update for ringbuffer change
[platform/upstream/gstreamer.git] / ext / pulse / pulsesrc.c
index 1750704..7a0b7e4 100644 (file)
@@ -83,7 +83,7 @@ static gboolean gst_pulsesrc_open (GstAudioSrc * asrc);
 static gboolean gst_pulsesrc_close (GstAudioSrc * asrc);
 
 static gboolean gst_pulsesrc_prepare (GstAudioSrc * asrc,
-    GstRingBufferSpec * spec);
+    GstAudioRingBufferSpec * spec);
 
 static gboolean gst_pulsesrc_unprepare (GstAudioSrc * asrc);
 
@@ -99,37 +99,16 @@ static GstStateChangeReturn gst_pulsesrc_change_state (GstElement *
     element, GstStateChange transition);
 
 #if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
-# define ENDIANNESS   "LITTLE_ENDIAN, BIG_ENDIAN"
+# define FORMATS "{ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, U8 }"
 #else
-# define ENDIANNESS   "BIG_ENDIAN, LITTLE_ENDIAN"
+# define FORMATS "{ S16BE, S16LE, F32BE, F32LE, S32BE, S32LE, U8 }"
 #endif
 
 static GstStaticPadTemplate pad_template = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-int, "
-        "endianness = (int) { " ENDIANNESS " }, "
-        "signed = (boolean) TRUE, "
-        "width = (int) 16, "
-        "depth = (int) 16, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, 32 ];"
-        "audio/x-raw-float, "
-        "endianness = (int) { " ENDIANNESS " }, "
-        "width = (int) 32, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, 32 ];"
-        "audio/x-raw-int, "
-        "endianness = (int) { " ENDIANNESS " }, "
-        "signed = (boolean) TRUE, "
-        "width = (int) 32, "
-        "depth = (int) 32, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, 32 ];"
-        "audio/x-raw-int, "
-        "signed = (boolean) FALSE, "
-        "width = (int) 8, "
-        "depth = (int) 8, "
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "format = (string) " FORMATS ", "
         "rate = (int) [ 1, MAX ], "
         "channels = (int) [ 1, 32 ];"
         "audio/x-alaw, "
@@ -831,12 +810,12 @@ gst_pulsesrc_create_stream (GstPulseSrc * pulsesrc, GstCaps * caps)
   pa_channel_map channel_map;
   GstStructure *s;
   gboolean need_channel_layout = FALSE;
-  GstRingBufferSpec spec;
+  GstAudioRingBufferSpec spec;
   const gchar *name;
 
-  memset (&spec, 0, sizeof (GstRingBufferSpec));
+  memset (&spec, 0, sizeof (GstAudioRingBufferSpec));
   spec.latency_time = GST_SECOND;
-  if (!gst_ring_buffer_parse_caps (&spec, caps))
+  if (!gst_audio_ring_buffer_parse_caps (&spec, caps))
     goto invalid_caps;
 
   /* Keep the refcount of the caps at 1 to make them writable */
@@ -853,9 +832,9 @@ gst_pulsesrc_create_stream (GstPulseSrc * pulsesrc, GstCaps * caps)
   s = gst_caps_get_structure (caps, 0);
   if (!gst_structure_has_field (s, "channel-layout") ||
       !gst_pulse_gst_to_channel_map (&channel_map, &spec)) {
-    if (spec.channels == 1)
+    if (spec.info.channels == 1)
       pa_channel_map_init_mono (&channel_map);
-    else if (spec.channels == 2)
+    else if (spec.info.channels == 2)
       pa_channel_map_init_stereo (&channel_map);
     else
       need_channel_layout = TRUE;
@@ -973,7 +952,7 @@ gst_pulsesrc_negotiate (GstBaseSrc * basesrc)
 
     /* now fixate */
     if (!gst_caps_is_empty (caps)) {
-      gst_pad_fixate_caps (GST_BASE_SRC_PAD (basesrc), caps);
+      GST_BASE_SRC_CLASS (parent_class)->fixate (basesrc, caps);
       GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps);
 
       if (gst_caps_is_any (caps)) {
@@ -1001,7 +980,7 @@ no_nego_needed:
 }
 
 static gboolean
-gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
+gst_pulsesrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
 {
   pa_buffer_attr wanted;
   const pa_buffer_attr *actual;