diff options
111 files changed, 927 insertions, 777 deletions
@@ -1,3 +1,23 @@ +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. + 2005-09-02 Thomas Vander Stichele <thomas at apestaart dot org> * gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush): diff --git a/check/elements/fakesrc.c b/check/elements/fakesrc.c index 1d9b34288..1770e819e 100644 --- a/check/elements/fakesrc.c +++ b/check/elements/fakesrc.c @@ -77,7 +77,8 @@ GST_START_TEST (test_num_buffers) src = setup_fakesrc (); g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); while (!have_eos) { g_usleep (1000); @@ -104,7 +105,8 @@ GST_START_TEST (test_sizetype_empty) g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); while (!have_eos) { g_usleep (1000); @@ -139,7 +141,8 @@ GST_START_TEST (test_sizetype_fixed) g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); while (!have_eos) { g_usleep (1000); @@ -175,7 +178,8 @@ GST_START_TEST (test_sizetype_random) g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); while (!have_eos) { g_usleep (1000); diff --git a/check/elements/identity.c b/check/elements/identity.c index dc5dd31ba..eb5f41e8c 100644 --- a/check/elements/identity.c +++ b/check/elements/identity.c @@ -93,7 +93,8 @@ GST_START_TEST (test_one_buffer) identity = setup_identity (); fail_unless (gst_element_set_state (identity, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); buffer = gst_buffer_new_and_alloc (4); ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); diff --git a/check/gst/gstbin.c b/check/gst/gstbin.c index 0bef198f2..fa704bed2 100644 --- a/check/gst/gstbin.c +++ b/check/gst/gstbin.c @@ -160,7 +160,7 @@ GST_START_TEST (test_message_state_changed_child) * - second for bin, causing an incref on the bin */ GST_DEBUG ("setting bin to READY"); fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); ASSERT_OBJECT_REFCOUNT (src, "src", 2); ASSERT_OBJECT_REFCOUNT (bin, "bin", 2); @@ -228,7 +228,7 @@ GST_START_TEST (test_message_state_changed_children) /* change state to READY, spawning three messages */ GST_DEBUG ("setting pipeline to READY"); fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* each object is referenced by a message */ ASSERT_OBJECT_REFCOUNT (bus, "bus", 1); @@ -247,7 +247,7 @@ GST_START_TEST (test_message_state_changed_children) /* change state to PAUSED, spawning three messages */ GST_DEBUG ("setting pipeline to PAUSED"); fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* each object is referenced by a message; * base_sink_chain has taken a refcount on the sink, and is blocked on @@ -267,7 +267,7 @@ GST_START_TEST (test_message_state_changed_children) /* change state to PLAYING, spawning three messages */ GST_DEBUG ("setting pipeline to PLAYING"); fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* each object is referenced by one message * sink might have an extra reference if it's still blocked on preroll */ @@ -287,7 +287,7 @@ GST_START_TEST (test_message_state_changed_children) /* go back to READY, spawning six messages */ GST_DEBUG ("setting pipeline to READY"); fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* each object is referenced by two messages */ ASSERT_OBJECT_REFCOUNT (src, "src", 3); @@ -303,7 +303,7 @@ GST_START_TEST (test_message_state_changed_children) /* setting pipeline to NULL flushes the bus automatically */ fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); @@ -337,7 +337,7 @@ GST_START_TEST (test_watch_for_state_change) /* change state, spawning two times three messages, minus one async */ fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED) - == GST_STATE_ASYNC); + == GST_STATE_CHANGE_ASYNC); pop_messages (bus, 5); @@ -353,7 +353,7 @@ GST_START_TEST (test_watch_for_state_change) "Unexpected messages on bus"); fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); pop_messages (bus, 3); @@ -369,7 +369,7 @@ GST_START_TEST (test_watch_for_state_change) /* setting bin to NULL flushes the bus automatically */ fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* clean up */ gst_object_unref (bin); diff --git a/check/gst/gstghostpad.c b/check/gst/gstghostpad.c index 455dd1f46..6e0c92945 100644 --- a/check/gst/gstghostpad.c +++ b/check/gst/gstghostpad.c @@ -218,9 +218,10 @@ GST_START_TEST (test_ghost_pads) assert_gstrefcount (isrc, 3); /* parent and gsrc */ fail_unless (gst_element_set_state (b1, - GST_STATE_PLAYING) == GST_STATE_SUCCESS); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS); - fail_unless (gst_element_set_state (b1, GST_STATE_NULL) == GST_STATE_SUCCESS); + fail_unless (gst_element_set_state (b1, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS); gst_object_unref (b1); /* unreffing the bin will unref all elements, which will unlink and unparent diff --git a/check/gst/gstmessage.c b/check/gst/gstmessage.c index 0cfad06e5..cf0216fe4 100644 --- a/check/gst/gstmessage.c +++ b/check/gst/gstmessage.c @@ -120,7 +120,7 @@ GST_START_TEST (test_parsing) } /* GST_MESSAGE_STATE_CHANGED */ { - GstElementState oldstate, newstate; + GstState oldstate, newstate; oldstate = GST_STATE_PAUSED; newstate = GST_STATE_PLAYING; @@ -175,8 +175,8 @@ GST_START_TEST (test_parsing) /* void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list); - void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state, - GstElementState *new_state); + void gst_message_parse_state_changed (GstMessage *message, GstState *old_state, + GstState *new_state); void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug); void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug); */ diff --git a/check/pipelines/simple_launch_lines.c b/check/pipelines/simple_launch_lines.c index 19726fdaf..11c6ed814 100644 --- a/check/pipelines/simple_launch_lines.c +++ b/check/pipelines/simple_launch_lines.c @@ -45,7 +45,8 @@ run_pipeline (GstElement * pipe, gchar * descr, bus = gst_element_get_bus (pipe); g_assert (bus); - if (gst_element_set_state (pipe, GST_STATE_PLAYING) != GST_STATE_SUCCESS) { + if (gst_element_set_state (pipe, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) { g_critical ("Couldn't set pipeline to PLAYING"); goto done; } diff --git a/check/states/sinks.c b/check/states/sinks.c index 95b6b02ea..92d2edad4 100644 --- a/check/states/sinks.c +++ b/check/states/sinks.c @@ -26,30 +26,30 @@ GST_START_TEST (test_sink) { GstElement *sink; - GstElementStateReturn ret; - GstElementState current, pending; + GstStateChangeReturn ret; + GstState current, pending; GTimeVal tv; sink = gst_element_factory_make ("fakesink", "sink"); ret = gst_element_set_state (sink, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_ASYNC, "no async state return"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); ret = gst_element_set_state (sink, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_ASYNC, "no forced async state change"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no forced async state change"); GST_TIME_TO_TIMEVAL ((GstClockTime) 0, tv); ret = gst_element_get_state (sink, ¤t, &pending, &tv); - fail_unless (ret == GST_STATE_ASYNC, "not changing state async"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async"); fail_unless (current == GST_STATE_PAUSED, "bad current state"); fail_unless (pending == GST_STATE_PLAYING, "bad pending state"); ret = gst_element_set_state (sink, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_ASYNC, "no async going back to paused"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async going back to paused"); ret = gst_element_set_state (sink, GST_STATE_READY); - fail_unless (ret == GST_STATE_SUCCESS, "failed to go to ready"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to ready"); gst_object_unref (sink); } @@ -60,8 +60,8 @@ GST_END_TEST GST_START_TEST (test_src_sink) { GstElement *sink, *src, *pipeline; - GstElementStateReturn ret; - GstElementState current, pending; + GstStateChangeReturn ret; + GstState current, pending; GstPad *srcpad, *sinkpad; pipeline = gst_pipeline_new ("pipeline"); @@ -79,13 +79,13 @@ GST_START_TEST (test_src_sink) ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); ret = gst_element_get_state (pipeline, NULL, NULL, NULL); - fail_unless (ret == GST_STATE_SUCCESS, "no success state return"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_SUCCESS, "cannot start play"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot start play"); ret = gst_element_get_state (pipeline, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_SUCCESS, "not playing"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); fail_unless (current == GST_STATE_PLAYING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); } @@ -97,8 +97,8 @@ GST_END_TEST GST_START_TEST (test_livesrc_remove) { GstElement *sink, *src, *pipeline; - GstElementStateReturn ret; - GstElementState current, pending; + GstStateChangeReturn ret; + GstState current, pending; GstPad *srcpad, *sinkpad; GTimeVal tv; @@ -117,10 +117,11 @@ GST_START_TEST (test_livesrc_remove) gst_object_unref (sinkpad); ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_NO_PREROLL, "no no_preroll state return"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no no_preroll state return"); ret = gst_element_get_state (src, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_NO_PREROLL, "not paused"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); fail_unless (current == GST_STATE_PAUSED, "not paused"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); @@ -128,7 +129,7 @@ GST_START_TEST (test_livesrc_remove) GST_TIME_TO_TIMEVAL (0, tv); ret = gst_element_get_state (pipeline, ¤t, &pending, &tv); - fail_unless (ret == GST_STATE_ASYNC, "not async"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async"); fail_unless (current == GST_STATE_PAUSED, "not paused"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); @@ -140,8 +141,8 @@ GST_END_TEST GST_START_TEST (test_livesrc_sink) { GstElement *sink, *src, *pipeline; - GstElementStateReturn ret; - GstElementState current, pending; + GstStateChangeReturn ret; + GstState current, pending; GstPad *srcpad, *sinkpad; pipeline = gst_pipeline_new ("pipeline"); @@ -159,23 +160,24 @@ GST_START_TEST (test_livesrc_sink) gst_object_unref (sinkpad); ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_NO_PREROLL, "no no_preroll state return"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no no_preroll state return"); ret = gst_element_get_state (src, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_NO_PREROLL, "not paused"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); fail_unless (current == GST_STATE_PAUSED, "not paused"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); ret = gst_element_get_state (pipeline, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_NO_PREROLL, "not paused"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); fail_unless (current == GST_STATE_PAUSED, "not paused"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_SUCCESS, "cannot force play"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot force play"); ret = gst_element_get_state (pipeline, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_SUCCESS, "not playing"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); fail_unless (current == GST_STATE_PLAYING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); } diff --git a/docs/gst/tmpl/gstelement.sgml b/docs/gst/tmpl/gstelement.sgml index 48b672e88..79ce4f06e 100644 --- a/docs/gst/tmpl/gstelement.sgml +++ b/docs/gst/tmpl/gstelement.sgml @@ -157,13 +157,6 @@ This enum defines the standard flags that an element may have. @GST_ELEMENT_UNPARENTING: @GST_ELEMENT_FLAG_LAST: -<!-- ##### MACRO GST_NUM_STATES ##### --> -<para> -The maximun number of states. -</para> - - - <!-- ##### MACRO GST_STATE ##### --> <para> This macro returns the current state of the element. @@ -180,56 +173,6 @@ This macro returns the currently pending state of the element. @obj: Element to return the pending state for. -<!-- ##### MACRO GST_STATE_TRANSITION ##### --> -<para> -Returns the state transition this object is going through. -</para> - -@obj: the Element to return the state transition for - - -<!-- ##### MACRO GST_STATE_NULL_TO_READY ##### --> -<para> -The Element is going from the NULL state to the READY state. -</para> - - - -<!-- ##### MACRO GST_STATE_READY_TO_PAUSED ##### --> -<para> -The Element is going from the READY state to the PAUSED state. -</para> - - - -<!-- ##### MACRO GST_STATE_PAUSED_TO_PLAYING ##### --> -<para> -The Element is going from the PAUSED state to the PLAYING state. -</para> - - - -<!-- ##### MACRO GST_STATE_PLAYING_TO_PAUSED ##### --> -<para> -The Element is going from the PLAYING state to the PAUSED state. -</para> - - - -<!-- ##### MACRO GST_STATE_PAUSED_TO_READY ##### --> -<para> -The Element is going from the PAUSED state to the READY state. -</para> - - - -<!-- ##### MACRO GST_STATE_READY_TO_NULL ##### --> -<para> -The Element is going from the READY state to the NULL state. -</para> - - - <!-- ##### MACRO GST_STATE_BROADCAST ##### --> <para> diff --git a/docs/gst/tmpl/gsttypes.sgml b/docs/gst/tmpl/gsttypes.sgml index ce77045b4..47c770cfa 100644 --- a/docs/gst/tmpl/gsttypes.sgml +++ b/docs/gst/tmpl/gsttypes.sgml @@ -17,29 +17,6 @@ various global enums and constants <!-- ##### SECTION Stability_Level ##### --> -<!-- ##### ENUM GstElementState ##### --> -<para> -These contants describe the state a #GstElement is in and transition scheduled for the #GstElement (the pending state). -</para> - -@GST_STATE_VOID_PENDING: no transition is schedules for this element -@GST_STATE_NULL: this is the default state all elements are in, after they have been created and are doing nothing -@GST_STATE_READY: the element is ready to start doing something -@GST_STATE_PAUSED: the element is paused for a period of time -@GST_STATE_PLAYING: the element is doing something - -<!-- ##### ENUM GstElementStateReturn ##### --> -<para> -One of these values is returned from a gst_element_set_state() call. -As GST_STATE_FAILURE is equal to 0, one can use a boolean comparission -against the GstElementStateReturn value. -</para> - -@GST_STATE_FAILURE: the state of the element could not be changed -@GST_STATE_SUCCESS: the state of the element has already be changed -@GST_STATE_ASYNC: the state of the element will change in the near future -@GST_STATE_NO_PREROLL: - <!-- ##### ENUM GstRank ##### --> <para> Element priority ranks. Defines the order in which the autoplugger (or similar diff --git a/examples/metadata/read-metadata.c b/examples/metadata/read-metadata.c index 269b48992..5e3972b38 100644 --- a/examples/metadata/read-metadata.c +++ b/examples/metadata/read-metadata.c @@ -182,8 +182,8 @@ main (int argc, char *argv[]) make_pipeline (); while (i < argc) { - GstElementStateReturn sret; - GstElementState state; + GstStateChangeReturn sret; + GstState state; filename = argv[i]; g_object_set (source, "location", filename, NULL); @@ -194,13 +194,13 @@ main (int argc, char *argv[]) * otherwise the state change fails */ sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); - if (GST_STATE_ASYNC == sret) { - if (GST_STATE_FAILURE == + if (GST_STATE_CHANGE_ASYNC == sret) { + if (GST_STATE_CHANGE_FAILURE == gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) { g_print ("State change failed. Aborting"); break; } - } else if (sret != GST_STATE_SUCCESS) { + } else if (sret != GST_STATE_CHANGE_SUCCESS) { g_print ("%s - Could not read file\n", argv[i]); } else { GstTagList *tags = NULL; @@ -226,8 +226,8 @@ main (int argc, char *argv[]) g_print ("No metadata found for %s\n", argv[i]); sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - if (GST_STATE_ASYNC == sret) { - if (GST_STATE_FAILURE == + if (GST_STATE_CHANGE_ASYNC == sret) { + if (GST_STATE_CHANGE_FAILURE == gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) { g_print ("State change failed. Aborting"); diff --git a/examples/plugins/example.c b/examples/plugins/example.c index 13f0ee93e..d87ebf03c 100644 --- a/examples/plugins/example.c +++ b/examples/plugins/example.c @@ -86,7 +86,8 @@ static void gst_example_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_example_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_example_change_state (GstElement * element); +static GstStateChangeReturn gst_example_change_state (GstElement * element, + GstStateChange transition); /* The parent class pointer needs to be kept around for some object * operations. @@ -338,8 +339,8 @@ gst_example_get_property (GObject * object, guint prop_id, GValue * value, * The plugin can prepare itself and its internal data structures * in the various state transitions. */ -static GstElementStateReturn -gst_example_change_state (GstElement * element) +static GstStateChangeReturn +gst_example_change_state (GstElement * element, GstStateChange transition) { GstExample *example; @@ -348,33 +349,33 @@ gst_example_change_state (GstElement * element) /* we perform our actions based on the state transition * of the element */ - switch (GST_STATE_TRANSITION (element)) { + switch (transition) { /* The NULL to READY transition is used to * create threads (if any), and/or open devices */ - 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: break; /* In the PAUSED to PLAYING state, the element should * prepare itself for operation or continue after a PAUSE */ - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; /* In the PLAYING to PAUSED state, the element should * PAUSE itself and make sure it can resume operation */ - case GST_STATE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: break; /* In the PAUSED to READY state, the element should reset * its internal state and close any devices. */ - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: break; /* The element should free all resources, terminate threads * and put itself into its initial state again */ - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: break; } /* Then we call the parent state change handler */ - return parent_class->change_state (element); + return parent_class->change_state (element, transition); } diff --git a/gst/base/gstbasesink.c b/gst/base/gstbasesink.c index 2a9fd525e..97af7b817 100644 --- a/gst/base/gstbasesink.c +++ b/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/gst/base/gstbasesrc.c b/gst/base/gstbasesrc.c index fb94452f5..12f2917f1 100644 --- a/gst/base/gstbasesrc.c +++ b/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/gst/base/gstbasetransform.c b/gst/base/gstbasetransform.c index ec46c8681..dc3d57451 100644 --- a/gst/base/gstbasetransform.c +++ b/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/gst/check/gstcheck.c b/gst/check/gstcheck.c index ab850a8ab..6d66a1b0f 100644 --- a/gst/check/gstcheck.c +++ b/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); } diff --git a/gst/elements/gstfakesink.c b/gst/elements/gstfakesink.c index 643a759bd..9bbdc925a 100644 --- a/gst/elements/gstfakesink.c +++ b/gst/elements/gstfakesink.c @@ -121,7 +121,8 @@ static void gst_fake_sink_set_property (GObject * object, guint prop_id, static void gst_fake_sink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_fake_sink_change_state (GstElement * element); +static GstStateChangeReturn gst_fake_sink_change_state (GstElement * element, + GstStateChange transition); static GstFlowReturn gst_fake_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer); @@ -382,35 +383,34 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf) return GST_FLOW_OK; } -static GstElementStateReturn -gst_fake_sink_change_state (GstElement * element) +static GstStateChangeReturn +gst_fake_sink_change_state (GstElement * element, GstStateChange transition) { - GstElementStateReturn ret = GST_STATE_SUCCESS; + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstFakeSink *fakesink = GST_FAKE_SINK (element); - GstElementState transition = GST_STATE_TRANSITION (element); switch (transition) { - case GST_STATE_NULL_TO_READY: + case GST_STATE_CHANGE_NULL_TO_READY: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_NULL_READY) goto error; break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_PAUSED) goto error; break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_PLAYING) goto error; break; - case GST_STATE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PLAYING_PAUSED) goto error; break; - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_READY) goto error; break; - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL) goto error; g_free (fakesink->last_message); @@ -420,11 +420,11 @@ gst_fake_sink_change_state (GstElement * element) break; } - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); return ret; error: GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL)); - return GST_STATE_FAILURE; + return GST_STATE_CHANGE_FAILURE; } diff --git a/gst/elements/gstfdsrc.c b/gst/elements/gstfdsrc.c index f53038803..938ae85b7 100644 --- a/gst/elements/gstfdsrc.c +++ b/gst/elements/gstfdsrc.c @@ -82,7 +82,8 @@ static void gst_fdsrc_set_property (GObject * object, guint prop_id, static void gst_fdsrc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_fdsrc_change_state (GstElement * element); +static GstStateChangeReturn gst_fdsrc_change_state (GstElement * element, + GstStateChange transition); static GstFlowReturn gst_fdsrc_create (GstPushSrc * psrc, GstBuffer ** outbuf); @@ -147,29 +148,29 @@ gst_fdsrc_init (GstFdSrc * fdsrc) fdsrc->seq = 0; } -static GstElementStateReturn -gst_fdsrc_change_state (GstElement * element) +static GstStateChangeReturn +gst_fdsrc_change_state (GstElement * element, GstStateChange transition) { GstFdSrc *src = GST_FDSRC (element); - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_NULL_TO_READY: + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: break; - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: src->curoffset = 0; break; - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: break; default: break; } if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - return GST_STATE_SUCCESS; + return GST_STATE_CHANGE_SUCCESS; } diff --git a/gst/elements/gstfilesink.c b/gst/elements/gstfilesink.c index 455ce7e4f..596d76827 100644 --- a/gst/elements/gstfilesink.c +++ b/gst/elements/gstfilesink.c @@ -91,7 +91,8 @@ static gboolean gst_file_sink_query (GstPad * pad, GstQuery * query); static void gst_file_sink_uri_handler_init (gpointer g_iface, gpointer iface_data); -static GstElementStateReturn gst_file_sink_change_state (GstElement * element); +static GstStateChangeReturn gst_file_sink_change_state (GstElement * element, + GstStateChange transition); //static guint gst_file_sink_signals[LAST_SIGNAL] = { 0 }; @@ -401,36 +402,33 @@ handle_error: return GST_FLOW_ERROR; } -static GstElementStateReturn -gst_file_sink_change_state (GstElement * element) +static GstStateChangeReturn +gst_file_sink_change_state (GstElement * element, GstStateChange transition) { - GstElementStateReturn ret; - gint transition; - - transition = GST_STATE_TRANSITION (element); + GstStateChangeReturn ret; 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: if (!gst_file_sink_open_file (GST_FILE_SINK (element))) goto open_error; break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; default: break; } - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); + ret = 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: gst_file_sink_close_file (GST_FILE_SINK (element)); break; - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: break; default: break; @@ -440,7 +438,7 @@ gst_file_sink_change_state (GstElement * element) open_error: { - return GST_STATE_FAILURE; + return GST_STATE_CHANGE_FAILURE; } } diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index 6106f9bbc..8c6785d8b 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -259,7 +259,7 @@ gst_file_src_set_location (GstFileSrc * src, const gchar * location) /* the element must be stopped in order to do this */ GST_STATE_LOCK (src); { - GstElementState state; + GstState state; state = GST_STATE (src); if (state != GST_STATE_READY && state != GST_STATE_NULL) diff --git a/gst/elements/gsttypefindelement.c b/gst/elements/gsttypefindelement.c index 157a9d58f..66aba4f11 100644 --- a/gst/elements/gsttypefindelement.c +++ b/gst/elements/gsttypefindelement.c @@ -131,8 +131,9 @@ static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad, guint64 offset, guint length, GstBuffer ** buffer); static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad); -static GstElementStateReturn -gst_type_find_element_change_state (GstElement * element); +static GstStateChangeReturn +gst_type_find_element_change_state (GstElement * element, + GstStateChange transition); static gboolean gst_type_find_element_activate (GstPad * pad); static gboolean gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active); @@ -406,7 +407,7 @@ start_typefinding (GstTypeFindElement * typefind) static void stop_typefinding (GstTypeFindElement * typefind) { - GstElementState state; + GstState state; gboolean push_cached_buffers; gst_element_get_state (GST_ELEMENT (typefind), &state, NULL, NULL); @@ -837,21 +838,20 @@ gst_type_find_element_activate (GstPad * pad) } } -static GstElementStateReturn -gst_type_find_element_change_state (GstElement * element) +static GstStateChangeReturn +gst_type_find_element_change_state (GstElement * element, + GstStateChange transition) { - GstElementState transition; - GstElementStateReturn ret; + GstStateChangeReturn ret; GstTypeFindElement *typefind; typefind = GST_TYPE_FIND_ELEMENT (element); - transition = GST_STATE_TRANSITION (element); - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); switch (transition) { - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: gst_caps_replace (&typefind->caps, NULL); break; default: diff --git a/gst/gstbin.c b/gst/gstbin.c index 51882d15c..c6afc2d8f 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -94,9 +94,10 @@ GType _gst_bin_type = 0; static void gst_bin_dispose (GObject * object); -static GstElementStateReturn gst_bin_change_state (GstElement * element); -static GstElementStateReturn gst_bin_get_state (GstElement * element, - GstElementState * state, GstElementState * pending, GTimeVal * timeout); +static GstStateChangeReturn gst_bin_change_state (GstElement * element, + GstStateChange transition); +static GstStateChangeReturn gst_bin_get_state (GstElement * element, + GstState * state, GstState * pending, GTimeVal * timeout); static gboolean gst_bin_add_func (GstBin * bin, GstElement * element); static gboolean gst_bin_remove_func (GstBin * bin, GstElement * element); @@ -959,12 +960,12 @@ gst_bin_iterate_sinks (GstBin * bin) * * MT safe */ -static GstElementStateReturn -gst_bin_get_state (GstElement * element, GstElementState * state, - GstElementState * pending, GTimeVal * timeout) +static GstStateChangeReturn +gst_bin_get_state (GstElement * element, GstState * state, + GstState * pending, GTimeVal * timeout) { GstBin *bin = GST_BIN (element); - GstElementStateReturn ret = GST_STATE_SUCCESS; + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GList *children; guint32 children_cookie; gboolean have_no_preroll; @@ -1014,14 +1015,14 @@ restart: switch (ret) { /* report FAILURE immediatly */ - case GST_STATE_FAILURE: + case GST_STATE_CHANGE_FAILURE: goto done; - case GST_STATE_NO_PREROLL: + case GST_STATE_CHANGE_NO_PREROLL: /* we have to continue scanning as there might be * ERRORS too */ have_no_preroll = TRUE; break; - case GST_STATE_ASYNC: + case GST_STATE_CHANGE_ASYNC: have_async = TRUE; break; default: @@ -1032,7 +1033,7 @@ restart: /* if we get here, we have no FAILURES, check for any NO_PREROLL * elements then. */ if (have_no_preroll) { - ret = GST_STATE_NO_PREROLL; + ret = GST_STATE_CHANGE_NO_PREROLL; goto done; } @@ -1042,7 +1043,7 @@ restart: /* if no ASYNC elements exist we don't even have to poll with a * timeout again */ if (!have_async) { - ret = GST_STATE_SUCCESS; + ret = GST_STATE_CHANGE_SUCCESS; goto done; } } @@ -1075,13 +1076,13 @@ restart: } switch (ret) { - case GST_STATE_SUCCESS: + case GST_STATE_CHANGE_SUCCESS: break; - case GST_STATE_FAILURE: - case GST_STATE_NO_PREROLL: + case GST_STATE_CHANGE_FAILURE: + case GST_STATE_CHANGE_NO_PREROLL: /* report FAILURE and NO_PREROLL immediatly */ goto done; - case GST_STATE_ASYNC: + case GST_STATE_CHANGE_ASYNC: goto done; default: g_assert_not_reached (); @@ -1100,11 +1101,11 @@ done: * added after this function completed. */ GST_STATE_LOCK (bin); switch (ret) { - case GST_STATE_SUCCESS: + case GST_STATE_CHANGE_SUCCESS: /* we can commit the state */ gst_element_commit_state (element); break; - case GST_STATE_FAILURE: + case GST_STATE_CHANGE_FAILURE: /* some element failed, abort the state change */ gst_element_abort_state (element); break; @@ -1206,12 +1207,12 @@ remove_all_from_queue (GQueue * queue, gpointer elem, gboolean unref) */ /* FIXME, make me more elegant, want to use a topological sort algorithm * based on indegrees (or outdegrees in our case) */ -static GstElementStateReturn -gst_bin_change_state (GstElement * element) +static GstStateChangeReturn +gst_bin_change_state (GstElement * element, GstStateChange transition) { GstBin *bin; - GstElementStateReturn ret; - GstElementState old_state, pending; + GstStateChangeReturn ret; + GstState old_state, pending; gboolean have_async = FALSE; gboolean have_no_preroll = FALSE; GList *children; @@ -1233,10 +1234,10 @@ gst_bin_change_state (GstElement * element) gst_element_state_get_name (pending)); if (pending == GST_STATE_VOID_PENDING) - return GST_STATE_SUCCESS; + return GST_STATE_CHANGE_SUCCESS; /* Clear eosed element list on READY-> PAUSED */ - if (GST_STATE_TRANSITION (element) == GST_STATE_READY_TO_PAUSED) { + if (transition == GST_STATE_CHANGE_READY_TO_PAUSED) { g_list_free (bin->eosed); bin->eosed = NULL; } @@ -1399,28 +1400,28 @@ restart: GST_UNLOCK (bin); switch (ret) { - case GST_STATE_SUCCESS: + case GST_STATE_CHANGE_SUCCESS: GST_CAT_DEBUG (GST_CAT_STATES, "child '%s' changed state to %d(%s) successfully", GST_ELEMENT_NAME (qelement), pending, gst_element_state_get_name (pending)); break; - case GST_STATE_ASYNC: + case GST_STATE_CHANGE_ASYNC: GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "child '%s' is changing state asynchronously", GST_ELEMENT_NAME (qelement)); have_async = TRUE; break; - case GST_STATE_FAILURE: + case GST_STATE_CHANGE_FAILURE: GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "child '%s' failed to go to state %d(%s)", GST_ELEMENT_NAME (qelement), pending, gst_element_state_get_name (pending)); - ret = GST_STATE_FAILURE; + ret = GST_STATE_CHANGE_FAILURE; /* release refcount of element we popped off the queue */ gst_object_unref (qelement); goto exit; - case GST_STATE_NO_PREROLL: + case GST_STATE_CHANGE_NO_PREROLL: GST_CAT_DEBUG (GST_CAT_STATES, "child '%s' changed state to %d(%s) successfully without preroll", GST_ELEMENT_NAME (qelement), pending, @@ -1448,11 +1449,11 @@ restart: } if (have_no_preroll) { - ret = GST_STATE_NO_PREROLL; + ret = GST_STATE_CHANGE_NO_PREROLL; } else if (have_async) { - ret = GST_STATE_ASYNC; + ret = GST_STATE_CHANGE_ASYNC; } else { - ret = parent_class->change_state (element); + ret = parent_class->change_state (element, transition); } GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, diff --git a/gst/gstelement.c b/gst/gstelement.c index f7c275d2e..6efb0a170 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -63,9 +63,10 @@ static void gst_element_base_class_finalize (gpointer g_class); static void gst_element_dispose (GObject * object); static void gst_element_finalize (GObject * object); -static GstElementStateReturn gst_element_change_state (GstElement * element); -static GstElementStateReturn gst_element_get_state_func (GstElement * element, - GstElementState * state, GstElementState * pending, GTimeVal * timeout); +static GstStateChangeReturn gst_element_change_state (GstElement * element, + GstStateChange transition); +static GstStateChangeReturn gst_element_get_state_func (GstElement * element, + GstState * state, GstState * pending, GTimeVal * timeout); static void gst_element_set_bus_func (GstElement * element, GstBus * bus); #ifndef GST_DISABLE_LOADSAVE @@ -119,7 +120,7 @@ gst_element_class_init (GstElementClass * klass) * @old_state: the GST_STATE_XXX before the change * @new_state: the GST_STATE_XXX after the change * - * the #GstElementState of the element has been changed + * the #GstState of the element has been changed */ gst_element_signals[STATE_CHANGE] = g_signal_new ("state-changed", G_TYPE_FROM_CLASS (klass), @@ -1509,32 +1510,33 @@ gst_element_sync_state_with_parent (GstElement * element) GST_ELEMENT_NAME (parent), gst_element_state_get_name (GST_STATE (parent))); - if (gst_element_set_state (element, GST_STATE (parent)) == GST_STATE_FAILURE) { + if (gst_element_set_state (element, + GST_STATE (parent)) == GST_STATE_CHANGE_FAILURE) { return FALSE; } return TRUE; } /* MT safe */ -static GstElementStateReturn +static GstStateChangeReturn gst_element_get_state_func (GstElement * element, - GstElementState * state, GstElementState * pending, GTimeVal * timeout) + GstState * state, GstState * pending, GTimeVal * timeout) { - GstElementStateReturn ret = GST_STATE_FAILURE; - GstElementState old_pending; + GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE; + GstState old_pending; GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "getting state"); GST_STATE_LOCK (element); /* we got an error, report immediatly */ if (GST_STATE_NO_PREROLL (element)) { - ret = GST_STATE_NO_PREROLL; + ret = GST_STATE_CHANGE_NO_PREROLL; goto done; } /* we got an error, report immediatly */ if (GST_STATE_ERROR (element)) { - ret = GST_STATE_FAILURE; + ret = GST_STATE_CHANGE_FAILURE; goto done; } @@ -1556,22 +1558,22 @@ gst_element_get_state_func (GstElement * element, if (!GST_STATE_TIMED_WAIT (element, timeval)) { GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "timeout"); /* timeout triggered */ - ret = GST_STATE_ASYNC; + ret = GST_STATE_CHANGE_ASYNC; } else { /* could be success or failure */ if (old_pending == GST_STATE (element)) { GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "got success"); - ret = GST_STATE_SUCCESS; + ret = GST_STATE_CHANGE_SUCCESS; } else { GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "got failure"); - ret = GST_STATE_FAILURE; + ret = GST_STATE_CHANGE_FAILURE; } } } /* if nothing is pending anymore we can return SUCCESS */ if (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING) { GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "nothing pending"); - ret = GST_STATE_SUCCESS; + ret = GST_STATE_CHANGE_SUCCESS; } done: @@ -1594,8 +1596,8 @@ done: /** * gst_element_get_state: * @element: a #GstElement to get the state of. - * @state: a pointer to #GstElementState to hold the state. Can be NULL. - * @pending: a pointer to #GstElementState to hold the pending state. + * @state: a pointer to #GstState to hold the state. Can be NULL. + * @pending: a pointer to #GstState to hold the pending state. * Can be NULL. * @timeout: a #GTimeVal to specify the timeout for an async * state change or NULL for infinite timeout. @@ -1607,23 +1609,23 @@ done: * specified timeout value for the state change to complete. * If the element completes the state change or goes into * an error, this function returns immediatly with a return value of - * GST_STATE_SUCCESS or GST_STATE_FAILURE respectively. + * GST_STATE_CHANGE_SUCCESS or GST_STATE_CHANGE_FAILURE respectively. * - * Returns: GST_STATE_SUCCESS if the element has no more pending state and - * the last state change succeeded, GST_STATE_ASYNC + * Returns: GST_STATE_CHANGE_SUCCESS if the element has no more pending state and + * the last state change succeeded, GST_STATE_CHANGE_ASYNC * if the element is still performing a state change or - * GST_STATE_FAILURE if the last state change failed. + * GST_STATE_CHANGE_FAILURE if the last state change failed. * * MT safe. */ -GstElementStateReturn +GstStateChangeReturn gst_element_get_state (GstElement * element, - GstElementState * state, GstElementState * pending, GTimeVal * timeout) + GstState * state, GstState * pending, GTimeVal * timeout) { GstElementClass *oclass; - GstElementStateReturn result = GST_STATE_FAILURE; + GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE; - g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE); + g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_CHANGE_FAILURE); oclass = GST_ELEMENT_GET_CLASS (element); @@ -1648,7 +1650,7 @@ gst_element_get_state (GstElement * element, void gst_element_abort_state (GstElement * element) { - GstElementState pending; + GstState pending; g_return_if_fail (GST_IS_ELEMENT (element)); @@ -1656,7 +1658,7 @@ gst_element_abort_state (GstElement * element) if (pending != GST_STATE_VOID_PENDING && !GST_STATE_ERROR (element)) { #ifndef GST_DISABLE_GST_DEBUG - GstElementState old_state = GST_STATE (element); + GstState old_state = GST_STATE (element); #endif GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, @@ -1684,7 +1686,7 @@ gst_element_abort_state (GstElement * element) void gst_element_commit_state (GstElement * element) { - GstElementState pending; + GstState pending; GstMessage *message; g_return_if_fail (GST_IS_ELEMENT (element)); @@ -1692,7 +1694,7 @@ gst_element_commit_state (GstElement * element) pending = GST_STATE_PENDING (element); if (pending != GST_STATE_VOID_PENDING) { - GstElementState old_state = GST_STATE (element); + GstState old_state = GST_STATE (element); GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "commiting state from %s to %s", gst_element_state_get_name (old_state), @@ -1735,7 +1737,7 @@ gst_element_lost_state (GstElement * element) if (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING && !GST_STATE_ERROR (element)) { - GstElementState current_state = GST_STATE (element); + GstState current_state = GST_STATE (element); GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "lost state of %s", gst_element_state_get_name (current_state)); @@ -1748,27 +1750,27 @@ gst_element_lost_state (GstElement * element) /** * gst_element_set_state: * @element: a #GstElement to change state of. - * @state: the element's new #GstElementState. + * @state: the element's new #GstState. * * Sets the state of the element. This function will try to set the * requested state by going through all the intermediary states and calling * the class's state change function for each. * - * Returns: Result of the state change using #GstElementStateReturn. + * Returns: Result of the state change using #GstStateChangeReturn. * * MT safe. */ -GstElementStateReturn -gst_element_set_state (GstElement * element, GstElementState state) +GstStateChangeReturn +gst_element_set_state (GstElement * element, GstState state) { GstElementClass *oclass; - GstElementState current; - GstElementStateReturn return_val = GST_STATE_SUCCESS; - GstElementStateReturn ret; - GstElementState pending; + GstState current; + GstStateChangeReturn return_val = GST_STATE_CHANGE_SUCCESS; + GstStateChangeReturn ret; + GstState pending; GTimeVal tv; - g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE); + g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_CHANGE_FAILURE); /* get current element state, need to call the method so that * we call the virtual method and subclasses can implement their @@ -1780,7 +1782,7 @@ gst_element_set_state (GstElement * element, GstElementState state) GST_STATE_LOCK (element); /* this is the state we should go to */ GST_STATE_FINAL (element) = state; - if (ret == GST_STATE_ASYNC) { + if (ret == GST_STATE_CHANGE_ASYNC) { gst_element_commit_state (element); gst_element_lost_state (element); } @@ -1797,13 +1799,13 @@ gst_element_set_state (GstElement * element, GstElementState state) * current state is equal to the required state. This is needed * for bins that sync their children. */ do { - GstElementState pending; + GstState pending; /* calculate the pending state */ if (current < state) - pending = current << 1; + pending = current + 1; else if (current > state) - pending = current >> 1; + pending = current - 1; else pending = current; @@ -1818,9 +1820,9 @@ gst_element_set_state (GstElement * element, GstElementState state) /* call the state change function so it can set the state */ if (oclass->change_state) - return_val = (oclass->change_state) (element); + return_val = (oclass->change_state) (element, GST_STATE_CHANGE (element)); else - return_val = GST_STATE_FAILURE; + return_val = GST_STATE_CHANGE_FAILURE; /* clear the error and preroll flag, we need to do that after * calling the virtual change_state function so that it can use the @@ -1829,26 +1831,26 @@ gst_element_set_state (GstElement * element, GstElementState state) GST_STATE_NO_PREROLL (element) = FALSE; switch (return_val) { - case GST_STATE_FAILURE: + case GST_STATE_CHANGE_FAILURE: GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "have failed change_state return"); /* state change failure exits the loop */ gst_element_abort_state (element); goto exit; - case GST_STATE_ASYNC: + case GST_STATE_CHANGE_ASYNC: GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "element will change state async"); /* an async state change exits the loop, we can only * go to the next state change when this one completes. */ goto exit; - case GST_STATE_SUCCESS: + case GST_STATE_CHANGE_SUCCESS: GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "element changed state successfully"); /* we can commit the state now and proceed to the next state */ gst_element_commit_state (element); GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "commited state"); break; - case GST_STATE_NO_PREROLL: + case GST_STATE_CHANGE_NO_PREROLL: GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "element changed state successfully and can't preroll"); /* we can commit the state now and proceed to the next state */ @@ -1881,7 +1883,7 @@ invalid_return: /* somebody added a GST_STATE_ and forgot to do stuff here ! */ g_critical ("unknown return value %d from a state change function", return_val); - return GST_STATE_FAILURE; + return GST_STATE_CHANGE_FAILURE; } } @@ -1958,54 +1960,51 @@ gst_element_pads_activate (GstElement * element, gboolean active) } /* is called with STATE_LOCK */ -static GstElementStateReturn -gst_element_change_state (GstElement * element) +static GstStateChangeReturn +gst_element_change_state (GstElement * element, GstStateChange transition) { - GstElementState old_state; - gint old_pending, old_transition; - GstElementStateReturn result = GST_STATE_SUCCESS; + GstState state, pending; + GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS; - g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE); + g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_CHANGE_FAILURE); - old_state = GST_STATE (element); - old_pending = GST_STATE_PENDING (element); - old_transition = GST_STATE_TRANSITION (element); + state = GST_STATE (element); + pending = GST_STATE_PENDING (element); /* if the element already is in the given state, we just return success */ - if (old_pending == GST_STATE_VOID_PENDING || - old_state == GST_STATE_PENDING (element)) { + if (pending == GST_STATE_VOID_PENDING || state == GST_STATE_PENDING (element)) { GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "element is already in the %s state", - gst_element_state_get_name (old_state)); + gst_element_state_get_name (state)); if (GST_STATE_NO_PREROLL (element)) - return GST_STATE_NO_PREROLL; + return GST_STATE_CHANGE_NO_PREROLL; else - return GST_STATE_SUCCESS; + return GST_STATE_CHANGE_SUCCESS; } GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "default handler tries setting state from %s to %s (%04x)", - gst_element_state_get_name (old_state), - gst_element_state_get_name (old_pending), old_transition); + gst_element_state_get_name (state), + gst_element_state_get_name (pending), transition); - switch (old_transition) { - case GST_STATE_NULL_TO_READY: + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: if (!gst_element_pads_activate (element, TRUE)) { - result = GST_STATE_FAILURE; + result = GST_STATE_CHANGE_FAILURE; } break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; - case GST_STATE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: break; - case GST_STATE_PAUSED_TO_READY: - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_PAUSED_TO_READY: + case GST_STATE_CHANGE_READY_TO_NULL: /* deactivate pads in both cases, since they are activated on ready->paused but the element might not have made it to paused */ if (!gst_element_pads_activate (element, FALSE)) { - result = GST_STATE_FAILURE; + result = GST_STATE_CHANGE_FAILURE; } else { GST_LOCK (element); element->base_time = 0; @@ -2019,8 +2018,8 @@ gst_element_change_state (GstElement * element) * - somehow the element was asked to jump across an intermediate state */ g_warning ("Unhandled state change from %s to %s", - gst_element_state_get_name (old_state), - gst_element_state_get_name (old_pending)); + gst_element_state_get_name (state), + gst_element_state_get_name (pending)); break; } diff --git a/gst/gstelement.h b/gst/gstelement.h index bc08348d6..cdb885a21 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -28,15 +28,15 @@ typedef struct _GstElement GstElement; typedef struct _GstElementClass GstElementClass; -/* gstmessage.h needs ElementState */ -#define GST_NUM_STATES 4 +/* gstmessage.h needs State */ typedef enum { - GST_STATE_VOID_PENDING = 0, - GST_STATE_NULL = (1 << 0), - GST_STATE_READY = (1 << 1), - GST_STATE_PAUSED = (1 << 2), - GST_STATE_PLAYING = (1 << 3) -} GstElementState; + GST_STATE_VOID_PENDING = 0, /* used for GstElement->pending_state when + there is no pending state */ + GST_STATE_NULL = 1, + GST_STATE_READY = 2, + GST_STATE_PAUSED = 3, + GST_STATE_PLAYING = 4 +} GstState; #include <gst/gstconfig.h> @@ -65,11 +65,11 @@ GST_EXPORT GType _gst_element_type; #define GST_ELEMENT_CAST(obj) ((GstElement*)(obj)) typedef enum { - GST_STATE_FAILURE = 0, - GST_STATE_SUCCESS = 1, - GST_STATE_ASYNC = 2, - GST_STATE_NO_PREROLL = 3 -} GstElementStateReturn; + GST_STATE_CHANGE_FAILURE = 0, + GST_STATE_CHANGE_SUCCESS = 1, + GST_STATE_CHANGE_ASYNC = 2, + GST_STATE_CHANGE_NO_PREROLL = 3 +} GstStateChangeReturn; /* NOTE: this probably should be done with an #ifdef to decide * whether to safe-cast or to just do the non-checking cast. @@ -80,14 +80,33 @@ typedef enum { #define GST_STATE_ERROR(obj) (GST_ELEMENT(obj)->state_error) #define GST_STATE_NO_PREROLL(obj) (GST_ELEMENT(obj)->no_preroll) -/* Note: using 8 bit shift mostly "just because", it leaves us enough room to grow <g> */ -#define GST_STATE_TRANSITION(obj) ((GST_STATE(obj)<<8) | GST_STATE_PENDING(obj)) -#define GST_STATE_NULL_TO_READY ((GST_STATE_NULL<<8) | GST_STATE_READY) -#define GST_STATE_READY_TO_PAUSED ((GST_STATE_READY<<8) | GST_STATE_PAUSED) -#define GST_STATE_PAUSED_TO_PLAYING ((GST_STATE_PAUSED<<8) | GST_STATE_PLAYING) -#define GST_STATE_PLAYING_TO_PAUSED ((GST_STATE_PLAYING<<8) | GST_STATE_PAUSED) -#define GST_STATE_PAUSED_TO_READY ((GST_STATE_PAUSED<<8) | GST_STATE_READY) -#define GST_STATE_READY_TO_NULL ((GST_STATE_READY<<8) | GST_STATE_NULL) +#ifndef GST_DEBUG_STATE_CHANGE +#define GST_STATE_CHANGE(obj) ((1<<(GST_STATE(obj)+8)) | 1<<GST_STATE_PENDING(obj)) +#else +inline GstStateChange +_gst_element_get_state_change (GstElement *e) +{ + if (e->state < GST_STATE_NULL || e->state > GST_STATE_PLAYING) + g_assert_not_reached (); + if (e->pending_state < GST_STATE_NULL || e->pending_state > GST_STATE_PLAYING) + g_assert_not_reached (); + if (e->state - e->pending_state != 1 && e->pending_state - e->state != 1) + g_assert_not_reached (); + return (1<<(GST_STATE(obj)+8)) | 1<<GST_STATE_PENDING(obj); +} +#define GST_STATE_CHANGE(obj) _gst_element_get_state_change(obj) +#endif + +/* FIXME: How to deal with lost_state ? */ +typedef enum +{ + GST_STATE_CHANGE_NULL_TO_READY = 1<<(GST_STATE_NULL+8) | 1<<GST_STATE_READY, + GST_STATE_CHANGE_READY_TO_PAUSED = 1<<(GST_STATE_READY+8) | 1<<GST_STATE_PAUSED, + GST_STATE_CHANGE_PAUSED_TO_PLAYING = 1<<(GST_STATE_PAUSED+8) | 1<<GST_STATE_PLAYING, + GST_STATE_CHANGE_PLAYING_TO_PAUSED = 1<<(GST_STATE_PLAYING+8) | 1<<GST_STATE_PAUSED, + GST_STATE_CHANGE_PAUSED_TO_READY = 1<<(GST_STATE_PAUSED+8) | 1<<GST_STATE_READY, + GST_STATE_CHANGE_READY_TO_NULL = 1<<(GST_STATE_READY+8) | 1<<GST_STATE_NULL +} GstStateChange; typedef enum { @@ -219,7 +238,7 @@ struct _GstElementClass /*< private >*/ /* signal callbacks */ - void (*state_changed) (GstElement *element, GstElementState old, GstElementState state); + void (*state_changed) (GstElement *element, GstState old, GstState state); void (*pad_added) (GstElement *element, GstPad *pad); void (*pad_removed) (GstElement *element, GstPad *pad); void (*no_more_pads) (GstElement *element); @@ -232,9 +251,9 @@ struct _GstElementClass void (*release_pad) (GstElement *element, GstPad *pad); /* state changes */ - GstElementStateReturn (*get_state) (GstElement * element, GstElementState * state, - GstElementState * pending, GTimeVal * timeout); - GstElementStateReturn (*change_state) (GstElement *element); + GstStateChangeReturn (*get_state) (GstElement * element, GstState * state, + GstState * pending, GTimeVal * timeout); + GstStateChangeReturn (*change_state) (GstElement *element, GstStateChange transition); /* bus */ void (*set_bus) (GstElement * element, GstBus * bus); @@ -329,11 +348,11 @@ gboolean gst_element_is_locked_state (GstElement *element); gboolean gst_element_set_locked_state (GstElement *element, gboolean locked_state); gboolean gst_element_sync_state_with_parent (GstElement *element); -GstElementStateReturn gst_element_get_state (GstElement * element, - GstElementState * state, - GstElementState * pending, +GstStateChangeReturn gst_element_get_state (GstElement * element, + GstState * state, + GstState * pending, GTimeVal * timeout); -GstElementStateReturn gst_element_set_state (GstElement *element, GstElementState state); +GstStateChangeReturn gst_element_set_state (GstElement *element, GstState state); void gst_element_abort_state (GstElement * element); void gst_element_commit_state (GstElement * element); diff --git a/gst/gstmessage.c b/gst/gstmessage.c index 997e78f63..86c617984 100644 --- a/gst/gstmessage.c +++ b/gst/gstmessage.c @@ -307,8 +307,7 @@ gst_message_new_tag (GstObject * src, GstTagList * tag_list) * MT safe. */ GstMessage * -gst_message_new_state_changed (GstObject * src, GstElementState old, - GstElementState new) +gst_message_new_state_changed (GstObject * src, GstState old, GstState new) { GstMessage *message; GstStructure *s; @@ -460,8 +459,8 @@ gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list) * MT safe. */ void -gst_message_parse_state_changed (GstMessage * message, GstElementState * old, - GstElementState * new) +gst_message_parse_state_changed (GstMessage * message, GstState * old, + GstState * new) { g_return_if_fail (GST_IS_MESSAGE (message)); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED); diff --git a/gst/gstmessage.h b/gst/gstmessage.h index 349577766..ac6ebbc82 100644 --- a/gst/gstmessage.h +++ b/gst/gstmessage.h @@ -138,8 +138,8 @@ GstMessage * gst_message_new_eos (GstObject * src); GstMessage * gst_message_new_error (GstObject * src, GError * error, gchar * debug); GstMessage * gst_message_new_warning (GstObject * src, GError * error, gchar * debug); GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list); -GstMessage * gst_message_new_state_changed (GstObject * src, GstElementState old_state, - GstElementState new_state); +GstMessage * gst_message_new_state_changed (GstObject * src, GstState old_state, + GstState new_state); GstMessage * gst_message_new_segment_start (GstObject * src, GstClockTime timestamp); GstMessage * gst_message_new_segment_done (GstObject * src, GstClockTime timestamp); GstMessage * gst_message_new_custom (GstMessageType type, @@ -166,8 +166,8 @@ GstMessage * gst_message_new_custom (GstMessageType type, void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug); void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug); void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list); -void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state, - GstElementState *new_state); +void gst_message_parse_state_changed (GstMessage *message, GstState *old_state, + GstState *new_state); void gst_message_parse_segment_start (GstMessage *message, GstClockTime *timestamp); void gst_message_parse_segment_done (GstMessage *message, GstClockTime *timestamp); diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c index b9f207a7b..20dd0071c 100644 --- a/gst/gstpipeline.c +++ b/gst/gstpipeline.c @@ -64,7 +64,8 @@ static gboolean gst_pipeline_send_event (GstElement * element, GstEvent * event); static GstClock *gst_pipeline_get_clock_func (GstElement * element); -static GstElementStateReturn gst_pipeline_change_state (GstElement * element); +static GstStateChangeReturn gst_pipeline_change_state (GstElement * element, + GstStateChange transition); static GstBinClass *parent_class = NULL; @@ -204,7 +205,7 @@ gst_pipeline_send_event (GstElement * element, GstEvent * event) { gboolean was_playing; gboolean res; - GstElementState state; + GstState state; GstEventType event_type = GST_EVENT_TYPE (event); GTimeVal timeout; @@ -249,25 +250,24 @@ gst_pipeline_new (const gchar * name) } /* MT safe */ -static GstElementStateReturn -gst_pipeline_change_state (GstElement * element) +static GstStateChangeReturn +gst_pipeline_change_state (GstElement * element, GstStateChange transition) { - GstElementStateReturn result = GST_STATE_SUCCESS; + GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS; GstPipeline *pipeline = GST_PIPELINE (element); - gint transition = GST_STATE_TRANSITION (element); GstClockTime play_timeout; GstClock *clock; switch (transition) { - case GST_STATE_NULL_TO_READY: + case GST_STATE_CHANGE_NULL_TO_READY: GST_LOCK (element); if (element->bus) gst_bus_set_flushing (element->bus, FALSE); GST_UNLOCK (element); break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: /* when going to playing, select a clock */ if ((clock = gst_element_get_clock (element))) { GstClockTime start_time; @@ -293,21 +293,23 @@ gst_pipeline_change_state (GstElement * element) gst_element_set_base_time (element, 0); } break; - case GST_STATE_PLAYING_TO_PAUSED: - case GST_STATE_PAUSED_TO_READY: - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PAUSED_TO_READY: + case GST_STATE_CHANGE_READY_TO_NULL: 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_READY_TO_PAUSED: + case GST_STATE_CHANGE_NULL_TO_READY: + break; + case GST_STATE_CHANGE_READY_TO_PAUSED: gst_pipeline_set_new_stream_time (pipeline, 0); break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; - case GST_STATE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: GST_LOCK (element); if ((clock = element->clock)) { GstClockTime now; @@ -329,9 +331,9 @@ gst_pipeline_change_state (GstElement * element) } GST_UNLOCK (element); 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: GST_LOCK (element); if (element->bus) { gst_bus_set_flushing (element->bus, TRUE); @@ -340,7 +342,7 @@ gst_pipeline_change_state (GstElement * element) break; } - if (result == GST_STATE_ASYNC) { + if (result == GST_STATE_CHANGE_ASYNC) { GST_LOCK (pipeline); play_timeout = pipeline->play_timeout; GST_UNLOCK (pipeline); @@ -363,11 +365,11 @@ gst_pipeline_change_state (GstElement * element) } result = gst_element_get_state (element, NULL, NULL, timeval); - if (result == GST_STATE_ASYNC) { + if (result == GST_STATE_CHANGE_ASYNC) { GST_WARNING_OBJECT (pipeline, "timeout in PREROLL, forcing next state change"); g_warning ("timeout in PREROLL, forcing next state change"); - result = GST_STATE_SUCCESS; + result = GST_STATE_CHANGE_SUCCESS; } GST_STATE_LOCK (pipeline); diff --git a/gst/gstqueue.c b/gst/gstqueue.c index fe4242102..5cb446913 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -147,7 +147,8 @@ static void gst_queue_locked_flush (GstQueue * queue); static gboolean gst_queue_src_activate_push (GstPad * pad, gboolean active); static gboolean gst_queue_sink_activate_push (GstPad * pad, gboolean active); -static GstElementStateReturn gst_queue_change_state (GstElement * element); +static GstStateChangeReturn gst_queue_change_state (GstElement * element, + GstStateChange transition); #define GST_TYPE_QUEUE_LEAKY (queue_leaky_get_type ()) @@ -989,35 +990,35 @@ gst_queue_src_activate_push (GstPad * pad, gboolean active) return result; } -static GstElementStateReturn -gst_queue_change_state (GstElement * element) +static GstStateChangeReturn +gst_queue_change_state (GstElement * element, GstStateChange transition) { GstQueue *queue; - GstElementStateReturn ret = GST_STATE_SUCCESS; + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; queue = GST_QUEUE (element); GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "starting state change"); - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_NULL_TO_READY: + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; default: break; } - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_PLAYING_TO_PAUSED: + switch (transition) { + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: 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: break; default: break; diff --git a/gst/gstutils.c b/gst/gstutils.c index 624d6dac3..5723f4bf8 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -703,14 +703,14 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad, /** * gst_element_state_get_name: - * @state: a #GstElementState to get the name of. + * @state: a #GstState to get the name of. * * Gets a string representing the given state. * * Returns: a string with the name of the state. */ const gchar * -gst_element_state_get_name (GstElementState state) +gst_element_state_get_name (GstState state) { switch (state) { #ifdef GST_DEBUG_COLOR @@ -1278,7 +1278,7 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname, if (filter) { GstElement *capsfilter; GstObject *parent; - GstElementState state, pending; + GstState state, pending; GTimeVal tv; capsfilter = gst_element_factory_make ("capsfilter", NULL); @@ -1841,13 +1841,13 @@ gst_bin_remove_many (GstBin * bin, GstElement * element_1, ...) static void get_state_func (GstElement * element, gpointer unused) { - GstElementStateReturn ret = GST_STATE_ASYNC; + GstStateChangeReturn ret = GST_STATE_CHANGE_ASYNC; GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "new thread waiting on state change"); /* wait indefinitely */ - while (ret == GST_STATE_ASYNC) + while (ret == GST_STATE_CHANGE_ASYNC) ret = gst_element_get_state (element, NULL, NULL, NULL); gst_object_unref (element); @@ -1859,7 +1859,7 @@ get_state_func (GstElement * element, gpointer unused) * * Spawns a thread calling gst_element_get_state on @bin with infinite timeout. * - * In practice this is done because if a bin returns %GST_STATE_ASYNC from a + * In practice this is done because if a bin returns %GST_STATE_CHANGE_ASYNC from a * state change it will not commit its state until someone calls * gst_element_get_state() on it. Thus having another thread checking the bin's * state will ensure that a state-changed message gets posted on the bus diff --git a/gst/gstutils.h b/gst/gstutils.h index 777e3de5b..4e2740b6b 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -292,7 +292,7 @@ GstPad* gst_element_get_compatible_pad (GstElement *element, Gs GstPadTemplate* gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl); -G_CONST_RETURN gchar* gst_element_state_get_name (GstElementState state); +G_CONST_RETURN gchar* gst_element_state_get_name (GstState state); gboolean gst_element_link (GstElement *src, GstElement *dest); gboolean gst_element_link_many (GstElement *element_1, diff --git a/gst/parse/grammar.y b/gst/parse/grammar.y index e6bf0e0b9..dc552c767 100644 --- a/gst/parse/grammar.y +++ b/gst/parse/grammar.y @@ -352,7 +352,7 @@ gst_parse_element_lock (GstElement *element, gboolean lock) GST_CAT_DEBUG (GST_CAT_PIPELINE, "trying to sync state of element with parent"); /* FIXME: it would be nice if we can figure out why it failed (e.g. caps nego) and give an error about that instead. */ - if (gst_element_set_state (element, GST_STATE_PLAYING) == GST_STATE_FAILURE) + if (gst_element_set_state (element, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL)); } } else { 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); } diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index 643a759bd..9bbdc925a 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -121,7 +121,8 @@ static void gst_fake_sink_set_property (GObject * object, guint prop_id, static void gst_fake_sink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_fake_sink_change_state (GstElement * element); +static GstStateChangeReturn gst_fake_sink_change_state (GstElement * element, + GstStateChange transition); static GstFlowReturn gst_fake_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer); @@ -382,35 +383,34 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf) return GST_FLOW_OK; } -static GstElementStateReturn -gst_fake_sink_change_state (GstElement * element) +static GstStateChangeReturn +gst_fake_sink_change_state (GstElement * element, GstStateChange transition) { - GstElementStateReturn ret = GST_STATE_SUCCESS; + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstFakeSink *fakesink = GST_FAKE_SINK (element); - GstElementState transition = GST_STATE_TRANSITION (element); switch (transition) { - case GST_STATE_NULL_TO_READY: + case GST_STATE_CHANGE_NULL_TO_READY: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_NULL_READY) goto error; break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_PAUSED) goto error; break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_PLAYING) goto error; break; - case GST_STATE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PLAYING_PAUSED) goto error; break; - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_READY) goto error; break; - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL) goto error; g_free (fakesink->last_message); @@ -420,11 +420,11 @@ gst_fake_sink_change_state (GstElement * element) break; } - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); return ret; error: GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL)); - return GST_STATE_FAILURE; + return GST_STATE_CHANGE_FAILURE; } diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index f53038803..938ae85b7 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -82,7 +82,8 @@ static void gst_fdsrc_set_property (GObject * object, guint prop_id, static void gst_fdsrc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_fdsrc_change_state (GstElement * element); +static GstStateChangeReturn gst_fdsrc_change_state (GstElement * element, + GstStateChange transition); static GstFlowReturn gst_fdsrc_create (GstPushSrc * psrc, GstBuffer ** outbuf); @@ -147,29 +148,29 @@ gst_fdsrc_init (GstFdSrc * fdsrc) fdsrc->seq = 0; } -static GstElementStateReturn -gst_fdsrc_change_state (GstElement * element) +static GstStateChangeReturn +gst_fdsrc_change_state (GstElement * element, GstStateChange transition) { GstFdSrc *src = GST_FDSRC (element); - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_NULL_TO_READY: + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: break; - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: src->curoffset = 0; break; - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: break; default: break; } if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - return GST_STATE_SUCCESS; + return GST_STATE_CHANGE_SUCCESS; } diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 455ce7e4f..596d76827 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -91,7 +91,8 @@ static gboolean gst_file_sink_query (GstPad * pad, GstQuery * query); static void gst_file_sink_uri_handler_init (gpointer g_iface, gpointer iface_data); -static GstElementStateReturn gst_file_sink_change_state (GstElement * element); +static GstStateChangeReturn gst_file_sink_change_state (GstElement * element, + GstStateChange transition); //static guint gst_file_sink_signals[LAST_SIGNAL] = { 0 }; @@ -401,36 +402,33 @@ handle_error: return GST_FLOW_ERROR; } -static GstElementStateReturn -gst_file_sink_change_state (GstElement * element) +static GstStateChangeReturn +gst_file_sink_change_state (GstElement * element, GstStateChange transition) { - GstElementStateReturn ret; - gint transition; - - transition = GST_STATE_TRANSITION (element); + GstStateChangeReturn ret; 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: if (!gst_file_sink_open_file (GST_FILE_SINK (element))) goto open_error; break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; default: break; } - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); + ret = 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: gst_file_sink_close_file (GST_FILE_SINK (element)); break; - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: break; default: break; @@ -440,7 +438,7 @@ gst_file_sink_change_state (GstElement * element) open_error: { - return GST_STATE_FAILURE; + return GST_STATE_CHANGE_FAILURE; } } diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 6106f9bbc..8c6785d8b 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -259,7 +259,7 @@ gst_file_src_set_location (GstFileSrc * src, const gchar * location) /* the element must be stopped in order to do this */ GST_STATE_LOCK (src); { - GstElementState state; + GstState state; state = GST_STATE (src); if (state != GST_STATE_READY && state != GST_STATE_NULL) diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index fe4242102..5cb446913 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -147,7 +147,8 @@ static void gst_queue_locked_flush (GstQueue * queue); static gboolean gst_queue_src_activate_push (GstPad * pad, gboolean active); static gboolean gst_queue_sink_activate_push (GstPad * pad, gboolean active); -static GstElementStateReturn gst_queue_change_state (GstElement * element); +static GstStateChangeReturn gst_queue_change_state (GstElement * element, + GstStateChange transition); #define GST_TYPE_QUEUE_LEAKY (queue_leaky_get_type ()) @@ -989,35 +990,35 @@ gst_queue_src_activate_push (GstPad * pad, gboolean active) return result; } -static GstElementStateReturn -gst_queue_change_state (GstElement * element) +static GstStateChangeReturn +gst_queue_change_state (GstElement * element, GstStateChange transition) { GstQueue *queue; - GstElementStateReturn ret = GST_STATE_SUCCESS; + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; queue = GST_QUEUE (element); GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "starting state change"); - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_NULL_TO_READY: + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: break; - case GST_STATE_READY_TO_PAUSED: + case GST_STATE_CHANGE_READY_TO_PAUSED: break; - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; default: break; } - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_PLAYING_TO_PAUSED: + switch (transition) { + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: 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: break; default: break; diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 157a9d58f..66aba4f11 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -131,8 +131,9 @@ static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad, guint64 offset, guint length, GstBuffer ** buffer); static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad); -static GstElementStateReturn -gst_type_find_element_change_state (GstElement * element); +static GstStateChangeReturn +gst_type_find_element_change_state (GstElement * element, + GstStateChange transition); static gboolean gst_type_find_element_activate (GstPad * pad); static gboolean gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active); @@ -406,7 +407,7 @@ start_typefinding (GstTypeFindElement * typefind) static void stop_typefinding (GstTypeFindElement * typefind) { - GstElementState state; + GstState state; gboolean push_cached_buffers; gst_element_get_state (GST_ELEMENT (typefind), &state, NULL, NULL); @@ -837,21 +838,20 @@ gst_type_find_element_activate (GstPad * pad) } } -static GstElementStateReturn -gst_type_find_element_change_state (GstElement * element) +static GstStateChangeReturn +gst_type_find_element_change_state (GstElement * element, + GstStateChange transition) { - GstElementState transition; - GstElementStateReturn ret; + GstStateChangeReturn ret; GstTypeFindElement *typefind; typefind = GST_TYPE_FIND_ELEMENT (element); - transition = GST_STATE_TRANSITION (element); - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); switch (transition) { - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: gst_caps_replace (&typefind->caps, NULL); break; default: diff --git a/scripts/update-states b/scripts/update-states new file mode 100755 index 000000000..174507b50 --- /dev/null +++ b/scripts/update-states @@ -0,0 +1,66 @@ +#!/bin/bash + +set -e + +if test -z "$1" -o -n "$2"; then + echo "Usage: $0 FILE" >&2 + exit 1 +fi + +file=$1 + +if grep -q GstElementState $file; then + echo "$file: GstElementState->GstState" + perl -i -p -e 's/GstElementState/GstState/g' $file +fi + +if grep -q GstStateReturn $file; then + echo "$file: GstStateReturn->GstStateChangeReturn" + perl -i -p -e 's/GstStateReturn/GstStateChangeReturn/g' $file +fi + +if egrep 'GST_STATE_(ASYNC|SUCCESS|FAILURE|NO_PREROLL)' $file | grep -q -v 'NO_PREROLL ('; then + echo "$file: GST_STATE_SUCCESS -> GST_STATE_CHANGE_SUCCESS" + perl -i -p -e 's/GST_STATE_SUCCESS/GST_STATE_CHANGE_SUCCESS/g' $file + perl -i -p -e 's/GST_STATE_ASYNC/GST_STATE_CHANGE_ASYNC/g' $file + perl -i -p -e 's/GST_STATE_FAILURE/GST_STATE_CHANGE_FAILURE/g' $file + perl -i -p -e 's/GST_STATE_NO_PREROLL/GST_STATE_CHANGE_NO_PREROLL/g' $file + # hack around the overloaded macro in 0.9 + perl -i -p -e 's/GST_STATE_CHANGE_NO_PREROLL \(/GST_STATE_NO_PREROLL (/g' $file +fi + +if grep 'change_state (' $file | grep -q 'element)'; then + echo "$file: change_state (GstElement) -> change_state (GstElement, GstStateChange)" + perl -i -p -e 's/^(static.*)change_state \(GstElement \* element\);/$1change_state (GstElement * element,\n GstStateChange transition);/g' $file + perl -i -p -e 's/change_state \(GstElement \* element\)/change_state (GstElement * element, GstStateChange transition)/g' $file + perl -i -p -e 's/change_state \(element\)/change_state (element, transition)/g' $file + egrep -v '^[[:space:]]+GstState transition;' < $file > $file.tmp + mv $file.tmp $file + grep -v 'transition = ' < $file > $file.tmp + mv $file.tmp $file +fi + +if grep -q GST_STATE_TRANSITION $file; then + echo "$file: CHECK ME: GST_STATE_TRANSITION (element) -> transition" + perl -i -p -e 's/GST_STATE_TRANSITION \(element\)/transition/g' $file +fi + +if grep 'transition' $file | grep -q int; then + echo "$file: Removing ghetto int transitions" + egrep -v '^[[:space:]]+g?u?int.* transition;' < $file > $file.tmp + mv $file.tmp $file +fi + +if egrep -q 'GST_STATE_[A-Z]+_TO_[A-Z]+' $file; then + echo "$file: GST_STATE_NULL_TO_READY -> GST_STATE_CHANGE_NULL_TO_READY" + perl -i -p -e 's/GST_STATE_([A-Z]+)_TO_([A-Z]+)/GST_STATE_CHANGE_$1_TO_$2/g' $file +fi + +if grep -q GstStateReturn $file; then + echo "$file: GST_STATE_SUCCESS -> GST_STATE_CHANGE_SUCCESS" + perl -i -p -e 's/GstStateReturn/GstStateChangeReturn/g' $file + perl -i -p -e 's/GST_STATE_SUCCESS/GST_STATE_CHANGE_SUCCESS/g' $file + perl -i -p -e 's/GST_STATE_ASYNC/GST_STATE_CHANGE_ASYNC/g' $file + perl -i -p -e 's/GST_STATE_FAILURE/GST_STATE_CHANGE_FAILURE/g' $file + perl -i -p -e 's/GST_STATE_NO_PREROLL/GST_STATE_CHANGE_NO_PREROLL/g' $file +fi diff --git a/tests/benchmarks/complexity.c b/tests/benchmarks/complexity.c index 58db01b87..96fcd164a 100644 --- a/tests/benchmarks/complexity.c +++ b/tests/benchmarks/complexity.c @@ -110,7 +110,8 @@ main (gint argc, gchar * argv[]) GST_TIME_ARGS (end - start), i); start = gst_get_current_time (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); end = gst_get_current_time (); g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", diff --git a/tests/benchmarks/mass-elements.c b/tests/benchmarks/mass-elements.c index 3a6ad4d9e..2d4d0c53d 100644 --- a/tests/benchmarks/mass-elements.c +++ b/tests/benchmarks/mass-elements.c @@ -88,7 +88,8 @@ main (gint argc, gchar * argv[]) GST_TIME_ARGS (end - start), identities); start = gst_get_current_time (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); end = gst_get_current_time (); g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", diff --git a/tests/check/elements/fakesrc.c b/tests/check/elements/fakesrc.c index 1d9b34288..1770e819e 100644 --- a/tests/check/elements/fakesrc.c +++ b/tests/check/elements/fakesrc.c @@ -77,7 +77,8 @@ GST_START_TEST (test_num_buffers) src = setup_fakesrc (); g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); while (!have_eos) { g_usleep (1000); @@ -104,7 +105,8 @@ GST_START_TEST (test_sizetype_empty) g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); while (!have_eos) { g_usleep (1000); @@ -139,7 +141,8 @@ GST_START_TEST (test_sizetype_fixed) g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); while (!have_eos) { g_usleep (1000); @@ -175,7 +178,8 @@ GST_START_TEST (test_sizetype_random) g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); while (!have_eos) { g_usleep (1000); diff --git a/tests/check/elements/identity.c b/tests/check/elements/identity.c index dc5dd31ba..eb5f41e8c 100644 --- a/tests/check/elements/identity.c +++ b/tests/check/elements/identity.c @@ -93,7 +93,8 @@ GST_START_TEST (test_one_buffer) identity = setup_identity (); fail_unless (gst_element_set_state (identity, - GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); buffer = gst_buffer_new_and_alloc (4); ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); diff --git a/tests/check/generic/sinks.c b/tests/check/generic/sinks.c index 95b6b02ea..92d2edad4 100644 --- a/tests/check/generic/sinks.c +++ b/tests/check/generic/sinks.c @@ -26,30 +26,30 @@ GST_START_TEST (test_sink) { GstElement *sink; - GstElementStateReturn ret; - GstElementState current, pending; + GstStateChangeReturn ret; + GstState current, pending; GTimeVal tv; sink = gst_element_factory_make ("fakesink", "sink"); ret = gst_element_set_state (sink, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_ASYNC, "no async state return"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); ret = gst_element_set_state (sink, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_ASYNC, "no forced async state change"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no forced async state change"); GST_TIME_TO_TIMEVAL ((GstClockTime) 0, tv); ret = gst_element_get_state (sink, ¤t, &pending, &tv); - fail_unless (ret == GST_STATE_ASYNC, "not changing state async"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async"); fail_unless (current == GST_STATE_PAUSED, "bad current state"); fail_unless (pending == GST_STATE_PLAYING, "bad pending state"); ret = gst_element_set_state (sink, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_ASYNC, "no async going back to paused"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async going back to paused"); ret = gst_element_set_state (sink, GST_STATE_READY); - fail_unless (ret == GST_STATE_SUCCESS, "failed to go to ready"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to ready"); gst_object_unref (sink); } @@ -60,8 +60,8 @@ GST_END_TEST GST_START_TEST (test_src_sink) { GstElement *sink, *src, *pipeline; - GstElementStateReturn ret; - GstElementState current, pending; + GstStateChangeReturn ret; + GstState current, pending; GstPad *srcpad, *sinkpad; pipeline = gst_pipeline_new ("pipeline"); @@ -79,13 +79,13 @@ GST_START_TEST (test_src_sink) ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); ret = gst_element_get_state (pipeline, NULL, NULL, NULL); - fail_unless (ret == GST_STATE_SUCCESS, "no success state return"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_SUCCESS, "cannot start play"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot start play"); ret = gst_element_get_state (pipeline, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_SUCCESS, "not playing"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); fail_unless (current == GST_STATE_PLAYING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); } @@ -97,8 +97,8 @@ GST_END_TEST GST_START_TEST (test_livesrc_remove) { GstElement *sink, *src, *pipeline; - GstElementStateReturn ret; - GstElementState current, pending; + GstStateChangeReturn ret; + GstState current, pending; GstPad *srcpad, *sinkpad; GTimeVal tv; @@ -117,10 +117,11 @@ GST_START_TEST (test_livesrc_remove) gst_object_unref (sinkpad); ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_NO_PREROLL, "no no_preroll state return"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no no_preroll state return"); ret = gst_element_get_state (src, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_NO_PREROLL, "not paused"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); fail_unless (current == GST_STATE_PAUSED, "not paused"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); @@ -128,7 +129,7 @@ GST_START_TEST (test_livesrc_remove) GST_TIME_TO_TIMEVAL (0, tv); ret = gst_element_get_state (pipeline, ¤t, &pending, &tv); - fail_unless (ret == GST_STATE_ASYNC, "not async"); + fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async"); fail_unless (current == GST_STATE_PAUSED, "not paused"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); @@ -140,8 +141,8 @@ GST_END_TEST GST_START_TEST (test_livesrc_sink) { GstElement *sink, *src, *pipeline; - GstElementStateReturn ret; - GstElementState current, pending; + GstStateChangeReturn ret; + GstState current, pending; GstPad *srcpad, *sinkpad; pipeline = gst_pipeline_new ("pipeline"); @@ -159,23 +160,24 @@ GST_START_TEST (test_livesrc_sink) gst_object_unref (sinkpad); ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_NO_PREROLL, "no no_preroll state return"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, + "no no_preroll state return"); ret = gst_element_get_state (src, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_NO_PREROLL, "not paused"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); fail_unless (current == GST_STATE_PAUSED, "not paused"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); ret = gst_element_get_state (pipeline, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_NO_PREROLL, "not paused"); + fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); fail_unless (current == GST_STATE_PAUSED, "not paused"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_SUCCESS, "cannot force play"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot force play"); ret = gst_element_get_state (pipeline, ¤t, &pending, NULL); - fail_unless (ret == GST_STATE_SUCCESS, "not playing"); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); fail_unless (current == GST_STATE_PLAYING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); } diff --git a/tests/check/gst/gstbin.c b/tests/check/gst/gstbin.c index 0bef198f2..fa704bed2 100644 --- a/tests/check/gst/gstbin.c +++ b/tests/check/gst/gstbin.c @@ -160,7 +160,7 @@ GST_START_TEST (test_message_state_changed_child) * - second for bin, causing an incref on the bin */ GST_DEBUG ("setting bin to READY"); fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); ASSERT_OBJECT_REFCOUNT (src, "src", 2); ASSERT_OBJECT_REFCOUNT (bin, "bin", 2); @@ -228,7 +228,7 @@ GST_START_TEST (test_message_state_changed_children) /* change state to READY, spawning three messages */ GST_DEBUG ("setting pipeline to READY"); fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* each object is referenced by a message */ ASSERT_OBJECT_REFCOUNT (bus, "bus", 1); @@ -247,7 +247,7 @@ GST_START_TEST (test_message_state_changed_children) /* change state to PAUSED, spawning three messages */ GST_DEBUG ("setting pipeline to PAUSED"); fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* each object is referenced by a message; * base_sink_chain has taken a refcount on the sink, and is blocked on @@ -267,7 +267,7 @@ GST_START_TEST (test_message_state_changed_children) /* change state to PLAYING, spawning three messages */ GST_DEBUG ("setting pipeline to PLAYING"); fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* each object is referenced by one message * sink might have an extra reference if it's still blocked on preroll */ @@ -287,7 +287,7 @@ GST_START_TEST (test_message_state_changed_children) /* go back to READY, spawning six messages */ GST_DEBUG ("setting pipeline to READY"); fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* each object is referenced by two messages */ ASSERT_OBJECT_REFCOUNT (src, "src", 3); @@ -303,7 +303,7 @@ GST_START_TEST (test_message_state_changed_children) /* setting pipeline to NULL flushes the bus automatically */ fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); @@ -337,7 +337,7 @@ GST_START_TEST (test_watch_for_state_change) /* change state, spawning two times three messages, minus one async */ fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED) - == GST_STATE_ASYNC); + == GST_STATE_CHANGE_ASYNC); pop_messages (bus, 5); @@ -353,7 +353,7 @@ GST_START_TEST (test_watch_for_state_change) "Unexpected messages on bus"); fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); pop_messages (bus, 3); @@ -369,7 +369,7 @@ GST_START_TEST (test_watch_for_state_change) /* setting bin to NULL flushes the bus automatically */ fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL) - == GST_STATE_SUCCESS); + == GST_STATE_CHANGE_SUCCESS); /* clean up */ gst_object_unref (bin); diff --git a/tests/check/gst/gstghostpad.c b/tests/check/gst/gstghostpad.c index 455dd1f46..6e0c92945 100644 --- a/tests/check/gst/gstghostpad.c +++ b/tests/check/gst/gstghostpad.c @@ -218,9 +218,10 @@ GST_START_TEST (test_ghost_pads) assert_gstrefcount (isrc, 3); /* parent and gsrc */ fail_unless (gst_element_set_state (b1, - GST_STATE_PLAYING) == GST_STATE_SUCCESS); + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS); - fail_unless (gst_element_set_state (b1, GST_STATE_NULL) == GST_STATE_SUCCESS); + fail_unless (gst_element_set_state (b1, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS); gst_object_unref (b1); /* unreffing the bin will unref all elements, which will unlink and unparent diff --git a/tests/check/gst/gstmessage.c b/tests/check/gst/gstmessage.c index 0cfad06e5..cf0216fe4 100644 --- a/tests/check/gst/gstmessage.c +++ b/tests/check/gst/gstmessage.c @@ -120,7 +120,7 @@ GST_START_TEST (test_parsing) } /* GST_MESSAGE_STATE_CHANGED */ { - GstElementState oldstate, newstate; + GstState oldstate, newstate; oldstate = GST_STATE_PAUSED; newstate = GST_STATE_PLAYING; @@ -175,8 +175,8 @@ GST_START_TEST (test_parsing) /* void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list); - void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state, - GstElementState *new_state); + void gst_message_parse_state_changed (GstMessage *message, GstState *old_state, + GstState *new_state); void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug); void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug); */ diff --git a/tests/check/pipelines/simple-launch-lines.c b/tests/check/pipelines/simple-launch-lines.c index 19726fdaf..11c6ed814 100644 --- a/tests/check/pipelines/simple-launch-lines.c +++ b/tests/check/pipelines/simple-launch-lines.c @@ -45,7 +45,8 @@ run_pipeline (GstElement * pipe, gchar * descr, bus = gst_element_get_bus (pipe); g_assert (bus); - if (gst_element_set_state (pipe, GST_STATE_PLAYING) != GST_STATE_SUCCESS) { + if (gst_element_set_state (pipe, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) { g_critical ("Couldn't set pipeline to PLAYING"); goto done; } diff --git a/tests/complexity.c b/tests/complexity.c index 58db01b87..96fcd164a 100644 --- a/tests/complexity.c +++ b/tests/complexity.c @@ -110,7 +110,8 @@ main (gint argc, gchar * argv[]) GST_TIME_ARGS (end - start), i); start = gst_get_current_time (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); end = gst_get_current_time (); g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", diff --git a/tests/mass_elements.c b/tests/mass_elements.c index 3a6ad4d9e..2d4d0c53d 100644 --- a/tests/mass_elements.c +++ b/tests/mass_elements.c @@ -88,7 +88,8 @@ main (gint argc, gchar * argv[]) GST_TIME_ARGS (end - start), identities); start = gst_get_current_time (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); end = gst_get_current_time (); g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", diff --git a/tests/old/examples/metadata/read-metadata.c b/tests/old/examples/metadata/read-metadata.c index 269b48992..5e3972b38 100644 --- a/tests/old/examples/metadata/read-metadata.c +++ b/tests/old/examples/metadata/read-metadata.c @@ -182,8 +182,8 @@ main (int argc, char *argv[]) make_pipeline (); while (i < argc) { - GstElementStateReturn sret; - GstElementState state; + GstStateChangeReturn sret; + GstState state; filename = argv[i]; g_object_set (source, "location", filename, NULL); @@ -194,13 +194,13 @@ main (int argc, char *argv[]) * otherwise the state change fails */ sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); - if (GST_STATE_ASYNC == sret) { - if (GST_STATE_FAILURE == + if (GST_STATE_CHANGE_ASYNC == sret) { + if (GST_STATE_CHANGE_FAILURE == gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) { g_print ("State change failed. Aborting"); break; } - } else if (sret != GST_STATE_SUCCESS) { + } else if (sret != GST_STATE_CHANGE_SUCCESS) { g_print ("%s - Could not read file\n", argv[i]); } else { GstTagList *tags = NULL; @@ -226,8 +226,8 @@ main (int argc, char *argv[]) g_print ("No metadata found for %s\n", argv[i]); sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - if (GST_STATE_ASYNC == sret) { - if (GST_STATE_FAILURE == + if (GST_STATE_CHANGE_ASYNC == sret) { + if (GST_STATE_CHANGE_FAILURE == gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) { g_print ("State change failed. Aborting"); diff --git a/tests/old/examples/plugins/example.c b/tests/old/examples/plugins/example.c index 13f0ee93e..d87ebf03c 100644 --- a/tests/old/examples/plugins/example.c +++ b/tests/old/examples/plugins/example.c @@ -86,7 +86,8 @@ static void gst_example_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_example_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_example_change_state (GstElement * element); +static GstStateChangeReturn gst_example_change_state (GstElement * element, + GstStateChange transition); /* The parent class pointer needs to be kept around for some object * operations. @@ -338,8 +339,8 @@ gst_example_get_property (GObject * object, guint prop_id, GValue * value, * The plugin can prepare itself and its internal data structures * in the various state transitions. */ -static GstElementStateReturn -gst_example_change_state (GstElement * element) +static GstStateChangeReturn +gst_example_change_state (GstElement * element, GstStateChange transition) { GstExample *example; @@ -348,33 +349,33 @@ gst_example_change_state (GstElement * element) /* we perform our actions based on the state transition * of the element */ - switch (GST_STATE_TRANSITION (element)) { + switch (transition) { /* The NULL to READY transition is used to * create threads (if any), and/or open devices */ - 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: break; /* In the PAUSED to PLAYING state, the element should * prepare itself for operation or continue after a PAUSE */ - case GST_STATE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; /* In the PLAYING to PAUSED state, the element should * PAUSE itself and make sure it can resume operation */ - case GST_STATE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: break; /* In the PAUSED to READY state, the element should reset * its internal state and close any devices. */ - case GST_STATE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY: break; /* The element should free all resources, terminate threads * and put itself into its initial state again */ - case GST_STATE_READY_TO_NULL: + case GST_STATE_CHANGE_READY_TO_NULL: break; } /* Then we call the parent state change handler */ - return parent_class->change_state (element); + return parent_class->change_state (element, transition); } diff --git a/tests/old/testsuite/bytestream/filepadsink.c b/tests/old/testsuite/bytestream/filepadsink.c index e5ac8b9ea..b25a63ae9 100644 --- a/tests/old/testsuite/bytestream/filepadsink.c +++ b/tests/old/testsuite/bytestream/filepadsink.c @@ -270,7 +270,8 @@ main (gint argc, gchar ** argv) g_assert (size >= MIN_SIZE); g_assert (size <= MAX_SIZE); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (gst_bin_iterate (GST_BIN (pipeline))); diff --git a/tests/old/testsuite/bytestream/gstbstest.c b/tests/old/testsuite/bytestream/gstbstest.c index 9f24b088d..d12613617 100644 --- a/tests/old/testsuite/bytestream/gstbstest.c +++ b/tests/old/testsuite/bytestream/gstbstest.c @@ -98,7 +98,8 @@ static void gst_bstest_set_property (GObject * object, guint prop_id, static void gst_bstest_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_bstest_change_state (GstElement * element); +static GstStateChangeReturn gst_bstest_change_state (GstElement * element, + GstStateChange transition); static void gst_bstest_loop (GstElement * element); static GstElementClass *parent_class = NULL; @@ -373,12 +374,12 @@ gst_bstest_get_property (GObject * object, guint prop_id, GValue * value, } } -static GstElementStateReturn -gst_bstest_change_state (GstElement * element) +static GstStateChangeReturn +gst_bstest_change_state (GstElement * element, GstStateChange transition) { GstBsTest *bstest; - g_return_val_if_fail (GST_IS_BSTEST (element), GST_STATE_FAILURE); + g_return_val_if_fail (GST_IS_BSTEST (element), GST_STATE_CHANGE_FAILURE); bstest = GST_BSTEST (element); @@ -394,9 +395,9 @@ gst_bstest_change_state (GstElement * element) } if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - return GST_STATE_SUCCESS; + return GST_STATE_CHANGE_SUCCESS; } static gboolean diff --git a/tests/old/testsuite/parse/parse1.c b/tests/old/testsuite/parse/parse1.c index d62dae693..5a6c33864 100644 --- a/tests/old/testsuite/parse/parse1.c +++ b/tests/old/testsuite/parse/parse1.c @@ -68,7 +68,7 @@ static gchar *s; alarm(10); \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ if (gst_element_set_state (cur, GST_STATE_PLAYING) \ - == GST_STATE_FAILURE) { \ + == GST_STATE_CHANGE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : " \ "pipeline could not be set to PLAYING\n", test, __LINE__); \ return -test; \ @@ -76,7 +76,7 @@ static gchar *s; iterations = 0; \ while (gst_bin_iterate (GST_BIN (cur))) iterations++; \ if (gst_element_set_state (cur, GST_STATE_NULL) \ - == GST_STATE_FAILURE) { \ + == GST_STATE_CHANGE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : " \ "pipeline could not be reset to state NULL\n", test, __LINE__); \ return -test; \ diff --git a/tests/old/testsuite/parse/parse2.c b/tests/old/testsuite/parse/parse2.c index de98c0d9a..60e3323cd 100644 --- a/tests/old/testsuite/parse/parse2.c +++ b/tests/old/testsuite/parse/parse2.c @@ -92,7 +92,7 @@ static char *video_file = NULL; #define TEST_RUN(iters) G_STMT_START{ \ gint it = iters; \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ - if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_FAILURE) { \ + if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \ return -test; \ } \ @@ -101,7 +101,7 @@ static char *video_file = NULL; iterations++; \ it--; \ } \ - if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_FAILURE) { \ + if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \ return -test; \ } \ diff --git a/tests/old/testsuite/schedulers/142183-2.c b/tests/old/testsuite/schedulers/142183-2.c index 6278d82de..5a3bb6888 100644 --- a/tests/old/testsuite/schedulers/142183-2.c +++ b/tests/old/testsuite/schedulers/142183-2.c @@ -56,7 +56,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (src, "src", id, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_iterate (GST_BIN (pipeline)); diff --git a/tests/old/testsuite/schedulers/142183.c b/tests/old/testsuite/schedulers/142183.c index 4c56090a7..50dca6ce2 100644 --- a/tests/old/testsuite/schedulers/142183.c +++ b/tests/old/testsuite/schedulers/142183.c @@ -66,7 +66,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (src, "src", id, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_iterate (GST_BIN (pipeline)); diff --git a/tests/old/testsuite/schedulers/143777-2.c b/tests/old/testsuite/schedulers/143777-2.c index bb89ddda6..bcad33140 100644 --- a/tests/old/testsuite/schedulers/143777-2.c +++ b/tests/old/testsuite/schedulers/143777-2.c @@ -24,7 +24,8 @@ main (int argc, char **argv) gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL); if (!gst_element_link_many (src, tee, enc, sink, NULL)) g_assert_not_reached (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); for (i = 0; i < 5; i++) { @@ -33,7 +34,8 @@ main (int argc, char **argv) g_print ("%d\n", i); } - if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_element_unlink_many (tee, enc, sink, NULL); gst_bin_remove_many (GST_BIN (pipeline), enc, sink, NULL); @@ -45,7 +47,8 @@ main (int argc, char **argv) gst_bin_add_many (GST_BIN (pipeline), enc, sink, NULL); if (!gst_element_link_many (tee, enc, sink, NULL)) g_assert_not_reached (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); for (i = 5; i < 10; i++) { diff --git a/tests/old/testsuite/schedulers/143777.c b/tests/old/testsuite/schedulers/143777.c index a28a2d78a..cf2ca57a7 100644 --- a/tests/old/testsuite/schedulers/143777.c +++ b/tests/old/testsuite/schedulers/143777.c @@ -51,12 +51,13 @@ main (gint argc, gchar ** argv) while (i < 100) { g_print ("running... (%d iterations)\n", i); if (gst_element_set_state (pipeline, - GST_STATE_PLAYING) != GST_STATE_SUCCESS) + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_element_link_many (src, id, sink, NULL); for (j = 0; j < i; j++) gst_bin_iterate (GST_BIN (pipeline)); - if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_element_unlink_many (src, id, sink, NULL); i++; diff --git a/tests/old/testsuite/schedulers/147713.c b/tests/old/testsuite/schedulers/147713.c index d9eaaf733..23a40c695 100644 --- a/tests/old/testsuite/schedulers/147713.c +++ b/tests/old/testsuite/schedulers/147713.c @@ -64,12 +64,15 @@ main (gint argc, gchar ** argv) gst_bin_add_many (GST_BIN (pipeline), src, id1, NULL); gst_element_link_pads (src, "src", id1, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (id2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (id2, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (sink, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (sink, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_add_many (GST_BIN (pipeline), sink, NULL); diff --git a/tests/old/testsuite/schedulers/147819.c b/tests/old/testsuite/schedulers/147819.c index 3cfd2f70b..eee315bea 100644 --- a/tests/old/testsuite/schedulers/147819.c +++ b/tests/old/testsuite/schedulers/147819.c @@ -71,7 +71,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (id1, "src", id2, "sink"); gst_element_link_pads (id2, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running...\n"); diff --git a/tests/old/testsuite/schedulers/147894-2.c b/tests/old/testsuite/schedulers/147894-2.c index 9773e144f..f836ebe8e 100644 --- a/tests/old/testsuite/schedulers/147894-2.c +++ b/tests/old/testsuite/schedulers/147894-2.c @@ -96,10 +96,12 @@ main (gint argc, gchar ** argv) gst_element_link_pads (queue, "src", id, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (pipeline2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline2, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running...\n"); diff --git a/tests/old/testsuite/schedulers/147894.c b/tests/old/testsuite/schedulers/147894.c index 9724bab8f..971382adc 100644 --- a/tests/old/testsuite/schedulers/147894.c +++ b/tests/old/testsuite/schedulers/147894.c @@ -96,10 +96,12 @@ main (gint argc, gchar ** argv) gst_element_link_pads (queue, "src", id, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (pipeline2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline2, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running...\n"); @@ -110,7 +112,8 @@ main (gint argc, gchar ** argv) } g_assert (!bug); - if (gst_element_set_state (pipeline2, GST_STATE_READY) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline2, + GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("relinking...\n"); @@ -118,7 +121,8 @@ main (gint argc, gchar ** argv) gst_element_unlink_pads (id, "src", sink, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline2, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running again...\n"); diff --git a/tests/old/testsuite/schedulers/group_link.c b/tests/old/testsuite/schedulers/group_link.c index 32524e06e..2022e051b 100644 --- a/tests/old/testsuite/schedulers/group_link.c +++ b/tests/old/testsuite/schedulers/group_link.c @@ -50,7 +50,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (src, "src", id1, "sink"); gst_element_link_pads (id2, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running...\n"); diff --git a/tests/old/testsuite/schedulers/queue_link.c b/tests/old/testsuite/schedulers/queue_link.c index 1ec80f272..e020157ab 100644 --- a/tests/old/testsuite/schedulers/queue_link.c +++ b/tests/old/testsuite/schedulers/queue_link.c @@ -53,7 +53,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (queue, "src", id1, "sink"); gst_element_link_pads (id1, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("unlinking...\n"); diff --git a/tests/old/testsuite/schedulers/relink.c b/tests/old/testsuite/schedulers/relink.c index 82cd68940..04157b481 100644 --- a/tests/old/testsuite/schedulers/relink.c +++ b/tests/old/testsuite/schedulers/relink.c @@ -60,7 +60,8 @@ main (gint argc, gchar ** argv) /* run pipeline */ g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (i++ < 10 && gst_bin_iterate (GST_BIN (pipeline))); diff --git a/tests/old/testsuite/schedulers/unlink.c b/tests/old/testsuite/schedulers/unlink.c index 04d1c8830..33b23cd36 100644 --- a/tests/old/testsuite/schedulers/unlink.c +++ b/tests/old/testsuite/schedulers/unlink.c @@ -51,7 +51,8 @@ main (gint argc, gchar ** argv) /* run pipeline */ g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (gst_bin_iterate (GST_BIN (pipeline))); diff --git a/tests/old/testsuite/schedulers/unref.c b/tests/old/testsuite/schedulers/unref.c index 845e6f61c..fdab3f6c8 100644 --- a/tests/old/testsuite/schedulers/unref.c +++ b/tests/old/testsuite/schedulers/unref.c @@ -52,7 +52,8 @@ main (gint argc, gchar ** argv) /* run pipeline */ g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (pipeline && gst_bin_iterate (GST_BIN (pipeline))); diff --git a/tests/old/testsuite/schedulers/useless_iteration.c b/tests/old/testsuite/schedulers/useless_iteration.c index bf6eba6ae..c87621a24 100644 --- a/tests/old/testsuite/schedulers/useless_iteration.c +++ b/tests/old/testsuite/schedulers/useless_iteration.c @@ -35,7 +35,8 @@ main (gint argc, gchar ** argv) /* run pipeline */ g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (i < 100 && gst_bin_iterate (GST_BIN (pipeline))) i++; diff --git a/tests/old/testsuite/states/bin.c b/tests/old/testsuite/states/bin.c index a3cf01cc5..efcc727cb 100644 --- a/tests/old/testsuite/states/bin.c +++ b/tests/old/testsuite/states/bin.c @@ -21,10 +21,10 @@ #include <gst/gst.h> -#define RETURN_NAME(x) ((x) == GST_STATE_SUCCESS ? "GST_STATE_SUCCESS" : \ - (x) == GST_STATE_ASYNC ? "GST_STATE_ASYNC" : "GST_STATE_FAILURE") +#define RETURN_NAME(x) ((x) == GST_STATE_CHANGE_SUCCESS ? "GST_STATE_CHANGE_SUCCESS" : \ + (x) == GST_STATE_CHANGE_ASYNC ? "GST_STATE_CHANGE_ASYNC" : "GST_STATE_CHANGE_FAILURE") static void -assert_state (GstElement * element, GstElementState state) +assert_state (GstElement * element, GstState state) { if (gst_element_get_state (element) != state) { g_printerr ("%s: state is %s instead of %s", @@ -36,10 +36,10 @@ assert_state (GstElement * element, GstElementState state) } static void -assert_state_change (GstElement * element, GstElementState new_state, - GstElementStateReturn result, GstElementState result_state) +assert_state_change (GstElement * element, GstState new_state, + GstStateChangeReturn result, GstState result_state) { - GstElementStateReturn ret = gst_element_set_state (element, new_state); + GstStateChangeReturn ret = gst_element_set_state (element, new_state); if (ret != result) { g_printerr ("%s: change state to %s returned %s instead of %s", @@ -56,15 +56,18 @@ empty_bin (gchar * bin_name) /* Test the behaviour of empty bins. Since a bin's state is always the state * of its highest child, nothing should change in here * Return values when no error occured but the state didn't change should be - * GST_STATE_ASYNC */ + * GST_STATE_CHANGE_ASYNC */ GstElement *bin = gst_element_factory_make (bin_name, NULL); /* obvious */ assert_state (bin, GST_STATE_NULL); /* see above */ - assert_state_change (bin, GST_STATE_READY, GST_STATE_ASYNC, GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_ASYNC, GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_ASYNC, GST_STATE_NULL); + assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_ASYNC, + GST_STATE_NULL); + assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_ASYNC, + GST_STATE_NULL); + assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC, + GST_STATE_NULL); } static void @@ -72,11 +75,11 @@ test_adding_one_element (GstElement * bin) { /* Tests behaviour of adding/removing elements to/from bins. It makes sure the * state of the bin is always the highest of all contained children. */ - GstElementState test_states[] = { GST_STATE_READY, GST_STATE_PAUSED, + GstState test_states[] = { GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY, GST_STATE_NULL }; GstElement *test = gst_element_factory_make ("identity", NULL); - GstElementState bin_state = gst_element_get_state (bin); + GstState bin_state = gst_element_get_state (bin); gint i; g_assert (test); @@ -85,9 +88,10 @@ test_adding_one_element (GstElement * bin) gst_bin_add (GST_BIN (bin), test); assert_state (bin, MAX (bin_state, GST_STATE_NULL)); for (i = 0; i < G_N_ELEMENTS (test_states); i++) { - GstElementState test_state = test_states[i]; + GstState test_state = test_states[i]; - assert_state_change (test, test_state, GST_STATE_SUCCESS, test_state); + assert_state_change (test, test_state, GST_STATE_CHANGE_SUCCESS, + test_state); assert_state (test, test_state); assert_state (bin, MAX (bin_state, test_state)); gst_bin_remove (GST_BIN (bin), test); @@ -105,7 +109,7 @@ static void test_element_in_bin (gchar * bin_name) { gint i; - GstElementState test_states[] = { GST_STATE_NULL, GST_STATE_READY, + GstState test_states[] = { GST_STATE_NULL, GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING }; GstElement *id, *bin = gst_element_factory_make (bin_name, NULL); @@ -121,9 +125,9 @@ test_element_in_bin (gchar * bin_name) gst_bin_add (GST_BIN (bin), id); /* test correct behaviour in bins which contain elements in various states */ for (i = 0; i < G_N_ELEMENTS (test_states); i++) { - GstElementState test_state = test_states[i]; + GstState test_state = test_states[i]; - assert_state_change (bin, test_state, GST_STATE_SUCCESS, test_state); + assert_state_change (bin, test_state, GST_STATE_CHANGE_SUCCESS, test_state); assert_state (id, test_state); test_adding_one_element (bin); } diff --git a/tests/old/testsuite/threads/159566.c b/tests/old/testsuite/threads/159566.c index abb704c3e..000bae8c6 100644 --- a/tests/old/testsuite/threads/159566.c +++ b/tests/old/testsuite/threads/159566.c @@ -85,7 +85,8 @@ main (int argc, char **argv) g_assert_not_reached (); /* run a bit */ - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); sleep (10000); diff --git a/tests/old/testsuite/threads/threadb.c b/tests/old/testsuite/threads/threadb.c index 496cc0076..11daa8531 100644 --- a/tests/old/testsuite/threads/threadb.c +++ b/tests/old/testsuite/threads/threadb.c @@ -31,7 +31,7 @@ construct_pipeline (GstElement * pipeline) void state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) { - GstElementState state = gst_element_get_state (el); + GstState state = gst_element_get_state (el); g_print ("element %s has changed state to %s\n", GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); diff --git a/tests/old/testsuite/threads/threadc.c b/tests/old/testsuite/threads/threadc.c index 7f9955cb5..a3885a663 100644 --- a/tests/old/testsuite/threads/threadc.c +++ b/tests/old/testsuite/threads/threadc.c @@ -38,7 +38,7 @@ construct_pipeline (GstElement * pipeline, gint identities) void state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) { - GstElementState state = gst_element_get_state (el); + GstState state = gst_element_get_state (el); g_print ("element %s has changed state to %s\n", GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); @@ -73,7 +73,8 @@ main (gint argc, gchar * argv[]) construct_pipeline (thread, i / 10 + 1); g_print ("Setting thread to play with %d identities\n", i / 10 + 1); - if (gst_element_set_state (thread, GST_STATE_PLAYING) == GST_STATE_FAILURE) { + if (gst_element_set_state (thread, + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { g_error ("Failed setting thread to play\n"); } else { g_print ("Going into the main GStreamer loop\n"); diff --git a/tests/old/testsuite/threads/threadd.c b/tests/old/testsuite/threads/threadd.c index 79bfb573c..6343af9ce 100644 --- a/tests/old/testsuite/threads/threadd.c +++ b/tests/old/testsuite/threads/threadd.c @@ -42,7 +42,7 @@ construct_pipeline (GstElement * pipeline, gint identities) void state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) { - GstElementState state = gst_element_get_state (el); + GstState state = gst_element_get_state (el); g_print ("element %s has changed state to %s\n", GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); @@ -75,7 +75,8 @@ main (gint argc, gchar * argv[]) g_print ("Setting thread to play with %d identities\n", i / RUNS_PER_IDENTITY + 1); done = FALSE; - if (gst_element_set_state (thread, GST_STATE_PLAYING) == GST_STATE_FAILURE) { + if (gst_element_set_state (thread, + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { g_warning ("failed to go to PLAYING"); } else { g_print ("Waiting for thread PLAYING->PAUSED\n"); diff --git a/tests/old/testsuite/threads/threadg.c b/tests/old/testsuite/threads/threadg.c index 73dc607a7..bdf2264ab 100644 --- a/tests/old/testsuite/threads/threadg.c +++ b/tests/old/testsuite/threads/threadg.c @@ -36,7 +36,8 @@ main (int argc, char **argv) g_assert_not_reached (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); for (i = 0; i < 100; i++) { @@ -45,17 +46,20 @@ main (int argc, char **argv) g_print ("%d\n", i); } - if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_remove_many (GST_BIN (thread), queue, sink, NULL); - if (gst_element_set_state (thread, GST_STATE_NULL) != GST_STATE_SUCCESS) + if (gst_element_set_state (thread, + GST_STATE_NULL) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_remove (GST_BIN (pipeline), thread); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); diff --git a/tests/old/testsuite/threads/threadh.c b/tests/old/testsuite/threads/threadh.c index 45f6323f5..a2d646222 100644 --- a/tests/old/testsuite/threads/threadh.c +++ b/tests/old/testsuite/threads/threadh.c @@ -9,10 +9,11 @@ handoff_src (GstElement * element) { g_print ("identity handoff\n"); - if (gst_element_set_state (thread, GST_STATE_PAUSED) != GST_STATE_SUCCESS) + if (gst_element_set_state (thread, + GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (sink, GST_STATE_READY) != GST_STATE_SUCCESS) + if (gst_element_set_state (sink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_remove (GST_BIN (thread), src); @@ -42,7 +43,8 @@ main (int argc, char **argv) g_assert_not_reached (); /* run a bit */ - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); sleep (2); diff --git a/tests/old/testsuite/threads/threadi.c b/tests/old/testsuite/threads/threadi.c index 6c522b5bf..a8edf2b30 100644 --- a/tests/old/testsuite/threads/threadi.c +++ b/tests/old/testsuite/threads/threadi.c @@ -63,8 +63,8 @@ cb_data (gpointer data) #endif static void -cb_state (GstElement * element, GstElementState old_state, - GstElementState new_state, gpointer data) +cb_state (GstElement * element, GstState old_state, + GstState new_state, gpointer data) { g_print ("Changed state from %d to %d\n", old_state, new_state); } @@ -72,7 +72,7 @@ cb_state (GstElement * element, GstElementState old_state, static gboolean cb_play (gpointer data) { - GstElementStateReturn res; + GstStateChangeReturn res; #if TESTNUM != 999999 g_print ("Setting state on fakesrc\n"); @@ -87,7 +87,7 @@ cb_play (gpointer data) #endif g_print ("Syncing state in pipeline\n"); res = gst_bin_sync_children_state (GST_BIN (data)); - g_assert (res == GST_STATE_SUCCESS); + g_assert (res == GST_STATE_CHANGE_SUCCESS); g_print ("Set to playing correctly: %d\n", GST_STATE (pipeline)); /* once */ diff --git a/testsuite/bytestream/filepadsink.c b/testsuite/bytestream/filepadsink.c index e5ac8b9ea..b25a63ae9 100644 --- a/testsuite/bytestream/filepadsink.c +++ b/testsuite/bytestream/filepadsink.c @@ -270,7 +270,8 @@ main (gint argc, gchar ** argv) g_assert (size >= MIN_SIZE); g_assert (size <= MAX_SIZE); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (gst_bin_iterate (GST_BIN (pipeline))); diff --git a/testsuite/bytestream/gstbstest.c b/testsuite/bytestream/gstbstest.c index 9f24b088d..d12613617 100644 --- a/testsuite/bytestream/gstbstest.c +++ b/testsuite/bytestream/gstbstest.c @@ -98,7 +98,8 @@ static void gst_bstest_set_property (GObject * object, guint prop_id, static void gst_bstest_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_bstest_change_state (GstElement * element); +static GstStateChangeReturn gst_bstest_change_state (GstElement * element, + GstStateChange transition); static void gst_bstest_loop (GstElement * element); static GstElementClass *parent_class = NULL; @@ -373,12 +374,12 @@ gst_bstest_get_property (GObject * object, guint prop_id, GValue * value, } } -static GstElementStateReturn -gst_bstest_change_state (GstElement * element) +static GstStateChangeReturn +gst_bstest_change_state (GstElement * element, GstStateChange transition) { GstBsTest *bstest; - g_return_val_if_fail (GST_IS_BSTEST (element), GST_STATE_FAILURE); + g_return_val_if_fail (GST_IS_BSTEST (element), GST_STATE_CHANGE_FAILURE); bstest = GST_BSTEST (element); @@ -394,9 +395,9 @@ gst_bstest_change_state (GstElement * element) } if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - return GST_STATE_SUCCESS; + return GST_STATE_CHANGE_SUCCESS; } static gboolean diff --git a/testsuite/parse/parse1.c b/testsuite/parse/parse1.c index d62dae693..5a6c33864 100644 --- a/testsuite/parse/parse1.c +++ b/testsuite/parse/parse1.c @@ -68,7 +68,7 @@ static gchar *s; alarm(10); \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ if (gst_element_set_state (cur, GST_STATE_PLAYING) \ - == GST_STATE_FAILURE) { \ + == GST_STATE_CHANGE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : " \ "pipeline could not be set to PLAYING\n", test, __LINE__); \ return -test; \ @@ -76,7 +76,7 @@ static gchar *s; iterations = 0; \ while (gst_bin_iterate (GST_BIN (cur))) iterations++; \ if (gst_element_set_state (cur, GST_STATE_NULL) \ - == GST_STATE_FAILURE) { \ + == GST_STATE_CHANGE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : " \ "pipeline could not be reset to state NULL\n", test, __LINE__); \ return -test; \ diff --git a/testsuite/parse/parse2.c b/testsuite/parse/parse2.c index de98c0d9a..60e3323cd 100644 --- a/testsuite/parse/parse2.c +++ b/testsuite/parse/parse2.c @@ -92,7 +92,7 @@ static char *video_file = NULL; #define TEST_RUN(iters) G_STMT_START{ \ gint it = iters; \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ - if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_FAILURE) { \ + if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \ return -test; \ } \ @@ -101,7 +101,7 @@ static char *video_file = NULL; iterations++; \ it--; \ } \ - if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_FAILURE) { \ + if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \ return -test; \ } \ diff --git a/testsuite/schedulers/142183-2.c b/testsuite/schedulers/142183-2.c index 6278d82de..5a3bb6888 100644 --- a/testsuite/schedulers/142183-2.c +++ b/testsuite/schedulers/142183-2.c @@ -56,7 +56,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (src, "src", id, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_iterate (GST_BIN (pipeline)); diff --git a/testsuite/schedulers/142183.c b/testsuite/schedulers/142183.c index 4c56090a7..50dca6ce2 100644 --- a/testsuite/schedulers/142183.c +++ b/testsuite/schedulers/142183.c @@ -66,7 +66,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (src, "src", id, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_iterate (GST_BIN (pipeline)); diff --git a/testsuite/schedulers/143777-2.c b/testsuite/schedulers/143777-2.c index bb89ddda6..bcad33140 100644 --- a/testsuite/schedulers/143777-2.c +++ b/testsuite/schedulers/143777-2.c @@ -24,7 +24,8 @@ main (int argc, char **argv) gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL); if (!gst_element_link_many (src, tee, enc, sink, NULL)) g_assert_not_reached (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); for (i = 0; i < 5; i++) { @@ -33,7 +34,8 @@ main (int argc, char **argv) g_print ("%d\n", i); } - if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_element_unlink_many (tee, enc, sink, NULL); gst_bin_remove_many (GST_BIN (pipeline), enc, sink, NULL); @@ -45,7 +47,8 @@ main (int argc, char **argv) gst_bin_add_many (GST_BIN (pipeline), enc, sink, NULL); if (!gst_element_link_many (tee, enc, sink, NULL)) g_assert_not_reached (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); for (i = 5; i < 10; i++) { diff --git a/testsuite/schedulers/143777.c b/testsuite/schedulers/143777.c index a28a2d78a..cf2ca57a7 100644 --- a/testsuite/schedulers/143777.c +++ b/testsuite/schedulers/143777.c @@ -51,12 +51,13 @@ main (gint argc, gchar ** argv) while (i < 100) { g_print ("running... (%d iterations)\n", i); if (gst_element_set_state (pipeline, - GST_STATE_PLAYING) != GST_STATE_SUCCESS) + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_element_link_many (src, id, sink, NULL); for (j = 0; j < i; j++) gst_bin_iterate (GST_BIN (pipeline)); - if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_element_unlink_many (src, id, sink, NULL); i++; diff --git a/testsuite/schedulers/147713.c b/testsuite/schedulers/147713.c index d9eaaf733..23a40c695 100644 --- a/testsuite/schedulers/147713.c +++ b/testsuite/schedulers/147713.c @@ -64,12 +64,15 @@ main (gint argc, gchar ** argv) gst_bin_add_many (GST_BIN (pipeline), src, id1, NULL); gst_element_link_pads (src, "src", id1, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (id2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (id2, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (sink, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (sink, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_add_many (GST_BIN (pipeline), sink, NULL); diff --git a/testsuite/schedulers/147819.c b/testsuite/schedulers/147819.c index 3cfd2f70b..eee315bea 100644 --- a/testsuite/schedulers/147819.c +++ b/testsuite/schedulers/147819.c @@ -71,7 +71,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (id1, "src", id2, "sink"); gst_element_link_pads (id2, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running...\n"); diff --git a/testsuite/schedulers/147894-2.c b/testsuite/schedulers/147894-2.c index 9773e144f..f836ebe8e 100644 --- a/testsuite/schedulers/147894-2.c +++ b/testsuite/schedulers/147894-2.c @@ -96,10 +96,12 @@ main (gint argc, gchar ** argv) gst_element_link_pads (queue, "src", id, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (pipeline2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline2, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running...\n"); diff --git a/testsuite/schedulers/147894.c b/testsuite/schedulers/147894.c index 9724bab8f..971382adc 100644 --- a/testsuite/schedulers/147894.c +++ b/testsuite/schedulers/147894.c @@ -96,10 +96,12 @@ main (gint argc, gchar ** argv) gst_element_link_pads (queue, "src", id, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (pipeline2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline2, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running...\n"); @@ -110,7 +112,8 @@ main (gint argc, gchar ** argv) } g_assert (!bug); - if (gst_element_set_state (pipeline2, GST_STATE_READY) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline2, + GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("relinking...\n"); @@ -118,7 +121,8 @@ main (gint argc, gchar ** argv) gst_element_unlink_pads (id, "src", sink, "sink"); gst_element_link_pads (id, "src", sink, "sink"); - if (gst_element_set_state (pipeline2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline2, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running again...\n"); diff --git a/testsuite/schedulers/group_link.c b/testsuite/schedulers/group_link.c index 32524e06e..2022e051b 100644 --- a/testsuite/schedulers/group_link.c +++ b/testsuite/schedulers/group_link.c @@ -50,7 +50,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (src, "src", id1, "sink"); gst_element_link_pads (id2, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("running...\n"); diff --git a/testsuite/schedulers/queue_link.c b/testsuite/schedulers/queue_link.c index 1ec80f272..e020157ab 100644 --- a/testsuite/schedulers/queue_link.c +++ b/testsuite/schedulers/queue_link.c @@ -53,7 +53,8 @@ main (gint argc, gchar ** argv) gst_element_link_pads (queue, "src", id1, "sink"); gst_element_link_pads (id1, "src", sink, "sink"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); g_print ("unlinking...\n"); diff --git a/testsuite/schedulers/relink.c b/testsuite/schedulers/relink.c index 82cd68940..04157b481 100644 --- a/testsuite/schedulers/relink.c +++ b/testsuite/schedulers/relink.c @@ -60,7 +60,8 @@ main (gint argc, gchar ** argv) /* run pipeline */ g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (i++ < 10 && gst_bin_iterate (GST_BIN (pipeline))); diff --git a/testsuite/schedulers/unlink.c b/testsuite/schedulers/unlink.c index 04d1c8830..33b23cd36 100644 --- a/testsuite/schedulers/unlink.c +++ b/testsuite/schedulers/unlink.c @@ -51,7 +51,8 @@ main (gint argc, gchar ** argv) /* run pipeline */ g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (gst_bin_iterate (GST_BIN (pipeline))); diff --git a/testsuite/schedulers/unref.c b/testsuite/schedulers/unref.c index 845e6f61c..fdab3f6c8 100644 --- a/testsuite/schedulers/unref.c +++ b/testsuite/schedulers/unref.c @@ -52,7 +52,8 @@ main (gint argc, gchar ** argv) /* run pipeline */ g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (pipeline && gst_bin_iterate (GST_BIN (pipeline))); diff --git a/testsuite/schedulers/useless_iteration.c b/testsuite/schedulers/useless_iteration.c index bf6eba6ae..c87621a24 100644 --- a/testsuite/schedulers/useless_iteration.c +++ b/testsuite/schedulers/useless_iteration.c @@ -35,7 +35,8 @@ main (gint argc, gchar ** argv) /* run pipeline */ g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); while (i < 100 && gst_bin_iterate (GST_BIN (pipeline))) i++; diff --git a/testsuite/states/bin.c b/testsuite/states/bin.c index a3cf01cc5..efcc727cb 100644 --- a/testsuite/states/bin.c +++ b/testsuite/states/bin.c @@ -21,10 +21,10 @@ #include <gst/gst.h> -#define RETURN_NAME(x) ((x) == GST_STATE_SUCCESS ? "GST_STATE_SUCCESS" : \ - (x) == GST_STATE_ASYNC ? "GST_STATE_ASYNC" : "GST_STATE_FAILURE") +#define RETURN_NAME(x) ((x) == GST_STATE_CHANGE_SUCCESS ? "GST_STATE_CHANGE_SUCCESS" : \ + (x) == GST_STATE_CHANGE_ASYNC ? "GST_STATE_CHANGE_ASYNC" : "GST_STATE_CHANGE_FAILURE") static void -assert_state (GstElement * element, GstElementState state) +assert_state (GstElement * element, GstState state) { if (gst_element_get_state (element) != state) { g_printerr ("%s: state is %s instead of %s", @@ -36,10 +36,10 @@ assert_state (GstElement * element, GstElementState state) } static void -assert_state_change (GstElement * element, GstElementState new_state, - GstElementStateReturn result, GstElementState result_state) +assert_state_change (GstElement * element, GstState new_state, + GstStateChangeReturn result, GstState result_state) { - GstElementStateReturn ret = gst_element_set_state (element, new_state); + GstStateChangeReturn ret = gst_element_set_state (element, new_state); if (ret != result) { g_printerr ("%s: change state to %s returned %s instead of %s", @@ -56,15 +56,18 @@ empty_bin (gchar * bin_name) /* Test the behaviour of empty bins. Since a bin's state is always the state * of its highest child, nothing should change in here * Return values when no error occured but the state didn't change should be - * GST_STATE_ASYNC */ + * GST_STATE_CHANGE_ASYNC */ GstElement *bin = gst_element_factory_make (bin_name, NULL); /* obvious */ assert_state (bin, GST_STATE_NULL); /* see above */ - assert_state_change (bin, GST_STATE_READY, GST_STATE_ASYNC, GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_ASYNC, GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_ASYNC, GST_STATE_NULL); + assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_ASYNC, + GST_STATE_NULL); + assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_ASYNC, + GST_STATE_NULL); + assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC, + GST_STATE_NULL); } static void @@ -72,11 +75,11 @@ test_adding_one_element (GstElement * bin) { /* Tests behaviour of adding/removing elements to/from bins. It makes sure the * state of the bin is always the highest of all contained children. */ - GstElementState test_states[] = { GST_STATE_READY, GST_STATE_PAUSED, + GstState test_states[] = { GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY, GST_STATE_NULL }; GstElement *test = gst_element_factory_make ("identity", NULL); - GstElementState bin_state = gst_element_get_state (bin); + GstState bin_state = gst_element_get_state (bin); gint i; g_assert (test); @@ -85,9 +88,10 @@ test_adding_one_element (GstElement * bin) gst_bin_add (GST_BIN (bin), test); assert_state (bin, MAX (bin_state, GST_STATE_NULL)); for (i = 0; i < G_N_ELEMENTS (test_states); i++) { - GstElementState test_state = test_states[i]; + GstState test_state = test_states[i]; - assert_state_change (test, test_state, GST_STATE_SUCCESS, test_state); + assert_state_change (test, test_state, GST_STATE_CHANGE_SUCCESS, + test_state); assert_state (test, test_state); assert_state (bin, MAX (bin_state, test_state)); gst_bin_remove (GST_BIN (bin), test); @@ -105,7 +109,7 @@ static void test_element_in_bin (gchar * bin_name) { gint i; - GstElementState test_states[] = { GST_STATE_NULL, GST_STATE_READY, + GstState test_states[] = { GST_STATE_NULL, GST_STATE_READY, GST_STATE_PAUSED, GST_STATE_PLAYING }; GstElement *id, *bin = gst_element_factory_make (bin_name, NULL); @@ -121,9 +125,9 @@ test_element_in_bin (gchar * bin_name) gst_bin_add (GST_BIN (bin), id); /* test correct behaviour in bins which contain elements in various states */ for (i = 0; i < G_N_ELEMENTS (test_states); i++) { - GstElementState test_state = test_states[i]; + GstState test_state = test_states[i]; - assert_state_change (bin, test_state, GST_STATE_SUCCESS, test_state); + assert_state_change (bin, test_state, GST_STATE_CHANGE_SUCCESS, test_state); assert_state (id, test_state); test_adding_one_element (bin); } diff --git a/testsuite/threads/159566.c b/testsuite/threads/159566.c index abb704c3e..000bae8c6 100644 --- a/testsuite/threads/159566.c +++ b/testsuite/threads/159566.c @@ -85,7 +85,8 @@ main (int argc, char **argv) g_assert_not_reached (); /* run a bit */ - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); sleep (10000); diff --git a/testsuite/threads/threadb.c b/testsuite/threads/threadb.c index 496cc0076..11daa8531 100644 --- a/testsuite/threads/threadb.c +++ b/testsuite/threads/threadb.c @@ -31,7 +31,7 @@ construct_pipeline (GstElement * pipeline) void state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) { - GstElementState state = gst_element_get_state (el); + GstState state = gst_element_get_state (el); g_print ("element %s has changed state to %s\n", GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); diff --git a/testsuite/threads/threadc.c b/testsuite/threads/threadc.c index 7f9955cb5..a3885a663 100644 --- a/testsuite/threads/threadc.c +++ b/testsuite/threads/threadc.c @@ -38,7 +38,7 @@ construct_pipeline (GstElement * pipeline, gint identities) void state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) { - GstElementState state = gst_element_get_state (el); + GstState state = gst_element_get_state (el); g_print ("element %s has changed state to %s\n", GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); @@ -73,7 +73,8 @@ main (gint argc, gchar * argv[]) construct_pipeline (thread, i / 10 + 1); g_print ("Setting thread to play with %d identities\n", i / 10 + 1); - if (gst_element_set_state (thread, GST_STATE_PLAYING) == GST_STATE_FAILURE) { + if (gst_element_set_state (thread, + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { g_error ("Failed setting thread to play\n"); } else { g_print ("Going into the main GStreamer loop\n"); diff --git a/testsuite/threads/threadd.c b/testsuite/threads/threadd.c index 79bfb573c..6343af9ce 100644 --- a/testsuite/threads/threadd.c +++ b/testsuite/threads/threadd.c @@ -42,7 +42,7 @@ construct_pipeline (GstElement * pipeline, gint identities) void state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) { - GstElementState state = gst_element_get_state (el); + GstState state = gst_element_get_state (el); g_print ("element %s has changed state to %s\n", GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); @@ -75,7 +75,8 @@ main (gint argc, gchar * argv[]) g_print ("Setting thread to play with %d identities\n", i / RUNS_PER_IDENTITY + 1); done = FALSE; - if (gst_element_set_state (thread, GST_STATE_PLAYING) == GST_STATE_FAILURE) { + if (gst_element_set_state (thread, + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { g_warning ("failed to go to PLAYING"); } else { g_print ("Waiting for thread PLAYING->PAUSED\n"); diff --git a/testsuite/threads/threadg.c b/testsuite/threads/threadg.c index 73dc607a7..bdf2264ab 100644 --- a/testsuite/threads/threadg.c +++ b/testsuite/threads/threadg.c @@ -36,7 +36,8 @@ main (int argc, char **argv) g_assert_not_reached (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); for (i = 0; i < 100; i++) { @@ -45,17 +46,20 @@ main (int argc, char **argv) g_print ("%d\n", i); } - if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_remove_many (GST_BIN (thread), queue, sink, NULL); - if (gst_element_set_state (thread, GST_STATE_NULL) != GST_STATE_SUCCESS) + if (gst_element_set_state (thread, + GST_STATE_NULL) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_remove (GST_BIN (pipeline), thread); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); diff --git a/testsuite/threads/threadh.c b/testsuite/threads/threadh.c index 45f6323f5..a2d646222 100644 --- a/testsuite/threads/threadh.c +++ b/testsuite/threads/threadh.c @@ -9,10 +9,11 @@ handoff_src (GstElement * element) { g_print ("identity handoff\n"); - if (gst_element_set_state (thread, GST_STATE_PAUSED) != GST_STATE_SUCCESS) + if (gst_element_set_state (thread, + GST_STATE_PAUSED) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); - if (gst_element_set_state (sink, GST_STATE_READY) != GST_STATE_SUCCESS) + if (gst_element_set_state (sink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); gst_bin_remove (GST_BIN (thread), src); @@ -42,7 +43,8 @@ main (int argc, char **argv) g_assert_not_reached (); /* run a bit */ - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) g_assert_not_reached (); sleep (2); diff --git a/testsuite/threads/threadi.c b/testsuite/threads/threadi.c index 6c522b5bf..a8edf2b30 100644 --- a/testsuite/threads/threadi.c +++ b/testsuite/threads/threadi.c @@ -63,8 +63,8 @@ cb_data (gpointer data) #endif static void -cb_state (GstElement * element, GstElementState old_state, - GstElementState new_state, gpointer data) +cb_state (GstElement * element, GstState old_state, + GstState new_state, gpointer data) { g_print ("Changed state from %d to %d\n", old_state, new_state); } @@ -72,7 +72,7 @@ cb_state (GstElement * element, GstElementState old_state, static gboolean cb_play (gpointer data) { - GstElementStateReturn res; + GstStateChangeReturn res; #if TESTNUM != 999999 g_print ("Setting state on fakesrc\n"); @@ -87,7 +87,7 @@ cb_play (gpointer data) #endif g_print ("Syncing state in pipeline\n"); res = gst_bin_sync_children_state (GST_BIN (data)); - g_assert (res == GST_STATE_SUCCESS); + g_assert (res == GST_STATE_CHANGE_SUCCESS); g_print ("Set to playing correctly: %d\n", GST_STATE (pipeline)); /* once */ diff --git a/tools/gst-launch.c b/tools/gst-launch.c index b5891d25c..f91abdfc9 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -440,7 +440,7 @@ event_loop (GstElement * pipeline, gboolean blocking) return TRUE; } case GST_MESSAGE_STATE_CHANGED:{ - GstElementState old, new; + GstState old, new; gst_message_parse_state_changed (message, &old, &new); if (!(old == GST_STATE_PLAYING && new == GST_STATE_PAUSED && @@ -592,8 +592,8 @@ main (int argc, char *argv[]) #endif if (!savefile) { - GstElementState state, pending; - GstElementStateReturn ret; + GstState state, pending; + GstStateChangeReturn ret; if (!GST_IS_BIN (pipeline)) { GstElement *real_pipeline = gst_element_factory_make ("pipeline", NULL); @@ -610,18 +610,18 @@ main (int argc, char *argv[]) ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); switch (ret) { - case GST_STATE_FAILURE: + case GST_STATE_CHANGE_FAILURE: fprintf (stderr, _("ERROR: pipeline doesn't want to pause.\n")); res = -1; goto end; - case GST_STATE_NO_PREROLL: + case GST_STATE_CHANGE_NO_PREROLL: fprintf (stderr, _("NO_PREROLL pipeline ...\n")); break; - case GST_STATE_ASYNC: + case GST_STATE_CHANGE_ASYNC: fprintf (stderr, _("PREROLL pipeline ...\n")); gst_element_get_state (pipeline, &state, &pending, NULL); /* fallthrough */ - case GST_STATE_SUCCESS: + case GST_STATE_CHANGE_SUCCESS: fprintf (stderr, _("PREROLLED pipeline ...\n")); break; } @@ -636,7 +636,7 @@ main (int argc, char *argv[]) fprintf (stderr, _("RUNNING pipeline ...\n")); if (gst_element_set_state (pipeline, - GST_STATE_PLAYING) == GST_STATE_FAILURE) { + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { fprintf (stderr, _("ERROR: pipeline doesn't want to play.\n")); res = -1; goto end; diff --git a/tools/gst-md5sum.c b/tools/gst-md5sum.c index f64e9277b..ac2cbe1bf 100644 --- a/tools/gst-md5sum.c +++ b/tools/gst-md5sum.c @@ -92,7 +92,8 @@ main (int argc, char *argv[]) return 1; } - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) { + if (gst_element_set_state (pipeline, + GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) { g_warning ("pipeline doesn't want to play\n"); return 1; } diff --git a/tools/gst-typefind.c b/tools/gst-typefind.c index 0a65e6945..59a08e505 100644 --- a/tools/gst-typefind.c +++ b/tools/gst-typefind.c @@ -78,8 +78,8 @@ main (int argc, char *argv[]) G_CALLBACK (have_type_handler), NULL); while (i < argc) { - GstElementStateReturn sret; - GstElementState state; + GstStateChangeReturn sret; + GstState state; filename = argv[i]; g_object_set (source, "location", filename, NULL); @@ -90,16 +90,16 @@ main (int argc, char *argv[]) * otherwise the state change fails */ sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); - if (GST_STATE_ASYNC == sret) { - if (GST_STATE_FAILURE == + if (GST_STATE_CHANGE_ASYNC == sret) { + if (GST_STATE_CHANGE_FAILURE == gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) break; - } else if (sret != GST_STATE_SUCCESS) + } else if (sret != GST_STATE_CHANGE_SUCCESS) g_print ("%s - No type found\n", argv[i]); - if (GST_STATE_ASYNC == + if (GST_STATE_CHANGE_ASYNC == gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL)) { - if (GST_STATE_FAILURE == + if (GST_STATE_CHANGE_FAILURE == gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) break; } diff --git a/win32/gstenumtypes.c b/win32/gstenumtypes.c index 9610c93cd..9c6a93cee 100644 --- a/win32/gstenumtypes.c +++ b/win32/gstenumtypes.c @@ -160,38 +160,65 @@ gst_clock_flags_get_type (void) /* enumerations from "gstelement.h" */ GType -gst_element_state_get_type (void) +gst_state_get_type (void) { static GType etype = 0; if (etype == 0) { - static const GFlagsValue values[] = { - {GST_STATE_VOID_PENDING, "GST_STATE_VOID_PENDING", "state-void-pending"}, - {GST_STATE_NULL, "GST_STATE_NULL", "state-null"}, - {GST_STATE_READY, "GST_STATE_READY", "state-ready"}, - {GST_STATE_PAUSED, "GST_STATE_PAUSED", "state-paused"}, - {GST_STATE_PLAYING, "GST_STATE_PLAYING", "state-playing"}, + static const GEnumValue values[] = { + {GST_STATE_VOID_PENDING, "GST_STATE_VOID_PENDING", "void-pending"}, + {GST_STATE_NULL, "GST_STATE_NULL", "null"}, + {GST_STATE_READY, "GST_STATE_READY", "ready"}, + {GST_STATE_PAUSED, "GST_STATE_PAUSED", "paused"}, + {GST_STATE_PLAYING, "GST_STATE_PLAYING", "playing"}, {0, NULL, NULL} }; - etype = g_flags_register_static ("GstElementState", values); + etype = g_enum_register_static ("GstState", values); } return etype; } GType -gst_element_state_return_get_type (void) +gst_state_change_return_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { - {GST_STATE_FAILURE, "GST_STATE_FAILURE", "failure"}, - {GST_STATE_SUCCESS, "GST_STATE_SUCCESS", "success"}, - {GST_STATE_ASYNC, "GST_STATE_ASYNC", "async"}, - {GST_STATE_NO_PREROLL, "GST_STATE_NO_PREROLL", "no-preroll"}, + {GST_STATE_CHANGE_FAILURE, "GST_STATE_CHANGE_FAILURE", "failure"}, + {GST_STATE_CHANGE_SUCCESS, "GST_STATE_CHANGE_SUCCESS", "success"}, + {GST_STATE_CHANGE_ASYNC, "GST_STATE_CHANGE_ASYNC", "async"}, + {GST_STATE_CHANGE_NO_PREROLL, "GST_STATE_CHANGE_NO_PREROLL", + "no-preroll"}, + {0, NULL, NULL} + }; + etype = g_enum_register_static ("GstStateChangeReturn", values); + } + return etype; +} + +GType +gst_state_change_get_type (void) +{ + static GType etype = 0; + + if (etype == 0) { + static const GFlagsValue values[] = { + {GST_STATE_CHANGE_NULL_TO_READY, "GST_STATE_CHANGE_NULL_TO_READY", + "null-to-ready"}, + {GST_STATE_CHANGE_READY_TO_PAUSED, "GST_STATE_CHANGE_READY_TO_PAUSED", + "ready-to-paused"}, + {GST_STATE_CHANGE_PAUSED_TO_PLAYING, "GST_STATE_CHANGE_PAUSED_TO_PLAYING", + "paused-to-playing"}, + {GST_STATE_CHANGE_PLAYING_TO_PAUSED, "GST_STATE_CHANGE_PLAYING_TO_PAUSED", + "playing-to-paused"}, + {GST_STATE_CHANGE_PAUSED_TO_READY, "GST_STATE_CHANGE_PAUSED_TO_READY", + "paused-to-ready"}, + {GST_STATE_CHANGE_READY_TO_NULL, "GST_STATE_CHANGE_READY_TO_NULL", + "ready-to-null"}, {0, NULL, NULL} }; - etype = g_enum_register_static ("GstElementStateReturn", values); + etype = g_flags_register_static ("GstStateChange", values); } return etype; } |