Commit 90f273b1 authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

imagefreeze: Send close segments when seeking only for non-flushing seeks and...

imagefreeze: Send close segments when seeking only for non-flushing seeks and if we already sent a newsegment event

Fixes bug #626619.
parent 3bdc5c24
...@@ -541,11 +541,14 @@ gst_image_freeze_src_event (GstPad * pad, GstEvent * event) ...@@ -541,11 +541,14 @@ gst_image_freeze_src_event (GstPad * pad, GstEvent * event)
gint64 start, stop; gint64 start, stop;
gint64 last_stop; gint64 last_stop;
gboolean start_task; gboolean start_task;
gboolean flush;
gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start, gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
&stop_type, &stop); &stop_type, &stop);
gst_event_unref (event); gst_event_unref (event);
flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
if (format != GST_FORMAT_TIME && format != GST_FORMAT_DEFAULT) { if (format != GST_FORMAT_TIME && format != GST_FORMAT_DEFAULT) {
GST_ERROR_OBJECT (pad, "Seek in invalid format: %s", GST_ERROR_OBJECT (pad, "Seek in invalid format: %s",
gst_format_get_name (format)); gst_format_get_name (format));
...@@ -567,7 +570,7 @@ gst_image_freeze_src_event (GstPad * pad, GstEvent * event) ...@@ -567,7 +570,7 @@ gst_image_freeze_src_event (GstPad * pad, GstEvent * event)
} }
} }
if ((flags & GST_SEEK_FLAG_FLUSH)) { if (flush) {
GstEvent *e; GstEvent *e;
e = gst_event_new_flush_start (); e = gst_event_new_flush_start ();
...@@ -580,21 +583,23 @@ gst_image_freeze_src_event (GstPad * pad, GstEvent * event) ...@@ -580,21 +583,23 @@ gst_image_freeze_src_event (GstPad * pad, GstEvent * event)
GST_OBJECT_LOCK (self); GST_OBJECT_LOCK (self);
gst_event_replace (&self->close_segment, NULL); gst_event_replace (&self->close_segment, NULL);
if (self->segment.rate >= 0) { if (!flush) {
self->close_segment = if (!self->need_segment && self->segment.rate >= 0) {
gst_event_new_new_segment_full (TRUE, self->segment.rate, self->close_segment =
self->segment.applied_rate, self->segment.format, gst_event_new_new_segment_full (TRUE, self->segment.rate,
self->segment.start, self->segment.last_stop, self->segment.time); self->segment.applied_rate, self->segment.format,
} else { self->segment.start, self->segment.last_stop, self->segment.time);
gint64 stop; } else if (!self->need_segment) {
gint64 stop;
if ((stop = self->segment.stop) == -1)
stop = self->segment.duration; if ((stop = self->segment.stop) == -1)
stop = self->segment.duration;
self->close_segment =
gst_event_new_new_segment_full (TRUE, self->segment.rate, self->close_segment =
self->segment.applied_rate, self->segment.format, gst_event_new_new_segment_full (TRUE, self->segment.rate,
self->segment.last_stop, stop, self->segment.last_stop); self->segment.applied_rate, self->segment.format,
self->segment.last_stop, stop, self->segment.last_stop);
}
} }
gst_segment_set_seek (&self->segment, rate, format, flags, start_type, gst_segment_set_seek (&self->segment, rate, format, flags, start_type,
...@@ -605,7 +610,7 @@ gst_image_freeze_src_event (GstPad * pad, GstEvent * event) ...@@ -605,7 +610,7 @@ gst_image_freeze_src_event (GstPad * pad, GstEvent * event)
start_task = self->buffer != NULL; start_task = self->buffer != NULL;
GST_OBJECT_UNLOCK (self); GST_OBJECT_UNLOCK (self);
if ((flags & GST_SEEK_FLAG_FLUSH)) { if (flush) {
GstEvent *e; GstEvent *e;
e = gst_event_new_flush_stop (); e = gst_event_new_flush_stop ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment