gst/gstelement.h (GstState): Renamed from GstElementState, changed to be a normal enum instead of flags.

Original commit message from CVS:
2005-09-02  Andy Wingo  <wingo@pobox.com>

* gst/gstelement.h (GstState): Renamed from GstElementState,
changed to be a normal enum instead of flags.
(GstStateChangeReturn): Renamed from GstElementStateReturn, names
munged to be GST_STATE_CHANGE_*.
(GST_STATE_CHANGE): Renamed from GST_STATE_TRANSITION, updated to
work with the new state representation.
(GstStateChange): New enumeration of possible state transitions.
Replaces GST_STATE_FOO_TO_BAR with GST_STATE_CHANGE_FOO_TO_BAR.
(GstElementClass::change_state): Pass the GstStateChange along as
an argument. Helps language bindings, so they don't have to use
tricky lock-needing macros like GST_STATE_CHANGE ().

* scripts/update-states (file): New script. Run it on a file to
update it for state naming and API changes. Updates files in
place.

* All files updated for the new API.
This commit is contained in:
Andy Wingo 2005-09-02 15:42:00 +00:00
parent c2397269b1
commit e040bb2dbe
111 changed files with 938 additions and 788 deletions

View file

@ -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> 2005-09-02 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush): * gst/gsttrace.c: (gst_trace_flush), (gst_trace_text_flush):

View file

@ -77,7 +77,8 @@ GST_START_TEST (test_num_buffers)
src = setup_fakesrc (); src = setup_fakesrc ();
g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); g_object_set (G_OBJECT (src), "num-buffers", 3, NULL);
fail_unless (gst_element_set_state (src, 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) { while (!have_eos) {
g_usleep (1000); g_usleep (1000);
@ -104,7 +105,8 @@ GST_START_TEST (test_sizetype_empty)
g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); g_object_set (G_OBJECT (src), "num-buffers", 100, NULL);
fail_unless (gst_element_set_state (src, 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) { while (!have_eos) {
g_usleep (1000); g_usleep (1000);
@ -139,7 +141,8 @@ GST_START_TEST (test_sizetype_fixed)
g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); g_object_set (G_OBJECT (src), "num-buffers", 100, NULL);
fail_unless (gst_element_set_state (src, 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) { while (!have_eos) {
g_usleep (1000); g_usleep (1000);
@ -175,7 +178,8 @@ GST_START_TEST (test_sizetype_random)
g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); g_object_set (G_OBJECT (src), "num-buffers", 100, NULL);
fail_unless (gst_element_set_state (src, 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) { while (!have_eos) {
g_usleep (1000); g_usleep (1000);

View file

@ -93,7 +93,8 @@ GST_START_TEST (test_one_buffer)
identity = setup_identity (); identity = setup_identity ();
fail_unless (gst_element_set_state (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); buffer = gst_buffer_new_and_alloc (4);
ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);

View file

@ -160,7 +160,7 @@ GST_START_TEST (test_message_state_changed_child)
* - second for bin, causing an incref on the bin */ * - second for bin, causing an incref on the bin */
GST_DEBUG ("setting bin to READY"); GST_DEBUG ("setting bin to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_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 (src, "src", 2);
ASSERT_OBJECT_REFCOUNT (bin, "bin", 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 */ /* change state to READY, spawning three messages */
GST_DEBUG ("setting pipeline to READY"); GST_DEBUG ("setting pipeline to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_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 */ /* each object is referenced by a message */
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1); 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 */ /* change state to PAUSED, spawning three messages */
GST_DEBUG ("setting pipeline to PAUSED"); GST_DEBUG ("setting pipeline to PAUSED");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_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; /* each object is referenced by a message;
* base_sink_chain has taken a refcount on the sink, and is blocked on * 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 */ /* change state to PLAYING, spawning three messages */
GST_DEBUG ("setting pipeline to PLAYING"); GST_DEBUG ("setting pipeline to PLAYING");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_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 /* each object is referenced by one message
* sink might have an extra reference if it's still blocked on preroll */ * 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 */ /* go back to READY, spawning six messages */
GST_DEBUG ("setting pipeline to READY"); GST_DEBUG ("setting pipeline to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_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 */ /* each object is referenced by two messages */
ASSERT_OBJECT_REFCOUNT (src, "src", 3); 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 */ /* setting pipeline to NULL flushes the bus automatically */
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL) 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 (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 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 */ /* change state, spawning two times three messages, minus one async */
fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED) fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED)
== GST_STATE_ASYNC); == GST_STATE_CHANGE_ASYNC);
pop_messages (bus, 5); pop_messages (bus, 5);
@ -353,7 +353,7 @@ GST_START_TEST (test_watch_for_state_change)
"Unexpected messages on bus"); "Unexpected messages on bus");
fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING) fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING)
== GST_STATE_SUCCESS); == GST_STATE_CHANGE_SUCCESS);
pop_messages (bus, 3); pop_messages (bus, 3);
@ -369,7 +369,7 @@ GST_START_TEST (test_watch_for_state_change)
/* setting bin to NULL flushes the bus automatically */ /* setting bin to NULL flushes the bus automatically */
fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL) fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL)
== GST_STATE_SUCCESS); == GST_STATE_CHANGE_SUCCESS);
/* clean up */ /* clean up */
gst_object_unref (bin); gst_object_unref (bin);

View file

@ -218,9 +218,10 @@ GST_START_TEST (test_ghost_pads)
assert_gstrefcount (isrc, 3); /* parent and gsrc */ assert_gstrefcount (isrc, 3); /* parent and gsrc */
fail_unless (gst_element_set_state (b1, 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); gst_object_unref (b1);
/* unreffing the bin will unref all elements, which will unlink and unparent /* unreffing the bin will unref all elements, which will unlink and unparent

View file

@ -120,7 +120,7 @@ GST_START_TEST (test_parsing)
} }
/* GST_MESSAGE_STATE_CHANGED */ /* GST_MESSAGE_STATE_CHANGED */
{ {
GstElementState oldstate, newstate; GstState oldstate, newstate;
oldstate = GST_STATE_PAUSED; oldstate = GST_STATE_PAUSED;
newstate = GST_STATE_PLAYING; 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_tag (GstMessage *message, GstTagList **tag_list);
void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state, void gst_message_parse_state_changed (GstMessage *message, GstState *old_state,
GstElementState *new_state); GstState *new_state);
void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug); 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_warning (GstMessage *message, GError **gerror, gchar **debug);
*/ */

View file

@ -45,7 +45,8 @@ run_pipeline (GstElement * pipe, gchar * descr,
bus = gst_element_get_bus (pipe); bus = gst_element_get_bus (pipe);
g_assert (bus); 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"); g_critical ("Couldn't set pipeline to PLAYING");
goto done; goto done;
} }

View file

