[gst-cvs] gst-plugins-good: qtdemux: parse in24 boxes to get endianness

Wim Taymans wtay at kemper.freedesktop.org
Thu May 21 13:05:39 PDT 2009


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

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Wed May 20 18:45:45 2009 +0200

qtdemux: parse in24 boxes to get endianness

in24 samples are normally big-endian but an enda box can change this to
little-endian. Recurse into the in24 box and find the enda box so that we get
the endianness right.

Fixes #582515

---

 gst/qtdemux/qtdemux.c        |   33 ++++++++++++++++++++++++++++++++-
 gst/qtdemux/qtdemux_fourcc.h |    2 ++
 2 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index e74712f..8f80069 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -3131,6 +3131,11 @@ qtdemux_parse_node (GstQTDemux * qtdemux, GNode * node, guint8 * buffer,
           qtdemux_parse_container (qtdemux, node, buffer + offset, end);
         break;
       }
+      case FOURCC_in24:
+      {
+        qtdemux_parse_container (qtdemux, node, buffer + 0x34, end);
+        break;
+      }
       default:
         break;
     }
@@ -4235,6 +4240,30 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
     stream->caps = qtdemux_audio_caps (qtdemux, stream, fourcc, NULL, 0,
         &codec);
 
+    switch (fourcc) {
+      case FOURCC_in24:
+      {
+        GNode *enda;
+        GNode *in24;
+
+        in24 = qtdemux_tree_get_child_by_type (stsd, FOURCC_in24);
+
+        enda = qtdemux_tree_get_child_by_type (in24, FOURCC_enda);
+        if (!enda) {
+          wave = qtdemux_tree_get_child_by_type (in24, FOURCC_wave);
+          if (wave)
+            enda = qtdemux_tree_get_child_by_type (wave, FOURCC_enda);
+        }
+        if (enda) {
+          gst_caps_set_simple (stream->caps,
+              "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
+        }
+        break;
+      }
+      default:
+        break;
+    }
+
     if (codec) {
       list = gst_tag_list_new ();
       gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
@@ -5664,8 +5693,10 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
       caps = gst_caps_new_simple ("audio/x-raw-float", "width", G_TYPE_INT, 32,
           "endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
       break;
-    case GST_MAKE_FOURCC ('i', 'n', '2', '4'):
+    case FOURCC_in24:
       _codec ("Raw 24-bit PCM audio");
+      /* we assume BIG ENDIAN, an enda box will tell us to change this to little
+       * endian later */
       caps = gst_caps_new_simple ("audio/x-raw-int", "width", G_TYPE_INT, 24,
           "depth", G_TYPE_INT, 24,
           "endianness", G_TYPE_INT, G_BIG_ENDIAN,
diff --git a/gst/qtdemux/qtdemux_fourcc.h b/gst/qtdemux/qtdemux_fourcc.h
index adae4fb..a819365 100644
--- a/gst/qtdemux/qtdemux_fourcc.h
+++ b/gst/qtdemux/qtdemux_fourcc.h
@@ -125,6 +125,8 @@ G_BEGIN_DECLS
 #define FOURCC_twos     GST_MAKE_FOURCC('t','w','o','s')
 #define FOURCC_sowt     GST_MAKE_FOURCC('s','o','w','t')
 #define FOURCC_raw_     GST_MAKE_FOURCC('r','a','w',' ')
+#define FOURCC_in24     GST_MAKE_FOURCC('i','n','2','4')
+#define FOURCC_enda     GST_MAKE_FOURCC('e','n','d','a')
 #define FOURCC_QDM2     GST_MAKE_FOURCC('Q','D','M','2')
 #define FOURCC_alac     GST_MAKE_FOURCC('a','l','a','c')
 #define FOURCC_samr     GST_MAKE_FOURCC('s','a','m','r')





More information about the Gstreamer-commits mailing list