source: trunk/third/gstreamer/testsuite/pad/getnopush.c @ 21448

Revision 21448, 1.5 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21447, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * this tests that get-based pads don't push.
3 */
4
5#include <gst/gst.h>
6
7typedef struct _GstTestSrc
8{
9  GstElement parent;
10  GstPad *srcpad;
11} GstTestSrc;
12
13typedef GstElementClass GstTestSrcClass;
14
15static void
16gst_test_src_class_init (GstTestSrcClass * klass)
17{
18}
19static void
20gst_test_src_base_init (gpointer klass)
21{
22}
23
24static GstData *
25gst_test_src_get (GstPad * pad)
26{
27  GstEvent *event;
28
29  event = gst_event_new (GST_EVENT_INTERRUPT);
30  gst_event_ref (event);
31  gst_pad_push (pad, GST_DATA (event));
32
33  return GST_DATA (event);
34}
35
36static void
37gst_test_src_init (GstTestSrc * src)
38{
39  src->srcpad = gst_pad_new ("src", GST_PAD_SRC);
40  gst_pad_set_get_function (src->srcpad, gst_test_src_get);
41  gst_element_add_pad (GST_ELEMENT (src), src->srcpad);
42}
43
44GST_BOILERPLATE (GstTestSrc, gst_test_src, GstElement, GST_TYPE_ELEMENT);
45
46int
47main (int argc, char *argv[])
48{
49  GstElement *pipeline, *testsrc, *fakesink;
50  gint n;
51
52  gst_init (&argc, &argv);
53
54  pipeline = gst_pipeline_new ("p");
55  testsrc = g_object_new (gst_test_src_get_type (), NULL);
56  gst_object_set_name (GST_OBJECT (testsrc), "src");
57  fakesink = gst_element_factory_make ("fakesink", "sink");
58  gst_bin_add_many (GST_BIN (pipeline), testsrc, fakesink, NULL);
59  gst_element_link (testsrc, fakesink);
60  gst_element_set_state (pipeline, GST_STATE_PLAYING);
61
62  for (n = 0; n < 100; n++) {
63    if (!gst_bin_iterate (GST_BIN (pipeline)))
64      break;
65  }
66
67  gst_element_set_state (pipeline, GST_STATE_NULL);
68  gst_object_unref (GST_OBJECT (pipeline));
69
70  return 0;
71}
Note: See TracBrowser for help on using the repository browser.