Gst::Pad Class Reference

Gst::PadObject contained by elements that allows links to other elements. More...

#include <pad.h>

Inheritance diagram for Gst::Pad:

Gst::Object

List of all members.

Public Types

typedef sigc::slot< void,
const Glib::RefPtr<Gst::Pad>
&, bool > 
SlotBlock
 For example, void on_block(const Glib::RefPtr<Gst::Pad>& pad, bool blocked);.
typedef sigc::slot< bool,
const Glib::RefPtr<Gst::Pad>
&, const Glib::RefPtr
<Gst::MiniObject >&> 
SlotData
 For example, bool on_have_data(const Glib::RefPtr<Gst::Pad>& pad, const Glib::RefPtr<Gst::MiniObjec>& data);.

Public Member Functions

virtual ~Pad ()
GstPad* gobj ()
 Provides access to the underlying C GObject.
const GstPad* gobj () const
 Provides access to the underlying C GObject.
GstPad* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
PadDirection get_direction () const
 Gets the direction of the pad.
Glib::RefPtr<Gst::Elementget_parent_element ()
 Gets the parent of pad, cast to a Gst::Element.
Glib::RefPtr<const Gst::Elementget_parent_element () const
 Gets the parent of pad, cast to a Gst::Element.
Glib::RefPtr<Gst::PadTemplateget_pad_template () const
 Gets the template for pad.
PadLinkReturn link (const Glib::RefPtr<Gst::Pad>& sink_pad)
 Links the source pad and the sink pad.
bool unlink (const Glib::RefPtr<Gst::Pad>& sink_pad)
 Unlinks the source pad from the sink pad.
bool is_linked () const
 Checks if a pad is linked to another pad or not.
bool can_link (const Glib::RefPtr<Gst::Pad>& other_pad)
 Checks if the source pad and the sink pad can be linked.
Glib::RefPtr<Gst::Capsget_caps ()
 Gets the capabilities this pad can produce or consume.
Glib::RefPtr<const Gst::Capsget_caps () const
 Gets the capabilities this pad can produce or consume.
Glib::RefPtr<Gst::Capsget_allowed_caps ()
 Gets the capabilities of the allowed media types that can flow through pad and its peer.
Glib::RefPtr<const Gst::Capsget_allowed_caps () const
 Gets the capabilities of the allowed media types that can flow through pad and its peer.
Glib::RefPtr<Gst::Capsget_negotiated_caps ()
 Gets the capabilities of the media type that currently flows through pad and its peer.
Glib::RefPtr<const Gst::Capsget_negotiated_caps () const
 Gets the capabilities of the media type that currently flows through pad and its peer.
Glib::RefPtr<const Gst::Capsget_pad_template_caps () const
 Gets the capabilities for pad's template.
bool set_caps (const Glib::RefPtr<Gst::Caps>& caps)
 Sets the capabilities of this pad.
Glib::RefPtr<Gst::Padget_peer ()
 Gets the peer of pad.
Glib::RefPtr<const Gst::Padget_peer () const
 Gets the peer of pad.
Glib::RefPtr<Gst::Capspeer_get_caps ()
 Gets the capabilities of the peer connected to this pad.
Glib::RefPtr<const Gst::Capspeer_get_caps () const
 Gets the capabilities of the peer connected to this pad.
void use_fixed_caps ()
 A helper function you can use that sets the gst_pad_get_fixed_caps_func as the getcaps function for the pad.
bool is_active () const
 Query if a pad is active.
bool set_blocked (bool blocked=true)
 Blocks or unblocks the dataflow on a pad.
bool set_blocked_async (const SlotBlock& slot, bool blocked=true)
 Blocks or unblocks the dataflow on a pad asynchronously.
bool is_blocked () const
 Checks if the pad is blocked or not.
bool is_blocking () const
 Checks if the pad is blocking or not.
gulong add_data_probe (const SlotData& slot)
 Adds a "data probe" to a pad.
gulong add_buffer_probe (const SlotData& slot)
 Adds a probe that will be called for all buffers passing through a pad.
gulong add_event_probe (const SlotData& slot)
 Adds a probe that will be called for all events passing through a pad.
void remove_data_probe (guint handler_id)
 Removes a data probe from pad.
void remove_buffer_probe (guint handler_id)
 Removes a buffer probe from pad.
void remove_event_probe (guint handler_id)
 Removes an event probe from pad.
