6 static GstCaps* gst_replace_sink_getcaps (GstPad *pad);
7 static gboolean gst_replace_sink_setcaps (GstPad *pad, GstCaps *caps);
8 static gboolean gst_replace_sink_acceptcaps (GstPad *pad, GstCaps *caps);
9 static void gst_replace_sink_fixatecaps (GstPad *pad, GstCaps *caps);
10 static gboolean gst_replace_sink_activate (GstPad *pad);
11 static gboolean gst_replace_sink_activatepush (GstPad *pad, gboolean active);
12 static gboolean gst_replace_sink_activatepull (GstPad *pad, gboolean active);
13 static GstPadLinkReturn gst_replace_sink_link (GstPad *pad, GstPad *peer);
14 static void gst_replace_sink_unlink (GstPad *pad);
15 static GstFlowReturn gst_replace_sink_chain (GstPad *pad, GstBuffer *buffer);
16 static GstFlowReturn gst_replace_sink_chainlist (GstPad *pad, GstBufferList *bufferlist);
17 static gboolean gst_replace_sink_event (GstPad *pad, GstEvent *event);
18 static gboolean gst_replace_sink_query (GstPad *pad, GstQuery *query);
19 static GstFlowReturn gst_replace_sink_bufferalloc (GstPad *pad, guint64 offset, guint size,
20 GstCaps *caps, GstBuffer **buf);
21 static GstIterator * gst_replace_sink_iterintlink (GstPad *pad);
24 static GstStaticPadTemplate gst_replace_sink_template =
25 GST_STATIC_PAD_TEMPLATE ("sink",
28 GST_STATIC_CAPS ("application/unknown")
32 gst_element_class_add_pad_template (element_class,
33 gst_static_pad_template_get (&gst_replace_sink_template));
36 replace->sinkpad = gst_pad_new_from_static_template (&gst_replace_sink_template
39 gst_pad_set_getcaps_function (replace->sinkpad,
40 GST_DEBUG_FUNCPTR(gst_replace_sink_getcaps));
41 gst_pad_set_setcaps_function (replace->sinkpad,
42 GST_DEBUG_FUNCPTR(gst_replace_sink_setcaps));
43 gst_pad_set_acceptcaps_function (replace->sinkpad,
44 GST_DEBUG_FUNCPTR(gst_replace_sink_acceptcaps));
45 gst_pad_set_fixatecaps_function (replace->sinkpad,
46 GST_DEBUG_FUNCPTR(gst_replace_sink_fixatecaps));
47 gst_pad_set_activate_function (replace->sinkpad,
48 GST_DEBUG_FUNCPTR(gst_replace_sink_activate));
49 gst_pad_set_activatepush_function (replace->sinkpad,
50 GST_DEBUG_FUNCPTR(gst_replace_sink_activatepush));
51 gst_pad_set_activatepull_function (replace->sinkpad,
52 GST_DEBUG_FUNCPTR(gst_replace_sink_activatepull));
53 gst_pad_set_link_function (replace->sinkpad,
54 GST_DEBUG_FUNCPTR(gst_replace_sink_link));
55 gst_pad_set_unlink_function (replace->sinkpad,
56 GST_DEBUG_FUNCPTR(gst_replace_sink_unlink));
57 gst_pad_set_chain_function (replace->sinkpad,
58 GST_DEBUG_FUNCPTR(gst_replace_sink_chain));
59 gst_pad_set_chain_list_function (replace->sinkpad,
60 GST_DEBUG_FUNCPTR(gst_replace_sink_chainlist));
61 gst_pad_set_event_function (replace->sinkpad,
62 GST_DEBUG_FUNCPTR(gst_replace_sink_event));
63 gst_pad_set_query_function (replace->sinkpad,
64 GST_DEBUG_FUNCPTR(gst_replace_sink_query));
65 gst_pad_set_bufferalloc_function (replace->sinkpad,
66 GST_DEBUG_FUNCPTR(gst_replace_sink_bufferalloc));
67 gst_pad_set_iterate_internal_links_function (replace->sinkpad,
68 GST_DEBUG_FUNCPTR(gst_replace_sink_iterintlink));
69 gst_element_add_pad (GST_ELEMENT(replace), replace->sinkpad);
75 gst_replace_sink_getcaps (GstPad *pad)
80 replace = GST_REPLACE (gst_pad_get_parent (pad));
82 GST_DEBUG_OBJECT(replace, "getcaps");
84 caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
86 gst_object_unref (replace);
91 gst_replace_sink_setcaps (GstPad *pad, GstCaps *caps)
95 replace = GST_REPLACE (gst_pad_get_parent (pad));
97 GST_DEBUG_OBJECT(replace, "setcaps");
100 gst_object_unref (replace);
105 gst_replace_sink_acceptcaps (GstPad *pad, GstCaps *caps)
109 replace = GST_REPLACE (gst_pad_get_parent (pad));
111 GST_DEBUG_OBJECT(replace, "acceptcaps");
114 gst_object_unref (replace);
119 gst_replace_sink_fixatecaps (GstPad *pad, GstCaps *caps)
123 replace = GST_REPLACE (gst_pad_get_parent (pad));
125 GST_DEBUG_OBJECT(replace, "fixatecaps");
128 gst_object_unref (replace);
132 gst_replace_sink_activate (GstPad *pad)
137 replace = GST_REPLACE (gst_pad_get_parent (pad));
139 GST_DEBUG_OBJECT(replace, "activate");
141 if (gst_pad_check_pull_range (pad)) {
142 GST_DEBUG_OBJECT (pad, "activating pull");
143 ret = gst_pad_activate_pull (pad, TRUE);
145 GST_DEBUG_OBJECT (pad, "activating push");
146 ret = gst_pad_activate_push (pad, TRUE);
149 gst_object_unref (replace);
154 gst_replace_sink_activatepush (GstPad *pad, gboolean active)
158 replace = GST_REPLACE (gst_pad_get_parent (pad));
160 GST_DEBUG_OBJECT(replace, "activatepush");
163 gst_object_unref (replace);
168 gst_replace_sink_activatepull (GstPad *pad, gboolean active)
172 replace = GST_REPLACE (gst_pad_get_parent (pad));
174 GST_DEBUG_OBJECT(replace, "activatepull");
177 gst_object_unref (replace);
181 static GstPadLinkReturn
182 gst_replace_sink_link (GstPad *pad, GstPad *peer)
186 replace = GST_REPLACE (gst_pad_get_parent (pad));
188 GST_DEBUG_OBJECT(replace, "link");
191 gst_object_unref (replace);
192 return GST_PAD_LINK_OK;
196 gst_replace_sink_unlink (GstPad *pad)
200 replace = GST_REPLACE (gst_pad_get_parent (pad));
202 GST_DEBUG_OBJECT(replace, "unlink");
205 gst_object_unref (replace);
209 gst_replace_sink_chain (GstPad *pad, GstBuffer *buffer)
213 replace = GST_REPLACE (gst_pad_get_parent (pad));
215 GST_DEBUG_OBJECT(replace, "chain");
218 gst_object_unref (replace);
223 gst_replace_sink_chainlist (GstPad *pad, GstBufferList *bufferlist)
227 replace = GST_REPLACE (gst_pad_get_parent (pad));
229 GST_DEBUG_OBJECT(replace, "chainlist");
232 gst_object_unref (replace);
237 gst_replace_sink_event (GstPad *pad, GstEvent *event)
242 replace = GST_REPLACE (gst_pad_get_parent (pad));
244 GST_DEBUG_OBJECT(replace, "event");
246 switch (GST_EVENT_TYPE (event)) {
248 res = gst_pad_event_default (pad, event);
252 gst_object_unref (replace);
257 gst_replace_sink_query (GstPad *pad, GstQuery *query)
262 replace = GST_REPLACE (gst_pad_get_parent (pad));
264 GST_DEBUG_OBJECT(replace, "query");
266 switch (GST_QUERY_TYPE(query)) {
268 res = gst_pad_query_default (pad, query);
272 gst_object_unref (replace);
277 gst_replace_sink_bufferalloc (GstPad *pad, guint64 offset, guint size,
278 GstCaps *caps, GstBuffer **buf)
282 replace = GST_REPLACE (gst_pad_get_parent (pad));
284 GST_DEBUG_OBJECT(replace, "bufferalloc");
287 *buf = gst_buffer_new_and_alloc (size);
288 gst_buffer_set_caps (*buf, caps);
290 gst_object_unref (replace);
295 gst_replace_sink_iterintlink (GstPad *pad)
300 replace = GST_REPLACE (gst_pad_get_parent (pad));
302 GST_DEBUG_OBJECT(replace, "iterintlink");
304 iter = gst_pad_iterate_internal_links_default (pad);
306 gst_object_unref (replace);