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
- endOfStream
- getCaps
- getCurrentLevelBuffers
- getCurrentLevelBytes
- getCurrentLevelTime
- getDuration
- getEmitSignals
- getLatency
- getLeakyType
- getMaxBuffers
- getMaxBytes
- getMaxTime
- getSize
- getStreamType
- pushBuffer
- pushBufferList
- pushSample
- setCaps
- setDuration
- setEmitSignals
- setLatency
- setLeakyType
- setMaxBuffers
- setMaxBytes
- setMaxTime
- setSize
- setStreamType
- Properties
- Signals
The appsrc element can be used by applications to insert data into a GStreamer pipeline. Unlike most GStreamer elements, appsrc provides external API functions.
appsrc can be used by linking with the libgstapp library to access the methods directly or by using the appsrc action signals.
Before operating appsrc, the caps property must be set to fixed caps describing the format of the data that will be pushed with appsrc. An exception to this is when pushing buffers with unknown caps, in which case no caps should be set. This is typically true of file-like sources that push raw byte buffers. If you don't want to explicitly set the caps, you can use gst_app_src_push_sample. This method gets the caps associated with the sample and sets them on the appsrc replacing any previously set caps (if different from sample's caps).
The main way of handing data to the appsrc element is by calling the
appSrcPushBuffer
method or by emitting the push-buffer action signal.
This will put the buffer onto a queue from which appsrc will read from in its
streaming thread. It is important to note that data transport will not happen
from the thread that performed the push-buffer call.
The "max-bytes", "max-buffers" and "max-time" properties control how much data can be queued in appsrc before appsrc considers the queue full. A filled internal queue will always signal the "enough-data" signal, which signals the application that it should stop pushing data into appsrc. The "block" property will cause appsrc to block the push-buffer method until free data becomes available again.
When the internal queue is running out of data, the "need-data" signal is emitted, which signals the application that it should start pushing more data into appsrc.
In addition to the "need-data" and "enough-data" signals, appsrc can emit the "seek-data" signal when the "stream-mode" property is set to "seekable" or "random-access". The signal argument will contain the new desired position in the stream expressed in the unit set with the "format" property. After receiving the seek-data signal, the application should push-buffers from the new position.
These signals allow the application to operate the appsrc in two different ways:
The push mode, in which the application repeatedly calls the push-buffer/push-sample method with a new buffer/sample. Optionally, the queue size in the appsrc can be controlled with the enough-data and need-data signals by respectively stopping/starting the push-buffer/push-sample calls. This is a typical mode of operation for the stream-type "stream" and "seekable". Use this mode when implementing various network protocols or hardware devices.
The pull mode, in which the need-data signal triggers the next push-buffer call. This mode is typically used in the "random-access" stream-type. Use this mode for file access or other randomly accessible sources. In this mode, a buffer of exactly the amount of bytes given by the need-data signal should be pushed into appsrc.
In all modes, the size property on appsrc should contain the total stream size in bytes. Setting this property is mandatory in the random-access mode. For the stream and seekable modes, setting this property is optional but recommended.
When the application has finished pushing data into appsrc, it should call
appSrcEndOfStream
or emit the end-of-stream action signal. After
this call, no more buffers can be pushed into appsrc until a flushing seek
occurs or the state of the appsrc has gone through READY.
Synopsis
- newtype AppSrc = AppSrc (ManagedPtr AppSrc)
- class (GObject o, IsDescendantOf AppSrc o) => IsAppSrc o
- toAppSrc :: (MonadIO m, IsAppSrc o) => o -> m AppSrc
- appSrcEndOfStream :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m FlowReturn
- appSrcGetCaps :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m (Maybe Caps)
- appSrcGetCurrentLevelBuffers :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m Word64
- appSrcGetCurrentLevelBytes :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m Word64
- appSrcGetCurrentLevelTime :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m Word64
- appSrcGetDuration :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m Word64
- appSrcGetEmitSignals :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m Bool
- appSrcGetLatency :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m (Word64, Word64)
- appSrcGetLeakyType :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m AppLeakyType
- appSrcGetMaxBuffers :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m Word64
- appSrcGetMaxBytes :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m Word64
- appSrcGetMaxTime :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m Word64
- appSrcGetSize :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m Int64
- appSrcGetStreamType :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> m AppStreamType
- appSrcPushBuffer :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Buffer -> m FlowReturn
- appSrcPushBufferList :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> BufferList -> m FlowReturn
- appSrcPushSample :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Sample -> m FlowReturn
- appSrcSetCaps :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Maybe Caps -> m ()
- appSrcSetDuration :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Word64 -> m ()
- appSrcSetEmitSignals :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Bool -> m ()
- appSrcSetLatency :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Word64 -> Word64 -> m ()
- appSrcSetLeakyType :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> AppLeakyType -> m ()
- appSrcSetMaxBuffers :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Word64 -> m ()
- appSrcSetMaxBytes :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Word64 -> m ()
- appSrcSetMaxTime :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Word64 -> m ()
- appSrcSetSize :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> Int64 -> m ()
- appSrcSetStreamType :: (HasCallStack, MonadIO m, IsAppSrc a) => a -> AppStreamType -> m ()
- constructAppSrcBlock :: (IsAppSrc o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAppSrcBlock :: (MonadIO m, IsAppSrc o) => o -> m Bool
- setAppSrcBlock :: (MonadIO m, IsAppSrc o) => o -> Bool -> m ()
- clearAppSrcCaps :: (MonadIO m, IsAppSrc o) => o -> m ()
- constructAppSrcCaps :: (IsAppSrc o, MonadIO m) => Caps -> m (GValueConstruct o)
- getAppSrcCaps :: (MonadIO m, IsAppSrc o) => o -> m (Maybe Caps)
- setAppSrcCaps :: (MonadIO m, IsAppSrc o) => o -> Caps -> m ()
- getAppSrcCurrentLevelBuffers :: (MonadIO m, IsAppSrc o) => o -> m Word64
- getAppSrcCurrentLevelBytes :: (MonadIO m, IsAppSrc o) => o -> m Word64
- getAppSrcCurrentLevelTime :: (MonadIO m, IsAppSrc o) => o -> m Word64
- constructAppSrcDuration :: (IsAppSrc o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getAppSrcDuration :: (MonadIO m, IsAppSrc o) => o -> m Word64
- setAppSrcDuration :: (MonadIO m, IsAppSrc o) => o -> Word64 -> m ()
- constructAppSrcEmitSignals :: (IsAppSrc o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAppSrcEmitSignals :: (MonadIO m, IsAppSrc o) => o -> m Bool
- setAppSrcEmitSignals :: (MonadIO m, IsAppSrc o) => o -> Bool -> m ()
- constructAppSrcFormat :: (IsAppSrc o, MonadIO m) => Format -> m (GValueConstruct o)
- getAppSrcFormat :: (MonadIO m, IsAppSrc o) => o -> m Format
- setAppSrcFormat :: (MonadIO m, IsAppSrc o) => o -> Format -> m ()
- constructAppSrcHandleSegmentChange :: (IsAppSrc o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAppSrcHandleSegmentChange :: (MonadIO m, IsAppSrc o) => o -> m Bool
- setAppSrcHandleSegmentChange :: (MonadIO m, IsAppSrc o) => o -> Bool -> m ()
- constructAppSrcIsLive :: (IsAppSrc o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAppSrcIsLive :: (MonadIO m, IsAppSrc o) => o -> m Bool
- setAppSrcIsLive :: (MonadIO m, IsAppSrc o) => o -> Bool -> m ()
- constructAppSrcLeakyType :: (IsAppSrc o, MonadIO m) => AppLeakyType -> m (GValueConstruct o)
- getAppSrcLeakyType :: (MonadIO m, IsAppSrc o) => o -> m AppLeakyType
- setAppSrcLeakyType :: (MonadIO m, IsAppSrc o) => o -> AppLeakyType -> m ()
- constructAppSrcMaxBuffers :: (IsAppSrc o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getAppSrcMaxBuffers :: (MonadIO m, IsAppSrc o) => o -> m Word64
- setAppSrcMaxBuffers :: (MonadIO m, IsAppSrc o) => o -> Word64 -> m ()
- constructAppSrcMaxBytes :: (IsAppSrc o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getAppSrcMaxBytes :: (MonadIO m, IsAppSrc o) => o -> m Word64
- setAppSrcMaxBytes :: (MonadIO m, IsAppSrc o) => o -> Word64 -> m ()
- constructAppSrcMaxLatency :: (IsAppSrc o, MonadIO m) => Int64 -> m (GValueConstruct o)
- getAppSrcMaxLatency :: (MonadIO m, IsAppSrc o) => o -> m Int64
- setAppSrcMaxLatency :: (MonadIO m, IsAppSrc o) => o -> Int64 -> m ()
- constructAppSrcMaxTime :: (IsAppSrc o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getAppSrcMaxTime :: (MonadIO m, IsAppSrc o) => o -> m Word64
- setAppSrcMaxTime :: (MonadIO m, IsAppSrc o) => o -> Word64 -> m ()
- constructAppSrcMinLatency :: (IsAppSrc o, MonadIO m) => Int64 -> m (GValueConstruct o)
- getAppSrcMinLatency :: (MonadIO m, IsAppSrc o) => o -> m Int64
- setAppSrcMinLatency :: (MonadIO m, IsAppSrc o) => o -> Int64 -> m ()
- constructAppSrcMinPercent :: (IsAppSrc o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getAppSrcMinPercent :: (MonadIO m, IsAppSrc o) => o -> m Word32
- setAppSrcMinPercent :: (MonadIO m, IsAppSrc o) => o -> Word32 -> m ()
- constructAppSrcSize :: (IsAppSrc o, MonadIO m) => Int64 -> m (GValueConstruct o)
- getAppSrcSize :: (MonadIO m, IsAppSrc o) => o -> m Int64
- setAppSrcSize :: (MonadIO m, IsAppSrc o) => o -> Int64 -> m ()
- constructAppSrcStreamType :: (IsAppSrc o, MonadIO m) => AppStreamType -> m (GValueConstruct o)
- getAppSrcStreamType :: (MonadIO m, IsAppSrc o) => o -> m AppStreamType
- setAppSrcStreamType :: (MonadIO m, IsAppSrc o) => o -> AppStreamType -> m ()
- type AppSrcEndOfStreamCallback = IO FlowReturn
- afterAppSrcEndOfStream :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcEndOfStreamCallback) -> m SignalHandlerId
- onAppSrcEndOfStream :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcEndOfStreamCallback) -> m SignalHandlerId
- type AppSrcEnoughDataCallback = IO ()
- afterAppSrcEnoughData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcEnoughDataCallback) -> m SignalHandlerId
- onAppSrcEnoughData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcEnoughDataCallback) -> m SignalHandlerId
- type AppSrcNeedDataCallback = Word32 -> IO ()
- afterAppSrcNeedData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcNeedDataCallback) -> m SignalHandlerId
- onAppSrcNeedData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcNeedDataCallback) -> m SignalHandlerId
- type AppSrcPushBufferCallback = Buffer -> IO FlowReturn
- afterAppSrcPushBuffer :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushBufferCallback) -> m SignalHandlerId
- onAppSrcPushBuffer :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushBufferCallback) -> m SignalHandlerId
- type AppSrcPushBufferListCallback = BufferList -> IO FlowReturn
- afterAppSrcPushBufferList :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushBufferListCallback) -> m SignalHandlerId
- onAppSrcPushBufferList :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushBufferListCallback) -> m SignalHandlerId
- type AppSrcPushSampleCallback = Sample -> IO FlowReturn
- afterAppSrcPushSample :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushSampleCallback) -> m SignalHandlerId
- onAppSrcPushSample :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushSampleCallback) -> m SignalHandlerId
- type AppSrcSeekDataCallback = Word64 -> IO Bool
- afterAppSrcSeekData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcSeekDataCallback) -> m SignalHandlerId
- onAppSrcSeekData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcSeekDataCallback) -> m SignalHandlerId
Exported types
Memory-managed wrapper type.
Instances
Eq AppSrc Source # | |
GObject AppSrc Source # | |
Defined in GI.GstApp.Objects.AppSrc | |
ManagedPtrNewtype AppSrc Source # | |
Defined in GI.GstApp.Objects.AppSrc toManagedPtr :: AppSrc -> ManagedPtr AppSrc | |
TypedObject AppSrc Source # | |
Defined in GI.GstApp.Objects.AppSrc | |
HasParentTypes AppSrc Source # | |
Defined in GI.GstApp.Objects.AppSrc | |
IsGValue (Maybe AppSrc) Source # | Convert |
Defined in GI.GstApp.Objects.AppSrc gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe AppSrc -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe AppSrc) | |
type ParentTypes AppSrc Source # | |
Defined in GI.GstApp.Objects.AppSrc type ParentTypes AppSrc = '[BaseSrc, Element, Object, Object, URIHandler] |
class (GObject o, IsDescendantOf AppSrc o) => IsAppSrc o Source #
Instances
(GObject o, IsDescendantOf AppSrc o) => IsAppSrc o Source # | |
Defined in GI.GstApp.Objects.AppSrc |
Methods
Click to display all available methods, including inherited ones
Methods
abortState, addControlBinding, addPad, addPropertyDeepNotifyWatch, addPropertyNotifyWatch, bindProperty, bindPropertyFull, callAsync, changeState, continueState, createAllPads, defaultError, endOfStream, forceFloating, foreachPad, foreachSinkPad, foreachSrcPad, freezeNotify, getv, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, isAsync, isFloating, isLive, isLockedState, iteratePads, iterateSinkPads, iterateSrcPads, link, linkFiltered, linkPads, linkPadsFiltered, linkPadsFull, lostState, messageFull, messageFullWithDetails, negotiate, newSeamlessSegment, newSegment, noMorePads, notify, notifyByPspec, postMessage, provideClock, pushBuffer, pushBufferList, pushSample, query, queryConvert, queryDuration, queryLatency, queryPosition, ref, refSink, releaseRequestPad, removeControlBinding, removePad, removePropertyNotifyWatch, requestPad, requestPadSimple, runDispose, seek, seekSimple, sendEvent, startComplete, startWait, stealData, stealQdata, submitBufferList, suggestNextSync, syncStateWithParent, syncValues, thawNotify, unlink, unlinkPads, unparent, unref, waitPlaying, watchClosure.
Getters
getAllocator, getBaseTime, getBlocksize, getBufferPool, getBus, getCaps, getClock, getCompatiblePad, getCompatiblePadTemplate, getContext, getContextUnlocked, getContexts, getControlBinding, getControlRate, getCurrentClockTime, getCurrentLevelBuffers, getCurrentLevelBytes, getCurrentLevelTime, getCurrentRunningTime, getData, getDoTimestamp, getDuration, getEmitSignals, getFactory, getGValueArray, getLatency, getLeakyType, getMaxBuffers, getMaxBytes, getMaxTime, getMetadata, getName, getPadTemplate, getPadTemplateList, getParent, getPathString, getProperty, getProtocols, getQdata, getRequestPad, getSize, getStartTime, getState, getStaticPad, getStreamType, getUri, getUriType, getValue.
Setters
setAsync, setAutomaticEos, setBaseTime, setBlocksize, setBus, setCaps, setClock, setContext, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setData, setDataFull, setDoTimestamp, setDuration, setDynamicSize, setEmitSignals, setFormat, setLatency, setLeakyType, setLive, setLockedState, setMaxBuffers, setMaxBytes, setMaxTime, setName, setParent, setProperty, setSize, setStartTime, setState, setStreamType, setUri.
endOfStream
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m FlowReturn | Returns: |
Indicates to the appsrc element that the last buffer queued in the element is the last buffer of the stream.
getCaps
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m (Maybe Caps) | Returns: the |
Get the configured caps on appsrc
.
getCurrentLevelBuffers
appSrcGetCurrentLevelBuffers Source #
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m Word64 | Returns: The number of currently queued buffers. |
Get the number of currently queued buffers inside appsrc
.
Since: 1.20
getCurrentLevelBytes
appSrcGetCurrentLevelBytes Source #
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m Word64 | Returns: The number of currently queued bytes. |
Get the number of currently queued bytes inside appsrc
.
Since: 1.2
getCurrentLevelTime
appSrcGetCurrentLevelTime Source #
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m Word64 | Returns: The amount of currently queued time. |
Get the amount of currently queued time inside appsrc
.
Since: 1.20
getDuration
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m Word64 | Returns: the duration of the stream previously set with |
Get the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is not known.
Since: 1.10
getEmitSignals
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m Bool | Returns: |
Check if appsrc will emit the "new-preroll" and "new-buffer" signals.
getLatency
Retrieve the min and max latencies in min
and max
respectively.
getLeakyType
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m AppLeakyType | Returns: The currently set |
Returns the currently set AppLeakyType
. See appSrcSetLeakyType
for more details.
Since: 1.20
getMaxBuffers
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m Word64 | Returns: The maximum amount of buffers that can be queued. |
Get the maximum amount of buffers that can be queued in appsrc
.
Since: 1.20
getMaxBytes
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m Word64 | Returns: The maximum amount of bytes that can be queued. |
Get the maximum amount of bytes that can be queued in appsrc
.
getMaxTime
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m Word64 | Returns: The maximum amount of time that can be queued. |
Get the maximum amount of time that can be queued in appsrc
.
Since: 1.20
getSize
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m Int64 | Returns: the size of the stream previously set with |
Get the size of the stream in bytes. A value of -1 means that the size is not known.
getStreamType
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> m AppStreamType | Returns: the stream type. |
Get the stream type. Control the stream type of appsrc
with appSrcSetStreamType
.
pushBuffer
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Buffer |
|
-> m FlowReturn | Returns: |
Adds a buffer to the queue of buffers that the appsrc element will push to its source pad. This function takes ownership of the buffer.
When the block property is TRUE, this function can block until free space becomes available in the queue.
pushBufferList
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> BufferList |
|
-> m FlowReturn | Returns: |
Adds a buffer list to the queue of buffers and buffer lists that the
appsrc element will push to its source pad. This function takes ownership
of bufferList
.
When the block property is TRUE, this function can block until free space becomes available in the queue.
Since: 1.14
pushSample
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Sample |
|
-> m FlowReturn | Returns: |
Extract a buffer from the provided sample and adds it to the queue of buffers that the appsrc element will push to its source pad. Any previous caps that were set on appsrc will be replaced by the caps associated with the sample if not equal.
This function does not take ownership of the sample so the sample needs to be unreffed after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
Since: 1.6
setCaps
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Maybe Caps |
|
-> m () |
Set the capabilities on the appsrc element. This function takes
a copy of the caps structure. After calling this method, the source will
only produce caps that match caps
. caps
must be fixed and the caps on the
buffers must match the caps or left NULL.
setDuration
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Word64 |
|
-> m () |
Set the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is not known.
Since: 1.10
setEmitSignals
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Bool |
|
-> m () |
Make appsrc emit the "new-preroll" and "new-buffer" signals. This option is by default disabled because signal emission is expensive and unneeded when the application prefers to operate in pull mode.
setLatency
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Word64 |
|
-> Word64 |
|
-> m () |
Configure the min
and max
latency in src
. If min
is set to -1, the
default latency calculations for pseudo-live sources will be used.
setLeakyType
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> AppLeakyType |
|
-> m () |
When set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsrc will drop any buffers that are pushed into it once its internal queue is full. The selected type defines whether to drop the oldest or new buffers.
Since: 1.20
setMaxBuffers
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Word64 |
|
-> m () |
Set the maximum amount of buffers that can be queued in appsrc
.
After the maximum amount of buffers are queued, appsrc
will emit the
"enough-data" signal.
Since: 1.20
setMaxBytes
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Word64 |
|
-> m () |
Set the maximum amount of bytes that can be queued in appsrc
.
After the maximum amount of bytes are queued, appsrc
will emit the
"enough-data" signal.
setMaxTime
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Word64 |
|
-> m () |
Set the maximum amount of time that can be queued in appsrc
.
After the maximum amount of time are queued, appsrc
will emit the
"enough-data" signal.
Since: 1.20
setSize
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> Int64 |
|
-> m () |
Set the size of the stream in bytes. A value of -1 means that the size is not known.
setStreamType
:: (HasCallStack, MonadIO m, IsAppSrc a) | |
=> a |
|
-> AppStreamType |
|
-> m () |
Set the stream type on appsrc
. For seekable streams, the "seek" signal must
be connected to.
A stream_type stream
Properties
block
When max-bytes are queued and after the enough-data signal has been emitted, block any further push-buffer calls until the amount of queued bytes drops below the max-bytes limit.
constructAppSrcBlock :: (IsAppSrc o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “block
” property. This is rarely needed directly, but it is used by new
.
getAppSrcBlock :: (MonadIO m, IsAppSrc o) => o -> m Bool Source #
Get the value of the “block
” property.
When overloading is enabled, this is equivalent to
get
appSrc #block
setAppSrcBlock :: (MonadIO m, IsAppSrc o) => o -> Bool -> m () Source #
Set the value of the “block
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #block:=
value ]
caps
The GstCaps that will negotiated downstream and will be put on outgoing buffers.
clearAppSrcCaps :: (MonadIO m, IsAppSrc o) => o -> m () Source #
Set the value of the “caps
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#caps
constructAppSrcCaps :: (IsAppSrc o, MonadIO m) => Caps -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “caps
” property. This is rarely needed directly, but it is used by new
.
getAppSrcCaps :: (MonadIO m, IsAppSrc o) => o -> m (Maybe Caps) Source #
Get the value of the “caps
” property.
When overloading is enabled, this is equivalent to
get
appSrc #caps
setAppSrcCaps :: (MonadIO m, IsAppSrc o) => o -> Caps -> m () Source #
Set the value of the “caps
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #caps:=
value ]
currentLevelBuffers
The number of currently queued buffers inside appsrc.
Since: 1.20
getAppSrcCurrentLevelBuffers :: (MonadIO m, IsAppSrc o) => o -> m Word64 Source #
Get the value of the “current-level-buffers
” property.
When overloading is enabled, this is equivalent to
get
appSrc #currentLevelBuffers
currentLevelBytes
The number of currently queued bytes inside appsrc.
Since: 1.2
getAppSrcCurrentLevelBytes :: (MonadIO m, IsAppSrc o) => o -> m Word64 Source #
Get the value of the “current-level-bytes
” property.
When overloading is enabled, this is equivalent to
get
appSrc #currentLevelBytes
currentLevelTime
The amount of currently queued time inside appsrc.
Since: 1.20
getAppSrcCurrentLevelTime :: (MonadIO m, IsAppSrc o) => o -> m Word64 Source #
Get the value of the “current-level-time
” property.
When overloading is enabled, this is equivalent to
get
appSrc #currentLevelTime
duration
The total duration in nanoseconds of the data stream. If the total duration is known, it is recommended to configure it with this property.
Since: 1.10
constructAppSrcDuration :: (IsAppSrc o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “duration
” property. This is rarely needed directly, but it is used by new
.
getAppSrcDuration :: (MonadIO m, IsAppSrc o) => o -> m Word64 Source #
Get the value of the “duration
” property.
When overloading is enabled, this is equivalent to
get
appSrc #duration
setAppSrcDuration :: (MonadIO m, IsAppSrc o) => o -> Word64 -> m () Source #
Set the value of the “duration
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #duration:=
value ]
emitSignals
Make appsrc emit the "need-data", "enough-data" and "seek-data" signals. This option is by default enabled for backwards compatibility reasons but can disabled when needed because signal emission is expensive.
constructAppSrcEmitSignals :: (IsAppSrc o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “emit-signals
” property. This is rarely needed directly, but it is used by new
.
getAppSrcEmitSignals :: (MonadIO m, IsAppSrc o) => o -> m Bool Source #
Get the value of the “emit-signals
” property.
When overloading is enabled, this is equivalent to
get
appSrc #emitSignals
setAppSrcEmitSignals :: (MonadIO m, IsAppSrc o) => o -> Bool -> m () Source #
Set the value of the “emit-signals
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #emitSignals:=
value ]
format
The format to use for segment events. When the source is producing timestamped buffers this property should be set to GST_FORMAT_TIME.
constructAppSrcFormat :: (IsAppSrc o, MonadIO m) => Format -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “format
” property. This is rarely needed directly, but it is used by new
.
getAppSrcFormat :: (MonadIO m, IsAppSrc o) => o -> m Format Source #
Get the value of the “format
” property.
When overloading is enabled, this is equivalent to
get
appSrc #format
setAppSrcFormat :: (MonadIO m, IsAppSrc o) => o -> Format -> m () Source #
Set the value of the “format
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #format:=
value ]
handleSegmentChange
When enabled, appsrc will check GstSegment in GstSample which was
pushed via appSrcPushSample
or "push-sample" signal action.
If a GstSegment is changed, corresponding segment event will be followed
by next data flow.
FIXME: currently only GST_FORMAT_TIME format is supported and therefore
GstAppSrcformat should be time. However, possibly AppSrc
can support
other formats.
Since: 1.18
constructAppSrcHandleSegmentChange :: (IsAppSrc o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “handle-segment-change
” property. This is rarely needed directly, but it is used by new
.
getAppSrcHandleSegmentChange :: (MonadIO m, IsAppSrc o) => o -> m Bool Source #
Get the value of the “handle-segment-change
” property.
When overloading is enabled, this is equivalent to
get
appSrc #handleSegmentChange
setAppSrcHandleSegmentChange :: (MonadIO m, IsAppSrc o) => o -> Bool -> m () Source #
Set the value of the “handle-segment-change
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #handleSegmentChange:=
value ]
isLive
Instruct the source to behave like a live source. This includes that it will only push out buffers in the PLAYING state.
constructAppSrcIsLive :: (IsAppSrc o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “is-live
” property. This is rarely needed directly, but it is used by new
.
getAppSrcIsLive :: (MonadIO m, IsAppSrc o) => o -> m Bool Source #
Get the value of the “is-live
” property.
When overloading is enabled, this is equivalent to
get
appSrc #isLive
setAppSrcIsLive :: (MonadIO m, IsAppSrc o) => o -> Bool -> m () Source #
Set the value of the “is-live
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #isLive:=
value ]
leakyType
When set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsrc will drop any buffers that are pushed into it once its internal queue is full. The selected type defines whether to drop the oldest or new buffers.
Since: 1.20
constructAppSrcLeakyType :: (IsAppSrc o, MonadIO m) => AppLeakyType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “leaky-type
” property. This is rarely needed directly, but it is used by new
.
getAppSrcLeakyType :: (MonadIO m, IsAppSrc o) => o -> m AppLeakyType Source #
Get the value of the “leaky-type
” property.
When overloading is enabled, this is equivalent to
get
appSrc #leakyType
setAppSrcLeakyType :: (MonadIO m, IsAppSrc o) => o -> AppLeakyType -> m () Source #
Set the value of the “leaky-type
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #leakyType:=
value ]
maxBuffers
The maximum amount of buffers that can be queued internally. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal.
Since: 1.20
constructAppSrcMaxBuffers :: (IsAppSrc o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “max-buffers
” property. This is rarely needed directly, but it is used by new
.
getAppSrcMaxBuffers :: (MonadIO m, IsAppSrc o) => o -> m Word64 Source #
Get the value of the “max-buffers
” property.
When overloading is enabled, this is equivalent to
get
appSrc #maxBuffers
setAppSrcMaxBuffers :: (MonadIO m, IsAppSrc o) => o -> Word64 -> m () Source #
Set the value of the “max-buffers
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #maxBuffers:=
value ]
maxBytes
The maximum amount of bytes that can be queued internally. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal.
constructAppSrcMaxBytes :: (IsAppSrc o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “max-bytes
” property. This is rarely needed directly, but it is used by new
.
getAppSrcMaxBytes :: (MonadIO m, IsAppSrc o) => o -> m Word64 Source #
Get the value of the “max-bytes
” property.
When overloading is enabled, this is equivalent to
get
appSrc #maxBytes
setAppSrcMaxBytes :: (MonadIO m, IsAppSrc o) => o -> Word64 -> m () Source #
Set the value of the “max-bytes
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #maxBytes:=
value ]
maxLatency
No description available in the introspection data.
constructAppSrcMaxLatency :: (IsAppSrc o, MonadIO m) => Int64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “max-latency
” property. This is rarely needed directly, but it is used by new
.
getAppSrcMaxLatency :: (MonadIO m, IsAppSrc o) => o -> m Int64 Source #
Get the value of the “max-latency
” property.
When overloading is enabled, this is equivalent to
get
appSrc #maxLatency
setAppSrcMaxLatency :: (MonadIO m, IsAppSrc o) => o -> Int64 -> m () Source #
Set the value of the “max-latency
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #maxLatency:=
value ]
maxTime
The maximum amount of time that can be queued internally. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal.
Since: 1.20
constructAppSrcMaxTime :: (IsAppSrc o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “max-time
” property. This is rarely needed directly, but it is used by new
.
getAppSrcMaxTime :: (MonadIO m, IsAppSrc o) => o -> m Word64 Source #
Get the value of the “max-time
” property.
When overloading is enabled, this is equivalent to
get
appSrc #maxTime
setAppSrcMaxTime :: (MonadIO m, IsAppSrc o) => o -> Word64 -> m () Source #
Set the value of the “max-time
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #maxTime:=
value ]
minLatency
The minimum latency of the source. A value of -1 will use the default
latency calculations of BaseSrc
.
constructAppSrcMinLatency :: (IsAppSrc o, MonadIO m) => Int64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “min-latency
” property. This is rarely needed directly, but it is used by new
.
getAppSrcMinLatency :: (MonadIO m, IsAppSrc o) => o -> m Int64 Source #
Get the value of the “min-latency
” property.
When overloading is enabled, this is equivalent to
get
appSrc #minLatency
setAppSrcMinLatency :: (MonadIO m, IsAppSrc o) => o -> Int64 -> m () Source #
Set the value of the “min-latency
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #minLatency:=
value ]
minPercent
Make appsrc emit the "need-data" signal when the amount of bytes in the queue drops below this percentage of max-bytes.
constructAppSrcMinPercent :: (IsAppSrc o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “min-percent
” property. This is rarely needed directly, but it is used by new
.
getAppSrcMinPercent :: (MonadIO m, IsAppSrc o) => o -> m Word32 Source #
Get the value of the “min-percent
” property.
When overloading is enabled, this is equivalent to
get
appSrc #minPercent
setAppSrcMinPercent :: (MonadIO m, IsAppSrc o) => o -> Word32 -> m () Source #
Set the value of the “min-percent
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #minPercent:=
value ]
size
The total size in bytes of the data stream. If the total size is known, it is recommended to configure it with this property.
constructAppSrcSize :: (IsAppSrc o, MonadIO m) => Int64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “size
” property. This is rarely needed directly, but it is used by new
.
getAppSrcSize :: (MonadIO m, IsAppSrc o) => o -> m Int64 Source #
Get the value of the “size
” property.
When overloading is enabled, this is equivalent to
get
appSrc #size
setAppSrcSize :: (MonadIO m, IsAppSrc o) => o -> Int64 -> m () Source #
Set the value of the “size
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #size:=
value ]
streamType
The type of stream that this source is producing. For seekable streams the application should connect to the seek-data signal.
constructAppSrcStreamType :: (IsAppSrc o, MonadIO m) => AppStreamType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “stream-type
” property. This is rarely needed directly, but it is used by new
.
getAppSrcStreamType :: (MonadIO m, IsAppSrc o) => o -> m AppStreamType Source #
Get the value of the “stream-type
” property.
When overloading is enabled, this is equivalent to
get
appSrc #streamType
setAppSrcStreamType :: (MonadIO m, IsAppSrc o) => o -> AppStreamType -> m () Source #
Set the value of the “stream-type
” property.
When overloading is enabled, this is equivalent to
set
appSrc [ #streamType:=
value ]
Signals
endOfStream
type AppSrcEndOfStreamCallback = IO FlowReturn Source #
Notify appsrc
that no more buffer are available.
afterAppSrcEndOfStream :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcEndOfStreamCallback) -> m SignalHandlerId Source #
Connect a signal handler for the endOfStream signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
appSrc #endOfStream callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAppSrcEndOfStream :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcEndOfStreamCallback) -> m SignalHandlerId Source #
Connect a signal handler for the endOfStream signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
appSrc #endOfStream callback
enoughData
type AppSrcEnoughDataCallback = IO () Source #
Signal that the source has enough data. It is recommended that the application stops calling push-buffer until the need-data signal is emitted again to avoid excessive buffer queueing.
afterAppSrcEnoughData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcEnoughDataCallback) -> m SignalHandlerId Source #
Connect a signal handler for the enoughData signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
appSrc #enoughData callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAppSrcEnoughData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcEnoughDataCallback) -> m SignalHandlerId Source #
Connect a signal handler for the enoughData signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
appSrc #enoughData callback
needData
type AppSrcNeedDataCallback Source #
Signal that the source needs more data. In the callback or from another thread you should call push-buffer or end-of-stream.
length
is just a hint and when it is set to -1, any number of bytes can be
pushed into appsrc
.
You can call push-buffer multiple times until the enough-data signal is fired.
afterAppSrcNeedData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcNeedDataCallback) -> m SignalHandlerId Source #
Connect a signal handler for the needData signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
appSrc #needData callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAppSrcNeedData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcNeedDataCallback) -> m SignalHandlerId Source #
Connect a signal handler for the needData signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
appSrc #needData callback
pushBuffer
type AppSrcPushBufferCallback Source #
= Buffer |
|
-> IO FlowReturn |
Adds a buffer to the queue of buffers that the appsrc element will push to its source pad.
This function does not take ownership of the buffer, but it takes a reference so the buffer can be unreffed at any time after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
afterAppSrcPushBuffer :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushBufferCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pushBuffer signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
appSrc #pushBuffer callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAppSrcPushBuffer :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushBufferCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pushBuffer signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
appSrc #pushBuffer callback
pushBufferList
type AppSrcPushBufferListCallback Source #
= BufferList |
|
-> IO FlowReturn |
Adds a buffer list to the queue of buffers and buffer lists that the appsrc element will push to its source pad.
This function does not take ownership of the buffer list, but it takes a reference so the buffer list can be unreffed at any time after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
Since: 1.14
afterAppSrcPushBufferList :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushBufferListCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pushBufferList signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
appSrc #pushBufferList callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAppSrcPushBufferList :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushBufferListCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pushBufferList signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
appSrc #pushBufferList callback
pushSample
type AppSrcPushSampleCallback Source #
= Sample |
|
-> IO FlowReturn |
Extract a buffer from the provided sample and adds the extracted buffer to the queue of buffers that the appsrc element will push to its source pad. This function set the appsrc caps based on the caps in the sample and reset the caps if they change. Only the caps and the buffer of the provided sample are used and not for example the segment in the sample.
This function does not take ownership of the sample, but it takes a reference so the sample can be unreffed at any time after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
Since: 1.6
afterAppSrcPushSample :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushSampleCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pushSample signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
appSrc #pushSample callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAppSrcPushSample :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcPushSampleCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pushSample signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
appSrc #pushSample callback
seekData
type AppSrcSeekDataCallback Source #
Seek to the given offset. The next push-buffer should produce buffers from
the new offset
.
This callback is only called for seekable stream types.
afterAppSrcSeekData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcSeekDataCallback) -> m SignalHandlerId Source #
Connect a signal handler for the seekData signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
appSrc #seekData callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onAppSrcSeekData :: (IsAppSrc a, MonadIO m) => a -> ((?self :: a) => AppSrcSeekDataCallback) -> m SignalHandlerId Source #
Connect a signal handler for the seekData signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
appSrc #seekData callback