[Spice-devel] [PATCH spice-gtk 4/5] audio: use swapped channel handler for stop

Marc-André Lureau marcandre.lureau at redhat.com
Wed Apr 29 08:06:47 PDT 2015


We are going to reuse playback_stop() in following commit.
---
 gtk/spice-gstaudio.c | 7 +++----
 gtk/spice-pulse.c    | 5 ++---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/gtk/spice-gstaudio.c b/gtk/spice-gstaudio.c
index 892028c..f3c5c20 100644
--- a/gtk/spice-gstaudio.c
+++ b/gtk/spice-gstaudio.c
@@ -243,9 +243,8 @@ cleanup:
         gst_element_set_state(p->record.pipe, GST_STATE_PLAYING);
 }
 
-static void playback_stop(SpicePlaybackChannel *channel, gpointer data)
+static void playback_stop(SpiceGstaudio *gstaudio)
 {
-    SpiceGstaudio *gstaudio = data;
     SpiceGstaudioPrivate *p = gstaudio->priv;
 
     if (p->playback.pipe)
@@ -289,7 +288,7 @@ static void playback_start(SpicePlaybackChannel *channel, gint format, gint chan
     if (p->playback.pipe &&
         (p->playback.rate != frequency ||
          p->playback.channels != channels)) {
-        playback_stop(channel, data);
+        playback_stop(gstaudio);
         gst_object_unref(p->playback.pipe);
         p->playback.pipe = NULL;
     }
@@ -501,7 +500,7 @@ static gboolean connect_channel(SpiceAudio *audio, SpiceChannel *channel)
         spice_g_signal_connect_object(channel, "playback-data",
                                       G_CALLBACK(playback_data), gstaudio, 0);
         spice_g_signal_connect_object(channel, "playback-stop",
-                                      G_CALLBACK(playback_stop), gstaudio, 0);
+                                      G_CALLBACK(playback_stop), gstaudio, G_CONNECT_SWAPPED);
         spice_g_signal_connect_object(channel, "notify::volume",
                                       G_CALLBACK(playback_volume_changed), gstaudio, 0);
         spice_g_signal_connect_object(channel, "notify::mute",
diff --git a/gtk/spice-pulse.c b/gtk/spice-pulse.c
index dd7f309..36955de 100644
--- a/gtk/spice-pulse.c
+++ b/gtk/spice-pulse.c
@@ -448,9 +448,8 @@ static void playback_data(SpicePlaybackChannel *channel,
     p->playback.state = state;
 }
 
-static void playback_stop(SpicePlaybackChannel *channel, gpointer data)
+static void playback_stop(SpicePulse *pulse)
 {
-    SpicePulse *pulse = data;
     SpicePulsePrivate *p = pulse->priv;
 
     SPICE_DEBUG("%s: #underflow %u", __FUNCTION__, p->playback.num_underflow);
@@ -749,7 +748,7 @@ static gboolean connect_channel(SpiceAudio *audio, SpiceChannel *channel)
         spice_g_signal_connect_object(channel, "playback-data",
                                       G_CALLBACK(playback_data), pulse, 0);
         spice_g_signal_connect_object(channel, "playback-stop",
-                                      G_CALLBACK(playback_stop), pulse, 0);
+                                      G_CALLBACK(playback_stop), pulse, G_CONNECT_SWAPPED);
         spice_g_signal_connect_object(channel, "notify::volume",
                                       G_CALLBACK(playback_volume_changed), pulse, 0);
         spice_g_signal_connect_object(channel, "notify::mute",
-- 
2.1.0



More information about the Spice-devel mailing list