GhostPad

Description 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 other GstElements. 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(GstGhostPad* gstGhostPad)

Sets our main struct and passes it to the parent class

this
this(string name, Pad target)

Create a new ghostpad with target as the target. The direction will be taken from the target pad. target must be unlinked. Will ref the target.

this
this(string name, GstPadDirection dir)

Create a new ghostpad without a target with the given direction. A target can be set on the ghostpad later with the gst_ghost_pad_set_target() function. The created ghostpad will not have a padtemplate.

this
this(string name, Pad target, PadTemplate templ)

Create a new ghostpad with target as the target. The direction will be taken from the target pad. The template used on the ghostpad will be template. Will ref the target.

this
this(string name, PadTemplate templ)

Create a new ghostpad based on templ, without setting a target. The direction will be taken from the templ.

Members

Functions

getGhostPadStruct
GstGhostPad* getGhostPadStruct()
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*

getTarget
Pad getTarget()

Get the target pad of gpad. Unref target pad after usage.

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

Set the new target of the ghostpad gpad. Any existing target is unlinked and links to the new target are established.

Variables

gstGhostPad
GstGhostPad* gstGhostPad;

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;
onHaveDataListeners
bool delegate(MiniObject, Pad)[] onHaveDataListeners;
Undocumented in source.
addOnHaveData
void addOnHaveData(bool delegate(MiniObject, Pad) dlg, ConnectFlags connectFlags)

Signals that new data is available on the pad. This signal is used internally for implementing pad probes. See gst_pad_add_*_probe functions.

callBackHaveData
gboolean callBackHaveData(GstPad* padStruct, GstMiniObject* miniObj, Pad _pad)
Undocumented in source. Be warned that the author may not have intended to support it.
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.
onRequestLinkListeners
void delegate(Pad)[] onRequestLinkListeners;
Undocumented in source.
addOnRequestLink
void addOnRequestLink(void delegate(Pad) dlg, ConnectFlags connectFlags)

Signals that a pad connection has been requested.

