/* track id */
guint track_id;
+#ifdef TIZEN_FEATURE_QTDEMUX_DURATION
+ guint64 tkhd_duration;
+#endif
+
/* duration/scale */
guint64 duration; /* in timescale units */
guint32 timescale;
stream = _create_stream (qtdemux, track_id);
stream->stream_tags = gst_tag_list_make_writable (stream->stream_tags);
+#ifdef TIZEN_FEATURE_QTDEMUX_DURATION
+ if (!gst_byte_reader_skip (&tkhd, 4))
+ goto corrupt_file;
+
+ if (tkhd_version == 1) {
+ if (!gst_byte_reader_get_uint64_be (&tkhd, &stream->tkhd_duration))
+ goto corrupt_file;
+ } else {
+ guint32 dur = 0;
+ if (!gst_byte_reader_get_uint32_be (&tkhd, &dur))
+ goto corrupt_file;
+ stream->tkhd_duration = dur;
+ }
+ GST_INFO_OBJECT (qtdemux, "tkhd duration: %" G_GUINT64_FORMAT,
+ stream->tkhd_duration);
+#endif
/* need defaults for fragments */
qtdemux_parse_trex (qtdemux, stream, &dummy, &dummy, &dummy);
guint32 matrix[9];
/* version 1 uses some 64-bit ints */
+#ifdef TIZEN_FEATURE_QTDEMUX_DURATION
+ if (!gst_byte_reader_skip (&tkhd, 16))
+#else
if (!gst_byte_reader_skip (&tkhd, 20 + value_size))
+#endif
goto corrupt_file;
if (!qtdemux_parse_transformation_matrix (qtdemux, &tkhd, matrix, "tkhd"))
qtdemux_prepare_streams (GstQTDemux * qtdemux)
{
GstFlowReturn ret = GST_FLOW_OK;
+#ifdef TIZEN_FEATURE_QTDEMUX_DURATION
+ guint64 tkhd_max_duration = 0;
+#endif
gint i;
GST_DEBUG_OBJECT (qtdemux, "prepare streams");
} else {
/* discard any stray moof */
qtdemux->moof_offset = 0;
+#ifdef TIZEN_FEATURE_QTDEMUX_DURATION
+ if (tkhd_max_duration < stream->tkhd_duration)
+ tkhd_max_duration = stream->tkhd_duration;
+#endif
}
/* prepare braking */
}
}
+#ifdef TIZEN_FEATURE_QTDEMUX_DURATION
+ if (!qtdemux->fragmented && (qtdemux->duration > tkhd_max_duration)) {
+ GST_INFO_OBJECT (qtdemux,
+ "Update duration: %" G_GUINT64_FORMAT " -> %" G_GUINT64_FORMAT,
+ qtdemux->duration, tkhd_max_duration);
+ qtdemux->duration = tkhd_max_duration;
+ }
+#endif
+
return ret;
}