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