mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
re-enable states and add test
Original commit message from CVS: re-enable states and add test
This commit is contained in:
parent
19fac086bf
commit
a074393f26
8 changed files with 230 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-07-09 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
* testsuite/Makefile.am:
|
||||||
|
* testsuite/states/Makefile.am:
|
||||||
|
* testsuite/states/parent.c: (main):
|
||||||
|
re-enable states testsuite dir. Add test for state changes and
|
||||||
|
parent behaviour
|
||||||
|
|
||||||
2004-07-09 Wim Taymans <wim@fluendo.com>
|
2004-07-09 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/schedulers/gstoptimalscheduler.c:
|
* gst/schedulers/gstoptimalscheduler.c:
|
||||||
|
|
|
@ -678,6 +678,7 @@ testsuite/parse/Makefile
|
||||||
testsuite/plugin/Makefile
|
testsuite/plugin/Makefile
|
||||||
testsuite/refcounting/Makefile
|
testsuite/refcounting/Makefile
|
||||||
testsuite/schedulers/Makefile
|
testsuite/schedulers/Makefile
|
||||||
|
testsuite/states/Makefile
|
||||||
testsuite/tags/Makefile
|
testsuite/tags/Makefile
|
||||||
testsuite/threads/Makefile
|
testsuite/threads/Makefile
|
||||||
examples/Makefile
|
examples/Makefile
|
||||||
|
|
|
@ -19,7 +19,7 @@ SUBDIRS = \
|
||||||
dlopen dynparams \
|
dlopen dynparams \
|
||||||
elements enumcaps ghostpads indexers negotiation \
|
elements enumcaps ghostpads indexers negotiation \
|
||||||
$(GST_PARSE_DIRS) \
|
$(GST_PARSE_DIRS) \
|
||||||
plugin refcounting schedulers tags threads
|
plugin refcounting schedulers states tags threads
|
||||||
|
|
||||||
DIST_SUBDIRS = \
|
DIST_SUBDIRS = \
|
||||||
bins bytestream caps cleanup clock \
|
bins bytestream caps cleanup clock \
|
||||||
|
@ -27,7 +27,7 @@ DIST_SUBDIRS = \
|
||||||
dlopen dynparams \
|
dlopen dynparams \
|
||||||
elements enumcaps ghostpads indexers negotiation \
|
elements enumcaps ghostpads indexers negotiation \
|
||||||
parse \
|
parse \
|
||||||
plugin refcounting schedulers tags threads
|
plugin refcounting schedulers states tags threads
|
||||||
|
|
||||||
tests_pass = test_gst_init
|
tests_pass = test_gst_init
|
||||||
tests_fail =
|
tests_fail =
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
tests_pass = locked
|
tests_pass = locked parent
|
||||||
tests_fail =
|
tests_fail =
|
||||||
tests_ignore =
|
tests_ignore =
|
||||||
|
|
||||||
|
|
107
tests/old/testsuite/states/parent.c
Normal file
107
tests/old/testsuite/states/parent.c
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
/* GStreamer
|
||||||
|
*
|
||||||
|
* parent.c: test to check that setting state on a parent sets same state
|
||||||
|
* recursively on children
|
||||||
|
*
|
||||||
|
* Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc, gchar * argv[])
|
||||||
|
{
|
||||||
|
GstElement *pipeline;
|
||||||
|
GstElement *bin1, *bin2;
|
||||||
|
GstElement *fakesrc, *identity, *fakesink;
|
||||||
|
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* +-pipeline----------------------------------------+
|
||||||
|
* | +-bin2----------------------------------------+ |
|
||||||
|
* | | +-bin1-----------------------+ | |
|
||||||
|
* | | | +---------+ +----------+ | +----------+ | |
|
||||||
|
* | | | | fakesrc |---| identity |---| fakesink | | |
|
||||||
|
* | | | +---------+ +----------- | +----------+ | |
|
||||||
|
* | | +----------------------------+ | |
|
||||||
|
* | +---------------------------------------------+ |
|
||||||
|
* +-------------------------------------------------+
|
||||||
|
*/
|
||||||
|
|
||||||
|
pipeline = gst_pipeline_new ("pipeline");
|
||||||
|
g_assert (pipeline);
|
||||||
|
bin1 = gst_bin_new ("bin1");
|
||||||
|
g_assert (bin1);
|
||||||
|
bin2 = gst_bin_new ("bin2");
|
||||||
|
g_assert (bin2);
|
||||||
|
|
||||||
|
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
||||||
|
g_assert (fakesrc);
|
||||||
|
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
||||||
|
identity = gst_element_factory_make ("identity", "identity");
|
||||||
|
g_assert (identity);
|
||||||
|
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
||||||
|
g_assert (fakesink);
|
||||||
|
|
||||||
|
gst_bin_add_many (GST_BIN (bin1), fakesrc, identity, NULL);
|
||||||
|
g_assert (gst_element_link (fakesrc, identity));
|
||||||
|
|
||||||
|
gst_bin_add_many (GST_BIN (bin2), bin1, fakesink, NULL);
|
||||||
|
g_assert (gst_element_link (identity, fakesink));
|
||||||
|
|
||||||
|
gst_bin_add (GST_BIN (pipeline), bin2);
|
||||||
|
g_signal_connect (G_OBJECT (pipeline), "deep_notify",
|
||||||
|
G_CALLBACK (gst_element_default_deep_notify), NULL);
|
||||||
|
|
||||||
|
/* setting pipeline to READY should bring in all children to READY */
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (bin1) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (bin2) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (fakesrc) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (identity) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (fakesink) == GST_STATE_READY);
|
||||||
|
|
||||||
|
/* setting fakesink to PAUSED should set pipeline and bin2 to PAUSED */
|
||||||
|
gst_element_set_state (fakesink, GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin1) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (bin2) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (fakesrc) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (identity) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
/* setting fakesrc to PAUSED should set bin1 and fakesrc to PAUSED */
|
||||||
|
gst_element_set_state (fakesrc, GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin1) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin2) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (fakesrc) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (identity) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
/* setting bin1 to PAUSED, even though it is already, should set
|
||||||
|
* identity to PAUSED as well */
|
||||||
|
gst_element_set_state (bin1, GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin1) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin2) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (fakesrc) == GST_STATE_PAUSED);
|
||||||
|
//FIXME: fix core so that this assert works
|
||||||
|
//g_assert (GST_STATE (identity) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -19,7 +19,7 @@ SUBDIRS = \
|
||||||
dlopen dynparams \
|
dlopen dynparams \
|
||||||
elements enumcaps ghostpads indexers negotiation \
|
elements enumcaps ghostpads indexers negotiation \
|
||||||
$(GST_PARSE_DIRS) \
|
$(GST_PARSE_DIRS) \
|
||||||
plugin refcounting schedulers tags threads
|
plugin refcounting schedulers states tags threads
|
||||||
|
|
||||||
DIST_SUBDIRS = \
|
DIST_SUBDIRS = \
|
||||||
bins bytestream caps cleanup clock \
|
bins bytestream caps cleanup clock \
|
||||||
|
@ -27,7 +27,7 @@ DIST_SUBDIRS = \
|
||||||
dlopen dynparams \
|
dlopen dynparams \
|
||||||
elements enumcaps ghostpads indexers negotiation \
|
elements enumcaps ghostpads indexers negotiation \
|
||||||
parse \
|
parse \
|
||||||
plugin refcounting schedulers tags threads
|
plugin refcounting schedulers states tags threads
|
||||||
|
|
||||||
tests_pass = test_gst_init
|
tests_pass = test_gst_init
|
||||||
tests_fail =
|
tests_fail =
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
tests_pass = locked
|
tests_pass = locked parent
|
||||||
tests_fail =
|
tests_fail =
|
||||||
tests_ignore =
|
tests_ignore =
|
||||||
|
|
||||||
|
|
107
testsuite/states/parent.c
Normal file
107
testsuite/states/parent.c
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
/* GStreamer
|
||||||
|
*
|
||||||
|
* parent.c: test to check that setting state on a parent sets same state
|
||||||
|
* recursively on children
|
||||||
|
*
|
||||||
|
* Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc, gchar * argv[])
|
||||||
|
{
|
||||||
|
GstElement *pipeline;
|
||||||
|
GstElement *bin1, *bin2;
|
||||||
|
GstElement *fakesrc, *identity, *fakesink;
|
||||||
|
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* +-pipeline----------------------------------------+
|
||||||
|
* | +-bin2----------------------------------------+ |
|
||||||
|
* | | +-bin1-----------------------+ | |
|
||||||
|
* | | | +---------+ +----------+ | +----------+ | |
|
||||||
|
* | | | | fakesrc |---| identity |---| fakesink | | |
|
||||||
|
* | | | +---------+ +----------- | +----------+ | |
|
||||||
|
* | | +----------------------------+ | |
|
||||||
|
* | +---------------------------------------------+ |
|
||||||
|
* +-------------------------------------------------+
|
||||||
|
*/
|
||||||
|
|
||||||
|
pipeline = gst_pipeline_new ("pipeline");
|
||||||
|
g_assert (pipeline);
|
||||||
|
bin1 = gst_bin_new ("bin1");
|
||||||
|
g_assert (bin1);
|
||||||
|
bin2 = gst_bin_new ("bin2");
|
||||||
|
g_assert (bin2);
|
||||||
|
|
||||||
|
fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
|
||||||
|
g_assert (fakesrc);
|
||||||
|
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
||||||
|
identity = gst_element_factory_make ("identity", "identity");
|
||||||
|
g_assert (identity);
|
||||||
|
fakesink = gst_element_factory_make ("fakesink", "fakesink");
|
||||||
|
g_assert (fakesink);
|
||||||
|
|
||||||
|
gst_bin_add_many (GST_BIN (bin1), fakesrc, identity, NULL);
|
||||||
|
g_assert (gst_element_link (fakesrc, identity));
|
||||||
|
|
||||||
|
gst_bin_add_many (GST_BIN (bin2), bin1, fakesink, NULL);
|
||||||
|
g_assert (gst_element_link (identity, fakesink));
|
||||||
|
|
||||||
|
gst_bin_add (GST_BIN (pipeline), bin2);
|
||||||
|
g_signal_connect (G_OBJECT (pipeline), "deep_notify",
|
||||||
|
G_CALLBACK (gst_element_default_deep_notify), NULL);
|
||||||
|
|
||||||
|
/* setting pipeline to READY should bring in all children to READY */
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (bin1) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (bin2) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (fakesrc) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (identity) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (fakesink) == GST_STATE_READY);
|
||||||
|
|
||||||
|
/* setting fakesink to PAUSED should set pipeline and bin2 to PAUSED */
|
||||||
|
gst_element_set_state (fakesink, GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin1) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (bin2) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (fakesrc) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (identity) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
/* setting fakesrc to PAUSED should set bin1 and fakesrc to PAUSED */
|
||||||
|
gst_element_set_state (fakesrc, GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin1) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin2) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (fakesrc) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (identity) == GST_STATE_READY);
|
||||||
|
g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
/* setting bin1 to PAUSED, even though it is already, should set
|
||||||
|
* identity to PAUSED as well */
|
||||||
|
gst_element_set_state (bin1, GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin1) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (bin2) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (fakesrc) == GST_STATE_PAUSED);
|
||||||
|
//FIXME: fix core so that this assert works
|
||||||
|
//g_assert (GST_STATE (identity) == GST_STATE_PAUSED);
|
||||||
|
g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue