Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Exported types
- Methods
- doPreroll
- getBlocksize
- getDropOutOfSegment
- getLastSample
- getLatency
- getMaxBitrate
- getMaxLateness
- getProcessingDeadline
- getRenderDelay
- getStats
- getSync
- getThrottleTime
- getTsOffset
- isAsyncEnabled
- isLastSampleEnabled
- isQosEnabled
- queryLatency
- setAsyncEnabled
- setBlocksize
- setDropOutOfSegment
- setLastSampleEnabled
- setMaxBitrate
- setMaxLateness
- setProcessingDeadline
- setQosEnabled
- setRenderDelay
- setSync
- setThrottleTime
- setTsOffset
- wait
- waitClock
- waitPreroll
- Properties
BaseSink
is the base class for sink elements in GStreamer, such as
xvimagesink or filesink. It is a layer on top of Element
that provides a
simplified interface to plugin writers. BaseSink
handles many details
for you, for example: preroll, clock synchronization, state changes,
activation in push or pull mode, and queries.
In most cases, when writing sink elements, there is no need to implement
class methods from Element
or to set functions on pads, because the
BaseSink
infrastructure should be sufficient.
BaseSink
provides support for exactly one sink pad, which should be
named "sink". A sink implementation (subclass of BaseSink
) should
install a pad template in its class_init function, like so:
C code
static void my_element_class_init (GstMyElementClass *klass) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); // sinktemplate should be a #GstStaticPadTemplate with direction // %GST_PAD_SINK and name "sink" gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate); gst_element_class_set_static_metadata (gstelement_class, "Sink name", "Sink", "My Sink element", "The author <my.sink@my.email>"); }
BaseSink
will handle the prerolling correctly. This means that it will
return StateChangeReturnAsync
from a state change to PAUSED until the first
buffer arrives in this element. The base class will call the
BaseSinkClass
::preroll
vmethod with this preroll buffer and will then
commit the state change to the next asynchronously pending state.
When the element is set to PLAYING, BaseSink
will synchronise on the
clock using the times returned from BaseSinkClass
::get_times
. If this
function returns CLOCK_TIME_NONE
for the start time, no synchronisation
will be done. Synchronisation can be disabled entirely by setting the object
BaseSink:sync property to False
.
After synchronisation the virtual method BaseSinkClass
::render
will be
called. Subclasses should minimally implement this method.
Subclasses that synchronise on the clock in the BaseSinkClass
::render
method are supported as well. These classes typically receive a buffer in
the render method and can then potentially block on the clock while
rendering. A typical example is an audiosink.
These subclasses can use baseSinkWaitPreroll
to perform the
blocking wait.
Upon receiving the EOS event in the PLAYING state, BaseSink
will wait
for the clock to reach the time indicated by the stop time of the last
BaseSinkClass
::get_times
call before posting an EOS message. When the
element receives EOS in PAUSED, preroll completes, the event is queued and an
EOS message is posted when going to PLAYING.
BaseSink
will internally use the EventTypeSegment
events to schedule
synchronisation and clipping of buffers. Buffers that fall completely outside
of the current segment are dropped. Buffers that fall partially in the
segment are rendered (and prerolled). Subclasses should do any subbuffer
clipping themselves when needed.
BaseSink
will by default report the current playback position in
FormatTime
based on the current clock time and segment information.
If no clock has been set on the element, the query will be forwarded
upstream.
The BaseSinkClass
::set_caps
function will be called when the subclass
should configure itself to process a specific media type.
The BaseSinkClass
::start
and BaseSinkClass
::stop
virtual methods
will be called when resources should be allocated. Any
BaseSinkClass
::preroll
, BaseSinkClass
::render
and
BaseSinkClass
::set_caps
function will be called between the
BaseSinkClass
::start
and BaseSinkClass
::stop
calls.
The BaseSinkClass
::event
virtual method will be called when an event is
received by BaseSink
. Normally this method should only be overridden by
very specific elements (such as file sinks) which need to handle the
newsegment event specially.
The BaseSinkClass
::unlock
method is called when the elements should
unblock any blocking operations they perform in the
BaseSinkClass
::render
method. This is mostly useful when the
BaseSinkClass
::render
method performs a blocking write on a file
descriptor, for example.
The BaseSink:maxLateness property affects how the sink deals with
buffers that arrive too late in the sink. A buffer arrives too late in the
sink when the presentation time (as a combination of the last segment, buffer
timestamp and element base_time) plus the duration is before the current
time of the clock.
If the frame is later than max-lateness, the sink will drop the buffer
without calling the render method.
This feature is disabled if sync is disabled, the
BaseSinkClass
::get_times
method does not return a valid start time or
max-lateness is set to -1 (the default).
Subclasses can use baseSinkSetMaxLateness
to configure the
max-lateness value.
The BaseSink:qos property will enable the quality-of-service features of the basesink which gather statistics about the real-time performance of the clock synchronisation. For each buffer received in the sink, statistics are gathered and a QOS event is sent upstream with these numbers. This information can then be used by upstream elements to reduce their processing rate, for example.
The BaseSink:async property can be used to instruct the sink to never perform an ASYNC state change. This feature is mostly usable when dealing with non-synchronized streams or sparse streams.
Synopsis
- newtype BaseSink = BaseSink (ManagedPtr BaseSink)
- class (GObject o, IsDescendantOf BaseSink o) => IsBaseSink o
- toBaseSink :: (MonadIO m, IsBaseSink o) => o -> m BaseSink
- baseSinkDoPreroll :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> MiniObject -> m FlowReturn
- baseSinkGetBlocksize :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Word32
- baseSinkGetDropOutOfSegment :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Bool
- baseSinkGetLastSample :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m (Maybe Sample)
- baseSinkGetLatency :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Word64
- baseSinkGetMaxBitrate :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Word64
- baseSinkGetMaxLateness :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Int64
- baseSinkGetProcessingDeadline :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Word64
- baseSinkGetRenderDelay :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Word64
- baseSinkGetStats :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Structure
- baseSinkGetSync :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Bool
- baseSinkGetThrottleTime :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Word64
- baseSinkGetTsOffset :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Int64
- baseSinkIsAsyncEnabled :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Bool
- baseSinkIsLastSampleEnabled :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Bool
- baseSinkIsQosEnabled :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m Bool
- baseSinkQueryLatency :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m (Bool, Bool, Bool, Word64, Word64)
- baseSinkSetAsyncEnabled :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Bool -> m ()
- baseSinkSetBlocksize :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Word32 -> m ()
- baseSinkSetDropOutOfSegment :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Bool -> m ()
- baseSinkSetLastSampleEnabled :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Bool -> m ()
- baseSinkSetMaxBitrate :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Word64 -> m ()
- baseSinkSetMaxLateness :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Int64 -> m ()
- baseSinkSetProcessingDeadline :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Word64 -> m ()
- baseSinkSetQosEnabled :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Bool -> m ()
- baseSinkSetRenderDelay :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Word64 -> m ()
- baseSinkSetSync :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Bool -> m ()
- baseSinkSetThrottleTime :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Word64 -> m ()
- baseSinkSetTsOffset :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Int64 -> m ()
- baseSinkWait :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Word64 -> m (FlowReturn, Int64)
- baseSinkWaitClock :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> Word64 -> m (ClockReturn, Int64)
- baseSinkWaitPreroll :: (HasCallStack, MonadIO m, IsBaseSink a) => a -> m FlowReturn
- constructBaseSinkAsync :: (IsBaseSink o, MonadIO m) => Bool -> m (GValueConstruct o)
- getBaseSinkAsync :: (MonadIO m, IsBaseSink o) => o -> m Bool
- setBaseSinkAsync :: (MonadIO m, IsBaseSink o) => o -> Bool -> m ()
- constructBaseSinkBlocksize :: (IsBaseSink o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getBaseSinkBlocksize :: (MonadIO m, IsBaseSink o) => o -> m Word32
- setBaseSinkBlocksize :: (MonadIO m, IsBaseSink o) => o -> Word32 -> m ()
- constructBaseSinkEnableLastSample :: (IsBaseSink o, MonadIO m) => Bool -> m (GValueConstruct o)
- getBaseSinkEnableLastSample :: (MonadIO m, IsBaseSink o) => o -> m Bool
- setBaseSinkEnableLastSample :: (MonadIO m, IsBaseSink o) => o -> Bool -> m ()
- getBaseSinkLastSample :: (MonadIO m, IsBaseSink o) => o -> m (Maybe Sample)
- constructBaseSinkMaxBitrate :: (IsBaseSink o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getBaseSinkMaxBitrate :: (MonadIO m, IsBaseSink o) => o -> m Word64
- setBaseSinkMaxBitrate :: (MonadIO m, IsBaseSink o) => o -> Word64 -> m ()
- constructBaseSinkMaxLateness :: (IsBaseSink o, MonadIO m) => Int64 -> m (GValueConstruct o)
- getBaseSinkMaxLateness :: (MonadIO m, IsBaseSink o) => o -> m Int64
- setBaseSinkMaxLateness :: (MonadIO m, IsBaseSink o) => o -> Int64 -> m ()
- constructBaseSinkProcessingDeadline :: (IsBaseSink o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getBaseSinkProcessingDeadline :: (MonadIO m, IsBaseSink o) => o -> m Word64
- setBaseSinkProcessingDeadline :: (MonadIO m, IsBaseSink o) => o -> Word64 -> m ()
- constructBaseSinkQos :: (IsBaseSink o, MonadIO m) => Bool -> m (GValueConstruct o)
- getBaseSinkQos :: (MonadIO m, IsBaseSink o) => o -> m Bool
- setBaseSinkQos :: (MonadIO m, IsBaseSink o) => o -> Bool -> m ()
- constructBaseSinkRenderDelay :: (IsBaseSink o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getBaseSinkRenderDelay :: (MonadIO m, IsBaseSink o) => o -> m Word64
- setBaseSinkRenderDelay :: (MonadIO m, IsBaseSink o) => o -> Word64 -> m ()
- getBaseSinkStats :: (MonadIO m, IsBaseSink o) => o -> m (Maybe Structure)
- constructBaseSinkSync :: (IsBaseSink o, MonadIO m) => Bool -> m (GValueConstruct o)
- getBaseSinkSync :: (MonadIO m, IsBaseSink o) => o -> m Bool
- setBaseSinkSync :: (MonadIO m, IsBaseSink o) => o -> Bool -> m ()
- constructBaseSinkThrottleTime :: (IsBaseSink o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getBaseSinkThrottleTime :: (MonadIO m, IsBaseSink o) => o -> m Word64
- setBaseSinkThrottleTime :: (MonadIO m, IsBaseSink o) => o -> Word64 -> m ()
- constructBaseSinkTsOffset :: (IsBaseSink o, MonadIO m) => Int64 -> m (GValueConstruct o)
- getBaseSinkTsOffset :: (MonadIO m, IsBaseSink o) => o -> m Int64
- setBaseSinkTsOffset :: (MonadIO m, IsBaseSink o) => o -> Int64 -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq BaseSink Source # | |
GObject BaseSink Source # | |
Defined in GI.GstBase.Objects.BaseSink | |
ManagedPtrNewtype BaseSink Source # | |
Defined in GI.GstBase.Objects.BaseSink toManagedPtr :: BaseSink -> ManagedPtr BaseSink | |
TypedObject BaseSink Source # | |
Defined in GI.GstBase.Objects.BaseSink | |
HasParentTypes BaseSink Source # | |
Defined in GI.GstBase.Objects.BaseSink | |
IsGValue (Maybe BaseSink) Source # | Convert |
Defined in GI.GstBase.Objects.BaseSink gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe BaseSink -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe BaseSink) | |
type ParentTypes BaseSink Source # | |
Defined in GI.GstBase.Objects.BaseSink type ParentTypes BaseSink = '[Element, Object, Object] |
class (GObject o, IsDescendantOf BaseSink o) => IsBaseSink o Source #
Type class for types which can be safely cast to BaseSink
, for instance with toBaseSink
.
Instances
(GObject o, IsDescendantOf BaseSink o) => IsBaseSink o Source # | |
Defined in GI.GstBase.Objects.BaseSink |
toBaseSink :: (MonadIO m, IsBaseSink o) => o -> m BaseSink Source #
Methods
Click to display all available methods, including inherited ones
Methods
abortState, addControlBinding, addPad, addPropertyDeepNotifyWatch, addPropertyNotifyWatch, bindProperty, bindPropertyFull, callAsync, changeState, continueState, createAllPads, defaultError, doPreroll, forceFloating, foreachPad, foreachSinkPad, foreachSrcPad, freezeNotify, getv, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, isAsyncEnabled, isFloating, isLastSampleEnabled, isLockedState, isQosEnabled, iteratePads, iterateSinkPads, iterateSrcPads, link, linkFiltered, linkPads, linkPadsFiltered, linkPadsFull, lostState, messageFull, messageFullWithDetails, noMorePads, notify, notifyByPspec, postMessage, provideClock, query, queryConvert, queryDuration, queryLatency, queryPosition, ref, refSink, releaseRequestPad, removeControlBinding, removePad, removePropertyNotifyWatch, requestPad, requestPadSimple, runDispose, seek, seekSimple, sendEvent, stealData, stealQdata, suggestNextSync, syncStateWithParent, syncValues, thawNotify, unlink, unlinkPads, unparent, unref, wait, waitClock, waitPreroll, watchClosure.
Getters
getBaseTime, getBlocksize, getBus, getClock, getCompatiblePad, getCompatiblePadTemplate, getContext, getContextUnlocked, getContexts, getControlBinding, getControlRate, getCurrentClockTime, getCurrentRunningTime, getData, getDropOutOfSegment, getFactory, getGValueArray, getLastSample, getLatency, getMaxBitrate, getMaxLateness, getMetadata, getName, getPadTemplate, getPadTemplateList, getParent, getPathString, getProcessingDeadline, getProperty, getQdata, getRenderDelay, getRequestPad, getStartTime, getState, getStaticPad, getStats, getSync, getThrottleTime, getTsOffset, getValue.
Setters
setAsyncEnabled, setBaseTime, setBlocksize, setBus, setClock, setContext, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setData, setDataFull, setDropOutOfSegment, setLastSampleEnabled, setLockedState, setMaxBitrate, setMaxLateness, setName, setParent, setProcessingDeadline, setProperty, setQosEnabled, setRenderDelay, setStartTime, setState, setSync, setThrottleTime, setTsOffset.
doPreroll
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> MiniObject |
|
-> m FlowReturn | Returns: |
If the sink
spawns its own thread for pulling buffers from upstream it
should call this method after it has pulled a buffer. If the element needed
to preroll, this function will perform the preroll and will then block
until the element state is changed.
This function should be called with the PREROLL_LOCK held.
getBlocksize
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Word32 | Returns: the number of bytes |
Get the number of bytes that the sink will pull when it is operating in pull mode.
getDropOutOfSegment
baseSinkGetDropOutOfSegment Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Bool | Returns: |
Checks if sink
is currently configured to drop buffers which are outside
the current segment
Since: 1.12
getLastSample
baseSinkGetLastSample Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m (Maybe Sample) | Returns: a |
Get the last sample that arrived in the sink and was used for preroll or for rendering. This property can be used to generate thumbnails.
The Caps
on the sample can be used to determine the type of the buffer.
Free-function: gst_sample_unref
getLatency
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Word64 | Returns: The configured latency. |
Get the currently configured latency.
getMaxBitrate
baseSinkGetMaxBitrate Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Word64 | Returns: the maximum number of bits per second |
Get the maximum amount of bits per second that the sink will render.
Since: 1.2
getMaxLateness
baseSinkGetMaxLateness Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Int64 | Returns: The maximum time in nanoseconds that a buffer can be late before it is dropped and not rendered. A value of -1 means an unlimited time. |
Gets the max lateness value. See baseSinkSetMaxLateness
for
more details.
getProcessingDeadline
baseSinkGetProcessingDeadline Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Word64 | Returns: the processing deadline |
Get the processing deadline of sink
. see
baseSinkSetProcessingDeadline
for more information about
the processing deadline.
Since: 1.16
getRenderDelay
baseSinkGetRenderDelay Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Word64 | Returns: the render delay of |
Get the render delay of sink
. see baseSinkSetRenderDelay
for more
information about the render delay.
getStats
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Structure | Returns: pointer to |
getSync
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Bool | Returns: |
Checks if sink
is currently configured to synchronize against the
clock.
getThrottleTime
baseSinkGetThrottleTime Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Word64 | Returns: the number of nanoseconds |
Get the time that will be inserted between frames to control the maximum buffers per second.
getTsOffset
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Int64 | Returns: The synchronisation offset. |
Get the synchronisation offset of sink
.
isAsyncEnabled
baseSinkIsAsyncEnabled Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Bool | Returns: |
Checks if sink
is currently configured to perform asynchronous state
changes to PAUSED.
isLastSampleEnabled
baseSinkIsLastSampleEnabled Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Bool | Returns: |
Checks if sink
is currently configured to store the last received sample in
the last-sample property.
isQosEnabled
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m Bool | Returns: |
Checks if sink
is currently configured to send Quality-of-Service events
upstream.
queryLatency
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m (Bool, Bool, Bool, Word64, Word64) | Returns: |
Query the sink for the latency parameters. The latency will be queried from
the upstream elements. live
will be True
if sink
is configured to
synchronize against the clock. upstreamLive
will be True
if an upstream
element is live.
If both live
and upstreamLive
are True
, the sink will want to compensate
for the latency introduced by the upstream elements by setting the
minLatency
to a strictly positive value.
This function is mostly used by subclasses.
setAsyncEnabled
baseSinkSetAsyncEnabled Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Bool |
|
-> m () |
Configures sink
to perform all state changes asynchronously. When async is
disabled, the sink will immediately go to PAUSED instead of waiting for a
preroll buffer. This feature is useful if the sink does not synchronize
against the clock or when it is dealing with sparse streams.
setBlocksize
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Word32 |
|
-> m () |
Set the number of bytes that the sink will pull when it is operating in pull mode.
setDropOutOfSegment
baseSinkSetDropOutOfSegment Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Bool |
|
-> m () |
Configure sink
to drop buffers which are outside the current segment
Since: 1.12
setLastSampleEnabled
baseSinkSetLastSampleEnabled Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Bool |
|
-> m () |
Configures sink
to store the last received sample in the last-sample
property.
setMaxBitrate
baseSinkSetMaxBitrate Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Word64 |
|
-> m () |
Set the maximum amount of bits per second that the sink will render.
Since: 1.2
setMaxLateness
baseSinkSetMaxLateness Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Int64 |
|
-> m () |
Sets the new max lateness value to maxLateness
. This value is
used to decide if a buffer should be dropped or not based on the
buffer timestamp and the current clock time. A value of -1 means
an unlimited time.
setProcessingDeadline
baseSinkSetProcessingDeadline Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Word64 |
|
-> m () |
Maximum amount of time (in nanoseconds) that the pipeline can take for processing the buffer. This is added to the latency of live pipelines.
This function is usually called by subclasses.
Since: 1.16
setQosEnabled
baseSinkSetQosEnabled Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Bool |
|
-> m () |
Configures sink
to send Quality-of-Service events upstream.
setRenderDelay
baseSinkSetRenderDelay Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Word64 |
|
-> m () |
Set the render delay in sink
to delay
. The render delay is the time
between actual rendering of a buffer and its synchronisation time. Some
devices might delay media rendering which can be compensated for with this
function.
After calling this function, this sink will report additional latency and other sinks will adjust their latency to delay the rendering of their media.
This function is usually called by subclasses.
setSync
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Bool |
|
-> m () |
setThrottleTime
baseSinkSetThrottleTime Source #
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Word64 |
|
-> m () |
Set the time that will be inserted between rendered buffers. This can be used to control the maximum buffers per second that the sink will render.
setTsOffset
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Int64 |
|
-> m () |
Adjust the synchronisation of sink
with offset
. A negative value will
render buffers earlier than their timestamp. A positive value will delay
rendering. This function can be used to fix playback of badly timestamped
buffers.
wait
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Word64 |
|
-> m (FlowReturn, Int64) | Returns: |
This function will wait for preroll to complete and will then block until time
is reached. It is usually called by subclasses that use their own internal
synchronisation but want to let some synchronization (like EOS) be handled
by the base class.
This function should only be called with the PREROLL_LOCK held (like when receiving an EOS event in the event vmethod or when handling buffers in render).
The time
argument should be the running_time of when the timeout should happen
and will be adjusted with any latency and offset configured in the sink.
waitClock
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> Word64 |
|
-> m (ClockReturn, Int64) | Returns: |
This function will block until time
is reached. It is usually called by
subclasses that use their own internal synchronisation.
If time
is not valid, no synchronisation is done and ClockReturnBadtime
is
returned. Likewise, if synchronisation is disabled in the element or there
is no clock, no synchronisation is done and ClockReturnBadtime
is returned.
This function should only be called with the PREROLL_LOCK held, like when
receiving an EOS event in the BaseSinkClass
::event
vmethod or when
receiving a buffer in
the BaseSinkClass
::render
vmethod.
The time
argument should be the running_time of when this method should
return and is not adjusted with any latency or offset configured in the
sink.
waitPreroll
:: (HasCallStack, MonadIO m, IsBaseSink a) | |
=> a |
|
-> m FlowReturn | Returns: |
If the BaseSinkClass
::render
method performs its own synchronisation
against the clock it must unblock when going from PLAYING to the PAUSED state
and call this method before continuing to render the remaining data.
If the BaseSinkClass
::render
method can block on something else than
the clock, it must also be ready to unblock immediately on
the BaseSinkClass
::unlock
method and cause the
BaseSinkClass
::render
method to immediately call this function.
In this case, the subclass must be prepared to continue rendering where it
left off if this function returns FlowReturnOk
.
This function will block until a state change to PLAYING happens (in which
case this function returns FlowReturnOk
) or the processing must be stopped due
to a state change to READY or a FLUSH event (in which case this function
returns FlowReturnFlushing
).
This function should only be called with the PREROLL_LOCK held, like in the render function.
Properties
async
If set to True
, the basesink will perform asynchronous state changes.
When set to False
, the sink will not signal the parent when it prerolls.
Use this option when dealing with sparse streams or when synchronisation is
not required.
constructBaseSinkAsync :: (IsBaseSink o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “async
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkAsync :: (MonadIO m, IsBaseSink o) => o -> m Bool Source #
Get the value of the “async
” property.
When overloading is enabled, this is equivalent to
get
baseSink #async
setBaseSinkAsync :: (MonadIO m, IsBaseSink o) => o -> Bool -> m () Source #
Set the value of the “async
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #async:=
value ]
blocksize
The amount of bytes to pull when operating in pull mode.
constructBaseSinkBlocksize :: (IsBaseSink o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “blocksize
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkBlocksize :: (MonadIO m, IsBaseSink o) => o -> m Word32 Source #
Get the value of the “blocksize
” property.
When overloading is enabled, this is equivalent to
get
baseSink #blocksize
setBaseSinkBlocksize :: (MonadIO m, IsBaseSink o) => o -> Word32 -> m () Source #
Set the value of the “blocksize
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #blocksize:=
value ]
enableLastSample
Enable the last-sample property. If False
, basesink doesn't keep a
reference to the last buffer arrived and the last-sample property is always
set to Nothing
. This can be useful if you need buffers to be released as soon
as possible, eg. if you're using a buffer pool.
constructBaseSinkEnableLastSample :: (IsBaseSink o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “enable-last-sample
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkEnableLastSample :: (MonadIO m, IsBaseSink o) => o -> m Bool Source #
Get the value of the “enable-last-sample
” property.
When overloading is enabled, this is equivalent to
get
baseSink #enableLastSample
setBaseSinkEnableLastSample :: (MonadIO m, IsBaseSink o) => o -> Bool -> m () Source #
Set the value of the “enable-last-sample
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #enableLastSample:=
value ]
lastSample
The last buffer that arrived in the sink and was used for preroll or for
rendering. This property can be used to generate thumbnails. This property
can be Nothing
when the sink has not yet received a buffer.
getBaseSinkLastSample :: (MonadIO m, IsBaseSink o) => o -> m (Maybe Sample) Source #
Get the value of the “last-sample
” property.
When overloading is enabled, this is equivalent to
get
baseSink #lastSample
maxBitrate
Control the maximum amount of bits that will be rendered per second. Setting this property to a value bigger than 0 will make the sink delay rendering of the buffers when it would exceed to max-bitrate.
Since: 1.2
constructBaseSinkMaxBitrate :: (IsBaseSink o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “max-bitrate
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkMaxBitrate :: (MonadIO m, IsBaseSink o) => o -> m Word64 Source #
Get the value of the “max-bitrate
” property.
When overloading is enabled, this is equivalent to
get
baseSink #maxBitrate
setBaseSinkMaxBitrate :: (MonadIO m, IsBaseSink o) => o -> Word64 -> m () Source #
Set the value of the “max-bitrate
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #maxBitrate:=
value ]
maxLateness
No description available in the introspection data.
constructBaseSinkMaxLateness :: (IsBaseSink o, MonadIO m) => Int64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “max-lateness
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkMaxLateness :: (MonadIO m, IsBaseSink o) => o -> m Int64 Source #
Get the value of the “max-lateness
” property.
When overloading is enabled, this is equivalent to
get
baseSink #maxLateness
setBaseSinkMaxLateness :: (MonadIO m, IsBaseSink o) => o -> Int64 -> m () Source #
Set the value of the “max-lateness
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #maxLateness:=
value ]
processingDeadline
Maximum amount of time (in nanoseconds) that the pipeline can take for processing the buffer. This is added to the latency of live pipelines.
Since: 1.16
constructBaseSinkProcessingDeadline :: (IsBaseSink o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “processing-deadline
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkProcessingDeadline :: (MonadIO m, IsBaseSink o) => o -> m Word64 Source #
Get the value of the “processing-deadline
” property.
When overloading is enabled, this is equivalent to
get
baseSink #processingDeadline
setBaseSinkProcessingDeadline :: (MonadIO m, IsBaseSink o) => o -> Word64 -> m () Source #
Set the value of the “processing-deadline
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #processingDeadline:=
value ]
qos
No description available in the introspection data.
constructBaseSinkQos :: (IsBaseSink o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “qos
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkQos :: (MonadIO m, IsBaseSink o) => o -> m Bool Source #
Get the value of the “qos
” property.
When overloading is enabled, this is equivalent to
get
baseSink #qos
setBaseSinkQos :: (MonadIO m, IsBaseSink o) => o -> Bool -> m () Source #
Set the value of the “qos
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #qos:=
value ]
renderDelay
The additional delay between synchronisation and actual rendering of the media. This property will add additional latency to the device in order to make other sinks compensate for the delay.
constructBaseSinkRenderDelay :: (IsBaseSink o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “render-delay
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkRenderDelay :: (MonadIO m, IsBaseSink o) => o -> m Word64 Source #
Get the value of the “render-delay
” property.
When overloading is enabled, this is equivalent to
get
baseSink #renderDelay
setBaseSinkRenderDelay :: (MonadIO m, IsBaseSink o) => o -> Word64 -> m () Source #
Set the value of the “render-delay
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #renderDelay:=
value ]
stats
Various BaseSink
statistics. This property returns a Structure
with name application/x-gst-base-sink-stats
with the following fields:
- "average-rate" G_TYPE_DOUBLE average frame rate
- "dropped" G_TYPE_UINT64 Number of dropped frames
- "rendered" G_TYPE_UINT64 Number of rendered frames
Since: 1.18
getBaseSinkStats :: (MonadIO m, IsBaseSink o) => o -> m (Maybe Structure) Source #
Get the value of the “stats
” property.
When overloading is enabled, this is equivalent to
get
baseSink #stats
sync
No description available in the introspection data.
constructBaseSinkSync :: (IsBaseSink o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “sync
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkSync :: (MonadIO m, IsBaseSink o) => o -> m Bool Source #
Get the value of the “sync
” property.
When overloading is enabled, this is equivalent to
get
baseSink #sync
setBaseSinkSync :: (MonadIO m, IsBaseSink o) => o -> Bool -> m () Source #
Set the value of the “sync
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #sync:=
value ]
throttleTime
The time to insert between buffers. This property can be used to control the maximum amount of buffers per second to render. Setting this property to a value bigger than 0 will make the sink create THROTTLE QoS events.
constructBaseSinkThrottleTime :: (IsBaseSink o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “throttle-time
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkThrottleTime :: (MonadIO m, IsBaseSink o) => o -> m Word64 Source #
Get the value of the “throttle-time
” property.
When overloading is enabled, this is equivalent to
get
baseSink #throttleTime
setBaseSinkThrottleTime :: (MonadIO m, IsBaseSink o) => o -> Word64 -> m () Source #
Set the value of the “throttle-time
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #throttleTime:=
value ]
tsOffset
Controls the final synchronisation, a negative value will render the buffer earlier while a positive value delays playback. This property can be used to fix synchronisation in bad files.
constructBaseSinkTsOffset :: (IsBaseSink o, MonadIO m) => Int64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “ts-offset
” property. This is rarely needed directly, but it is used by new
.
getBaseSinkTsOffset :: (MonadIO m, IsBaseSink o) => o -> m Int64 Source #
Get the value of the “ts-offset
” property.
When overloading is enabled, this is equivalent to
get
baseSink #tsOffset
setBaseSinkTsOffset :: (MonadIO m, IsBaseSink o) => o -> Int64 -> m () Source #
Set the value of the “ts-offset
” property.
When overloading is enabled, this is equivalent to
set
baseSink [ #tsOffset:=
value ]