Use GstClockTime in _get_state() instead of GTimeVal.

Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstelement.c: (GST_START_TEST):
* check/gst/gstevent.c: (GST_START_TEST), (test_event):
* check/gst/gstghostpad.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST):
* check/pipelines/simple_launch_lines.c: (run_pipeline):
* check/states/sinks.c: (GST_START_TEST):
* gst/elements/gsttypefindelement.c: (stop_typefinding):
* gst/gstbin.c: (gst_bin_provide_clock_func), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_get_state), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_set_state),
(gst_element_change_state), (gst_element_change_state_func):
* gst/gstelement.h:
* gst/gstpipeline.c: (gst_pipeline_class_init), (do_pipeline_seek),
(gst_pipeline_provide_clock_func):
* gst/gstutils.c: (gst_element_link_pads_filtered):
* tools/gst-launch.c: (main):
* tools/gst-typefind.c: (main):
Use GstClockTime in _get_state() instead of GTimeVal.
Remove old code in gstutils.c
This commit is contained in:
Wim Taymans 2005-10-12 12:18:48 +00:00
parent c3cc492c7e
commit 6d0be74351
24 changed files with 153 additions and 268 deletions

View file

@ -1,3 +1,30 @@
2005-10-12 Wim Taymans <wim@fluendo.com>
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstelement.c: (GST_START_TEST):
* check/gst/gstevent.c: (GST_START_TEST), (test_event):
* check/gst/gstghostpad.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST):
* check/pipelines/simple_launch_lines.c: (run_pipeline):
* check/states/sinks.c: (GST_START_TEST):
* gst/elements/gsttypefindelement.c: (stop_typefinding):
* gst/gstbin.c: (gst_bin_provide_clock_func), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_get_state), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_set_state),
(gst_element_change_state), (gst_element_change_state_func):
* gst/gstelement.h:
* gst/gstpipeline.c: (gst_pipeline_class_init), (do_pipeline_seek),
(gst_pipeline_provide_clock_func):
* gst/gstutils.c: (gst_element_link_pads_filtered):
* tools/gst-launch.c: (main):
* tools/gst-typefind.c: (main):
Use GstClockTime in _get_state() instead of GTimeVal.
Remove old code in gstutils.c
2005-10-12 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_pause_task): Actually return FALSE if

View file

@ -264,7 +264,8 @@ GST_START_TEST (test_message_state_changed_children)
ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
fail_unless (ret == GST_STATE_CHANGE_ASYNC);
ret =
gst_element_get_state (GST_ELEMENT (pipeline), &current, &pending, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), &current, &pending,
GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
fail_unless (current == GST_STATE_PAUSED);
fail_unless (pending == GST_STATE_VOID_PENDING);
@ -289,7 +290,8 @@ GST_START_TEST (test_message_state_changed_children)
ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
ret =
gst_element_get_state (GST_ELEMENT (pipeline), &current, &pending, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), &current, &pending,
GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
fail_unless (current == GST_STATE_PLAYING);
fail_unless (pending == GST_STATE_VOID_PENDING);
@ -367,7 +369,9 @@ GST_START_TEST (test_watch_for_state_change)
/* change state, spawning two times three messages */
ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED);
fail_unless (ret == GST_STATE_CHANGE_ASYNC);
ret = gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, NULL);
ret =
gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
pop_messages (bus, 6);
@ -382,7 +386,7 @@ GST_START_TEST (test_watch_for_state_change)
/* this one might return either SUCCESS or ASYNC, likely SUCCESS */
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED);
gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, NULL);
gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_CLOCK_TIME_NONE);
pop_messages (bus, 3);
@ -502,7 +506,8 @@ GST_START_TEST (test_children_state_change_order_flagged_sink)
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_if (ret != GST_STATE_CHANGE_ASYNC,
"State change to PLAYING did not return ASYNC");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to PLAYING failed");
fail_if (current != GST_STATE_PLAYING, "State change to PLAYING failed");
fail_if (pending != GST_STATE_VOID_PENDING, "State change to PLAYING failed");
@ -543,7 +548,7 @@ GST_START_TEST (test_children_state_change_order_flagged_sink)
/* don't set to NULL that will set the bus flushing and kill our messages */
ret = gst_element_set_state (pipeline, GST_STATE_READY);
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed");
ret = gst_element_get_state (pipeline, NULL, NULL, NULL);
ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed");
/* TODO: do we need to check downwards state change order as well? */
@ -602,7 +607,8 @@ GST_START_TEST (test_children_state_change_order_semi_sink)
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_if (ret != GST_STATE_CHANGE_ASYNC, "State change to PLAYING not ASYNC");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to PLAYING failed");
fail_if (current != GST_STATE_PLAYING, "State change to PLAYING failed");
fail_if (pending != GST_STATE_VOID_PENDING, "State change to PLAYING failed");

