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
This commit is contained in:
Wim Taymans 2009-05-20 18:45:45 +02:00 committed by Wim Taymans
parent 10ce6c6f6d
commit a6424471f1
2 changed files with 34 additions and 1 deletions

View file

@ -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,

View file

@ -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')