ProxyPad

GhostPads are useful when organizing pipelines with GstBin like elements. The idea here is to create hierarchical element graphs. The bin element contains a sub-graph. Now one would like to treat the bin-element like any other GstElement. This is where GhostPads come into play. A GhostPad acts as a proxy for another pad. Thus the bin can have sink and source ghost-pads that are associated with sink and source pads of the child elements.

If the target pad is known at creation time, gst_ghost_pad_new() is the function to use to get a ghost-pad. Otherwise one can use gst_ghost_pad_new_no_target() to create the ghost-pad and use gst_ghost_pad_set_target() to establish the association later on.

Note that GhostPads add overhead to the data processing of a pipeline.

Last reviewed on 2005-11-18 (0.9.5)

Constructors

this
this(GstProxyPad* gstProxyPad)

Sets our main struct and passes it to the parent class

Members

Functions

chainDefault
GstFlowReturn chainDefault(ObjectGst parent, Buffer buffer)

Invoke the default chain function of the proxy pad.

chainListDefault
GstFlowReturn chainListDefault(ObjectGst parent, BufferList list)

Invoke the default chain list function of the proxy pad.

getInternal
ProxyPad getInternal()

Get the internal pad of pad. Unref target pad after usage. The internal pad of a GstGhostPad is the internally used pad of opposite direction, which is used to link to the target.

getProxyPadStruct
GstProxyPad* getProxyPadStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

getrangeDefault
GstFlowReturn getrangeDefault(ObjectGst parent, ulong offset, uint size, Buffer buffer)

returns GST_FLOW_ERROR if NULL. Invoke the default getrange function of the proxy pad.

iterateInternalLinksDefault
Iterator iterateInternalLinksDefault(ObjectGst parent)

Invoke the default iterate internal links function of the proxy pad.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

gstProxyPad
GstProxyPad* gstProxyPad;

the main Gtk struct

Inherited Members

From Pad

gstPad
GstPad* gstPad;

the main Gtk struct

getPadStruct
GstPad* getPadStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
queryPosition
long queryPosition()

Queries a pad for the stream position. This is a convenience function for gstreamerD.

queryDuration
long queryDuration()

Queries a pad for the stream duration. This is a convenience function for gstreamerD.

connectedSignals
int[string] connectedSignals;
onLinkedListeners
void delegate(Pad, Pad)[] onLinkedListeners;
Undocumented in source.
addOnLinked
void addOnLinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags)

Signals that a pad has been linked to the peer pad.

callBackLinked
void callBackLinked(GstPad* padStruct, GstPad* peer, Pad _pad)
Undocumented in source. Be warned that the author may not have intended to support it.
onUnlinkedListeners
void delegate(Pad, Pad)[] onUnlinkedListeners;
Undocumented in source.
addOnUnlinked
void addOnUnlinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags)

Signals that a pad has been unlinked from the peer pad. See Also GstPadTemplate, GstElement, GstEvent, GstQuery, GstBuffer

callBackUnlinked
void callBackUnlinked(GstPad* padStruct, GstPad* peer, Pad _pad)
Undocumented in source. Be warned that the author may not have intended to support it.
gstFlowGetName
string gstFlowGetName(GstFlowReturn ret)

Gets a string representing the given flow return.

gstFlowToQuark
GQuark gstFlowToQuark(GstFlowReturn ret)

Get the unique quark for the given GstFlowReturn.

modeGetName
string modeGetName(GstPadMode mode)

Return the name of a pad mode, for use in debug messages mostly.

getDirection
GstPadDirection getDirection()

Gets the direction of the pad. The direction of the pad is decided at construction time so this function does not take the LOCK.

getParentElement
Element getParentElement()

Gets the parent of pad, cast to a GstElement. If a pad has no parent or its parent is not an element, return NULL.

getPadTemplate
PadTemplate getPadTemplate()

Gets the template for pad.

link
GstPadLinkReturn link(Pad sinkpad)

Links the source pad and the sink pad.

linkFull
GstPadLinkReturn linkFull(Pad sinkpad, GstPadLinkCheck flags)

Links the source pad and the sink pad. This variant of gst_pad_link provides a more granular control on the checks being done when linking. While providing some considerable speedups the caller of this method must be aware that wrong usage of those flags can cause severe issues. Refer to the documentation of GstPadLinkCheck for more information. MT Safe.

unlink
int unlink(Pad sinkpad)

Unlinks the source pad from the sink pad. Will emit the "unlinked" signal on both pads.

isLinked
int isLinked()

Checks if a pad is linked to another pad or not.

canLink
int canLink(Pad sinkpad)

Checks if the source pad and the sink pad are compatible so they can be linked.

getAllowedCaps
Caps getAllowedCaps()

Gets the capabilities of the allowed media types that can flow through pad and its peer. The allowed capabilities is calculated as the intersection of the results of calling gst_pad_query_caps() on pad and its peer. The caller owns a reference on the resulting caps.

getCurrentCaps
Caps getCurrentCaps()

Gets the capabilities currently configured on pad with the last GST_EVENT_CAPS event.

getPadTemplateCaps
Caps getPadTemplateCaps()

Gets the capabilities for pad's template.

getPeer
Pad getPeer()

Gets the peer of pad. This function refs the peer pad so you need to unref it after use.

useFixedCaps
void useFixedCaps()

A helper function you can use that sets the FIXED_CAPS flag This way the default CAPS query will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps. The negotiated caps are the caps of the last CAPS event that passed on the pad. Use this function on a pad that, once it negotiated to a CAPS, cannot be renegotiated to something else.

hasCurrentCaps
int hasCurrentCaps()

Check if pad has caps set on it with a GST_EVENT_CAPS event.

getStickyEvent
Event getStickyEvent(GstEventType eventType, uint idx)

Returns a new reference of the sticky event of type event_type from the event.

stickyEventsForeach
void stickyEventsForeach(GstPadStickyEventsForeachFunction foreachFunc, void* userData)

Iterates all sticky events on pad and calls foreach_func for every event. If foreach_func returns FALSE the iteration is immediately stopped.

isActive
int isActive()

Query if a pad is active

probeInfoGetBuffer
Buffer probeInfoGetBuffer(GstPadProbeInfo* info)
probeInfoGetBufferList
BufferList probeInfoGetBufferList(GstPadProbeInfo* info)
probeInfoGetEvent
Event probeInfoGetEvent(GstPadProbeInfo* info)
probeInfoGetQuery
Query probeInfoGetQuery(GstPadProbeInfo* info)
addProbe
gulong addProbe(GstPadProbeType mask, GstPadProbeCallback callback, void* userData, GDestroyNotify destroyData)

Be notified of different states of pads. The provided callback is called for every state that matches mask.

removeProbe
void removeProbe(gulong id)

Remove the probe with id from pad. MT safe.

isBlocked
int isBlocked()

Checks if the pad is blocked or not. This function returns the last requested state of the pad. It is not certain that the pad is actually blocking at this point (see gst_pad_is_blocking()).

isBlocking
int isBlocking()

Checks if the pad is blocking or not. This is a guaranteed state of whether the pad is actually blocking on a GstBuffer or a GstEvent.

getOffset
long getOffset()

Get the offset applied to the running time of pad. pad has to be a source pad.

setOffset
void setOffset(long offset)

Set the offset that will be applied to the running time of pad.

setChainFunctionFull
void setChainFunctionFull(GstPadChainFunction chain, void* userData, GDestroyNotify notify)

Sets the given chain function for the pad. The chain function is called to process a GstBuffer input buffer. see GstPadChainFunction for more details.

setChainListFunctionFull
void setChainListFunctionFull(GstPadChainListFunction chainlist, void* userData, GDestroyNotify notify)

Sets the given chain list function for the pad. The chainlist function is called to process a GstBufferList input buffer list. See GstPadChainListFunction for more details.

getRange
GstFlowReturn getRange(ulong offset, uint size, Buffer buffer)

returns GST_FLOW_ERROR if NULL. When pad is flushing this function returns GST_FLOW_FLUSHING immediately and buffer is NULL. Calls the getrange function of pad, see GstPadGetRangeFunction for a description of a getrange function. If pad has no getrange function installed (see gst_pad_set_getrange_function()) this function returns GST_FLOW_NOT_SUPPORTED. If buffer points to a variable holding NULL, a valid new GstBuffer will be placed in buffer when this function returns GST_FLOW_OK. The new buffer must be freed with gst_buffer_unref() after usage. When buffer points to a variable that points to a valid GstBuffer, the buffer will be filled with the result data when this function returns GST_FLOW_OK. If the provided buffer is larger than size, only size bytes will be filled in the result buffer and its size will be updated accordingly. Note that less than size bytes can be returned in buffer when, for example, an EOS condition is near or when buffer is not large enough to hold size bytes. The caller should check the result buffer size to get the result size. When this function returns any other result value than GST_FLOW_OK, buffer will be unchanged. This is a lowlevel function. Usualy gst_pad_pull_range() is used.

setGetrangeFunctionFull
void setGetrangeFunctionFull(GstPadGetRangeFunction get, void* userData, GDestroyNotify notify)

