ringbuffer: Add support for MPEG audio buffers
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 14 Mar 2011 10:21:40 +0000 (15:51 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Sat, 14 May 2011 12:51:16 +0000 (18:21 +0530)
gst-libs/gst/audio/gstringbuffer.c

index a2a863b..d0a6f7e 100644 (file)
@@ -446,6 +446,19 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
     spec->width = 16;
     spec->depth = 16;
     spec->channels = 2;
+  } else if (!strncmp (mimetype, "audio/mpeg", 10) &&
+      gst_structure_get_int (structure, "mpegaudioversion", &i) &&
+      (i == 1 || i == 2)) {
+    /* Now we know this is MPEG-1 or MPEG-2 (non AAC) */
+    /* extract the needed information from the cap */
+    if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
+      goto parse_error;
+
+    spec->type = GST_BUFTYPE_MPEG;
+    spec->format = GST_MPEG;
+    spec->width = 16;
+    spec->depth = 16;
+    spec->channels = 2;
   } else {
     goto parse_error;
   }