mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
qtdemux: get stsd child by index instead of type
There might be multiple children with the same type
This commit is contained in:
parent
21f532f1c6
commit
bd32bcc36c
1 changed files with 39 additions and 19 deletions
|
@ -94,6 +94,8 @@
|
||||||
#define QTDEMUX_SECONDS_FROM_1904_TO_1970 (((1970 - 1904) * (guint64) 365 + \
|
#define QTDEMUX_SECONDS_FROM_1904_TO_1970 (((1970 - 1904) * (guint64) 365 + \
|
||||||
QTDEMUX_LEAP_YEARS_FROM_1904_TO_1970) * QTDEMUX_SECONDS_PER_DAY)
|
QTDEMUX_LEAP_YEARS_FROM_1904_TO_1970) * QTDEMUX_SECONDS_PER_DAY)
|
||||||
|
|
||||||
|
#define QTDEMUX_TREE_NODE_FOURCC(n) (QT_FOURCC(((guint8 *) (n)->data) + 4))
|
||||||
|
|
||||||
#define STREAM_IS_EOS(s) (s->time_position == GST_CLOCK_TIME_NONE)
|
#define STREAM_IS_EOS(s) (s->time_position == GST_CLOCK_TIME_NONE)
|
||||||
|
|
||||||
#define ABSDIFF(x, y) ( (x) > (y) ? ((x) - (y)) : ((y) - (x)) )
|
#define ABSDIFF(x, y) ( (x) > (y) ? ((x) - (y)) : ((y) - (x)) )
|
||||||
|
@ -7540,6 +7542,12 @@ qtdemux_tree_get_child_by_type_full (GNode * node, guint32 fourcc,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GNode *
|
||||||
|
qtdemux_tree_get_child_by_index (GNode * node, guint index)
|
||||||
|
{
|
||||||
|
return g_node_nth_child (node, index);
|
||||||
|
}
|
||||||
|
|
||||||
static GNode *
|
static GNode *
|
||||||
qtdemux_tree_get_sibling_by_type_full (GNode * node, guint32 fourcc,
|
qtdemux_tree_get_sibling_by_type_full (GNode * node, guint32 fourcc,
|
||||||
GstByteReader * parser)
|
GstByteReader * parser)
|
||||||
|
@ -9881,10 +9889,16 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
colr = NULL;
|
colr = NULL;
|
||||||
fiel = NULL;
|
fiel = NULL;
|
||||||
/* pick 'the' stsd child */
|
/* pick 'the' stsd child */
|
||||||
if (!stream->protected)
|
mp4v = qtdemux_tree_get_child_by_index (stsd, 0);
|
||||||
mp4v = qtdemux_tree_get_child_by_type (stsd, fourcc);
|
if (!stream->protected) {
|
||||||
else
|
if (QTDEMUX_TREE_NODE_FOURCC (mp4v) != fourcc) {
|
||||||
mp4v = qtdemux_tree_get_child_by_type (stsd, FOURCC_encv);
|
mp4v = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (QTDEMUX_TREE_NODE_FOURCC (mp4v) != FOURCC_encv) {
|
||||||
|
mp4v = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mp4v) {
|
if (mp4v) {
|
||||||
esds = qtdemux_tree_get_child_by_type (mp4v, FOURCC_esds);
|
esds = qtdemux_tree_get_child_by_type (mp4v, FOURCC_esds);
|
||||||
|
@ -10200,7 +10214,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (qtdemux, "found mjp2");
|
GST_DEBUG_OBJECT (qtdemux, "found mjp2");
|
||||||
/* some required atoms */
|
/* some required atoms */
|
||||||
mjp2 = qtdemux_tree_get_child_by_type (stsd, FOURCC_mjp2);
|
mjp2 = qtdemux_tree_get_child_by_index (stsd, 0);
|
||||||
if (!mjp2)
|
if (!mjp2)
|
||||||
break;
|
break;
|
||||||
jp2h = qtdemux_tree_get_child_by_type (mjp2, FOURCC_jp2h);
|
jp2h = qtdemux_tree_get_child_by_type (mjp2, FOURCC_jp2h);
|
||||||
|
@ -10484,7 +10498,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
GNode *xith, *xdxt;
|
GNode *xith, *xdxt;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (qtdemux, "found XiTh");
|
GST_DEBUG_OBJECT (qtdemux, "found XiTh");
|
||||||
xith = qtdemux_tree_get_child_by_type (stsd, FOURCC_XiTh);
|
xith = qtdemux_tree_get_child_by_index (stsd, 0);
|
||||||
if (!xith)
|
if (!xith)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -10506,7 +10520,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (qtdemux, "parse ovc1 header");
|
GST_DEBUG_OBJECT (qtdemux, "parse ovc1 header");
|
||||||
ovc1 = qtdemux_tree_get_child_by_type (stsd, FOURCC_ovc1);
|
ovc1 = qtdemux_tree_get_child_by_index (stsd, 0);
|
||||||
if (!ovc1)
|
if (!ovc1)
|
||||||
break;
|
break;
|
||||||
ovc1_data = ovc1->data;
|
ovc1_data = ovc1->data;
|
||||||
|
@ -10754,7 +10768,6 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
}
|
}
|
||||||
case FOURCC_owma:
|
case FOURCC_owma:
|
||||||
{
|
{
|
||||||
GNode *owma;
|
|
||||||
const guint8 *owma_data;
|
const guint8 *owma_data;
|
||||||
const gchar *codec_name = NULL;
|
const gchar *codec_name = NULL;
|
||||||
guint owma_len;
|
guint owma_len;
|
||||||
|
@ -10776,10 +10789,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
WAVEFORMATEX *wfex;
|
WAVEFORMATEX *wfex;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (qtdemux, "parse owma");
|
GST_DEBUG_OBJECT (qtdemux, "parse owma");
|
||||||
owma = qtdemux_tree_get_child_by_type (stsd, FOURCC_owma);
|
owma_data = stsd_entry_data;
|
||||||
if (!owma)
|
|
||||||
break;
|
|
||||||
owma_data = owma->data;
|
|
||||||
owma_len = QT_UINT32 (owma_data);
|
owma_len = QT_UINT32 (owma_data);
|
||||||
if (owma_len <= 54) {
|
if (owma_len <= 54) {
|
||||||
GST_WARNING_OBJECT (qtdemux, "Too small owma header, skipping");
|
GST_WARNING_OBJECT (qtdemux, "Too small owma header, skipping");
|
||||||
|
@ -10926,7 +10936,6 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
}
|
}
|
||||||
case FOURCC_opus:
|
case FOURCC_opus:
|
||||||
{
|
{
|
||||||
GNode *opus;
|
|
||||||
const guint8 *opus_data;
|
const guint8 *opus_data;
|
||||||
guint8 *channel_mapping = NULL;
|
guint8 *channel_mapping = NULL;
|
||||||
guint32 rate;
|
guint32 rate;
|
||||||
|
@ -10936,8 +10945,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
guint8 coupled_count;
|
guint8 coupled_count;
|
||||||
guint8 i;
|
guint8 i;
|
||||||
|
|
||||||
opus = qtdemux_tree_get_child_by_type (stsd, FOURCC_opus);
|
opus_data = stsd_entry_data;
|
||||||
opus_data = opus->data;
|
|
||||||
|
|
||||||
channels = GST_READ_UINT8 (opus_data + 45);
|
channels = GST_READ_UINT8 (opus_data + 45);
|
||||||
rate = GST_READ_UINT32_LE (opus_data + 48);
|
rate = GST_READ_UINT32_LE (opus_data + 48);
|
||||||
|
@ -10977,10 +10985,22 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||||
GST_TAG_BITRATE, bitrate, NULL);
|
GST_TAG_BITRATE, bitrate, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream->protected && fourcc == FOURCC_mp4a)
|
mp4a = qtdemux_tree_get_child_by_index (stsd, 0);
|
||||||
mp4a = qtdemux_tree_get_child_by_type (stsd, FOURCC_enca);
|
if (!stream->protected) {
|
||||||
else
|
} else {
|
||||||
mp4a = qtdemux_tree_get_child_by_type (stsd, FOURCC_mp4a);
|
if (QTDEMUX_TREE_NODE_FOURCC (mp4v) != FOURCC_encv) {
|
||||||
|
mp4v = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stream->protected && fourcc == FOURCC_mp4a) {
|
||||||
|
if (QTDEMUX_TREE_NODE_FOURCC (mp4a) != FOURCC_enca) {
|
||||||
|
mp4a = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (QTDEMUX_TREE_NODE_FOURCC (mp4a) != FOURCC_mp4a) {
|
||||||
|
mp4a = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wave = NULL;
|
wave = NULL;
|
||||||
esds = NULL;
|
esds = NULL;
|
||||||
|
|
Loading…
Reference in a new issue