View file

@ -109,7 +109,7 @@ GST_START_TEST (test_link)
gst_element_set_state (src, GST_STATE_PAUSED);
/* wait for preroll */
gst_element_get_state (sink, NULL, NULL, NULL);
gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE);
/* play some more */
gst_element_set_state (sink, GST_STATE_PLAYING);
@ -122,7 +122,7 @@ GST_START_TEST (test_link)
gst_element_set_state (src, GST_STATE_PAUSED);
/* wait for preroll */
gst_element_get_state (sink, NULL, NULL, NULL);
gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_element_set_state (sink, GST_STATE_NULL);
gst_element_set_state (src, GST_STATE_NULL);

View file

@ -245,7 +245,8 @@ static void test_event
got_event_before_q = got_event_after_q = NULL;
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
GST_CLOCK_TIME_NONE);
event = gst_event_new_custom (type,
gst_structure_empty_new ("application/x-custom"));
@ -275,7 +276,8 @@ static void test_event
}
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
GST_CLOCK_TIME_NONE);
if (got_event_before_q)
gst_event_unref (got_event_before_q);
@ -372,7 +374,8 @@ GST_START_TEST (send_custom_events)
G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
GST_CLOCK_TIME_NONE);
gst_object_unref (pipeline);
}

View file

@ -248,11 +248,11 @@ GST_START_TEST (test_ghost_pads)
assert_gstrefcount (isrc, 3); /* parent and gsrc */
ret = gst_element_set_state (b1, GST_STATE_PLAYING);
ret = gst_element_get_state (b1, NULL, NULL, NULL);
ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
ret = gst_element_set_state (b1, GST_STATE_NULL);
ret = gst_element_get_state (b1, NULL, NULL, NULL);
ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
gst_object_unref (b1);

View file

@ -167,6 +167,7 @@ GST_START_TEST (test_bus)
GstBus *bus;
guint id;
GstState current;
GstStateChangeReturn ret;
pipeline = gst_pipeline_new (NULL);
fail_unless (pipeline != NULL, "Could not create pipeline");
@ -188,7 +189,9 @@ GST_START_TEST (test_bus)
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline after add_watch", 1);
ASSERT_OBJECT_REFCOUNT (bus, "bus after add_watch", 3);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC);
loop = g_main_loop_new (NULL, FALSE);
GST_DEBUG ("going into main loop");
g_main_loop_run (loop);
@ -202,23 +205,22 @@ GST_START_TEST (test_bus)
/* cleanup */
GST_DEBUG ("cleanup");
gst_element_set_state (pipeline, GST_STATE_NULL);
fail_unless (gst_element_get_state (pipeline, &current, NULL, NULL) ==
GST_STATE_CHANGE_SUCCESS);
ret = gst_element_set_state (pipeline, GST_STATE_NULL);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
ret = gst_element_get_state (pipeline, &current, NULL, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
fail_unless (current == GST_STATE_NULL, "state is not NULL but %d", current);
/* FIXME: need to figure out an extra refcount, checks disabled */
// ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline at start of cleanup", 1);
// ASSERT_OBJECT_REFCOUNT (bus, "bus at start of cleanup", 3);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline at start of cleanup", 1);
ASSERT_OBJECT_REFCOUNT (bus, "bus at start of cleanup", 3);
fail_unless (g_source_remove (id));
// ASSERT_OBJECT_REFCOUNT (bus, "bus after removing source", 2);
ASSERT_OBJECT_REFCOUNT (bus, "bus after removing source", 2);
GST_DEBUG ("unreffing pipeline");
gst_object_unref (pipeline);
// ASSERT_OBJECT_REFCOUNT (bus, "bus after unref pipeline", 1);
ASSERT_OBJECT_REFCOUNT (bus, "bus after unref pipeline", 1);
gst_object_unref (bus);
}

View file

