gi-gstbase-1.0.23: GStreamerBase bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.GstBase.Objects.BaseTransform

Description

This base class is for filter elements that process data. Elements that are suitable for implementation using BaseTransform are ones where the size and caps of the output is known entirely from the input caps and buffer sizes. These include elements that directly transform one buffer into another, modify the contents of a buffer in-place, as well as elements that collate multiple input buffers into one output buffer, or that expand one input buffer into multiple output buffers. See below for more concrete use cases.

It provides for:

  • one sinkpad and one srcpad
  • Possible formats on sink and source pad implemented with custom transform_caps function. By default uses same format on sink and source.
  • Handles state changes
  • Does flushing
  • Push mode
  • Pull mode if the sub-class transform can operate on arbitrary data

Use Cases

Passthrough mode

  • Element has no interest in modifying the buffer. It may want to inspect it, in which case the element should have a transform_ip function. If there is no transform_ip function in passthrough mode, the buffer is pushed intact.
  • The BaseTransformClass.passthrough_on_same_caps variable will automatically set/unset passthrough based on whether the element negotiates the same caps on both pads.
  • BaseTransformClass.passthrough_on_same_caps on an element that doesn't implement a transform_caps function is useful for elements that only inspect data (such as level)
  • Example elements
  • Level
  • Videoscale, audioconvert, videoconvert, audioresample in certain modes.

Modifications in-place - input buffer and output buffer are the same thing.

  • The element must implement a transform_ip function.
  • Output buffer size must <= input buffer size
  • If the always_in_place flag is set, non-writable buffers will be copied and passed to the transform_ip function, otherwise a new buffer will be created and the transform function called.
  • Incoming writable buffers will be passed to the transform_ip function immediately.
  • only implementing transform_ip and not transform implies always_in_place = True
  • Example elements:
  • Volume
  • Audioconvert in certain modes (signed/unsigned conversion)
  • videoconvert in certain modes (endianness swapping)

Modifications only to the caps/metadata of a buffer

  • The element does not require writable data, but non-writable buffers should be subbuffered so that the meta-information can be replaced.
  • Elements wishing to operate in this mode should replace the prepare_output_buffer method to create subbuffers of the input buffer and set always_in_place to True
  • Example elements
  • Capsfilter when setting caps on outgoing buffers that have none.
  • identity when it is going to re-timestamp buffers by datarate.

Normal mode

  • always_in_place flag is not set, or there is no transform_ip function
  • Element will receive an input buffer and output buffer to operate on.
  • Output buffer is allocated by calling the prepare_output_buffer function.
  • Example elements:
  • Videoscale, videoconvert, audioconvert when doing scaling/conversions

Special output buffer allocations

  • Elements which need to do special allocation of their output buffers beyond allocating output buffers via the negotiated allocator or buffer pool should implement the prepare_output_buffer method.
  • Example elements:
  • efence

Sub-class settable flags on GstBaseTransform

  • passthrough
  • Implies that in the current configuration, the sub-class is not interested in modifying the buffers.
  • Elements which are always in passthrough mode whenever the same caps has been negotiated on both pads can set the class variable passthrough_on_same_caps to have this behaviour automatically.
  • always_in_place
  • Determines whether a non-writable buffer will be copied before passing to the transform_ip function.
  • Implied True if no transform function is implemented.
  • Implied False if ONLY transform function is implemented.
Synopsis

Exported types

newtype BaseTransform Source #

Memory-managed wrapper type.

Constructors

BaseTransform (ManagedPtr BaseTransform) 

Instances

Instances details
Eq BaseTransform Source # 
Instance details

Defined in GI.GstBase.Objects.BaseTransform

GObject BaseTransform Source # 
Instance details

Defined in GI.GstBase.Objects.BaseTransform

ManagedPtrNewtype BaseTransform Source # 
Instance details

Defined in GI.GstBase.Objects.BaseTransform

Methods

toManagedPtr :: BaseTransform -> ManagedPtr BaseTransform

TypedObject BaseTransform Source # 
Instance details

Defined in GI.GstBase.Objects.BaseTransform

Methods

glibType :: IO GType

IsGValue BaseTransform Source #

Convert BaseTransform to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.GstBase.Objects.BaseTransform

Methods

toGValue :: BaseTransform -> IO GValue

fromGValue :: GValue -> IO BaseTransform

HasParentTypes BaseTransform Source # 
Instance details

Defined in GI.GstBase.Objects.BaseTransform

type ParentTypes BaseTransform Source # 
Instance details

Defined in GI.GstBase.Objects.BaseTransform

type ParentTypes BaseTransform = '[Element, Object, Object]

class (GObject o, IsDescendantOf BaseTransform o) => IsBaseTransform o Source #

