summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-05-20 18:45:45 +0200
committerWim Taymans <wim@metal.(none)>2009-05-21 22:05:11 +0200
commita6424471f14c9196533bb263aaf98e29eee5cba5 (patch)
tree29f6b0fed6b748ce2e9d8f16a08177a1b9f7e535
parent10ce6c6f6d6f7f1a41ae6cb0e431faffc93d4add (diff)
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
-rw-r--r--gst/qtdemux/qtdemux.c33
-rw-r--r--gst/qtdemux/qtdemux_fourcc.h2
2 files changed, 34 insertions, 1 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index e74712fe..8f800697 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 adae4fb9..a8193651 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')