summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungha Yang <sh.yang@lge.com>2016-01-28 22:36:23 +0900
committerSebastian Dröge <sebastian@centricular.com>2016-01-29 10:57:05 +0100
commit0391a93a3519c2ea4c375e9668b481c851e59d08 (patch)
treed427bb31e3f5fc286592afdfd7a0fa791df1242f
parentd8bb6687ea251570c331038279a43d448167d6ad (diff)
downloadgstreamer-plugins-good-0391a93a3519c2ea4c375e9668b481c851e59d08.tar.gz
qtdemux: handling zero segment-duration edit list
Based on document ISO_IEC_14496-12, edit list box can have segment duration as zero. It does not imply that media_start equals to media_stop. But, it just indicates a sample which should be presented at the first. This patch derives segment duration using media_time and duration of file. And set derived duration to segment-duration. https://bugzilla.gnome.org/show_bug.cgi?id=760781
-rw-r--r--gst/isomp4/qtdemux.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
index cbba39bc8..f0b368bf8 100644
--- a/gst/isomp4/qtdemux.c
+++ b/gst/isomp4/qtdemux.c
@@ -8019,24 +8019,40 @@ qtdemux_parse_segments (GstQTDemux * qtdemux, QtDemuxStream * stream,
guint64 media_time;
QtDemuxSegment *segment;
guint32 rate_int;
+ GstClockTime media_start = GST_CLOCK_TIME_NONE;
media_time = QT_UINT32 (buffer + 20 + i * 12);
duration = QT_UINT32 (buffer + 16 + i * 12);
+ if (media_time != G_MAXUINT32)
+ media_start = QTSTREAMTIME_TO_GSTTIME (stream, media_time);
+
segment = &stream->segments[count++];
/* time and duration expressed in global timescale */
segment->time = stime;
/* add non scaled values so we don't cause roundoff errors */
- time += duration;
- stime = QTTIME_TO_GSTTIME (qtdemux, time);
+ if (duration) {
+ time += duration;
+ stime = QTTIME_TO_GSTTIME (qtdemux, time);
+ segment->duration = stime - segment->time;
+ } else {
+ /* zero duration does not imply media_start == media_stop
+ * but, only specify media_start.*/
+ stime = QTTIME_TO_GSTTIME (qtdemux, qtdemux->duration);
+ if (GST_CLOCK_TIME_IS_VALID (stime) && media_time != G_MAXUINT32
+ && stime >= media_start) {
+ segment->duration = stime - media_start;
+ } else {
+ segment->duration = GST_CLOCK_TIME_NONE;
+ }
+ }
segment->stop_time = stime;
- segment->duration = stime - segment->time;
segment->trak_media_start = media_time;
/* media_time expressed in stream timescale */
if (media_time != G_MAXUINT32) {
- segment->media_start = QTSTREAMTIME_TO_GSTTIME (stream, media_time);
+ segment->media_start = media_start;
segment->media_stop = segment->media_start + segment->duration;
media_segments_count++;
} else {