Type class for types which can be safely cast to BaseTransform, for instance with toBaseTransform.

Instances

Instances details
(GObject o, IsDescendantOf BaseTransform o) => IsBaseTransform o Source # 
Instance details

Defined in GI.GstBase.Objects.BaseTransform

toBaseTransform :: (MonadIO m, IsBaseTransform o) => o -> m BaseTransform Source #

Cast to BaseTransform, for types for which this is known to be safe. For general casts, use castTo.

Methods

Overloaded methods

getAllocator

baseTransformGetAllocator Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> m (Allocator, AllocationParams) 

Lets BaseTransform sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after use it.

getBufferPool

baseTransformGetBufferPool Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> m BufferPool

Returns: the instance of the BufferPool used by trans; free it after use it

No description available in the introspection data.

isInPlace

baseTransformIsInPlace Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: the BaseTransform to query

-> m Bool

Returns: True is the transform is configured in in_place mode.

MT safe.

See if trans is configured as a in_place transform.

isPassthrough

baseTransformIsPassthrough Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: the BaseTransform to query

-> m Bool

Returns: True is the transform is configured in passthrough mode.

MT safe.

See if trans is configured as a passthrough transform.

isQosEnabled

baseTransformIsQosEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> m Bool

Returns: True if QoS is enabled.

MT safe.

Queries if the transform will handle QoS.

reconfigureSink

baseTransformReconfigureSink Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> m () 

Instructs trans to request renegotiation upstream. This function is typically called after properties on the transform were set that influence the input format.

reconfigureSrc

baseTransformReconfigureSrc Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> m () 

Instructs trans to renegotiate a new downstream transform on the next buffer. This function is typically called after properties on the transform were set that influence the output format.

setGapAware

baseTransformSetGapAware Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> Bool

gapAware: New state

-> m () 

If gapAware is False (the default), output buffers will have the BufferFlagsGap flag unset.

If set to True, the element must handle output buffers with this flag set correctly, i.e. it can assume that the buffer contains neutral data but must unset the flag if the output is no neutral data.

MT safe.

setInPlace

baseTransformSetInPlace Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: the BaseTransform to modify

-> Bool

inPlace: Boolean value indicating that we would like to operate on in_place buffers.

-> m () 

Determines whether a non-writable buffer will be copied before passing to the transform_ip function.

  • Always True if no transform function is implemented.
  • Always False if ONLY transform function is implemented.

MT safe.

setPassthrough

baseTransformSetPassthrough Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: the BaseTransform to set

-> Bool

passthrough: boolean indicating passthrough mode.

-> m () 

Set passthrough mode for this filter by default. This is mostly useful for filters that do not care about negotiation.

Always True for filters which don't implement either a transform or transform_ip method.

MT safe.

setPreferPassthrough

baseTransformSetPreferPassthrough Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> Bool

preferPassthrough: New state

-> m () 

If preferPassthrough is True (the default), trans will check and prefer passthrough caps from the list of caps returned by the transform_caps vmethod.

If set to False, the element must order the caps returned from the transform_caps function in such a way that the preferred format is first in the list. This can be interesting for transforms that can do passthrough transforms but prefer to do something else, like a capsfilter.

MT safe.

Since: 1.0.1

setQosEnabled

baseTransformSetQosEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> Bool

enabled: new state

-> m () 

Enable or disable QoS handling in the transform.

MT safe.

updateQos

baseTransformUpdateQos Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> Double

proportion: the proportion

-> Int64

diff: the diff against the clock

-> Word64

timestamp: the timestamp of the buffer generating the QoS expressed in running_time.

-> m () 

Set the QoS parameters in the transform. This function is called internally when a QOS event is received but subclasses can provide custom information when needed.

MT safe.

updateSrcCaps

baseTransformUpdateSrcCaps Source #

Arguments

:: (HasCallStack, MonadIO m, IsBaseTransform a) 
=> a

trans: a BaseTransform

-> Caps

updatedCaps: An updated version of the srcpad caps to be pushed downstream

-> m Bool

Returns: True if the caps could be send downstream False otherwise

Updates the srcpad caps and send the caps downstream. This function can be used by subclasses when they have already negotiated their caps but found a change in them (or computed new information). This way, they can notify downstream about that change without losing any buffer.

Since: 1.6

Properties

qos

No description available in the introspection data.

constructBaseTransformQos :: (IsBaseTransform 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.

getBaseTransformQos :: (MonadIO m, IsBaseTransform o) => o -> m Bool Source #

Get the value of the “qos” property. When overloading is enabled, this is equivalent to

get baseTransform #qos

setBaseTransformQos :: (MonadIO m, IsBaseTransform o) => o -> Bool -> m () Source #

Set the value of the “qos” property. When overloading is enabled, this is equivalent to

set baseTransform [ #qos := value ]