Debian Codegraph @

tools/element-templates/basesink

raw
1 /* vim: set filetype=c: */
2 % ClassName
3 GstBaseSink
4 % TYPE_CLASS_NAME
5 GST_TYPE_BASE_SINK
6 % pads
7 sinkpad-simple
8 % pkg-config
9 gstreamer-base-1.0
10 % includes
11 #include <gst/base/gstbasesink.h>
12 % prototypes
13 static GstCaps *gst_replace_get_caps (GstBaseSink * sink, GstCaps * filter);
14 static gboolean gst_replace_set_caps (GstBaseSink * sink, GstCaps * caps);
15 static GstCaps *gst_replace_fixate (GstBaseSink * sink, GstCaps * caps);
16 static gboolean gst_replace_activate_pull (GstBaseSink * sink, gboolean active);
17 static void gst_replace_get_times (GstBaseSink * sink, GstBuffer * buffer,
18 GstClockTime * start, GstClockTime * end);
19 static gboolean gst_replace_propose_allocation (GstBaseSink * sink,
20 GstQuery * query);
21 static gboolean gst_replace_start (GstBaseSink * sink);
22 static gboolean gst_replace_stop (GstBaseSink * sink);
23 static gboolean gst_replace_unlock (GstBaseSink * sink);
24 static gboolean gst_replace_unlock_stop (GstBaseSink * sink);
25 static gboolean gst_replace_query (GstBaseSink * sink, GstQuery * query);
26 static gboolean gst_replace_event (GstBaseSink * sink, GstEvent * event);
27 static GstFlowReturn gst_replace_wait_event (GstBaseSink * sink,
28 GstEvent * event);
29 static GstFlowReturn gst_replace_prepare (GstBaseSink * sink,
30 GstBuffer * buffer);
31 static GstFlowReturn gst_replace_prepare_list (GstBaseSink * sink,
32 GstBufferList * buffer_list);
33 static GstFlowReturn gst_replace_preroll (GstBaseSink * sink,
34 GstBuffer * buffer);
35 static GstFlowReturn gst_replace_render (GstBaseSink * sink,
36 GstBuffer * buffer);
37 static GstFlowReturn gst_replace_render_list (GstBaseSink * sink,
38 GstBufferList * buffer_list);
39 % declare-class
40 GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
41 % set-methods
42 base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps);
43 base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps);
44 base_sink_class->fixate = GST_DEBUG_FUNCPTR (gst_replace_fixate);
45 base_sink_class->activate_pull = GST_DEBUG_FUNCPTR (gst_replace_activate_pull);
46 base_sink_class->get_times = GST_DEBUG_FUNCPTR (gst_replace_get_times);
47 base_sink_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_replace_propose_allocation);
48 base_sink_class->start = GST_DEBUG_FUNCPTR (gst_replace_start);
49 base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop);
50 base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_replace_unlock);
51 base_sink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_replace_unlock_stop);
52 base_sink_class->query = GST_DEBUG_FUNCPTR (gst_replace_query);
53 base_sink_class->event = GST_DEBUG_FUNCPTR (gst_replace_event);
54 base_sink_class->wait_event = GST_DEBUG_FUNCPTR (gst_replace_wait_event);
55 base_sink_class->prepare = GST_DEBUG_FUNCPTR (gst_replace_prepare);
56 base_sink_class->prepare_list = GST_DEBUG_FUNCPTR (gst_replace_prepare_list);
57 base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_replace_preroll);
58 base_sink_class->render = GST_DEBUG_FUNCPTR (gst_replace_render);
59 base_sink_class->render_list = GST_DEBUG_FUNCPTR (gst_replace_render_list);
60 % methods
61 static GstCaps *
62 gst_replace_get_caps (GstBaseSink * sink, GstCaps * filter)
63 {
64 GstReplace *replace = GST_REPLACE (sink);
65
66 GST_DEBUG_OBJECT (replace, "get_caps");
67
68 return NULL;
69 }
70
71 /* notify subclass of new caps */
72 static gboolean
73 gst_replace_set_caps (GstBaseSink * sink, GstCaps * caps)
74 {
75 GstReplace *replace = GST_REPLACE (sink);
76
77 GST_DEBUG_OBJECT (replace, "set_caps");
78
79 return TRUE;
80 }
81
82 /* fixate sink caps during pull-mode negotiation */
83 static GstCaps *
84 gst_replace_fixate (GstBaseSink * sink, GstCaps * caps)
85 {
86 GstReplace *replace = GST_REPLACE (sink);
87
88 GST_DEBUG_OBJECT (replace, "fixate");
89
90 return NULL;
91 }
92
93 /* start or stop a pulling thread */
94 static gboolean
95 gst_replace_activate_pull (GstBaseSink * sink, gboolean active)
96 {
97 GstReplace *replace = GST_REPLACE (sink);
98
99 GST_DEBUG_OBJECT (replace, "activate_pull");
100
101 return TRUE;
102 }
103
104 /* get the start and end times for syncing on this buffer */
105 static void
106 gst_replace_get_times (GstBaseSink * sink, GstBuffer * buffer,
107 GstClockTime * start, GstClockTime * end)
108 {
109 GstReplace *replace = GST_REPLACE (sink);
110
111 GST_DEBUG_OBJECT (replace, "get_times");
112
113 }
114
115 /* propose allocation parameters for upstream */
116 static gboolean
117 gst_replace_propose_allocation (GstBaseSink * sink, GstQuery * query)
118 {
119 GstReplace *replace = GST_REPLACE (sink);
120
121 GST_DEBUG_OBJECT (replace, "propose_allocation");
122
123 return TRUE;
124 }
125
126 /* start and stop processing, ideal for opening/closing the resource */
127 static gboolean
128 gst_replace_start (GstBaseSink * sink)
129 {
130 GstReplace *replace = GST_REPLACE (sink);
131
132 GST_DEBUG_OBJECT (replace, "start");
133
134 return TRUE;
135 }
136
137 static gboolean
138 gst_replace_stop (GstBaseSink * sink)
139 {
140 GstReplace *replace = GST_REPLACE (sink);
141
142 GST_DEBUG_OBJECT (replace, "stop");
143
144 return TRUE;
145 }
146
147 /* unlock any pending access to the resource. subclasses should unlock
148 * any function ASAP. */
149 static gboolean
150 gst_replace_unlock (GstBaseSink * sink)
151 {
152 GstReplace *replace = GST_REPLACE (sink);
153
154 GST_DEBUG_OBJECT (replace, "unlock");
155
156 return TRUE;
157 }
158
159 /* Clear a previously indicated unlock request not that unlocking is
160 * complete. Sub-classes should clear any command queue or indicator they
161 * set during unlock */
162 static gboolean
163 gst_replace_unlock_stop (GstBaseSink * sink)
164 {
165 GstReplace *replace = GST_REPLACE (sink);
166
167 GST_DEBUG_OBJECT (replace, "unlock_stop");
168
169 return TRUE;
170 }
171
172 /* notify subclass of query */
173 static gboolean
174 gst_replace_query (GstBaseSink * sink, GstQuery * query)
175 {
176 GstReplace *replace = GST_REPLACE (sink);
177
178 GST_DEBUG_OBJECT (replace, "query");
179
180 return TRUE;
181 }
182
183 /* notify subclass of event */
184 static gboolean
185 gst_replace_event (GstBaseSink * sink, GstEvent * event)
186 {
187 GstReplace *replace = GST_REPLACE (sink);
188
189 GST_DEBUG_OBJECT (replace, "event");
190
191 return TRUE;
192 }
193
194 /* wait for eos or gap, subclasses should chain up to parent first */
195 static GstFlowReturn
196 gst_replace_wait_event (GstBaseSink * sink, GstEvent * event)
197 {
198 GstReplace *replace = GST_REPLACE (sink);
199
200 GST_DEBUG_OBJECT (replace, "wait_event");
201
202 return GST_FLOW_OK;
203 }
204
205 /* notify subclass of buffer or list before doing sync */
206 static GstFlowReturn
207 gst_replace_prepare (GstBaseSink * sink, GstBuffer * buffer)
208 {
209 GstReplace *replace = GST_REPLACE (sink);
210
211 GST_DEBUG_OBJECT (replace, "prepare");
212
213 return GST_FLOW_OK;
214 }
215
216 static GstFlowReturn
217 gst_replace_prepare_list (GstBaseSink * sink, GstBufferList * buffer_list)
218 {
219 GstReplace *replace = GST_REPLACE (sink);
220
221 GST_DEBUG_OBJECT (replace, "prepare_list");
222
223 return GST_FLOW_OK;
224 }
225
226 /* notify subclass of preroll buffer or real buffer */
227 static GstFlowReturn
228 gst_replace_preroll (GstBaseSink * sink, GstBuffer * buffer)
229 {
230 GstReplace *replace = GST_REPLACE (sink);
231
232 GST_DEBUG_OBJECT (replace, "preroll");
233
234 return GST_FLOW_OK;
235 }
236
237 static GstFlowReturn
238 gst_replace_render (GstBaseSink * sink, GstBuffer * buffer)
239 {
240 GstReplace *replace = GST_REPLACE (sink);
241
242 GST_DEBUG_OBJECT (replace, "render");
243
244 return GST_FLOW_OK;
245 }
246
247 /* Render a BufferList */
248 static GstFlowReturn
249 gst_replace_render_list (GstBaseSink * sink, GstBufferList * buffer_list)
250 {
251 GstReplace *replace = GST_REPLACE (sink);
252
253 GST_DEBUG_OBJECT (replace, "render_list");
254
255 return GST_FLOW_OK;
256 }
257 % end