1 | /* |
---|
2 | * this tests that chain-based pads don't pull. |
---|
3 | */ |
---|
4 | |
---|
5 | #include <gst/gst.h> |
---|
6 | |
---|
7 | typedef struct _GstTestSink |
---|
8 | { |
---|
9 | GstElement parent; |
---|
10 | GstPad *sinkpad; |
---|
11 | } GstTestSink; |
---|
12 | |
---|
13 | typedef GstElementClass GstTestSinkClass; |
---|
14 | |
---|
15 | static void |
---|
16 | gst_test_sink_class_init (GstTestSinkClass * klass) |
---|
17 | { |
---|
18 | } |
---|
19 | |
---|
20 | static void |
---|
21 | gst_test_sink_base_init (gpointer klass) |
---|
22 | { |
---|
23 | } |
---|
24 | |
---|
25 | static void |
---|
26 | gst_test_sink_chain (GstPad * pad, GstData * data) |
---|
27 | { |
---|
28 | data = gst_pad_pull (pad); |
---|
29 | } |
---|
30 | |
---|
31 | static void |
---|
32 | gst_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 | |
---|
39 | GST_BOILERPLATE (GstTestSink, gst_test_sink, GstElement, GST_TYPE_ELEMENT); |
---|
40 | |
---|
41 | int |
---|
42 | main (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 | } |
---|