@ -55,7 +55,7 @@ run_pipeline (GstElement * pipeline, gchar * descr,
g_assert (bus);
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
ret = gst_element_get_state (pipeline, NULL, NULL, NULL);
ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
if (ret != GST_STATE_CHANGE_SUCCESS) {
g_critical ("Couldn't set pipeline to PLAYING");

View file

@ -28,7 +28,6 @@ GST_START_TEST (test_sink)
GstElement *sink;
GstStateChangeReturn ret;
GstState current, pending;
GTimeVal tv;
sink = gst_element_factory_make ("fakesink", "sink");
@ -38,9 +37,7 @@ GST_START_TEST (test_sink)
ret = gst_element_set_state (sink, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no forced async state change");
GST_TIME_TO_TIMEVAL ((GstClockTime) 0, tv);
ret = gst_element_get_state (sink, &current, &pending, &tv);
ret = gst_element_get_state (sink, &current, &pending, 0);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async");
fail_unless (current == GST_STATE_READY, "bad current state");
fail_unless (pending == GST_STATE_PLAYING, "bad pending state");
@ -65,16 +62,13 @@ GST_START_TEST (test_sink_completion)
GstElement *sink, *src;
GstStateChangeReturn ret;
GstState current, pending;
GTimeVal tv;
sink = gst_element_factory_make ("fakesink", "sink");
ret = gst_element_set_state (sink, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return");
GST_TIME_TO_TIMEVAL ((GstClockTime) 0, tv);
ret = gst_element_get_state (sink, &current, &pending, &tv);
ret = gst_element_get_state (sink, &current, &pending, 0);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async");
fail_unless (current == GST_STATE_READY, "bad current state");
fail_unless (pending == GST_STATE_PLAYING, "bad pending state");
@ -86,7 +80,7 @@ GST_START_TEST (test_sink_completion)
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return");
/* now wait for final state */
ret = gst_element_get_state (sink, &current, &pending, NULL);
ret = gst_element_get_state (sink, &current, &pending, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to change state");
fail_unless (current == GST_STATE_PLAYING, "bad current state");
fail_unless (pending == GST_STATE_VOID_PENDING, "bad pending state");
@ -126,13 +120,14 @@ GST_START_TEST (test_src_sink)
ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return");
ret = gst_element_get_state (pipeline, NULL, NULL, NULL);
ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return");
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot start play");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing");
fail_unless (current == GST_STATE_PLAYING, "not playing");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
@ -153,7 +148,6 @@ GST_START_TEST (test_livesrc_remove)
GstStateChangeReturn ret;
GstState current, pending;
GstPad *srcpad, *sinkpad;
GTimeVal tv;
pipeline = gst_pipeline_new ("pipeline");
src = gst_element_factory_make ("fakesrc", "src");
@ -173,15 +167,14 @@ GST_START_TEST (test_livesrc_remove)
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, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused");
fail_unless (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
gst_bin_remove (GST_BIN (pipeline), src);
GST_TIME_TO_TIMEVAL (0, tv);
ret = gst_element_get_state (pipeline, &current, &pending, &tv);
ret = gst_element_get_state (pipeline, &current, &pending, 0);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async");
fail_unless (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_PAUSED, "not paused");
@ -196,7 +189,6 @@ GST_START_TEST (test_livesrc_sink)
GstStateChangeReturn ret;
GstState current, pending;
GstPad *srcpad, *sinkpad;
GTimeVal tv;
pipeline = gst_pipeline_new ("pipeline");
src = gst_element_factory_make ("fakesrc", "src");
@ -216,26 +208,27 @@ GST_START_TEST (test_livesrc_sink)
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, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused");
fail_unless (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
/* don't block here */
GST_TIME_TO_TIMEVAL (0, tv);
ret = gst_element_get_state (sink, &current, &pending, &tv);
ret = gst_element_get_state (sink, &current, &pending, 0);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async");
fail_unless (current == GST_STATE_READY, "not ready");
fail_unless (pending == GST_STATE_PAUSED, "not paused");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused");
fail_unless (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing");
fail_unless (current == GST_STATE_PLAYING, "not playing");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");

View file

@ -410,7 +410,8 @@ stop_typefinding (GstTypeFindElement * typefind)
GstState state;
gboolean push_cached_buffers;
gst_element_get_state (GST_ELEMENT (typefind), &state, NULL, NULL);
gst_element_get_state (GST_ELEMENT (typefind), &state, NULL,
GST_CLOCK_TIME_NONE);
push_cached_buffers = (state >= GST_STATE_PAUSED);

View file

@ -84,7 +84,7 @@ static void gst_bin_recalc_state (GstBin * bin, gboolean force);
static GstStateChangeReturn gst_bin_change_state_func (GstElement * element,
GstStateChange transition);
static GstStateChangeReturn gst_bin_get_state_func (GstElement * element,
GstState * state, GstState * pending, GTimeVal * timeout);
GstState * state, GstState * pending, GstClockTime timeout);
static gboolean gst_bin_add_func (GstBin * bin, GstElement * element);
static gboolean gst_bin_remove_func (GstBin * bin, GstElement * element);
@ -908,7 +908,7 @@ gst_bin_iterate_sinks (GstBin * bin)
*/
static GstStateChangeReturn
gst_bin_get_state_func (GstElement * element, GstState * state,
GstState * pending, GTimeVal * timeout)
GstState * pending, GstClockTime timeout)
{
GstBin *bin = GST_BIN (element);
@ -928,7 +928,6 @@ gst_bin_recalc_state (GstBin * bin, gboolean force)
guint32 children_cookie;
gboolean have_no_preroll;
gboolean have_async;
GTimeVal tv;
ret = GST_STATE_CHANGE_SUCCESS;
@ -962,7 +961,6 @@ restart:
/* scan all element states with a zero timeout so we don't block on
* anything */
GST_TIME_TO_TIMEVAL (0, tv);
children = bin->children;
children_cookie = bin->children_cookie;
while (children) {
@ -973,7 +971,7 @@ restart:
* release the lock anyway since we can. */
GST_UNLOCK (bin);
ret = gst_element_get_state (child, NULL, NULL, &tv);
ret = gst_element_get_state (child, NULL, NULL, 0);
gst_object_unref (child);

View file

@ -120,7 +120,7 @@ static GstStateChangeReturn gst_element_change_state_func (GstElement * element,
static GstStateChangeReturn gst_element_change_state_func (GstElement * element,
GstStateChange transition);
static GstStateChangeReturn gst_element_get_state_func (GstElement * element,
GstState * state, GstState * pending, GTimeVal * timeout);
GstState * state, GstState * pending, GstClockTime timeout);
static void gst_element_set_bus_func (GstElement * element, GstBus * bus);
#ifndef GST_DISABLE_LOADSAVE
@ -1604,7 +1604,7 @@ failed:
/* MT safe */
static GstStateChangeReturn
gst_element_get_state_func (GstElement * element,
GstState * state, GstState * pending, GTimeVal * timeout)
GstState * state, GstState * pending, GstClockTime timeout)
{
GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;
GstState old_pending;
@ -1630,8 +1630,8 @@ gst_element_get_state_func (GstElement * element,
if (old_pending != GST_STATE_VOID_PENDING) {
GTimeVal *timeval, abstimeout;
if (timeout) {
glong add = timeout->tv_sec * G_USEC_PER_SEC + timeout->tv_usec;
if (timeout != GST_CLOCK_TIME_NONE) {
glong add = timeout / 1000;
if (add == 0)
goto done;
@ -1688,8 +1688,8 @@ done:
* @state: a pointer to #GstState to hold the state. Can be NULL.
* @pending: a pointer to #GstState to hold the pending state.
* Can be NULL.
* @timeout: a #GTimeVal to specify the timeout for an async
* state change or NULL for infinite timeout.
* @timeout: a #GstClockTime to specify the timeout for an async
* state change or GST_CLOCK_TIME_NONE for infinite timeout.
*
* Gets the state of the element.
*
@ -1712,7 +1712,7 @@ done:
*/
GstStateChangeReturn
gst_element_get_state (GstElement * element,
GstState * state, GstState * pending, GTimeVal * timeout)
GstState * state, GstState * pending, GstClockTime timeout)
{
GstElementClass *oclass;
GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE;

View file

@ -355,7 +355,7 @@ struct _GstElementClass
/* state changes */
GstStateChangeReturn (*get_state) (GstElement * element, GstState * state,
GstState * pending, GTimeVal * timeout);
GstState * pending, GstClockTime timeout);
GstStateChangeReturn (*change_state) (GstElement *element, GstStateChange transition);
/* bus */
@ -485,7 +485,7 @@ gboolean gst_element_sync_state_with_parent (GstElement *element);
GstStateChangeReturn gst_element_get_state (GstElement * element,
GstState * state,
GstState * pending,
GTimeVal * timeout);
GstClockTime timeout);
GstStateChangeReturn gst_element_set_state (GstElement *element, GstState state);
void gst_element_abort_state (GstElement * element);

View file

@ -226,12 +226,10 @@ do_pipeline_seek (GstElement * element, GstEvent * event)
if (flush) {
GstState state;
GTimeVal timeout;
GST_TIME_TO_TIMEVAL (0, timeout);
/* need to call _get_state() since a bin state is only updated
* with this call. */
gst_element_get_state (element, &state, NULL, &timeout);
gst_element_get_state (element, &state, NULL, 0);
was_playing = state == GST_STATE_PLAYING;
if (was_playing) {

View file

@ -1337,7 +1337,6 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
GstElement *capsfilter;
GstObject *parent;
GstState state, pending;
GTimeVal tv;
capsfilter = gst_element_factory_make ("capsfilter", NULL);
if (!capsfilter) {
@ -1348,8 +1347,7 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname,
parent = gst_object_get_parent (GST_OBJECT (src));
g_return_val_if_fail (GST_IS_BIN (parent), FALSE);
GST_TIME_TO_TIMEVAL (0, tv);
gst_element_get_state (GST_ELEMENT_CAST (parent), &state, &pending, &tv);
gst_element_get_state (GST_ELEMENT_CAST (parent), &state, &pending, 0);
if (!gst_bin_add (GST_BIN (parent), capsfilter)) {
GST_ERROR ("Could not add capsfilter");
@ -1920,154 +1918,6 @@ gst_bin_remove_many (GstBin * bin, GstElement * element_1, ...)
va_end (args);
}
static void
get_state_func (GstElement * element, gpointer unused)
{
GstStateChangeReturn ret = GST_STATE_CHANGE_ASYNC;
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"new thread waiting on state change");
/* wait indefinitely */
while (ret == GST_STATE_CHANGE_ASYNC)
ret = gst_element_get_state (element, NULL, NULL, NULL);
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"thread done waiting on state change");
gst_object_unref (element);
}
/**
* gst_bin_watch_for_state_change:
* @bin: the bin to watch for state changes
*
* 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_CHANGE_ASYNC
* from a state change, it will not commit its state until someone calls
* gst_element_get_state() on it. Thus having another thread checking the bin's
* state will ensure that a state-changed message gets posted on the bus
* eventually.
*
* This function is admittedly a bit of a hack. Bins should always post
* messages. However this behavior was broken out into this function to avoid
* spawning threads when scrubbing, when the bin's state is changing quickly and
* asynchronously.
*/
void
gst_bin_watch_for_state_change (GstBin * bin)
{
static GThreadPool *pool = NULL;
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
g_static_mutex_lock (&mutex);
if (pool == NULL)
pool = g_thread_pool_new ((GFunc) get_state_func, NULL, -1, FALSE, NULL);
g_static_mutex_unlock (&mutex);
g_thread_pool_push (pool, gst_object_ref (bin), NULL);
}
struct _GstAsyncThreadData
{
GstElement *element;
GstState state;
};
static void
set_state_async_thread_func (struct _GstAsyncThreadData *data, gpointer unused)
{
GstState current, pending;
GstStateChangeReturn ret = GST_STATE_CHANGE_ASYNC;
GST_CAT_INFO_OBJECT (GST_CAT_STATES, data->element,
"new thread ensuring state change to %s",
gst_element_state_get_name (data->state));
while (TRUE) {
/* wait indefinitely */
ret = gst_element_get_state (data->element, &current, &pending, NULL);
GST_CAT_INFO_OBJECT (GST_CAT_STATES, data->element,
"get_state returned %d, current %s, pending %s", ret,
gst_element_state_get_name (current),
gst_element_state_get_name (pending));
/* can only be SUCCESS or FAILURE */
if (ret == GST_STATE_CHANGE_FAILURE) {
/* we can only break, hopefully an error message was posted as well */
GST_CAT_INFO_OBJECT (GST_CAT_STATES, data->element,
"FAILURE during state change");
break;
} else if (ret == GST_STATE_CHANGE_SUCCESS) {
if (current == data->state) {
GST_CAT_INFO_OBJECT (GST_CAT_STATES, data->element,
"successfully reached final state");
break;
}
GST_CAT_INFO_OBJECT (GST_CAT_STATES, data->element,
"setting target state %s again",
gst_element_state_get_name (data->state));
gst_element_set_state (data->element, data->state);
} else {
g_assert_not_reached ();
}
}
GST_CAT_INFO_OBJECT (GST_CAT_STATES, data->element,
"thread done waiting on state change");
gst_object_unref (data->element);
g_free (data);
}
/**
* gst_element_set_state_async:
* @element: a #GstElement to change state of
* @state: the element's new #GstState
*
* Sets the state of the element. This function will try to set the
* requested state by going through all the intermediary states and calling
* the class's state change function for each. If the state change returns
* #GST_STATE_CHANGE_ASYNC at any time, a thread will be started to
* monitor the state change and make sure the element is brought to the
* requested state.
*
* Returns: Result of the state change using #GstStateChangeReturn.
*
* MT safe.
*/
GstStateChangeReturn
gst_element_set_state_async (GstElement * element, GstState state)
{
GstStateChangeReturn ret;
struct _GstAsyncThreadData *data;
ret = gst_element_set_state (element, state);
if (ret == GST_STATE_CHANGE_ASYNC) {
static GThreadPool *pool = NULL;
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"starting new thread to ensure state change to %s",
gst_element_state_get_name (state));
g_static_mutex_lock (&mutex);
if (pool == NULL)
pool = g_thread_pool_new ((GFunc) set_state_async_thread_func,
NULL, -1, FALSE, NULL);
g_static_mutex_unlock (&mutex);
data = g_new0 (struct _GstAsyncThreadData, 1);
gst_object_ref (element);
data->element = element;
data->state = state;
g_thread_pool_push (pool, data, NULL);
}
return ret;
}
static void
gst_element_populate_std_props (GObjectClass * klass, const gchar * prop_name,
guint arg_id, GParamFlags flags)

View file

@ -410,7 +410,8 @@ stop_typefinding (GstTypeFindElement * typefind)
GstState state;
gboolean push_cached_buffers;
gst_element_get_state (GST_ELEMENT (typefind), &state, NULL, NULL);
gst_element_get_state (GST_ELEMENT (typefind), &state, NULL,
GST_CLOCK_TIME_NONE);
push_cached_buffers = (state >= GST_STATE_PAUSED);

View file

@ -28,7 +28,6 @@ GST_START_TEST (test_sink)
GstElement *sink;
GstStateChangeReturn ret;
GstState current, pending;
GTimeVal tv;
sink = gst_element_factory_make ("fakesink", "sink");
@ -38,9 +37,7 @@ GST_START_TEST (test_sink)
ret = gst_element_set_state (sink, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no forced async state change");
GST_TIME_TO_TIMEVAL ((GstClockTime) 0, tv);
ret = gst_element_get_state (sink, &current, &pending, &tv);
ret = gst_element_get_state (sink, &current, &pending, 0);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async");
fail_unless (current == GST_STATE_READY, "bad current state");
fail_unless (pending == GST_STATE_PLAYING, "bad pending state");
@ -65,16 +62,13 @@ GST_START_TEST (test_sink_completion)
GstElement *sink, *src;
GstStateChangeReturn ret;
GstState current, pending;
GTimeVal tv;
sink = gst_element_factory_make ("fakesink", "sink");
ret = gst_element_set_state (sink, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return");
GST_TIME_TO_TIMEVAL ((GstClockTime) 0, tv);
ret = gst_element_get_state (sink, &current, &pending, &tv);
ret = gst_element_get_state (sink, &current, &pending, 0);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async");
fail_unless (current == GST_STATE_READY, "bad current state");
fail_unless (pending == GST_STATE_PLAYING, "bad pending state");
@ -86,7 +80,7 @@ GST_START_TEST (test_sink_completion)
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return");
/* now wait for final state */
ret = gst_element_get_state (sink, &current, &pending, NULL);
ret = gst_element_get_state (sink, &current, &pending, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to change state");
fail_unless (current == GST_STATE_PLAYING, "bad current state");
fail_unless (pending == GST_STATE_VOID_PENDING, "bad pending state");
@ -126,13 +120,14 @@ GST_START_TEST (test_src_sink)
ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return");
ret = gst_element_get_state (pipeline, NULL, NULL, NULL);
ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return");
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot start play");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing");
fail_unless (current == GST_STATE_PLAYING, "not playing");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
@ -153,7 +148,6 @@ GST_START_TEST (test_livesrc_remove)
GstStateChangeReturn ret;
GstState current, pending;
GstPad *srcpad, *sinkpad;
GTimeVal tv;
pipeline = gst_pipeline_new ("pipeline");
src = gst_element_factory_make ("fakesrc", "src");
@ -173,15 +167,14 @@ GST_START_TEST (test_livesrc_remove)
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, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused");
fail_unless (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
gst_bin_remove (GST_BIN (pipeline), src);
GST_TIME_TO_TIMEVAL (0, tv);
ret = gst_element_get_state (pipeline, &current, &pending, &tv);
ret = gst_element_get_state (pipeline, &current, &pending, 0);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async");
fail_unless (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_PAUSED, "not paused");
@ -196,7 +189,6 @@ GST_START_TEST (test_livesrc_sink)
GstStateChangeReturn ret;
GstState current, pending;
GstPad *srcpad, *sinkpad;
GTimeVal tv;
pipeline = gst_pipeline_new ("pipeline");
src = gst_element_factory_make ("fakesrc", "src");
@ -216,26 +208,27 @@ GST_START_TEST (test_livesrc_sink)
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, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused");
fail_unless (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
/* don't block here */
GST_TIME_TO_TIMEVAL (0, tv);
ret = gst_element_get_state (sink, &current, &pending, &tv);
ret = gst_element_get_state (sink, &current, &pending, 0);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async");
fail_unless (current == GST_STATE_READY, "not ready");
fail_unless (pending == GST_STATE_PAUSED, "not paused");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused");
fail_unless (current == GST_STATE_PAUSED, "not paused");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing");
fail_unless (current == GST_STATE_PLAYING, "not playing");
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");

View file

@ -264,7 +264,8 @@ GST_START_TEST (test_message_state_changed_children)
ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
fail_unless (ret == GST_STATE_CHANGE_ASYNC);
ret =
gst_element_get_state (GST_ELEMENT (pipeline), &current, &pending, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), &current, &pending,
GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
fail_unless (current == GST_STATE_PAUSED);
fail_unless (pending == GST_STATE_VOID_PENDING);
@ -289,7 +290,8 @@ GST_START_TEST (test_message_state_changed_children)
ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
ret =
gst_element_get_state (GST_ELEMENT (pipeline), &current, &pending, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), &current, &pending,
GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
fail_unless (current == GST_STATE_PLAYING);
fail_unless (pending == GST_STATE_VOID_PENDING);
@ -367,7 +369,9 @@ GST_START_TEST (test_watch_for_state_change)
/* change state, spawning two times three messages */
ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED);
fail_unless (ret == GST_STATE_CHANGE_ASYNC);
ret = gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, NULL);
ret =
gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
pop_messages (bus, 6);
@ -382,7 +386,7 @@ GST_START_TEST (test_watch_for_state_change)
/* this one might return either SUCCESS or ASYNC, likely SUCCESS */
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED);
gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, NULL);
gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_CLOCK_TIME_NONE);
pop_messages (bus, 3);
@ -502,7 +506,8 @@ GST_START_TEST (test_children_state_change_order_flagged_sink)
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_if (ret != GST_STATE_CHANGE_ASYNC,
"State change to PLAYING did not return ASYNC");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to PLAYING failed");
fail_if (current != GST_STATE_PLAYING, "State change to PLAYING failed");
fail_if (pending != GST_STATE_VOID_PENDING, "State change to PLAYING failed");
@ -543,7 +548,7 @@ GST_START_TEST (test_children_state_change_order_flagged_sink)
/* don't set to NULL that will set the bus flushing and kill our messages */
ret = gst_element_set_state (pipeline, GST_STATE_READY);
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed");
ret = gst_element_get_state (pipeline, NULL, NULL, NULL);
ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed");
/* TODO: do we need to check downwards state change order as well? */
@ -602,7 +607,8 @@ GST_START_TEST (test_children_state_change_order_semi_sink)
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_if (ret != GST_STATE_CHANGE_ASYNC, "State change to PLAYING not ASYNC");
ret = gst_element_get_state (pipeline, &current, &pending, NULL);
ret =
gst_element_get_state (pipeline, &current, &pending, GST_CLOCK_TIME_NONE);
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to PLAYING failed");
fail_if (current != GST_STATE_PLAYING, "State change to PLAYING failed");
fail_if (pending != GST_STATE_VOID_PENDING, "State change to PLAYING failed");

View file

@ -109,7 +109,7 @@ GST_START_TEST (test_link)
gst_element_set_state (src, GST_STATE_PAUSED);
/* wait for preroll */
gst_element_get_state (sink, NULL, NULL, NULL);
gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE);
/* play some more */
gst_element_set_state (sink, GST_STATE_PLAYING);
@ -122,7 +122,7 @@ GST_START_TEST (test_link)
gst_element_set_state (src, GST_STATE_PAUSED);
/* wait for preroll */
gst_element_get_state (sink, NULL, NULL, NULL);
gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_element_set_state (sink, GST_STATE_NULL);
gst_element_set_state (src, GST_STATE_NULL);

View file

@ -245,7 +245,8 @@ static void test_event
got_event_before_q = got_event_after_q = NULL;
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
GST_CLOCK_TIME_NONE);
event = gst_event_new_custom (type,
gst_structure_empty_new ("application/x-custom"));
@ -275,7 +276,8 @@ static void test_event
}
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
GST_CLOCK_TIME_NONE);
if (got_event_before_q)
gst_event_unref (got_event_before_q);
@ -372,7 +374,8 @@ GST_START_TEST (send_custom_events)
G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time));
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, NULL);
gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
GST_CLOCK_TIME_NONE);
gst_object_unref (pipeline);
}

