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