diff options
author | Jorge Zapata <jorgeluis.zapata@gmail.com> | 2013-02-13 12:06:55 +0100 |
---|---|---|
committer | Josep Torra <n770galaxy@gmail.com> | 2013-05-22 14:41:22 +0200 |
commit | 46902501e769b57fd3635bbdafccfeaac3b0cf68 (patch) | |
tree | d8daf4049042db2d895ac81ceac851eb876d8ac2 | |
parent | d5e6318c5759723ba1a656010eda53f6f2af942b (diff) |
qtdemux: Add support for default-base-is-moof flag on 'tfhd'
The track fragment header box has a new flag available only on iso5
brand.
This flag modifies the behaviour whenever the base-data-offset-present is
not present. Instead of accumulaing the previous 'traf's offsets, the data
is always relative to the 'moof' start
-rw-r--r-- | gst/isomp4/qtdemux.c | 13 | ||||
-rw-r--r-- | gst/isomp4/qtdemux_types.h | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 6ec43df4b..335a99ed6 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -2579,6 +2579,13 @@ qtdemux_is_brand_piff (GstQTDemux * qtdemux, gboolean major) major); } +static inline gboolean +qtdemux_is_brand_iso5 (GstQTDemux * qtdemux, gboolean major) +{ + return qtdemux_check_brand (qtdemux, GST_MAKE_FOURCC ('i', 's', 'o', '5'), + major); +} + static inline void qtdemux_get_track_defaults (GstQTDemux * qtdemux, guint track_id, guint32 * ds_duration, guint32 * ds_size, guint32 * ds_flags, @@ -2662,6 +2669,12 @@ qtdemux_parse_tfhd (GstQTDemux * qtdemux, GstByteReader * tfhd, if (!gst_byte_reader_get_uint32_be (tfhd, default_sample_flags)) goto invalid_track; + /* in case the iso5 flag is set, reset the base offset */ + if (qtdemux_is_brand_iso5 (qtdemux, FALSE)) { + if (flags & TF_DEFAULT_BASE_IS_MOOF) + *base_offset = -1; + } + return TRUE; invalid_track: diff --git a/gst/isomp4/qtdemux_types.h b/gst/isomp4/qtdemux_types.h index a22efb8bf..188ef9f14 100644 --- a/gst/isomp4/qtdemux_types.h +++ b/gst/isomp4/qtdemux_types.h @@ -62,7 +62,8 @@ enum TfFlags TF_DEFAULT_SAMPLE_DURATION = 0x000008, /* default-sample-duration-present */ TF_DEFAULT_SAMPLE_SIZE = 0x000010, /* default-sample-size-present */ TF_DEFAULT_SAMPLE_FLAGS = 0x000020, /* default-sample-flags-present */ - TF_DURATION_IS_EMPTY = 0x100000 /* duration-is-empty */ + TF_DURATION_IS_EMPTY = 0x100000, /* duration-is-empty */ + TF_DEFAULT_BASE_IS_MOOF = 0x020000 /* default-base-is-moof */ }; enum TrFlags |