summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/out/ao.h2
-rw-r--r--audio/out/ao_pulse.c13
-rw-r--r--mpvcore/player/audio.c1
-rw-r--r--mpvcore/player/misc.c26
-rw-r--r--mpvcore/player/mp_core.h3
-rw-r--r--mpvcore/player/osd.c2
-rw-r--r--mpvcore/player/video.c2
7 files changed, 39 insertions, 10 deletions
diff --git a/audio/out/ao.h b/audio/out/ao.h
index 7e7b6968bb..c6ad5455d2 100644
--- a/audio/out/ao.h
+++ b/audio/out/ao.h
@@ -34,6 +34,8 @@ enum aocontrol {
// _MUTE commands take a pointer to bool
AOCONTROL_GET_MUTE,
AOCONTROL_SET_MUTE,
+ // Has char* as argument, which contains the desired stream title.
+ AOCONTROL_UPDATE_STREAM_TITLE,
};
#define AOPLAY_FINAL_CHUNK 1
diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c
index 9d86cddd6d..a4da2a179b 100644
--- a/audio/out/ao_pulse.c
+++ b/audio/out/ao_pulse.c
@@ -582,6 +582,19 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
pa_threaded_mainloop_unlock(priv->mainloop);
return CONTROL_OK;
}
+
+ case AOCONTROL_UPDATE_STREAM_TITLE: {
+ char *title = (char *)arg;
+ pa_threaded_mainloop_lock(priv->mainloop);
+ if (!waitop(priv, pa_stream_set_name(priv->stream, title,
+ success_cb, ao)))
+ {
+ GENERIC_ERR_MSG("pa_stream_set_name() failed");
+ return CONTROL_ERROR;
+ }
+ return CONTROL_OK;
+ }
+
default:
return CONTROL_UNKNOWN;
}
diff --git a/mpvcore/player/audio.c b/mpvcore/player/audio.c
index e89e22c208..e0c35c628e 100644
--- a/mpvcore/player/audio.c
+++ b/mpvcore/player/audio.c
@@ -152,6 +152,7 @@ void reinit_audio_chain(struct MPContext *mpctx)
MP_INFO(mpctx, "AO: [%s] %s\n", ao->driver->name, s);
talloc_free(s);
MP_VERBOSE(mpctx, "AO: Description: %s\n", ao->driver->description);
+ update_window_title(mpctx, true);
}
if (recreate_audio_filters(mpctx) < 0)
diff --git a/mpvcore/player/misc.c b/mpvcore/player/misc.c
index b1853bcfa0..be42d76447 100644
--- a/mpvcore/player/misc.c
+++ b/mpvcore/player/misc.c
@@ -34,6 +34,7 @@
#include "mpvcore/encode.h"
#include "mpvcore/input/input.h"
+#include "audio/out/ao.h"
#include "stream/stream.h"
#include "video/out/vo.h"
@@ -128,17 +129,28 @@ bool mp_get_cache_idle(struct MPContext *mpctx)
return idle;
}
-void update_vo_window_title(struct MPContext *mpctx)
+void update_window_title(struct MPContext *mpctx, bool force)
{
- if (!mpctx->video_out)
+ if (!mpctx->video_out && !mpctx->ao) {
+ talloc_free(mpctx->last_window_title);
+ mpctx->last_window_title = false;
return;
+ }
char *title = mp_property_expand_string(mpctx, mpctx->opts->wintitle);
- if (!mpctx->video_out->window_title ||
- strcmp(title, mpctx->video_out->window_title))
+ if (!mpctx->last_window_title || force ||
+ strcmp(title, mpctx->last_window_title) != 0)
{
- talloc_free(mpctx->video_out->window_title);
- mpctx->video_out->window_title = talloc_steal(mpctx, title);
- vo_control(mpctx->video_out, VOCTRL_UPDATE_WINDOW_TITLE, title);
+ talloc_free(mpctx->last_window_title);
+ mpctx->last_window_title = talloc_steal(mpctx, title);
+
+ if (mpctx->video_out) {
+ mpctx->video_out->window_title = talloc_strdup(mpctx->video_out, title);
+ vo_control(mpctx->video_out, VOCTRL_UPDATE_WINDOW_TITLE, title);
+ }
+
+ if (mpctx->ao) {
+ ao_control(mpctx->ao, AOCONTROL_UPDATE_STREAM_TITLE, title);
+ }
} else {
talloc_free(title);
}
diff --git a/mpvcore/player/mp_core.h b/mpvcore/player/mp_core.h
index 3f20f9ab2e..4dcb218a80 100644
--- a/mpvcore/player/mp_core.h
+++ b/mpvcore/player/mp_core.h
@@ -153,6 +153,7 @@ typedef struct MPContext {
struct osd_state *osd;
struct mp_osd_msg *osd_msg_stack;
char *terminal_osd_text;
+ char *last_window_title;
int add_osd_seek_info; // bitfield of enum mp_osd_seek_info
double osd_visible; // for the osd bar only
@@ -377,7 +378,7 @@ double get_play_end_pts(struct MPContext *mpctx);
double get_relative_time(struct MPContext *mpctx);
int mp_get_cache_percent(struct MPContext *mpctx);
bool mp_get_cache_idle(struct MPContext *mpctx);
-void update_vo_window_title(struct MPContext *mpctx);
+void update_window_title(struct MPContext *mpctx, bool force);
void stream_dump(struct MPContext *mpctx);
// osd.c
diff --git a/mpvcore/player/osd.c b/mpvcore/player/osd.c
index a6cfbcb5bc..03c7c339b7 100644
--- a/mpvcore/player/osd.c
+++ b/mpvcore/player/osd.c
@@ -87,7 +87,7 @@ void print_status(struct MPContext *mpctx)
struct MPOpts *opts = mpctx->opts;
sh_video_t * const sh_video = mpctx->sh_video;
- update_vo_window_title(mpctx);
+ update_window_title(mpctx, false);
if (opts->quiet)
return;
diff --git a/mpvcore/player/video.c b/mpvcore/player/video.c
index 8f57bd97ad..aec5d1c703 100644
--- a/mpvcore/player/video.c
+++ b/mpvcore/player/video.c
@@ -125,7 +125,7 @@ int reinit_video_chain(struct MPContext *mpctx)
sh_video->hwdec_info = talloc_zero(sh_video, struct mp_hwdec_info);
vo_control(mpctx->video_out, VOCTRL_GET_HWDEC_INFO, sh_video->hwdec_info);
- update_vo_window_title(mpctx);
+ update_window_title(mpctx, true);
if (stream_control(mpctx->sh_video->gsh->demuxer->stream,
STREAM_CTRL_GET_ASPECT_RATIO, &ar) != STREAM_UNSUPPORTED)