diff options
author | Julien Moutte <julien@moutte.net> | 2004-02-15 18:05:04 +0000 |
---|---|---|
committer | Julien Moutte <julien@moutte.net> | 2004-02-15 18:05:04 +0000 |
commit | a828b1a18560405e06a4a6243ce4bca357b7a54b (patch) | |
tree | 7cb673f20c298381f18cc41431af576d9047e6b6 | |
parent | 84721705b7b6271e787ca3af2a0c9bd4324a0ce3 (diff) | |
download | gst-plugins-bad-a828b1a18560405e06a4a6243ce4bca357b7a54b.tar.gz gst-plugins-bad-a828b1a18560405e06a4a6243ce4bca357b7a54b.tar.bz2 gst-plugins-bad-a828b1a18560405e06a4a6243ce4bca357b7a54b.zip |
gst/switch/gstswitch.c: Cleaning the sinkpads correctly on state change, mostly the EOS flag.
Original commit message from CVS:
2004-02-15 Julien MOUTTE <julien@moutte.net>
* gst/switch/gstswitch.c: (gst_switch_change_state),
(gst_switch_class_init): Cleaning the sinkpads correctly on state
change, mostly the EOS flag.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gst/switch/gstswitch.c | 52 |
2 files changed, 56 insertions, 2 deletions
@@ -1,5 +1,11 @@ 2004-02-15 Julien MOUTTE <julien@moutte.net> + * gst/switch/gstswitch.c: (gst_switch_change_state), + (gst_switch_class_init): Cleaning the sinkpads correctly on state + change, mostly the EOS flag. + +2004-02-15 Julien MOUTTE <julien@moutte.net> + * examples/gstplay/player.c: (got_eos), (main): Adding some output for debugging. * gst-libs/gst/play/play.c: (gst_play_state_change): Stop our diff --git a/gst/switch/gstswitch.c b/gst/switch/gstswitch.c index 67b14ff4..1b1c88a4 100644 --- a/gst/switch/gstswitch.c +++ b/gst/switch/gstswitch.c @@ -271,6 +271,54 @@ gst_switch_loop (GstElement *element) } } +static GstElementStateReturn +gst_switch_change_state (GstElement *element) +{ + GstSwitch *gstswitch; + + gstswitch = GST_SWITCH (element); + + switch (GST_STATE_TRANSITION (element)) { + case GST_STATE_NULL_TO_READY: + break; + case GST_STATE_READY_TO_PAUSED: + break; + case GST_STATE_PAUSED_TO_PLAYING: + break; + case GST_STATE_PLAYING_TO_PAUSED: + { + GList *sinkpads = NULL; + + sinkpads = gstswitch->sinkpads; + + while (sinkpads) { + GstSwitchPad *switchpad = sinkpads->data; + + /* If a data is still stored in our structure we unref it */ + if (switchpad->data) { + gst_data_unref (switchpad->data); + switchpad->data = NULL; + } + + switchpad->forwarded = FALSE; + switchpad->eos = FALSE; + + sinkpads = g_list_next (sinkpads); + } + } + break; + case GST_STATE_PAUSED_TO_READY: + break; + case GST_STATE_READY_TO_NULL: + break; + } + + if (GST_ELEMENT_CLASS (parent_class)->change_state) + return GST_ELEMENT_CLASS (parent_class)->change_state (element); + else + return GST_STATE_SUCCESS; +} + /* =========================================== */ /* */ /* Properties */ @@ -416,8 +464,8 @@ gst_switch_class_init (GstSwitchClass *klass) gobject_class->dispose = gst_switch_dispose; gobject_class->set_property = gst_switch_set_property; gobject_class->get_property = gst_switch_get_property; - /* FIXME: implement change state to unref all data from our sinkpad list on - READY */ + + gstelement_class->change_state = gst_switch_change_state; gstelement_class->request_new_pad = gst_switch_request_new_pad; gstelement_class->release_pad = gst_switch_release_pad; } |