• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* vim: set filetype=c: */
2% ClassName
3GstBaseSink
4% TYPE_CLASS_NAME
5GST_TYPE_BASE_SINK
6% pads
7sinkpad-simple
8% pkg-config
9gstreamer-base-1.0
10% includes
11#include <gst/base/gstbasesink.h>
12% prototypes
13static GstCaps *gst_replace_get_caps (GstBaseSink * sink, GstCaps * filter);
14static gboolean gst_replace_set_caps (GstBaseSink * sink, GstCaps * caps);
15static GstCaps *gst_replace_fixate (GstBaseSink * sink, GstCaps * caps);
16static gboolean gst_replace_activate_pull (GstBaseSink * sink, gboolean active);
17static void gst_replace_get_times (GstBaseSink * sink, GstBuffer * buffer,
18    GstClockTime * start, GstClockTime * end);
19static gboolean gst_replace_propose_allocation (GstBaseSink * sink,
20    GstQuery * query);
21static gboolean gst_replace_start (GstBaseSink * sink);
22static gboolean gst_replace_stop (GstBaseSink * sink);
23static gboolean gst_replace_unlock (GstBaseSink * sink);
24static gboolean gst_replace_unlock_stop (GstBaseSink * sink);
25static gboolean gst_replace_query (GstBaseSink * sink, GstQuery * query);
26static gboolean gst_replace_event (GstBaseSink * sink, GstEvent * event);
27static GstFlowReturn gst_replace_wait_event (GstBaseSink * sink,
28    GstEvent * event);
29static GstFlowReturn gst_replace_prepare (GstBaseSink * sink,
30    GstBuffer * buffer);
31static GstFlowReturn gst_replace_prepare_list (GstBaseSink * sink,
32    GstBufferList * buffer_list);
33static GstFlowReturn gst_replace_preroll (GstBaseSink * sink,
34    GstBuffer * buffer);
35static GstFlowReturn gst_replace_render (GstBaseSink * sink,
36    GstBuffer * buffer);
37static 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
61static GstCaps *
62gst_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 */
72static gboolean
73gst_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 */
83static GstCaps *
84gst_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 */
94static gboolean
95gst_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 */
105static void
106gst_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 */
116static gboolean
117gst_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 */
127static gboolean
128gst_replace_start (GstBaseSink * sink)
129{
130  GstReplace *replace = GST_REPLACE (sink);
131
132  GST_DEBUG_OBJECT (replace, "start");
133
134  return TRUE;
135}
136
137static gboolean
138gst_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. */
149static gboolean
150gst_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 */
162static gboolean
163gst_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 */
173static gboolean
174gst_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 */
184static gboolean
185gst_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 */
195static GstFlowReturn
196gst_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 */
206static GstFlowReturn
207gst_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
216static GstFlowReturn
217gst_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 */
227static GstFlowReturn
228gst_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
237static GstFlowReturn
238gst_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 */
248static GstFlowReturn
249gst_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
258