Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
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.
<itemizedlist>
<listitem><para>
Collectpads are created with collectPadsNew
. A callback should then
be installed with gst_collect_pads_set_function ().
</para></listitem>
<listitem><para>
Pads are added to the collection with collectPadsAddPad
/
collectPadsRemovePad
. 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.
</para></listitem>
<listitem><para>
For each pad, data is queued in the _chain function or by
performing a pull_range.
</para></listitem>
<listitem><para>
When data is queued on all pads in waiting mode, the callback function is called.
</para></listitem>
<listitem><para>
Data can be dequeued from the pad with the collectPadsPop
method.
One can peek at the data with the collectPadsPeek
function.
These functions will return Nothing
if the pad received an EOS event. When all
pads return Nothing
from a collectPadsPeek
, the element can emit an EOS
event itself.
</para></listitem>
<listitem><para>
Data can also be dequeued in byte units using the collectPadsAvailable
,
collectPadsReadBuffer
and collectPadsFlush
calls.
</para></listitem>
<listitem><para>
Elements should call collectPadsStart
and collectPadsStop
in
their state change functions to start and stop the processing of the collectpads.
The collectPadsStop
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.
</para></listitem>
<listitem><para>
collectPadsSetWaiting
sets a pad to waiting or non-waiting mode.
CollectPads element is not waiting for data to be collected on non-waiting pads.
Thus these pads may but need not have data when the callback is called.
All pads are in waiting mode by default.
</para></listitem>
</itemizedlist>
- newtype CollectPads = CollectPads (ManagedPtr CollectPads)
- class GObject o => IsCollectPads o
- toCollectPads :: IsCollectPads o => o -> IO CollectPads
- noCollectPads :: Maybe CollectPads
- data CollectPadsAddPadMethodInfo
- collectPadsAddPad :: (HasCallStack, MonadIO m, IsCollectPads a, IsPad b) => a -> b -> Word32 -> CollectDataDestroyNotify -> Bool -> m (Maybe CollectData)
- data CollectPadsAvailableMethodInfo
- collectPadsAvailable :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> m Word32
- data CollectPadsClipRunningTimeMethodInfo
- collectPadsClipRunningTime :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectData -> Buffer -> Maybe Buffer -> Ptr () -> m FlowReturn
- data CollectPadsEventDefaultMethodInfo
- collectPadsEventDefault :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectData -> Event -> Bool -> m Bool
- data CollectPadsFlushMethodInfo
- collectPadsFlush :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectData -> Word32 -> m Word32
- collectPadsNew :: (HasCallStack, MonadIO m) => m CollectPads
- data CollectPadsPeekMethodInfo
- collectPadsPeek :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectData -> m (Maybe Buffer)
- data CollectPadsPopMethodInfo
- collectPadsPop :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectData -> m (Maybe Buffer)
- data CollectPadsQueryDefaultMethodInfo
- collectPadsQueryDefault :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectData -> Query -> Bool -> m Bool
- data CollectPadsReadBufferMethodInfo
- collectPadsReadBuffer :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectData -> Word32 -> m (Maybe Buffer)
- data CollectPadsRemovePadMethodInfo
- collectPadsRemovePad :: (HasCallStack, MonadIO m, IsCollectPads a, IsPad b) => a -> b -> m Bool
- data CollectPadsSetBufferFunctionMethodInfo
- collectPadsSetBufferFunction :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectPadsBufferFunction -> m ()
- data CollectPadsSetClipFunctionMethodInfo
- collectPadsSetClipFunction :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectPadsClipFunction -> m ()
- data CollectPadsSetCompareFunctionMethodInfo
- collectPadsSetCompareFunction :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectPadsCompareFunction -> m ()
- data CollectPadsSetEventFunctionMethodInfo
- collectPadsSetEventFunction :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectPadsEventFunction -> m ()
- data CollectPadsSetFlushFunctionMethodInfo
- collectPadsSetFlushFunction :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectPadsFlushFunction -> m ()
- data CollectPadsSetFlushingMethodInfo
- collectPadsSetFlushing :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> Bool -> m ()
- data CollectPadsSetFunctionMethodInfo
- collectPadsSetFunction :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectPadsFunction -> m ()
- data CollectPadsSetQueryFunctionMethodInfo
- collectPadsSetQueryFunction :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectPadsQueryFunction -> m ()
- data CollectPadsSetWaitingMethodInfo
- collectPadsSetWaiting :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectData -> Bool -> m ()
- data CollectPadsSrcEventDefaultMethodInfo
- collectPadsSrcEventDefault :: (HasCallStack, MonadIO m, IsCollectPads a, IsPad b) => a -> b -> Event -> m Bool
- data CollectPadsStartMethodInfo
- collectPadsStart :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> m ()
- data CollectPadsStopMethodInfo
- collectPadsStop :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> m ()
- data CollectPadsTakeBufferMethodInfo
- collectPadsTakeBuffer :: (HasCallStack, MonadIO m, IsCollectPads a) => a -> CollectData -> Word32 -> m (Maybe Buffer)
Exported types
newtype CollectPads Source #
GObject CollectPads Source # | |
IsObject CollectPads Source # | |
IsObject CollectPads Source # | |
IsCollectPads CollectPads Source # | |
((~) * info (ResolveCollectPadsMethod t CollectPads), MethodInfo * info CollectPads p) => IsLabel t (CollectPads -> p) Source # | |
((~) * info (ResolveCollectPadsMethod t CollectPads), MethodInfo * info CollectPads p) => IsLabelProxy t (CollectPads -> p) Source # | |
HasAttributeList * CollectPads Source # | |
type AttributeList CollectPads Source # | |
type SignalList CollectPads Source # | |
class GObject o => IsCollectPads o Source #
toCollectPads :: IsCollectPads o => o -> IO CollectPads Source #
Methods
addPad
data CollectPadsAddPadMethodInfo Source #
((~) * signature (b -> Word32 -> CollectDataDestroyNotify -> Bool -> m (Maybe CollectData)), MonadIO m, IsCollectPads a, IsPad b) => MethodInfo * CollectPadsAddPadMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCollectPads a, IsPad b) | |
=> a |
|
-> b |
|
-> Word32 |
|
-> CollectDataDestroyNotify |
|
-> Bool |
|
-> m (Maybe CollectData) | Returns: a new |
Add a pad to the collection of collect pads. The pad has to be
a sinkpad. The refcount of the pad is incremented. Use
collectPadsRemovePad
to remove the pad from the collection
again.
You specify a size for the returned CollectData
structure
so that you can use it to store additional information.
You can also specify a CollectDataDestroyNotify
that will be called
just before the CollectData
structure is freed. It is passed the
pointer to the structure and should free any custom memory and resources
allocated for it.
Keeping a pad locked in waiting state is only relevant when using the default collection algorithm (providing the oldest buffer). It ensures a buffer must be available on this pad for a collection to take place. This is of typical use to a muxer element where non-subtitle streams should always be in waiting state, e.g. to assure that caps information is available on all these streams when initial headers have to be written.
The pad will be automatically activated in push mode when pads
is
started.
MT safe.
available
data CollectPadsAvailableMethodInfo Source #
((~) * signature (m Word32), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsAvailableMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> m Word32 | Returns: The maximum number of bytes queued on all pads. This function returns 0 if a pad has no queued buffer. |
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
STREAM_LOCK held, such as
in the callback.
MT safe.
clipRunningTime
data CollectPadsClipRunningTimeMethodInfo Source #
((~) * signature (CollectData -> Buffer -> Maybe Buffer -> Ptr () -> m FlowReturn), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsClipRunningTimeMethodInfo a signature Source # | |
collectPadsClipRunningTime Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectData |
|
-> Buffer |
|
-> Maybe Buffer |
|
-> Ptr () |
|
-> m FlowReturn |
Convenience clipping function that converts incoming buffer's timestamp to running time, or clips the buffer if outside configured segment.
Since 1.6, this clipping function also sets the DTS parameter of the GstCollectData structure. This version of the running time DTS can be negative. G_MININT64 is used to indicate invalid value.
eventDefault
data CollectPadsEventDefaultMethodInfo Source #
((~) * signature (CollectData -> Event -> Bool -> m Bool), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsEventDefaultMethodInfo a signature Source # | |
collectPadsEventDefault Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectData |
|
-> Event |
|
-> Bool |
|
-> m Bool |
Default CollectPads
event handling that elements should always
chain up to to ensure proper operation. Element might however indicate
event should not be forwarded downstream.
flush
data CollectPadsFlushMethodInfo Source #
((~) * signature (CollectData -> Word32 -> m Word32), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsFlushMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectData |
|
-> Word32 |
|
-> m Word32 | Returns: The number of bytes flushed This can be less than |
Flush size
bytes from the pad data
.
This function should be called with pads
STREAM_LOCK held, such as
in the callback.
MT safe.
new
:: (HasCallStack, MonadIO m) | |
=> m CollectPads | Returns: a new |
Create a new instance of CollectPads
.
MT safe.
peek
data CollectPadsPeekMethodInfo Source #
((~) * signature (CollectData -> m (Maybe Buffer)), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsPeekMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectData |
|
-> m (Maybe Buffer) | Returns: The buffer in |
Peek at the buffer currently queued in data
. This function
should be called with the pads
STREAM_LOCK held, such as in the callback
handler.
MT safe.
pop
data CollectPadsPopMethodInfo Source #
((~) * signature (CollectData -> m (Maybe Buffer)), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsPopMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectData |
|
-> m (Maybe Buffer) | Returns: The buffer in |
Pop the buffer currently queued in data
. This function
should be called with the pads
STREAM_LOCK held, such as in the callback
handler.
MT safe.
queryDefault
data CollectPadsQueryDefaultMethodInfo Source #
((~) * signature (CollectData -> Query -> Bool -> m Bool), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsQueryDefaultMethodInfo a signature Source # | |
collectPadsQueryDefault Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectData |
|
-> Query |
|
-> Bool |
|
-> m Bool |
Default CollectPads
query handling that elements should always
chain up to to ensure proper operation. Element might however indicate
query should not be forwarded downstream.
readBuffer
data CollectPadsReadBufferMethodInfo Source #
((~) * signature (CollectData -> Word32 -> m (Maybe Buffer)), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsReadBufferMethodInfo a signature Source # | |
collectPadsReadBuffer Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectData |
|
-> Word32 |
|
-> m (Maybe Buffer) | Returns: A sub buffer. The size of the buffer can
be less that requested. A return of |
Get a subbuffer of size
bytes from the given pad data
.
This function should be called with pads
STREAM_LOCK held, such as in the
callback.
MT safe.
removePad
data CollectPadsRemovePadMethodInfo Source #
((~) * signature (b -> m Bool), MonadIO m, IsCollectPads a, IsPad b) => MethodInfo * CollectPadsRemovePadMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCollectPads a, IsPad b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: |
Remove a pad from the collection of collect pads. This function will also
free the CollectData
and all the resources that were allocated with
collectPadsAddPad
.
The pad will be deactivated automatically when pads
is stopped.
MT safe.
setBufferFunction
data CollectPadsSetBufferFunctionMethodInfo Source #
((~) * signature (CollectPadsBufferFunction -> m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsSetBufferFunctionMethodInfo a signature Source # | |
collectPadsSetBufferFunction Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectPadsBufferFunction |
|
-> m () |
Set the callback function and user data that will be called with
the oldest buffer when all pads have been collected, or Nothing
on EOS.
If a buffer is passed, the callback owns a reference and must unref
it.
MT safe.
setClipFunction
data CollectPadsSetClipFunctionMethodInfo Source #
((~) * signature (CollectPadsClipFunction -> m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsSetClipFunctionMethodInfo a signature Source # | |
collectPadsSetClipFunction Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectPadsClipFunction |
|
-> m () |
Install a clipping function that is called right after a buffer is received
on a pad managed by pads
. See CollectPadsClipFunction
for more info.
setCompareFunction
data CollectPadsSetCompareFunctionMethodInfo Source #
((~) * signature (CollectPadsCompareFunction -> m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsSetCompareFunctionMethodInfo a signature Source # | |
collectPadsSetCompareFunction Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectPadsCompareFunction |
|
-> m () |
Set the timestamp comparison function.
MT safe.
setEventFunction
data CollectPadsSetEventFunctionMethodInfo Source #
((~) * signature (CollectPadsEventFunction -> m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsSetEventFunctionMethodInfo a signature Source # | |
collectPadsSetEventFunction Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectPadsEventFunction |
|
-> m () |
Set the event callback function and user data that will be called when
collectpads has received an event originating from one of the collected
pads. If the event being processed is a serialized one, this callback is
called with pads
STREAM_LOCK held, otherwise not. As this lock should be
held when calling a number of CollectPads functions, it should be acquired
if so (unusually) needed.
MT safe.
setFlushFunction
data CollectPadsSetFlushFunctionMethodInfo Source #
((~) * signature (CollectPadsFlushFunction -> m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsSetFlushFunctionMethodInfo a signature Source # | |
collectPadsSetFlushFunction Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectPadsFlushFunction |
|
-> m () |
Install a flush function that is called when the internal
state of all pads should be flushed as part of flushing seek
handling. See CollectPadsFlushFunction
for more info.
Since: 1.4
setFlushing
data CollectPadsSetFlushingMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsSetFlushingMethodInfo a signature Source # | |
collectPadsSetFlushing Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> Bool |
|
-> m () |
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
False
makes pads
accept data again.
Caller must ensure that downstream streaming (thread) is not blocked,
e.g. by sending a FLUSH_START downstream.
MT safe.
setFunction
data CollectPadsSetFunctionMethodInfo Source #
((~) * signature (CollectPadsFunction -> m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsSetFunctionMethodInfo a signature Source # | |
collectPadsSetFunction Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectPadsFunction |
|
-> m () |
CollectPads provides a default collection algorithm that will determine
the oldest buffer available on all of its pads, and then delegate
to a configured callback.
However, if circumstances are more complicated and/or more control
is desired, this sets a callback that will be invoked instead when
all the pads added to the collection have buffers queued.
Evidently, this callback is not compatible with
collectPadsSetBufferFunction
callback.
If this callback is set, the former will be unset.
MT safe.
setQueryFunction
data CollectPadsSetQueryFunctionMethodInfo Source #
((~) * signature (CollectPadsQueryFunction -> m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsSetQueryFunctionMethodInfo a signature Source # | |
collectPadsSetQueryFunction Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectPadsQueryFunction |
|
-> m () |
Set the query callback function and user data that will be called after
collectpads has received a query originating from one of the collected
pads. If the query being processed is a serialized one, this callback is
called with pads
STREAM_LOCK held, otherwise not. As this lock should be
held when calling a number of CollectPads functions, it should be acquired
if so (unusually) needed.
MT safe.
setWaiting
data CollectPadsSetWaitingMethodInfo Source #
((~) * signature (CollectData -> Bool -> m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsSetWaitingMethodInfo a signature Source # | |
collectPadsSetWaiting Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectData |
|
-> Bool |
|
-> m () |
Sets a pad to waiting or non-waiting mode, if at least this pad has not been created with locked waiting state, in which case nothing happens.
This function should be called with pads
STREAM_LOCK held, such as
in the callback.
MT safe.
srcEventDefault
data CollectPadsSrcEventDefaultMethodInfo Source #
((~) * signature (b -> Event -> m Bool), MonadIO m, IsCollectPads a, IsPad b) => MethodInfo * CollectPadsSrcEventDefaultMethodInfo a signature Source # | |
collectPadsSrcEventDefault Source #
:: (HasCallStack, MonadIO m, IsCollectPads a, IsPad b) | |
=> a |
|
-> b |
|
-> Event |
|
-> m Bool |
Default CollectPads
event handling for the src pad of elements.
Elements can chain up to this to let flushing seek event handling
be done by CollectPads
.
Since: 1.4
start
data CollectPadsStartMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsStartMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> m () |
Starts the processing of data in the collect_pads.
MT safe.
stop
data CollectPadsStopMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsStopMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> m () |
Stops the processing of data in the collect_pads. this function will also unblock any blocking operations.
MT safe.
takeBuffer
data CollectPadsTakeBufferMethodInfo Source #
((~) * signature (CollectData -> Word32 -> m (Maybe Buffer)), MonadIO m, IsCollectPads a) => MethodInfo * CollectPadsTakeBufferMethodInfo a signature Source # | |
collectPadsTakeBuffer Source #
:: (HasCallStack, MonadIO m, IsCollectPads a) | |
=> a |
|
-> CollectData |
|
-> Word32 |
|
-> m (Maybe Buffer) | Returns: A sub buffer. The size of the buffer can
be less that requested. A return of |
Get a subbuffer of size
bytes from the given pad data
. Flushes the amount
of read bytes.
This function should be called with pads
STREAM_LOCK held, such as in the
callback.
MT safe.