[Spice-devel] [spice-gtk PATCH v1 3/3] spice-pulse: compatibility with old pulse version

Victor Toso victortoso at redhat.com
Mon Apr 27 06:12:40 PDT 2015


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.
---
 gtk/spice-pulse.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

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;
-- 
2.1.0



More information about the Spice-devel mailing list