pulsesink: Make 2.0 dependency optional
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Thu, 13 Jun 2013 07:10:15 +0000 (12:40 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Thu, 13 Jun 2013 07:14:32 +0000 (12:44 +0530)
The getcaps function we added uses some pa_format_info_get_prop...
accessor functions that were only added in 2.0, so we only have our
getcaps implementation exist if we're compiling against libpulse 2.0 or
above.

Eventually, we could bump the minimum requirement to 2.0 or above.

https://bugzilla.gnome.org/show_bug.cgi?id=686459

configure.ac
ext/pulse/pulsesink.c
ext/pulse/pulseutil.c

index 8f398c2..e599a71 100644 (file)
@@ -813,6 +813,11 @@ AG_GST_CHECK_FEATURE(PULSE, [pulseaudio plug-in], pulseaudio, [
   AC_CHECK_HEADERS([process.h])
 
   AG_GST_PKG_CHECK_MODULES(PULSE, libpulse >= 1.0)
+  AG_GST_PKG_CHECK_MODULES(PULSE_2_0, libpulse >= 2.0)
+  if test x$HAVE_PULSE_2_0 = xyes; then
+    AC_DEFINE(HAVE_PULSE_2_0, 1, [defined if pulseaudio >= 2.0 is available])
+  fi
+
 ])
 
 dnl *** dv1394 ***
index cd257d6..a7008ad 100644 (file)
@@ -2016,6 +2016,7 @@ done:
   pa_threaded_mainloop_signal (mainloop, 0);
 }
 
+#ifdef HAVE_PULSE_2_0
 static gboolean
 gst_pulse_format_info_int_prop_to_value (pa_format_info * format,
     const char *key, GValue * value)
@@ -2125,6 +2126,7 @@ gst_pulse_format_info_to_caps (pa_format_info * format)
 out:
   return ret;
 }
+#endif
 
 /* Call with mainloop lock held */
 static pa_stream *
@@ -2162,6 +2164,7 @@ error:
   return NULL;
 }
 
+#ifdef HAVE_PULSE_2_0
 static GstCaps *
 gst_pulsesink_query_getcaps (GstPulseSink * psink, GstCaps * filter)
 {
@@ -2274,6 +2277,7 @@ info_failed:
     goto unlock;
   }
 }
+#endif
 
 static gboolean
 gst_pulsesink_query_acceptcaps (GstPulseSink * psink, GstCaps * caps)
@@ -3125,6 +3129,7 @@ gst_pulsesink_query (GstBaseSink * sink, GstQuery * query)
   gboolean ret;
 
   switch (GST_QUERY_TYPE (query)) {
+#ifdef HAVE_PULSE_2_0
     case GST_QUERY_CAPS:
     {
       GstCaps *caps, *filter;
@@ -3140,6 +3145,7 @@ gst_pulsesink_query (GstBaseSink * sink, GstQuery * query)
         return FALSE;
       }
     }
+#endif
     case GST_QUERY_ACCEPT_CAPS:
     {
       GstCaps *caps;
index a232c6e..b8abf00 100644 (file)
@@ -191,6 +191,7 @@ fail:
   return FALSE;
 }
 
+#ifdef HAVE_PULSE_2_0
 const char *
 gst_pulse_sample_format_to_caps_format (pa_sample_format_t sf)
 {
@@ -232,6 +233,7 @@ gst_pulse_sample_format_to_caps_format (pa_sample_format_t sf)
       return NULL;
   }
 }
+#endif
 
 /* PATH_MAX is not defined everywhere, e.g. on GNU Hurd */
 #ifndef PATH_MAX