1 /* vim: set filetype=c: */
5 GST_TYPE_BASE_TRANSFORM
12 #include <gst/base/gstbasetransform.h>
14 static GstCaps *gst_replace_transform_caps (GstBaseTransform * trans,
15 GstPadDirection direction, GstCaps * caps, GstCaps * filter);
16 static GstCaps *gst_replace_fixate_caps (GstBaseTransform * trans,
17 GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
18 static gboolean gst_replace_accept_caps (GstBaseTransform * trans,
19 GstPadDirection direction, GstCaps * caps);
20 static gboolean gst_replace_set_caps (GstBaseTransform * trans,
21 GstCaps * incaps, GstCaps * outcaps);
22 static gboolean gst_replace_query (GstBaseTransform * trans,
23 GstPadDirection direction, GstQuery * query);
24 static gboolean gst_replace_decide_allocation (GstBaseTransform * trans,
26 static gboolean gst_replace_filter_meta (GstBaseTransform * trans,
27 GstQuery * query, GType api, const GstStructure * params);
28 static gboolean gst_replace_propose_allocation (GstBaseTransform * trans,
29 GstQuery * decide_query, GstQuery * query);
30 static gboolean gst_replace_transform_size (GstBaseTransform * trans,
31 GstPadDirection direction, GstCaps * caps, gsize size, GstCaps * othercaps,
33 static gboolean gst_replace_get_unit_size (GstBaseTransform * trans,
34 GstCaps * caps, gsize * size);
35 static gboolean gst_replace_start (GstBaseTransform * trans);
36 static gboolean gst_replace_stop (GstBaseTransform * trans);
37 static gboolean gst_replace_sink_event (GstBaseTransform * trans,
39 static gboolean gst_replace_src_event (GstBaseTransform * trans,
41 static GstFlowReturn gst_replace_prepare_output_buffer (GstBaseTransform *
42 trans, GstBuffer * input, GstBuffer ** outbuf);
43 static gboolean gst_replace_copy_metadata (GstBaseTransform * trans,
44 GstBuffer * input, GstBuffer * outbuf);
45 static gboolean gst_replace_transform_meta (GstBaseTransform * trans,
46 GstBuffer * outbuf, GstMeta * meta, GstBuffer * inbuf);
47 static void gst_replace_before_transform (GstBaseTransform * trans,
49 static GstFlowReturn gst_replace_transform (GstBaseTransform * trans,
50 GstBuffer * inbuf, GstBuffer * outbuf);
51 static GstFlowReturn gst_replace_transform_ip (GstBaseTransform * trans,
54 GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
56 base_transform_class->transform_caps = GST_DEBUG_FUNCPTR (gst_replace_transform_caps);
57 base_transform_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_replace_fixate_caps);
58 base_transform_class->accept_caps = GST_DEBUG_FUNCPTR (gst_replace_accept_caps);
59 base_transform_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
60 base_transform_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
61 base_transform_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_replace_decide_allocation);
62 base_transform_class->filter_meta = GST_DEBUG_FUNCPTR (gst_replace_filter_meta);
63 base_transform_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_replace_propose_allocation);
64 base_transform_class->transform_size = GST_DEBUG_FUNCPTR (gst_replace_transform_size);
65 base_transform_class->get_unit_size = GST_DEBUG_FUNCPTR (gst_replace_get_unit_size);
66 base_transform_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
67 base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
68 base_transform_class->sink_event = GST_DEBUG_FUNCPTR (gst_replace_sink_event);
69 base_transform_class->src_event = GST_DEBUG_FUNCPTR (gst_replace_src_event);
70 base_transform_class->prepare_output_buffer = GST_DEBUG_FUNCPTR (gst_replace_prepare_output_buffer);
71 base_transform_class->copy_metadata = GST_DEBUG_FUNCPTR (gst_replace_copy_metadata);
72 base_transform_class->transform_meta = GST_DEBUG_FUNCPTR (gst_replace_transform_meta);
73 base_transform_class->before_transform = GST_DEBUG_FUNCPTR (gst_replace_before_transform);
74 base_transform_class->transform = GST_DEBUG_FUNCPTR (gst_replace_transform);
75 base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_ip);
78 gst_replace_transform_caps (GstBaseTransform * trans, GstPadDirection direction,
79 GstCaps * caps, GstCaps * filter)
81 GstReplace *replace = GST_REPLACE (trans);
83 GST_DEBUG_OBJECT (replace, "transform_caps");
89 gst_replace_fixate_caps (GstBaseTransform * trans, GstPadDirection direction,
90 GstCaps * caps, GstCaps * othercaps)
92 GstReplace *replace = GST_REPLACE (trans);
94 GST_DEBUG_OBJECT (replace, "fixate_caps");
100 gst_replace_accept_caps (GstBaseTransform * trans, GstPadDirection direction,
103 GstReplace *replace = GST_REPLACE (trans);
105 GST_DEBUG_OBJECT (replace, "accept_caps");
111 gst_replace_set_caps (GstBaseTransform * trans, GstCaps * incaps,
114 GstReplace *replace = GST_REPLACE (trans);
116 GST_DEBUG_OBJECT (replace, "set_caps");
122 gst_replace_query (GstBaseTransform * trans, GstPadDirection direction,
125 GstReplace *replace = GST_REPLACE (trans);
127 GST_DEBUG_OBJECT (replace, "query");
132 /* decide allocation query for output buffers */
134 gst_replace_decide_allocation (GstBaseTransform * trans, GstQuery * query)
136 GstReplace *replace = GST_REPLACE (trans);
138 GST_DEBUG_OBJECT (replace, "decide_allocation");
144 gst_replace_filter_meta (GstBaseTransform * trans, GstQuery * query, GType api,
145 const GstStructure * params)
147 GstReplace *replace = GST_REPLACE (trans);
149 GST_DEBUG_OBJECT (replace, "filter_meta");
154 /* propose allocation query parameters for input buffers */
156 gst_replace_propose_allocation (GstBaseTransform * trans,
157 GstQuery * decide_query, GstQuery * query)
159 GstReplace *replace = GST_REPLACE (trans);
161 GST_DEBUG_OBJECT (replace, "propose_allocation");
168 gst_replace_transform_size (GstBaseTransform * trans, GstPadDirection direction,
169 GstCaps * caps, gsize size, GstCaps * othercaps, gsize * othersize)
171 GstReplace *replace = GST_REPLACE (trans);
173 GST_DEBUG_OBJECT (replace, "transform_size");
179 gst_replace_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
182 GstReplace *replace = GST_REPLACE (trans);
184 GST_DEBUG_OBJECT (replace, "get_unit_size");
191 gst_replace_start (GstBaseTransform * trans)
193 GstReplace *replace = GST_REPLACE (trans);
195 GST_DEBUG_OBJECT (replace, "start");
201 gst_replace_stop (GstBaseTransform * trans)
203 GstReplace *replace = GST_REPLACE (trans);
205 GST_DEBUG_OBJECT (replace, "stop");
210 /* sink and src pad event handlers */
212 gst_replace_sink_event (GstBaseTransform * trans, GstEvent * event)
214 GstReplace *replace = GST_REPLACE (trans);
216 GST_DEBUG_OBJECT (replace, "sink_event");
218 return GST_BASE_TRANSFORM_CLASS (gst_replace_parent_class)->sink_event (
223 gst_replace_src_event (GstBaseTransform * trans, GstEvent * event)
225 GstReplace *replace = GST_REPLACE (trans);
227 GST_DEBUG_OBJECT (replace, "src_event");
229 return GST_BASE_TRANSFORM_CLASS (gst_replace_parent_class)->src_event (
234 gst_replace_prepare_output_buffer (GstBaseTransform * trans, GstBuffer * input,
237 GstReplace *replace = GST_REPLACE (trans);
239 GST_DEBUG_OBJECT (replace, "prepare_output_buffer");
246 gst_replace_copy_metadata (GstBaseTransform * trans, GstBuffer * input,
249 GstReplace *replace = GST_REPLACE (trans);
251 GST_DEBUG_OBJECT (replace, "copy_metadata");
257 gst_replace_transform_meta (GstBaseTransform * trans, GstBuffer * outbuf,
258 GstMeta * meta, GstBuffer * inbuf)
260 GstReplace *replace = GST_REPLACE (trans);
262 GST_DEBUG_OBJECT (replace, "transform_meta");
268 gst_replace_before_transform (GstBaseTransform * trans, GstBuffer * buffer)
270 GstReplace *replace = GST_REPLACE (trans);
272 GST_DEBUG_OBJECT (replace, "before_transform");
278 gst_replace_transform (GstBaseTransform * trans, GstBuffer * inbuf,
281 GstReplace *replace = GST_REPLACE (trans);
283 GST_DEBUG_OBJECT (replace, "transform");
289 gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
291 GstReplace *replace = GST_REPLACE (trans);
293 GST_DEBUG_OBJECT (replace, "transform_ip");