diff options
author | Andy Wingo <wingo@pobox.com> | 2005-09-02 15:42:00 +0000 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2005-09-02 15:42:00 +0000 |
commit | e040bb2dbe8373c723d2e973b311fd15dc72a76e (patch) | |
tree | 73bcb6ea84523a35b96a7ee66210e5183faa5acb /libs | |
parent | c2397269b118f1e9296887f4b6f799d6f1d7e82a (diff) |
gst/gstelement.h (GstState): Renamed from GstElementState, changed to be a normal enum instead of flags.
Original commit message from CVS:
2005-09-02 Andy Wingo <wingo@pobox.com>
* gst/gstelement.h (GstState): Renamed from GstElementState,
changed to be a normal enum instead of flags.
(GstStateChangeReturn): Renamed from GstElementStateReturn, names
munged to be GST_STATE_CHANGE_*.
(GST_STATE_CHANGE): Renamed from GST_STATE_TRANSITION, updated to
work with the new state representation.
(GstStateChange): New enumeration of possible state transitions.
Replaces GST_STATE_FOO_TO_BAR with GST_STATE_CHANGE_FOO_TO_BAR.
(GstElementClass::change_state): Pass the GstStateChange along as
an argument. Helps language bindings, so they don't have to use
tricky lock-needing macros like GST_STATE_CHANGE ().
* scripts/update-states (file): New script. Run it on a file to
update it for state naming and API changes. Updates files in
place.
* All files updated for the new API.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gst/base/gstbasesink.c | 38 | ||||
-rw-r--r-- | libs/gst/base/gstbasesrc.c | 36 | ||||
-rw-r--r-- | libs/gst/base/gstbasetransform.c | 27 | ||||
-rw-r--r-- | libs/gst/check/gstcheck.c | 2 |
4 files changed, 51 insertions, 52 deletions
diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 2a9fd525e..97af7b817 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -109,7 +109,8 @@ static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink, static void gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer, GstClockTime * start, GstClockTime * end); -static GstElementStateReturn gst_base_sink_change_state (GstElement * element); +static GstStateChangeReturn gst_base_sink_change_state (GstElement * element, + GstStateChange transition); static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer); static void gst_base_sink_loop (GstPad * pad); @@ -1263,23 +1264,22 @@ gst_base_sink_activate_pull (GstPad * pad, gboolean active) return result; } -static GstElementStateReturn -gst_base_sink_change_state (GstElement * element) +static GstStateChangeReturn +gst_base_sink_change_state (GstElement * element, GstStateChange transition) { - GstElementStateReturn ret = GST_STATE_SUCCESS; + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstBaseSink *basesink = GST_BASE_SINK (element); - GstElementState transition = GST_STATE_TRANSITION (element); GstBaseSinkClass *bclass; bclass = GST_BASE_SINK_GET_CLASS (basesink); switch (transition) { - case GST_STATE_NULL_TO_READY: + case GST_STATE_CHANGE_NULL_TO_READY: if (bclass->start) if (!bclass->start (basesink)) goto start_failed; break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: /* need to complete preroll before this state change completes, there * is no data flow in READY so we can safely assume we need to preroll. */ basesink->offset = 0; @@ -1291,9 +1291,9 @@ gst_base_sink_change_state (GstElement * element) basesink->segment_rate = 1.0; basesink->segment_start = 0; basesink->segment_stop = 0; - ret = GST_STATE_ASYNC; + ret = GST_STATE_CHANGE_ASYNC; break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: { GST_PREROLL_LOCK (basesink->sinkpad); /* if we have EOS, we should empty the queue now as there will @@ -1307,7 +1307,7 @@ gst_base_sink_change_state (GstElement * element) /* don't need preroll, but do queue a commit_state */ basesink->need_preroll = FALSE; basesink->playing_async = TRUE; - ret = GST_STATE_ASYNC; + ret = GST_STATE_CHANGE_ASYNC; /* we know it's not waiting, no need to signal */ } else { /* don't need the preroll anymore */ @@ -1323,16 +1323,16 @@ gst_base_sink_change_state (GstElement * element) } { - GstElementStateReturn bret; + GstStateChangeReturn bret; - bret = GST_ELEMENT_CLASS (parent_class)->change_state (element); + bret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - if (bret != GST_STATE_SUCCESS) + if (bret != GST_STATE_CHANGE_SUCCESS) goto activate_failed; } switch (transition) { - case GST_STATE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: { GstBaseSinkClass *bclass; @@ -1358,14 +1358,14 @@ gst_base_sink_change_state (GstElement * element) basesink->eos); if (!basesink->have_preroll && !basesink->eos) { basesink->need_preroll = TRUE; - ret = GST_STATE_ASYNC; + ret = GST_STATE_CHANGE_ASYNC; } GST_PREROLL_UNLOCK (basesink->sinkpad); break; } - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: break; - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: if (bclass->stop) if (!bclass->stop (basesink)) { GST_WARNING ("failed to stop"); @@ -1381,11 +1381,11 @@ gst_base_sink_change_state (GstElement * element) start_failed: { GST_DEBUG ("failed to start"); - return GST_STATE_FAILURE; + return GST_STATE_CHANGE_FAILURE; } activate_failed: { GST_DEBUG ("element failed to change states -- activation problem?"); - return GST_STATE_FAILURE; + return GST_STATE_CHANGE_FAILURE; } } diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index fb94452f5..12f2917f1 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -125,7 +125,8 @@ static gboolean gst_base_src_get_size (GstBaseSrc * basesrc, guint64 * size); static gboolean gst_base_src_start (GstBaseSrc * basesrc); static gboolean gst_base_src_stop (GstBaseSrc * basesrc); -static GstElementStateReturn gst_base_src_change_state (GstElement * element); +static GstStateChangeReturn gst_base_src_change_state (GstElement * element, + GstStateChange transition); static void gst_base_src_loop (GstPad * pad); static gboolean gst_base_src_check_get_range (GstPad * pad); @@ -1041,30 +1042,28 @@ error_stop: } } -static GstElementStateReturn -gst_base_src_change_state (GstElement * element) +static GstStateChangeReturn +gst_base_src_change_state (GstElement * element, GstStateChange transition) { GstBaseSrc *basesrc; - GstElementStateReturn result = GST_STATE_SUCCESS; - GstElementStateReturn presult; - GstElementState transition; + GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS; + GstStateChangeReturn presult; basesrc = GST_BASE_SRC (element); - transition = GST_STATE_TRANSITION (element); switch (transition) { - case GST_STATE_NULL_TO_READY: + case GST_STATE_CHANGE_NULL_TO_READY: break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: GST_LIVE_LOCK (element); if (basesrc->is_live) { - result = GST_STATE_NO_PREROLL; + result = GST_STATE_CHANGE_NO_PREROLL; basesrc->live_running = FALSE; } GST_LIVE_UNLOCK (element); break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: GST_LIVE_LOCK (element); if (basesrc->is_live) { basesrc->live_running = TRUE; @@ -1076,26 +1075,27 @@ gst_base_src_change_state (GstElement * element) break; } - if ((presult = GST_ELEMENT_CLASS (parent_class)->change_state (element)) != - GST_STATE_SUCCESS) { + if ((presult = + GST_ELEMENT_CLASS (parent_class)->change_state (element, + transition)) != GST_STATE_CHANGE_SUCCESS) { gst_base_src_stop (basesrc); return presult; } switch (transition) { - case GST_STATE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: GST_LIVE_LOCK (element); if (basesrc->is_live) { - result = GST_STATE_NO_PREROLL; + result = GST_STATE_CHANGE_NO_PREROLL; basesrc->live_running = FALSE; } GST_LIVE_UNLOCK (element); break; - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: if (!gst_base_src_stop (basesrc)) - result = GST_STATE_FAILURE; + result = GST_STATE_CHANGE_FAILURE; break; - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: break; default: break; diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index ec46c8681..dc3d57451 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -113,8 +113,8 @@ static gboolean gst_base_transform_sink_activate_push (GstPad * pad, static gboolean gst_base_transform_get_unit_size (GstBaseTransform * trans, GstCaps * caps, guint * size); -static GstElementStateReturn gst_base_transform_change_state (GstElement * - element); +static GstStateChangeReturn gst_base_transform_change_state (GstElement * + element, GstStateChange transition); static gboolean gst_base_transform_event (GstPad * pad, GstEvent * event); static GstFlowReturn gst_base_transform_getrange (GstPad * pad, guint64 offset, @@ -1048,23 +1048,22 @@ gst_base_transform_src_activate_pull (GstPad * pad, gboolean active) return result; } -static GstElementStateReturn -gst_base_transform_change_state (GstElement * element) +static GstStateChangeReturn +gst_base_transform_change_state (GstElement * element, + GstStateChange transition) { GstBaseTransform *trans; GstBaseTransformClass *bclass; - GstElementState transition; - GstElementStateReturn result; + GstStateChangeReturn result; trans = GST_BASE_TRANSFORM (element); bclass = GST_BASE_TRANSFORM_GET_CLASS (trans); - transition = GST_STATE_TRANSITION (element); switch (transition) { - case GST_STATE_NULL_TO_READY: + case GST_STATE_CHANGE_NULL_TO_READY: break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: GST_LOCK (trans); if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad)) trans->in_place = gst_caps_is_equal (GST_PAD_CAPS (trans->sinkpad), @@ -1077,22 +1076,22 @@ gst_base_transform_change_state (GstElement * element) trans->negotiated = FALSE; GST_UNLOCK (trans); break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; default: break; } - result = GST_ELEMENT_CLASS (parent_class)->change_state (element); + result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); switch (transition) { - case GST_STATE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: break; - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: if (bclass->stop) result = bclass->stop (trans); break; - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: break; default: break; diff --git a/libs/gst/check/gstcheck.c b/libs/gst/check/gstcheck.c index ab850a8ab..6d66a1b0f 100644 --- a/libs/gst/check/gstcheck.c +++ b/libs/gst/check/gstcheck.c @@ -140,7 +140,7 @@ gst_check_teardown_element (GstElement * element) GST_DEBUG ("teardown_element"); fail_unless (gst_element_set_state (element, GST_STATE_NULL) == - GST_STATE_SUCCESS, "could not set to null"); + GST_STATE_CHANGE_SUCCESS, "could not set to null"); ASSERT_OBJECT_REFCOUNT (element, "element", 1); gst_object_unref (element); } |