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