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

Revision 21448, 1.4 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 chain-based pads don't pull.
3 */
4
5#include <gst/gst.h>
6
7typedef struct _GstTestSink
8{
9  GstElement parent;
10  GstPad *sinkpad;
11} GstTestSink;
12
13typedef GstElementClass GstTestSinkClass;
14
15static void
16gst_test_sink_class_init (GstTestSinkClass * klass)
17{
18}
19
20static void
21gst_test_sink_base_init (gpointer klass)
22{
23}
24
25static void
26gst_test_sink_chain (GstPad * pad, GstData * data)
27{
28  data = gst_pad_pull (pad);
29}
30
31static void
32gst_test_sink_init (GstTestSink * sink)
33{
34  sink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
35  gst_pad_set_chain_function (sink->sinkpad, gst_test_sink_chain);
36  gst_element_add_pad (GST_ELEMENT (sink), sink->sinkpad);
37}
38
39GST_BOILERPLATE (GstTestSink, gst_test_sink, GstElement, GST_TYPE_ELEMENT);
40
41int
42main (int argc, char *argv[])
43{
44  GstElement *pipeline, *fakesrc, *testsink;
45  gint n;
46
47  gst_init (&argc, &argv);
48
49  pipeline = gst_pipeline_new ("p");
50  fakesrc = gst_element_factory_make ("fakesrc", "src");
51  testsink = g_object_new (gst_test_sink_get_type (), NULL);
52  gst_object_set_name (GST_OBJECT (testsink), "sink");
53  gst_bin_add_many (GST_BIN (pipeline), fakesrc, testsink, NULL);
54  gst_element_link (fakesrc, testsink);
55  gst_element_set_state (pipeline, GST_STATE_PLAYING);
56
57  for (n = 0; n < 100; n++) {
58    if (!gst_bin_iterate (GST_BIN (pipeline)))
59      break;
60  }
61
62  gst_element_set_state (pipeline, GST_STATE_NULL);
63  gst_object_unref (GST_OBJECT (pipeline));
64
65  return 0;
66}
Note: See TracBrowser for help on using the repository browser.