Merge branch 'master' into 0.11
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 28 Oct 2011 14:52:08 +0000 (16:52 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 28 Oct 2011 14:52:08 +0000 (16:52 +0200)
ext/jpeg/gstjpegdec.c
gst/flv/gstflvdemux.c
gst/isomp4/qtdemux.c
gst/matroska/matroska-demux.c

index 41858fb..ab4ed1a 100644 (file)
@@ -72,6 +72,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
 
 /* *INDENT-ON* */
 
+/* FIXME: sof-marker is for IJG libjpeg 8, should be different for 6.2 */
 static GstStaticPadTemplate gst_jpeg_dec_sink_pad_template =
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
@@ -79,7 +80,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
     GST_STATIC_CAPS ("image/jpeg, "
         "width = (int) [ " G_STRINGIFY (MIN_WIDTH) ", " G_STRINGIFY (MAX_WIDTH)
         " ], " "height = (int) [ " G_STRINGIFY (MIN_HEIGHT) ", "
-        G_STRINGIFY (MAX_HEIGHT) " ], " "framerate = (fraction) [ 0/1, MAX ]")
+        G_STRINGIFY (MAX_HEIGHT) " ], framerate = (fraction) [ 0/1, MAX ], "
+        "sof-marker = (int) { 0, 1, 2, 5, 6, 7, 9, 10, 13, 14 }")
     );
 
 GST_DEBUG_CATEGORY_STATIC (jpeg_dec_debug);
index e33a199..4103f25 100644 (file)
@@ -1216,7 +1216,9 @@ gst_flv_demux_parse_tag_video (GstFlvDemux * demux, GstBuffer * buffer)
 
     GST_LOG_OBJECT (demux, "got cts %d", cts);
 
-    pts = pts + cts;
+    /* avoid negative overflow */
+    if (cts >= 0 || pts >= -cts)
+      pts += cts;
   }
 
   GST_LOG_OBJECT (demux, "video tag with codec tag %u, keyframe (%d) "
index 8341ede..02d1ebd 100644 (file)
@@ -1138,8 +1138,9 @@ gst_qtdemux_adjust_seek (GstQTDemux * qtdemux, gint64 desired_time,
 
     /* get the index of the sample with media time */
     index = gst_qtdemux_find_index_linear (qtdemux, str, media_start);
-    GST_DEBUG_OBJECT (qtdemux, "sample for %" GST_TIME_FORMAT " at %u",
-        GST_TIME_ARGS (media_start), index);
+    GST_DEBUG_OBJECT (qtdemux, "sample for %" GST_TIME_FORMAT " at %u"
+        " at offset %" G_GUINT64_FORMAT,
+        GST_TIME_ARGS (media_start), index, str->samples[index].offset);
 
     /* find previous keyframe */
     kindex = gst_qtdemux_find_keyframe (qtdemux, str, index);
@@ -1153,8 +1154,9 @@ gst_qtdemux_adjust_seek (GstQTDemux * qtdemux, gint64 desired_time,
       media_time =
           gst_util_uint64_scale (str->samples[kindex].timestamp, GST_SECOND,
           str->timescale);
-      GST_DEBUG_OBJECT (qtdemux, "keyframe at %u with time %" GST_TIME_FORMAT,
-          kindex, GST_TIME_ARGS (media_time));
+      GST_DEBUG_OBJECT (qtdemux, "keyframe at %u with time %" GST_TIME_FORMAT
+          " at offset %" G_GUINT64_FORMAT,
+          kindex, GST_TIME_ARGS (media_time), str->samples[kindex].offset);
 
       /* keyframes in the segment get a chance to change the
        * desired_offset. keyframes out of the segment are
index eaa6dfd..b1815d7 100644 (file)
@@ -1904,7 +1904,7 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
   gint64 cur, stop;
   GstMatroskaTrackContext *track = NULL;
   GstSegment seeksegment = { 0, };
-  gboolean update;
+  gboolean update = TRUE;
 
   if (pad)
     track = gst_pad_get_element_private (pad);
@@ -1936,8 +1936,19 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
     }
   }
 
+  flush = !!(flags & GST_SEEK_FLAG_FLUSH);
+  keyunit = !!(flags & GST_SEEK_FLAG_KEY_UNIT);
+
   GST_DEBUG_OBJECT (demux, "New segment %" GST_SEGMENT_FORMAT, &seeksegment);
 
+  if (!update) {
+    /* only have to update some segment,
+     * but also still have to honour flush and so on */
+    GST_DEBUG_OBJECT (demux, "... no update");
+    /* bad goto, bad ... */
+    goto next;
+  }
+
   /* check sanity before we start flushing and all that */
   GST_OBJECT_LOCK (demux);
   track = gst_matroska_read_common_get_seek_track (&demux->common, track);
@@ -1962,9 +1973,7 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
         entry->pos + demux->common.ebml_segment_start);
   }
 
-  flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
-  keyunit = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
-
+next:
   if (flush) {
     GST_DEBUG_OBJECT (demux, "Starting flush");
     gst_pad_push_event (demux->common.sinkpad, gst_event_new_flush_start ());
@@ -1973,6 +1982,9 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
     GST_DEBUG_OBJECT (demux, "Non-flushing seek, pausing task");
     gst_pad_pause_task (demux->common.sinkpad);
   }
+  /* ouch */
+  if (!update)
+    goto exit;
 
   /* now grab the stream lock so that streaming cannot continue, for
    * non flushing seeks when the element is in PAUSED this could block
@@ -2007,11 +2019,12 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
     seeksegment.time = entry->time - demux->stream_start_time;
   }
 
+exit:
   if (flush) {
     GST_DEBUG_OBJECT (demux, "Stopping flush");
     gst_pad_push_event (demux->common.sinkpad, gst_event_new_flush_stop ());
     gst_matroska_demux_send_event (demux, gst_event_new_flush_stop ());
-  } else if (demux->segment_running) {
+  } else if (demux->segment_running && update) {
     GST_DEBUG_OBJECT (demux, "Closing currently running segment");
 
     GST_OBJECT_LOCK (demux);
@@ -2032,7 +2045,7 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
   GST_OBJECT_UNLOCK (demux);
 
   /* update some (segment) state */
-  if (!gst_matroska_demux_move_to_entry (demux, entry, TRUE))
+  if (update && !gst_matroska_demux_move_to_entry (demux, entry, TRUE))
     goto seek_error;
 
   /* notify start of new segment */
@@ -2047,7 +2060,7 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
   GST_OBJECT_LOCK (demux);
   if (demux->new_segment)
     gst_event_unref (demux->new_segment);
-  demux->new_segment = gst_event_new_new_segment_full (FALSE,
+  demux->new_segment = gst_event_new_new_segment_full (!update,
       demux->common.segment.rate, demux->common.segment.applied_rate,
       demux->common.segment.format, demux->common.segment.start,
       demux->common.segment.stop, demux->common.segment.time);