qtdemux: handling zero segment-duration edit list 02/83502/1 accepted/tizen/common/20160818.144322 accepted/tizen/ivi/20160818.231812 accepted/tizen/mobile/20160818.231631 accepted/tizen/tv/20160818.231744 accepted/tizen/wearable/20160818.231713 submit/tizen/20160818.052348
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 11 Aug 2016 08:42:10 +0000 (17:42 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Thu, 11 Aug 2016 08:42:10 +0000 (17:42 +0900)
    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

Change-Id: I965e79f23970153bcc7c3cd935a29a09cc963246

gst/isomp4/qtdemux.c
packaging/gst-plugins-good.spec

index 781b2bb..e7fe051 100644 (file)
@@ -7860,24 +7860,57 @@ qtdemux_parse_segments (GstQTDemux * qtdemux, QtDemuxStream * stream,
       guint64 media_time;
       QtDemuxSegment *segment;
       guint32 rate_int;
+#ifdef GST_UPSTREAM
+      GstClockTime media_start = GST_CLOCK_TIME_NONE;
+#endif
 
       media_time = QT_UINT32 (buffer + 20 + i * 12);
       duration = QT_UINT32 (buffer + 16 + i * 12);
 
+#ifdef GST_UPSTREAM
+      if (media_time != G_MAXUINT32)
+        media_start = QTSTREAMTIME_TO_GSTTIME (stream, media_time);
+#endif
+
       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 */
+#ifdef GST_UPSTREAM
+      if (duration || media_start == GST_CLOCK_TIME_NONE) {
+        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;
+        }
+      }
+#else
       time += duration;
       stime = QTTIME_TO_GSTTIME (qtdemux, time);
+#endif
       segment->stop_time = stime;
+
+#ifndef GST_UPSTREAM
       segment->duration = stime - segment->time;
+#endif
 
       segment->trak_media_start = media_time;
       /* media_time expressed in stream timescale */
       if (media_time != G_MAXUINT32) {
+#ifdef GST_UPSTREAM
+        segment->media_start = media_start;
+#else
         segment->media_start = QTSTREAMTIME_TO_GSTTIME (stream, media_time);
+#endif
         segment->media_stop = segment->media_start + segment->duration;
       } else {
         segment->media_start = GST_CLOCK_TIME_NONE;
index 38f265b..9ee37d6 100644 (file)
@@ -74,6 +74,7 @@ export CFLAGS+=" -DGST_EXT_V4L2SRC_MODIFIED\
                -DGST_EXT_AACPARSE_MODIFICATION\
                -DGST_EXT_QTDEMUX_MODIFICATION\
                -DGST_EXT_FLVDEMUX_MODIFICATION\
+               -DGST_UPSTREAM\
                -DTIZEN_FEATURE_GST_MUX_ENHANCEMENT"
 %configure\
 %if ! 0%{?ENABLE_AALIB}