rename stream names too, when the sink name changes
authorLennart Poettering <lennart@poettering.net>
Tue, 30 Oct 2007 02:35:00 +0000 (02:35 +0000)
committerLennart Poettering <lennart@poettering.net>
Tue, 30 Oct 2007 02:35:00 +0000 (02:35 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1997 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/modules/module-tunnel.c

index 485b6f3..edc03c9 100644 (file)
@@ -575,13 +575,15 @@ static pa_usec_t source_get_latency(pa_source *s) {
 
 static void update_description(struct userdata *u) {
     char *d;
+    char un[128], hn[128];
+    pa_tagstruct *t;
 
     pa_assert(u);
 
     if (!u->server_fqdn || !u->user_name || !u->device_description)
         return;
 
-    d = pa_sprintf_malloc("%s's %s on %s", u->user_name, u->device_description, u->server_fqdn);
+    d = pa_sprintf_malloc("%s on %s@%s", u->device_description, u->user_name, u->server_fqdn);
 
 #ifdef TUNNEL_SINK
     pa_sink_set_description(u->sink, d);
@@ -590,6 +592,23 @@ static void update_description(struct userdata *u) {
 #endif
 
     pa_xfree(d);
+
+    d = pa_sprintf_malloc("%s for %s@%s", u->device_description,
+                          pa_get_user_name(un, sizeof(un)),
+                          pa_get_host_name(hn, sizeof(hn)));
+
+    t = pa_tagstruct_new(NULL, 0);
+#ifdef TUNNEL_SINK
+    pa_tagstruct_putu32(t, PA_COMMAND_SET_PLAYBACK_STREAM_NAME);
+#else
+    pa_tagstruct_putu32(t, PA_COMMAND_SET_RECORD_STREAM_NAME);
+#endif
+    pa_tagstruct_putu32(t, u->ctag++);
+    pa_tagstruct_putu32(t, u->channel);
+    pa_tagstruct_puts(t, d);
+    pa_pstream_send_tagstruct(u->pstream, t);
+
+    pa_xfree(d);
 }
 
 static void server_info_cb(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -989,15 +1008,15 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
     }
 
 #ifdef TUNNEL_SINK
-    pa_snprintf(name, sizeof(name), "%s@%s",
-             pa_get_user_name(un, sizeof(un)),
-             pa_get_host_name(hn, sizeof(hn)),
-             u->sink->name);
+    pa_snprintf(name, sizeof(name), "%s for %s@%s",
+                u->sink_name,
+                pa_get_user_name(un, sizeof(un)),
+                pa_get_host_name(hn, sizeof(hn)));
 #else
-    pa_snprintf(name, sizeof(name), "%s@%s",
-             pa_get_user_name(un, sizeof(un)),
-             pa_get_host_name(hn, sizeof(hn)),
-             u->source->name);
+    pa_snprintf(name, sizeof(name), "%s for %s@%s",
+                u->source_name,
+                pa_get_user_name(un, sizeof(un)),
+                pa_get_host_name(hn, sizeof(hn)));
 #endif
 
     reply = pa_tagstruct_new(NULL, 0);