callBackRequestLink
void callBackRequestLink(GstPad* padStruct, 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

callBackUnlinked
void callBackUnlinked(GstPad* padStruct, GstPad* peer, Pad _pad)
Undocumented in source. Be warned that the author may not have intended to support it.
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.

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 can be linked. Both srcpad and sinkpad must be unlinked.

getCaps
Caps getCaps()

Gets the capabilities this pad can produce or consume. Note that this method doesn't necessarily return the caps set by gst_pad_set_caps() - use GST_PAD_CAPS for that instead. gst_pad_get_caps returns all possible caps a pad can operate with, using the pad's get_caps function; this returns the pad template caps if not explicitly set.

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_get_caps() on pad and its peer. The caller owns a reference on the resulting caps.

getNegotiatedCaps
Caps getNegotiatedCaps()

Gets the capabilities of the media type that currently flows through pad and its peer. This function can be used on both src and sinkpads. Note that srcpads are always negotiated before sinkpads so it is possible that the negotiated caps on the srcpad do not match the negotiated caps of the peer.

getPadTemplateCaps
Caps getPadTemplateCaps()

Gets the capabilities for pad's template.

setCaps
int setCaps(Caps caps)

Sets the capabilities of this pad. The caps must be fixed. Any previous caps on the pad will be unreffed. This function refs the caps so you should unref if as soon as you don't need it anymore. It is possible to set NULL caps, which will make the pad unnegotiated again.

getPeer
Pad getPeer()

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

peerGetCaps
Caps peerGetCaps()

Gets the capabilities of the peer connected to this pad.

useFixedCaps
void useFixedCaps()

A helper function you can use that sets the gst_pad_get_fixed_caps_func as the getcaps function for the pad. This way the function will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps. Use this function on a pad that, once _set_caps() has been called on it, cannot be renegotiated to something else.

isActive
int isActive()

Query if a pad is active

setBlocked
int setBlocked(int blocked)

Blocks or unblocks the dataflow on a pad. This function is a shortcut for gst_pad_set_blocked_async() with a NULL callback.

setBlockedAsync
int setBlockedAsync(int blocked, GstPadBlockCallback callback, void* userData)

Blocks or unblocks the dataflow on a pad. The provided callback is called when the operation succeeds; this happens right before the next attempt at pushing a buffer on the pad. This can take a while as the pad can only become blocked when real dataflow is happening. When the pipeline is stalled, for example in PAUSED, this can take an indeterminate amount of time. You can pass NULL as the callback to make this call block. Be careful with this blocking call as it might not return for reasons stated above.

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.

addDataProbe
gulong addDataProbe(GCallback handler, void* data)

Adds a "data probe" to a pad. This function will be called whenever data passes through a pad. In this case data means both events and buffers. The probe will be called with the data as an argument, meaning handler should have the same callback signature as the 'have-data' signal of GstPad. Note that the data will have a reference count greater than 1, so it will be immutable -- you must not change it. For source pads, the probe will be called after the blocking function, if any (see gst_pad_set_blocked_async()), but before looking up the peer to chain to. For sink pads, the probe function will be called before configuring the sink with new caps, if any, and before calling the pad's chain function. Your data probe should return TRUE to let the data continue to flow, or FALSE to drop it. Dropping data is rarely useful, but occasionally comes in handy with events. Although probes are implemented internally by connecting handler to the have-data signal on the pad, if you want to remove a probe it is insufficient to only call g_signal_handler_disconnect on the returned handler id. To remove a probe, use the appropriate function, such as gst_pad_remove_data_probe().

addBufferProbe
gulong addBufferProbe(GCallback handler, void* data)

Adds a probe that will be called for all buffers passing through a pad. See gst_pad_add_data_probe() for more information.

addEventProbe
gulong addEventProbe(GCallback handler, void* data)

Adds a probe that will be called for all events passing through a pad. See gst_pad_add_data_probe() for more information.

removeDataProbe
void removeDataProbe(uint handlerId)

Removes a data probe from pad.

removeBufferProbe
void removeBufferProbe(uint handlerId)

Removes a buffer probe from pad.

removeEventProbe
void removeEventProbe(uint handlerId)

Removes an event probe from pad.

allocBuffer
GstFlowReturn allocBuffer(ulong offset, int size, Caps caps, Buffer buf)

Allocates a new, empty buffer optimized to push to pad pad. This function only works if pad is a source pad and has a peer. A new, empty GstBuffer will be put in the buf argument. You need to check the caps of the buffer after performing this function and renegotiate to the format if needed.

allocBufferAndSetCaps
GstFlowReturn allocBufferAndSetCaps(ulong offset, int size, Caps caps, Buffer buf)

In addition to the function gst_pad_alloc_buffer(), this function automatically calls gst_pad_set_caps() when the caps of the newly allocated buffer are different from the pad caps.

setBufferallocFunction
void setBufferallocFunction(GstPadBufferAllocFunction bufalloc)

Sets the given bufferalloc function for the pad. Note that the bufferalloc function can only be set on sinkpads.

setChainFunction
void setChainFunction(GstPadChainFunction chain)

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

setCheckgetrangeFunction
void setCheckgetrangeFunction(GstPadCheckGetRangeFunction check)

Sets the given checkgetrange function for the pad. Implement this function on a pad if you dynamically support getrange based scheduling on the pad.

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

When pad is flushing this function returns GST_FLOW_WRONG_STATE immediatly. 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. buffer's caps must either be unset or the same as what is already configured on pad. Renegotiation within a running pull-mode pipeline is not supported. This is a lowlevel function. Usualy gst_pad_pull_range() is used.

setGetrangeFunction
void setGetrangeFunction(GstPadGetRangeFunction get)

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.

setEventFunction
void setEventFunction(GstPadEventFunction event)

Sets the given event handler for the pad.

setLinkFunction
void setLinkFunction(GstPadLinkFunction link)

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.

setUnlinkFunction
void setUnlinkFunction(GstPadUnlinkFunction unlink)

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

acceptCaps
int acceptCaps(Caps caps)

Check if the given pad accepts the caps.

setAcceptcapsFunction
void setAcceptcapsFunction(GstPadAcceptCapsFunction acceptcaps)

Sets the given acceptcaps function for the pad. The acceptcaps function will be called to check if the pad can accept the given caps. Setting the acceptcaps function to NULL restores the default behaviour of allowing any caps that matches the caps from gst_pad_get_caps.

setGetcapsFunction
void setGetcapsFunction(GstPadGetCapsFunction getcaps)

Sets the given getcaps function for the pad. getcaps should return the allowable caps for a pad in the context of the element's state, its link to other elements, and the devices or files it has opened. These caps must be a subset of the pad template caps. In the NULL state with no links, getcaps should ideally return the same caps as the pad template. In rare circumstances, an object property can affect the caps returned by getcaps, but this is discouraged. You do not need to call this function if pad's allowed caps are always the same as the pad template caps. This can only be true if the padtemplate has fixed simple caps. For most filters, the caps returned by getcaps is directly affected by the allowed caps on other pads. For demuxers and decoders, the caps returned by the srcpad's getcaps function is directly related to the stream data. Again, getcaps should return the most specific caps it reasonably can, since this helps with autoplugging. Note that the return value from getcaps is owned by the caller, so the caller should unref the caps after usage.

proxyGetcaps
Caps proxyGetcaps()

Calls gst_pad_get_allowed_caps() for every other pad belonging to the same element as pad, and returns the intersection of the results. This function is useful as a default getcaps 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 aggregator.

setSetcapsFunction
void setSetcapsFunction(GstPadSetCapsFunction setcaps)

Sets the given setcaps function for the pad. The setcaps function will be called whenever a buffer with a new media type is pushed or pulled from the pad. The pad/element needs to update its internal structures to process the new media type. If this new type is not acceptable, the setcaps function should return FALSE.

proxySetcaps
int proxySetcaps(Caps caps)

Calls gst_pad_set_caps() for every other pad belonging to the same element as pad. If gst_pad_set_caps() fails on any pad, the proxy setcaps fails. May be used only during negotiation.

fixateCaps
void fixateCaps(Caps caps)

Fixate a caps on the given pad. Modifies the caps in place, so you should make sure that the caps are actually writable (see gst_caps_make_writable()).

setFixatecapsFunction
void setFixatecapsFunction(GstPadFixateCapsFunction fixatecaps)

Sets the given fixatecaps function for the pad. The fixatecaps function will be called whenever the default values for a GstCaps needs to be filled in.

getFixedCapsFunc
Caps getFixedCapsFunc()

A helper function you can use as a GetCaps function that will return the currently negotiated caps or the padtemplate when NULL.

peerAcceptCaps
int peerAcceptCaps(Caps caps)

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

setActivateFunction
void setActivateFunction(GstPadActivateFunction activate)

Sets the given activate function for pad. The activate function will dispatch to gst_pad_activate_push() or gst_pad_activate_pull() 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.

setActivatepushFunction
void setActivatepushFunction(GstPadActivateModeFunction activatepush)

Sets the given activate_push function for the pad. An activate_push function prepares the element for pushing. See XXX part-activation.txt for details.

setActivatepullFunction
void setActivatepullFunction(GstPadActivateModeFunction activatepull)

Sets the given activate_pull function for the pad. An activate_pull function prepares the element and any upstream connections for pulling. See XXX part-activation.txt for details.

push
GstFlowReturn push(Buffer buffer)

Pushes a buffer to the peer of pad. This function will call an installed pad block before triggering any installed pad probes. If the caps on buffer are different from the currently configured caps on pad, this function will call any installed setcaps function on pad (see gst_pad_set_setcaps_function()). In case of failure to renegotiate the new format, this function returns GST_FLOW_NOT_NEGOTIATED. 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.

checkPullRange
int checkPullRange()

Checks if a gst_pad_pull_range() can be performed on the peer source pad. This function is used by plugins that want to check if they can use random access on the peer source pad. The peer sourcepad can implement a custom GstPadCheckGetRangeFunction if it needs to perform some logic to determine if pull_range is possible.

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

Pulls a buffer from the peer pad. 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. buffer's caps must either be unset or the same as what is already configured on pad. Renegotiation within a running pull-mode pipeline is not supported.

activatePull
int activatePull(int active)

Activates or deactivates the given pad in pull mode via dispatching to the pad's activatepullfunc. For use from within pad activation functions only. When called on sink pads, will first proxy the call to the peer pad, which is expected to activate its internally linked pads from within its activate_pull function. If you don't know what this is, you probably don't want to call it.

activatePush
int activatePush(int active)

Activates or deactivates the given pad in push mode via dispatching to the pad's activatepushfunc. 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(Event event)

Invokes the default event handler for the given pad. End-of-stream and discontinuity events are handled specially, and then the event 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 an event. Multi-sinkpad elements should implement custom event handlers.

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 in gstquery.h. The element 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.

queryDefault
int queryDefault(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.

queryPeerPosition
int queryPeerPosition(GstFormat format, long cur)

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

queryPeerDuration
int queryPeerDuration(GstFormat format, long duration)

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

queryPeerConvert
int queryPeerConvert(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.

setQueryFunction
void setQueryFunction(GstPadQueryFunction query)

Set the given query function for the pad.

setQueryTypeFunction
void setQueryTypeFunction(GstPadQueryTypeFunction typeFunc)

Set the given query type function for the pad.

getQueryTypes
GstQueryType* getQueryTypes()

Get an array of supported queries that can be performed on this pad.

getQueryTypesDefault
GstQueryType* getQueryTypesDefault()

Invoke the default dispatcher for the query types on the pad.

setInternalLinkFunction
void setInternalLinkFunction(GstPadIntLinkFunction intlink)

Sets the given internal link function for the pad.

getInternalLinks
ListG getInternalLinks()

Gets a list of pads to which the given pad is linked to inside of the parent element. The caller must free this list after use.

getInternalLinksDefault
ListG getInternalLinksDefault()

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

dispatcher
int dispatcher(GstPadDispatcherFunction dispatch, void* data)

Invokes the given dispatcher function on each respective peer of all pads that are internally linked to the given pad. The GstPadDispatcherFunction should return TRUE when no further pads need to be processed.

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.

chain
GstFlowReturn chain(Buffer buffer)

Chain a buffer to pad. The function returns GST_FLOW_WRONG_STATE if the pad was flushing. If the caps on buffer are different from the current caps on pad, this function will call any setcaps function (see gst_pad_set_setcaps_function()) installed on pad. If the new caps are not acceptable for pad, 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.

startTask
int startTask(GstTaskFunction func, void* data)

Starts a task that repeatedly calls func with 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 make sure that the function executed by the task will effectively stop.

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, checks the pad's current mode and calls gst_pad_activate_push() or gst_pad_activate_pull(), as appropriate, with a FALSE argument.

Meta