FlowReturn alloc_buffer (guint64 offset, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buf)
 Allocates a new, empty buffer optimized to push to pad pad.
FlowReturn alloc_buffer_and_set_caps (guint64 offset, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buf)
 In addition to the function alloc_buffer(), this function automatically calls set_caps() when the caps of the newly allocated buffer are different from the pad caps.
FlowReturn get_range (guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer)
bool accept_caps (const Glib::RefPtr<Gst::Caps>& caps)
 Check if the given pad accepts the caps.
Glib::RefPtr<Gst::Capsproxy_getcaps ()
 Calls get_allowed_caps() for every other pad belonging to the same element as pad, and returns the intersection of the results.
Glib::RefPtr<const Gst::Capsproxy_getcaps () const
 Calls get_allowed_caps() for every other pad belonging to the same element as pad, and returns the intersection of the results.
bool proxy_setcaps (const Glib::RefPtr<Gst::Caps>& caps)
 Calls set_caps() for every other pad belonging to the same element as pad.
void fixate_caps (const Glib::RefPtr<Gst::Caps>& caps)
 Fixate a caps on the given pad.
bool peer_accept_caps (const Glib::RefPtr<Gst::Caps>& caps)
 Check if the peer of pad accepts caps.
FlowReturn push (const Glib::RefPtr<Gst::Buffer>& buffer)
 Pushes a buffer to the peer of the pad.
bool push_event (const Glib::RefPtr<Gst::Event>& event)
 Sends the event to the peer of the pad.
bool check_pull_range () const
 Checks if a pull_range() can be performed on the peer source pad.
FlowReturn pull_range (guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer)
bool activate_pull (bool active=true)
 Activates or deactivates the given pad in pull mode via dispatching to the pad's activatepullfunc.
bool activate_push (bool active=true)
 Activates or deactivates the given pad in push mode via dispatching to the pad's activatepushfunc.
bool send_event (const Glib::RefPtr<Gst::Event>& event)
 Sends the event to the pad.
bool event_default (const Glib::RefPtr<Gst::Event>& event)
 Invokes the default event handler for the given pad.
bool query (const Glib::RefPtr<Gst::Query>& query)
 Dispatches a query to a pad.
bool peer_query (const Glib::RefPtr<Gst::Query>& query)
 Performs query() on the peer of pad.
bool query_default (const Glib::RefPtr<Gst::Query>& query)
 Invokes the default query handler for the given pad.
bool query_position (Format& format, gint64& position) const
 Queries a pad for the stream position.
bool query_position (Format& format) const
 Queries a pad for the stream position parsing only the format.
bool query_duration (Format& format, gint64& duration) const
 Queries a pad for the total stream duration.
bool query_duration (Format& format) const
 Queries a pad for the total stream duration parsing only the format.
