gst/gstcaps.c: Remove debug info.
[platform/upstream/gstreamer.git] / gst / gstpad.h
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wim.taymans@chello.be>
4  *
5  * gstpad.h: Header for GstPad object
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23
24 #ifndef __GST_PAD_H__
25 #define __GST_PAD_H__
26
27 #include <gst/gstconfig.h>
28
29 #include <gst/gstobject.h>
30 #include <gst/gstbuffer.h>
31 #include <gst/gstcaps.h>
32 #include <gst/gstevent.h>
33 #include <gst/gstquery.h>
34 #include <gst/gstqueryutils.h>
35 #include <gst/gsttask.h>
36
37
38 G_BEGIN_DECLS
39
40 GST_EXPORT GType _gst_pad_type;
41
42 /*
43  * Pad base class
44  */
45 #define GST_TYPE_PAD                    (_gst_pad_type)
46 #define GST_IS_PAD(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
47 #define GST_IS_PAD_FAST(obj)            (G_OBJECT_TYPE(obj) == GST_TYPE_PAD) /* necessary? */
48 #define GST_IS_PAD_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
49 #define GST_PAD(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
50 #define GST_PAD_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
51 #define GST_PAD_CAST(obj)               ((GstPad*)(obj))
52
53
54 /* why are these in gsttypes, again? */
55 /*typedef struct _GstPad GstPad;*/
56 /*typedef struct _GstPadClass GstPadClass;*/
57 /*typedef struct _GstPadTemplate GstPadTemplate;*/
58 /*typedef struct _GstPadTemplateClass GstPadTemplateClass;*/
59 typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
60
61 typedef enum {
62   GST_PAD_LINK_NOSCHED          = -5,   /* pads cannot cooperate in scheduling */
63   GST_PAD_LINK_NOFORMAT         = -4,   /* pads do not have common format */
64   GST_PAD_LINK_REFUSED          = -3,   /* refused for some reason */
65   GST_PAD_LINK_WRONG_DIRECTION  = -2,   /* pads have wrong direction */
66   GST_PAD_LINK_WAS_LINKED       = -1,   /* pad was already linked */
67   GST_PAD_LINK_OK               =  0,   /* link ok */
68 } GstPadLinkReturn;
69
70 #define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
71 #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
72
73 typedef enum {
74   GST_FLOW_RESEND         =  1,         /* resend buffer, possibly with new caps */
75   GST_FLOW_OK             =  0,         /* data passing was ok */
76   /* expected failures */
77   GST_FLOW_NOT_LINKED     = -1,         /* pad is not linked */
78   GST_FLOW_WRONG_STATE    = -2,         /* pad is in wrong state */
79   /* error cases */
80   GST_FLOW_UNEXPECTED     = -3,         /* did not expect anything, like after EOS */
81   GST_FLOW_NOT_NEGOTIATED = -4,         /* pad is not negotiated */
82   GST_FLOW_ERROR          = -5,         /* some (fatal) error occured */
83   GST_FLOW_NOT_SUPPORTED  = -6          /* function not supported */
84 } GstFlowReturn;
85
86 #define GST_FLOW_IS_FATAL(ret) ((ret) <= GST_FLOW_UNEXPECTED)
87
88 typedef enum {
89   GST_ACTIVATE_NONE,
90   GST_ACTIVATE_PUSH,
91   GST_ACTIVATE_PULL,
92 } GstActivateMode;
93
94 #define GST_PAD_MODE_ACTIVATE(mode) ((mode) != GST_ACTIVATE_NONE)
95
96 /* pad states */
97 typedef gboolean                (*GstPadActivateFunction)       (GstPad *pad);
98 typedef gboolean                (*GstPadActivateModeFunction)   (GstPad *pad, gboolean active);
99
100 /* data passing */
101 typedef GstFlowReturn           (*GstPadChainFunction)          (GstPad *pad, GstBuffer *buffer);
102 typedef GstFlowReturn           (*GstPadGetRangeFunction)       (GstPad *pad, guint64 offset,
103                                                                  guint length, GstBuffer **buffer);
104 typedef gboolean                (*GstPadEventFunction)          (GstPad *pad, GstEvent *event);
105
106 /* deprecate me, check range should use seeking query */
107 typedef gboolean                (*GstPadCheckGetRangeFunction)  (GstPad *pad);
108
109 /* internal links */
110 typedef GList*                  (*GstPadIntLinkFunction)        (GstPad *pad);
111
112 /* generic query function */
113 typedef const GstQueryType*     (*GstPadQueryTypeFunction)      (GstPad *pad);
114 typedef gboolean                (*GstPadQueryFunction)          (GstPad *pad, GstQuery *query);
115
116 /* linking */
117 typedef GstPadLinkReturn        (*GstPadLinkFunction)           (GstPad *pad, GstPad *peer);
118 typedef void                    (*GstPadUnlinkFunction)         (GstPad *pad);
119
120 /* caps nego */
121 typedef GstCaps*                (*GstPadGetCapsFunction)        (GstPad *pad);
122 typedef gboolean                (*GstPadSetCapsFunction)        (GstPad *pad, GstCaps *caps);
123 typedef gboolean                (*GstPadAcceptCapsFunction)     (GstPad *pad, GstCaps *caps);
124 typedef void                    (*GstPadFixateCapsFunction)     (GstPad *pad, GstCaps *caps);
125 typedef GstFlowReturn           (*GstPadBufferAllocFunction)    (GstPad *pad, guint64 offset, guint size,
126                                                                  GstCaps *caps, GstBuffer **buf);
127 /* misc */
128 typedef gboolean                (*GstPadDispatcherFunction)     (GstPad *pad, gpointer data);
129
130 typedef void                    (*GstPadBlockCallback)          (GstPad *pad, gboolean blocked, gpointer user_data);
131
132 typedef enum {
133   GST_PAD_UNKNOWN,
134   GST_PAD_SRC,
135   GST_PAD_SINK
136 } GstPadDirection;
137
138 typedef enum {
139   GST_PAD_BLOCKED               = GST_OBJECT_FLAG_LAST,
140   GST_PAD_FLUSHING,
141   GST_PAD_IN_GETCAPS,
142   GST_PAD_IN_SETCAPS,
143
144   GST_PAD_FLAG_LAST             = GST_OBJECT_FLAG_LAST + 8
145 } GstPadFlags;
146
147 struct _GstPad {
148   GstObject                     object;
149
150   gpointer                      element_private;
151
152   GstPadTemplate                *padtemplate;
153
154   /* direction cannot change after creating the pad */
155   GstPadDirection                direction;
156
157   /*< public >*/ /* with STREAM_LOCK */
158   /* streaming rec_lock */
159   GStaticRecMutex               *stream_rec_lock;
160   GstTask                       *task;
161   /*< public >*/ /* with PREROLL_LOCK */
162   GMutex                        *preroll_lock;
163   GCond                         *preroll_cond;
164
165   /*< public >*/ /* with LOCK */
166   /* block cond, mutex is from the object */
167   GCond                         *block_cond;
168   GstPadBlockCallback            block_callback;
169   gpointer                       block_data;
170
171   /* the pad capabilities */
172   GstCaps                       *caps;
173   GstPadGetCapsFunction         getcapsfunc;
174   GstPadSetCapsFunction         setcapsfunc;
175   GstPadAcceptCapsFunction       acceptcapsfunc;
176   GstPadFixateCapsFunction       fixatecapsfunc;
177
178   GstPadActivateFunction         activatefunc;
179   GstPadActivateModeFunction     activatepushfunc;
180   GstPadActivateModeFunction     activatepullfunc;
181
182   /* pad link */
183   GstPadLinkFunction             linkfunc;
184   GstPadUnlinkFunction           unlinkfunc;
185   GstPad                        *peer;
186
187   gpointer                       sched_private;
188
189   /* data transport functions */
190   GstPadChainFunction            chainfunc;
191   GstPadCheckGetRangeFunction    checkgetrangefunc;
192   GstPadGetRangeFunction         getrangefunc;
193   GstPadEventFunction            eventfunc;
194
195   GstActivateMode                mode;
196
197   /* generic query method */
198   GstPadQueryTypeFunction        querytypefunc;
199   GstPadQueryFunction            queryfunc;
200
201   /* internal links */
202   GstPadIntLinkFunction          intlinkfunc;
203
204   GstPadBufferAllocFunction      bufferallocfunc;
205
206   /* whether to emit signals for have-data. counts number
207    * of handlers attached. */
208   gint                           do_buffer_signals;
209   gint                           do_event_signals;
210
211   /*< private >*/
212   gpointer _gst_reserved[GST_PADDING];
213 };
214
215 struct _GstPadClass {
216   GstObjectClass        parent_class;
217
218   /* signal callbacks */
219   void          (*linked)               (GstPad *pad, GstPad *peer);
220   void          (*unlinked)             (GstPad *pad, GstPad *peer);
221   void          (*request_link)         (GstPad *pad);
222   gboolean      (*have_data)            (GstPad *pad, GstMiniObject *data);
223
224   /*< private >*/
225   gpointer _gst_reserved[GST_PADDING];
226 };
227
228
229 /***** helper macros *****/
230 /* GstPad */
231 #define GST_PAD_NAME(pad)               (GST_OBJECT_NAME(pad))
232 #define GST_PAD_PARENT(pad)             (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
233 #define GST_PAD_ELEMENT_PRIVATE(pad)    (GST_PAD_CAST(pad)->element_private)
234 #define GST_PAD_PAD_TEMPLATE(pad)       (GST_PAD_CAST(pad)->padtemplate)
235 #define GST_PAD_DIRECTION(pad)          (GST_PAD_CAST(pad)->direction)
236 #define GST_PAD_TASK(pad)               (GST_PAD_CAST(pad)->task)
237 #define GST_PAD_ACTIVATE_MODE(pad)      (GST_PAD_CAST(pad)->mode)
238
239 #define GST_PAD_ACTIVATEFUNC(pad)       (GST_PAD_CAST(pad)->activatefunc)
240 #define GST_PAD_ACTIVATEPUSHFUNC(pad)   (GST_PAD_CAST(pad)->activatepushfunc)
241 #define GST_PAD_ACTIVATEPULLFUNC(pad)   (GST_PAD_CAST(pad)->activatepullfunc)
242 #define GST_PAD_CHAINFUNC(pad)          (GST_PAD_CAST(pad)->chainfunc)
243 #define GST_PAD_CHECKGETRANGEFUNC(pad)  (GST_PAD_CAST(pad)->checkgetrangefunc)
244 #define GST_PAD_GETRANGEFUNC(pad)       (GST_PAD_CAST(pad)->getrangefunc)
245 #define GST_PAD_EVENTFUNC(pad)          (GST_PAD_CAST(pad)->eventfunc)
246 #define GST_PAD_QUERYTYPEFUNC(pad)      (GST_PAD_CAST(pad)->querytypefunc)
247 #define GST_PAD_QUERYFUNC(pad)          (GST_PAD_CAST(pad)->queryfunc)
248 #define GST_PAD_INTLINKFUNC(pad)        (GST_PAD_CAST(pad)->intlinkfunc)
249
250 #define GST_PAD_PEER(pad)               (GST_PAD_CAST(pad)->peer)
251 #define GST_PAD_LINKFUNC(pad)           (GST_PAD_CAST(pad)->linkfunc)
252 #define GST_PAD_UNLINKFUNC(pad)         (GST_PAD_CAST(pad)->unlinkfunc)
253
254 #define GST_PAD_CAPS(pad)               (GST_PAD_CAST(pad)->caps)
255 #define GST_PAD_GETCAPSFUNC(pad)        (GST_PAD_CAST(pad)->getcapsfunc)
256 #define GST_PAD_SETCAPSFUNC(pad)        (GST_PAD_CAST(pad)->setcapsfunc)
257 #define GST_PAD_ACCEPTCAPSFUNC(pad)     (GST_PAD_CAST(pad)->acceptcapsfunc)
258 #define GST_PAD_FIXATECAPSFUNC(pad)     (GST_PAD_CAST(pad)->fixatecapsfunc)
259
260 #define GST_PAD_BUFFERALLOCFUNC(pad)    (GST_PAD_CAST(pad)->bufferallocfunc)
261
262 #define GST_PAD_DO_BUFFER_SIGNALS(pad)  (GST_PAD_CAST(pad)->do_buffer_signals)
263 #define GST_PAD_DO_EVENT_SIGNALS(pad)   (GST_PAD_CAST(pad)->do_event_signals)
264
265 #define GST_PAD_IS_LINKED(pad)          (GST_PAD_PEER(pad) != NULL)
266 #define GST_PAD_IS_BLOCKED(pad)         (GST_FLAG_IS_SET (pad, GST_PAD_BLOCKED))
267 #define GST_PAD_IS_FLUSHING(pad)        (GST_FLAG_IS_SET (pad, GST_PAD_FLUSHING))
268 #define GST_PAD_IS_IN_GETCAPS(pad)      (GST_FLAG_IS_SET (pad, GST_PAD_IN_GETCAPS))
269 #define GST_PAD_IS_IN_SETCAPS(pad)      (GST_FLAG_IS_SET (pad, GST_PAD_IN_SETCAPS))
270 #define GST_PAD_IS_USABLE(pad)          (GST_PAD_IS_LINKED (pad) && \
271                                          !GST_PAD_IS_FLUSHING(pad) && !GST_PAD_IS_FLUSHING(GST_PAD_PEER (pad)))
272 #define GST_PAD_IS_SRC(pad)             (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
273 #define GST_PAD_IS_SINK(pad)            (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
274
275 #define GST_PAD_SET_FLUSHING(pad)       (GST_FLAG_SET (pad, GST_PAD_FLUSHING))
276 #define GST_PAD_UNSET_FLUSHING(pad)     (GST_FLAG_UNSET (pad, GST_PAD_FLUSHING))
277
278 #define GST_STREAM_GET_LOCK(pad)        (GST_PAD_CAST(pad)->stream_rec_lock)
279 #define GST_STREAM_LOCK(pad)            (g_static_rec_mutex_lock(GST_STREAM_GET_LOCK(pad)))
280 #define GST_STREAM_TRYLOCK(pad)         (g_static_rec_mutex_trylock(GST_STREAM_GET_LOCK(pad)))
281 #define GST_STREAM_UNLOCK(pad)          (g_static_rec_mutex_unlock(GST_STREAM_GET_LOCK(pad)))
282 #define GST_STREAM_UNLOCK_FULL(pad)     (g_static_rec_mutex_unlock_full(GST_STREAM_GET_LOCK(pad)))
283 #define GST_STREAM_LOCK_FULL(pad,t)     (g_static_rec_mutex_lock_full(GST_STREAM_GET_LOCK(pad), t))
284
285 #define GST_PREROLL_GET_LOCK(pad)       (GST_PAD_CAST(pad)->preroll_lock)
286 #define GST_PREROLL_LOCK(pad)           (g_mutex_lock(GST_PREROLL_GET_LOCK(pad)))
287 #define GST_PREROLL_TRYLOCK(pad)        (g_mutex_trylock(GST_PREROLL_GET_LOCK(pad)))
288 #define GST_PREROLL_UNLOCK(pad)         (g_mutex_unlock(GST_PREROLL_GET_LOCK(pad)))
289 #define GST_PREROLL_GET_COND(pad)       (GST_PAD_CAST(pad)->preroll_cond)
290 #define GST_PREROLL_WAIT(pad)           g_cond_wait (GST_PREROLL_GET_COND (pad), GST_PREROLL_GET_LOCK (pad))
291 #define GST_PREROLL_TIMED_WAIT(pad, timeval) g_cond_timed_wait (GST_PREROLL_GET_COND (pad), GST_PREROLL_GET_LOCK (pad),\
292                                              timeval)
293 #define GST_PREROLL_SIGNAL(pad)         g_cond_signal (GST_PREROLL_GET_COND (pad));
294 #define GST_PREROLL_BROADCAST(pad)      g_cond_broadcast (GST_PREROLL_GET_COND (pad));
295
296 #define GST_PAD_BLOCK_GET_COND(pad)     (GST_PAD_CAST(pad)->block_cond)
297 #define GST_PAD_BLOCK_WAIT(pad)         (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_GET_LOCK (pad)))
298 #define GST_PAD_BLOCK_SIGNAL(pad)       (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
299
300 /***** PadTemplate *****/
301 #define GST_TYPE_PAD_TEMPLATE           (gst_pad_template_get_type ())
302 #define GST_PAD_TEMPLATE(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
303 #define GST_PAD_TEMPLATE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD_TEMPLATE,GstPadTemplateClass))
304 #define GST_IS_PAD_TEMPLATE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD_TEMPLATE))
305 #define GST_IS_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD_TEMPLATE))
306
307 typedef enum {
308   GST_PAD_ALWAYS,
309   GST_PAD_SOMETIMES,
310   GST_PAD_REQUEST
311 } GstPadPresence;
312
313 #define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ)   (((GstPadTemplate *)(templ))->name_template)
314 #define GST_PAD_TEMPLATE_DIRECTION(templ)       (((GstPadTemplate *)(templ))->direction)
315 #define GST_PAD_TEMPLATE_PRESENCE(templ)        (((GstPadTemplate *)(templ))->presence)
316 #define GST_PAD_TEMPLATE_CAPS(templ)            (((GstPadTemplate *)(templ))->caps)
317
318 typedef enum {
319   GST_PAD_TEMPLATE_FIXED        = GST_OBJECT_FLAG_LAST,
320
321   GST_PAD_TEMPLATE_FLAG_LAST    = GST_OBJECT_FLAG_LAST + 4
322 } GstPadTemplateFlags;
323
324 #define GST_PAD_TEMPLATE_IS_FIXED(templ)        (GST_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
325
326 struct _GstPadTemplate {
327   GstObject        object;
328
329   gchar           *name_template;
330   GstPadDirection  direction;
331   GstPadPresence   presence;
332   GstCaps         *caps;
333
334   gpointer _gst_reserved[GST_PADDING];
335 };
336
337 struct _GstPadTemplateClass {
338   GstObjectClass   parent_class;
339
340   /* signal callbacks */
341   void (*pad_created)   (GstPadTemplate *templ, GstPad *pad);
342
343   gpointer _gst_reserved[GST_PADDING];
344 };
345
346 struct _GstStaticPadTemplate {
347   gchar           *name_template;
348   GstPadDirection  direction;
349   GstPadPresence   presence;
350   GstStaticCaps   static_caps;
351 };
352
353 #define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
354   { \
355   /* name_template */    padname, \
356   /* direction */        dir, \
357   /* presence */         pres, \
358   /* caps */             caps \
359   }
360
361
362 GType                   gst_pad_get_type                        (void);
363
364 /* creating pads */
365 GstPad*                 gst_pad_new                             (const gchar *name, GstPadDirection direction);
366 GstPad*                 gst_pad_new_from_template               (GstPadTemplate *templ, const gchar *name);
367
368 #define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
369 GstElement*             gst_pad_get_parent                      (GstPad *pad);
370
371 GstPadDirection         gst_pad_get_direction                   (GstPad *pad);
372
373 gboolean                gst_pad_set_active                      (GstPad *pad, gboolean active);
374 gboolean                gst_pad_is_active                       (GstPad *pad);
375 gboolean                gst_pad_activate_pull                   (GstPad *pad, gboolean active);
376 gboolean                gst_pad_activate_push                   (GstPad *pad, gboolean active);
377
378 gboolean                gst_pad_set_blocked                     (GstPad *pad, gboolean blocked);
379 gboolean                gst_pad_set_blocked_async               (GstPad *pad, gboolean blocked,
380                                                                  GstPadBlockCallback callback, gpointer user_data);
381 gboolean                gst_pad_is_blocked                      (GstPad *pad);
382
383 void                    gst_pad_set_element_private             (GstPad *pad, gpointer priv);
384 gpointer                gst_pad_get_element_private             (GstPad *pad);
385
386 GstPadTemplate*         gst_pad_get_pad_template                (GstPad *pad);
387
388 void                    gst_pad_set_bufferalloc_function        (GstPad *pad, GstPadBufferAllocFunction bufalloc);
389 GstFlowReturn           gst_pad_alloc_buffer                    (GstPad *pad, guint64 offset, gint size,
390                                                                  GstCaps *caps, GstBuffer **buf);
391
392 /* data passing setup functions */
393 void                    gst_pad_set_activate_function           (GstPad *pad, GstPadActivateFunction activate);
394 void                    gst_pad_set_activatepull_function       (GstPad *pad, GstPadActivateModeFunction activatepull);
395 void                    gst_pad_set_activatepush_function       (GstPad *pad, GstPadActivateModeFunction activatepush);
396 void                    gst_pad_set_chain_function              (GstPad *pad, GstPadChainFunction chain);
397 void                    gst_pad_set_getrange_function           (GstPad *pad, GstPadGetRangeFunction get);
398 void                    gst_pad_set_checkgetrange_function      (GstPad *pad, GstPadCheckGetRangeFunction check);
399 void                    gst_pad_set_event_function              (GstPad *pad, GstPadEventFunction event);
400
401 /* pad links */
402 void                    gst_pad_set_link_function               (GstPad *pad, GstPadLinkFunction link);
403 void                    gst_pad_set_unlink_function             (GstPad *pad, GstPadUnlinkFunction unlink);
404
405 GstPadLinkReturn        gst_pad_link                            (GstPad *srcpad, GstPad *sinkpad);
406 gboolean                gst_pad_unlink                          (GstPad *srcpad, GstPad *sinkpad);
407 gboolean                gst_pad_is_linked                       (GstPad *pad);
408
409 GstPad*                 gst_pad_get_peer                        (GstPad *pad);
410
411 /* capsnego functions */
412 void                    gst_pad_set_getcaps_function            (GstPad *pad, GstPadGetCapsFunction getcaps);
413 void                    gst_pad_set_acceptcaps_function         (GstPad *pad, GstPadAcceptCapsFunction acceptcaps);
414 void                    gst_pad_set_fixatecaps_function         (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
415 void                    gst_pad_set_setcaps_function            (GstPad *pad, GstPadSetCapsFunction setcaps);
416
417 G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps           (GstPad *pad);
418
419 /* capsnego function for connected/unconnected pads */
420 GstCaps *               gst_pad_get_caps                        (GstPad * pad);
421 void                    gst_pad_fixate_caps                     (GstPad * pad, GstCaps *caps);
422 gboolean                gst_pad_accept_caps                     (GstPad * pad, GstCaps *caps);
423 gboolean                gst_pad_set_caps                        (GstPad * pad, GstCaps *caps);
424
425 GstCaps *               gst_pad_peer_get_caps                   (GstPad * pad);
426 gboolean                gst_pad_peer_accept_caps                (GstPad * pad, GstCaps *caps);
427
428 /* capsnego for connected pads */
429 GstCaps *               gst_pad_get_allowed_caps                (GstPad * srcpad);
430 GstCaps *               gst_pad_get_negotiated_caps             (GstPad * pad);
431
432 /* data passing functions to peer */
433 GstFlowReturn           gst_pad_push                            (GstPad *pad, GstBuffer *buffer);
434 gboolean                gst_pad_check_pull_range                (GstPad *pad);
435 GstFlowReturn           gst_pad_pull_range                      (GstPad *pad, guint64 offset, guint size,
436                                                                  GstBuffer **buffer);
437 gboolean                gst_pad_push_event                      (GstPad *pad, GstEvent *event);
438 gboolean                gst_pad_event_default                   (GstPad *pad, GstEvent *event);
439
440 /* data passing functions on pad */
441 GstFlowReturn           gst_pad_chain                           (GstPad *pad, GstBuffer *buffer);
442 GstFlowReturn           gst_pad_get_range                       (GstPad *pad, guint64 offset, guint size,
443                                                                  GstBuffer **buffer);
444 gboolean                gst_pad_send_event                      (GstPad *pad, GstEvent *event);
445
446 /* pad tasks */
447 gboolean                gst_pad_start_task                      (GstPad *pad, GstTaskFunction func,
448                                                                  gpointer data);
449 gboolean                gst_pad_pause_task                      (GstPad *pad);
450 gboolean                gst_pad_stop_task                       (GstPad *pad);
451
452 /* internal links */
453 void                    gst_pad_set_internal_link_function      (GstPad *pad, GstPadIntLinkFunction intlink);
454 GList*                  gst_pad_get_internal_links              (GstPad *pad);
455 GList*                  gst_pad_get_internal_links_default      (GstPad *pad);
456
457 /* generic query function */
458 void                    gst_pad_set_query_type_function         (GstPad *pad, GstPadQueryTypeFunction type_func);
459 G_CONST_RETURN GstQueryType*
460                         gst_pad_get_query_types                 (GstPad *pad);
461 G_CONST_RETURN GstQueryType*
462                         gst_pad_get_query_types_default         (GstPad *pad);
463
464 gboolean                gst_pad_query                           (GstPad *pad, GstQuery *query);
465 void                    gst_pad_set_query_function              (GstPad *pad, GstPadQueryFunction query);
466 gboolean                gst_pad_query_default                   (GstPad *pad, GstQuery *query);
467
468 /* misc helper functions */
469 gboolean                gst_pad_dispatcher                      (GstPad *pad, GstPadDispatcherFunction dispatch,
470                                                                  gpointer data);
471
472 #ifndef GST_DISABLE_LOADSAVE
473 void                    gst_pad_load_and_link                   (xmlNodePtr self, GstObject *parent);
474 #endif
475
476
477 /* templates and factories */
478 GType                   gst_pad_template_get_type               (void);
479
480 GstPadTemplate*         gst_pad_template_new                    (const gchar *name_template,
481                                                                  GstPadDirection direction, GstPadPresence presence,
482                                                                  GstCaps *caps);
483
484 GstPadTemplate *        gst_static_pad_template_get             (GstStaticPadTemplate *pad_template);
485 GstCaps*                gst_static_pad_template_get_caps        (GstStaticPadTemplate *templ);
486 GstCaps*                gst_pad_template_get_caps               (GstPadTemplate *templ);
487
488
489 G_END_DECLS
490
491 #endif /* __GST_PAD_H__ */