mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
qtdemux: Switch from QtAtomParser to GstByteReader
This commit is contained in:
parent
5d41590601
commit
9e49197208
5 changed files with 191 additions and 201 deletions
|
@ -1,5 +1,6 @@
|
|||
/* GStreamer QuickTime atom parser
|
||||
* Copyright (C) 2009 Tim-Philipp Müller <tim centricular net>
|
||||
* Copyright (C) <2009> STEricsson <benjamin.gaignard@stericsson.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -24,20 +25,15 @@
|
|||
|
||||
/* our inlined version of GstByteReader */
|
||||
|
||||
typedef GstByteReader QtAtomParser;
|
||||
|
||||
#define qt_atom_parser_init gst_byte_reader_init
|
||||
#define qt_atom_parser_get_remaining gst_byte_reader_get_remaining
|
||||
|
||||
static inline gboolean
|
||||
qt_atom_parser_has_remaining (QtAtomParser * parser, guint64 bytes_needed)
|
||||
qt_atom_parser_has_remaining (GstByteReader * parser, guint64 bytes_needed)
|
||||
{
|
||||
return G_LIKELY (parser->size >= bytes_needed) &&
|
||||
G_LIKELY ((parser->size - bytes_needed) >= parser->byte);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
qt_atom_parser_has_chunks (QtAtomParser * parser, guint32 n_chunks,
|
||||
qt_atom_parser_has_chunks (GstByteReader * parser, guint32 n_chunks,
|
||||
guint32 chunk_size)
|
||||
{
|
||||
/* assumption: n_chunks and chunk_size are 32-bit, we cast to 64-bit here
|
||||
|
@ -45,104 +41,76 @@ qt_atom_parser_has_chunks (QtAtomParser * parser, guint32 n_chunks,
|
|||
return qt_atom_parser_has_remaining (parser, (guint64) n_chunks * chunk_size);
|
||||
}
|
||||
|
||||
#define qt_atom_parser_skip gst_byte_reader_skip
|
||||
#define qt_atom_parser_skip_unchecked gst_byte_reader_skip_unchecked
|
||||
|
||||
#define qt_atom_parser_get_uint8 gst_byte_reader_get_uint8
|
||||
#define qt_atom_parser_get_uint16 gst_byte_reader_get_uint16_be
|
||||
#define qt_atom_parser_get_uint24 gst_byte_reader_get_uint24_be
|
||||
#define qt_atom_parser_get_uint32 gst_byte_reader_get_uint32_be
|
||||
#define qt_atom_parser_get_uint64 gst_byte_reader_get_uint64_be
|
||||
|
||||
#define qt_atom_parser_peek_uint8 gst_byte_reader_peek_uint8
|
||||
#define qt_atom_parser_peek_uint16 gst_byte_reader_peek_uint16_be
|
||||
#define qt_atom_parser_peek_uint24 gst_byte_reader_peek_uint24_be
|
||||
#define qt_atom_parser_peek_uint32 gst_byte_reader_peek_uint32_be
|
||||
#define qt_atom_parser_peek_uint64 gst_byte_reader_peek_uint64_be
|
||||
|
||||
#define qt_atom_parser_get_uint8_unchecked gst_byte_reader_get_uint8_unchecked
|
||||
#define qt_atom_parser_get_uint16_unchecked gst_byte_reader_get_uint16_be_unchecked
|
||||
#define qt_atom_parser_get_uint24_unchecked gst_byte_reader_get_uint24_be_unchecked
|
||||
#define qt_atom_parser_get_uint32_unchecked gst_byte_reader_get_uint32_be_unchecked
|
||||
#define qt_atom_parser_get_uint64_unchecked gst_byte_reader_get_uint64_be_unchecked
|
||||
|
||||
#define qt_atom_parser_peek_uint8_unchecked gst_byte_reader_peek_uint8_unchecked
|
||||
#define qt_atom_parser_peek_uint16_unchecked gst_byte_reader_peek_uint16_be_unchecked
|
||||
#define qt_atom_parser_peek_uint24_unchecked gst_byte_reader_peek_uint24_be_unchecked
|
||||
#define qt_atom_parser_peek_uint32_unchecked gst_byte_reader_peek_uint32_be_unchecked
|
||||
#define qt_atom_parser_peek_uint64_unchecked gst_byte_reader_peek_uint64_be_unchecked
|
||||
|
||||
#define qt_atom_parser_peek_bytes_unchecked gst_byte_reader_peek_data_unchecked
|
||||
|
||||
static inline gboolean
|
||||
qt_atom_parser_peek_sub (QtAtomParser * parser, guint offset, guint size,
|
||||
QtAtomParser * sub)
|
||||
qt_atom_parser_peek_sub (GstByteReader * parser, guint offset, guint size,
|
||||
GstByteReader * sub)
|
||||
{
|
||||
*sub = *parser;
|
||||
|
||||
if (G_UNLIKELY (!qt_atom_parser_skip (sub, offset)))
|
||||
if (G_UNLIKELY (!gst_byte_reader_skip (sub, offset)))
|
||||
return FALSE;
|
||||
|
||||
return (qt_atom_parser_get_remaining (sub) >= size);
|
||||
return (gst_byte_reader_get_remaining (sub) >= size);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
qt_atom_parser_skipn_and_get_uint32 (QtAtomParser * parser,
|
||||
qt_atom_parser_skipn_and_get_uint32 (GstByteReader * parser,
|
||||
guint bytes_to_skip, guint32 * val)
|
||||
{
|
||||
if (G_UNLIKELY (qt_atom_parser_get_remaining (parser) < (bytes_to_skip + 4)))
|
||||
if (G_UNLIKELY (gst_byte_reader_get_remaining (parser) < (bytes_to_skip + 4)))
|
||||
return FALSE;
|
||||
|
||||
qt_atom_parser_skip_unchecked (parser, bytes_to_skip);
|
||||
*val = qt_atom_parser_get_uint32_unchecked (parser);
|
||||
gst_byte_reader_skip_unchecked (parser, bytes_to_skip);
|
||||
*val = gst_byte_reader_get_uint32_be_unchecked (parser);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* off_size must be either 4 or 8 */
|
||||
static inline gboolean
|
||||
qt_atom_parser_get_offset (QtAtomParser * parser, guint off_size, guint64 * val)
|
||||
qt_atom_parser_get_offset (GstByteReader * parser, guint off_size,
|
||||
guint64 * val)
|
||||
{
|
||||
if (G_UNLIKELY (qt_atom_parser_get_remaining (parser) < off_size))
|
||||
if (G_UNLIKELY (gst_byte_reader_get_remaining (parser) < off_size))
|
||||
return FALSE;
|
||||
|
||||
if (off_size == sizeof (guint64)) {
|
||||
*val = qt_atom_parser_get_uint64_unchecked (parser);
|
||||
*val = gst_byte_reader_get_uint64_be_unchecked (parser);
|
||||
} else {
|
||||
*val = qt_atom_parser_get_uint32_unchecked (parser);
|
||||
*val = gst_byte_reader_get_uint32_be_unchecked (parser);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* off_size must be either 4 or 8 */
|
||||
static inline guint64
|
||||
qt_atom_parser_get_offset_unchecked (QtAtomParser * parser, guint off_size)
|
||||
qt_atom_parser_get_offset_unchecked (GstByteReader * parser, guint off_size)
|
||||
{
|
||||
if (off_size == sizeof (guint64)) {
|
||||
return qt_atom_parser_get_uint64_unchecked (parser);
|
||||
return gst_byte_reader_get_uint64_be_unchecked (parser);
|
||||
} else {
|
||||
return qt_atom_parser_get_uint32_unchecked (parser);
|
||||
return gst_byte_reader_get_uint32_be_unchecked (parser);
|
||||
}
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
qt_atom_parser_get_fourcc (QtAtomParser * parser, guint32 * fourcc)
|
||||
qt_atom_parser_get_fourcc (GstByteReader * parser, guint32 * fourcc)
|
||||
{
|
||||
guint32 f_be;
|
||||
|
||||
if (G_UNLIKELY (qt_atom_parser_get_remaining (parser) < 4))
|
||||
if (G_UNLIKELY (gst_byte_reader_get_remaining (parser) < 4))
|
||||
return FALSE;
|
||||
|
||||
f_be = qt_atom_parser_get_uint32_unchecked (parser);
|
||||
f_be = gst_byte_reader_get_uint32_be_unchecked (parser);
|
||||
*fourcc = GUINT32_SWAP_LE_BE (f_be);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline guint32
|
||||
qt_atom_parser_get_fourcc_unchecked (QtAtomParser * parser)
|
||||
qt_atom_parser_get_fourcc_unchecked (GstByteReader * parser)
|
||||
{
|
||||
guint32 fourcc;
|
||||
|
||||
fourcc = qt_atom_parser_get_uint32_unchecked (parser);
|
||||
fourcc = gst_byte_reader_get_uint32_be_unchecked (parser);
|
||||
return GUINT32_SWAP_LE_BE (fourcc);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) <2006> Wim Taymans <wim@fluendo.com>
|
||||
* Copyright (C) <2007> Julien Moutte <julien@fluendo.com>
|
||||
* Copyright (C) <2009> Tim-Philipp Müller <tim centricular net>
|
||||
* Copyright (C) <2009> STEricsson <benjamin.gaignard@stericsson.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -263,7 +264,7 @@ enum QtDemuxState
|
|||
|
||||
static GNode *qtdemux_tree_get_child_by_type (GNode * node, guint32 fourcc);
|
||||
static GNode *qtdemux_tree_get_child_by_type_full (GNode * node,
|
||||
guint32 fourcc, QtAtomParser * parser);
|
||||
guint32 fourcc, GstByteReader * parser);
|
||||
static GNode *qtdemux_tree_get_sibling_by_type (GNode * node, guint32 fourcc);
|
||||
|
||||
static const GstElementDetails gst_qtdemux_details =
|
||||
|
@ -3463,7 +3464,7 @@ qtdemux_tree_get_child_by_type (GNode * node, guint32 fourcc)
|
|||
|
||||
static GNode *
|
||||
qtdemux_tree_get_child_by_type_full (GNode * node, guint32 fourcc,
|
||||
QtAtomParser * parser)
|
||||
GstByteReader * parser)
|
||||
{
|
||||
GNode *child;
|
||||
guint8 *buffer;
|
||||
|
@ -3480,7 +3481,7 @@ qtdemux_tree_get_child_by_type_full (GNode * node, guint32 fourcc,
|
|||
if (G_UNLIKELY (child_len < (4 + 4)))
|
||||
return NULL;
|
||||
/* FIXME: must verify if atom length < parent atom length */
|
||||
qt_atom_parser_init (parser, buffer + (4 + 4), child_len - (4 + 4));
|
||||
gst_byte_reader_init (parser, buffer + (4 + 4), child_len - (4 + 4));
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
@ -3717,10 +3718,10 @@ static gboolean
|
|||
qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
||||
GNode * stbl)
|
||||
{
|
||||
QtAtomParser co_reader;
|
||||
QtAtomParser stsz;
|
||||
QtAtomParser stsc;
|
||||
QtAtomParser stts;
|
||||
GstByteReader co_reader;
|
||||
GstByteReader stsz;
|
||||
GstByteReader stsc;
|
||||
GstByteReader stts;
|
||||
GNode *ctts;
|
||||
guint32 sample_size = 0;
|
||||
guint32 n_samples = 0;
|
||||
|
@ -3752,8 +3753,8 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
if (!qtdemux_tree_get_child_by_type_full (stbl, FOURCC_stts, &stts))
|
||||
goto corrupt_file;
|
||||
|
||||
if (!qt_atom_parser_skip (&stsz, 1 + 3) ||
|
||||
!qt_atom_parser_get_uint32 (&stsz, &sample_size))
|
||||
if (!gst_byte_reader_skip (&stsz, 1 + 3) ||
|
||||
!gst_byte_reader_get_uint32_be (&stsz, &sample_size))
|
||||
goto corrupt_file;
|
||||
|
||||
if (sample_size == 0 || stream->sampled) {
|
||||
|
@ -3761,7 +3762,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
if (!gst_byte_reader_skip (&co_reader, 1 + 3 + 4))
|
||||
goto corrupt_file;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (&stsz, &n_samples))
|
||||
if (!gst_byte_reader_get_uint32_be (&stsz, &n_samples))
|
||||
goto corrupt_file;
|
||||
|
||||
if (n_samples == 0)
|
||||
|
@ -3788,7 +3789,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
goto corrupt_file;
|
||||
|
||||
for (i = 0; i < n_samples; i++) {
|
||||
samples[i].size = qt_atom_parser_get_uint32_unchecked (&stsz);
|
||||
samples[i].size = gst_byte_reader_get_uint32_be_unchecked (&stsz);
|
||||
GST_LOG_OBJECT (qtdemux, "sample %d has size %u", i, samples[i].size);
|
||||
}
|
||||
} else {
|
||||
|
@ -3799,8 +3800,8 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
}
|
||||
|
||||
/* set the sample offsets in the file */
|
||||
if (!qt_atom_parser_skip (&stsc, 1 + 3) ||
|
||||
!qt_atom_parser_get_uint32 (&stsc, &n_samples_per_chunk))
|
||||
if (!gst_byte_reader_skip (&stsc, 1 + 3) ||
|
||||
!gst_byte_reader_get_uint32_be (&stsc, &n_samples_per_chunk))
|
||||
goto corrupt_file;
|
||||
|
||||
if (!qt_atom_parser_has_chunks (&stsc, n_samples_per_chunk, 12))
|
||||
|
@ -3808,13 +3809,13 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
|
||||
index = 0;
|
||||
for (i = 0; i < n_samples_per_chunk; i++) {
|
||||
QtAtomParser co_chunk;
|
||||
GstByteReader co_chunk;
|
||||
guint32 first_chunk, last_chunk;
|
||||
guint32 samples_per_chunk;
|
||||
|
||||
first_chunk = qt_atom_parser_get_uint32_unchecked (&stsc);
|
||||
samples_per_chunk = qt_atom_parser_get_uint32_unchecked (&stsc);
|
||||
qt_atom_parser_skip_unchecked (&stsc, 4);
|
||||
first_chunk = gst_byte_reader_get_uint32_be_unchecked (&stsc);
|
||||
samples_per_chunk = gst_byte_reader_get_uint32_be_unchecked (&stsc);
|
||||
gst_byte_reader_skip_unchecked (&stsc, 4);
|
||||
|
||||
/* chunk numbers are counted from 1 it seems */
|
||||
if (G_UNLIKELY (first_chunk == 0))
|
||||
|
@ -3828,7 +3829,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
if (G_UNLIKELY (i == n_samples_per_chunk - 1)) {
|
||||
last_chunk = G_MAXUINT32;
|
||||
} else {
|
||||
last_chunk = qt_atom_parser_peek_uint32_unchecked (&stsc);
|
||||
last_chunk = gst_byte_reader_peek_uint32_be_unchecked (&stsc);
|
||||
if (G_UNLIKELY (last_chunk == 0))
|
||||
goto corrupt_file;
|
||||
else
|
||||
|
@ -3844,7 +3845,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
goto corrupt_file;
|
||||
} else {
|
||||
co_chunk = co_reader;
|
||||
if (!qt_atom_parser_skip (&co_chunk, first_chunk * co_size))
|
||||
if (!gst_byte_reader_skip (&co_chunk, first_chunk * co_size))
|
||||
goto corrupt_file;
|
||||
}
|
||||
|
||||
|
@ -3870,9 +3871,9 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
guint32 n_sample_times = 0;
|
||||
guint32 time;
|
||||
|
||||
if (!qt_atom_parser_skip (&stts, 4))
|
||||
if (!gst_byte_reader_skip (&stts, 4))
|
||||
goto corrupt_file;
|
||||
if (!qt_atom_parser_get_uint32 (&stts, &n_sample_times))
|
||||
if (!gst_byte_reader_get_uint32_be (&stts, &n_sample_times))
|
||||
goto corrupt_file;
|
||||
GST_LOG_OBJECT (qtdemux, "%u timestamp blocks", n_sample_times);
|
||||
|
||||
|
@ -3888,8 +3889,8 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
guint32 n;
|
||||
guint32 duration;
|
||||
|
||||
n = qt_atom_parser_get_uint32_unchecked (&stts);
|
||||
duration = qt_atom_parser_get_uint32_unchecked (&stts);
|
||||
n = gst_byte_reader_get_uint32_be_unchecked (&stts);
|
||||
duration = gst_byte_reader_get_uint32_be_unchecked (&stts);
|
||||
GST_LOG_OBJECT (qtdemux, "block %d, %u timestamps, duration %u ", i, n,
|
||||
duration);
|
||||
|
||||
|
@ -3929,16 +3930,16 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
done3:
|
||||
{
|
||||
/* FIXME: split this block out into a separate function */
|
||||
QtAtomParser stss, stps;
|
||||
GstByteReader stss, stps;
|
||||
|
||||
/* sample sync, can be NULL */
|
||||
if (qtdemux_tree_get_child_by_type_full (stbl, FOURCC_stss, &stss)) {
|
||||
guint32 n_sample_syncs = 0;
|
||||
|
||||
/* mark keyframes */
|
||||
if (!qt_atom_parser_skip (&stss, 4))
|
||||
if (!gst_byte_reader_skip (&stss, 4))
|
||||
goto corrupt_file;
|
||||
if (!qt_atom_parser_get_uint32 (&stss, &n_sample_syncs))
|
||||
if (!gst_byte_reader_get_uint32_be (&stss, &n_sample_syncs))
|
||||
goto corrupt_file;
|
||||
|
||||
if (n_sample_syncs == 0) {
|
||||
|
@ -3949,7 +3950,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
goto corrupt_file;
|
||||
for (i = 0; i < n_sample_syncs; i++) {
|
||||
/* note that the first sample is index 1, not 0 */
|
||||
index = qt_atom_parser_get_uint32_unchecked (&stss);
|
||||
index = gst_byte_reader_get_uint32_be_unchecked (&stss);
|
||||
if (G_LIKELY (index > 0 && index <= n_samples))
|
||||
samples[index - 1].keyframe = TRUE;
|
||||
}
|
||||
|
@ -3958,9 +3959,9 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
if (qtdemux_tree_get_child_by_type_full (stbl, FOURCC_stps, &stps)) {
|
||||
guint32 n_sample_syncs = 0;
|
||||
|
||||
if (!qt_atom_parser_skip (&stps, 4))
|
||||
if (!gst_byte_reader_skip (&stps, 4))
|
||||
goto corrupt_file;
|
||||
if (!qt_atom_parser_get_uint32 (&stps, &n_sample_syncs))
|
||||
if (!gst_byte_reader_get_uint32_be (&stps, &n_sample_syncs))
|
||||
goto corrupt_file;
|
||||
|
||||
if (n_sample_syncs != 0) {
|
||||
|
@ -3972,7 +3973,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
goto corrupt_file;
|
||||
for (i = 0; i < n_sample_syncs; i++) {
|
||||
/* note that the first sample is index 1, not 0 */
|
||||
index = qt_atom_parser_get_uint32_unchecked (&stps);
|
||||
index = gst_byte_reader_get_uint32_be_unchecked (&stps);
|
||||
if (G_LIKELY (index > 0 && index <= n_samples))
|
||||
samples[index - 1].keyframe = TRUE;
|
||||
}
|
||||
|
@ -4011,8 +4012,8 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
stream->n_samples = n_samples;
|
||||
stream->samples = samples;
|
||||
|
||||
if (!qt_atom_parser_skip (&stsc, 1 + 3) ||
|
||||
!qt_atom_parser_get_uint32 (&stsc, &n_samples_per_chunk))
|
||||
if (!gst_byte_reader_skip (&stsc, 1 + 3) ||
|
||||
!gst_byte_reader_get_uint32_be (&stsc, &n_samples_per_chunk))
|
||||
goto corrupt_file;
|
||||
|
||||
GST_DEBUG_OBJECT (qtdemux, "n_samples_per_chunk %u", n_samples_per_chunk);
|
||||
|
@ -4023,13 +4024,13 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
goto corrupt_file;
|
||||
|
||||
for (i = 0; i < n_samples_per_chunk; i++) {
|
||||
QtAtomParser co_chunk;
|
||||
GstByteReader co_chunk;
|
||||
guint32 first_chunk, last_chunk;
|
||||
guint32 samples_per_chunk;
|
||||
|
||||
first_chunk = qt_atom_parser_get_uint32_unchecked (&stsc);
|
||||
samples_per_chunk = qt_atom_parser_get_uint32_unchecked (&stsc);
|
||||
qt_atom_parser_skip_unchecked (&stsc, 4);
|
||||
first_chunk = gst_byte_reader_get_uint32_be_unchecked (&stsc);
|
||||
samples_per_chunk = gst_byte_reader_get_uint32_be_unchecked (&stsc);
|
||||
gst_byte_reader_skip_unchecked (&stsc, 4);
|
||||
|
||||
/* chunk numbers are counted from 1 it seems */
|
||||
if (G_UNLIKELY (first_chunk == 0))
|
||||
|
@ -4043,7 +4044,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
if (G_UNLIKELY (i == (n_samples_per_chunk - 1))) {
|
||||
last_chunk = G_MAXUINT32;
|
||||
} else {
|
||||
last_chunk = qt_atom_parser_peek_uint32_unchecked (&stsc);
|
||||
last_chunk = gst_byte_reader_peek_uint32_be_unchecked (&stsc);
|
||||
if (G_UNLIKELY (last_chunk == 0))
|
||||
goto corrupt_file;
|
||||
else
|
||||
|
@ -4063,7 +4064,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
goto corrupt_file;
|
||||
} else {
|
||||
co_chunk = co_reader;
|
||||
if (!qt_atom_parser_skip (&co_chunk, first_chunk * co_size))
|
||||
if (!gst_byte_reader_skip (&co_chunk, first_chunk * co_size))
|
||||
goto corrupt_file;
|
||||
}
|
||||
|
||||
|
@ -4379,7 +4380,7 @@ end:
|
|||
static gboolean
|
||||
qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
||||
{
|
||||
QtAtomParser tkhd;
|
||||
GstByteReader tkhd;
|
||||
int offset;
|
||||
GNode *mdia;
|
||||
GNode *mdhd;
|
||||
|
@ -4414,8 +4415,8 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
|||
stream->last_ret = GST_FLOW_OK;
|
||||
|
||||
if (!qtdemux_tree_get_child_by_type_full (trak, FOURCC_tkhd, &tkhd) ||
|
||||
!qt_atom_parser_get_uint8 (&tkhd, &tkhd_version) ||
|
||||
!qt_atom_parser_get_uint24 (&tkhd, &tkhd_flags))
|
||||
!gst_byte_reader_get_uint8 (&tkhd, &tkhd_version) ||
|
||||
!gst_byte_reader_get_uint24_be (&tkhd, &tkhd_flags))
|
||||
goto corrupt_file;
|
||||
|
||||
GST_LOG_OBJECT (qtdemux, "track[tkhd] version/flags: 0x%02x/%06x",
|
||||
|
@ -4534,9 +4535,9 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
|||
stream->sampled = TRUE;
|
||||
|
||||
/* version 1 uses some 64-bit ints */
|
||||
if (!qt_atom_parser_skip (&tkhd, (tkhd_version == 1) ? 84 : 72) ||
|
||||
!qt_atom_parser_get_uint32 (&tkhd, &w) ||
|
||||
!qt_atom_parser_get_uint32 (&tkhd, &h))
|
||||
if (!gst_byte_reader_skip (&tkhd, (tkhd_version == 1) ? 84 : 72) ||
|
||||
!gst_byte_reader_get_uint32_be (&tkhd, &w) ||
|
||||
!gst_byte_reader_get_uint32_be (&tkhd, &h))
|
||||
goto corrupt_file;
|
||||
|
||||
stream->display_width = w >> 16;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Copyright (C) 2009 Tim-Philipp Müller <tim centricular net>
|
||||
* Copyright (C) <2009> STEricsson <benjamin.gaignard@stericsson.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -21,20 +22,20 @@
|
|||
#include "qtdemux_types.h"
|
||||
#include "qtdemux_dump.h"
|
||||
|
||||
#include <gst/base/gstbytereader.h>
|
||||
#include "qtatomparser.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define GET_UINT8(data) qt_atom_parser_get_uint8_unchecked(data)
|
||||
#define GET_UINT16(data) qt_atom_parser_get_uint16_unchecked(data)
|
||||
#define GET_UINT32(data) qt_atom_parser_get_uint32_unchecked(data)
|
||||
#define GET_UINT64(data) qt_atom_parser_get_uint64_unchecked(data)
|
||||
#define GET_FP32(data) (qt_atom_parser_get_uint32_unchecked(data)/65536.0)
|
||||
#define GET_FP16(data) (qt_atom_parser_get_uint16_unchecked(data)/256.0)
|
||||
#define GET_UINT8(data) gst_byte_reader_get_uint8_unchecked(data)
|
||||
#define GET_UINT16(data) gst_byte_reader_get_uint16_be_unchecked(data)
|
||||
#define GET_UINT32(data) gst_byte_reader_get_uint32_be_unchecked(data)
|
||||
#define GET_UINT64(data) gst_byte_reader_get_uint64_be_unchecked(data)
|
||||
#define GET_FP32(data) (gst_byte_reader_get_uint32_be_unchecked(data)/65536.0)
|
||||
#define GET_FP16(data) (gst_byte_reader_get_uint16_be_unchecked(data)/256.0)
|
||||
#define GET_FOURCC(data) qt_atom_parser_get_fourcc_unchecked(data)
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_mvhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_mvhd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
if (!qt_atom_parser_has_remaining (data, 100))
|
||||
return FALSE;
|
||||
|
@ -46,7 +47,7 @@ qtdemux_dump_mvhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
GST_LOG ("%*s duration: %u", depth, "", GET_UINT32 (data));
|
||||
GST_LOG ("%*s pref. rate: %g", depth, "", GET_FP32 (data));
|
||||
GST_LOG ("%*s pref. volume: %g", depth, "", GET_FP16 (data));
|
||||
qt_atom_parser_skip (data, 46);
|
||||
gst_byte_reader_skip (data, 46);
|
||||
GST_LOG ("%*s preview time: %u", depth, "", GET_UINT32 (data));
|
||||
GST_LOG ("%*s preview dur.: %u", depth, "", GET_UINT32 (data));
|
||||
GST_LOG ("%*s poster time: %u", depth, "", GET_UINT32 (data));
|
||||
|
@ -58,14 +59,14 @@ qtdemux_dump_mvhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_tkhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_tkhd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint64 duration, ctime, mtime;
|
||||
guint32 version = 0, track_id = 0, iwidth = 0, iheight = 0;
|
||||
guint16 layer = 0, alt_group = 0, ivol = 0;
|
||||
guint value_size;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &version))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &version))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", version);
|
||||
|
@ -74,17 +75,17 @@ qtdemux_dump_tkhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
|
||||
if (qt_atom_parser_get_offset (data, value_size, &ctime) &&
|
||||
qt_atom_parser_get_offset (data, value_size, &mtime) &&
|
||||
qt_atom_parser_get_uint32 (data, &track_id) &&
|
||||
qt_atom_parser_skip (data, 4) &&
|
||||
gst_byte_reader_get_uint32_be (data, &track_id) &&
|
||||
gst_byte_reader_skip (data, 4) &&
|
||||
qt_atom_parser_get_offset (data, value_size, &duration) &&
|
||||
qt_atom_parser_skip (data, 4) &&
|
||||
qt_atom_parser_get_uint16 (data, &layer) &&
|
||||
qt_atom_parser_get_uint16 (data, &alt_group) &&
|
||||
qt_atom_parser_skip (data, 4) &&
|
||||
qt_atom_parser_get_uint16 (data, &ivol) &&
|
||||
qt_atom_parser_skip (data, 2 + (9 * 4)) &&
|
||||
qt_atom_parser_get_uint32 (data, &iwidth) &&
|
||||
qt_atom_parser_get_uint32 (data, &iheight)) {
|
||||
gst_byte_reader_skip (data, 4) &&
|
||||
gst_byte_reader_get_uint16_be (data, &layer) &&
|
||||
gst_byte_reader_get_uint16_be (data, &alt_group) &&
|
||||
gst_byte_reader_skip (data, 4) &&
|
||||
gst_byte_reader_get_uint16_be (data, &ivol) &&
|
||||
gst_byte_reader_skip (data, 2 + (9 * 4)) &&
|
||||
gst_byte_reader_get_uint32_be (data, &iwidth) &&
|
||||
gst_byte_reader_get_uint32_be (data, &iheight)) {
|
||||
GST_LOG ("%*s creation time: %" G_GUINT64_FORMAT, depth, "", ctime);
|
||||
GST_LOG ("%*s modify time: %" G_GUINT64_FORMAT, depth, "", mtime);
|
||||
GST_LOG ("%*s track ID: %u", depth, "", track_id);
|
||||
|
@ -101,12 +102,12 @@ qtdemux_dump_tkhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_elst (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_elst (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
|
@ -124,7 +125,7 @@ qtdemux_dump_elst (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_mdhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_mdhd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 version = 0;
|
||||
guint64 duration, ctime, mtime;
|
||||
|
@ -132,7 +133,7 @@ qtdemux_dump_mdhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
guint16 language = 0, quality = 0;
|
||||
guint value_size;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &version))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &version))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", version);
|
||||
|
@ -141,10 +142,10 @@ qtdemux_dump_mdhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
|
||||
if (qt_atom_parser_get_offset (data, value_size, &ctime) &&
|
||||
qt_atom_parser_get_offset (data, value_size, &mtime) &&
|
||||
qt_atom_parser_get_uint32 (data, &time_scale) &&
|
||||
gst_byte_reader_get_uint32_be (data, &time_scale) &&
|
||||
qt_atom_parser_get_offset (data, value_size, &duration) &&
|
||||
qt_atom_parser_get_uint16 (data, &language) &&
|
||||
qt_atom_parser_get_uint16 (data, &quality)) {
|
||||
gst_byte_reader_get_uint16_be (data, &language) &&
|
||||
gst_byte_reader_get_uint16_be (data, &quality)) {
|
||||
GST_LOG ("%*s creation time: %" G_GUINT64_FORMAT, depth, "", ctime);
|
||||
GST_LOG ("%*s modify time: %" G_GUINT64_FORMAT, depth, "", mtime);
|
||||
GST_LOG ("%*s time scale: 1/%u sec", depth, "", time_scale);
|
||||
|
@ -158,7 +159,7 @@ qtdemux_dump_mdhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_hdlr (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_hdlr (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 version, type, subtype, manufacturer;
|
||||
const gchar *name;
|
||||
|
@ -188,9 +189,9 @@ qtdemux_dump_hdlr (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
gchar buf[256];
|
||||
guint len;
|
||||
|
||||
len = qt_atom_parser_get_uint8_unchecked (data);
|
||||
len = gst_byte_reader_get_uint8_unchecked (data);
|
||||
if (qt_atom_parser_has_remaining (data, len)) {
|
||||
memcpy (buf, qt_atom_parser_peek_bytes_unchecked (data), len);
|
||||
memcpy (buf, gst_byte_reader_peek_data_unchecked (data), len);
|
||||
buf[len] = '\0';
|
||||
GST_LOG ("%*s name: %s", depth, "", buf);
|
||||
}
|
||||
|
@ -199,7 +200,7 @@ qtdemux_dump_hdlr (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_vmhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_vmhd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
if (!qt_atom_parser_has_remaining (data, 4 + 4))
|
||||
return FALSE;
|
||||
|
@ -210,12 +211,12 @@ qtdemux_dump_vmhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_dref (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_dref (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
|
@ -223,9 +224,9 @@ qtdemux_dump_dref (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
for (i = 0; i < num_entries; i++) {
|
||||
guint32 size = 0, fourcc;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &size) ||
|
||||
if (!gst_byte_reader_get_uint32_be (data, &size) ||
|
||||
!qt_atom_parser_get_fourcc (data, &fourcc) || size < 8 ||
|
||||
!qt_atom_parser_skip (data, size - 8))
|
||||
!gst_byte_reader_skip (data, size - 8))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s size: %u", depth, "", size);
|
||||
|
@ -236,22 +237,22 @@ qtdemux_dump_dref (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_stsd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_stsd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
GST_LOG ("%*s n entries: %d", depth, "", num_entries);
|
||||
|
||||
for (i = 0; i < num_entries; i++) {
|
||||
QtAtomParser sub;
|
||||
GstByteReader sub;
|
||||
guint32 size = 0, fourcc;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &size) ||
|
||||
if (!gst_byte_reader_get_uint32_be (data, &size) ||
|
||||
!qt_atom_parser_get_fourcc (data, &fourcc))
|
||||
return FALSE;
|
||||
|
||||
|
@ -263,7 +264,7 @@ qtdemux_dump_stsd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
return FALSE;
|
||||
|
||||
qt_atom_parser_peek_sub (data, 0, 78, &sub);
|
||||
qt_atom_parser_skip (&sub, 6);
|
||||
gst_byte_reader_skip (&sub, 6);
|
||||
GST_LOG ("%*s data reference:%d", depth, "", GET_UINT16 (&sub));
|
||||
GST_LOG ("%*s version/rev.: %08x", depth, "", GET_UINT32 (&sub));
|
||||
fourcc = GET_FOURCC (&sub);
|
||||
|
@ -279,23 +280,23 @@ qtdemux_dump_stsd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
GST_LOG ("%*s frame count: %u", depth, "", GET_UINT16 (&sub));
|
||||
/* something is not right with this, it's supposed to be a string but it's
|
||||
* not apparently, so just skip this for now */
|
||||
qt_atom_parser_skip (&sub, 1 + 31);
|
||||
gst_byte_reader_skip (&sub, 1 + 31);
|
||||
GST_LOG ("%*s compressor: (skipped)", depth, "");
|
||||
GST_LOG ("%*s depth: %u", depth, "", GET_UINT16 (&sub));
|
||||
GST_LOG ("%*s color table ID:%u", depth, "", GET_UINT16 (&sub));
|
||||
if (!qt_atom_parser_skip (data, size - (4 + 4)))
|
||||
if (!gst_byte_reader_skip (data, size - (4 + 4)))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_stts (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_stts (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
|
@ -312,12 +313,12 @@ qtdemux_dump_stts (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_stps (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_stps (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
|
@ -333,12 +334,12 @@ qtdemux_dump_stps (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_stss (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_stss (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
|
@ -354,12 +355,12 @@ qtdemux_dump_stss (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_stsc (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_stsc (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
|
@ -377,19 +378,19 @@ qtdemux_dump_stsc (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_stsz (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_stsz (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, sample_size = 0, num_entries = 0;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &sample_size))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &sample_size))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
GST_LOG ("%*s sample size: %d", depth, "", sample_size);
|
||||
|
||||
if (sample_size == 0) {
|
||||
if (!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s n entries: %d", depth, "", num_entries);
|
||||
|
@ -405,12 +406,12 @@ qtdemux_dump_stsz (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_stco (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_stco (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
|
@ -426,12 +427,12 @@ qtdemux_dump_stco (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_ctts (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_ctts (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i, count, offset;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
|
@ -449,12 +450,12 @@ qtdemux_dump_ctts (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_co64 (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_co64 (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
guint32 ver_flags = 0, num_entries = 0, i;
|
||||
|
||||
if (!qt_atom_parser_get_uint32 (data, &ver_flags) ||
|
||||
!qt_atom_parser_get_uint32 (data, &num_entries))
|
||||
if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
|
||||
!gst_byte_reader_get_uint32_be (data, &num_entries))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
|
||||
|
@ -471,7 +472,7 @@ qtdemux_dump_co64 (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_dcom (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_dcom (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
if (!qt_atom_parser_has_remaining (data, 4))
|
||||
return FALSE;
|
||||
|
@ -482,7 +483,7 @@ qtdemux_dump_dcom (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_cmvd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_cmvd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
if (!qt_atom_parser_has_remaining (data, 4))
|
||||
return FALSE;
|
||||
|
@ -492,22 +493,22 @@ qtdemux_dump_cmvd (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
|||
}
|
||||
|
||||
gboolean
|
||||
qtdemux_dump_unknown (GstQTDemux * qtdemux, QtAtomParser * data, int depth)
|
||||
qtdemux_dump_unknown (GstQTDemux * qtdemux, GstByteReader * data, int depth)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = qt_atom_parser_get_remaining (data);
|
||||
len = gst_byte_reader_get_remaining (data);
|
||||
GST_LOG ("%*s length: %d", depth, "", len);
|
||||
|
||||
GST_MEMDUMP_OBJECT (qtdemux, "unknown atom data",
|
||||
qt_atom_parser_peek_bytes_unchecked (data), len);
|
||||
gst_byte_reader_peek_data_unchecked (data), len);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
qtdemux_node_dump_foreach (GNode * node, gpointer qtdemux)
|
||||
{
|
||||
QtAtomParser parser;
|
||||
GstByteReader parser;
|
||||
guint8 *buffer = (guint8 *) node->data; /* FIXME: move to byte reader */
|
||||
guint32 node_length;
|
||||
guint32 fourcc;
|
||||
|
@ -519,7 +520,7 @@ qtdemux_node_dump_foreach (GNode * node, gpointer qtdemux)
|
|||
|
||||
g_warn_if_fail (node_length >= 8);
|
||||
|
||||
qt_atom_parser_init (&parser, buffer + 8, node_length - 8);
|
||||
gst_byte_reader_init (&parser, buffer + 8, node_length - 8);
|
||||
|
||||
type = qtdemux_type_get (fourcc);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Copyright (C) <2009> STEricsson <benjamin.gaignard@stericsson.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -24,29 +25,46 @@
|
|||
#include <qtdemux.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean qtdemux_dump_mvhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_tkhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_elst (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_mdhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_hdlr (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_vmhd (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_dref (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_stsd (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_stts (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_stss (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_stps (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_stsc (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_stsz (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_stco (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_co64 (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_dcom (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_cmvd (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_ctts (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_unknown (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
gboolean qtdemux_dump_mvhd (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_tkhd (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_elst (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_mdhd (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_hdlr (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_vmhd (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_dref (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_stsd (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_stts (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_stss (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_stps (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_stsc (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_stsz (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_stco (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_co64 (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_dcom (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_cmvd (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_ctts (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
gboolean qtdemux_dump_unknown (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
|
||||
gboolean qtdemux_node_dump (GstQTDemux * qtdemux, GNode * node);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_QTDEMUX_DUMP_H__ */
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Copyright (C) <2009> STEricsson <benjamin.gaignard@stericsson.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -21,13 +22,14 @@
|
|||
#define __GST_QTDEMUX_TYPES_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstbytereader.h>
|
||||
|
||||
#include "qtatomparser.h"
|
||||
#include "qtdemux.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef gboolean (*QtDumpFunc) (GstQTDemux * qtdemux, QtAtomParser * data, int depth);
|
||||
typedef gboolean (*QtDumpFunc) (GstQTDemux * qtdemux, GstByteReader * data,
|
||||
int depth);
|
||||
|
||||
typedef struct _QtNodeType QtNodeType;
|
||||
|
||||
|
|
Loading…
Reference in a new issue