From 960515083060eb2cb6bc959b5aff3e493e3486be Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 27 Mar 2009 11:20:02 +0100 Subject: [PATCH] outputselector: reset state when going to READY Reset the last-buffer, the pending pad and the segment when going to the READY state. Fixes #576712. --- gst/selector/gstoutputselector.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/gst/selector/gstoutputselector.c b/gst/selector/gstoutputselector.c index 74191cb..32988af 100644 --- a/gst/selector/gstoutputselector.c +++ b/gst/selector/gstoutputselector.c @@ -158,10 +158,8 @@ gst_output_selector_init (GstOutputSelector * sel, } static void -gst_output_selector_dispose (GObject * object) +gst_output_selector_reset (GstOutputSelector * osel) { - GstOutputSelector *osel = GST_OUTPUT_SELECTOR (object); - if (osel->pending_srcpad != NULL) { gst_object_unref (osel->pending_srcpad); osel->pending_srcpad = NULL; @@ -170,6 +168,15 @@ gst_output_selector_dispose (GObject * object) gst_buffer_unref (osel->latest_buffer); osel->latest_buffer = NULL; } + gst_segment_init (&osel->segment, GST_FORMAT_UNDEFINED); +} + +static void +gst_output_selector_dispose (GObject * object) +{ + GstOutputSelector *osel = GST_OUTPUT_SELECTOR (object); + + gst_output_selector_reset (osel); G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -379,7 +386,29 @@ static GstStateChangeReturn gst_output_selector_change_state (GstElement * element, GstStateChange transition) { - return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + GstOutputSelector *sel; + GstStateChangeReturn result; + + sel = GST_OUTPUT_SELECTOR (element); + + switch (transition) { + case GST_STATE_CHANGE_READY_TO_PAUSED: + break; + default: + break; + } + + result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + switch (transition) { + case GST_STATE_CHANGE_PAUSED_TO_READY: + gst_output_selector_reset (sel); + break; + default: + break; + } + + return result; } static gboolean @@ -412,7 +441,6 @@ gst_output_selector_handle_sink_event (GstPad * pad, GstEvent * event) /* Send newsegment to all src pads */ gst_pad_event_default (pad, event); - break; } case GST_EVENT_EOS: -- 2.7.4