From 54e16cc34e85eb222a3716994ec18d6ee818d35f Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 15 Jun 2017 10:38:29 -0400 Subject: [PATCH] element: Add missing values for "to same" state changes And handle newly added GstStateChange values in GstPipeline https://bugzilla.gnome.org/show_bug.cgi?id=783798 --- gst/gstelement.h | 14 +++++++++++++- gst/gstpipeline.c | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/gst/gstelement.h b/gst/gstelement.h index 85ffed3..83d9224 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -230,6 +230,14 @@ typedef enum { * @GST_STATE_CHANGE_READY_TO_NULL : state change from READY to NULL. * * Elements close devices * * Elements reset any internal state. + * @GST_STATE_CHANGE_NULL_TO_NULL : state change from NULL to NULL. (Since 1.14) + * @GST_STATE_CHANGE_READY_TO_READY : state change from READY to READY, + * This might happen when going to PAUSED asynchronously failed, in that case + * elements should make sure they are in a proper, coherent READY state. (Since 1.14) + * @GST_STATE_CHANGE_PAUSED_TO_PAUSED : state change from PAUSED to PAUSED. + * This might happen when elements were in PLAYING state and 'lost state', + * they should make sure to go back to real 'PAUSED' state (prerolling for example). (Since 1.14) + * @GST_STATE_CHANGE_PLAYING_TO_PLAYING : state change from PLAYING to PLAYING. (Since 1.14) * * These are the different state changes an element goes through. * %GST_STATE_NULL ⇒ %GST_STATE_PLAYING is called an upwards state change @@ -242,7 +250,11 @@ typedef enum /*< flags=0 >*/ GST_STATE_CHANGE_PAUSED_TO_PLAYING = (GST_STATE_PAUSED<<3) | GST_STATE_PLAYING, GST_STATE_CHANGE_PLAYING_TO_PAUSED = (GST_STATE_PLAYING<<3) | GST_STATE_PAUSED, GST_STATE_CHANGE_PAUSED_TO_READY = (GST_STATE_PAUSED<<3) | GST_STATE_READY, - GST_STATE_CHANGE_READY_TO_NULL = (GST_STATE_READY<<3) | GST_STATE_NULL + GST_STATE_CHANGE_READY_TO_NULL = (GST_STATE_READY<<3) | GST_STATE_NULL, + GST_STATE_CHANGE_NULL_TO_NULL = (GST_STATE_NULL<<3) | GST_STATE_NULL, + GST_STATE_CHANGE_READY_TO_READY = (GST_STATE_READY<<3) | GST_STATE_READY, + GST_STATE_CHANGE_PAUSED_TO_PAUSED = (GST_STATE_PAUSED<<3) | GST_STATE_PAUSED, + GST_STATE_CHANGE_PLAYING_TO_PLAYING = (GST_STATE_PLAYING<<3) | GST_STATE_PLAYING } GstStateChange; /** diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c index ca4708f..07b4cce 100644 --- a/gst/gstpipeline.c +++ b/gst/gstpipeline.c @@ -381,6 +381,14 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition) GstClock *clock; switch (transition) { + case GST_STATE_CHANGE_NULL_TO_NULL: + break; + case GST_STATE_CHANGE_READY_TO_READY: + break; + case GST_STATE_CHANGE_PAUSED_TO_PAUSED: + break; + case GST_STATE_CHANGE_PLAYING_TO_PLAYING: + break; case GST_STATE_CHANGE_NULL_TO_READY: GST_OBJECT_LOCK (element); if (element->bus) @@ -500,6 +508,14 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition) result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); switch (transition) { + case GST_STATE_CHANGE_NULL_TO_NULL: + break; + case GST_STATE_CHANGE_READY_TO_READY: + break; + case GST_STATE_CHANGE_PAUSED_TO_PAUSED: + break; + case GST_STATE_CHANGE_PLAYING_TO_PLAYING: + break; case GST_STATE_CHANGE_NULL_TO_READY: break; case GST_STATE_CHANGE_READY_TO_PAUSED: -- 2.7.4