Sets the given getrange function for the pad. The getrange function is called to produce a new GstBuffer to start the processing pipeline. see GstPadGetRangeFunction for a description of the getrange function.

setEventFunctionFull
void setEventFunctionFull(GstPadEventFunction event, void* userData, GDestroyNotify notify)

Sets the given event handler for the pad.

setLinkFunctionFull
void setLinkFunctionFull(GstPadLinkFunction link, void* userData, GDestroyNotify notify)

Sets the given link function for the pad. It will be called when the pad is linked with another pad. The return value GST_PAD_LINK_OK should be used when the connection can be made. The return value GST_PAD_LINK_REFUSED should be used when the connection cannot be made for some reason. If link is installed on a source pad, it should call the GstPadLinkFunction of the peer sink pad, if present.

setUnlinkFunctionFull
void setUnlinkFunctionFull(GstPadUnlinkFunction unlink, void* userData, GDestroyNotify notify)

Sets the given unlink function for the pad. It will be called when the pad is unlinked.

proxyQueryCaps
int proxyQueryCaps(Query query)

Calls gst_pad_query_caps() for all internally linked pads fof pad and returns the intersection of the results. This function is useful as a default caps query function for an element that can handle any stream format, but requires all its pads to have the same caps. Two such elements are tee and adder.

proxyQueryAcceptCaps
int proxyQueryAcceptCaps(Query query)

Calls gst_pad_accept_caps() for all internally linked pads of pad and returns the intersection of the results. This function is useful as a default accept caps query function for an element that can handle any stream format, but requires caps that are acceptable for all oposite pads.

setActivateFunctionFull
void setActivateFunctionFull(GstPadActivateFunction activate, void* userData, GDestroyNotify notify)

Sets the given activate function for pad. The activate function will dispatch to gst_pad_activate_mode() to perform the actual activation. Only makes sense to set on sink pads. Call this function if your sink pad can start a pull-based task.

setActivatemodeFunctionFull
void setActivatemodeFunctionFull(GstPadActivateModeFunction activatemode, void* userData, GDestroyNotify notify)

Sets the given activate_mode function for the pad. An activate_mode function prepares the element for data passing.

needsReconfigure
int needsReconfigure()

Check the GST_PAD_FLAG_NEED_RECONFIGURE flag on pad and return TRUE if the flag was set.

checkReconfigure
int checkReconfigure()

Check and clear the GST_PAD_FLAG_NEED_RECONFIGURE flag on pad and return TRUE if the flag was set.

markReconfigure
void markReconfigure()

Mark a pad for needing reconfiguration. The next call to gst_pad_check_reconfigure() will return TRUE after this call.

push
GstFlowReturn push(Buffer buffer)

Pushes a buffer to the peer of pad. This function will call installed block probes before triggering any installed data probes. The function proceeds calling gst_pad_chain() on the peer pad and returns the value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will be returned. In all cases, success or failure, the caller loses its reference to buffer after calling this function.

pushEvent
int pushEvent(Event event)

Sends the event to the peer of the given pad. This function is mainly used by elements to send events to their peer elements. This function takes owership of the provided event so you should gst_event_ref() it if you want to reuse the event after this call.

pushList
GstFlowReturn pushList(BufferList list)

Pushes a buffer list to the peer of pad. This function will call installed block probes before triggering any installed data probes. The function proceeds calling the chain function on the peer pad and returns the value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will be returned. If the peer pad does not have any installed chainlist function every group buffer of the list will be merged into a normal GstBuffer and chained via gst_pad_chain(). In all cases, success or failure, the caller loses its reference to list after calling this function.

pullRange
GstFlowReturn pullRange(ulong offset, uint size, Buffer buffer)

Pulls a buffer from the peer pad or fills up a provided buffer. This function will first trigger the pad block signal if it was installed. When pad is not linked GST_FLOW_NOT_LINKED is returned else this function returns the result of gst_pad_get_range() on the peer pad. See gst_pad_get_range() for a list of return values and for the semantics of the arguments of this function. If buffer points to a variable holding NULL, a valid new GstBuffer will be placed in buffer when this function returns GST_FLOW_OK. The new buffer must be freed with gst_buffer_unref() after usage. When this function returns any other result value, buffer will still point to NULL. When buffer points to a variable that points to a valid GstBuffer, the buffer will be filled with the result data when this function returns GST_FLOW_OK. When this function returns any other result value, buffer will be unchanged. If the provided buffer is larger than size, only size bytes will be filled in the result buffer and its size will be updated accordingly. Note that less than size bytes can be returned in buffer when, for example, an EOS condition is near or when buffer is not large enough to hold size bytes. The caller should check the result buffer size to get the result size.

