[gst-cvs] gst-plugins-good: matroskamux: Only accept raw aac

Thiago Sousa Santos thiagoss at kemper.freedesktop.org
Mon Jan 11 07:34:36 PST 2010


Module: gst-plugins-good
Branch: master
Commit: 1314853210d66959f8c09447ec9278fe645d104c
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=1314853210d66959f8c09447ec9278fe645d104c

Author: Thiago Santos <thiago.sousa.santos at collabora.co.uk>
Date:   Mon Jan 11 12:07:29 2010 -0300

matroskamux: Only accept raw aac

makes matroskamux reject aac streams that are not
in raw format (stream-format=none)

Fixes #598350

---

 gst/matroska/matroska-mux.c |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c
index e59faab..fa45637 100644
--- a/gst/matroska/matroska-mux.c
+++ b/gst/matroska/matroska-mux.c
@@ -136,6 +136,7 @@ static GstStaticPadTemplate audiosink_templ =
     GST_STATIC_CAPS ("audio/mpeg, "
         "mpegversion = (int) 1, "
         "layer = (int) [ 1, 3 ], "
+        "stream-format = (string) { none }, "
         COMMON_AUDIO_CAPS "; "
         "audio/mpeg, "
         "mpegversion = (int) { 2, 4 }, "
@@ -1426,6 +1427,7 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
   GstStructure *structure;
   const GValue *codec_data = NULL;
   const GstBuffer *buf = NULL;
+  const gchar *stream_format = NULL;
 
   mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
 
@@ -1504,20 +1506,30 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
         break;
       }
       case 2:
-        if (buf) {
-          context->codec_id =
-              g_strdup_printf (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG2 "%s",
-              aac_codec_data_to_codec_id (buf));
+      case 4:
+        stream_format = gst_structure_get_string (structure, "stream-format");
+        /* check this is raw aac */
+        if (stream_format) {
+          if (strcmp (stream_format, "none") != 0) {
+            GST_WARNING_OBJECT (mux, "AAC stream-format must be 'none', not %s",
+                stream_format);
+          }
         } else {
-          GST_DEBUG_OBJECT (mux, "no AAC codec_data; not packetized");
-          return FALSE;
+          GST_WARNING_OBJECT (mux, "AAC stream-format not specified, "
+              "assuming 'none'");
         }
-        break;
-      case 4:
+
         if (buf) {
-          context->codec_id =
-              g_strdup_printf (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4 "%s",
-              aac_codec_data_to_codec_id (buf));
+          if (mpegversion == 2)
+            context->codec_id =
+                g_strdup_printf (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG2 "%s",
+                aac_codec_data_to_codec_id (buf));
+          else if (mpegversion == 4)
+            context->codec_id =
+                g_strdup_printf (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4 "%s",
+                aac_codec_data_to_codec_id (buf));
+          else
+            g_assert_not_reached ();
         } else {
           GST_DEBUG_OBJECT (mux, "no AAC codec_data; not packetized");
           return FALSE;





More information about the Gstreamer-commits mailing list