bool query_convert (Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const
 Queries a pad to convert src_val in src_format to dest_format.
bool query_peer_position (Format& format, gint64& position) const
 Queries the peer of a given sink pad for the stream position.
bool query_peer_position (Format& format) const
 Queries the peer of a given sink pad for the stream position parsing only the format.
bool query_peer_duration (Format& format, gint64& duration) const
 Queries the peer pad of a given sink pad for the total stream duration.
bool query_peer_duration (Format& format) const
 Queries the peer pad of a given sink pad for the total stream duration.
bool query_peer_convert (Format src_format, gint64 src_value, Format& dst_format, gint64& dst_value) const
 Queries the peer pad of a given sink pad to convert src_val in src_format to dest_format.
Glib::ArrayHandle<QueryTypeget_query_types () const
 Get an array of supported queries that can be performed on this pad.
Glib::ArrayHandle<QueryTypeget_query_types_default () const
 Invoke the default dispatcher for the query types on the pad.
Glib::ListHandle< Glib::RefPtr
<Gst::Pad >> 
get_internal_links ()
 Gets a list of pads to which the given pad is linked to inside of the parent element.
Glib::ListHandle< Glib::RefPtr
<Gst::Pad >> 
get_internal_links_default ()
 Gets a list of pads to which the given pad is linked to inside of the parent element.
FlowReturn chain (const Glib::RefPtr<Gst::Buffer>& buffer)
bool pause_task ()
 Pause the task of pad.
bool stop_task ()
 Stop the task of pad.
bool set_active (bool active=true)
 Activates or deactivates the given pad.
Glib::SignalProxy1< void,
const Glib::RefPtr<Gst::Pad >&> 
signal_linked ()
 Signals that a pad has been linked to the peer pad.
Glib::SignalProxy0<void> signal_request_link ()
 Signals that a pad connection has been requested.
Glib::SignalProxy1< void,
const Glib::RefPtr<Gst::Pad >&> 
signal_unlinked ()
 Signals that a pad has been unlinked from the peer pad.
Glib::PropertyProxy_ReadOnly
<Glib::RefPtr<Gst::Caps>> 
property_caps () const
 The capabilities of the pad.
Glib::PropertyProxy_ReadOnly
<PadDirection
property_direction () const
 The direction of the pad.
Glib::PropertyProxy<PadTemplateproperty_template ()
 The GstPadTemplate of this pad.
Glib::PropertyProxy_ReadOnly
<PadTemplate
property_template () const
 The GstPadTemplate of this pad.

Static Public Member Functions

static Glib::RefPtr<Padcreate (const Glib::ustring& name, PadDirection dir)
 Creates a new pad with the given name in the given direction.
static Glib::RefPtr<Padcreate (PadDirection dir)
 Creates a new pad with a guaranteed unique name (across all pads) in the given direction.
static Glib::RefPtr<Padcreate (const Glib::RefPtr<Gst::PadTemplate>& pad_template)
 Creates a new pad with the given name from the given template.
static Glib::RefPtr<Padcreate (const Glib::RefPtr<Gst::PadTemplate>& pad_template, const Glib::ustring& name)
 Creates a new pad with a guaranteed unique name (across all pads) from the given template.

Protected Member Functions

 Pad (const Glib::ustring& name, PadDirection direction)
 Pad (PadDirection dir)
 Pad (const Glib::RefPtr<Gst::PadTemplate>& templ, const Glib::ustring& name)
 Pad (const Glib::RefPtr<Gst::PadTemplate>& templ)
virtual void on_linked (const Glib::RefPtr<Gst::Pad>& peer_pad)
virtual void on_request_link ()
virtual void on_unlinked (const Glib::RefPtr<Gst::Pad>& peer_pad)

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gst::Padwrap (GstPad* object, bool take_copy=false)
 A Glib::wrap() method for this object.


Detailed Description

Gst::PadObject contained by elements that allows links to other elements.

A Gst::Element is linked to other elements via "pads", which are extremely light-weight generic link points. After two pads are retrieved from an element with Element::get_pad(), the pads can be link with link(). (For quick links, you can also use Element::link(), which will make the obvious link for you if it's straightforward.)

Pads are typically created from a Gst::PadTemplate with the create() method that takes a Gst::PadTemplate.

Pads have Gst::Caps attached to it to describe the media type they are capable of dealing with. get_caps() and set_caps() are used to manipulate the caps of the pads. Pads created from a pad template cannot set capabilities that are incompatible with the pad template capabilities.

Pads without pad templates can be created with create(), which takes a direction and a name as an argument.

get_parent_element() will retrieve the Gst::Element that owns the pad.

A Gst::Element creating a pad will typically use the underlying C API to register callbacks for various events on the pads.

Elements will use push() and pull_range() to push out or pull in a buffer.

To send a Gst::Event on a pad, use send_event() and push_event().

Last reviewed on 2006-07-06 (0.10.9)


Member Typedef Documentation

typedef sigc::slot<void, const Glib::RefPtr<Gst::Pad>&, bool> Gst::Pad::SlotBlock

For example, void on_block(const Glib::RefPtr<Gst::Pad>& pad, bool blocked);.

typedef sigc::slot<bool, const Glib::RefPtr<Gst::Pad>&, const Glib::RefPtr<Gst::MiniObject>&> Gst::Pad::SlotData

For example, bool on_have_data(const Glib::RefPtr<Gst::Pad>& pad, const Glib::RefPtr<Gst::MiniObjec>& data);.

The data method should return true to keep the data in the pipeline, false to drop it (throw it away).


Constructor & Destructor Documentation

virtual Gst::Pad::~Pad (  )  [virtual]

Gst::Pad::Pad ( const Glib::ustring &  name,
PadDirection  direction 
) [explicit, protected]

Gst::Pad::Pad ( PadDirection  dir  )  [protected]

Gst::Pad::Pad ( const Glib::RefPtr<Gst::PadTemplate>&  templ,
const Glib::ustring &  name 
) [protected]

Gst::Pad::Pad ( const Glib::RefPtr<Gst::PadTemplate>&  templ  )  [protected]


Member Function Documentation

bool Gst::Pad::accept_caps ( const Glib::RefPtr<Gst::Caps>&  caps  ) 

Check if the given pad accepts the caps.

Parameters:
caps A Gst::Caps to check on the pad.
Returns:
true if the pad can accept the caps.

bool Gst::Pad::activate_pull ( bool  active = true  ) 

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.

Parameters:
active Whether or not the pad should be active.
Returns:
true if the operation was successful.
MT safe.

bool Gst::Pad::activate_push ( bool  active = true  ) 

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.

Parameters:
active Whether the pad should be active or not.
Returns:
true if the operation was successful.
MT safe.

gulong Gst::Pad::add_buffer_probe ( const SlotData slot  ) 

Adds a probe that will be called for all buffers passing through a pad.

See add_data_probe() for more information.

Parameters:
slot The slot to call when buffers are passed over pad.
Returns:
The handler id.

gulong Gst::Pad::add_data_probe ( const SlotData slot  ) 

Adds a "data probe" to a pad.

The slot 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. 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 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.

To remove a probe, use the appropriate function, such as remove_data_probe().

Parameters:
slot The slot to call when data is passed over pad (note: slot is not copied because it is connected to a signal).
Returns:
The handler id which may be used to remove the connection later.

gulong Gst::Pad::add_event_probe ( const SlotData slot  ) 

Adds a probe that will be called for all events passing through a pad.

See add_data_probe() for more information.

Parameters:
slot The slot to call when events are passed over pad.
Returns:
The handler id.

FlowReturn Gst::Pad::alloc_buffer ( guint64  offset,
int  size,
const Glib::RefPtr<Gst::Caps>&  caps,
Glib::RefPtr<Gst::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 Gst::Buffer 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.

Parameters:
offset The offset of the new buffer in the stream.
size The size of the new buffer.
caps The caps of the new buffer.
buf A newly allocated buffer.
Returns:
A result code indicating success of the operation. Any result code other than Gst::FLOW_OK is an error and buf should not be used. An error can occur if the pad is not connected or when the downstream peer elements cannot provide an acceptable buffer. MT safe.

FlowReturn Gst::Pad::alloc_buffer_and_set_caps ( guint64  offset,
int  size,
const Glib::RefPtr<Gst::Caps>&  caps,
Glib::RefPtr<Gst::Buffer>&  buf 
)

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

Again, the pad must be a source pad.

Parameters:
offset The offset of the new buffer in the stream.
size The size of the new buffer.
caps The caps of the new buffer.
buf A newly allocated buffer.
Returns:
A result code indicating success of the operation. Any result code other than Gst::FLOW_OK is an error and buf should not be used. An error can occur if the pad is not connected or when the downstream peer elements cannot provide an acceptable buffer. MT safe.

bool Gst::Pad::can_link ( const Glib::RefPtr<Gst::Pad>&  other_pad  ) 

Checks if the source pad and the sink pad can be linked.

Both srcpad and sinkpad must be unlinked.

Parameters:
sinkpad The sink Gst::Pad to link.
Returns:
true if the pads can be linked, false otherwise.

FlowReturn Gst::Pad::chain ( const Glib::RefPtr<Gst::Buffer>&  buffer  ) 

bool Gst::Pad::check_pull_range (  )  const

Checks if a 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 Gst::PadCheckGetRangeFunction if it needs to perform some logic to determine if pull_range is possible.

Returns:
A bool with the result.
MT safe.

static Glib::RefPtr<Pad> Gst::Pad::create ( const Glib::RefPtr<Gst::PadTemplate>&  pad_template,
const Glib::ustring &  name 
) [static]

Creates a new pad with a guaranteed unique name (across all pads) from the given template.

Parameters:
templ The pad template to use.
Returns:
A new Gst::Pad, or NULL in case of an error.

static Glib::RefPtr<Pad> Gst::Pad::create ( const Glib::RefPtr<Gst::PadTemplate>&  pad_template  )  [static]

Creates a new pad with the given name from the given template.

Parameters:
templ The pad template to use.
name The name of the element.
Returns:
A new Gst::Pad, or NULL in case of an error.

static Glib::RefPtr<Pad> Gst::Pad::create ( PadDirection  dir  )  [static]

Creates a new pad with a guaranteed unique name (across all pads) in the given direction.

Parameters:
direction The GstPadDirection of the pad.
Returns:
A new Gst::Pad, or NULL in case of an error. MT safe.

static Glib::RefPtr<Pad> Gst::Pad::create ( const Glib::ustring &  name,
PadDirection  dir 
) [static]

Creates a new pad with the given name in the given direction.

Parameters:
name The name of the new pad.
direction The GstPadDirection of the pad.
Returns:
A new Gst::Pad, or NULL in case of an error. MT safe.

bool Gst::Pad::event_default ( const Glib::RefPtr<Gst::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.

Parameters:
event The Gst::Event to handle.
Returns:
true if the event was sent succesfully.

void Gst::Pad::fixate_caps ( const Glib::RefPtr<Gst::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()).

Parameters:
caps The Gst::Caps to fixate.

Glib::RefPtr<const Gst::Caps> Gst::Pad::get_allowed_caps (  )  const

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

Returns:
The allowed Gst::Caps of the pad link. Unref the caps when you no longer need it. This function returns 0 when pad has no peer.
MT safe.

Glib::RefPtr<Gst::Caps> Gst::Pad::get_allowed_caps (  ) 

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

Returns:
The allowed Gst::Caps of the pad link. Unref the caps when you no longer need it. This function returns 0 when pad has no peer.
MT safe.

Glib::RefPtr<const Gst::Caps> Gst::Pad::get_caps (  )  const

Gets the capabilities this pad can produce or consume.

Note that this method doesn't necessarily return the caps set by 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.

Returns:
A newly allocated copy of the Gst::Caps of this pad.
MT safe.

Glib::RefPtr<Gst::Caps> Gst::Pad::get_caps (  ) 

Gets the capabilities this pad can produce or consume.

Note that this method doesn't necessarily return the caps set by 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.

Returns:
A newly allocated copy of the Gst::Caps of this pad.
MT safe.

PadDirection Gst::Pad::get_direction (  )  const

Gets the direction of the pad.

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

Returns:
The Gst::PadDirection of the pad.
MT safe.

Glib::ListHandle<Glib::RefPtr<Gst::Pad>> Gst::Pad::get_internal_links (  ) 

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.

Returns:
A newly allocated List of pads, free with Glib::list_free().
Not MT safe.

Deprecated: This function does not ref the pads in the list so that they could become invalid by the time the application accesses them. It's also possible that the list changes while handling the pads, which the caller of this function is unable to know. Use the thread-safe iterate_internal_links() instead.

Glib::ListHandle<Glib::RefPtr<Gst::Pad>> Gst::Pad::get_internal_links_default (  ) 

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 with Glib::list_free().

Returns:
A newly allocated List of pads, or 0 if the pad has no parent.
Not MT safe.

Deprecated: This function does not ref the pads in the list so that they could become invalid by the time the application accesses them. It's also possible that the list changes while handling the pads, which the caller of this function is unable to know. Use the thread-safe iterate_internal_links_default() instead.

Glib::RefPtr<const Gst::Caps> Gst::Pad::get_negotiated_caps (  )  const

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.

Returns:
The negotiated Gst::Caps of the pad link. Unref the caps when you no longer need it. This function returns 0 when the pad has no peer or is not negotiated yet.
MT safe.

Glib::RefPtr<Gst::Caps> Gst::Pad::get_negotiated_caps (  ) 

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.

Returns:
The negotiated Gst::Caps of the pad link. Unref the caps when you no longer need it. This function returns 0 when the pad has no peer or is not negotiated yet.
MT safe.

Glib::RefPtr<Gst::PadTemplate> Gst::Pad::get_pad_template (  )  const

Gets the template for pad.

Returns:
The Gst::PadTemplate from which this pad was instantiated, or 0 if this pad has no template.
FIXME: currently returns an unrefcounted padtemplate.

Glib::RefPtr<const Gst::Caps> Gst::Pad::get_pad_template_caps (  )  const

Gets the capabilities for pad's template.

Returns:
The Gst::Caps of this pad template.

Glib::RefPtr<const Gst::Element> Gst::Pad::get_parent_element (  )  const

Gets the parent of pad, cast to a Gst::Element.

If a pad has no parent or its parent is not an element, return 0.

Returns:
The parent of the pad. The caller has a reference on the parent, so unref when you're finished with it.
MT safe.

Glib::RefPtr<Gst::Element> Gst::Pad::get_parent_element (  ) 

Gets the parent of pad, cast to a Gst::Element.

If a pad has no parent or its parent is not an element, return 0.

Returns:
The parent of the pad. The caller has a reference on the parent, so unref when you're finished with it.
MT safe.

Glib::RefPtr<const Gst::Pad> Gst::Pad::get_peer (  )  const

Gets the peer of pad.

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

Returns:
The peer Gst::Pad. Unref after usage.
MT safe.

Glib::RefPtr<Gst::Pad> Gst::Pad::get_peer (  ) 

Gets the peer of pad.

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

Returns:
The peer Gst::Pad. Unref after usage.
MT safe.

Glib::ArrayHandle<QueryType> Gst::Pad::get_query_types (  )  const

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

Returns:
A zero-terminated array of Gst::QueryType.

Glib::ArrayHandle<QueryType> Gst::Pad::get_query_types_default (  )  const

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

Returns:
An zero-terminated array of Gst::QueryType, or 0 if none of the internally-linked pads has a query types function.

FlowReturn Gst::Pad::get_range ( guint64  offset,
guint  size,
Glib::RefPtr<Gst::Buffer>&  buffer 
)

const GstPad* Gst::Pad::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Gst::Object.

GstPad* Gst::Pad::gobj (  )  [inline]

Provides access to the underlying C GObject.

Reimplemented from Gst::Object.

GstPad* Gst::Pad::gobj_copy (  ) 

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gst::Object.

bool Gst::Pad::is_active (  )  const

Query if a pad is active.

Returns:
true if the pad is active.
MT safe.

bool Gst::Pad::is_blocked (  )  const

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 is_blocking()).

Returns:
true if the pad is blocked.
MT safe.

bool Gst::Pad::is_blocking (  )  const

Checks if the pad is blocking or not.

This is a guaranteed state of whether the pad is actually blocking on a Gst::Buffer or a Gst::Event.

Returns:
true if the pad is blocking.
MT safe.

Since: 0.10.11.

bool Gst::Pad::is_linked (  )  const

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

Returns:
true if the pad is linked, false otherwise.
MT safe.

PadLinkReturn Gst::Pad::link ( const Glib::RefPtr<Gst::Pad>&  sink_pad  ) 

Links the source pad and the sink pad.

Parameters:
sinkpad The sink Gst::Pad to link.
Returns:
A result code indicating if the connection worked or what went wrong.
MT Safe.

virtual void Gst::Pad::on_linked ( const Glib::RefPtr<Gst::Pad>&  peer_pad  )  [protected, virtual]

virtual void Gst::Pad::on_request_link (  )  [protected, virtual]

virtual void Gst::Pad::on_unlinked ( const Glib::RefPtr<Gst::Pad>&  peer_pad  )  [protected, virtual]

bool Gst::Pad::pause_task (  ) 

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.

Returns:
A true if the task could be paused or false when the pad has no task.

bool Gst::Pad::peer_accept_caps ( const Glib::RefPtr<Gst::Caps>&  caps  ) 

Check if the peer of pad accepts caps.

If pad has no peer, this function Returns: true if the peer of pad can accept the caps or pad has no peer.

Parameters:
caps A Gst::Caps to check on the pad.
Returns:
true if the peer of pad can accept the caps or pad has no peer.

Glib::RefPtr<const Gst::Caps> Gst::Pad::peer_get_caps (  )  const

Gets the capabilities of the peer connected to this pad.

Returns:
The Gst::Caps of the peer pad. This function returns a new caps, so use gst_caps_unref to get rid of it. this function returns 0 if there is no peer pad.

Glib::RefPtr<Gst::Caps> Gst::Pad::peer_get_caps (  ) 

Gets the capabilities of the peer connected to this pad.

Returns:
The Gst::Caps of the peer pad. This function returns a new caps, so use gst_caps_unref to get rid of it. this function returns 0 if there is no peer pad.

bool Gst::Pad::peer_query ( const Glib::RefPtr<Gst::Query>&  query  ) 

Performs query() on the peer of pad.

The caller is responsible for both the allocation and deallocation of the query structure.

Parameters:
query The Gst::Query to perform.
Returns:
true if the query could be performed. This function returns false if pad has no peer.
Since: 0.10.15.

Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gst::Caps>> Gst::Pad::property_caps (  )  const

The capabilities of the pad.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<PadDirection> Gst::Pad::property_direction (  )  const

The direction of the pad.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<PadTemplate> Gst::Pad::property_template (  )  const

The GstPadTemplate of this pad.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<PadTemplate> Gst::Pad::property_template (  ) 

The GstPadTemplate of this pad.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::RefPtr<const Gst::Caps > Gst::Pad::proxy_getcaps (  )  const

Calls 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.

Returns:
The intersection of the other pads' allowed caps.

Glib::RefPtr<Gst::Caps> Gst::Pad::proxy_getcaps (  ) 

Calls 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.

Returns:
The intersection of the other pads' allowed caps.

bool Gst::Pad::proxy_setcaps ( const Glib::RefPtr<Gst::Caps>&  caps  ) 

Calls set_caps() for every other pad belonging to the same element as pad.

If set_caps() fails on any pad, the proxy setcaps fails. May be used only during negotiation.

Parameters:
caps The Gst::Caps to link with.
Returns:
true if sucessful.

FlowReturn Gst::Pad::pull_range ( guint64  offset,
guint  size,
Glib::RefPtr<Gst::Buffer>&  buffer 
)

FlowReturn Gst::Pad::push ( const Glib::RefPtr<Gst::Buffer>&  buffer  ) 

Pushes a buffer to the peer of the pad.

The pad must be a source pad, otherwise this method returns Gst::FLOW_ERROR.

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 the C API 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 chain() on the peer pad and returns the value from that function. If pad has no peer, Gst::FLOW_NOT_LINKED will be returned.

Parameters:
buffer The Gst::Buffer to push.
Returns:
A Gst::FlowReturn from the peer pad. MT safe.

bool Gst::Pad::push_event ( const Glib::RefPtr<Gst::Event>&  event  ) 

Sends the event to the peer of the pad.

This function is mainly used by elements to send events to their peer elements.

Parameters:
event The GstEvent to send to the pad.
Returns:
true if the event was handled. MT safe.

bool Gst::Pad::query ( const Glib::RefPtr<Gst::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.

Parameters:
query The Gst::Query to perform.
Returns:
true if the query could be performed.

bool Gst::Pad::query_convert ( Format  src_format,
gint64  src_value,
Format dst_format,
gint64 &  dst_value 
) const

Queries a pad to convert src_val in src_format to dest_format.

Parameters:
src_format A Gst::Format to convert from.
src_val A value to convert.
dest_format A pointer to the Gst::Format to convert to.
dest_val A pointer to the result.
Returns:
true if the query could be performed.

bool Gst::Pad::query_default ( const Glib::RefPtr<Gst::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.

Parameters:
query The Gst::Query to handle.
Returns:
true if the query was performed succesfully.

bool Gst::Pad::query_duration ( Format format  )  const

Queries a pad for the total stream duration parsing only the format.

Parameters:
format A reference to the Gst::Format asked for. On return contains the GstFormat used.
Returns:
true if the query could be performed.

bool Gst::Pad::query_duration ( Format format,
gint64 &  duration 
) const

Queries a pad for the total stream duration.

Parameters:
format A pointer to the Gst::Format asked for. On return contains the Gst::Format used.
duration A location in which to store the total duration, or 0.
Returns:
true if the query could be performed.

bool Gst::Pad::query_peer_convert ( Format  src_format,
gint64  src_value,
Format dst_format,
gint64 &  dst_value 
) const

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

Parameters:
src_format A Gst::Format to convert from.
src_val A value to convert.
dest_format A pointer to the Gst::Format to convert to.
dest_val A pointer to the result.
Returns:
true if the query could be performed.

bool Gst::Pad::query_peer_duration ( Format format  )  const

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

Parameters:
format A reference to the Gst::Format asked for. On return contains the Gst::Format used.
Returns:
true if the query could be performed.

bool Gst::Pad::query_peer_duration ( Format format,
gint64 &  duration 
) const

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

Parameters:
format A pointer to the Gst::Format asked for. On return contains the Gst::Format used.
duration A location in which to store the total duration, or 0.
Returns:
true if the query could be performed.

bool Gst::Pad::query_peer_position ( Format format  )  const

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

Parameters:
format A reference to the Gst::Format asked for. On return contains the Gst::Format used.
Returns:
true if the query could be performed.

bool Gst::Pad::query_peer_position ( Format format,
gint64 &  position 
) const

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

Parameters:
format A pointer to the Gst::Format asked for. On return contains the Gst::Format used.
cur A location in which to store the current position, or 0.
Returns:
true if the query could be performed.

bool Gst::Pad::query_position ( Format format  )  const

Queries a pad for the stream position parsing only the format.

Parameters:
format A reference to the Gst::Format asked for. On return contains the Gst::Format used.
Returns:
true if the query could be performed.

bool Gst::Pad::query_position ( Format format,
gint64 &  position 
) const

Queries a pad for the stream position.

Parameters:
format A pointer to the Gst::Format asked for. On return contains the Gst::Format used.
cur A location in which to store the current position, or 0.
Returns:
true if the query could be performed.

void Gst::Pad::remove_buffer_probe ( guint  handler_id  ) 

Removes a buffer probe from pad.

Parameters:
handler_id Handler id returned from gst_pad_add_buffer_probe.

void Gst::Pad::remove_data_probe ( guint  handler_id  ) 

Removes a data probe from pad.

Parameters:
handler_id Handler id returned from gst_pad_add_data_probe.

void Gst::Pad::remove_event_probe ( guint  handler_id  ) 

Removes an event probe from pad.

Parameters:
handler_id Handler id returned from gst_pad_add_event_probe.

bool Gst::Pad::send_event ( const Glib::RefPtr<Gst::Event>&  event  ) 

Sends the event to the pad.

This function can be used by applications to send events in the pipeline.

If the pad is a source pad, event should be an upstream event. If the pad is a sink pad, the 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 Gst::EventTypeFlags, Gst::Enums::get_flags(), 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.

Parameters:
event The Gst::Event to send to the pad.
Returns:
true if the event was handled.

bool Gst::Pad::set_active ( bool  active = true  ) 

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 activate_push() or activate_pull(), as appropriate, with a false argument.

Parameters:
active Whether or not the pad should be active.
Returns:
#true if the operation was successful.
MT safe.

bool Gst::Pad::set_blocked ( bool  blocked = true  ) 

Blocks or unblocks the dataflow on a pad.

This function is a shortcut for set_blocked_async() with a 0 callback.

Parameters:
blocked Boolean indicating we should block or unblock.
Returns:
true if the pad could be blocked. This function can fail if the wrong parameters were passed or the pad was already in the requested state.
MT safe.

bool Gst::Pad::set_blocked_async ( const SlotBlock slot,
bool  blocked = true 
)

Blocks or unblocks the dataflow on a pad asynchronously.

The provided slot 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. Be careful with this blocking call as it might not return for reasons stated above.

Parameters:
slot SlotBlock that will be called when the operation succeeds.
blocked boolean indicating whether the pad should be blocked or unblocked.
Returns:
true if the pad could be blocked. This function can fail if the pad was already in the requested state. MT safe.

bool Gst::Pad::set_caps ( const Glib::RefPtr<Gst::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 0 caps, which will make the pad unnegotiated again.

Parameters:
caps A Gst::Caps to set.
Returns:
true if the caps could be set. false if the caps were not fixed or bad parameters were provided to this function.
MT safe.

Glib::SignalProxy1<void,const Glib::RefPtr<Gst::Pad>&> Gst::Pad::signal_linked (  ) 

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

Prototype:
void on_my_linked(const Glib::RefPtr<Gst::Pad>& peer_pad)

Glib::SignalProxy0< void > Gst::Pad::signal_request_link (  ) 

Signals that a pad connection has been requested.

Prototype:
void on_my_request_link()

Glib::SignalProxy1<void,const Glib::RefPtr<Gst::Pad>&> Gst::Pad::signal_unlinked (  ) 

Signals that a pad has been unlinked from the peer pad.

Prototype:
void on_my_unlinked(const Glib::RefPtr<Gst::Pad>& peer_pad)

bool Gst::Pad::stop_task (  ) 

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.

Returns:
A true if the task could be stopped or false on error.

bool Gst::Pad::unlink ( const Glib::RefPtr<Gst::Pad>&  sink_pad  ) 

Unlinks the source pad from the sink pad.

Will emit the Gst::Pad::unlinked signal on both pads.

Parameters:
sinkpad The sink Gst::Pad to unlink.
Returns:
true if the pads were unlinked. This function returns false if the pads were not linked together.
MT safe.

void Gst::Pad::use_fixed_caps (  ) 

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.


Friends And Related Function Documentation

Glib::RefPtr<Gst::Pad> wrap ( GstPad *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
object The C instance.
take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.


The documentation for this class was generated from the following file:

Generated on Thu Jan 15 09:33:13 2009 for gstreamermm by  doxygen 1.5.7.1