activateMode
int activateMode(GstPadMode mode, int active)

Activates or deactivates the given pad in mode via dispatching to the pad's activatemodefunc. For use from within pad activation functions only. If you don't know what this is, you probably don't want to call it.

sendEvent
int sendEvent(Event event)

Sends the event to the pad. This function can be used by applications to send events in the pipeline. If pad is a source pad, event should be an upstream event. If pad is a sink pad, event should be a downstream event. For example, you would not send a GST_EVENT_EOS on a src pad; EOS events only propagate downstream. Furthermore, some downstream events have to be serialized with data flow, like EOS, while some can travel out-of-band, like GST_EVENT_FLUSH_START. If the event needs to be serialized with data flow, this function will take the pad's stream lock while calling its event function. To find out whether an event type is upstream, downstream, or downstream and serialized, see GstEventTypeFlags, gst_event_type_get_flags(), GST_EVENT_IS_UPSTREAM, GST_EVENT_IS_DOWNSTREAM, and GST_EVENT_IS_SERIALIZED. Note that in practice that an application or plugin doesn't need to bother itself with this information; the core handles all necessary locks and checks. This function takes owership of the provided event so you should gst_event_ref() it if you want to reuse the event after this call.

eventDefault
int eventDefault(ObjectGst parent, Event event)

Invokes the default event handler for the given pad. The EOS event will pause the task associated with pad before it is forwarded to all internally linked pads, The the event is sent to all pads internally linked to pad. This function takes ownership of event.

query
int query(Query query)

Dispatches a query to a pad. The query should have been allocated by the caller via one of the type-specific allocation functions. The element that the pad belongs to is responsible for filling the query with an appropriate response, which should then be parsed with a type-specific query parsing function. Again, the caller is responsible for both the allocation and deallocation of the query structure. Please also note that some queries might need a running pipeline to work.

peerQuery
int peerQuery(Query query)

Performs gst_pad_query() on the peer of pad. The caller is responsible for both the allocation and deallocation of the query structure.

queryDefault
int queryDefault(ObjectGst parent, Query query)

Invokes the default query handler for the given pad. The query is sent to all pads internally linked to pad. Note that if there are many possible sink pads that are internally linked to pad, only one will be sent the query. Multi-sinkpad elements should implement custom query handlers.

queryPosition
int queryPosition(GstFormat format, long cur)

Queries a pad for the stream position.

queryDuration
int queryDuration(GstFormat format, long duration)

Queries a pad for the total stream duration.

queryConvert
int queryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, long destVal)

Queries a pad to convert src_val in src_format to dest_format.

queryAcceptCaps
int queryAcceptCaps(Caps caps)

Check if the given pad accepts the caps.

queryCaps
Caps queryCaps(Caps filter)

Gets the capabilities this pad can produce or consume. Note that this method doesn't necessarily return the caps set by sending a gst_event_new_caps() - use gst_pad_get_current_caps() for that instead. gst_pad_query_caps returns all possible caps a pad can operate with, using the pad's CAPS query function, If the query fails, this function will return filter, if not NULL, otherwise ANY. When called on sinkpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on srcpads filter contains the caps accepted by downstream in the preffered order. filter might be NULL but if it is not NULL the returned caps will be a subset of filter. Note that this function does not return writable GstCaps, use gst_caps_make_writable() before modifying the caps.

peerQueryPosition
int peerQueryPosition(GstFormat format, long cur)

Queries the peer of a given sink pad for the stream position.

peerQueryDuration
int peerQueryDuration(GstFormat format, long duration)

Queries the peer pad of a given sink pad for the total stream duration.

peerQueryConvert
int peerQueryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, long destVal)

Queries the peer pad of a given sink pad to convert src_val in src_format to dest_format.

peerQueryAcceptCaps
int peerQueryAcceptCaps(Caps caps)

Check if the peer of pad accepts caps. If pad has no peer, this function returns TRUE.

peerQueryCaps
Caps peerQueryCaps(Caps filter)

Gets the capabilities of the peer connected to this pad. Similar to gst_pad_query_caps(). When called on srcpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on sinkpads filter contains the caps accepted by downstream in the preffered order. filter might be NULL but if it is not NULL the returned caps will be a subset of filter.

setQueryFunctionFull
void setQueryFunctionFull(GstPadQueryFunction query, void* userData, GDestroyNotify notify)

Set the given query function for the pad.