View file

@ -248,11 +248,11 @@ GST_START_TEST (test_ghost_pads)
assert_gstrefcount (isrc, 3); /* parent and gsrc */
ret = gst_element_set_state (b1, GST_STATE_PLAYING);
ret = gst_element_get_state (b1, NULL, NULL, NULL);
ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
ret = gst_element_set_state (b1, GST_STATE_NULL);
ret = gst_element_get_state (b1, NULL, NULL, NULL);
ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
gst_object_unref (b1);

View file

@ -167,6 +167,7 @@ GST_START_TEST (test_bus)
GstBus *bus;
guint id;
GstState current;
GstStateChangeReturn ret;
pipeline = gst_pipeline_new (NULL);
fail_unless (pipeline != NULL, "Could not create pipeline");
@ -188,7 +189,9 @@ GST_START_TEST (test_bus)
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline after add_watch", 1);
ASSERT_OBJECT_REFCOUNT (bus, "bus after add_watch", 3);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC);
loop = g_main_loop_new (NULL, FALSE);
GST_DEBUG ("going into main loop");
g_main_loop_run (loop);
@ -202,23 +205,22 @@ GST_START_TEST (test_bus)
/* cleanup */
GST_DEBUG ("cleanup");
gst_element_set_state (pipeline, GST_STATE_NULL);
fail_unless (gst_element_get_state (pipeline, &current, NULL, NULL) ==
GST_STATE_CHANGE_SUCCESS);
ret = gst_element_set_state (pipeline, GST_STATE_NULL);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
ret = gst_element_get_state (pipeline, &current, NULL, GST_CLOCK_TIME_NONE);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
fail_unless (current == GST_STATE_NULL, "state is not NULL but %d", current);
/* FIXME: need to figure out an extra refcount, checks disabled */
// ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline at start of cleanup", 1);
// ASSERT_OBJECT_REFCOUNT (bus, "bus at start of cleanup", 3);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline at start of cleanup", 1);
ASSERT_OBJECT_REFCOUNT (bus, "bus at start of cleanup", 3);
fail_unless (g_source_remove (id));
// ASSERT_OBJECT_REFCOUNT (bus, "bus after removing source", 2);
ASSERT_OBJECT_REFCOUNT (bus, "bus after removing source", 2);
GST_DEBUG ("unreffing pipeline");
gst_object_unref (pipeline);
// ASSERT_OBJECT_REFCOUNT (bus, "bus after unref pipeline", 1);
ASSERT_OBJECT_REFCOUNT (bus, "bus after unref pipeline", 1);
gst_object_unref (bus);
}