@ -26,30 +26,30 @@
GST_START_TEST (test_sink) GST_START_TEST (test_sink)
{ {
GstElement *sink; GstElement *sink;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState current, pending; GstState current, pending;
GTimeVal tv; GTimeVal tv;
sink = gst_element_factory_make ("fakesink", "sink"); sink = gst_element_factory_make ("fakesink", "sink");
ret = gst_element_set_state (sink, GST_STATE_PAUSED); 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); 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); GST_TIME_TO_TIMEVAL ((GstClockTime) 0, tv);
ret = gst_element_get_state (sink, &current, &pending, &tv); ret = gst_element_get_state (sink, &current, &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 (current == GST_STATE_PAUSED, "bad current state");
fail_unless (pending == GST_STATE_PLAYING, "bad pending state"); fail_unless (pending == GST_STATE_PLAYING, "bad pending state");
ret = gst_element_set_state (sink, GST_STATE_PAUSED); 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); 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); gst_object_unref (sink);
} }
@ -60,8 +60,8 @@ GST_END_TEST
GST_START_TEST (test_src_sink) GST_START_TEST (test_src_sink)
{ {
GstElement *sink, *src, *pipeline; GstElement *sink, *src, *pipeline;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState current, pending; GstState current, pending;
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
pipeline = gst_pipeline_new ("pipeline"); 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_set_state (pipeline, GST_STATE_PAUSED);
ret = gst_element_get_state (pipeline, NULL, NULL, NULL); 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); 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, &current, &pending, NULL); ret = gst_element_get_state (pipeline, &current, &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 (current == GST_STATE_PLAYING, "not playing");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
} }
@ -97,8 +97,8 @@ GST_END_TEST
GST_START_TEST (test_livesrc_remove) GST_START_TEST (test_livesrc_remove)
{ {
GstElement *sink, *src, *pipeline; GstElement *sink, *src, *pipeline;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState current, pending; GstState current, pending;
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GTimeVal tv; GTimeVal tv;
@ -117,10 +117,11 @@ GST_START_TEST (test_livesrc_remove)
gst_object_unref (sinkpad); gst_object_unref (sinkpad);
ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); 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, &current, &pending, NULL); ret = gst_element_get_state (src, &current, &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 (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); 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); GST_TIME_TO_TIMEVAL (0, tv);
ret = gst_element_get_state (pipeline, &current, &pending, &tv); ret = gst_element_get_state (pipeline, &current, &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 (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
@ -140,8 +141,8 @@ GST_END_TEST
GST_START_TEST (test_livesrc_sink) GST_START_TEST (test_livesrc_sink)
{ {
GstElement *sink, *src, *pipeline; GstElement *sink, *src, *pipeline;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState current, pending; GstState current, pending;
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
pipeline = gst_pipeline_new ("pipeline"); pipeline = gst_pipeline_new ("pipeline");
@ -159,23 +160,24 @@ GST_START_TEST (test_livesrc_sink)
gst_object_unref (sinkpad); gst_object_unref (sinkpad);
ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); 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, &current, &pending, NULL); ret = gst_element_get_state (src, &current, &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 (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
ret = gst_element_get_state (pipeline, &current, &pending, NULL); ret = gst_element_get_state (pipeline, &current, &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 (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
ret = gst_element_set_state (pipeline, GST_STATE_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, &current, &pending, NULL); ret = gst_element_get_state (pipeline, &current, &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 (current == GST_STATE_PLAYING, "not playing");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
} }

View file

@ -157,13 +157,6 @@ This enum defines the standard flags that an element may have.
@GST_ELEMENT_UNPARENTING: @GST_ELEMENT_UNPARENTING:
@GST_ELEMENT_FLAG_LAST: @GST_ELEMENT_FLAG_LAST:
<!-- ##### MACRO GST_NUM_STATES ##### -->
<para>
The maximun number of states.
</para>
<!-- ##### MACRO GST_STATE ##### --> <!-- ##### MACRO GST_STATE ##### -->
<para> <para>
This macro returns the current state of the element. 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. @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 ##### --> <!-- ##### MACRO GST_STATE_BROADCAST ##### -->
<para> <para>

View file

@ -17,29 +17,6 @@ various global enums and constants
<!-- ##### SECTION Stability_Level ##### --> <!-- ##### 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 ##### --> <!-- ##### ENUM GstRank ##### -->
<para> <para>
Element priority ranks. Defines the order in which the autoplugger (or similar Element priority ranks. Defines the order in which the autoplugger (or similar

View file

@ -182,8 +182,8 @@ main (int argc, char *argv[])
make_pipeline (); make_pipeline ();
while (i < argc) { while (i < argc) {
GstElementStateReturn sret; GstStateChangeReturn sret;
GstElementState state; GstState state;
filename = argv[i]; filename = argv[i];
g_object_set (source, "location", filename, NULL); g_object_set (source, "location", filename, NULL);
@ -194,13 +194,13 @@ main (int argc, char *argv[])
* otherwise the state change fails */ * otherwise the state change fails */
sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
if (GST_STATE_ASYNC == sret) { if (GST_STATE_CHANGE_ASYNC == sret) {
if (GST_STATE_FAILURE == if (GST_STATE_CHANGE_FAILURE ==
gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) { gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) {
g_print ("State change failed. Aborting"); g_print ("State change failed. Aborting");
break; break;
} }
} else if (sret != GST_STATE_SUCCESS) { } else if (sret != GST_STATE_CHANGE_SUCCESS) {
g_print ("%s - Could not read file\n", argv[i]); g_print ("%s - Could not read file\n", argv[i]);
} else { } else {
GstTagList *tags = NULL; GstTagList *tags = NULL;
@ -226,8 +226,8 @@ main (int argc, char *argv[])
g_print ("No metadata found for %s\n", argv[i]); g_print ("No metadata found for %s\n", argv[i]);
sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
if (GST_STATE_ASYNC == sret) { if (GST_STATE_CHANGE_ASYNC == sret) {
if (GST_STATE_FAILURE == if (GST_STATE_CHANGE_FAILURE ==
gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL))
{ {
g_print ("State change failed. Aborting"); g_print ("State change failed. Aborting");

View file

@ -86,7 +86,8 @@ static void gst_example_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_example_get_property (GObject * object, guint prop_id, static void gst_example_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); 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 /* The parent class pointer needs to be kept around for some object
* operations. * 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 * The plugin can prepare itself and its internal data structures
* in the various state transitions. * in the various state transitions.
*/ */
static GstElementStateReturn static GstStateChangeReturn
gst_example_change_state (GstElement * element) gst_example_change_state (GstElement * element, GstStateChange transition)
{ {
GstExample *example; GstExample *example;
@ -348,33 +349,33 @@ gst_example_change_state (GstElement * element)
/* we perform our actions based on the state transition /* we perform our actions based on the state transition
* of the element */ * of the element */
switch (GST_STATE_TRANSITION (element)) { switch (transition) {
/* The NULL to READY transition is used to /* The NULL to READY transition is used to
* create threads (if any), and/or open devices */ * create threads (if any), and/or open devices */
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
break; break;
/* In the PAUSED to PLAYING state, the element should /* In the PAUSED to PLAYING state, the element should
* prepare itself for operation or continue after a PAUSE */ * prepare itself for operation or continue after a PAUSE */
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
/* In the PLAYING to PAUSED state, the element should /* In the PLAYING to PAUSED state, the element should
* PAUSE itself and make sure it can resume operation */ * PAUSE itself and make sure it can resume operation */
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
/* In the PAUSED to READY state, the element should reset /* In the PAUSED to READY state, the element should reset
* its internal state and close any devices. */ * its internal state and close any devices. */
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
/* The element should free all resources, terminate threads /* The element should free all resources, terminate threads
* and put itself into its initial state again */ * and put itself into its initial state again */
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
} }
/* Then we call the parent state change handler */ /* Then we call the parent state change handler */
return parent_class->change_state (element); return parent_class->change_state (element, transition);
} }

View file

@ -109,7 +109,8 @@ static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink,
static void gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer, static void gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end); 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 GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
static void gst_base_sink_loop (GstPad * pad); static void gst_base_sink_loop (GstPad * pad);
@ -1263,23 +1264,22 @@ gst_base_sink_activate_pull (GstPad * pad, gboolean active)
return result; return result;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_base_sink_change_state (GstElement * element) 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); GstBaseSink *basesink = GST_BASE_SINK (element);
GstElementState transition = GST_STATE_TRANSITION (element);
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
bclass = GST_BASE_SINK_GET_CLASS (basesink); bclass = GST_BASE_SINK_GET_CLASS (basesink);
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
if (bclass->start) if (bclass->start)
if (!bclass->start (basesink)) if (!bclass->start (basesink))
goto start_failed; goto start_failed;
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
/* need to complete preroll before this state change completes, there /* 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. */ * is no data flow in READY so we can safely assume we need to preroll. */
basesink->offset = 0; basesink->offset = 0;
@ -1291,9 +1291,9 @@ gst_base_sink_change_state (GstElement * element)
basesink->segment_rate = 1.0; basesink->segment_rate = 1.0;
basesink->segment_start = 0; basesink->segment_start = 0;
basesink->segment_stop = 0; basesink->segment_stop = 0;
ret = GST_STATE_ASYNC; ret = GST_STATE_CHANGE_ASYNC;
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
{ {
GST_PREROLL_LOCK (basesink->sinkpad); GST_PREROLL_LOCK (basesink->sinkpad);
/* if we have EOS, we should empty the queue now as there will /* 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 */ /* don't need preroll, but do queue a commit_state */
basesink->need_preroll = FALSE; basesink->need_preroll = FALSE;
basesink->playing_async = TRUE; basesink->playing_async = TRUE;
ret = GST_STATE_ASYNC; ret = GST_STATE_CHANGE_ASYNC;
/* we know it's not waiting, no need to signal */ /* we know it's not waiting, no need to signal */
} else { } else {
/* don't need the preroll anymore */ /* 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; goto activate_failed;
} }
switch (transition) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
@ -1358,14 +1358,14 @@ gst_base_sink_change_state (GstElement * element)
basesink->eos); basesink->eos);
if (!basesink->have_preroll && !basesink->eos) { if (!basesink->have_preroll && !basesink->eos) {
basesink->need_preroll = TRUE; basesink->need_preroll = TRUE;
ret = GST_STATE_ASYNC; ret = GST_STATE_CHANGE_ASYNC;
} }
GST_PREROLL_UNLOCK (basesink->sinkpad); GST_PREROLL_UNLOCK (basesink->sinkpad);
break; break;
} }
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
if (bclass->stop) if (bclass->stop)
if (!bclass->stop (basesink)) { if (!bclass->stop (basesink)) {
GST_WARNING ("failed to stop"); GST_WARNING ("failed to stop");
@ -1381,11 +1381,11 @@ gst_base_sink_change_state (GstElement * element)
start_failed: start_failed:
{ {
GST_DEBUG ("failed to start"); GST_DEBUG ("failed to start");
return GST_STATE_FAILURE; return GST_STATE_CHANGE_FAILURE;
} }
activate_failed: activate_failed:
{ {
GST_DEBUG ("element failed to change states -- activation problem?"); GST_DEBUG ("element failed to change states -- activation problem?");
return GST_STATE_FAILURE; return GST_STATE_CHANGE_FAILURE;
} }
} }

View file

@ -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_start (GstBaseSrc * basesrc);
static gboolean gst_base_src_stop (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 void gst_base_src_loop (GstPad * pad);
static gboolean gst_base_src_check_get_range (GstPad * pad); static gboolean gst_base_src_check_get_range (GstPad * pad);
@ -1041,30 +1042,28 @@ error_stop:
} }
} }
static GstElementStateReturn static GstStateChangeReturn
gst_base_src_change_state (GstElement * element) gst_base_src_change_state (GstElement * element, GstStateChange transition)
{ {
GstBaseSrc *basesrc; GstBaseSrc *basesrc;
GstElementStateReturn result = GST_STATE_SUCCESS; GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS;
GstElementStateReturn presult; GstStateChangeReturn presult;
GstElementState transition;
basesrc = GST_BASE_SRC (element); basesrc = GST_BASE_SRC (element);
transition = GST_STATE_TRANSITION (element);
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_LIVE_LOCK (element); GST_LIVE_LOCK (element);
if (basesrc->is_live) { if (basesrc->is_live) {
result = GST_STATE_NO_PREROLL; result = GST_STATE_CHANGE_NO_PREROLL;
basesrc->live_running = FALSE; basesrc->live_running = FALSE;
} }
GST_LIVE_UNLOCK (element); GST_LIVE_UNLOCK (element);
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
GST_LIVE_LOCK (element); GST_LIVE_LOCK (element);
if (basesrc->is_live) { if (basesrc->is_live) {
basesrc->live_running = TRUE; basesrc->live_running = TRUE;
@ -1076,26 +1075,27 @@ gst_base_src_change_state (GstElement * element)
break; break;
} }
if ((presult = GST_ELEMENT_CLASS (parent_class)->change_state (element)) != if ((presult =
GST_STATE_SUCCESS) { GST_ELEMENT_CLASS (parent_class)->change_state (element,
transition)) != GST_STATE_CHANGE_SUCCESS) {
gst_base_src_stop (basesrc); gst_base_src_stop (basesrc);
return presult; return presult;
} }
switch (transition) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
GST_LIVE_LOCK (element); GST_LIVE_LOCK (element);
if (basesrc->is_live) { if (basesrc->is_live) {
result = GST_STATE_NO_PREROLL; result = GST_STATE_CHANGE_NO_PREROLL;
basesrc->live_running = FALSE; basesrc->live_running = FALSE;
} }
GST_LIVE_UNLOCK (element); GST_LIVE_UNLOCK (element);
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
if (!gst_base_src_stop (basesrc)) if (!gst_base_src_stop (basesrc))
result = GST_STATE_FAILURE; result = GST_STATE_CHANGE_FAILURE;
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
default: default:
break; break;

View file

@ -113,8 +113,8 @@ static gboolean gst_base_transform_sink_activate_push (GstPad * pad,
static gboolean gst_base_transform_get_unit_size (GstBaseTransform * trans, static gboolean gst_base_transform_get_unit_size (GstBaseTransform * trans,
GstCaps * caps, guint * size); GstCaps * caps, guint * size);
static GstElementStateReturn gst_base_transform_change_state (GstElement * static GstStateChangeReturn gst_base_transform_change_state (GstElement *
element); element, GstStateChange transition);
static gboolean gst_base_transform_event (GstPad * pad, GstEvent * event); static gboolean gst_base_transform_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_base_transform_getrange (GstPad * pad, guint64 offset, 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; return result;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_base_transform_change_state (GstElement * element) gst_base_transform_change_state (GstElement * element,
GstStateChange transition)
{ {
GstBaseTransform *trans; GstBaseTransform *trans;
GstBaseTransformClass *bclass; GstBaseTransformClass *bclass;
GstElementState transition; GstStateChangeReturn result;
GstElementStateReturn result;
trans = GST_BASE_TRANSFORM (element); trans = GST_BASE_TRANSFORM (element);
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans); bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
transition = GST_STATE_TRANSITION (element);
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_LOCK (trans); GST_LOCK (trans);
if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad)) if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad))
trans->in_place = gst_caps_is_equal (GST_PAD_CAPS (trans->sinkpad), 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; trans->negotiated = FALSE;
GST_UNLOCK (trans); GST_UNLOCK (trans);
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
default: default:
break; break;
} }
result = GST_ELEMENT_CLASS (parent_class)->change_state (element); result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
if (bclass->stop) if (bclass->stop)
result = bclass->stop (trans); result = bclass->stop (trans);
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
default: default:
break; break;

View file

@ -140,7 +140,7 @@ gst_check_teardown_element (GstElement * element)
GST_DEBUG ("teardown_element"); GST_DEBUG ("teardown_element");
fail_unless (gst_element_set_state (element, GST_STATE_NULL) == 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); ASSERT_OBJECT_REFCOUNT (element, "element", 1);
gst_object_unref (element); gst_object_unref (element);
} }

View file

@ -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, static void gst_fake_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); 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, static GstFlowReturn gst_fake_sink_preroll (GstBaseSink * bsink,
GstBuffer * buffer); GstBuffer * buffer);
@ -382,35 +383,34 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
return GST_FLOW_OK; return GST_FLOW_OK;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_fake_sink_change_state (GstElement * element) 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); GstFakeSink *fakesink = GST_FAKE_SINK (element);
GstElementState transition = GST_STATE_TRANSITION (element);
switch (transition) { 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) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_NULL_READY)
goto error; goto error;
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_PAUSED) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_PAUSED)
goto error; goto error;
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_PLAYING) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_PLAYING)
goto error; goto error;
break; break;
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PLAYING_PAUSED) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PLAYING_PAUSED)
goto error; goto error;
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_READY) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_READY)
goto error; goto error;
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL)
goto error; goto error;
g_free (fakesink->last_message); g_free (fakesink->last_message);
@ -420,11 +420,11 @@ gst_fake_sink_change_state (GstElement * element)
break; break;
} }
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return ret; return ret;
error: error:
GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL)); GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL));
return GST_STATE_FAILURE; return GST_STATE_CHANGE_FAILURE;
} }

View file

@ -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, static void gst_fdsrc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); 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); static GstFlowReturn gst_fdsrc_create (GstPushSrc * psrc, GstBuffer ** outbuf);
@ -147,29 +148,29 @@ gst_fdsrc_init (GstFdSrc * fdsrc)
fdsrc->seq = 0; fdsrc->seq = 0;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_fdsrc_change_state (GstElement * element) gst_fdsrc_change_state (GstElement * element, GstStateChange transition)
{ {
GstFdSrc *src = GST_FDSRC (element); GstFdSrc *src = GST_FDSRC (element);
switch (GST_STATE_TRANSITION (element)) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
src->curoffset = 0; src->curoffset = 0;
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
default: default:
break; break;
} }
if (GST_ELEMENT_CLASS (parent_class)->change_state) 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;
} }

View file

@ -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, static void gst_file_sink_uri_handler_init (gpointer g_iface,
gpointer iface_data); 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 }; //static guint gst_file_sink_signals[LAST_SIGNAL] = { 0 };
@ -401,36 +402,33 @@ handle_error:
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_file_sink_change_state (GstElement * element) gst_file_sink_change_state (GstElement * element, GstStateChange transition)
{ {
GstElementStateReturn ret; GstStateChangeReturn ret;
gint transition;
transition = GST_STATE_TRANSITION (element);
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
if (!gst_file_sink_open_file (GST_FILE_SINK (element))) if (!gst_file_sink_open_file (GST_FILE_SINK (element)))
goto open_error; goto open_error;
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
default: default:
break; break;
} }
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_file_sink_close_file (GST_FILE_SINK (element)); gst_file_sink_close_file (GST_FILE_SINK (element));
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
default: default:
break; break;
@ -440,7 +438,7 @@ gst_file_sink_change_state (GstElement * element)
open_error: open_error:
{ {
return GST_STATE_FAILURE; return GST_STATE_CHANGE_FAILURE;
} }
} }

View file

@ -259,7 +259,7 @@ gst_file_src_set_location (GstFileSrc * src, const gchar * location)
/* the element must be stopped in order to do this */ /* the element must be stopped in order to do this */
GST_STATE_LOCK (src); GST_STATE_LOCK (src);
{ {
GstElementState state; GstState state;
state = GST_STATE (src); state = GST_STATE (src);
if (state != GST_STATE_READY && state != GST_STATE_NULL) if (state != GST_STATE_READY && state != GST_STATE_NULL)

View file

@ -131,8 +131,9 @@ static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad,
guint64 offset, guint length, GstBuffer ** buffer); guint64 offset, guint length, GstBuffer ** buffer);
static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad); static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad);
static GstElementStateReturn static GstStateChangeReturn
gst_type_find_element_change_state (GstElement * element); 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 (GstPad * pad);
static gboolean static gboolean
gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active); gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active);
@ -406,7 +407,7 @@ start_typefinding (GstTypeFindElement * typefind)
static void static void
stop_typefinding (GstTypeFindElement * typefind) stop_typefinding (GstTypeFindElement * typefind)
{ {
GstElementState state; GstState state;
gboolean push_cached_buffers; gboolean push_cached_buffers;
gst_element_get_state (GST_ELEMENT (typefind), &state, NULL, NULL); gst_element_get_state (GST_ELEMENT (typefind), &state, NULL, NULL);
@ -837,21 +838,20 @@ gst_type_find_element_activate (GstPad * pad)
} }
} }
static GstElementStateReturn static GstStateChangeReturn
gst_type_find_element_change_state (GstElement * element) gst_type_find_element_change_state (GstElement * element,
GstStateChange transition)
{ {
GstElementState transition; GstStateChangeReturn ret;
GstElementStateReturn ret;
GstTypeFindElement *typefind; GstTypeFindElement *typefind;
typefind = GST_TYPE_FIND_ELEMENT (element); 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) { switch (transition) {
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_caps_replace (&typefind->caps, NULL); gst_caps_replace (&typefind->caps, NULL);
break; break;
default: default:

View file

@ -94,9 +94,10 @@ GType _gst_bin_type = 0;
static void gst_bin_dispose (GObject * object); static void gst_bin_dispose (GObject * object);
static GstElementStateReturn gst_bin_change_state (GstElement * element); static GstStateChangeReturn gst_bin_change_state (GstElement * element,
static GstElementStateReturn gst_bin_get_state (GstElement * element, GstStateChange transition);
GstElementState * state, GstElementState * pending, GTimeVal * timeout); 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_add_func (GstBin * bin, GstElement * element);
static gboolean gst_bin_remove_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 * MT safe
*/ */
static GstElementStateReturn static GstStateChangeReturn
gst_bin_get_state (GstElement * element, GstElementState * state, gst_bin_get_state (GstElement * element, GstState * state,
GstElementState * pending, GTimeVal * timeout) GstState * pending, GTimeVal * timeout)
{ {
GstBin *bin = GST_BIN (element); GstBin *bin = GST_BIN (element);
GstElementStateReturn ret = GST_STATE_SUCCESS; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GList *children; GList *children;
guint32 children_cookie; guint32 children_cookie;
gboolean have_no_preroll; gboolean have_no_preroll;
@ -1014,14 +1015,14 @@ restart:
switch (ret) { switch (ret) {
/* report FAILURE immediatly */ /* report FAILURE immediatly */
case GST_STATE_FAILURE: case GST_STATE_CHANGE_FAILURE:
goto done; goto done;
case GST_STATE_NO_PREROLL: case GST_STATE_CHANGE_NO_PREROLL:
/* we have to continue scanning as there might be /* we have to continue scanning as there might be
* ERRORS too */ * ERRORS too */
have_no_preroll = TRUE; have_no_preroll = TRUE;
break; break;
case GST_STATE_ASYNC: case GST_STATE_CHANGE_ASYNC:
have_async = TRUE; have_async = TRUE;
break; break;
default: default:
@ -1032,7 +1033,7 @@ restart:
/* if we get here, we have no FAILURES, check for any NO_PREROLL /* if we get here, we have no FAILURES, check for any NO_PREROLL
* elements then. */ * elements then. */
if (have_no_preroll) { if (have_no_preroll) {
ret = GST_STATE_NO_PREROLL; ret = GST_STATE_CHANGE_NO_PREROLL;
goto done; goto done;
} }
@ -1042,7 +1043,7 @@ restart:
/* if no ASYNC elements exist we don't even have to poll with a /* if no ASYNC elements exist we don't even have to poll with a
* timeout again */ * timeout again */
if (!have_async) { if (!have_async) {
ret = GST_STATE_SUCCESS; ret = GST_STATE_CHANGE_SUCCESS;
goto done; goto done;
} }
} }
@ -1075,13 +1076,13 @@ restart:
} }
switch (ret) { switch (ret) {
case GST_STATE_SUCCESS: case GST_STATE_CHANGE_SUCCESS:
break; break;
case GST_STATE_FAILURE: case GST_STATE_CHANGE_FAILURE:
case GST_STATE_NO_PREROLL: case GST_STATE_CHANGE_NO_PREROLL:
/* report FAILURE and NO_PREROLL immediatly */ /* report FAILURE and NO_PREROLL immediatly */
goto done; goto done;
case GST_STATE_ASYNC: case GST_STATE_CHANGE_ASYNC:
goto done; goto done;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
@ -1100,11 +1101,11 @@ done:
* added after this function completed. */ * added after this function completed. */
GST_STATE_LOCK (bin); GST_STATE_LOCK (bin);
switch (ret) { switch (ret) {
case GST_STATE_SUCCESS: case GST_STATE_CHANGE_SUCCESS:
/* we can commit the state */ /* we can commit the state */
gst_element_commit_state (element); gst_element_commit_state (element);
break; break;
case GST_STATE_FAILURE: case GST_STATE_CHANGE_FAILURE:
/* some element failed, abort the state change */ /* some element failed, abort the state change */
gst_element_abort_state (element); gst_element_abort_state (element);
break; 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 /* FIXME, make me more elegant, want to use a topological sort algorithm
* based on indegrees (or outdegrees in our case) */ * based on indegrees (or outdegrees in our case) */
static GstElementStateReturn static GstStateChangeReturn
gst_bin_change_state (GstElement * element) gst_bin_change_state (GstElement * element, GstStateChange transition)
{ {
GstBin *bin; GstBin *bin;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState old_state, pending; GstState old_state, pending;
gboolean have_async = FALSE; gboolean have_async = FALSE;
gboolean have_no_preroll = FALSE; gboolean have_no_preroll = FALSE;
GList *children; GList *children;
@ -1233,10 +1234,10 @@ gst_bin_change_state (GstElement * element)
gst_element_state_get_name (pending)); gst_element_state_get_name (pending));
if (pending == GST_STATE_VOID_PENDING) if (pending == GST_STATE_VOID_PENDING)
return GST_STATE_SUCCESS; return GST_STATE_CHANGE_SUCCESS;
/* Clear eosed element list on READY-> PAUSED */ /* 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); g_list_free (bin->eosed);
bin->eosed = NULL; bin->eosed = NULL;
} }
@ -1399,28 +1400,28 @@ restart:
GST_UNLOCK (bin); GST_UNLOCK (bin);
switch (ret) { switch (ret) {
case GST_STATE_SUCCESS: case GST_STATE_CHANGE_SUCCESS:
GST_CAT_DEBUG (GST_CAT_STATES, GST_CAT_DEBUG (GST_CAT_STATES,
"child '%s' changed state to %d(%s) successfully", "child '%s' changed state to %d(%s) successfully",
GST_ELEMENT_NAME (qelement), pending, GST_ELEMENT_NAME (qelement), pending,
gst_element_state_get_name (pending)); gst_element_state_get_name (pending));
break; break;
case GST_STATE_ASYNC: case GST_STATE_CHANGE_ASYNC:
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"child '%s' is changing state asynchronously", "child '%s' is changing state asynchronously",
GST_ELEMENT_NAME (qelement)); GST_ELEMENT_NAME (qelement));
have_async = TRUE; have_async = TRUE;
break; break;
case GST_STATE_FAILURE: case GST_STATE_CHANGE_FAILURE:
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"child '%s' failed to go to state %d(%s)", "child '%s' failed to go to state %d(%s)",
GST_ELEMENT_NAME (qelement), GST_ELEMENT_NAME (qelement),
pending, gst_element_state_get_name (pending)); 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 */ /* release refcount of element we popped off the queue */
gst_object_unref (qelement); gst_object_unref (qelement);
goto exit; goto exit;
case GST_STATE_NO_PREROLL: case GST_STATE_CHANGE_NO_PREROLL:
GST_CAT_DEBUG (GST_CAT_STATES, GST_CAT_DEBUG (GST_CAT_STATES,
"child '%s' changed state to %d(%s) successfully without preroll", "child '%s' changed state to %d(%s) successfully without preroll",
GST_ELEMENT_NAME (qelement), pending, GST_ELEMENT_NAME (qelement), pending,
@ -1448,11 +1449,11 @@ restart:
} }
if (have_no_preroll) { if (have_no_preroll) {
ret = GST_STATE_NO_PREROLL; ret = GST_STATE_CHANGE_NO_PREROLL;
} else if (have_async) { } else if (have_async) {
ret = GST_STATE_ASYNC; ret = GST_STATE_CHANGE_ASYNC;
} else { } else {
ret = parent_class->change_state (element); ret = parent_class->change_state (element, transition);
} }
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,

View file

@ -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_dispose (GObject * object);
static void gst_element_finalize (GObject * object); static void gst_element_finalize (GObject * object);
static GstElementStateReturn gst_element_change_state (GstElement * element); static GstStateChangeReturn gst_element_change_state (GstElement * element,
static GstElementStateReturn gst_element_get_state_func (GstElement * element, GstStateChange transition);
GstElementState * state, GstElementState * pending, GTimeVal * timeout); 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); static void gst_element_set_bus_func (GstElement * element, GstBus * bus);
#ifndef GST_DISABLE_LOADSAVE #ifndef GST_DISABLE_LOADSAVE
@ -119,7 +120,7 @@ gst_element_class_init (GstElementClass * klass)
* @old_state: the GST_STATE_XXX before the change * @old_state: the GST_STATE_XXX before the change
* @new_state: the GST_STATE_XXX after 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] = gst_element_signals[STATE_CHANGE] =
g_signal_new ("state-changed", G_TYPE_FROM_CLASS (klass), 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_NAME (parent),
gst_element_state_get_name (GST_STATE (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 FALSE;
} }
return TRUE; return TRUE;
} }
/* MT safe */ /* MT safe */
static GstElementStateReturn static GstStateChangeReturn
gst_element_get_state_func (GstElement * element, gst_element_get_state_func (GstElement * element,
GstElementState * state, GstElementState * pending, GTimeVal * timeout) GstState * state, GstState * pending, GTimeVal * timeout)
{ {
GstElementStateReturn ret = GST_STATE_FAILURE; GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;
GstElementState old_pending; GstState old_pending;
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "getting state"); GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "getting state");
GST_STATE_LOCK (element); GST_STATE_LOCK (element);
/* we got an error, report immediatly */ /* we got an error, report immediatly */
if (GST_STATE_NO_PREROLL (element)) { if (GST_STATE_NO_PREROLL (element)) {
ret = GST_STATE_NO_PREROLL; ret = GST_STATE_CHANGE_NO_PREROLL;
goto done; goto done;
} }
/* we got an error, report immediatly */ /* we got an error, report immediatly */
if (GST_STATE_ERROR (element)) { if (GST_STATE_ERROR (element)) {
ret = GST_STATE_FAILURE; ret = GST_STATE_CHANGE_FAILURE;
goto done; goto done;
} }
@ -1556,22 +1558,22 @@ gst_element_get_state_func (GstElement * element,
if (!GST_STATE_TIMED_WAIT (element, timeval)) { if (!GST_STATE_TIMED_WAIT (element, timeval)) {
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "timeout"); GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "timeout");
/* timeout triggered */ /* timeout triggered */
ret = GST_STATE_ASYNC; ret = GST_STATE_CHANGE_ASYNC;
} else { } else {
/* could be success or failure */ /* could be success or failure */
if (old_pending == GST_STATE (element)) { if (old_pending == GST_STATE (element)) {
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "got success"); GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "got success");
ret = GST_STATE_SUCCESS; ret = GST_STATE_CHANGE_SUCCESS;
} else { } else {
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "got failure"); 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 nothing is pending anymore we can return SUCCESS */
if (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING) { if (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING) {
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "nothing pending"); GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "nothing pending");
ret = GST_STATE_SUCCESS; ret = GST_STATE_CHANGE_SUCCESS;
} }
done: done:
@ -1594,8 +1596,8 @@ done:
/** /**
* gst_element_get_state: * gst_element_get_state:
* @element: a #GstElement to get the state of. * @element: a #GstElement to get the state of.
* @state: a pointer to #GstElementState to hold the state. Can be NULL. * @state: a pointer to #GstState to hold the state. Can be NULL.
* @pending: a pointer to #GstElementState to hold the pending state. * @pending: a pointer to #GstState to hold the pending state.
* Can be NULL. * Can be NULL.
* @timeout: a #GTimeVal to specify the timeout for an async * @timeout: a #GTimeVal to specify the timeout for an async
* state change or NULL for infinite timeout. * state change or NULL for infinite timeout.
@ -1607,23 +1609,23 @@ done:
* specified timeout value for the state change to complete. * specified timeout value for the state change to complete.
* If the element completes the state change or goes into * If the element completes the state change or goes into
* an error, this function returns immediatly with a return value of * 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 * Returns: GST_STATE_CHANGE_SUCCESS if the element has no more pending state and
* the last state change succeeded, GST_STATE_ASYNC * the last state change succeeded, GST_STATE_CHANGE_ASYNC
* if the element is still performing a state change or * 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. * MT safe.
*/ */
GstElementStateReturn GstStateChangeReturn
gst_element_get_state (GstElement * element, gst_element_get_state (GstElement * element,
GstElementState * state, GstElementState * pending, GTimeVal * timeout) GstState * state, GstState * pending, GTimeVal * timeout)
{ {
GstElementClass *oclass; 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); oclass = GST_ELEMENT_GET_CLASS (element);
@ -1648,7 +1650,7 @@ gst_element_get_state (GstElement * element,
void void
gst_element_abort_state (GstElement * element) gst_element_abort_state (GstElement * element)
{ {
GstElementState pending; GstState pending;
g_return_if_fail (GST_IS_ELEMENT (element)); 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)) { if (pending != GST_STATE_VOID_PENDING && !GST_STATE_ERROR (element)) {
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
GstElementState old_state = GST_STATE (element); GstState old_state = GST_STATE (element);
#endif #endif
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
@ -1684,7 +1686,7 @@ gst_element_abort_state (GstElement * element)
void void
gst_element_commit_state (GstElement * element) gst_element_commit_state (GstElement * element)
{ {
GstElementState pending; GstState pending;
GstMessage *message; GstMessage *message;
g_return_if_fail (GST_IS_ELEMENT (element)); g_return_if_fail (GST_IS_ELEMENT (element));
@ -1692,7 +1694,7 @@ gst_element_commit_state (GstElement * element)
pending = GST_STATE_PENDING (element); pending = GST_STATE_PENDING (element);
if (pending != GST_STATE_VOID_PENDING) { 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, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"commiting state from %s to %s", gst_element_state_get_name (old_state), "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 && if (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING &&
!GST_STATE_ERROR (element)) { !GST_STATE_ERROR (element)) {
GstElementState current_state = GST_STATE (element); GstState current_state = GST_STATE (element);
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"lost state of %s", gst_element_state_get_name (current_state)); "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: * gst_element_set_state:
* @element: a #GstElement to change state of. * @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 * Sets the state of the element. This function will try to set the
* requested state by going through all the intermediary states and calling * requested state by going through all the intermediary states and calling
* the class's state change function for each. * 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. * MT safe.
*/ */
GstElementStateReturn GstStateChangeReturn
gst_element_set_state (GstElement * element, GstElementState state) gst_element_set_state (GstElement * element, GstState state)
{ {
GstElementClass *oclass; GstElementClass *oclass;
GstElementState current; GstState current;
GstElementStateReturn return_val = GST_STATE_SUCCESS; GstStateChangeReturn return_val = GST_STATE_CHANGE_SUCCESS;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState pending; GstState pending;
GTimeVal tv; 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 /* get current element state, need to call the method so that
* we call the virtual method and subclasses can implement their * 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); GST_STATE_LOCK (element);
/* this is the state we should go to */ /* this is the state we should go to */
GST_STATE_FINAL (element) = state; GST_STATE_FINAL (element) = state;
if (ret == GST_STATE_ASYNC) { if (ret == GST_STATE_CHANGE_ASYNC) {
gst_element_commit_state (element); gst_element_commit_state (element);
gst_element_lost_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 * current state is equal to the required state. This is needed
* for bins that sync their children. */ * for bins that sync their children. */
do { do {
GstElementState pending; GstState pending;
/* calculate the pending state */ /* calculate the pending state */
if (current < state) if (current < state)
pending = current << 1; pending = current + 1;
else if (current > state) else if (current > state)
pending = current >> 1; pending = current - 1;
else else
pending = current; 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 */ /* call the state change function so it can set the state */
if (oclass->change_state) if (oclass->change_state)
return_val = (oclass->change_state) (element); return_val = (oclass->change_state) (element, GST_STATE_CHANGE (element));
else else
return_val = GST_STATE_FAILURE; return_val = GST_STATE_CHANGE_FAILURE;
/* clear the error and preroll flag, we need to do that after /* clear the error and preroll flag, we need to do that after
* calling the virtual change_state function so that it can use the * 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; GST_STATE_NO_PREROLL (element) = FALSE;
switch (return_val) { switch (return_val) {
case GST_STATE_FAILURE: case GST_STATE_CHANGE_FAILURE:
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"have failed change_state return"); "have failed change_state return");
/* state change failure exits the loop */ /* state change failure exits the loop */
gst_element_abort_state (element); gst_element_abort_state (element);
goto exit; goto exit;
case GST_STATE_ASYNC: case GST_STATE_CHANGE_ASYNC:
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"element will change state async"); "element will change state async");
/* an async state change exits the loop, we can only /* an async state change exits the loop, we can only
* go to the next state change when this one completes. */ * go to the next state change when this one completes. */
goto exit; goto exit;
case GST_STATE_SUCCESS: case GST_STATE_CHANGE_SUCCESS:
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"element changed state successfully"); "element changed state successfully");
/* we can commit the state now and proceed to the next state */ /* we can commit the state now and proceed to the next state */
gst_element_commit_state (element); gst_element_commit_state (element);
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "commited state"); GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "commited state");
break; break;
case GST_STATE_NO_PREROLL: case GST_STATE_CHANGE_NO_PREROLL:
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"element changed state successfully and can't preroll"); "element changed state successfully and can't preroll");
/* we can commit the state now and proceed to the next state */ /* 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 ! */ /* somebody added a GST_STATE_ and forgot to do stuff here ! */
g_critical ("unknown return value %d from a state change function", g_critical ("unknown return value %d from a state change function",
return_val); 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 */ /* is called with STATE_LOCK */
static GstElementStateReturn static GstStateChangeReturn
gst_element_change_state (GstElement * element) gst_element_change_state (GstElement * element, GstStateChange transition)
{ {
GstElementState old_state; GstState state, pending;
gint old_pending, old_transition; GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS;
GstElementStateReturn result = GST_STATE_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); state = GST_STATE (element);
old_pending = GST_STATE_PENDING (element); pending = GST_STATE_PENDING (element);
old_transition = GST_STATE_TRANSITION (element);
/* if the element already is in the given state, we just return success */ /* if the element already is in the given state, we just return success */
if (old_pending == GST_STATE_VOID_PENDING || if (pending == GST_STATE_VOID_PENDING || state == GST_STATE_PENDING (element)) {
old_state == GST_STATE_PENDING (element)) {
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
"element is already in the %s state", "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)) if (GST_STATE_NO_PREROLL (element))
return GST_STATE_NO_PREROLL; return GST_STATE_CHANGE_NO_PREROLL;
else else
return GST_STATE_SUCCESS; return GST_STATE_CHANGE_SUCCESS;
} }
GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, GST_CAT_LOG_OBJECT (GST_CAT_STATES, element,
"default handler tries setting state from %s to %s (%04x)", "default handler tries setting state from %s to %s (%04x)",
gst_element_state_get_name (old_state), gst_element_state_get_name (state),
gst_element_state_get_name (old_pending), old_transition); gst_element_state_get_name (pending), transition);
switch (old_transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
if (!gst_element_pads_activate (element, TRUE)) { if (!gst_element_pads_activate (element, TRUE)) {
result = GST_STATE_FAILURE; result = GST_STATE_CHANGE_FAILURE;
} }
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
/* deactivate pads in both cases, since they are activated on /* deactivate pads in both cases, since they are activated on
ready->paused but the element might not have made it to paused */ ready->paused but the element might not have made it to paused */
if (!gst_element_pads_activate (element, FALSE)) { if (!gst_element_pads_activate (element, FALSE)) {
result = GST_STATE_FAILURE; result = GST_STATE_CHANGE_FAILURE;
} else { } else {
GST_LOCK (element); GST_LOCK (element);
element->base_time = 0; 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 * - somehow the element was asked to jump across an intermediate state
*/ */
g_warning ("Unhandled state change from %s to %s", g_warning ("Unhandled state change from %s to %s",
gst_element_state_get_name (old_state), gst_element_state_get_name (state),
gst_element_state_get_name (old_pending)); gst_element_state_get_name (pending));
break; break;
} }

View file

@ -28,15 +28,15 @@
typedef struct _GstElement GstElement; typedef struct _GstElement GstElement;
typedef struct _GstElementClass GstElementClass; typedef struct _GstElementClass GstElementClass;
/* gstmessage.h needs ElementState */ /* gstmessage.h needs State */
#define GST_NUM_STATES 4
typedef enum { typedef enum {
GST_STATE_VOID_PENDING = 0, GST_STATE_VOID_PENDING = 0, /* used for GstElement->pending_state when
GST_STATE_NULL = (1 << 0), there is no pending state */
GST_STATE_READY = (1 << 1), GST_STATE_NULL = 1,
GST_STATE_PAUSED = (1 << 2), GST_STATE_READY = 2,
GST_STATE_PLAYING = (1 << 3) GST_STATE_PAUSED = 3,
} GstElementState; GST_STATE_PLAYING = 4
} GstState;
#include <gst/gstconfig.h> #include <gst/gstconfig.h>
@ -65,11 +65,11 @@ GST_EXPORT GType _gst_element_type;
#define GST_ELEMENT_CAST(obj) ((GstElement*)(obj)) #define GST_ELEMENT_CAST(obj) ((GstElement*)(obj))
typedef enum { typedef enum {
GST_STATE_FAILURE = 0, GST_STATE_CHANGE_FAILURE = 0,
GST_STATE_SUCCESS = 1, GST_STATE_CHANGE_SUCCESS = 1,
GST_STATE_ASYNC = 2, GST_STATE_CHANGE_ASYNC = 2,
GST_STATE_NO_PREROLL = 3 GST_STATE_CHANGE_NO_PREROLL = 3
} GstElementStateReturn; } GstStateChangeReturn;
/* NOTE: this probably should be done with an #ifdef to decide /* NOTE: this probably should be done with an #ifdef to decide
* whether to safe-cast or to just do the non-checking cast. * 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_ERROR(obj) (GST_ELEMENT(obj)->state_error)
#define GST_STATE_NO_PREROLL(obj) (GST_ELEMENT(obj)->no_preroll) #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> */ #ifndef GST_DEBUG_STATE_CHANGE
#define GST_STATE_TRANSITION(obj) ((GST_STATE(obj)<<8) | GST_STATE_PENDING(obj)) #define GST_STATE_CHANGE(obj) ((1<<(GST_STATE(obj)+8)) | 1<<GST_STATE_PENDING(obj))
#define GST_STATE_NULL_TO_READY ((GST_STATE_NULL<<8) | GST_STATE_READY) #else
#define GST_STATE_READY_TO_PAUSED ((GST_STATE_READY<<8) | GST_STATE_PAUSED) inline GstStateChange
#define GST_STATE_PAUSED_TO_PLAYING ((GST_STATE_PAUSED<<8) | GST_STATE_PLAYING) _gst_element_get_state_change (GstElement *e)
#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) if (e->state < GST_STATE_NULL || e->state > GST_STATE_PLAYING)
#define GST_STATE_READY_TO_NULL ((GST_STATE_READY<<8) | GST_STATE_NULL) 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 typedef enum
{ {
@ -219,7 +238,7 @@ struct _GstElementClass
/*< private >*/ /*< private >*/
/* signal callbacks */ /* 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_added) (GstElement *element, GstPad *pad);
void (*pad_removed) (GstElement *element, GstPad *pad); void (*pad_removed) (GstElement *element, GstPad *pad);
void (*no_more_pads) (GstElement *element); void (*no_more_pads) (GstElement *element);
@ -232,9 +251,9 @@ struct _GstElementClass
void (*release_pad) (GstElement *element, GstPad *pad); void (*release_pad) (GstElement *element, GstPad *pad);
/* state changes */ /* state changes */
GstElementStateReturn (*get_state) (GstElement * element, GstElementState * state, GstStateChangeReturn (*get_state) (GstElement * element, GstState * state,
GstElementState * pending, GTimeVal * timeout); GstState * pending, GTimeVal * timeout);
GstElementStateReturn (*change_state) (GstElement *element); GstStateChangeReturn (*change_state) (GstElement *element, GstStateChange transition);
/* bus */ /* bus */
void (*set_bus) (GstElement * element, GstBus * 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_set_locked_state (GstElement *element, gboolean locked_state);
gboolean gst_element_sync_state_with_parent (GstElement *element); gboolean gst_element_sync_state_with_parent (GstElement *element);
GstElementStateReturn gst_element_get_state (GstElement * element, GstStateChangeReturn gst_element_get_state (GstElement * element,
GstElementState * state, GstState * state,
GstElementState * pending, GstState * pending,
GTimeVal * timeout); 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_abort_state (GstElement * element);
void gst_element_commit_state (GstElement * element); void gst_element_commit_state (GstElement * element);

View file

@ -307,8 +307,7 @@ gst_message_new_tag (GstObject * src, GstTagList * tag_list)
* MT safe. * MT safe.
*/ */
GstMessage * GstMessage *
gst_message_new_state_changed (GstObject * src, GstElementState old, gst_message_new_state_changed (GstObject * src, GstState old, GstState new)
GstElementState new)
{ {
GstMessage *message; GstMessage *message;
GstStructure *s; GstStructure *s;
@ -460,8 +459,8 @@ gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list)
* MT safe. * MT safe.
*/ */
void void
gst_message_parse_state_changed (GstMessage * message, GstElementState * old, gst_message_parse_state_changed (GstMessage * message, GstState * old,
GstElementState * new) GstState * new)
{ {
g_return_if_fail (GST_IS_MESSAGE (message)); g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED);

View file

@ -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_error (GstObject * src, GError * error, gchar * debug);
GstMessage * gst_message_new_warning (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_tag (GstObject * src, GstTagList * tag_list);
GstMessage * gst_message_new_state_changed (GstObject * src, GstElementState old_state, GstMessage * gst_message_new_state_changed (GstObject * src, GstState old_state,
GstElementState new_state); GstState new_state);
GstMessage * gst_message_new_segment_start (GstObject * src, GstClockTime timestamp); GstMessage * gst_message_new_segment_start (GstObject * src, GstClockTime timestamp);
GstMessage * gst_message_new_segment_done (GstObject * src, GstClockTime timestamp); GstMessage * gst_message_new_segment_done (GstObject * src, GstClockTime timestamp);
GstMessage * gst_message_new_custom (GstMessageType type, 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_error (GstMessage *message, GError **gerror, gchar **debug);
void gst_message_parse_warning (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_tag (GstMessage *message, GstTagList **tag_list);
void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state, void gst_message_parse_state_changed (GstMessage *message, GstState *old_state,
GstElementState *new_state); GstState *new_state);
void gst_message_parse_segment_start (GstMessage *message, GstClockTime *timestamp); void gst_message_parse_segment_start (GstMessage *message, GstClockTime *timestamp);
void gst_message_parse_segment_done (GstMessage *message, GstClockTime *timestamp); void gst_message_parse_segment_done (GstMessage *message, GstClockTime *timestamp);

View file

@ -64,7 +64,8 @@ static gboolean gst_pipeline_send_event (GstElement * element,
GstEvent * event); GstEvent * event);
static GstClock *gst_pipeline_get_clock_func (GstElement * element); 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; static GstBinClass *parent_class = NULL;
@ -204,7 +205,7 @@ gst_pipeline_send_event (GstElement * element, GstEvent * event)
{ {
gboolean was_playing; gboolean was_playing;
gboolean res; gboolean res;
GstElementState state; GstState state;
GstEventType event_type = GST_EVENT_TYPE (event); GstEventType event_type = GST_EVENT_TYPE (event);
GTimeVal timeout; GTimeVal timeout;
@ -249,25 +250,24 @@ gst_pipeline_new (const gchar * name)
} }
/* MT safe */ /* MT safe */
static GstElementStateReturn static GstStateChangeReturn
gst_pipeline_change_state (GstElement * element) gst_pipeline_change_state (GstElement * element, GstStateChange transition)
{ {
GstElementStateReturn result = GST_STATE_SUCCESS; GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS;
GstPipeline *pipeline = GST_PIPELINE (element); GstPipeline *pipeline = GST_PIPELINE (element);
gint transition = GST_STATE_TRANSITION (element);
GstClockTime play_timeout; GstClockTime play_timeout;
GstClock *clock; GstClock *clock;
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
GST_LOCK (element); GST_LOCK (element);
if (element->bus) if (element->bus)
gst_bus_set_flushing (element->bus, FALSE); gst_bus_set_flushing (element->bus, FALSE);
GST_UNLOCK (element); GST_UNLOCK (element);
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
/* when going to playing, select a clock */ /* when going to playing, select a clock */
if ((clock = gst_element_get_clock (element))) { if ((clock = gst_element_get_clock (element))) {
GstClockTime start_time; GstClockTime start_time;
@ -293,21 +293,23 @@ gst_pipeline_change_state (GstElement * element)
gst_element_set_base_time (element, 0); gst_element_set_base_time (element, 0);
} }
break; break;
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
} }
result = GST_ELEMENT_CLASS (parent_class)->change_state (element); result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (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); gst_pipeline_set_new_stream_time (pipeline, 0);
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
GST_LOCK (element); GST_LOCK (element);
if ((clock = element->clock)) { if ((clock = element->clock)) {
GstClockTime now; GstClockTime now;
@ -329,9 +331,9 @@ gst_pipeline_change_state (GstElement * element)
} }
GST_UNLOCK (element); GST_UNLOCK (element);
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
GST_LOCK (element); GST_LOCK (element);
if (element->bus) { if (element->bus) {
gst_bus_set_flushing (element->bus, TRUE); gst_bus_set_flushing (element->bus, TRUE);
@ -340,7 +342,7 @@ gst_pipeline_change_state (GstElement * element)
break; break;
} }
if (result == GST_STATE_ASYNC) { if (result == GST_STATE_CHANGE_ASYNC) {
GST_LOCK (pipeline); GST_LOCK (pipeline);
play_timeout = pipeline->play_timeout; play_timeout = pipeline->play_timeout;
GST_UNLOCK (pipeline); GST_UNLOCK (pipeline);
@ -363,11 +365,11 @@ gst_pipeline_change_state (GstElement * element)
} }
result = gst_element_get_state (element, NULL, NULL, timeval); result = gst_element_get_state (element, NULL, NULL, timeval);
if (result == GST_STATE_ASYNC) { if (result == GST_STATE_CHANGE_ASYNC) {
GST_WARNING_OBJECT (pipeline, GST_WARNING_OBJECT (pipeline,
"timeout in PREROLL, forcing next state change"); "timeout in PREROLL, forcing next state change");
g_warning ("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); GST_STATE_LOCK (pipeline);

View file

@ -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_src_activate_push (GstPad * pad, gboolean active);
static gboolean gst_queue_sink_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 ()) #define GST_TYPE_QUEUE_LEAKY (queue_leaky_get_type ())
@ -989,35 +990,35 @@ gst_queue_src_activate_push (GstPad * pad, gboolean active)
return result; return result;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_queue_change_state (GstElement * element) gst_queue_change_state (GstElement * element, GstStateChange transition)
{ {
GstQueue *queue; GstQueue *queue;
GstElementStateReturn ret = GST_STATE_SUCCESS; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
queue = GST_QUEUE (element); queue = GST_QUEUE (element);
GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "starting state change"); GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "starting state change");
switch (GST_STATE_TRANSITION (element)) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
default: default:
break; 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)) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
default: default:
break; break;

View file

@ -703,14 +703,14 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
/** /**
* gst_element_state_get_name: * 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. * Gets a string representing the given state.
* *
* Returns: a string with the name of the state. * Returns: a string with the name of the state.
*/ */
const gchar * const gchar *
gst_element_state_get_name (GstElementState state) gst_element_state_get_name (GstState state)
{ {
switch (state) { switch (state) {
#ifdef GST_DEBUG_COLOR #ifdef GST_DEBUG_COLOR
@ -1278,7 +1278,7 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
if (filter) { if (filter) {
GstElement *capsfilter; GstElement *capsfilter;
GstObject *parent; GstObject *parent;
GstElementState state, pending; GstState state, pending;
GTimeVal tv; GTimeVal tv;
capsfilter = gst_element_factory_make ("capsfilter", NULL); capsfilter = gst_element_factory_make ("capsfilter", NULL);
@ -1841,13 +1841,13 @@ gst_bin_remove_many (GstBin * bin, GstElement * element_1, ...)
static void static void
get_state_func (GstElement * element, gpointer unused) 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, GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"new thread waiting on state change"); "new thread waiting on state change");
/* wait indefinitely */ /* wait indefinitely */
while (ret == GST_STATE_ASYNC) while (ret == GST_STATE_CHANGE_ASYNC)
ret = gst_element_get_state (element, NULL, NULL, NULL); ret = gst_element_get_state (element, NULL, NULL, NULL);
gst_object_unref (element); 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. * 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 * 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 * 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 * state will ensure that a state-changed message gets posted on the bus

View file

@ -292,7 +292,7 @@ GstPad* gst_element_get_compatible_pad (GstElement *element, Gs
GstPadTemplate* gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl); 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 (GstElement *src, GstElement *dest);
gboolean gst_element_link_many (GstElement *element_1, gboolean gst_element_link_many (GstElement *element_1,

View file

@ -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"); 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 /* FIXME: it would be nice if we can figure out why it failed
(e.g. caps nego) and give an error about that instead. */ (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)); GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL));
} }
} else { } else {

View file

@ -109,7 +109,8 @@ static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink,
static void gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer, static void gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end); 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 GstFlowReturn gst_base_sink_chain (GstPad * pad, GstBuffer * buffer);
static void gst_base_sink_loop (GstPad * pad); static void gst_base_sink_loop (GstPad * pad);
@ -1263,23 +1264,22 @@ gst_base_sink_activate_pull (GstPad * pad, gboolean active)
return result; return result;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_base_sink_change_state (GstElement * element) 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); GstBaseSink *basesink = GST_BASE_SINK (element);
GstElementState transition = GST_STATE_TRANSITION (element);
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
bclass = GST_BASE_SINK_GET_CLASS (basesink); bclass = GST_BASE_SINK_GET_CLASS (basesink);
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
if (bclass->start) if (bclass->start)
if (!bclass->start (basesink)) if (!bclass->start (basesink))
goto start_failed; goto start_failed;
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
/* need to complete preroll before this state change completes, there /* 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. */ * is no data flow in READY so we can safely assume we need to preroll. */
basesink->offset = 0; basesink->offset = 0;
@ -1291,9 +1291,9 @@ gst_base_sink_change_state (GstElement * element)
basesink->segment_rate = 1.0; basesink->segment_rate = 1.0;
basesink->segment_start = 0; basesink->segment_start = 0;
basesink->segment_stop = 0; basesink->segment_stop = 0;
ret = GST_STATE_ASYNC; ret = GST_STATE_CHANGE_ASYNC;
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
{ {
GST_PREROLL_LOCK (basesink->sinkpad); GST_PREROLL_LOCK (basesink->sinkpad);
/* if we have EOS, we should empty the queue now as there will /* 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 */ /* don't need preroll, but do queue a commit_state */
basesink->need_preroll = FALSE; basesink->need_preroll = FALSE;
basesink->playing_async = TRUE; basesink->playing_async = TRUE;
ret = GST_STATE_ASYNC; ret = GST_STATE_CHANGE_ASYNC;
/* we know it's not waiting, no need to signal */ /* we know it's not waiting, no need to signal */
} else { } else {
/* don't need the preroll anymore */ /* 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; goto activate_failed;
} }
switch (transition) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
{ {
GstBaseSinkClass *bclass; GstBaseSinkClass *bclass;
@ -1358,14 +1358,14 @@ gst_base_sink_change_state (GstElement * element)
basesink->eos); basesink->eos);
if (!basesink->have_preroll && !basesink->eos) { if (!basesink->have_preroll && !basesink->eos) {
basesink->need_preroll = TRUE; basesink->need_preroll = TRUE;
ret = GST_STATE_ASYNC; ret = GST_STATE_CHANGE_ASYNC;
} }
GST_PREROLL_UNLOCK (basesink->sinkpad); GST_PREROLL_UNLOCK (basesink->sinkpad);
break; break;
} }
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
if (bclass->stop) if (bclass->stop)
if (!bclass->stop (basesink)) { if (!bclass->stop (basesink)) {
GST_WARNING ("failed to stop"); GST_WARNING ("failed to stop");
@ -1381,11 +1381,11 @@ gst_base_sink_change_state (GstElement * element)
start_failed: start_failed:
{ {
GST_DEBUG ("failed to start"); GST_DEBUG ("failed to start");
return GST_STATE_FAILURE; return GST_STATE_CHANGE_FAILURE;
} }
activate_failed: activate_failed:
{ {
GST_DEBUG ("element failed to change states -- activation problem?"); GST_DEBUG ("element failed to change states -- activation problem?");
return GST_STATE_FAILURE; return GST_STATE_CHANGE_FAILURE;
} }
} }

View file

@ -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_start (GstBaseSrc * basesrc);
static gboolean gst_base_src_stop (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 void gst_base_src_loop (GstPad * pad);
static gboolean gst_base_src_check_get_range (GstPad * pad); static gboolean gst_base_src_check_get_range (GstPad * pad);
@ -1041,30 +1042,28 @@ error_stop:
} }
} }
static GstElementStateReturn static GstStateChangeReturn
gst_base_src_change_state (GstElement * element) gst_base_src_change_state (GstElement * element, GstStateChange transition)
{ {
GstBaseSrc *basesrc; GstBaseSrc *basesrc;
GstElementStateReturn result = GST_STATE_SUCCESS; GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS;
GstElementStateReturn presult; GstStateChangeReturn presult;
GstElementState transition;
basesrc = GST_BASE_SRC (element); basesrc = GST_BASE_SRC (element);
transition = GST_STATE_TRANSITION (element);
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_LIVE_LOCK (element); GST_LIVE_LOCK (element);
if (basesrc->is_live) { if (basesrc->is_live) {
result = GST_STATE_NO_PREROLL; result = GST_STATE_CHANGE_NO_PREROLL;
basesrc->live_running = FALSE; basesrc->live_running = FALSE;
} }
GST_LIVE_UNLOCK (element); GST_LIVE_UNLOCK (element);
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
GST_LIVE_LOCK (element); GST_LIVE_LOCK (element);
if (basesrc->is_live) { if (basesrc->is_live) {
basesrc->live_running = TRUE; basesrc->live_running = TRUE;
@ -1076,26 +1075,27 @@ gst_base_src_change_state (GstElement * element)
break; break;
} }
if ((presult = GST_ELEMENT_CLASS (parent_class)->change_state (element)) != if ((presult =
GST_STATE_SUCCESS) { GST_ELEMENT_CLASS (parent_class)->change_state (element,
transition)) != GST_STATE_CHANGE_SUCCESS) {
gst_base_src_stop (basesrc); gst_base_src_stop (basesrc);
return presult; return presult;
} }
switch (transition) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
GST_LIVE_LOCK (element); GST_LIVE_LOCK (element);
if (basesrc->is_live) { if (basesrc->is_live) {
result = GST_STATE_NO_PREROLL; result = GST_STATE_CHANGE_NO_PREROLL;
basesrc->live_running = FALSE; basesrc->live_running = FALSE;
} }
GST_LIVE_UNLOCK (element); GST_LIVE_UNLOCK (element);
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
if (!gst_base_src_stop (basesrc)) if (!gst_base_src_stop (basesrc))
result = GST_STATE_FAILURE; result = GST_STATE_CHANGE_FAILURE;
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
default: default:
break; break;

View file

@ -113,8 +113,8 @@ static gboolean gst_base_transform_sink_activate_push (GstPad * pad,
static gboolean gst_base_transform_get_unit_size (GstBaseTransform * trans, static gboolean gst_base_transform_get_unit_size (GstBaseTransform * trans,
GstCaps * caps, guint * size); GstCaps * caps, guint * size);
static GstElementStateReturn gst_base_transform_change_state (GstElement * static GstStateChangeReturn gst_base_transform_change_state (GstElement *
element); element, GstStateChange transition);
static gboolean gst_base_transform_event (GstPad * pad, GstEvent * event); static gboolean gst_base_transform_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_base_transform_getrange (GstPad * pad, guint64 offset, 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; return result;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_base_transform_change_state (GstElement * element) gst_base_transform_change_state (GstElement * element,
GstStateChange transition)
{ {
GstBaseTransform *trans; GstBaseTransform *trans;
GstBaseTransformClass *bclass; GstBaseTransformClass *bclass;
GstElementState transition; GstStateChangeReturn result;
GstElementStateReturn result;
trans = GST_BASE_TRANSFORM (element); trans = GST_BASE_TRANSFORM (element);
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans); bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
transition = GST_STATE_TRANSITION (element);
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_LOCK (trans); GST_LOCK (trans);
if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad)) if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad))
trans->in_place = gst_caps_is_equal (GST_PAD_CAPS (trans->sinkpad), 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; trans->negotiated = FALSE;
GST_UNLOCK (trans); GST_UNLOCK (trans);
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
default: default:
break; break;
} }
result = GST_ELEMENT_CLASS (parent_class)->change_state (element); result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
if (bclass->stop) if (bclass->stop)
result = bclass->stop (trans); result = bclass->stop (trans);
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
default: default:
break; break;

View file

@ -140,7 +140,7 @@ gst_check_teardown_element (GstElement * element)
GST_DEBUG ("teardown_element"); GST_DEBUG ("teardown_element");
fail_unless (gst_element_set_state (element, GST_STATE_NULL) == 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); ASSERT_OBJECT_REFCOUNT (element, "element", 1);
gst_object_unref (element); gst_object_unref (element);
} }

View file

@ -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, static void gst_fake_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); 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, static GstFlowReturn gst_fake_sink_preroll (GstBaseSink * bsink,
GstBuffer * buffer); GstBuffer * buffer);
@ -382,35 +383,34 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
return GST_FLOW_OK; return GST_FLOW_OK;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_fake_sink_change_state (GstElement * element) 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); GstFakeSink *fakesink = GST_FAKE_SINK (element);
GstElementState transition = GST_STATE_TRANSITION (element);
switch (transition) { 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) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_NULL_READY)
goto error; goto error;
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_PAUSED) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_PAUSED)
goto error; goto error;
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_PLAYING) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_PLAYING)
goto error; goto error;
break; break;
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PLAYING_PAUSED) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PLAYING_PAUSED)
goto error; goto error;
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_READY) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_READY)
goto error; goto error;
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL) if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL)
goto error; goto error;
g_free (fakesink->last_message); g_free (fakesink->last_message);
@ -420,11 +420,11 @@ gst_fake_sink_change_state (GstElement * element)
break; break;
} }
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return ret; return ret;
error: error:
GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL)); GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL));
return GST_STATE_FAILURE; return GST_STATE_CHANGE_FAILURE;
} }

View file

@ -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, static void gst_fdsrc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); 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); static GstFlowReturn gst_fdsrc_create (GstPushSrc * psrc, GstBuffer ** outbuf);
@ -147,29 +148,29 @@ gst_fdsrc_init (GstFdSrc * fdsrc)
fdsrc->seq = 0; fdsrc->seq = 0;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_fdsrc_change_state (GstElement * element) gst_fdsrc_change_state (GstElement * element, GstStateChange transition)
{ {
GstFdSrc *src = GST_FDSRC (element); GstFdSrc *src = GST_FDSRC (element);
switch (GST_STATE_TRANSITION (element)) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
src->curoffset = 0; src->curoffset = 0;
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
default: default:
break; break;
} }
if (GST_ELEMENT_CLASS (parent_class)->change_state) 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;
} }

View file

@ -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, static void gst_file_sink_uri_handler_init (gpointer g_iface,
gpointer iface_data); 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 }; //static guint gst_file_sink_signals[LAST_SIGNAL] = { 0 };
@ -401,36 +402,33 @@ handle_error:
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_file_sink_change_state (GstElement * element) gst_file_sink_change_state (GstElement * element, GstStateChange transition)
{ {
GstElementStateReturn ret; GstStateChangeReturn ret;
gint transition;
transition = GST_STATE_TRANSITION (element);
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
if (!gst_file_sink_open_file (GST_FILE_SINK (element))) if (!gst_file_sink_open_file (GST_FILE_SINK (element)))
goto open_error; goto open_error;
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
default: default:
break; break;
} }
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_file_sink_close_file (GST_FILE_SINK (element)); gst_file_sink_close_file (GST_FILE_SINK (element));
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
default: default:
break; break;
@ -440,7 +438,7 @@ gst_file_sink_change_state (GstElement * element)
open_error: open_error:
{ {
return GST_STATE_FAILURE; return GST_STATE_CHANGE_FAILURE;
} }
} }

View file

@ -259,7 +259,7 @@ gst_file_src_set_location (GstFileSrc * src, const gchar * location)
/* the element must be stopped in order to do this */ /* the element must be stopped in order to do this */
GST_STATE_LOCK (src); GST_STATE_LOCK (src);
{ {
GstElementState state; GstState state;
state = GST_STATE (src); state = GST_STATE (src);
if (state != GST_STATE_READY && state != GST_STATE_NULL) if (state != GST_STATE_READY && state != GST_STATE_NULL)

View file

@ -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_src_activate_push (GstPad * pad, gboolean active);
static gboolean gst_queue_sink_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 ()) #define GST_TYPE_QUEUE_LEAKY (queue_leaky_get_type ())
@ -989,35 +990,35 @@ gst_queue_src_activate_push (GstPad * pad, gboolean active)
return result; return result;
} }
static GstElementStateReturn static GstStateChangeReturn
gst_queue_change_state (GstElement * element) gst_queue_change_state (GstElement * element, GstStateChange transition)
{ {
GstQueue *queue; GstQueue *queue;
GstElementStateReturn ret = GST_STATE_SUCCESS; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
queue = GST_QUEUE (element); queue = GST_QUEUE (element);
GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "starting state change"); GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "starting state change");
switch (GST_STATE_TRANSITION (element)) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
default: default:
break; 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)) { switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
default: default:
break; break;

View file

@ -131,8 +131,9 @@ static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad,
guint64 offset, guint length, GstBuffer ** buffer); guint64 offset, guint length, GstBuffer ** buffer);
static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad); static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad);
static GstElementStateReturn static GstStateChangeReturn
gst_type_find_element_change_state (GstElement * element); 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 (GstPad * pad);
static gboolean static gboolean
gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active); gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active);
@ -406,7 +407,7 @@ start_typefinding (GstTypeFindElement * typefind)
static void static void
stop_typefinding (GstTypeFindElement * typefind) stop_typefinding (GstTypeFindElement * typefind)
{ {
GstElementState state; GstState state;
gboolean push_cached_buffers; gboolean push_cached_buffers;
gst_element_get_state (GST_ELEMENT (typefind), &state, NULL, NULL); gst_element_get_state (GST_ELEMENT (typefind), &state, NULL, NULL);
@ -837,21 +838,20 @@ gst_type_find_element_activate (GstPad * pad)
} }
} }
static GstElementStateReturn static GstStateChangeReturn
gst_type_find_element_change_state (GstElement * element) gst_type_find_element_change_state (GstElement * element,
GstStateChange transition)
{ {
GstElementState transition; GstStateChangeReturn ret;
GstElementStateReturn ret;
GstTypeFindElement *typefind; GstTypeFindElement *typefind;
typefind = GST_TYPE_FIND_ELEMENT (element); 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) { switch (transition) {
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_caps_replace (&typefind->caps, NULL); gst_caps_replace (&typefind->caps, NULL);
break; break;
default: default:

66
scripts/update-states Executable file
View file

@ -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

View file

@ -110,7 +110,8 @@ main (gint argc, gchar * argv[])
GST_TIME_ARGS (end - start), i); GST_TIME_ARGS (end - start), i);
start = gst_get_current_time (); 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 (); g_assert_not_reached ();
end = gst_get_current_time (); end = gst_get_current_time ();
g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n",

View file

@ -88,7 +88,8 @@ main (gint argc, gchar * argv[])
GST_TIME_ARGS (end - start), identities); GST_TIME_ARGS (end - start), identities);
start = gst_get_current_time (); 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 (); g_assert_not_reached ();
end = gst_get_current_time (); end = gst_get_current_time ();
g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n",

View file

@ -77,7 +77,8 @@ GST_START_TEST (test_num_buffers)
src = setup_fakesrc (); src = setup_fakesrc ();
g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); g_object_set (G_OBJECT (src), "num-buffers", 3, NULL);
fail_unless (gst_element_set_state (src, 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) { while (!have_eos) {
g_usleep (1000); g_usleep (1000);
@ -104,7 +105,8 @@ GST_START_TEST (test_sizetype_empty)
g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); g_object_set (G_OBJECT (src), "num-buffers", 100, NULL);
fail_unless (gst_element_set_state (src, 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) { while (!have_eos) {
g_usleep (1000); g_usleep (1000);
@ -139,7 +141,8 @@ GST_START_TEST (test_sizetype_fixed)
g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); g_object_set (G_OBJECT (src), "num-buffers", 100, NULL);
fail_unless (gst_element_set_state (src, 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) { while (!have_eos) {
g_usleep (1000); g_usleep (1000);
@ -175,7 +178,8 @@ GST_START_TEST (test_sizetype_random)
g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); g_object_set (G_OBJECT (src), "num-buffers", 100, NULL);
fail_unless (gst_element_set_state (src, 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) { while (!have_eos) {
g_usleep (1000); g_usleep (1000);

View file

@ -93,7 +93,8 @@ GST_START_TEST (test_one_buffer)
identity = setup_identity (); identity = setup_identity ();
fail_unless (gst_element_set_state (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); buffer = gst_buffer_new_and_alloc (4);
ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);

View file

@ -26,30 +26,30 @@
GST_START_TEST (test_sink) GST_START_TEST (test_sink)
{ {
GstElement *sink; GstElement *sink;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState current, pending; GstState current, pending;
GTimeVal tv; GTimeVal tv;
sink = gst_element_factory_make ("fakesink", "sink"); sink = gst_element_factory_make ("fakesink", "sink");
ret = gst_element_set_state (sink, GST_STATE_PAUSED); 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); 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); GST_TIME_TO_TIMEVAL ((GstClockTime) 0, tv);
ret = gst_element_get_state (sink, &current, &pending, &tv); ret = gst_element_get_state (sink, &current, &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 (current == GST_STATE_PAUSED, "bad current state");
fail_unless (pending == GST_STATE_PLAYING, "bad pending state"); fail_unless (pending == GST_STATE_PLAYING, "bad pending state");
ret = gst_element_set_state (sink, GST_STATE_PAUSED); 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); 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); gst_object_unref (sink);
} }
@ -60,8 +60,8 @@ GST_END_TEST
GST_START_TEST (test_src_sink) GST_START_TEST (test_src_sink)
{ {
GstElement *sink, *src, *pipeline; GstElement *sink, *src, *pipeline;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState current, pending; GstState current, pending;
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
pipeline = gst_pipeline_new ("pipeline"); 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_set_state (pipeline, GST_STATE_PAUSED);
ret = gst_element_get_state (pipeline, NULL, NULL, NULL); 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); 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, &current, &pending, NULL); ret = gst_element_get_state (pipeline, &current, &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 (current == GST_STATE_PLAYING, "not playing");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
} }
@ -97,8 +97,8 @@ GST_END_TEST
GST_START_TEST (test_livesrc_remove) GST_START_TEST (test_livesrc_remove)
{ {
GstElement *sink, *src, *pipeline; GstElement *sink, *src, *pipeline;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState current, pending; GstState current, pending;
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GTimeVal tv; GTimeVal tv;
@ -117,10 +117,11 @@ GST_START_TEST (test_livesrc_remove)
gst_object_unref (sinkpad); gst_object_unref (sinkpad);
ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); 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, &current, &pending, NULL); ret = gst_element_get_state (src, &current, &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 (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); 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); GST_TIME_TO_TIMEVAL (0, tv);
ret = gst_element_get_state (pipeline, &current, &pending, &tv); ret = gst_element_get_state (pipeline, &current, &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 (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
@ -140,8 +141,8 @@ GST_END_TEST
GST_START_TEST (test_livesrc_sink) GST_START_TEST (test_livesrc_sink)
{ {
GstElement *sink, *src, *pipeline; GstElement *sink, *src, *pipeline;
GstElementStateReturn ret; GstStateChangeReturn ret;
GstElementState current, pending; GstState current, pending;
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
pipeline = gst_pipeline_new ("pipeline"); pipeline = gst_pipeline_new ("pipeline");
@ -159,23 +160,24 @@ GST_START_TEST (test_livesrc_sink)
gst_object_unref (sinkpad); gst_object_unref (sinkpad);
ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); 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, &current, &pending, NULL); ret = gst_element_get_state (src, &current, &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 (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
ret = gst_element_get_state (pipeline, &current, &pending, NULL); ret = gst_element_get_state (pipeline, &current, &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 (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
ret = gst_element_set_state (pipeline, GST_STATE_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, &current, &pending, NULL); ret = gst_element_get_state (pipeline, &current, &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 (current == GST_STATE_PLAYING, "not playing");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
} }

View file

@ -160,7 +160,7 @@ GST_START_TEST (test_message_state_changed_child)
* - second for bin, causing an incref on the bin */ * - second for bin, causing an incref on the bin */
GST_DEBUG ("setting bin to READY"); GST_DEBUG ("setting bin to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_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 (src, "src", 2);
ASSERT_OBJECT_REFCOUNT (bin, "bin", 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 */ /* change state to READY, spawning three messages */
GST_DEBUG ("setting pipeline to READY"); GST_DEBUG ("setting pipeline to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_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 */ /* each object is referenced by a message */
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1); 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 */ /* change state to PAUSED, spawning three messages */
GST_DEBUG ("setting pipeline to PAUSED"); GST_DEBUG ("setting pipeline to PAUSED");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_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; /* each object is referenced by a message;
* base_sink_chain has taken a refcount on the sink, and is blocked on * 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 */ /* change state to PLAYING, spawning three messages */
GST_DEBUG ("setting pipeline to PLAYING"); GST_DEBUG ("setting pipeline to PLAYING");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_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 /* each object is referenced by one message
* sink might have an extra reference if it's still blocked on preroll */ * 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 */ /* go back to READY, spawning six messages */
GST_DEBUG ("setting pipeline to READY"); GST_DEBUG ("setting pipeline to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_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 */ /* each object is referenced by two messages */
ASSERT_OBJECT_REFCOUNT (src, "src", 3); 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 */ /* setting pipeline to NULL flushes the bus automatically */
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL) 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 (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 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 */ /* change state, spawning two times three messages, minus one async */
fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED) fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED)
== GST_STATE_ASYNC); == GST_STATE_CHANGE_ASYNC);
pop_messages (bus, 5); pop_messages (bus, 5);
@ -353,7 +353,7 @@ GST_START_TEST (test_watch_for_state_change)
"Unexpected messages on bus"); "Unexpected messages on bus");
fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING) fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING)
== GST_STATE_SUCCESS); == GST_STATE_CHANGE_SUCCESS);
pop_messages (bus, 3); pop_messages (bus, 3);
@ -369,7 +369,7 @@ GST_START_TEST (test_watch_for_state_change)
/* setting bin to NULL flushes the bus automatically */ /* setting bin to NULL flushes the bus automatically */
fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL) fail_unless (gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL)
== GST_STATE_SUCCESS); == GST_STATE_CHANGE_SUCCESS);
/* clean up */ /* clean up */
gst_object_unref (bin); gst_object_unref (bin);

View file

@ -218,9 +218,10 @@ GST_START_TEST (test_ghost_pads)
assert_gstrefcount (isrc, 3); /* parent and gsrc */ assert_gstrefcount (isrc, 3); /* parent and gsrc */
fail_unless (gst_element_set_state (b1, 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); gst_object_unref (b1);
/* unreffing the bin will unref all elements, which will unlink and unparent /* unreffing the bin will unref all elements, which will unlink and unparent

View file

@ -120,7 +120,7 @@ GST_START_TEST (test_parsing)
} }
/* GST_MESSAGE_STATE_CHANGED */ /* GST_MESSAGE_STATE_CHANGED */
{ {
GstElementState oldstate, newstate; GstState oldstate, newstate;
oldstate = GST_STATE_PAUSED; oldstate = GST_STATE_PAUSED;
newstate = GST_STATE_PLAYING; 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_tag (GstMessage *message, GstTagList **tag_list);
void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state, void gst_message_parse_state_changed (GstMessage *message, GstState *old_state,
GstElementState *new_state); GstState *new_state);
void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug); 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_warning (GstMessage *message, GError **gerror, gchar **debug);
*/ */

View file

@ -45,7 +45,8 @@ run_pipeline (GstElement * pipe, gchar * descr,
bus = gst_element_get_bus (pipe); bus = gst_element_get_bus (pipe);
g_assert (bus); 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"); g_critical ("Couldn't set pipeline to PLAYING");
goto done; goto done;
} }

View file

@ -110,7 +110,8 @@ main (gint argc, gchar * argv[])
GST_TIME_ARGS (end - start), i); GST_TIME_ARGS (end - start), i);
start = gst_get_current_time (); 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 (); g_assert_not_reached ();
end = gst_get_current_time (); end = gst_get_current_time ();
g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n",

View file

@ -88,7 +88,8 @@ main (gint argc, gchar * argv[])
GST_TIME_ARGS (end - start), identities); GST_TIME_ARGS (end - start), identities);
start = gst_get_current_time (); 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 (); g_assert_not_reached ();
end = gst_get_current_time (); end = gst_get_current_time ();
g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n", g_print ("%" GST_TIME_FORMAT " - setting pipeline to playing\n",

View file

@ -182,8 +182,8 @@ main (int argc, char *argv[])
make_pipeline (); make_pipeline ();
while (i < argc) { while (i < argc) {
GstElementStateReturn sret; GstStateChangeReturn sret;
GstElementState state; GstState state;
filename = argv[i]; filename = argv[i];
g_object_set (source, "location", filename, NULL); g_object_set (source, "location", filename, NULL);
@ -194,13 +194,13 @@ main (int argc, char *argv[])
* otherwise the state change fails */ * otherwise the state change fails */
sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
if (GST_STATE_ASYNC == sret) { if (GST_STATE_CHANGE_ASYNC == sret) {
if (GST_STATE_FAILURE == if (GST_STATE_CHANGE_FAILURE ==
gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) { gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) {
g_print ("State change failed. Aborting"); g_print ("State change failed. Aborting");
break; break;
} }
} else if (sret != GST_STATE_SUCCESS) { } else if (sret != GST_STATE_CHANGE_SUCCESS) {
g_print ("%s - Could not read file\n", argv[i]); g_print ("%s - Could not read file\n", argv[i]);
} else { } else {
GstTagList *tags = NULL; GstTagList *tags = NULL;
@ -226,8 +226,8 @@ main (int argc, char *argv[])
g_print ("No metadata found for %s\n", argv[i]); g_print ("No metadata found for %s\n", argv[i]);
sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
if (GST_STATE_ASYNC == sret) { if (GST_STATE_CHANGE_ASYNC == sret) {
if (GST_STATE_FAILURE == if (GST_STATE_CHANGE_FAILURE ==
gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL)) gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL))
{ {
g_print ("State change failed. Aborting"); g_print ("State change failed. Aborting");

View file

@ -86,7 +86,8 @@ static void gst_example_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_example_get_property (GObject * object, guint prop_id, static void gst_example_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); 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 /* The parent class pointer needs to be kept around for some object
* operations. * 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 * The plugin can prepare itself and its internal data structures
* in the various state transitions. * in the various state transitions.
*/ */
static GstElementStateReturn static GstStateChangeReturn
gst_example_change_state (GstElement * element) gst_example_change_state (GstElement * element, GstStateChange transition)
{ {
GstExample *example; GstExample *example;
@ -348,33 +349,33 @@ gst_example_change_state (GstElement * element)
/* we perform our actions based on the state transition /* we perform our actions based on the state transition
* of the element */ * of the element */
switch (GST_STATE_TRANSITION (element)) { switch (transition) {
/* The NULL to READY transition is used to /* The NULL to READY transition is used to
* create threads (if any), and/or open devices */ * create threads (if any), and/or open devices */
case GST_STATE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
break; break;
/* In the PAUSED to PLAYING state, the element should /* In the PAUSED to PLAYING state, the element should
* prepare itself for operation or continue after a PAUSE */ * prepare itself for operation or continue after a PAUSE */
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
/* In the PLAYING to PAUSED state, the element should /* In the PLAYING to PAUSED state, the element should
* PAUSE itself and make sure it can resume operation */ * PAUSE itself and make sure it can resume operation */
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
/* In the PAUSED to READY state, the element should reset /* In the PAUSED to READY state, the element should reset
* its internal state and close any devices. */ * its internal state and close any devices. */
case GST_STATE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
break; break;
/* The element should free all resources, terminate threads /* The element should free all resources, terminate threads
* and put itself into its initial state again */ * and put itself into its initial state again */
case GST_STATE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;
} }
/* Then we call the parent state change handler */ /* Then we call the parent state change handler */
return parent_class->change_state (element); return parent_class->change_state (element, transition);
} }

View file

@ -270,7 +270,8 @@ main (gint argc, gchar ** argv)
g_assert (size >= MIN_SIZE); g_assert (size >= MIN_SIZE);
g_assert (size <= MAX_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 (); g_assert_not_reached ();
while (gst_bin_iterate (GST_BIN (pipeline))); while (gst_bin_iterate (GST_BIN (pipeline)));

View file

@ -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, static void gst_bstest_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); 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 void gst_bstest_loop (GstElement * element);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
@ -373,12 +374,12 @@ gst_bstest_get_property (GObject * object, guint prop_id, GValue * value,
} }
} }
static GstElementStateReturn static GstStateChangeReturn
gst_bstest_change_state (GstElement * element) gst_bstest_change_state (GstElement * element, GstStateChange transition)
{ {
GstBsTest *bstest; 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); bstest = GST_BSTEST (element);
@ -394,9 +395,9 @@ gst_bstest_change_state (GstElement * element)
} }
if (GST_ELEMENT_CLASS (parent_class)->change_state) 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 static gboolean

View file

@ -68,7 +68,7 @@ static gchar *s;
alarm(10); \ alarm(10); \
g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
if (gst_element_set_state (cur, GST_STATE_PLAYING) \ if (gst_element_set_state (cur, GST_STATE_PLAYING) \
== GST_STATE_FAILURE) { \ == GST_STATE_CHANGE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \ g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be set to PLAYING\n", test, __LINE__); \ "pipeline could not be set to PLAYING\n", test, __LINE__); \
return -test; \ return -test; \
@ -76,7 +76,7 @@ static gchar *s;
iterations = 0; \ iterations = 0; \
while (gst_bin_iterate (GST_BIN (cur))) iterations++; \ while (gst_bin_iterate (GST_BIN (cur))) iterations++; \
if (gst_element_set_state (cur, GST_STATE_NULL) \ if (gst_element_set_state (cur, GST_STATE_NULL) \
== GST_STATE_FAILURE) { \ == GST_STATE_CHANGE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \ g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be reset to state NULL\n", test, __LINE__); \ "pipeline could not be reset to state NULL\n", test, __LINE__); \
return -test; \ return -test; \

View file

@ -92,7 +92,7 @@ static char *video_file = NULL;
#define TEST_RUN(iters) G_STMT_START{ \ #define TEST_RUN(iters) G_STMT_START{ \
gint it = iters; \ gint it = iters; \
g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ 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__); \ g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \
return -test; \ return -test; \
} \ } \
@ -101,7 +101,7 @@ static char *video_file = NULL;
iterations++; \ iterations++; \
it--; \ 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__); \ g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \
return -test; \ return -test; \
} \ } \

View file

@ -56,7 +56,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (src, "src", id, "sink"); gst_element_link_pads (src, "src", id, "sink");
gst_element_link_pads (id, "src", sink, "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 (); g_assert_not_reached ();
gst_bin_iterate (GST_BIN (pipeline)); gst_bin_iterate (GST_BIN (pipeline));

View file

@ -66,7 +66,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (src, "src", id, "sink"); gst_element_link_pads (src, "src", id, "sink");
gst_element_link_pads (id, "src", sink, "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 (); g_assert_not_reached ();
gst_bin_iterate (GST_BIN (pipeline)); gst_bin_iterate (GST_BIN (pipeline));

View file

@ -24,7 +24,8 @@ main (int argc, char **argv)
gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL); gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL);
if (!gst_element_link_many (src, tee, enc, sink, NULL)) if (!gst_element_link_many (src, tee, enc, sink, NULL))
g_assert_not_reached (); 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 (); g_assert_not_reached ();
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
@ -33,7 +34,8 @@ main (int argc, char **argv)
g_print ("%d\n", i); 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 (); g_assert_not_reached ();
gst_element_unlink_many (tee, enc, sink, NULL); gst_element_unlink_many (tee, enc, sink, NULL);
gst_bin_remove_many (GST_BIN (pipeline), 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); gst_bin_add_many (GST_BIN (pipeline), enc, sink, NULL);
if (!gst_element_link_many (tee, enc, sink, NULL)) if (!gst_element_link_many (tee, enc, sink, NULL))
g_assert_not_reached (); 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 (); g_assert_not_reached ();
for (i = 5; i < 10; i++) { for (i = 5; i < 10; i++) {

View file

@ -51,12 +51,13 @@ main (gint argc, gchar ** argv)
while (i < 100) { while (i < 100) {
g_print ("running... (%d iterations)\n", i); g_print ("running... (%d iterations)\n", i);
if (gst_element_set_state (pipeline, if (gst_element_set_state (pipeline,
GST_STATE_PLAYING) != GST_STATE_SUCCESS) GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
g_assert_not_reached (); g_assert_not_reached ();
gst_element_link_many (src, id, sink, NULL); gst_element_link_many (src, id, sink, NULL);
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
gst_bin_iterate (GST_BIN (pipeline)); 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 (); g_assert_not_reached ();
gst_element_unlink_many (src, id, sink, NULL); gst_element_unlink_many (src, id, sink, NULL);
i++; i++;

View file

@ -64,12 +64,15 @@ main (gint argc, gchar ** argv)
gst_bin_add_many (GST_BIN (pipeline), src, id1, NULL); gst_bin_add_many (GST_BIN (pipeline), src, id1, NULL);
gst_element_link_pads (src, "src", id1, "sink"); 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 (); 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 (); 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 (); g_assert_not_reached ();
gst_bin_add_many (GST_BIN (pipeline), sink, NULL); gst_bin_add_many (GST_BIN (pipeline), sink, NULL);

View file

@ -71,7 +71,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (id1, "src", id2, "sink"); gst_element_link_pads (id1, "src", id2, "sink");
gst_element_link_pads (id2, "src", sink, "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_assert_not_reached ();
g_print ("running...\n"); g_print ("running...\n");

View file

@ -96,10 +96,12 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (queue, "src", id, "sink"); gst_element_link_pads (queue, "src", id, "sink");
gst_element_link_pads (id, "src", sink, "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 (); 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_assert_not_reached ();
g_print ("running...\n"); g_print ("running...\n");

View file

@ -96,10 +96,12 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (queue, "src", id, "sink"); gst_element_link_pads (queue, "src", id, "sink");
gst_element_link_pads (id, "src", sink, "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 (); 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_assert_not_reached ();
g_print ("running...\n"); g_print ("running...\n");
@ -110,7 +112,8 @@ main (gint argc, gchar ** argv)
} }
g_assert (!bug); 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_assert_not_reached ();
g_print ("relinking...\n"); g_print ("relinking...\n");
@ -118,7 +121,8 @@ main (gint argc, gchar ** argv)
gst_element_unlink_pads (id, "src", sink, "sink"); gst_element_unlink_pads (id, "src", sink, "sink");
gst_element_link_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_assert_not_reached ();
g_print ("running again...\n"); g_print ("running again...\n");

View file

@ -50,7 +50,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (src, "src", id1, "sink"); gst_element_link_pads (src, "src", id1, "sink");
gst_element_link_pads (id2, "src", sink, "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_assert_not_reached ();
g_print ("running...\n"); g_print ("running...\n");

View file

@ -53,7 +53,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (queue, "src", id1, "sink"); gst_element_link_pads (queue, "src", id1, "sink");
gst_element_link_pads (id1, "src", sink, "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_assert_not_reached ();
g_print ("unlinking...\n"); g_print ("unlinking...\n");

View file

@ -60,7 +60,8 @@ main (gint argc, gchar ** argv)
/* run pipeline */ /* run pipeline */
g_print ("running...\n"); 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 (); g_assert_not_reached ();
while (i++ < 10 && gst_bin_iterate (GST_BIN (pipeline))); while (i++ < 10 && gst_bin_iterate (GST_BIN (pipeline)));

View file

@ -51,7 +51,8 @@ main (gint argc, gchar ** argv)
/* run pipeline */ /* run pipeline */
g_print ("running...\n"); 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 (); g_assert_not_reached ();
while (gst_bin_iterate (GST_BIN (pipeline))); while (gst_bin_iterate (GST_BIN (pipeline)));

View file

@ -52,7 +52,8 @@ main (gint argc, gchar ** argv)
/* run pipeline */ /* run pipeline */
g_print ("running...\n"); 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 (); g_assert_not_reached ();
while (pipeline && gst_bin_iterate (GST_BIN (pipeline))); while (pipeline && gst_bin_iterate (GST_BIN (pipeline)));

View file

@ -35,7 +35,8 @@ main (gint argc, gchar ** argv)
/* run pipeline */ /* run pipeline */
g_print ("running...\n"); 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 (); g_assert_not_reached ();
while (i < 100 && gst_bin_iterate (GST_BIN (pipeline))) while (i < 100 && gst_bin_iterate (GST_BIN (pipeline)))
i++; i++;

View file

@ -21,10 +21,10 @@
#include <gst/gst.h> #include <gst/gst.h>
#define RETURN_NAME(x) ((x) == GST_STATE_SUCCESS ? "GST_STATE_SUCCESS" : \ #define RETURN_NAME(x) ((x) == GST_STATE_CHANGE_SUCCESS ? "GST_STATE_CHANGE_SUCCESS" : \
(x) == GST_STATE_ASYNC ? "GST_STATE_ASYNC" : "GST_STATE_FAILURE") (x) == GST_STATE_CHANGE_ASYNC ? "GST_STATE_CHANGE_ASYNC" : "GST_STATE_CHANGE_FAILURE")
static void static void
assert_state (GstElement * element, GstElementState state) assert_state (GstElement * element, GstState state)
{ {
if (gst_element_get_state (element) != state) { if (gst_element_get_state (element) != state) {
g_printerr ("%s: state is %s instead of %s", g_printerr ("%s: state is %s instead of %s",
@ -36,10 +36,10 @@ assert_state (GstElement * element, GstElementState state)
} }
static void static void
assert_state_change (GstElement * element, GstElementState new_state, assert_state_change (GstElement * element, GstState new_state,
GstElementStateReturn result, GstElementState result_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) { if (ret != result) {
g_printerr ("%s: change state to %s returned %s instead of %s", 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 /* Test the behaviour of empty bins. Since a bin's state is always the state
* of its highest child, nothing should change in here * of its highest child, nothing should change in here
* Return values when no error occured but the state didn't change should be * 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); GstElement *bin = gst_element_factory_make (bin_name, NULL);
/* obvious */ /* obvious */
assert_state (bin, GST_STATE_NULL); assert_state (bin, GST_STATE_NULL);
/* see above */ /* see above */
assert_state_change (bin, GST_STATE_READY, GST_STATE_ASYNC, GST_STATE_NULL); assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_ASYNC,
assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_ASYNC, GST_STATE_NULL); GST_STATE_NULL);
assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_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 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 /* 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. */ * 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 GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY, GST_STATE_NULL
}; };
GstElement *test = gst_element_factory_make ("identity", 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; gint i;
g_assert (test); g_assert (test);
@ -85,9 +88,10 @@ test_adding_one_element (GstElement * bin)
gst_bin_add (GST_BIN (bin), test); gst_bin_add (GST_BIN (bin), test);
assert_state (bin, MAX (bin_state, GST_STATE_NULL)); assert_state (bin, MAX (bin_state, GST_STATE_NULL));
for (i = 0; i < G_N_ELEMENTS (test_states); i++) { 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 (test, test_state);
assert_state (bin, MAX (bin_state, test_state)); assert_state (bin, MAX (bin_state, test_state));
gst_bin_remove (GST_BIN (bin), test); gst_bin_remove (GST_BIN (bin), test);
@ -105,7 +109,7 @@ static void
test_element_in_bin (gchar * bin_name) test_element_in_bin (gchar * bin_name)
{ {
gint i; 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 GST_STATE_PAUSED, GST_STATE_PLAYING
}; };
GstElement *id, *bin = gst_element_factory_make (bin_name, NULL); 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); gst_bin_add (GST_BIN (bin), id);
/* test correct behaviour in bins which contain elements in various states */ /* test correct behaviour in bins which contain elements in various states */
for (i = 0; i < G_N_ELEMENTS (test_states); i++) { 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); assert_state (id, test_state);
test_adding_one_element (bin); test_adding_one_element (bin);
} }

View file

@ -85,7 +85,8 @@ main (int argc, char **argv)
g_assert_not_reached (); g_assert_not_reached ();
/* run a bit */ /* 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 (); g_assert_not_reached ();
sleep (10000); sleep (10000);

View file

@ -31,7 +31,7 @@ construct_pipeline (GstElement * pipeline)
void void
state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) 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", g_print ("element %s has changed state to %s\n",
GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); GST_ELEMENT_NAME (el), gst_element_state_get_name (state));

View file

@ -38,7 +38,7 @@ construct_pipeline (GstElement * pipeline, gint identities)
void void
state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) 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", g_print ("element %s has changed state to %s\n",
GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); 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); construct_pipeline (thread, i / 10 + 1);
g_print ("Setting thread to play with %d identities\n", 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"); g_error ("Failed setting thread to play\n");
} else { } else {
g_print ("Going into the main GStreamer loop\n"); g_print ("Going into the main GStreamer loop\n");

View file

@ -42,7 +42,7 @@ construct_pipeline (GstElement * pipeline, gint identities)
void void
state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) 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", g_print ("element %s has changed state to %s\n",
GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); 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", g_print ("Setting thread to play with %d identities\n",
i / RUNS_PER_IDENTITY + 1); i / RUNS_PER_IDENTITY + 1);
done = FALSE; 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"); g_warning ("failed to go to PLAYING");
} else { } else {
g_print ("Waiting for thread PLAYING->PAUSED\n"); g_print ("Waiting for thread PLAYING->PAUSED\n");

View file

@ -36,7 +36,8 @@ main (int argc, char **argv)
g_assert_not_reached (); 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 (); g_assert_not_reached ();
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
@ -45,17 +46,20 @@ main (int argc, char **argv)
g_print ("%d\n", i); 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 (); g_assert_not_reached ();
gst_bin_remove_many (GST_BIN (thread), queue, sink, NULL); 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 (); g_assert_not_reached ();
gst_bin_remove (GST_BIN (pipeline), thread); 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 (); g_assert_not_reached ();

View file

@ -9,10 +9,11 @@ handoff_src (GstElement * element)
{ {
g_print ("identity handoff\n"); 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 (); 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 (); g_assert_not_reached ();
gst_bin_remove (GST_BIN (thread), src); gst_bin_remove (GST_BIN (thread), src);
@ -42,7 +43,8 @@ main (int argc, char **argv)
g_assert_not_reached (); g_assert_not_reached ();
/* run a bit */ /* 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 (); g_assert_not_reached ();
sleep (2); sleep (2);

View file

@ -63,8 +63,8 @@ cb_data (gpointer data)
#endif #endif
static void static void
cb_state (GstElement * element, GstElementState old_state, cb_state (GstElement * element, GstState old_state,
GstElementState new_state, gpointer data) GstState new_state, gpointer data)
{ {
g_print ("Changed state from %d to %d\n", old_state, new_state); 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 static gboolean
cb_play (gpointer data) cb_play (gpointer data)
{ {
GstElementStateReturn res; GstStateChangeReturn res;
#if TESTNUM != 999999 #if TESTNUM != 999999
g_print ("Setting state on fakesrc\n"); g_print ("Setting state on fakesrc\n");
@ -87,7 +87,7 @@ cb_play (gpointer data)
#endif #endif
g_print ("Syncing state in pipeline\n"); g_print ("Syncing state in pipeline\n");
res = gst_bin_sync_children_state (GST_BIN (data)); 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)); g_print ("Set to playing correctly: %d\n", GST_STATE (pipeline));
/* once */ /* once */

View file

@ -270,7 +270,8 @@ main (gint argc, gchar ** argv)
g_assert (size >= MIN_SIZE); g_assert (size >= MIN_SIZE);
g_assert (size <= MAX_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 (); g_assert_not_reached ();
while (gst_bin_iterate (GST_BIN (pipeline))); while (gst_bin_iterate (GST_BIN (pipeline)));

View file

@ -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, static void gst_bstest_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); 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 void gst_bstest_loop (GstElement * element);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
@ -373,12 +374,12 @@ gst_bstest_get_property (GObject * object, guint prop_id, GValue * value,
} }
} }
static GstElementStateReturn static GstStateChangeReturn
gst_bstest_change_state (GstElement * element) gst_bstest_change_state (GstElement * element, GstStateChange transition)
{ {
GstBsTest *bstest; 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); bstest = GST_BSTEST (element);
@ -394,9 +395,9 @@ gst_bstest_change_state (GstElement * element)
} }
if (GST_ELEMENT_CLASS (parent_class)->change_state) 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 static gboolean

View file

@ -68,7 +68,7 @@ static gchar *s;
alarm(10); \ alarm(10); \
g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
if (gst_element_set_state (cur, GST_STATE_PLAYING) \ if (gst_element_set_state (cur, GST_STATE_PLAYING) \
== GST_STATE_FAILURE) { \ == GST_STATE_CHANGE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \ g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be set to PLAYING\n", test, __LINE__); \ "pipeline could not be set to PLAYING\n", test, __LINE__); \
return -test; \ return -test; \
@ -76,7 +76,7 @@ static gchar *s;
iterations = 0; \ iterations = 0; \
while (gst_bin_iterate (GST_BIN (cur))) iterations++; \ while (gst_bin_iterate (GST_BIN (cur))) iterations++; \
if (gst_element_set_state (cur, GST_STATE_NULL) \ if (gst_element_set_state (cur, GST_STATE_NULL) \
== GST_STATE_FAILURE) { \ == GST_STATE_CHANGE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \ g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be reset to state NULL\n", test, __LINE__); \ "pipeline could not be reset to state NULL\n", test, __LINE__); \
return -test; \ return -test; \

View file

@ -92,7 +92,7 @@ static char *video_file = NULL;
#define TEST_RUN(iters) G_STMT_START{ \ #define TEST_RUN(iters) G_STMT_START{ \
gint it = iters; \ gint it = iters; \
g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ 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__); \ g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \
return -test; \ return -test; \
} \ } \
@ -101,7 +101,7 @@ static char *video_file = NULL;
iterations++; \ iterations++; \
it--; \ 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__); \ g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \
return -test; \ return -test; \
} \ } \

View file

@ -56,7 +56,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (src, "src", id, "sink"); gst_element_link_pads (src, "src", id, "sink");
gst_element_link_pads (id, "src", sink, "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 (); g_assert_not_reached ();
gst_bin_iterate (GST_BIN (pipeline)); gst_bin_iterate (GST_BIN (pipeline));

View file

@ -66,7 +66,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (src, "src", id, "sink"); gst_element_link_pads (src, "src", id, "sink");
gst_element_link_pads (id, "src", sink, "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 (); g_assert_not_reached ();
gst_bin_iterate (GST_BIN (pipeline)); gst_bin_iterate (GST_BIN (pipeline));

View file

@ -24,7 +24,8 @@ main (int argc, char **argv)
gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL); gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL);
if (!gst_element_link_many (src, tee, enc, sink, NULL)) if (!gst_element_link_many (src, tee, enc, sink, NULL))
g_assert_not_reached (); 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 (); g_assert_not_reached ();
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
@ -33,7 +34,8 @@ main (int argc, char **argv)
g_print ("%d\n", i); 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 (); g_assert_not_reached ();
gst_element_unlink_many (tee, enc, sink, NULL); gst_element_unlink_many (tee, enc, sink, NULL);
gst_bin_remove_many (GST_BIN (pipeline), 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); gst_bin_add_many (GST_BIN (pipeline), enc, sink, NULL);
if (!gst_element_link_many (tee, enc, sink, NULL)) if (!gst_element_link_many (tee, enc, sink, NULL))
g_assert_not_reached (); 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 (); g_assert_not_reached ();
for (i = 5; i < 10; i++) { for (i = 5; i < 10; i++) {

View file

@ -51,12 +51,13 @@ main (gint argc, gchar ** argv)
while (i < 100) { while (i < 100) {
g_print ("running... (%d iterations)\n", i); g_print ("running... (%d iterations)\n", i);
if (gst_element_set_state (pipeline, if (gst_element_set_state (pipeline,
GST_STATE_PLAYING) != GST_STATE_SUCCESS) GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
g_assert_not_reached (); g_assert_not_reached ();
gst_element_link_many (src, id, sink, NULL); gst_element_link_many (src, id, sink, NULL);
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
gst_bin_iterate (GST_BIN (pipeline)); 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 (); g_assert_not_reached ();
gst_element_unlink_many (src, id, sink, NULL); gst_element_unlink_many (src, id, sink, NULL);
i++; i++;

View file

@ -64,12 +64,15 @@ main (gint argc, gchar ** argv)
gst_bin_add_many (GST_BIN (pipeline), src, id1, NULL); gst_bin_add_many (GST_BIN (pipeline), src, id1, NULL);
gst_element_link_pads (src, "src", id1, "sink"); 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 (); 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 (); 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 (); g_assert_not_reached ();
gst_bin_add_many (GST_BIN (pipeline), sink, NULL); gst_bin_add_many (GST_BIN (pipeline), sink, NULL);

View file

@ -71,7 +71,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (id1, "src", id2, "sink"); gst_element_link_pads (id1, "src", id2, "sink");
gst_element_link_pads (id2, "src", sink, "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_assert_not_reached ();
g_print ("running...\n"); g_print ("running...\n");

View file

@ -96,10 +96,12 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (queue, "src", id, "sink"); gst_element_link_pads (queue, "src", id, "sink");
gst_element_link_pads (id, "src", sink, "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 (); 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_assert_not_reached ();
g_print ("running...\n"); g_print ("running...\n");

View file

@ -96,10 +96,12 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (queue, "src", id, "sink"); gst_element_link_pads (queue, "src", id, "sink");
gst_element_link_pads (id, "src", sink, "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 (); 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_assert_not_reached ();
g_print ("running...\n"); g_print ("running...\n");
@ -110,7 +112,8 @@ main (gint argc, gchar ** argv)
} }
g_assert (!bug); 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_assert_not_reached ();
g_print ("relinking...\n"); g_print ("relinking...\n");
@ -118,7 +121,8 @@ main (gint argc, gchar ** argv)
gst_element_unlink_pads (id, "src", sink, "sink"); gst_element_unlink_pads (id, "src", sink, "sink");
gst_element_link_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_assert_not_reached ();
g_print ("running again...\n"); g_print ("running again...\n");

View file

@ -50,7 +50,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (src, "src", id1, "sink"); gst_element_link_pads (src, "src", id1, "sink");
gst_element_link_pads (id2, "src", sink, "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_assert_not_reached ();
g_print ("running...\n"); g_print ("running...\n");

View file

@ -53,7 +53,8 @@ main (gint argc, gchar ** argv)
gst_element_link_pads (queue, "src", id1, "sink"); gst_element_link_pads (queue, "src", id1, "sink");
gst_element_link_pads (id1, "src", sink, "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_assert_not_reached ();
g_print ("unlinking...\n"); g_print ("unlinking...\n");

View file

@ -60,7 +60,8 @@ main (gint argc, gchar ** argv)
/* run pipeline */ /* run pipeline */
g_print ("running...\n"); 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 (); g_assert_not_reached ();
while (i++ < 10 && gst_bin_iterate (GST_BIN (pipeline))); while (i++ < 10 && gst_bin_iterate (GST_BIN (pipeline)));

View file

@ -51,7 +51,8 @@ main (gint argc, gchar ** argv)
/* run pipeline */ /* run pipeline */
g_print ("running...\n"); 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 (); g_assert_not_reached ();
while (gst_bin_iterate (GST_BIN (pipeline))); while (gst_bin_iterate (GST_BIN (pipeline)));

View file

@ -52,7 +52,8 @@ main (gint argc, gchar ** argv)
/* run pipeline */ /* run pipeline */
g_print ("running...\n"); 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 (); g_assert_not_reached ();
while (pipeline && gst_bin_iterate (GST_BIN (pipeline))); while (pipeline && gst_bin_iterate (GST_BIN (pipeline)));

View file

@ -35,7 +35,8 @@ main (gint argc, gchar ** argv)
/* run pipeline */ /* run pipeline */
g_print ("running...\n"); 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 (); g_assert_not_reached ();
while (i < 100 && gst_bin_iterate (GST_BIN (pipeline))) while (i < 100 && gst_bin_iterate (GST_BIN (pipeline)))
i++; i++;

View file

@ -21,10 +21,10 @@
#include <gst/gst.h> #include <gst/gst.h>
#define RETURN_NAME(x) ((x) == GST_STATE_SUCCESS ? "GST_STATE_SUCCESS" : \ #define RETURN_NAME(x) ((x) == GST_STATE_CHANGE_SUCCESS ? "GST_STATE_CHANGE_SUCCESS" : \
(x) == GST_STATE_ASYNC ? "GST_STATE_ASYNC" : "GST_STATE_FAILURE") (x) == GST_STATE_CHANGE_ASYNC ? "GST_STATE_CHANGE_ASYNC" : "GST_STATE_CHANGE_FAILURE")
static void static void
assert_state (GstElement * element, GstElementState state) assert_state (GstElement * element, GstState state)
{ {
if (gst_element_get_state (element) != state) { if (gst_element_get_state (element) != state) {
g_printerr ("%s: state is %s instead of %s", g_printerr ("%s: state is %s instead of %s",
@ -36,10 +36,10 @@ assert_state (GstElement * element, GstElementState state)
} }
static void static void
assert_state_change (GstElement * element, GstElementState new_state, assert_state_change (GstElement * element, GstState new_state,
GstElementStateReturn result, GstElementState result_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) { if (ret != result) {
g_printerr ("%s: change state to %s returned %s instead of %s", 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 /* Test the behaviour of empty bins. Since a bin's state is always the state
* of its highest child, nothing should change in here * of its highest child, nothing should change in here
* Return values when no error occured but the state didn't change should be * 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); GstElement *bin = gst_element_factory_make (bin_name, NULL);
/* obvious */ /* obvious */
assert_state (bin, GST_STATE_NULL); assert_state (bin, GST_STATE_NULL);
/* see above */ /* see above */
assert_state_change (bin, GST_STATE_READY, GST_STATE_ASYNC, GST_STATE_NULL); assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_ASYNC,
assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_ASYNC, GST_STATE_NULL); GST_STATE_NULL);
assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_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 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 /* 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. */ * 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 GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY, GST_STATE_NULL
}; };
GstElement *test = gst_element_factory_make ("identity", 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; gint i;
g_assert (test); g_assert (test);
@ -85,9 +88,10 @@ test_adding_one_element (GstElement * bin)
gst_bin_add (GST_BIN (bin), test); gst_bin_add (GST_BIN (bin), test);
assert_state (bin, MAX (bin_state, GST_STATE_NULL)); assert_state (bin, MAX (bin_state, GST_STATE_NULL));
for (i = 0; i < G_N_ELEMENTS (test_states); i++) { 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 (test, test_state);
assert_state (bin, MAX (bin_state, test_state)); assert_state (bin, MAX (bin_state, test_state));
gst_bin_remove (GST_BIN (bin), test); gst_bin_remove (GST_BIN (bin), test);
@ -105,7 +109,7 @@ static void
test_element_in_bin (gchar * bin_name) test_element_in_bin (gchar * bin_name)
{ {
gint i; 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 GST_STATE_PAUSED, GST_STATE_PLAYING
}; };
GstElement *id, *bin = gst_element_factory_make (bin_name, NULL); 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); gst_bin_add (GST_BIN (bin), id);
/* test correct behaviour in bins which contain elements in various states */ /* test correct behaviour in bins which contain elements in various states */
for (i = 0; i < G_N_ELEMENTS (test_states); i++) { 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); assert_state (id, test_state);
test_adding_one_element (bin); test_adding_one_element (bin);
} }

Some files were not shown because too many files have changed in this diff Show more