changeset 36362:99708d402208

Pass playing filename to audio outputs. Use it in pulseaudio to set the stream name.
author reimar
date Sun, 22 Sep 2013 09:03:30 +0000
parents 0caa0bf428b9
children c3aaaf17c721
files libao2/ao_pulse.c libao2/audio_out.h mplayer.c
diffstat 3 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_pulse.c	Sun Sep 22 08:34:08 2013 +0000
+++ b/libao2/ao_pulse.c	Sun Sep 22 09:03:30 2013 +0000
@@ -379,6 +379,13 @@
 
 static int control(int cmd, void *arg) {
     switch (cmd) {
+        case AOCONTROL_FILENAME:
+            pa_threaded_mainloop_lock(mainloop);
+            if (!waitop(pa_stream_set_name(stream, arg, success_cb, NULL))) {
+                GENERIC_ERR_MSG(context, "pa_stream_set_name() failed");
+                return CONTROL_ERROR;
+            }
+            return CONTROL_OK;
         case AOCONTROL_GET_VOLUME: {
             ao_control_vol_t *vol = arg;
             uint32_t devidx = pa_stream_get_index(stream);
--- a/libao2/audio_out.h	Sun Sep 22 08:34:08 2013 +0000
+++ b/libao2/audio_out.h	Sun Sep 22 09:03:30 2013 +0000
@@ -82,6 +82,7 @@
 #define AOCONTROL_SET_VOLUME 5
 #define AOCONTROL_SET_PLUGIN_DRIVER 6
 #define AOCONTROL_SET_PLUGIN_LIST 7
+#define AOCONTROL_FILENAME 8
 
 #define AOPLAY_FINAL_CHUNK 1
 
--- a/mplayer.c	Sun Sep 22 08:34:08 2013 +0000
+++ b/mplayer.c	Sun Sep 22 09:03:30 2013 +0000
@@ -3648,6 +3648,8 @@
             reinit_audio_chain();
             if (mpctx->sh_audio && mpctx->sh_audio->codec)
                 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_CODEC=%s\n", mpctx->sh_audio->codec->name);
+            if (mpctx->audio_out)
+                mpctx->audio_out->control(AOCONTROL_FILENAME, (void *)mp_basename(filename));
         }
 
         current_module = "av_init";