View file

@ -55,7 +55,7 @@ run_pipeline (GstElement * pipeline, gchar * descr,
g_assert (bus);
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
ret = gst_element_get_state (pipeline, NULL, NULL, NULL);
ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
if (ret != GST_STATE_CHANGE_SUCCESS) {
g_critical ("Couldn't set pipeline to PLAYING");

View file

@ -642,7 +642,7 @@ main (int argc, char *argv[])
break;
case GST_STATE_CHANGE_ASYNC:
fprintf (stderr, _("PREROLL pipeline ...\n"));
gst_element_get_state (pipeline, &state, &pending, NULL);
gst_element_get_state (pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
/* fallthrough */
case GST_STATE_CHANGE_SUCCESS:
fprintf (stderr, _("PREROLLED pipeline ...\n"));
@ -677,15 +677,15 @@ main (int argc, char *argv[])
fprintf (stderr, _("PAUSE pipeline ...\n"));
gst_element_set_state (pipeline, GST_STATE_PAUSED);
gst_element_get_state (pipeline, &state, &pending, NULL);
gst_element_get_state (pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
fprintf (stderr, _("READY pipeline ...\n"));
gst_element_set_state (pipeline, GST_STATE_READY);
gst_element_get_state (pipeline, &state, &pending, NULL);
gst_element_get_state (pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
end:
fprintf (stderr, _("NULL pipeline ...\n"));
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_element_get_state (pipeline, &state, &pending, NULL);
gst_element_get_state (pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
}
fprintf (stderr, _("FREEING pipeline ...\n"));

View file

@ -92,7 +92,8 @@ main (int argc, char *argv[])
if (GST_STATE_CHANGE_ASYNC == sret) {
if (GST_STATE_CHANGE_FAILURE ==
gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL))
gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL,
GST_CLOCK_TIME_NONE))
break;
} else if (sret != GST_STATE_CHANGE_SUCCESS)
g_print ("%s - No type found\n", argv[i]);
@ -100,7 +101,8 @@ main (int argc, char *argv[])
if (GST_STATE_CHANGE_ASYNC ==
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL)) {
if (GST_STATE_CHANGE_FAILURE ==
gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, NULL))
gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL,
GST_CLOCK_TIME_NONE))
break;
}