gstreamer/tests/old/testsuite/pad/getnopush.c

72 lines
1.5 KiB
C
Raw Normal View History

docs/pwg/advanced-types.xml: Fix description for buffer-frames=0. Original commit message from CVS: * docs/pwg/advanced-types.xml: Fix description for buffer-frames=0. * docs/gst/tmpl/gstbin.sgml: * gst/gstbin.c: (gst_bin_child_state_change_func), (gst_bin_change_state), (gst_bin_change_state_norecurse): * gst/gstbin.h: * testsuite/threads/Makefile.am: * testsuite/threads/threadi.c: (cb_timeout), (cb_quit), (cb_eos), (cb_state), (cb_play), (main): Fix non-recursive state changes to *really* change the state of the object, and not just call parent_class->state_change. Fix a lot of lockups caused by this. Fixes #132775. Add test for the problem. Also enable test to show #142588 (fixed). * gst/gstthread.c: (gst_thread_change_state), (gst_thread_child_state_change): Don't exit the thread if we go to NULL and are inside thread context. Instead, return control to the main thread context and exit from there. * gst/gstelement.c: (gst_element_disable_threadsafe_properties): Don't unset virtual functions, since those may still be used. That's not necessarily correct, but suffices for now. * configure.ac: * testsuite/Makefile.am: * testsuite/pad/Makefile.am: * testsuite/pad/chainnopull.c: (gst_test_sink_class_init), (gst_test_sink_base_init), (gst_test_sink_chain), (gst_test_sink_init), (main): * testsuite/pad/getnopush.c: (gst_test_src_class_init), (gst_test_src_base_init), (gst_test_src_get), (gst_test_src_init), (main): * testsuite/pad/link.c: (gst_test_element_class_init), (gst_test_element_base_init), (gst_test_src_get), (gst_test_src_loop), (gst_test_src_init), (gst_test_filter_chain), (gst_test_filter_loop), (gst_test_filter_init), (gst_test_sink_chain), (gst_test_sink_loop), (gst_test_sink_init), (cb_error), (main): Add tests to show #150546. Pass, but should fail (currently disabled from the testsuite). * gst/gstscheduler.c: (gst_scheduler_dispose): Dereference child schedulers on dispose (#94464). * testsuite/bytestream/filepadsink.c: (gst_fp_sink_init): Fix typo. * testsuite/threads/thread.c: (main): Add more debug.
2005-01-31 15:51:19 +00:00
/*
* this tests that get-based pads don't push.
*/
#include <gst/gst.h>
typedef struct _GstTestSrc
{
GstElement parent;
GstPad *srcpad;
} GstTestSrc;
typedef GstElementClass GstTestSrcClass;
static void
gst_test_src_class_init (GstTestSrcClass * klass)
{
}
static void
gst_test_src_base_init (gpointer klass)
{
}
static GstData *
gst_test_src_get (GstPad * pad)
{
GstEvent *event;
event = gst_event_new (GST_EVENT_INTERRUPT);
gst_event_ref (event);
gst_pad_push (pad, GST_DATA (event));
return GST_DATA (event);
}
static void
gst_test_src_init (GstTestSrc * src)
{
src->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_pad_set_get_function (src->srcpad, gst_test_src_get);
gst_element_add_pad (GST_ELEMENT (src), src->srcpad);
}
GST_BOILERPLATE (GstTestSrc, gst_test_src, GstElement, GST_TYPE_ELEMENT);
int
main (int argc, char *argv[])
{
GstElement *pipeline, *testsrc, *fakesink;
gint n;
gst_init (&argc, &argv);
pipeline = gst_pipeline_new ("p");
testsrc = g_object_new (gst_test_src_get_type (), NULL);
gst_object_set_name (GST_OBJECT (testsrc), "src");
fakesink = gst_element_factory_make ("fakesink", "sink");
gst_bin_add_many (GST_BIN (pipeline), testsrc, fakesink, NULL);
gst_element_link (testsrc, fakesink);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
for (n = 0; n < 100; n++) {
if (!gst_bin_iterate (GST_BIN (pipeline)))
break;
}
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
return 0;
}