diff --git a/gst/gstpad.c b/gst/gstpad.c index f4781909ff..bd59ee201c 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -232,6 +232,10 @@ gst_real_pad_init (GstRealPad *pad) pad->convertfunc = gst_pad_convert_default; pad->queryfunc = gst_pad_query_default; pad->intconnfunc = gst_pad_get_internal_connections_default; + + pad->eventmaskfunc = gst_pad_get_event_masks_default; + pad->formatsfunc = gst_pad_get_formats_default; + pad->querytypefunc = gst_pad_get_query_types_default; } static void @@ -241,15 +245,7 @@ gst_real_pad_set_property (GObject *object, guint prop_id, const GValue *value, switch (prop_id) { case REAL_ARG_ACTIVE: - if (g_value_get_boolean (value)) { - GST_DEBUG (GST_CAT_PADS, "activating pad %s:%s", GST_DEBUG_PAD_NAME (object)); - GST_FLAG_UNSET (object, GST_PAD_DISABLED); - } else { - GST_DEBUG (GST_CAT_PADS, "de-activating pad %s:%s", GST_DEBUG_PAD_NAME (object)); - GST_FLAG_SET (object, GST_PAD_DISABLED); - } - g_signal_emit (G_OBJECT (object), gst_real_pad_signals[REAL_SET_ACTIVE], 0, - !GST_FLAG_IS_SET (object, GST_PAD_DISABLED)); + gst_pad_set_active (GST_PAD (object), g_value_get_boolean (value)); break; default: break; @@ -376,6 +372,36 @@ gst_pad_get_direction (GstPad *pad) return GST_PAD_DIRECTION (pad); } +/** + * gst_pad_set_active: + * @pad: the Pad to activate or deactivate + * + * Activate or deactivate the given pad + */ +void +gst_pad_set_active (GstPad *pad, gboolean active) +{ + GstRealPad *realpad; + + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_PAD (pad)); + + if (GST_PAD_IS_ACTIVE (pad) == active) + return; + + realpad = GST_PAD_REALIZE (pad); + + if (active) { + GST_DEBUG (GST_CAT_PADS, "activating pad %s:%s", GST_DEBUG_PAD_NAME (realpad)); + GST_FLAG_UNSET (realpad, GST_PAD_DISABLED); + } else { + GST_DEBUG (GST_CAT_PADS, "de-activating pad %s:%s", GST_DEBUG_PAD_NAME (realpad)); + GST_FLAG_SET (realpad, GST_PAD_DISABLED); + } + g_signal_emit (G_OBJECT (realpad), gst_real_pad_signals[REAL_SET_ACTIVE], 0, + !GST_FLAG_IS_SET (realpad, GST_PAD_DISABLED)); +} + /** * gst_pad_set_name: * @pad: the pad to set the name of @@ -443,7 +469,8 @@ gst_pad_set_get_function (GstPad *pad, g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_REAL_PAD (pad)); - GST_RPAD_GETFUNC(pad) = get; + GST_RPAD_GETFUNC (pad) = get; + GST_DEBUG (GST_CAT_PADS, "getfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (get)); } @@ -462,11 +489,83 @@ gst_pad_set_event_function (GstPad *pad, g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_REAL_PAD (pad)); - GST_RPAD_EVENTFUNC(pad) = event; + GST_RPAD_EVENTFUNC (pad) = event; + GST_DEBUG (GST_CAT_PADS, "eventfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (event)); } +void +gst_pad_set_event_mask_function (GstPad *pad, GstPadEventMaskFunction mask_function) +{ + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_REAL_PAD (pad)); + + GST_RPAD_EVENTMASKFUNC (pad) = mask_function; + + GST_DEBUG (GST_CAT_PADS, "eventmaskfunc for %s:%s set to %s", + GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (mask_function)); +} + +const GstEventMask* +gst_pad_get_event_masks (GstPad *pad) +{ + GstRealPad *rpad; + + if (pad == NULL) + return FALSE; + + rpad = GST_PAD_REALIZE (pad); + + g_return_val_if_fail (rpad, FALSE); + + if (GST_RPAD_EVENTMASKFUNC (rpad)) + return GST_RPAD_EVENTMASKFUNC (rpad) (GST_PAD_CAST (pad)); + + return NULL; +} + +static gboolean +gst_pad_get_event_masks_dispatcher (GstPad *pad, const GstFormat **data) +{ + *data = gst_pad_get_formats (pad); + + return TRUE; +} + +const GstEventMask* +gst_pad_get_event_masks_default (GstPad *pad) +{ + GstEventMask *result = NULL; + + gst_pad_dispatcher (pad, (GstPadDispatcherFunction) gst_pad_get_event_masks_dispatcher, &result); + + return result; +} + +gboolean +gst_pad_handles_event (GstPad *pad, GstEventMask *mask) +{ + const GstEventMask *masks; + + g_return_val_if_fail (pad != NULL, FALSE); + g_return_val_if_fail (mask != NULL, FALSE); + + masks = gst_pad_get_event_masks (pad); + if (!masks) + return FALSE; + + while (masks->type) { + if (masks->type == mask->type && + (masks->flags & mask->flags) == mask->flags) + return TRUE; + + masks++; + } + + return FALSE; +} + /** * gst_pad_set_convert_function: * @pad: the pad to set the event handler for @@ -481,7 +580,8 @@ gst_pad_set_convert_function (GstPad *pad, g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_REAL_PAD (pad)); - GST_RPAD_CONVERTFUNC(pad) = convert; + GST_RPAD_CONVERTFUNC (pad) = convert; + GST_DEBUG (GST_CAT_PADS, "convertfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (convert)); } @@ -500,10 +600,59 @@ gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query) g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_QUERYFUNC(pad) = query; + GST_DEBUG (GST_CAT_PADS, "queryfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (query)); } +void +gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func) +{ + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_REAL_PAD (pad)); + + GST_RPAD_QUERYTYPEFUNC (pad) = type_func; + + GST_DEBUG (GST_CAT_PADS, "querytypefunc for %s:%s set to %s", + GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (type_func)); +} + +const GstPadQueryType* +gst_pad_get_query_types (GstPad *pad) +{ + GstRealPad *rpad; + + if (pad == NULL) + return FALSE; + + rpad = GST_PAD_REALIZE (pad); + + g_return_val_if_fail (rpad, FALSE); + + if (GST_RPAD_QUERYTYPEFUNC (rpad)) + return GST_RPAD_QUERYTYPEFUNC (rpad) (GST_PAD_CAST (pad)); + + return NULL; +} + +static gboolean +gst_pad_get_query_types_dispatcher (GstPad *pad, const GstPadQueryType **data) +{ + *data = gst_pad_get_query_types (pad); + + return TRUE; +} + +const GstPadQueryType* +gst_pad_get_query_types_default (GstPad *pad) +{ + GstPadQueryType *result = NULL; + + gst_pad_dispatcher (pad, (GstPadDispatcherFunction) gst_pad_get_query_types_dispatcher, &result); + + return result; +} + /** * gst_pad_set_internal_connection_function: * @pad: the pad to set the internal connection function for @@ -522,6 +671,24 @@ gst_pad_set_internal_connection_function (GstPad *pad, GstPadIntConnFunction int GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (intconn)); } +/** + * gst_pad_set_formats_function: + * @pad: the pad to set the formats function for + * @formats: the formats function to set + * + * Set the given formats function to the pad + */ +void +gst_pad_set_formats_function (GstPad *pad, GstPadFormatsFunction formats) +{ + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_REAL_PAD (pad)); + + GST_RPAD_FORMATSFUNC(pad) = formats; + GST_DEBUG (GST_CAT_PADS, "formats function for %s:%s set to %s", + GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (formats)); +} + /** * gst_pad_set_connect_function: * @pad: the pad to set the connect function for @@ -1049,11 +1216,11 @@ gst_pad_try_set_caps_func (GstRealPad *pad, GstCaps *caps, gboolean notify) g_return_val_if_fail (pad != NULL, GST_PAD_CONNECT_REFUSED); g_return_val_if_fail (GST_IS_PAD (pad), GST_PAD_CONNECT_REFUSED); - /* if this pad has a parent and the parent is not READY, delay the + /* if this pad has a parent and the parent is not PAUSED, delay the * negotiation */ - if (parent && GST_STATE (parent) < GST_STATE_READY) + if (parent && GST_STATE (parent) < GST_STATE_PAUSED) { - GST_DEBUG (GST_CAT_CAPS, "parent %s of pad %s:%s is not ready", + GST_DEBUG (GST_CAT_CAPS, "parent %s of pad %s:%s is not paused", GST_ELEMENT_NAME (parent), GST_DEBUG_PAD_NAME (pad)); return GST_PAD_CONNECT_DELAYED; } @@ -1823,7 +1990,6 @@ gst_pad_ghost_save_thyself (GstPad *pad, } #endif /* GST_DISABLE_LOADSAVE */ -#ifndef gst_pad_push /** * gst_pad_push: * @pad: the pad to push @@ -1865,9 +2031,7 @@ gst_pad_push (GstPad *pad, GstBuffer *buf) gst_data_unref (GST_DATA (buf)); } } -#endif -#ifndef gst_pad_pull /** * gst_pad_pull: * @pad: the pad to pull @@ -1918,7 +2082,6 @@ gst_pad_pull (GstPad *pad) } return NULL; } -#endif /** * gst_pad_peek: @@ -2342,7 +2505,7 @@ gst_pad_event_default_dispatch (GstPad *pad, GstElement *element, GstEvent *even pads = g_list_next (pads); /* for all pads in the opposite direction that are connected */ - if (GST_PAD_DIRECTION (eventpad) != GST_PAD_DIRECTION (pad) && GST_PAD_IS_CONNECTED (eventpad)) { + if (GST_PAD_DIRECTION (eventpad) != GST_PAD_DIRECTION (pad) && GST_PAD_IS_USABLE (eventpad)) { if (GST_PAD_DIRECTION (eventpad) == GST_PAD_SRC) { /* increase the refcount */ gst_event_ref (event); @@ -2428,7 +2591,7 @@ gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch, gpointer dat GstRealPad *int_rpad = GST_PAD_REALIZE (int_pads->data); GstRealPad *int_peer = GST_RPAD_PEER (int_rpad); - if (int_peer && GST_PAD_IS_CONNECTED (int_peer)) { + if (int_peer && GST_PAD_IS_USABLE (int_peer)) { res = dispatch (GST_PAD_CAST (int_peer), data); if (res) break; @@ -2457,7 +2620,7 @@ gst_pad_send_event (GstPad *pad, GstEvent *event) g_return_val_if_fail (event, FALSE); - if (!pad || (GST_PAD_IS_SINK (pad) && !GST_PAD_IS_CONNECTED (pad))) + if (!pad || (GST_PAD_IS_SINK (pad) && !GST_PAD_IS_USABLE (pad))) return FALSE; if (GST_EVENT_SRC (event) == NULL) @@ -2636,3 +2799,59 @@ gst_pad_query (GstPad *pad, GstPadQueryType type, return FALSE; } + +gboolean +gst_pad_handles_format (GstPad *pad, GstFormat format) +{ + const GstFormat *formats; + + formats = gst_pad_get_formats (pad); + if (!formats) + return FALSE; + + while (*formats) { + if (*formats == format) + return TRUE; + + formats++; + } + + return FALSE; +} + +static gboolean +gst_pad_get_formats_dispatcher (GstPad *pad, const GstFormat **data) +{ + *data = gst_pad_get_formats (pad); + + return TRUE; +} + +const GstFormat* +gst_pad_get_formats_default (GstPad *pad) +{ + GstFormat *result = NULL; + + gst_pad_dispatcher (pad, (GstPadDispatcherFunction) gst_pad_get_formats_dispatcher, &result); + + return result; +} + +const GstFormat* +gst_pad_get_formats (GstPad *pad) +{ + GstRealPad *rpad; + + if (pad == NULL) + return FALSE; + + rpad = GST_PAD_REALIZE (pad); + + g_return_val_if_fail (rpad, FALSE); + + if (GST_RPAD_FORMATSFUNC (rpad)) + return GST_RPAD_FORMATSFUNC (rpad) (GST_PAD_CAST (pad)); + + return NULL; +} + diff --git a/gst/gstpad.h b/gst/gstpad.h index fd621648e5..3c9af2ff0b 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -43,7 +43,7 @@ extern GType _gst_ghost_pad_type; /* * Pad base class */ -#define GST_TYPE_PAD (_gst_pad_type) +#define GST_TYPE_PAD (_gst_pad_type) #define GST_PAD_CAST(obj) ((GstPad*)(obj)) #define GST_PAD_CLASS_CAST(klass) ((GstPadClass*)(klass)) @@ -117,10 +117,12 @@ typedef enum { } GstPadConnectReturn; typedef enum { + GST_PAD_QUERY_NONE = 0, GST_PAD_QUERY_TOTAL, GST_PAD_QUERY_POSITION, GST_PAD_QUERY_LATENCY, - GST_PAD_QUERY_JITTER + GST_PAD_QUERY_JITTER, + GST_PAD_QUERY_SEGMENT_END } GstPadQueryType; /* this defines the functions used to chain buffers @@ -135,6 +137,9 @@ typedef gboolean (*GstPadConvertFunction) (GstPad *pad, typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstPadQueryType type, GstFormat *format, gint64 *value); typedef GList* (*GstPadIntConnFunction) (GstPad *pad); +typedef const GstFormat* (*GstPadFormatsFunction) (GstPad *pad); +typedef const GstEventMask* (*GstPadEventMaskFunction) (GstPad *pad); +typedef const GstPadQueryType* (*GstPadQueryTypeFunction) (GstPad *pad); typedef GstPadConnectReturn (*GstPadConnectFunction) (GstPad *pad, GstCaps *caps); typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad, GstCaps *caps); @@ -168,36 +173,43 @@ struct _GstPadClass { }; struct _GstRealPad { - GstPad pad; + GstPad pad; + /* the pad cpabilities */ GstCaps *caps; GstCaps *filter; GstCaps *appfilter; - GstPadDirection direction; + GstPadGetCapsFunction getcapsfunc; + + GstPadDirection direction; GstScheduler *sched; - gpointer sched_private; + gpointer sched_private; + GstPadConnectFunction connectfunc; GstRealPad *peer; GstBuffer *bufpen; - GstPadChainFunction chainfunc; - GstPadChainFunction chainhandler; - GstPadGetFunction getfunc; - GstPadGetFunction gethandler; + /* data transport functions */ + GstPadChainFunction chainfunc; + GstPadChainFunction chainhandler; + GstPadGetFunction getfunc; + GstPadGetFunction gethandler; + GstPadEventFunction eventfunc; + GstPadEventFunction eventhandler; + GstPadEventMaskFunction eventmaskfunc; - GstPadEventFunction eventfunc; - GstPadEventFunction eventhandler; - GstPadConvertFunction convertfunc; - GstPadQueryFunction queryfunc; - GstPadIntConnFunction intconnfunc; + GList *ghostpads; - GstPadGetCapsFunction getcapsfunc; - GstPadConnectFunction connectfunc; - GstPadBufferPoolFunction bufferpoolfunc; + /* query/convert/formats functions */ + GstPadConvertFunction convertfunc; + GstPadQueryFunction queryfunc; + GstPadFormatsFunction formatsfunc; + GstPadQueryTypeFunction querytypefunc; + GstPadIntConnFunction intconnfunc; - GList *ghostpads; + GstPadBufferPoolFunction bufferpoolfunc; }; struct _GstRealPadClass { @@ -249,6 +261,12 @@ struct _GstGhostPadClass { #define GST_RPAD_CONVERTFUNC(pad) (((GstRealPad *)(pad))->convertfunc) #define GST_RPAD_QUERYFUNC(pad) (((GstRealPad *)(pad))->queryfunc) #define GST_RPAD_INTCONNFUNC(pad) (((GstRealPad *)(pad))->intconnfunc) +#define GST_RPAD_FORMATSFUNC(pad) (((GstRealPad *)(pad))->formatsfunc) +#define GST_RPAD_QUERYTYPEFUNC(pad) (((GstRealPad *)(pad))->querytypefunc) +#define GST_RPAD_EVENTMASKFUNC(pad) (((GstRealPad *)(pad))->eventmaskfunc) + +#define GST_RPAD_EVENT_MASKS(pad) (((GstRealPad *)(pad))->event_masks) +#define GST_RPAD_QUERY_TYPES(pad) (((GstRealPad *)(pad))->query_types) #define GST_RPAD_CONNECTFUNC(pad) (((GstRealPad *)(pad))->connectfunc) #define GST_RPAD_GETCAPSFUNC(pad) (((GstRealPad *)(pad))->getcapsfunc) @@ -265,6 +283,9 @@ struct _GstGhostPadClass { /* Some check functions (unused?) */ #define GST_PAD_IS_CONNECTED(pad) (GST_PAD_PEER(pad) != NULL) +#define GST_PAD_IS_ACTIVE(pad) (!GST_FLAG_IS_SET(pad, GST_PAD_DISABLED)) +#define GST_PAD_IS_USABLE(pad) (GST_PAD_IS_CONNECTED (pad) && \ + GST_PAD_IS_ACTIVE(pad) && GST_PAD_IS_ACTIVE(GST_PAD_PEER (pad))) #define GST_PAD_CAN_PULL(pad) (GST_IS_REAL_PAD(pad) && GST_REAL_PAD(pad)->gethandler != NULL) #define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC) #define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK) @@ -337,36 +358,24 @@ GType gst_pad_get_type (void); GType gst_real_pad_get_type (void); GType gst_ghost_pad_get_type (void); +/* creating pads */ GstPad* gst_pad_new (const gchar *name, GstPadDirection direction); #define gst_pad_destroy(pad) gst_object_destroy (GST_OBJECT (pad)) GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name); GstPad* gst_pad_custom_new (GType type, const gchar *name, GstPadDirection direction); GstPad* gst_pad_custom_new_from_template (GType type, GstPadTemplate *templ, const gchar *name); +void gst_pad_set_name (GstPad *pad, const gchar *name); +const gchar* gst_pad_get_name (GstPad *pad); + GstPadDirection gst_pad_get_direction (GstPad *pad); -void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain); -void gst_pad_set_get_function (GstPad *pad, GstPadGetFunction get); -void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event); -void gst_pad_set_convert_function (GstPad *pad, GstPadConvertFunction convert); -void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query); -void gst_pad_set_internal_connection_function (GstPad *pad, GstPadIntConnFunction intconn); - -void gst_pad_set_connect_function (GstPad *pad, GstPadConnectFunction connect); -void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps); -void gst_pad_set_bufferpool_function (GstPad *pad, GstPadBufferPoolFunction bufpool); - -GstCaps* gst_pad_get_caps (GstPad *pad); -GstCaps* gst_pad_get_pad_template_caps (GstPad *pad); -gboolean gst_pad_try_set_caps (GstPad *pad, GstCaps *caps); -gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad); +void gst_pad_set_active (GstPad *pad, gboolean active); +gboolean gst_pad_is_active (GstPad *pad); void gst_pad_set_element_private (GstPad *pad, gpointer priv); gpointer gst_pad_get_element_private (GstPad *pad); -void gst_pad_set_name (GstPad *pad, const gchar *name); -const gchar* gst_pad_get_name (GstPad *pad); - void gst_pad_set_parent (GstPad *pad, GstObject *parent); GstElement* gst_pad_get_parent (GstPad *pad); GstElement* gst_pad_get_real_parent (GstPad *pad); @@ -379,12 +388,22 @@ void gst_pad_add_ghost_pad (GstPad *pad, GstPad *ghostpad); void gst_pad_remove_ghost_pad (GstPad *pad, GstPad *ghostpad); GList* gst_pad_get_ghost_pad_list (GstPad *pad); -GstPadTemplate* gst_pad_get_pad_template (GstPad *pad); - -GstPad* gst_pad_get_peer (GstPad *pad); +GstPadTemplate* gst_pad_get_pad_template (GstPad *pad); +void gst_pad_set_bufferpool_function (GstPad *pad, GstPadBufferPoolFunction bufpool); GstBufferPool* gst_pad_get_bufferpool (GstPad *pad); +/* data passing setup functions */ +void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain); +void gst_pad_set_get_function (GstPad *pad, GstPadGetFunction get); +void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event); +void gst_pad_set_event_mask_function (GstPad *pad, GstPadEventMaskFunction mask_func); +const GstEventMask* gst_pad_get_event_masks (GstPad *pad); +const GstEventMask* gst_pad_get_event_masks_default (GstPad *pad); +gboolean gst_pad_handles_event (GstPad *pad, GstEventMask *mask); + +/* pad connections */ +void gst_pad_set_connect_function (GstPad *pad, GstPadConnectFunction connect); gboolean gst_pad_can_connect (GstPad *srcpad, GstPad *sinkpad); gboolean gst_pad_can_connect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps); @@ -392,6 +411,15 @@ gboolean gst_pad_connect (GstPad *srcpad, GstPad *s gboolean gst_pad_connect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps); void gst_pad_disconnect (GstPad *srcpad, GstPad *sinkpad); +GstPad* gst_pad_get_peer (GstPad *pad); + +/* capsnego functions */ +GstCaps* gst_pad_get_caps (GstPad *pad); +GstCaps* gst_pad_get_pad_template_caps (GstPad *pad); +gboolean gst_pad_try_set_caps (GstPad *pad, GstCaps *caps); +gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad); + +void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps); GstPadConnectReturn gst_pad_proxy_connect (GstPad *pad, GstCaps *caps); gboolean gst_pad_reconnect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps); gboolean gst_pad_perform_negotiate (GstPad *srcpad, GstPad *sinkpad); @@ -399,26 +427,23 @@ gboolean gst_pad_try_reconnect_filtered (GstPad *srcpad, GstPad *sinkpad, GstC GstCaps* gst_pad_get_allowed_caps (GstPad *pad); gboolean gst_pad_recalc_allowed_caps (GstPad *pad); -#if 1 +/* data passing functions */ void gst_pad_push (GstPad *pad, GstBuffer *buf); -#else -#define gst_pad_push(pad,buf) G_STMT_START{ \ - if (((GstRealPad *)(pad))->peer->chainhandler) \ - (((GstRealPad *)(pad))->peer->chainhandler)((GstPad *)(((GstRealPad *)(pad))->peer),(buf)); \ -}G_STMT_END -#endif -#if 1 GstBuffer* gst_pad_pull (GstPad *pad); -#else -#define gst_pad_pull(pad) \ - ( (((GstRealPad *)(pad))->peer->gethandler) ? \ -(((GstRealPad *)(pad))->peer->gethandler)((GstPad *)(((GstRealPad *)(pad))->peer)) : \ -NULL ) -#endif - gboolean gst_pad_send_event (GstPad *pad, GstEvent *event); gboolean gst_pad_event_default (GstPad *pad, GstEvent *event); +GstBuffer* gst_pad_peek (GstPad *pad); +GstPad* gst_pad_select (GList *padlist); +GstPad* gst_pad_selectv (GstPad *pad, ...); + +/* convert/query/format functions */ +void gst_pad_set_formats_function (GstPad *pad, GstPadFormatsFunction format); +gboolean gst_pad_handles_format (GstPad *pad, GstFormat format); +const GstFormat* gst_pad_get_formats (GstPad *pad); +const GstFormat* gst_pad_get_formats_default (GstPad *pad); + +void gst_pad_set_convert_function (GstPad *pad, GstPadConvertFunction convert); gboolean gst_pad_convert (GstPad *pad, GstFormat src_format, gint64 src_value, GstFormat *dest_format, gint64 *dest_value); @@ -426,22 +451,24 @@ gboolean gst_pad_convert_default (GstPad *pad, GstFormat src_format, gint64 src_value, GstFormat *dest_format, gint64 *dest_value); +void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query); +void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_function); +const GstPadQueryType* gst_pad_get_query_types (GstPad *pad); +const GstPadQueryType* gst_pad_get_query_types_default (GstPad *pad); gboolean gst_pad_query (GstPad *pad, GstPadQueryType type, GstFormat *format, gint64 *value); gboolean gst_pad_query_default (GstPad *pad, GstPadQueryType type, GstFormat *format, gint64 *value); +void gst_pad_set_internal_connection_function(GstPad *pad, GstPadIntConnFunction intconn); GList* gst_pad_get_internal_connections (GstPad *pad); GList* gst_pad_get_internal_connections_default (GstPad *pad); +/* misc helper functions */ gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch, gpointer data); -GstBuffer* gst_pad_peek (GstPad *pad); -GstPad* gst_pad_select (GList *padlist); -GstPad* gst_pad_selectv (GstPad *pad, ...); - #ifndef GST_DISABLE_LOADSAVE void gst_pad_load_and_connect (xmlNodePtr self, GstObject *parent); #endif