![]() |
![]() |
![]() |
GStreamer 0.10 Library Reference Manual | ![]() |
---|---|---|---|---|
#include <gst/base/gstcollectpads.h> GstCollectData; GstCollectPads; GstFlowReturn (*GstCollectPadsFunction) (GstCollectPads *pads, gpointer user_data); GstCollectPads* gst_collect_pads_new (void); void gst_collect_pads_set_function (GstCollectPads *pads, GstCollectPadsFunction func, gpointer user_data); GstCollectData* gst_collect_pads_add_pad (GstCollectPads *pads, GstPad *pad, guint size); gboolean gst_collect_pads_remove_pad (GstCollectPads *pads, GstPad *pad); gboolean gst_collect_pads_is_active (GstCollectPads *pads, GstPad *pad); GstFlowReturn gst_collect_pads_collect (GstCollectPads *pads); GstFlowReturn gst_collect_pads_collect_range (GstCollectPads *pads, guint64 offset, guint length); void gst_collect_pads_start (GstCollectPads *pads); void gst_collect_pads_stop (GstCollectPads *pads); void gst_collect_pads_set_flushing (GstCollectPads *pads, gboolean flushing); GstBuffer* gst_collect_pads_peek (GstCollectPads *pads, GstCollectData *data); GstBuffer* gst_collect_pads_pop (GstCollectPads *pads, GstCollectData *data); guint gst_collect_pads_available (GstCollectPads *pads); guint gst_collect_pads_read (GstCollectPads *pads, GstCollectData *data, guint8 **bytes, guint size); guint gst_collect_pads_flush (GstCollectPads *pads, GstCollectData *data, guint size);
Manages a set of pads that operate in collect mode. This means that control is given to the manager of this object when all pads have data.
Collectpads are created with gst_collect_pads_new()
. A callback should then
be installed with gst_collect_pads_set_function()
.
Pads are added to the collection with gst_collect_pads_add_pad()
/
gst_collect_pads_remove_pad()
. The pad
has to be a sinkpad. The chain and event functions of the pad are
overridden. The element_private of the pad is used to store
private information for the collectpads.
For each pad, data is queued in the _chain function or by performing a pull_range.
When data is queued on all pads, the callback function is called.
Data can be dequeued from the pad with the gst_collect_pads_pop()
method.
One can peek at the data with the gst_collect_pads_peek()
function.
These functions will return NULL if the pad received an EOS event. When all
pads return NULL from a gst_collect_pads_peek()
, the element can emit an EOS
event itself.
Data can also be dequeued in byte units using the gst_collect_pads_available()
,
gst_collect_pads_read()
and gst_collect_pads_flush()
calls.
Elements should call gst_collect_pads_start()
and gst_collect_pads_stop()
in
their state change functions to start and stop the processing of the collecpads.
The gst_collect_pads_stop()
call should be called before calling the parent
element state change function in the PAUSED_TO_READY state change to ensure
no pad is blocked and the element can finish streaming.
gst_collect_pads_collect()
and gst_collect_pads_collect_range()
can be used by
elements that start a GstTask to drive the collect_pads. This feature is however
not yet implemented.
Last reviewed on 2006-05-10 (0.10.6)
typedef struct { /* with LOCK of @collect */ GstCollectPads *collect; GstPad *pad; GstBuffer *buffer; guint pos; GstSegment segment; } GstCollectData;
Structure used by the collect_pads.
collect
;GstCollectPadscollect
owner GstCollectPads
owner GstCollectPads
GstCollectPadsGstCollectPadsGstPad *pad
;GstPadpad
GstPad managed by this data
GstPad managed by this data
GstPadGstPadGstBuffer *buffer
;GstBufferbuffer
currently queued buffer.
currently queued buffer.
guint pos
;guintpos
position in the buffer
position in the buffer
GstSegment segment
;GstSegmentsegment
last segment received.
last segment received.
GstCollectPads *collect ; |
owner GstCollectPads |
GstPad *pad ; |
GstPad managed by this data |
GstBuffer *buffer ; |
currently queued buffer. |
guint pos ; |
position in the buffer |
GstSegment segment ; |
last segment received. |
typedef struct { GSList *data; /* list of CollectData items */ } GstCollectPads;
Collectpads object.
data
;GSListdata
GList of GstCollectData managed by this GstCollectPads.
GList of GstCollectData managed by this GstCollectPads.
GListGListGstCollectDataGstCollectDataGstCollectPadsGstCollectPads
GSList *data ; |
GList of GstCollectData managed by this GstCollectPads. |
GstFlowReturn (*GstCollectPadsFunction) (GstCollectPads *pads, gpointer user_data);
A function that will be called when all pads have received data.
pads
:pads
the GstCollectPads that trigered the callback
the GstCollectPads that trigered the callback
GstCollectPadsGstCollectPadsuser_data
:user_data
user data passed to gst_collect_pads_set_function()
user data passed to gst_collect_pads_set_function()
gst_collect_pads_set_function()
gst_collect_pads_set_function()
Returns :Returns GST_FLOW_OK for success
GST_FLOW_OK for success
GST_FLOW_OKGST_FLOW_OK
pads : |
the GstCollectPads that trigered the callback |
user_data : |
user data passed to gst_collect_pads_set_function()
|
Returns : | GST_FLOW_OK for success |
GstCollectPads* gst_collect_pads_new (void);
Create a new instance of GstCollectsPads.
Returns : | a new GstCollectPads, or NULL in case of an error. MT safe. |
void gst_collect_pads_set_function (GstCollectPads *pads, GstCollectPadsFunction func, gpointer user_data);
Set the callback function and user data that will be called when all the pads added to the collection have buffers queued.
MT safe.
pads
:pads
the collectspads to use
the collectspads to use
func
:func
the function to set
the function to set
user_data
:user_data
user data passed to the function
user data passed to the function
pads : |
the collectspads to use |
func : |
the function to set |
user_data : |
user data passed to the function |
GstCollectData* gst_collect_pads_add_pad (GstCollectPads *pads, GstPad *pad, guint size);
Add a pad to the collection of collect pads. The pad has to be
a sinkpad. The refcount of the pad is incremented. Use
gst_collect_pads_remove_pad()
to remove the pad from the collection
again.
You specify a size for the returned GstCollectData structure so that you can use it to store additional information.
pads
:pads
the collectspads to use
the collectspads to use
pad
:pad
the pad to add
the pad to add
size
:size
the size of the returned GstCollectData structure
the size of the returned GstCollectData structure
GstCollectDataGstCollectDataReturns :Returns a new GstCollectData to identify the new pad. Or NULL
if wrong parameters are supplied.
MT safe.
a new GstCollectData to identify the new pad. Or NULL
if wrong parameters are supplied.
MT safe.
GstCollectDataGstCollectData
pads : |
the collectspads to use |
pad : |
the pad to add |
size : |
the size of the returned GstCollectData structure |
Returns : | a new GstCollectData to identify the new pad. Or NULL if wrong parameters are supplied. MT safe. |
gboolean gst_collect_pads_remove_pad (GstCollectPads *pads, GstPad *pad);
Remove a pad from the collection of collect pads. This function will also
free the GstCollectData and all the resources that were allocated with
gst_collect_pads_add_pad()
.
pads
:pads
the collectspads to use
the collectspads to use
pad
:pad
the pad to remove
the pad to remove
Returns :Returns TRUE
if the pad could be removed.
MT safe.
TRUE
if the pad could be removed.
MT safe.
TRUE
TRUE
pads : |
the collectspads to use |
pad : |
the pad to remove |
Returns : | TRUE if the pad could be removed.
MT safe.
|
gboolean gst_collect_pads_is_active (GstCollectPads *pads, GstPad *pad);
Check if a pad is active.
This function is currently not implemented.
pads
:pads
the collectspads to use
the collectspads to use
pad
:pad
the pad to check
the pad to check
Returns :Returns TRUE
if the pad is active.
MT safe.
TRUE
if the pad is active.
MT safe.
TRUE
TRUE
pads : |
the collectspads to use |
pad : |
the pad to check |
Returns : | TRUE if the pad is active.
MT safe.
|
GstFlowReturn gst_collect_pads_collect (GstCollectPads *pads);
Collect data on all pads. This function is usually called from a GstTask function in an element.
This function is currently not implemented.
pads
:pads
the collectspads to use
the collectspads to use
Returns :Returns GstFlowReturn of the operation.
MT safe.
GstFlowReturn of the operation.
MT safe.
GstFlowReturnGstFlowReturn
pads : |
the collectspads to use |
Returns : | GstFlowReturn of the operation. MT safe. |
GstFlowReturn gst_collect_pads_collect_range (GstCollectPads *pads, guint64 offset, guint length);
Collect data with offset
and length
on all pads. This function
is typically called in the getrange function of an element.
This function is currently not implemented.
pads
:pads
the collectspads to use
the collectspads to use
offset
:offset
the offset to collect
the offset to collect
length
:length
the length to collect
the length to collect
Returns :Returns GstFlowReturn of the operation.
MT safe.
GstFlowReturn of the operation.
MT safe.
GstFlowReturnGstFlowReturn
pads : |
the collectspads to use |
offset : |
the offset to collect |
length : |
the length to collect |
Returns : | GstFlowReturn of the operation. MT safe. |
void gst_collect_pads_start (GstCollectPads *pads);
Starts the processing of data in the collect_pads.
MT safe.
pads
:pads
the collectspads to use
the collectspads to use
pads : |
the collectspads to use |
void gst_collect_pads_stop (GstCollectPads *pads);
Stops the processing of data in the collect_pads. this function will also unblock any blocking operations.
MT safe.
pads
:pads
the collectspads to use
the collectspads to use
pads : |
the collectspads to use |
void gst_collect_pads_set_flushing (GstCollectPads *pads, gboolean flushing);
Change the flushing state of all the pads in the collection. No pad
is able to accept anymore data when flushing
is TRUE
. Calling this
function with flushing
TRUE
makes pads
accept data again.
MT safe.
pads
:pads
the collectspads to use
the collectspads to use
flushing
:flushing
desired state of the pads
desired state of the pads
pads : |
the collectspads to use |
flushing : |
desired state of the pads |
Since 0.10.7.
GstBuffer* gst_collect_pads_peek (GstCollectPads *pads, GstCollectData *data);
Peek at the buffer currently queued in data
. This function
should be called with the pads
LOCK held, such as in the callback
handler.
pads
:pads
the collectspads to peek
the collectspads to peek
data
:data
the data to use
the data to use
Returns :Returns The buffer in data
or NULL if no buffer is queued.
should unref the buffer after usage.
MT safe.
The buffer in data
or NULL if no buffer is queued.
should unref the buffer after usage.
MT safe.
data
pads : |
the collectspads to peek |
data : |
the data to use |
Returns : | The buffer in data or NULL if no buffer is queued.
should unref the buffer after usage.
MT safe.
|
GstBuffer* gst_collect_pads_pop (GstCollectPads *pads, GstCollectData *data);
Pop the buffer currently queued in data
. This function
should be called with the pads
LOCK held, such as in the callback
handler.
pads
:pads
the collectspads to pop
the collectspads to pop
data
:data
the data to use
the data to use
Returns :Returns The buffer in data
or NULL if no buffer was queued.
You should unref the buffer after usage.
MT safe.
The buffer in data
or NULL if no buffer was queued.
You should unref the buffer after usage.
MT safe.
data
pads : |
the collectspads to pop |
data : |
the data to use |
Returns : | The buffer in data or NULL if no buffer was queued.
You should unref the buffer after usage.
MT safe.
|
guint gst_collect_pads_available (GstCollectPads *pads);
Query how much bytes can be read from each queued buffer. This means that the result of this call is the maximum number of bytes that can be read from each of the pads.
This function should be called with pads
LOCK held, such as
in the callback.
Returns: The maximum number of bytes queued on all pad. This function
pads
:pads
the collectspads to query
the collectspads to query
Returns :Returns0 if a pad has no queued buffer.
MT safe.
0 if a pad has no queued buffer.
MT safe.
pads : |
the collectspads to query |
Returns : | 0 if a pad has no queued buffer. MT safe. |
guint gst_collect_pads_read (GstCollectPads *pads, GstCollectData *data, guint8 **bytes, guint size);
Get a pointer in bytes
where size
bytes can be read from the
given pad data.
This function should be called with pads
LOCK held, such as
in the callback.
pads
:pads
the collectspads to query
the collectspads to query
data
:data
the data to use
the data to use
bytes
:bytes
a pointer to a byte array
a pointer to a byte array
size
:size
the number of bytes to read
the number of bytes to read
Returns :Returns The number of bytes available for consumption in the
memory pointed to by bytes
. This can be less than size
and
is 0 if the pad is end-of-stream.
MT safe.
The number of bytes available for consumption in the
memory pointed to by bytes
. This can be less than size
and
is 0 if the pad is end-of-stream.
MT safe.
bytes
size
pads : |
the collectspads to query |
data : |
the data to use |
bytes : |
a pointer to a byte array |
size : |
the number of bytes to read |
Returns : | The number of bytes available for consumption in the
memory pointed to by bytes . This can be less than size and
is 0 if the pad is end-of-stream.
MT safe.
|
guint gst_collect_pads_flush (GstCollectPads *pads, GstCollectData *data, guint size);
Flush size
bytes from the pad data
.
This function should be called with pads
LOCK held, such as
in the callback.
pads
:pads
the collectspads to query
the collectspads to query
data
:data
the data to use
the data to use
size
:size
the number of bytes to flush
the number of bytes to flush
Returns :Returns The number of bytes flushed This can be less than size
and
is 0 if the pad was end-of-stream.
MT safe.
The number of bytes flushed This can be less than size
and
is 0 if the pad was end-of-stream.
MT safe.
size
pads : |
the collectspads to query |
data : |
the data to use |
size : |
the number of bytes to flush |
Returns : | The number of bytes flushed This can be less than size and
is 0 if the pad was end-of-stream.
MT safe.
|