[Spice-commits] 3 commits - gtk/glib-compat.h gtk/spice-pulse.c

Victor Toso de Carvalho victortoso at kemper.freedesktop.org
Thu Apr 30 02:05:21 PDT 2015


 gtk/glib-compat.h |    4 ++++
 gtk/spice-pulse.c |   25 +++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

New commits:
commit 0a50d2c1aca61772b6522b74eb2324fd5378a60e
Author: Victor Toso <victortoso at redhat.com>
Date:   Mon Apr 27 14:48:46 2015 +0200

    spice-pulse: compatibility with old pulse version
    
    The commit 37ba949716ebf441110330 breaks compatibility with old versions
    of libpulse as the volume and mute data in pa_source_output_info were
    available only from version 1.0.0 onwards. Using other API function for
    this which does not relay on audio per stream.

diff --git a/gtk/spice-pulse.c b/gtk/spice-pulse.c
index 54ac9ad..916f1d0 100644
--- a/gtk/spice-pulse.c
+++ b/gtk/spice-pulse.c
@@ -1098,10 +1098,17 @@ static void stream_restore_read_cb(pa_context *context,
     pstream->info.volume = info->volume;
 }
 
+#if PA_CHECK_VERSION(1,0,0)
 static void source_output_info_cb(pa_context *context,
                                   const pa_source_output_info *info,
                                   int eol,
                                   void *userdata)
+#else
+static void source_info_cb(pa_context *context,
+                           const pa_source_info *info,
+                           int eol,
+                           void *userdata)
+#endif
 {
     struct async_task *task = userdata;
     SpicePulsePrivate *p = task->pulse->priv;
@@ -1198,10 +1205,17 @@ static void pulse_stream_restore_info_async(gboolean is_playback,
             pa_stream_get_index(p->record.stream) != PA_INVALID_INDEX) {
         SPICE_DEBUG("Record stream is created - get-source-output-info");
         p->record.info_updated = FALSE;
+#if PA_CHECK_VERSION(1,0,0)
         op = pa_context_get_source_output_info(p->context,
                                                pa_stream_get_index(p->record.stream),
                                                source_output_info_cb,
                                                task);
+#else
+        op = pa_context_get_source_info_by_index(p->context,
+                                                 pa_stream_get_device_index(p->record.stream),
+                                                 source_info_cb,
+                                                 task);
+#endif
         if (!op)
             goto fail;
         task->pa_op = op;
commit 60a8a3543c9206727a907d0db42c1870dbd21a37
Author: Victor Toso <victortoso at redhat.com>
Date:   Mon Apr 27 14:18:06 2015 +0200

    spice-pulse: GSimpleAsyncResult compatibility
    
    Avoid breaking build with glib older then 2.32 which is when
    g_simple_async_result_set_check_cancellable was introduced.

diff --git a/gtk/spice-pulse.c b/gtk/spice-pulse.c
index f101b0c..54ac9ad 100644
--- a/gtk/spice-pulse.c
+++ b/gtk/spice-pulse.c
@@ -22,6 +22,7 @@
 #include "spice-session-priv.h"
 #include "spice-channel-priv.h"
 #include "spice-util-priv.h"
+#include "glib-compat.h"
 
 #include <pulse/glib-mainloop.h>
 #include <pulse/pulseaudio.h>
@@ -979,6 +980,14 @@ static void cancel_task(GCancellable *cancellable, gpointer user_data)
         task->pulse->priv->pending_restore_task = NULL;
     }
 
+#if !GLIB_CHECK_VERSION(2,32,0)
+    /* g_simple_async_result_set_check_cancellable is not present. Set an error
+     * in the GSimpleAsyncResult in case of _finish functions is called */
+    g_simple_async_result_set_error(task->res,
+                                    SPICE_CLIENT_ERROR,
+                                    SPICE_CLIENT_ERROR_FAILED,
+                                    "Operation was cancelled");
+#endif
     /* FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=705395
      * Free the memory in idle */
     g_idle_add(free_async_task, task);
@@ -1148,7 +1157,9 @@ static void pulse_stream_restore_info_async(gboolean is_playback,
                                        callback,
                                        user_data,
                                        pulse_stream_restore_info_async);
+#if GLIB_CHECK_VERSION(2,32,0)
     g_simple_async_result_set_check_cancellable (simple, cancellable);
+#endif
 
     task->res = simple;
     task->pulse = g_object_ref(audio);
commit bac48297211258b6527ef03d71fee4c275d779b8
Author: Victor Toso <victortoso at redhat.com>
Date:   Mon Apr 27 11:54:38 2015 +0200

    glib-compat: add G_SOURCE_REMOVE G_SOURCE_CONTINUE

diff --git a/gtk/glib-compat.h b/gtk/glib-compat.h
index 8828599..5491fe4 100644
--- a/gtk/glib-compat.h
+++ b/gtk/glib-compat.h
@@ -32,6 +32,10 @@ GType spice_main_context_get_type (void) G_GNUC_CONST;
 
 #if !GLIB_CHECK_VERSION(2,32,0)
 # define G_SIGNAL_DEPRECATED (1 << 9)
+
+#define G_SOURCE_CONTINUE   TRUE
+#define G_SOURCE_REMOVE     FALSE
+
 void
 g_queue_free_full (GQueue        *queue,
                    GDestroyNotify  free_func);


More information about the Spice-commits mailing list