Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
Safe Haskell | None |
Language | Haskell2010 |
A Pipeline
is a special Bin
used as the toplevel container for
the filter graph. The Pipeline
will manage the selection and
distribution of a global Clock
as well as provide a Bus
to the
application.
pipelineNew
is used to create a pipeline. when you are done with
the pipeline, use objectUnref
to free its resources including all
added Element
objects (if not otherwise referenced).
Elements are added and removed from the pipeline using the Bin
methods like binAdd
and binRemove
(see Bin
).
Before changing the state of the Pipeline
(see Element
) a Bus
can be retrieved with pipelineGetBus
. This bus can then be
used to receive Message
from the elements in the pipeline.
By default, a Pipeline
will automatically flush the pending Bus
messages when going to the NULL state to ensure that no circular
references exist when no messages are read from the Bus
. This
behaviour can be changed with pipelineSetAutoFlushBus
.
When the Pipeline
performs the PAUSED to PLAYING state change it will
select a clock for the elements. The clock selection algorithm will by
default select a clock provided by an element that is most upstream
(closest to the source). For live pipelines (ones that return
GST_STATE_CHANGE_NO_PREROLL
from the elementSetState
call) this
will select the clock provided by the live source. For normal pipelines
this will select a clock provided by the sinks (most likely the audio
sink). If no element provides a clock, a default SystemClock
is used.
The clock selection can be controlled with the pipelineUseClock
method, which will enforce a given clock on the pipeline. With
pipelineAutoClock
the default clock selection algorithm can be
restored.
A Pipeline
maintains a running time for the elements. The running
time is defined as the difference between the current clock time and
the base time. When the pipeline goes to READY or a flushing seek is
performed on it, the running time is reset to 0. When the pipeline is
set from PLAYING to PAUSED, the current clock time is sampled and used to
configure the base time for the elements when the pipeline is set
to PLAYING again. The effect is that the running time (as the difference
between the clock time and the base time) will count how much time was spent
in the PLAYING state. This default behaviour can be changed with the
elementSetStartTime
method.
Synopsis
- newtype Pipeline = Pipeline (ManagedPtr Pipeline)
- class (GObject o, IsDescendantOf Pipeline o) => IsPipeline o
- toPipeline :: (MonadIO m, IsPipeline o) => o -> m Pipeline
- noPipeline :: Maybe Pipeline
- pipelineAutoClock :: (HasCallStack, MonadIO m, IsPipeline a) => a -> m ()
- pipelineGetAutoFlushBus :: (HasCallStack, MonadIO m, IsPipeline a) => a -> m Bool
- pipelineGetBus :: (HasCallStack, MonadIO m, IsPipeline a) => a -> m Bus
- pipelineGetDelay :: (HasCallStack, MonadIO m, IsPipeline a) => a -> m Word64
- pipelineGetLatency :: (HasCallStack, MonadIO m, IsPipeline a) => a -> m Word64
- pipelineGetPipelineClock :: (HasCallStack, MonadIO m, IsPipeline a) => a -> m Clock
- pipelineNew :: (HasCallStack, MonadIO m) => Maybe Text -> m Pipeline
- pipelineSetAutoFlushBus :: (HasCallStack, MonadIO m, IsPipeline a) => a -> Bool -> m ()
- pipelineSetDelay :: (HasCallStack, MonadIO m, IsPipeline a) => a -> Word64 -> m ()
- pipelineSetLatency :: (HasCallStack, MonadIO m, IsPipeline a) => a -> Word64 -> m ()
- pipelineUseClock :: (HasCallStack, MonadIO m, IsPipeline a, IsClock b) => a -> Maybe b -> m ()
- constructPipelineAutoFlushBus :: IsPipeline o => Bool -> IO (GValueConstruct o)
- getPipelineAutoFlushBus :: (MonadIO m, IsPipeline o) => o -> m Bool
- setPipelineAutoFlushBus :: (MonadIO m, IsPipeline o) => o -> Bool -> m ()
- constructPipelineDelay :: IsPipeline o => Word64 -> IO (GValueConstruct o)
- getPipelineDelay :: (MonadIO m, IsPipeline o) => o -> m Word64
- setPipelineDelay :: (MonadIO m, IsPipeline o) => o -> Word64 -> m ()
- constructPipelineLatency :: IsPipeline o => Word64 -> IO (GValueConstruct o)
- getPipelineLatency :: (MonadIO m, IsPipeline o) => o -> m Word64
- setPipelineLatency :: (MonadIO m, IsPipeline o) => o -> Word64 -> m ()
Exported types
Memory-managed wrapper type.
Instances
GObject Pipeline Source # | |
Defined in GI.Gst.Objects.Pipeline gobjectType :: IO GType # | |
HasParentTypes Pipeline Source # | |
Defined in GI.Gst.Objects.Pipeline | |
type ParentTypes Pipeline Source # | |
Defined in GI.Gst.Objects.Pipeline type ParentTypes Pipeline = Bin ': (Element ': (Object ': (Object ': (ChildProxy ': ([] :: [Type]))))) |
class (GObject o, IsDescendantOf Pipeline o) => IsPipeline o Source #
Type class for types which can be safely cast to Pipeline
, for instance with toPipeline
.
Instances
(GObject o, IsDescendantOf Pipeline o) => IsPipeline o Source # | |
Defined in GI.Gst.Objects.Pipeline |
toPipeline :: (MonadIO m, IsPipeline o) => o -> m Pipeline Source #
Methods
autoClock
:: (HasCallStack, MonadIO m, IsPipeline a) | |
=> a |
|
-> m () |
Let pipeline
select a clock automatically. This is the default
behaviour.
Use this function if you previous forced a fixed clock with
pipelineUseClock
and want to restore the default
pipeline clock selection algorithm.
MT safe.
getAutoFlushBus
pipelineGetAutoFlushBus Source #
:: (HasCallStack, MonadIO m, IsPipeline a) | |
=> a |
|
-> m Bool | Returns: whether the pipeline will automatically flush its bus when going from READY to NULL state or not. MT safe. |
Check if pipeline
will automatically flush messages when going to
the NULL state.
getBus
:: (HasCallStack, MonadIO m, IsPipeline a) | |
=> a |
|
-> m Bus | Returns: a MT safe. |
getDelay
:: (HasCallStack, MonadIO m, IsPipeline a) | |
=> a |
|
-> m Word64 | Returns: The configured delay. MT safe. |
Get the configured delay (see pipelineSetDelay
).
getLatency
:: (HasCallStack, MonadIO m, IsPipeline a) | |
=> a |
|
-> m Word64 | Returns: Latency to configure on the pipeline or GST_CLOCK_TIME_NONE |
Gets the latency that should be configured on the pipeline. See
pipelineSetLatency
.
Since: 1.6
getPipelineClock
pipelineGetPipelineClock Source #
:: (HasCallStack, MonadIO m, IsPipeline a) | |
=> a |
|
-> m Clock | Returns: a |
Gets the current clock used by pipeline
.
Unlike elementGetClock
, this function will always return a
clock, even if the pipeline is not in the PLAYING state.
Since: 1.6
new
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> m Pipeline | Returns: newly created GstPipeline MT safe. |
Create a new pipeline with the given name.
setAutoFlushBus
pipelineSetAutoFlushBus Source #
:: (HasCallStack, MonadIO m, IsPipeline a) | |
=> a |
|
-> Bool |
|
-> m () |
Usually, when a pipeline goes from READY to NULL state, it automatically flushes all pending messages on the bus, which is done for refcounting purposes, to break circular references.
This means that applications that update state using (async) bus messages (e.g. do certain things when a pipeline goes from PAUSED to READY) might not get to see messages when the pipeline is shut down, because they might be flushed before they can be dispatched in the main thread. This behaviour can be disabled using this function.
It is important that all messages on the bus are handled when the automatic flushing is disabled else memory leaks will be introduced.
MT safe.
setDelay
:: (HasCallStack, MonadIO m, IsPipeline a) | |
=> a |
|
-> Word64 |
|
-> m () |
Set the expected delay needed for all elements to perform the
PAUSED to PLAYING state change. delay
will be added to the
base time of the elements so that they wait an additional delay
amount of time before starting to process buffers and cannot be
CLOCK_TIME_NONE
.
This option is used for tuning purposes and should normally not be used.
MT safe.
setLatency
:: (HasCallStack, MonadIO m, IsPipeline a) | |
=> a |
|
-> Word64 |
|
-> m () |
Sets the latency that should be configured on the pipeline. Setting GST_CLOCK_TIME_NONE will restore the default behaviour of using the minimum latency from the LATENCY query. Setting this is usually not required and the pipeline will figure out an appropriate latency automatically.
Setting a too low latency, especially lower than the minimum latency from the LATENCY query, will most likely cause the pipeline to fail.
Since: 1.6
useClock
:: (HasCallStack, MonadIO m, IsPipeline a, IsClock b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Force pipeline
to use the given clock
. The pipeline will
always use the given clock even if new clock providers are added
to this pipeline.
If clock
is Nothing
all clocking will be disabled which will make
the pipeline run as fast as possible.
MT safe.
Properties
autoFlushBus
Whether or not to automatically flush all messages on the
pipeline's bus when going from READY to NULL state. Please see
pipelineSetAutoFlushBus
for more information on this option.
constructPipelineAutoFlushBus :: IsPipeline o => Bool -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “auto-flush-bus
” property. This is rarely needed directly, but it is used by new
.
getPipelineAutoFlushBus :: (MonadIO m, IsPipeline o) => o -> m Bool Source #
Get the value of the “auto-flush-bus
” property.
When overloading is enabled, this is equivalent to
get
pipeline #autoFlushBus
setPipelineAutoFlushBus :: (MonadIO m, IsPipeline o) => o -> Bool -> m () Source #
Set the value of the “auto-flush-bus
” property.
When overloading is enabled, this is equivalent to
set
pipeline [ #autoFlushBus:=
value ]
delay
The expected delay needed for elements to spin up to the
PLAYING state expressed in nanoseconds.
see pipelineSetDelay
for more information on this option.
constructPipelineDelay :: IsPipeline o => Word64 -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “delay
” property. This is rarely needed directly, but it is used by new
.
getPipelineDelay :: (MonadIO m, IsPipeline o) => o -> m Word64 Source #
Get the value of the “delay
” property.
When overloading is enabled, this is equivalent to
get
pipeline #delay
setPipelineDelay :: (MonadIO m, IsPipeline o) => o -> Word64 -> m () Source #
Set the value of the “delay
” property.
When overloading is enabled, this is equivalent to
set
pipeline [ #delay:=
value ]
latency
Latency to configure on the pipeline. See pipelineSetLatency
.
Since: 1.6
constructPipelineLatency :: IsPipeline o => Word64 -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “latency
” property. This is rarely needed directly, but it is used by new
.
getPipelineLatency :: (MonadIO m, IsPipeline o) => o -> m Word64 Source #
Get the value of the “latency
” property.
When overloading is enabled, this is equivalent to
get
pipeline #latency
setPipelineLatency :: (MonadIO m, IsPipeline o) => o -> Word64 -> m () Source #
Set the value of the “latency
” property.
When overloading is enabled, this is equivalent to
set
pipeline [ #latency:=
value ]