2005-06-23 10:37:09 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* unit test for sinks
|
|
|
|
*
|
|
|
|
* Copyright (C) <2005> Wim Taymans <wim at fluendo dot com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2005-08-20 12:14:28 +00:00
|
|
|
#include <gst/check/gstcheck.h>
|
2005-06-23 10:37:09 +00:00
|
|
|
|
|
|
|
/* a sink should go ASYNC to PAUSE. forcing PLAYING is possible */
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_sink)
|
2005-06-23 10:37:09 +00:00
|
|
|
{
|
|
|
|
GstElement *sink;
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
GstState current, pending;
|
2005-06-23 10:37:09 +00:00
|
|
|
|
|
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
|
|
|
|
|
|
|
ret = gst_element_set_state (sink, GST_STATE_PAUSED);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return");
|
2005-06-23 10:37:09 +00:00
|
|
|
|
|
|
|
ret = gst_element_set_state (sink, GST_STATE_PLAYING);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no forced async state change");
|
2005-06-23 10:37:09 +00:00
|
|
|
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (sink, ¤t, &pending, 0);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async");
|
check/: Check fixes, use API as stated in design docs, remove hacks.
Original commit message from CVS:
* check/Makefile.am:
* check/generic/states.c: (GST_START_TEST):
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite):
* check/states/sinks.c: (GST_START_TEST):
* check/states/sinks2.c: (GST_START_TEST), (gst_object_suite),
(main):
Check fixes, use API as stated in design docs, remove hacks.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_change_state):
Catch stopping our task while we're shutting down.
* gst/gstbin.c: (gst_bin_init), (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/gstbin.h:
* gst/gstelement.c: (gst_element_init),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state), (gst_element_change_state),
(gst_element_change_state_func):
* gst/gstelement.h:
New state change algorithm (see #318116)
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_init), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
* gst/gstpipeline.h:
Remove crude state change hacks.
* gst/gstutils.h:
Remove crude hacks.
* tools/gst-launch.c: (main):
Fixes for state change. Needs some more work to fully use the
new stuff.
2005-10-10 16:38:26 +00:00
|
|
|
fail_unless (current == GST_STATE_READY, "bad current state");
|
2005-08-18 16:20:24 +00:00
|
|
|
fail_unless (pending == GST_STATE_PLAYING, "bad pending state");
|
|
|
|
|
|
|
|
ret = gst_element_set_state (sink, GST_STATE_PAUSED);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async going back to paused");
|
2005-08-18 16:20:24 +00:00
|
|
|
|
|
|
|
ret = gst_element_set_state (sink, GST_STATE_READY);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to ready");
|
2005-08-18 16:20:24 +00:00
|
|
|
|
2005-09-29 18:37:48 +00:00
|
|
|
ret = gst_element_set_state (sink, GST_STATE_NULL);
|
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to null");
|
|
|
|
|
2005-08-18 16:20:24 +00:00
|
|
|
gst_object_unref (sink);
|
2005-06-23 10:37:09 +00:00
|
|
|
}
|
|
|
|
|
2005-10-12 08:38:06 +00:00
|
|
|
GST_END_TEST
|
|
|
|
/* a sink should go ASYNC to PAUSE and PLAYING, when linking a src, it
|
|
|
|
* should complete the state change. */
|
|
|
|
GST_START_TEST (test_sink_completion)
|
|
|
|
{
|
|
|
|
GstElement *sink, *src;
|
|
|
|
GstStateChangeReturn ret;
|
|
|
|
GstState current, pending;
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (sink, ¤t, &pending, 0);
|
2005-10-12 08:38:06 +00:00
|
|
|
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");
|
|
|
|
|
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
|
|
|
gst_element_link (src, sink);
|
|
|
|
|
|
|
|
ret = gst_element_set_state (src, GST_STATE_PLAYING);
|
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return");
|
|
|
|
|
|
|
|
/* now wait for final state */
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (sink, ¤t, &pending, GST_CLOCK_TIME_NONE);
|
2005-10-12 08:38:06 +00:00
|
|
|
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");
|
|
|
|
|
|
|
|
ret = gst_element_set_state (sink, GST_STATE_NULL);
|
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to null");
|
|
|
|
|
|
|
|
ret = gst_element_set_state (src, GST_STATE_NULL);
|
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to null");
|
|
|
|
|
|
|
|
gst_object_unref (sink);
|
|
|
|
gst_object_unref (src);
|
|
|
|
}
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_END_TEST
|
2005-06-23 10:37:09 +00:00
|
|
|
/* a sink should go ASYNC to PAUSE. PAUSE should complete when
|
|
|
|
* prerolled. */
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_src_sink)
|
2005-06-23 10:37:09 +00:00
|
|
|
{
|
|
|
|
GstElement *sink, *src, *pipeline;
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
GstState current, pending;
|
2005-06-23 10:37:09 +00:00
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("pipeline");
|
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
|
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), sink);
|
|
|
|
|
|
|
|
srcpad = gst_element_get_pad (src, "src");
|
|
|
|
sinkpad = gst_element_get_pad (sink, "sink");
|
|
|
|
gst_pad_link (srcpad, sinkpad);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (sinkpad);
|
2005-06-23 10:37:09 +00:00
|
|
|
|
|
|
|
ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
check/: Check fixes, use API as stated in design docs, remove hacks.
Original commit message from CVS:
* check/Makefile.am:
* check/generic/states.c: (GST_START_TEST):
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite):
* check/states/sinks.c: (GST_START_TEST):
* check/states/sinks2.c: (GST_START_TEST), (gst_object_suite),
(main):
Check fixes, use API as stated in design docs, remove hacks.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_change_state):
Catch stopping our task while we're shutting down.
* gst/gstbin.c: (gst_bin_init), (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/gstbin.h:
* gst/gstelement.c: (gst_element_init),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state), (gst_element_change_state),
(gst_element_change_state_func):
* gst/gstelement.h:
New state change algorithm (see #318116)
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_init), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
* gst/gstpipeline.h:
Remove crude state change hacks.
* gst/gstutils.h:
Remove crude hacks.
* tools/gst-launch.c: (main):
Fixes for state change. Needs some more work to fully use the
new stuff.
2005-10-10 16:38:26 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return");
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return");
|
2005-06-23 10:37:09 +00:00
|
|
|
|
|
|
|
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot start play");
|
2005-06-23 10:37:09 +00:00
|
|
|
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret =
|
|
|
|
gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing");
|
2005-06-23 10:37:09 +00:00
|
|
|
fail_unless (current == GST_STATE_PLAYING, "not playing");
|
|
|
|
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
|
2005-10-10 11:04:55 +00:00
|
|
|
ret = gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot null pipeline");
|
|
|
|
|
|
|
|
gst_object_unref (pipeline);
|
|
|
|
|
2005-06-23 10:37:09 +00:00
|
|
|
}
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_END_TEST
|
2005-06-23 10:37:09 +00:00
|
|
|
/* a pipeline with live source should return NO_PREROLL in
|
|
|
|
* PAUSE. When removing the live source it should return ASYNC
|
|
|
|
* from the sink */
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_livesrc_remove)
|
2005-06-23 10:37:09 +00:00
|
|
|
{
|
|
|
|
GstElement *sink, *src, *pipeline;
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
GstState current, pending;
|
2005-06-23 10:37:09 +00:00
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("pipeline");
|
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
|
|
|
g_object_set (G_OBJECT (src), "is-live", TRUE, NULL);
|
|
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), sink);
|
|
|
|
|
|
|
|
srcpad = gst_element_get_pad (src, "src");
|
|
|
|
sinkpad = gst_element_get_pad (sink, "sink");
|
|
|
|
gst_pad_link (srcpad, sinkpad);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (sinkpad);
|
2005-06-23 10:37:09 +00:00
|
|
|
|
|
|
|
ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL,
|
|
|
|
"no no_preroll state return");
|
2005-06-23 10:37:09 +00:00
|
|
|
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused");
|
2005-06-23 10:37:09 +00:00
|
|
|
fail_unless (current == GST_STATE_PAUSED, "not paused");
|
|
|
|
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
|
|
|
|
|
|
|
|
gst_bin_remove (GST_BIN (pipeline), src);
|
|
|
|
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (pipeline, ¤t, &pending, 0);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async");
|
2005-06-23 10:37:09 +00:00
|
|
|
fail_unless (current == GST_STATE_PAUSED, "not paused");
|
check/: Check fixes, use API as stated in design docs, remove hacks.
Original commit message from CVS:
* check/Makefile.am:
* check/generic/states.c: (GST_START_TEST):
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite):
* check/states/sinks.c: (GST_START_TEST):
* check/states/sinks2.c: (GST_START_TEST), (gst_object_suite),
(main):
Check fixes, use API as stated in design docs, remove hacks.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_change_state):
Catch stopping our task while we're shutting down.
* gst/gstbin.c: (gst_bin_init), (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/gstbin.h:
* gst/gstelement.c: (gst_element_init),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state), (gst_element_change_state),
(gst_element_change_state_func):
* gst/gstelement.h:
New state change algorithm (see #318116)
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_init), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
* gst/gstpipeline.h:
Remove crude state change hacks.
* gst/gstutils.h:
Remove crude hacks.
* tools/gst-launch.c: (main):
Fixes for state change. Needs some more work to fully use the
new stuff.
2005-10-10 16:38:26 +00:00
|
|
|
fail_unless (pending == GST_STATE_PAUSED, "not paused");
|
2005-06-23 10:37:09 +00:00
|
|
|
}
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_END_TEST
|
2005-06-23 10:37:09 +00:00
|
|
|
/* a sink should go ASYNC to PAUSE. PAUSE does not complete
|
|
|
|
* since we have a live source. */
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_START_TEST (test_livesrc_sink)
|
2005-06-23 10:37:09 +00:00
|
|
|
{
|
|
|
|
GstElement *sink, *src, *pipeline;
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
GstState current, pending;
|
2005-06-23 10:37:09 +00:00
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("pipeline");
|
|
|
|
src = gst_element_factory_make ("fakesrc", "src");
|
|
|
|
g_object_set (G_OBJECT (src), "is-live", TRUE, NULL);
|
|
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), sink);
|
|
|
|
|
|
|
|
srcpad = gst_element_get_pad (src, "src");
|
|
|
|
sinkpad = gst_element_get_pad (sink, "sink");
|
|
|
|
gst_pad_link (srcpad, sinkpad);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (sinkpad);
|
2005-06-23 10:37:09 +00:00
|
|
|
|
|
|
|
ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL,
|
|
|
|
"no no_preroll state return");
|
2005-06-23 10:37:09 +00:00
|
|
|
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused");
|
2005-06-23 10:37:09 +00:00
|
|
|
fail_unless (current == GST_STATE_PAUSED, "not paused");
|
|
|
|
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
|
|
|
|
|
2005-10-12 08:38:06 +00:00
|
|
|
/* don't block here */
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret = gst_element_get_state (sink, ¤t, &pending, 0);
|
2005-10-12 08:38:06 +00:00
|
|
|
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");
|
|
|
|
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret =
|
|
|
|
gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused");
|
2005-06-23 10:37:09 +00:00
|
|
|
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);
|
2005-10-12 08:38:06 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async");
|
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
2005-10-12 12:18:48 +00:00
|
|
|
ret =
|
|
|
|
gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE);
|
2005-09-02 15:42:00 +00:00
|
|
|
fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing");
|
2005-06-23 10:37:09 +00:00
|
|
|
fail_unless (current == GST_STATE_PLAYING, "not playing");
|
|
|
|
fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
|
|
|
|
}
|
|
|
|
|
2005-08-24 16:09:50 +00:00
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
|
2005-06-23 10:37:09 +00:00
|
|
|
/* test: try changing state of sinks */
|
2005-08-24 16:09:50 +00:00
|
|
|
Suite *
|
|
|
|
gst_object_suite (void)
|
2005-06-23 10:37:09 +00:00
|
|
|
{
|
|
|
|
Suite *s = suite_create ("Sinks");
|
|
|
|
TCase *tc_chain = tcase_create ("general");
|
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
|
|
|
tcase_add_test (tc_chain, test_sink);
|
2005-10-12 08:38:06 +00:00
|
|
|
tcase_add_test (tc_chain, test_sink_completion);
|
2005-06-23 10:37:09 +00:00
|
|
|
tcase_add_test (tc_chain, test_src_sink);
|
|
|
|
tcase_add_test (tc_chain, test_livesrc_remove);
|
|
|
|
tcase_add_test (tc_chain, test_livesrc_sink);
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
int nf;
|
|
|
|
|
|
|
|
Suite *s = gst_object_suite ();
|
|
|
|
SRunner *sr = srunner_create (s);
|
|
|
|
|
|
|
|
gst_check_init (&argc, &argv);
|
|
|
|
|
|
|
|
srunner_run_all (sr, CK_NORMAL);
|
|
|
|
nf = srunner_ntests_failed (sr);
|
|
|
|
srunner_free (sr);
|
|
|
|
|
|
|
|
return nf;
|
|
|
|
}
|