diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-05-20 11:12:44 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-05-20 11:12:44 +0300 |
commit | 9e5cda59f82d6a2abb4186a7ce7061437e9c23ff (patch) | |
tree | fc57a8d22af311ce2bd0d8e7fab02d90b61e9956 /gst | |
parent | 0345ba78f5cf72ef0be2f8b989e57dd73f7f27f4 (diff) |
avidemux: Pass through seek event seqnums in all SEGMENT/EOS events and SEGMENT_DONE messages/events
See https://bugzilla.gnome.org/show_bug.cgi?id=765935
Diffstat (limited to 'gst')
-rw-r--r-- | gst/avi/gstavidemux.c | 45 | ||||
-rw-r--r-- | gst/avi/gstavidemux.h | 1 |
2 files changed, 33 insertions, 13 deletions
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 92cb2b428..5ccbbb135 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -299,6 +299,7 @@ gst_avi_demux_reset (GstAviDemux * avi) gst_adapter_clear (avi->adapter); gst_segment_init (&avi->segment, GST_FORMAT_TIME); + avi->segment_seqnum = 0; } @@ -845,6 +846,7 @@ gst_avi_demux_handle_sink_event (GstPad * pad, GstObject * parent, gst_segment_copy_into (&segment, &avi->segment); GST_DEBUG_OBJECT (avi, "Pushing newseg %" GST_SEGMENT_FORMAT, &segment); + avi->segment_seqnum = gst_event_get_seqnum (event); segment_event = gst_event_new_segment (&segment); gst_event_set_seqnum (segment_event, gst_event_get_seqnum (event)); gst_avi_demux_push_event (avi, segment_event); @@ -1617,7 +1619,7 @@ out_of_mem: * Create and push a flushing seek event upstream */ static gboolean -perform_seek_to_offset (GstAviDemux * demux, guint64 offset) +perform_seek_to_offset (GstAviDemux * demux, guint64 offset, guint32 seqnum) { GstEvent *event; gboolean res = 0; @@ -1628,7 +1630,7 @@ perform_seek_to_offset (GstAviDemux * demux, guint64 offset) gst_event_new_seek (1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, GST_SEEK_TYPE_SET, offset, GST_SEEK_TYPE_NONE, -1); - + gst_event_set_seqnum (event, seqnum); res = gst_pad_push_event (demux->sinkpad, event); if (res) @@ -1695,7 +1697,8 @@ gst_avi_demux_read_subindexes_push (GstAviDemux * avi) } /* seek to next index */ - return perform_seek_to_offset (avi, avi->odml_subidxs[avi->odml_subidx]); + return perform_seek_to_offset (avi, avi->odml_subidxs[avi->odml_subidx], + avi->segment_seqnum); } /* @@ -2948,7 +2951,7 @@ gst_avi_demux_stream_index_push (GstAviDemux * avi) (8 + GST_ROUND_UP_2 (size))); avi->idx1_offset = offset + 8 + GST_ROUND_UP_2 (size); /* issue seek to allow chain function to handle it and return! */ - perform_seek_to_offset (avi, avi->idx1_offset); + perform_seek_to_offset (avi, avi->idx1_offset, avi->segment_seqnum); return; } @@ -3536,6 +3539,8 @@ skipping_done: if (avi->seg_event) gst_event_unref (avi->seg_event); avi->seg_event = gst_event_new_segment (&avi->segment); + if (avi->segment_seqnum) + gst_event_set_seqnum (avi->seg_event, avi->segment_seqnum); gst_avi_demux_check_seekability (avi); @@ -4306,6 +4311,8 @@ skipping_done: if (avi->seg_event) gst_event_unref (avi->seg_event); avi->seg_event = gst_event_new_segment (&avi->segment); + if (avi->segment_seqnum) + gst_event_set_seqnum (avi->seg_event, avi->segment_seqnum); stamp = gst_util_get_timestamp () - stamp; GST_DEBUG_OBJECT (avi, "pulling header took %" GST_TIME_FORMAT, @@ -4637,6 +4644,7 @@ gst_avi_demux_handle_seek (GstAviDemux * avi, GstPad * pad, GstEvent * event) avi->seg_event = gst_event_new_segment (&avi->segment); if (seqnum) gst_event_set_seqnum (avi->seg_event, seqnum); + avi->segment_seqnum = seqnum; if (!avi->streaming) { gst_pad_start_task (avi->sinkpad, (GstTaskFunction) gst_avi_demux_loop, @@ -4836,7 +4844,7 @@ avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad, GstEvent * event) GST_DEBUG_OBJECT (avi, "seeking to chunk at offset %" G_GUINT64_FORMAT, min_offset); - if (!perform_seek_to_offset (avi, min_offset)) { + if (!perform_seek_to_offset (avi, min_offset, gst_event_get_seqnum (event))) { GST_DEBUG_OBJECT (avi, "seek event failed!"); return FALSE; } @@ -4886,7 +4894,7 @@ gst_avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad, GST_INFO_OBJECT (avi, "Seeking to legacy index/first subindex at %" G_GUINT64_FORMAT, offset); - return perform_seek_to_offset (avi, offset); + return perform_seek_to_offset (avi, offset, gst_event_get_seqnum (event)); } /* FIXME: we have to always return true so that we don't block the seek @@ -5666,18 +5674,25 @@ pause:{ avi->segment.position = avi->segment.start; if (avi->segment.flags & GST_SEEK_FLAG_SEGMENT) { gint64 stop; + GstEvent *event; + GstMessage *msg; if ((stop = avi->segment.stop) == -1) stop = avi->segment.duration; GST_INFO_OBJECT (avi, "sending segment_done"); - gst_element_post_message - (GST_ELEMENT_CAST (avi), + msg = gst_message_new_segment_done (GST_OBJECT_CAST (avi), - GST_FORMAT_TIME, stop)); - gst_avi_demux_push_event (avi, - gst_event_new_segment_done (GST_FORMAT_TIME, stop)); + GST_FORMAT_TIME, stop); + if (avi->segment_seqnum) + gst_message_set_seqnum (msg, avi->segment_seqnum); + gst_element_post_message (GST_ELEMENT_CAST (avi), msg); + + event = gst_event_new_segment_done (GST_FORMAT_TIME, stop); + if (avi->segment_seqnum) + gst_event_set_seqnum (event, avi->segment_seqnum); + gst_avi_demux_push_event (avi, event); } else { push_eos = TRUE; } @@ -5691,9 +5706,13 @@ pause:{ push_eos = TRUE; } if (push_eos) { + GstEvent *event; + GST_INFO_OBJECT (avi, "sending eos"); - if (!gst_avi_demux_push_event (avi, gst_event_new_eos ()) && - (res == GST_FLOW_EOS)) { + event = gst_event_new_eos (); + if (avi->segment_seqnum) + gst_event_set_seqnum (event, avi->segment_seqnum); + if (!gst_avi_demux_push_event (avi, event) && (res == GST_FLOW_EOS)) { GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), ("got eos but no streams (yet)")); } diff --git a/gst/avi/gstavidemux.h b/gst/avi/gstavidemux.h index fd2af507d..813ec604f 100644 --- a/gst/avi/gstavidemux.h +++ b/gst/avi/gstavidemux.h @@ -182,6 +182,7 @@ typedef struct _GstAviDemux { /* segment in TIME */ GstSegment segment; + guint32 segment_seqnum; /* pending tags/events */ GstEvent *seg_event; |