setIterateInternalLinksFunctionFull
void setIterateInternalLinksFunctionFull(GstPadIterIntLinkFunction iterintlink, void* userData, GDestroyNotify notify)

Sets the given internal link iterator function for the pad.

iterateInternalLinks
Iterator iterateInternalLinks()

Gets an iterator for the pads to which the given pad is linked to inside of the parent element. Each GstPad element yielded by the iterator will have its refcount increased, so unref after use. Free-function: gst_iterator_free

iterateInternalLinksDefault
Iterator iterateInternalLinksDefault(ObjectGst parent)

Iterate the list of pads to which the given pad is linked to inside of the parent element. This is the default handler, and thus returns an iterator of all of the pads inside the parent element with opposite direction. The caller must free this iterator after use with gst_iterator_free().

setElementPrivate
void setElementPrivate(void* priv)

Set the given private data gpointer on the pad. This function can only be used by the element that owns the pad. No locking is performed in this function.

getElementPrivate
void* getElementPrivate()

Gets the private data of a pad. No locking is performed in this function.

createStreamId
string createStreamId(Element parent, string streamId)

Creates a stream-id for the source GstPad pad by combining the upstream information with the optional stream_id of the stream of pad. pad must have a parent GstElement and which must have zero or one sinkpad. stream_id can only be NULL if the parent element of pad has only a single source pad. This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending stream_id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead. Since stream IDs are sorted alphabetically, any numbers in the stream ID should be printed with a fixed number of characters, preceded by 0's, such as by using the format %03u instead of %u.

createStreamIdPrintfValist
string createStreamIdPrintfValist(Element parent, string streamId, void* varArgs)

Creates a stream-id for the source GstPad pad by combining the upstream information with the optional stream_id of the stream of pad. pad must have a parent GstElement and which must have zero or one sinkpad. stream_id can only be NULL if the parent element of pad has only a single source pad. This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending stream_id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.

getStreamId
string getStreamId()

Returns the current stream-id for the pad, or NULL if none has been set yet, i.e. the pad has not received a stream-start event yet. This is a convenience wrapper around gst_pad_get_sticky_event() and gst_event_parse_stream_start(). The returned stream-id string should be treated as an opaque string, its contents should not be interpreted. Since 1.2

forward
int forward(GstPadForwardFunction forward, void* userData)

Calls forward for all internally linked pads of pad. This function deals with dynamically changing internal pads and will make sure that the forward function is only called once for each pad. When forward returns TRUE, no further pads will be processed.

chain
GstFlowReturn chain(Buffer buffer)

Chain a buffer to pad. The function returns GST_FLOW_FLUSHING if the pad was flushing. If the buffer type is not acceptable for pad (as negotiated with a preceeding GST_EVENT_CAPS event), this function returns GST_FLOW_NOT_NEGOTIATED. The function proceeds calling the chain function installed on pad (see gst_pad_set_chain_function()) and the return value of that function is returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad has no chain function. In all cases, success or failure, the caller loses its reference to buffer after calling this function.

chainList
GstFlowReturn chainList(BufferList list)

Chain a bufferlist to pad. The function returns GST_FLOW_FLUSHING if the pad was flushing. If pad was not negotiated properly with a CAPS event, this function returns GST_FLOW_NOT_NEGOTIATED. The function proceeds calling the chainlist function installed on pad (see gst_pad_set_chain_list_function()) and the return value of that function is returned to the caller. GST_FLOW_NOT_SUPPORTED is returned if pad has no chainlist function. In all cases, success or failure, the caller loses its reference to list after calling this function. MT safe.

startTask
int startTask(GstTaskFunction func, void* userData, GDestroyNotify notify)

Starts a task that repeatedly calls func with user_data. This function is mostly used in pad activation functions to start the dataflow. The GST_PAD_STREAM_LOCK of pad will automatically be acquired before func is called.

pauseTask
int pauseTask()

Pause the task of pad. This function will also wait until the function executed by the task is finished if this function is not called from the task function.

stopTask
int stopTask()

Stop the task of pad. This function will also make sure that the function executed by the task will effectively stop if not called from the GstTaskFunction. This function will deadlock if called from the GstTaskFunction of the task. Use gst_task_pause() instead. Regardless of whether the pad has a task, the stream lock is acquired and released so as to ensure that streaming through this pad has finished.

setActive
int setActive(int active)

Activates or deactivates the given pad. Normally called from within core state change functions. If active, makes sure the pad is active. If it is already active, either in push or pull mode, just return. Otherwise dispatches to the pad's activate function to perform the actual activation. If not active, calls gst_pad_activate_mode() with the pad's current mode and a FALSE argument.

Meta