gst

package
v1.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: LGPL-2.1 Imports: 19 Imported by: 0

Documentation

Overview

Package gst contains bindings for the gstreamer C API. If you are trying to build simple pipelines quickly (and optiionally readers/writers) see the gstauto package.

Index

Constants

View Source
const (
	ParameterControllable   = C.GST_PARAM_CONTROLLABLE
	ParameterMutablePlaying = C.GST_PARAM_MUTABLE_PLAYING
	ParameterMutablePaused  = C.GST_PARAM_MUTABLE_PAUSED
	ParameterMutableReady   = C.GST_PARAM_MUTABLE_READY
)

Additional GStreamer ParamSpec flags

View Source
const (
	//Initial state. Waiting for transition to any other state.
	PromiseResultPending = C.GST_PROMISE_RESULT_PENDING
	// Interrupted by the consumer as it doesn't want the value anymore.
	PromiseResultInterrupted = C.GST_PROMISE_RESULT_INTERRUPTED
	// A producer marked a reply
	PromiseResultReplied = C.GST_PROMISE_RESULT_REPLIED
	// The promise expired (the carrying object lost all refs) and the promise will never be fulfilled.
	PromiseResultExpired = C.GST_PROMISE_RESULT_EXPIRED
)

Variables

View Source
var (
	CapsFeatureMemorySystemMemory string = C.GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY
)

Go casting of pre-baked caps features

View Source
var ErrCannotAwaitPromise = errors.New("promises received from FFI cannot be awaited")

ErrCannotAwaitPromise signifies that we do not have a channel that we can await.

this happens if the promise was marshaled from a GValue coming from C

View Source
var ErrNilPromiseReply = errors.New("promise returned a nil reply")
View Source
var ErrPromiseNotReplied = errors.New("promise was not replied")
View Source
var ExtendsBin glib.Extendable = &extendsBin{parent: ExtendsElement}

ExtendsBin implements an Extendable object based on a GstBin.

View Source
var ExtendsElement glib.Extendable = &extendElement{parent: glib.ExtendsObject}

ExtendsElement implements an Extendable object based on a GstElement.

View Source
var InterfaceChildProxy glib.Interface = &interfaceChildProxy{}

InterfaceChildProxy represents the GstChildProxy interface. Use this when querying bins for elements that implement GstChildProxy, or when signaling that a GoObjectSubclass provides this interface.

View Source
var InterfaceTOCSetter = glib.Type(C.GST_TYPE_TOC_SETTER)

InterfaceTOCSetter represents the GstTocSetter interface GType. Use this when querying bins for elements that implement a TOCSetter.

View Source
var InterfaceTagSetter glib.Interface = &interfaceTagSetter{}

InterfaceTagSetter represents the GstTagsetter interface GType. Use this when querying bins for elements that implement a TagSetter. Extending this interface is not yet implemented.

View Source
var InterfaceURIHandler glib.Interface = &interfaceURIHandler{}

InterfaceURIHandler represents the GstURIHandler interface GType. Use this when querying bins for elements that implement a URIHandler, or when signaling that a GoObjectSubclass provides this interface. Note that the way this interface is implemented, it can only be used once per plugin.

View Source
var TypeBitmask = glib.Type(C.gst_bitmask_get_type())

TypeBitmask is the GType for a bitmask value.

TypeCaps is the static Glib Type for a GstCaps.

View Source
var TypeCapsFeatures = glib.Type(C.gst_caps_features_get_type())

TypeCapsFeatures is the glib.Type for a CapsFeatures.

View Source
var TypeFlagset = glib.Type(C.gst_flagset_get_type())

TypeFlagset is the GType for a Flagset

View Source
var TypeFloat64Range = glib.Type(C.gst_double_range_get_type())

TypeFloat64Range is the GType for a range of 64-bit floating point numbers. This is the equivalent of a GstDoubleRange.

View Source
var TypeFraction = glib.Type(C.gst_fraction_get_type())

TypeFraction is the GType for a GstFraction

View Source
var TypeFractionRange = glib.Type(C.gst_fraction_range_get_type())

TypeFractionRange is the GType for a GstFractionRange

View Source
var TypeInt64Range = glib.Type(C.gst_int64_range_get_type())

TypeInt64Range is the GType for a range of 64-bit integers.

View Source
var TypeIntRange = glib.Type(C.gst_int_range_get_type())

TypeIntRange is the GType for a range of integers.

View Source
var TypePromise = glib.Type(C.GST_TYPE_PROMISE)
View Source
var TypeStructure = glib.Type(C.gst_structure_get_type())

TypeStructure is the glib.Type for a Structure.

View Source
var TypeValueArray = glib.Type(C.gst_value_array_get_type())

TypeValueArray is the GType for a GstValueArray

View Source
var TypeValueList = glib.Type(C.gst_value_list_get_type())

TypeValueList is the GType for a GstValueList

Functions

func APIHasTag

func APIHasTag(api glib.Type, tag string) bool

APIHasTag returns true if the given api has the given tag.

func Deinit

func Deinit()

Deinit is a wrapper for gst_deinit Clean up any resources created by GStreamer in gst_init(). It is normally not needed to call this function in a normal application as the resources will automatically be freed when the program terminates. This function is therefore mostly used by testsuites and other memory profiling tools.

func ElementLinkMany

func ElementLinkMany(elems ...*Element) error

ElementLinkMany is a go implementation of `gst_element_link_many` to compensate for no variadic functions in cgo.

func ElementUnlinkMany

func ElementUnlinkMany(elems ...*Element)

ElementUnlinkMany is a go implementation of `gst_element_unlink_many` to compensate for no variadic functions in cgo.

func FilterProtectionSystemByDecryptors

func FilterProtectionSystemByDecryptors(decryptors []string) []string

FilterProtectionSystemByDecryptors tterates the supplied list of UUIDs and checks the GstRegistry for all the decryptors supporting one of the supplied UUIDs.

func GetAPITags

func GetAPITags(apiType glib.Type) []string

GetAPITags retrieves the tags for the given api type.

func GetMaxBufferMemory

func GetMaxBufferMemory() uint64

GetMaxBufferMemory returns the maximum amount of memory a buffer can hold.

func Init

func Init(args *[]string)

Init is a wrapper around gst_init() and must be called before any other gstreamer calls and is used to initialize everything necessary. In addition to setting up gstreamer for usage, a pointer to a slice of strings may be passed in to parse standard gst command line arguments. args will be modified to remove any flags that were handled. Alternatively, nil may be passed in to not perform any command line parsing.

The bindings will also set up their own internal DebugCategory for logging than can be invoked from applications or plugins as well. However, for plugins it is generally better to initialize your own DebugCategory.

func NextGroupID

func NextGroupID() uint

NextGroupID returns a new group id that can be used for an event.

func RegisterAPIType

func RegisterAPIType(name string, tags []string) glib.Type

RegisterAPIType registers and returns a GType for the given api name and associates it with tags.

func RegisterElement

func RegisterElement(plugin *Plugin, name string, rank Rank, elem glib.GoObjectSubclass, extends glib.Extendable, interfaces ...glib.Interface) bool

RegisterElement creates a new elementfactory capable of instantiating objects of the given GoElement and adds the factory to the plugin. A higher rank means more importance when autoplugging.

plugin can also be nil to register a static element

func RegisterPlugin

func RegisterPlugin(desc *PluginMetadata, initFunc PluginInitFunc) bool

RegisterPlugin will register a static plugin, i.e. a plugin which is private to an application or library and contained within the application or library (as opposed to being shipped as a separate module file).

func SelectProtectionSystem

func SelectProtectionSystem(decryptors []string) string

SelectProtectionSystem iterates the supplied list of UUIDs and checks the GstRegistry for an element that supports one of the supplied UUIDs. If more than one element matches, the system ID of the highest ranked element is selected.

func SetLogFunction

func SetLogFunction(f LogFunction)

SetLogFunction is used to replace gstreamer's default logging function. Setting to nil will revert to the default logging function.

func ValueDeserialize

func ValueDeserialize(data string, t glib.Type) (value *glib.Value, ok bool)

ValueDeserialize tries to deserialize a string into a glib.Value of the type specified. If the operation succeeds, TRUE is returned, FALSE otherwise.

func ValueFixate

func ValueFixate(src *glib.Value, dest *glib.Value) (ok bool)

ValueFixate fixates src into a new value dest. For ranges, the first element is taken. For lists and arrays, the first item is fixated and returned. If src is already fixed, this function returns FALSE.

func ValueFractionMultiply

func ValueFractionMultiply(factor1, factor2 *glib.Value) (product *glib.Value, ok bool)

ValueFractionMultiply multiplies the two GValue items containing a TypeFraction and returns the product. This function can return false if any error occurs, such as in memory allocation or an integer overflow.

func ValueFractionSubtract

func ValueFractionSubtract(minuend, subtrahend *glib.Value) (result *glib.Value, ok bool)

ValueFractionSubtract subtracts the subtrahend from the minuend containing a TypeFraction and returns the result. This function can return false if any error occurs, such as in memory allocation or an integer overflow.

func ValueIntersect

func ValueIntersect(value1, value2 *glib.Value) (*glib.Value, bool)

ValueIntersect calculates the intersection of two values. If the values have a non-empty intersection, the value representing the intersection isreturned. Otherwise this function returns false. This function can also return false for any allocation errors.

func ValueIsFixed

func ValueIsFixed(value *glib.Value) bool

ValueIsFixed tests if the given GValue, if available in a Structure (or any other container) contains a "fixed" (which means: one value) or an "unfixed" (which means: multiple possible values, such as data lists or data ranges) value.

func ValueIsSubset

func ValueIsSubset(value1, value2 *glib.Value) bool

ValueIsSubset checks that value1 is a subset of value2.

func ValueSerialize

func ValueSerialize(value *glib.Value) string

ValueSerialize attempts to serialize the given value into a string. An empty string is returned if no serializer exists.

func ValueSubtract

func ValueSubtract(minuend, subtrahend *glib.Value) (*glib.Value, bool)

ValueSubtract subtracts subtrahend from minuend and returns the resule. Note that this means subtraction as in sets, not as in mathematics. This function can return false if the subtraction is empty or any error occurs.

func ValueUnion

func ValueUnion(value1, value2 *glib.Value) (*glib.Value, bool)

ValueUnion creates a GValue corresponding to the union of value1 and value2.

func ValuesCanCompare

func ValuesCanCompare(val1, val2 *glib.Value) bool

ValuesCanCompare determines if val1 and val2 can be compared.

func ValuesCanIntersect

func ValuesCanIntersect(val1, val2 *glib.Value) bool

ValuesCanIntersect determines if intersecting two values will return a valid result. Two values will produce a valid intersection if they are the same type.

func ValuesCanSubtract

func ValuesCanSubtract(minuend, subtrahend *glib.Value) bool

ValuesCanSubtract checks if it's possible to subtract subtrahend from minuend.

func ValuesCanUnion

func ValuesCanUnion(val1, val2 *glib.Value) bool

ValuesCanUnion determines if val1 and val2 can be non-trivially unioned. Any two values can be trivially unioned by adding both of them to a GstValueList. However, certain types have the possibility to be unioned in a simpler way. For example, an integer range and an integer can be unioned if the integer is a subset of the integer range. If there is the possibility that two values can be unioned, this function returns TRUE.

Types

type AllocationParams

type AllocationParams struct {
	// contains filtered or unexported fields
}

AllocationParams wraps the GstAllocationParams.

func FromGstAllocationParamsUnsafe

func FromGstAllocationParamsUnsafe(alloc unsafe.Pointer) *AllocationParams

FromGstAllocationParamsUnsafe wraps the given unsafe.Pointer in an AllocationParams instance.

func NewAllocationParams

func NewAllocationParams() *AllocationParams

NewAllocationParams initializes a set of allocation params with the default values.

func (*AllocationParams) Copy

Copy copies these AllocationParams.

func (*AllocationParams) Free

func (a *AllocationParams) Free()

Free frees the underlying AllocationParams

func (*AllocationParams) GetAlignment

func (a *AllocationParams) GetAlignment() int64

GetAlignment returns the desired alignment of the memory.

func (*AllocationParams) GetFlags

func (a *AllocationParams) GetFlags() MemoryFlags

GetFlags returns the flags on these AllocationParams.

func (*AllocationParams) GetPadding

func (a *AllocationParams) GetPadding() int64

GetPadding returns the desired padding size.

func (*AllocationParams) GetPrefix

func (a *AllocationParams) GetPrefix() int64

GetPrefix returns the desired prefix size.

func (*AllocationParams) Init

func (a *AllocationParams) Init()

Init initializes these AllocationParams to their original values.

func (*AllocationParams) Instance

func (a *AllocationParams) Instance() *C.GstAllocationParams

Instance returns the underlying GstAllocationParams.

func (*AllocationParams) SetAlignment

func (a *AllocationParams) SetAlignment(align int64)

SetAlignment sets the desired alignment of the memory.

func (*AllocationParams) SetFlags

func (a *AllocationParams) SetFlags(flags MemoryFlags)

SetFlags changes the flags on these AllocationParams. this must be used

func (*AllocationParams) SetPadding

func (a *AllocationParams) SetPadding(padding int64)

SetPadding sets the desired padding size.

func (*AllocationParams) SetPrefix

func (a *AllocationParams) SetPrefix(prefix int64)

SetPrefix sets the desired prefix size.

type Allocator

type Allocator struct{ *Object }

Allocator is a go representation of a GstAllocator

func DefaultAllocator

func DefaultAllocator() *Allocator

DefaultAllocator returns the default GstAllocator.

func FromGstAllocatorUnsafeFull

func FromGstAllocatorUnsafeFull(alloc unsafe.Pointer) *Allocator

FromGstAllocatorUnsafeFull wraps the given unsafe.Pointer in an Allocator instance.

func FromGstAllocatorUnsafeNone

func FromGstAllocatorUnsafeNone(alloc unsafe.Pointer) *Allocator

FromGstAllocatorUnsafeNone wraps the given unsafe.Pointer in an Allocator instance.

func (*Allocator) Alloc

func (a *Allocator) Alloc(size int64, params *AllocationParams) *Memory

Alloc is used to allocate a new memory block with memory that is at least size big. The optional params can specify the prefix and padding for the memory. If nil is passed, no flags, no extra prefix/padding and a default alignment is used.

The prefix/padding will be filled with 0 if flags contains MemoryFlagZeroPrefixed and MemoryFlagZeroPadded respectively.

The alignment in params is given as a bitmask so that align + 1 equals the amount of bytes to align to. For example, to align to 8 bytes, use an alignment of 7.

func (*Allocator) Free

func (a *Allocator) Free(mem *Memory)

Free memory that was originally allocated with this allocator.

func (*Allocator) Instance

func (a *Allocator) Instance() *C.GstAllocator

Instance returns the underlying GstAllocator instance.

func (*Allocator) MemType

func (a *Allocator) MemType() string

MemType returns the memory type for this allocator.

type Bin

type Bin struct{ *Element }

Bin is a go wrapper arounds a GstBin.

func NewBin

func NewBin(name string) *Bin

NewBin returns a new Bin with the given name.

func NewBinFromString

func NewBinFromString(description string, ghostUnlinkedPads bool) (*Bin, error)

NewBinFromString constructs a bin from a string description. description - command line describing the bin ghostUnlinkedPads - whether to automatically create ghost pads for unlinked source or sink pads within the bin

func ToGstBin

func ToGstBin(obj interface{}) *Bin

ToGstBin wraps the given glib.Object, gst.Object, or gst.Element in a Bin instance. Only works for objects that implement their own Bin.

func (*Bin) Add

func (b *Bin) Add(elem *Element) error

Add adds an element to the bin.

func (*Bin) AddMany

func (b *Bin) AddMany(elems ...*Element) error

AddMany is a go implementation of `gst_bin_add_many`.

func (*Bin) DebugBinToDotData

func (b *Bin) DebugBinToDotData(details DebugGraphDetails) string

DebugBinToDotData will obtain the whole network of gstreamer elements that form the pipeline into a dot file. This data can be processed with graphviz to get an image.

func (*Bin) DebugBinToDotFile

func (b *Bin) DebugBinToDotFile(details DebugGraphDetails, filename string)

DebugBinToDotFile is like DebugBinToDotData except it will write the dot data to the filename specified.

func (*Bin) DebugBinToDotFileWithTs

func (b *Bin) DebugBinToDotFileWithTs(details DebugGraphDetails, filename string)

DebugBinToDotFileWithTs is like DebugBinToDotFile except it will write the dot data to the filename specified, except it will append the current timestamp to the filename.

func (*Bin) FindUnlinkedPad

func (b *Bin) FindUnlinkedPad(direction PadDirection) *Pad

FindUnlinkedPad recursively looks for elements with an unlinked pad of the given direction within this bin and returns an unlinked pad if one is found, or NULL otherwise.

func (*Bin) GetAllByInterface

func (b *Bin) GetAllByInterface(iface glib.Interface) ([]*Element, error)

GetAllByInterface looks for all elements inside the bin that implements the given interface. You can safely cast all returned elements to the given interface. The function recurses inside child bins.

func (*Bin) GetByInterface

func (b *Bin) GetByInterface(iface glib.Interface) (*Element, error)

GetByInterface looks for an element inside the bin that implements the given interface. If such an element is found, it returns the element. You can cast this element to the given interface afterwards. If you want all elements that implement the interface, use GetAllByInterface. This function recurses into child bins.

func (*Bin) GetElementByName

func (b *Bin) GetElementByName(name string) (*Element, error)

GetElementByName returns the element with the given name.

func (*Bin) GetElementByNameRecursive

func (b *Bin) GetElementByNameRecursive(name string) (*Element, error)

GetElementByNameRecursive returns the element with the given name. If it is not found in this Bin, parent Bins are searched recursively.

func (*Bin) GetElements

func (b *Bin) GetElements() ([]*Element, error)

GetElements returns a list of the elements added to this pipeline.

func (*Bin) GetElementsRecursive

func (b *Bin) GetElementsRecursive() ([]*Element, error)

GetElementsRecursive returns a list of the elements added to this Bin. It recurses children Bins.

func (*Bin) GetElementsSorted

func (b *Bin) GetElementsSorted() ([]*Element, error)

GetElementsSorted returns a list of the elements in this bin in topologically sorted order. This means that the elements are returned from the most downstream elements (sinks) to the sources.

func (*Bin) GetSinkElements

func (b *Bin) GetSinkElements() ([]*Element, error)

GetSinkElements returns a list of all the sink elements in this Bin.

func (*Bin) GetSourceElements

func (b *Bin) GetSourceElements() ([]*Element, error)

GetSourceElements returns a list of all the source elements in this Bin.

func (*Bin) GetSuppressedFlags

func (b *Bin) GetSuppressedFlags() ElementFlags

GetSuppressedFlags returns the suppressed flags of the bin.

func (*Bin) Instance

func (b *Bin) Instance() *C.GstBin

Instance returns the underlying GstBin instance.

func (*Bin) ParentAddElement

func (b *Bin) ParentAddElement(element *Element) bool

ParentAddElement chains up to the parent AddElement handler.

func (*Bin) ParentDeepElementAdded

func (b *Bin) ParentDeepElementAdded(subbin *Bin, element *Element)

ParentDeepElementAdded chains up to the parent DeepElementAdded handler.

func (*Bin) ParentDeepElementRemoved

func (b *Bin) ParentDeepElementRemoved(subbin *Bin, element *Element)

ParentDeepElementRemoved chains up to the parent DeepElementRemoved handler.

func (*Bin) ParentDoLatency

func (b *Bin) ParentDoLatency() bool

ParentDoLatency chains up to the parent DoLatency handler.

func (*Bin) ParentElementAdded

func (b *Bin) ParentElementAdded(element *Element)

ParentElementAdded chains up to the parent ElementAdded handler.

func (*Bin) ParentElementRemoved

func (b *Bin) ParentElementRemoved(element *Element)

ParentElementRemoved chains up to the parent ElementRemoved handler.

func (*Bin) ParentHandleMessage

func (b *Bin) ParentHandleMessage(message *Message)

ParentHandleMessage chains up to the parent HandleMessage handler.

func (*Bin) ParentRemoveElement

func (b *Bin) ParentRemoveElement(element *Element) bool

ParentRemoveElement chains up to the parent RemoveElement handler.

func (*Bin) RecalculateLatency

func (b *Bin) RecalculateLatency() bool

RecalculateLatency queries bin for the current latency and reconfigures this latency to all the elements with a LATENCY event.

This method is typically called on the pipeline when a MessageLatency is posted on the bus.

This function simply emits the 'do-latency' signal so any custom latency calculations will be performed. It returns true if the latency could be queried and reconfigured.

func (*Bin) Remove

func (b *Bin) Remove(elem *Element) error

Remove removes an element from the Bin.

func (*Bin) RemoveMany

func (b *Bin) RemoveMany(elems ...*Element) error

RemoveMany is a go implementation of `gst_bin_remove_many`.

func (*Bin) SetSuppressedFlags

func (b *Bin) SetSuppressedFlags(flags ElementFlags)

SetSuppressedFlags suppresses the given flags on the bin. ElementFlags of a child element are propagated when it is added to the bin. When suppressed flags are set, those specified flags will not be propagated to the bin.

func (*Bin) SyncChildrenStates

func (b *Bin) SyncChildrenStates() bool

SyncChildrenStates synchronizes the state of every child with the state of this Bin. This function returns true if the operation was successful.

type BinImpl

type BinImpl interface {
	AddElement(self *Bin, element *Element) bool
	DeepElementAdded(self *Bin, subbin *Bin, child *Element)
	DeepElementRemoved(self *Bin, subbin *Bin, child *Element)
	DoLatency(self *Bin) bool
	ElementAdded(self *Bin, child *Element)
	ElementRemoved(self *Bin, child *Element)
	HandleMessage(self *Bin, msg *Message)
	RemoveElement(self *Bin, element *Element) bool
}

BinImpl is the reference interface for Go elements extending a Bin. You only need to implement the methods that interest you.

type Bitmask

type Bitmask uint64

Bitmask represents a bitmask value.

func ValueGetBitmask

func ValueGetBitmask(value *glib.Value) Bitmask

ValueGetBitmask gets the bitmask from the given value.

func (Bitmask) ToGValue

func (b Bitmask) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer is a go representation of a GstBuffer.

func FromGstBufferUnsafeFull

func FromGstBufferUnsafeFull(buf unsafe.Pointer) *Buffer

FromGstBufferUnsafeFull wraps the given buffer without taking an additional reference.

func FromGstBufferUnsafeNone

func FromGstBufferUnsafeNone(buf unsafe.Pointer) *Buffer

FromGstBufferUnsafeNone wraps the given buffer, sinking any floating references, and places a finalizer on the wrapped Buffer.

func NewBufferAllocate

func NewBufferAllocate(alloc *Allocator, params *AllocationParams, size int64) *Buffer

NewBufferAllocate tries to create a newly allocated buffer with data of the given size and extra parameters from allocator. If the requested amount of memory can't be allocated, nil will be returned. The allocated buffer memory is not cleared.

When allocator is nil, the default memory allocator will be used.

Note that when size == 0, the buffer will not have memory associated with it.

func NewBufferFromBytes

func NewBufferFromBytes(b []byte) *Buffer

NewBufferFromBytes returns a new buffer from the given byte slice.

func NewBufferFromReader

func NewBufferFromReader(rdr io.Reader) (*Buffer, error)

NewBufferFromReader returns a new buffer from the given io.Reader.

func NewBufferFull

func NewBufferFull(flags MemoryFlags, data []byte, maxSize, offset, size int64, notifyFunc func()) *Buffer

NewBufferFull allocates a new buffer that wraps the given data. The wrapped buffer will have the region from offset and size visible. The maxsize must be at least the size of the data provided.

When the buffer is destroyed, notifyFunc will be called if it is not nil.

The prefix/padding must be filled with 0 if flags contains MemoryFlagZeroPrefixed and MemoryFlagZeroPadded respectively.

// Example

buf := gst.NewBufferFull(0, []byte("hello-world"), 1024, 0, 1024, func() {
    fmt.Println("buffer was destroyed")
})

func NewBufferWithSize

func NewBufferWithSize(size int64) *Buffer

NewBufferWithSize is a convenience wrapped for NewBufferrAllocate with the default allocator and parameters.

func NewEmptyBuffer

func NewEmptyBuffer() *Buffer

NewEmptyBuffer returns a new empty buffer.

func ToGstBuffer

func ToGstBuffer(buf unsafe.Pointer) *Buffer

ToGstBuffer converts the given pointer into a Buffer without affecting the ref count or placing finalizers.

func (*Buffer) AddMeta

func (b *Buffer) AddMeta(info *MetaInfo, params interface{}) *Meta

AddMeta adds metadata for info to the buffer using the parameters in params. The given parameters are passed to the MetaInfo's init function, and as such will only work for MetaInfo objects created from the go runtime.

// Example

metaInfo := gst.RegisterMeta(glib.TypeFromName("MyObjectType"), "my-meta", 1024, &gst.MetaInfoCallbackFuncs{
    InitFunc: func(params interface{}, buffer *gst.Buffer) bool {
        paramStr := params.(string)
        fmt.Println("Buffer initialized with params:", paramStr)
        return true
    },
    FreeFunc: func(buffer *gst.Buffer) {
        fmt.Println("Buffer was destroyed")
    },
})

buf := gst.NewEmptyBuffer()
buf.AddMeta(metaInfo, "hello world")

// > Buffer initialized with params: hello world
// > Buffer was destroyed

func (*Buffer) AddParentMeta

func (b *Buffer) AddParentMeta(buf *Buffer) *ParentBufferMeta

AddParentMeta adds a ParentBufferMeta to this buffer that holds a parent reference on the given buffer until the it is freed.

func (*Buffer) AddProtectionMeta

func (b *Buffer) AddProtectionMeta(info *Structure) *ProtectionMeta

AddProtectionMeta attaches ProtectionMeta to this buffer. The structure contains cryptographic information relating to the sample contained in the buffer. This function takes ownership of the structure.

func (*Buffer) AddReferenceTimestampMeta

func (b *Buffer) AddReferenceTimestampMeta(ref *Caps, timestamp, duration ClockTime) *ReferenceTimestampMeta

AddReferenceTimestampMeta adds a ReferenceTimestampMeta to this buffer that holds a timestamp and optional duration (specify -1 to omit) based on a specific timestamp reference.

See the documentation of GstReferenceTimestampMeta for details. https://gstreamer.freedesktop.org/documentation/gstreamer/gstbuffer.html?gi-language=c#GstReferenceTimestampMeta

func (*Buffer) Append

func (b *Buffer) Append(buf *Buffer) *Buffer

Append will append all the memory from the given buffer to this one. The result buffer will contain a concatenation of the memory of the two buffers.

func (*Buffer) AppendMemory

func (b *Buffer) AppendMemory(mem *Memory)

AppendMemory append the memory block to this buffer. This function takes ownership of the memory and thus doesn't increase its refcount.

This function is identical to InsertMemory with an index of -1.

func (*Buffer) AppendRegion

func (b *Buffer) AppendRegion(buf *Buffer, offset, size int64) *Buffer

AppendRegion will append size bytes at offset from the given buffer to this one. The result buffer will contain a concatenation of the memory of this buffer and the requested region of the one provided.

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

Bytes returns a byte slice of the data inside this buffer.

func (*Buffer) Copy

func (b *Buffer) Copy() *Buffer

Copy creates a copy of this buffer. This will only copy the buffer's data to a newly allocated Memory if needed (if the type of memory requires it), otherwise the underlying data is just referenced. Check DeepCopy if you want to force the data to be copied to newly allocated Memory.

func (*Buffer) CopyInto

func (b *Buffer) CopyInto(dest *Buffer, flags BufferCopyFlags, offset, size int64) bool

CopyInto copies the information from this buffer into the given one. If the given buffer already contains memory and flags contains BufferCopyMemory, the memory from this one will be appended to that provided.

Flags indicate which fields will be copied. Offset and size dictate from where and how much memory is copied. If size is -1 then all data is copied. The function returns true if the copy was successful.

func (*Buffer) CopyRegion

func (b *Buffer) CopyRegion(flags BufferCopyFlags, offset, size int64) *Buffer

CopyRegion creates a sub-buffer from this one at offset and size. This sub-buffer uses the actual memory space of the parent buffer. This function will copy the offset and timestamp fields when the offset is 0. If not, they will be set to ClockTimeNone.

If offset equals 0 and size equals the total size of buffer, the duration and offset end fields are also copied. If not they will be set to ClockTimeNone.

func (*Buffer) DecodingTimestamp

func (b *Buffer) DecodingTimestamp() ClockTime

DecodingTimestamp returns the decoding timestamp of the buffer, or a negative duration if not known or relevant. This value contains the timestamp when the media should be processed.

func (*Buffer) DeepCopy

func (b *Buffer) DeepCopy() *Buffer

DeepCopy creates a copy of the given buffer. This will make a newly allocated copy of the data the source buffer contains.

func (*Buffer) Duration

func (b *Buffer) Duration() ClockTime

Duration returns the length of the data inside this buffer, or a negative duration if not known or relevant.

func (*Buffer) Extract

func (b *Buffer) Extract(offset, size int64) []byte

Extract extracts size bytes starting from offset in this buffer. The data extracted may be lower than the actual size if the buffer did not contain enough data.

func (*Buffer) FillBytes

func (b *Buffer) FillBytes(offset int64, data []byte) int64

FillBytes adds the given byte slice to the buffer at the given offset. The return value reflects the amount of data added to the buffer.

func (*Buffer) FindMemory

func (b *Buffer) FindMemory(offset, size int64) (index, length uint, skip int64)

FindMemory looks for the memory blocks that span size bytes starting from offset in buffer. Size can be -1 to retrieve all the memory blocks.

Index will contain the index of the first memory block where the byte for offset can be found and length contains the number of memory blocks containing the size remaining bytes. Skip contains the number of bytes to skip in the memory block at index to get to the byte for offset. All values will be 0 if the memory blocks could not be read.

func (*Buffer) ForEachMeta

func (b *Buffer) ForEachMeta(f func(meta *Meta) bool) bool

ForEachMeta calls the given function for each Meta in this buffer.

The function can modify the passed meta pointer or its contents. The return value defines if this function continues or if the remaining metadata items in the buffer should be skipped.

func (*Buffer) GetAllMemory

func (b *Buffer) GetAllMemory() *Memory

GetAllMemory retrieves all the memory inside this buffer.

func (*Buffer) GetFlags

func (b *Buffer) GetFlags() BufferFlags

GetFlags returns the flags on this buffer.

func (*Buffer) GetMemory

func (b *Buffer) GetMemory(idx uint) *Memory

GetMemory retrieves the memory block at the given index in the buffer.

func (*Buffer) GetMemoryRange

func (b *Buffer) GetMemoryRange(idx uint, length int) *Memory

GetMemoryRange retrieves length memory blocks in buffer starting at idx. The memory blocks will be merged into one large Memory. If length is -1, all memory starting from idx is merged.

func (*Buffer) GetMeta

func (b *Buffer) GetMeta(api glib.Type) *Meta

GetMeta retrieves the metadata for the given api on buffer. When there is no such metadata, nil is returned. If multiple metadata with the given api are attached to this buffer only the first one is returned. To handle multiple metadata with a given API use ForEachMeta instead and check the type.

func (*Buffer) GetNumMetas

func (b *Buffer) GetNumMetas(api glib.Type) uint

GetNumMetas returns the number of metas for the given api type on the buffer.

func (*Buffer) GetReferenceTimestampMeta

func (b *Buffer) GetReferenceTimestampMeta(caps *Caps) *ReferenceTimestampMeta

GetReferenceTimestampMeta finds the first ReferenceTimestampMeta on the buffer that conforms to reference. Conformance is tested by checking if the meta's reference is a subset of reference.

Buffers can contain multiple ReferenceTimestampMeta metadata items.

func (*Buffer) GetSize

func (b *Buffer) GetSize() int64

GetSize retrieves the number of Memory blocks in the bffer.

func (*Buffer) GetSizes

func (b *Buffer) GetSizes() (size, offset, maxsize int64)

GetSizes will retrieve the size of the buffer, the offset of the first memory block in the buffer, and the sum of the size of the buffer, the offset, and any padding. These values can be used to resize the buffer with Resize.

func (*Buffer) GetSizesRange

func (b *Buffer) GetSizesRange(idx uint, length int) (offset, maxsize int64)

GetSizesRange will get the total size of length memory blocks stating from idx in buffer.

Offset will contain the offset of the data in the memory block in buffer at idx and maxsize will contain the sum of the size and offset and the amount of extra padding on the memory block at idx + length -1. Offset and maxsize can be used to resize the buffer memory blocks with ResizeRange.

func (*Buffer) HasFlags

func (b *Buffer) HasFlags(flags BufferFlags) bool

HasFlags returns true if this Buffer has the given BufferFlags.

func (*Buffer) InsertMemory

func (b *Buffer) InsertMemory(mem *Memory, idx int)

InsertMemory insert the memory block to the buffer at idx. This function takes ownership of the Memory and thus doesn't increase its refcount.

Only the value from GetMaxBufferMemory can be added to a buffer. If more memory is added, existing memory blocks will automatically be merged to make room for the new memory.

func (*Buffer) Instance

func (b *Buffer) Instance() *C.GstBuffer

Instance returns the underlying GstBuffer instance.

func (*Buffer) IsAllMemoryWritable

func (b *Buffer) IsAllMemoryWritable() bool

IsAllMemoryWritable checks if all memory blocks in buffer are writable.

Note that this function does not check if buffer is writable, use IsWritable to check that if needed.

func (*Buffer) IsMemoryRangeWritable

func (b *Buffer) IsMemoryRangeWritable(idx uint, length int) bool

IsMemoryRangeWritable checks if length memory blocks in the buffer starting from idx are writable.

Length can be -1 to check all the memory blocks after idx.

Note that this function does not check if buffer is writable, use IsWritable to check that if needed.

func (*Buffer) IsWritable

func (b *Buffer) IsWritable() bool

IsWritable returns true if this buffer is writable.

func (*Buffer) IterateMeta

func (b *Buffer) IterateMeta(meta *Meta) *Meta

IterateMeta retrieves the next Meta after the given one. If state points to nil, the first Meta is returned.

func (*Buffer) IterateMetaFiltered

func (b *Buffer) IterateMetaFiltered(meta *Meta, apiType glib.Type) *Meta

IterateMetaFiltered is similar to IterateMeta except it will filter on the api type.

func (*Buffer) MakeWritable

func (b *Buffer) MakeWritable() *Buffer

MakeWritable returns a writable copy of this buffer. If the source buffer is already writable, this will simply return the same buffer.

Use this function to ensure that a buffer can be safely modified before making changes to it, including changing the metadata such as PTS/DTS.

If the reference count of the source buffer buf is exactly one, the caller is the sole owner and this function will return the buffer object unchanged.

If there is more than one reference on the object, a copy will be made using gst_buffer_copy. The passed-in buf will be unreffed in that case, and the caller will now own a reference to the new returned buffer object. Note that this just copies the buffer structure itself, the underlying memory is not copied if it can be shared amongst multiple buffers.

In short, this function unrefs the buf in the argument and refs the buffer that it returns. Don't access the argument after calling this function unless you have an additional reference to it.

func (*Buffer) Map

func (b *Buffer) Map(flags MapFlags) *MapInfo

Map will map the data inside this buffer. This function can return nil if the memory is not read or writable. It is safe to call this function multiple times on a single Buffer, however it will retain the flags used when mapping the first time. To change between read and write access first unmap and then remap the buffer with the appropriate flags, or map initially with both read/write access.

Unmap the Buffer after usage.

func (*Buffer) MapRange

func (b *Buffer) MapRange(idx uint, length int, flags MapFlags) *MapInfo

MapRange maps the info of length merged memory blocks starting at idx in buffer. When length is -1, all memory blocks starting from idx are merged and mapped.

Flags describe the desired access of the memory. When flags is MapWrite, buffer should be writable (as returned from IsWritable).

When the buffer is writable but the memory isn't, a writable copy will automatically be created and returned. The readonly copy of the buffer memory will then also be replaced with this writable copy.

Unmap the Buffer after usage.

func (*Buffer) Memset

func (b *Buffer) Memset(offset int64, val uint8, size int64) int64

Memset fills buf with size bytes with val starting from offset. It returns the size written to the buffer.

func (*Buffer) NumMemoryBlocks

func (b *Buffer) NumMemoryBlocks() uint

NumMemoryBlocks returns the number of memory blocks this buffer has.

func (*Buffer) Offset

func (b *Buffer) Offset() int64

Offset returns a media specific offset for the buffer data. For video frames, this is the frame number of this buffer. For audio samples, this is the offset of the first sample in this buffer. For file data or compressed data this is the byte offset of the first byte in this buffer.

func (*Buffer) OffsetEnd

func (b *Buffer) OffsetEnd() int64

OffsetEnd returns the last offset contained in this buffer. It has the same format as Offset.

func (*Buffer) PeekMemory

func (b *Buffer) PeekMemory(idx uint) *Memory

PeekMemory gets the memory block at idx in buffer. The memory block stays valid until the memory block is removed, replaced, or merged. Typically with any call that modifies the memory in buffer.

func (*Buffer) PrependMemory

func (b *Buffer) PrependMemory(mem *Memory)

PrependMemory prepends the memory block mem to this buffer. This function takes ownership of mem and thus doesn't increase its refcount.

This function is identical to InsertMemory with an index of 0.

func (*Buffer) PresentationTimestamp

func (b *Buffer) PresentationTimestamp() ClockTime

PresentationTimestamp returns the presentation timestamp of the buffer, or a negative duration if not known or relevant. This value contains the timestamp when the media should be presented to the user.

func (*Buffer) Reader

func (b *Buffer) Reader() io.Reader

Reader returns an io.Reader for this buffer.

func (*Buffer) Ref

func (b *Buffer) Ref() *Buffer

Ref increases the ref count on the buffer by one.

func (*Buffer) RemoveAllMemory

func (b *Buffer) RemoveAllMemory()

RemoveAllMemory removes all memory blocks in the buffer.

func (*Buffer) RemoveMemoryAt

func (b *Buffer) RemoveMemoryAt(idx uint)

RemoveMemoryAt removes the memory block at the given index.

func (*Buffer) RemoveMemoryRange

func (b *Buffer) RemoveMemoryRange(idx uint, length int)

RemoveMemoryRange removes length memory blocks in buffer starting from idx.

Length can be -1, in which case all memory starting from idx is removed.

func (*Buffer) RemoveMeta

func (b *Buffer) RemoveMeta(meta *Meta) bool

RemoveMeta removes the given metadata from the buffer.

func (*Buffer) ReplaceAllMemory

func (b *Buffer) ReplaceAllMemory(mem *Memory)

ReplaceAllMemory replaces all the memory in this buffer with that provided.

func (*Buffer) ReplaceMemory

func (b *Buffer) ReplaceMemory(mem *Memory, idx uint)

ReplaceMemory replaces the memory at the given index with the given memory.

func (*Buffer) ReplaceMemoryRange

func (b *Buffer) ReplaceMemoryRange(idx uint, length int, mem *Memory)

ReplaceMemoryRange replaces length memory blocks in the buffer starting at idx with the given memory.

If length is -1, all memory starting from idx will be removed and replaced.

The buffer should be writable.

func (*Buffer) Resize

func (b *Buffer) Resize(offset, size int64)

Resize sets the offset and total size of the memory blocks in this buffer.

func (*Buffer) ResizeRange

func (b *Buffer) ResizeRange(idx uint, length int, offset, size int64) bool

ResizeRange sets the total size of the length memory blocks starting at idx in this buffer.

func (*Buffer) SetDuration

func (b *Buffer) SetDuration(dur ClockTime)

SetDuration sets the duration on the buffer.

func (*Buffer) SetFlags

func (b *Buffer) SetFlags(flags BufferFlags) bool

SetFlags sets one or more buffer flags on the buffer.

func (*Buffer) SetPresentationTimestamp

func (b *Buffer) SetPresentationTimestamp(dur ClockTime)

SetPresentationTimestamp sets the presentation timestamp on the buffer.

func (*Buffer) SetSize

func (b *Buffer) SetSize(size int64)

SetSize sets the total size of the memory blocks in buffer.

func (*Buffer) Unmap

func (b *Buffer) Unmap()

Unmap will unmap the data inside this memory. Use this after calling Map on the buffer.

func (*Buffer) Unref

func (b *Buffer) Unref()

Unref decreaes the ref count on the buffer by one. When the refcount reaches zero, the memory is freed.

func (*Buffer) UnsetFlags

func (b *Buffer) UnsetFlags(flags BufferFlags) bool

UnsetFlags removes one or more flags from the buffer.

type BufferCopyFlags

type BufferCopyFlags int

BufferCopyFlags casts GstBufferCopyFlags to a go type.

const (
	BufferCopyNone        BufferCopyFlags = C.GST_BUFFER_COPY_NONE       // (0) – copy nothing
	BufferCopyBufferFlags BufferCopyFlags = C.GST_BUFFER_COPY_FLAGS      // (1) – flag indicating that buffer flags should be copied
	BufferCopyTimestamps  BufferCopyFlags = C.GST_BUFFER_COPY_TIMESTAMPS // (2) – flag indicating that buffer pts, dts, duration, offset and offset_end should be copied
	BufferCopyMeta        BufferCopyFlags = C.GST_BUFFER_COPY_META       // (4) – flag indicating that buffer meta should be copied
	BufferCopyMemory      BufferCopyFlags = C.GST_BUFFER_COPY_MEMORY     // (8) – flag indicating that buffer memory should be reffed and appended to already existing memory. Unless the memory is marked as NO_SHARE, no actual copy of the memory is made but it is simply reffed. Add GST_BUFFER_COPY_DEEP to force a real copy.
	BufferCopyMerge       BufferCopyFlags = C.GST_BUFFER_COPY_MERGE      // (16) – flag indicating that buffer memory should be merged
	BufferCopyDeep        BufferCopyFlags = C.GST_BUFFER_COPY_DEEP       // (32) – flag indicating that memory should always be copied instead of reffed (Since: 1.2)
)

Type castings of BufferCopyFlags

type BufferFlags

type BufferFlags int

BufferFlags casts GstBufferFlags to a go type.

const (
	BufferFlagLive         BufferFlags = C.GST_BUFFER_FLAG_LIVE          // (16) – the buffer is live data and should be discarded in the PAUSED state.
	BufferFlagDecodeOnly   BufferFlags = C.GST_BUFFER_FLAG_DECODE_ONLY   // (32) – the buffer contains data that should be dropped because it will be clipped against the segment boundaries or because it does not contain data that should be shown to the user.
	BufferFlagDiscont      BufferFlags = C.GST_BUFFER_FLAG_DISCONT       // (64) – the buffer marks a data discontinuity in the stream. This typically occurs after a seek or a dropped buffer from a live or network source.
	BufferFlagResync       BufferFlags = C.GST_BUFFER_FLAG_RESYNC        // (128) – the buffer timestamps might have a discontinuity and this buffer is a good point to resynchronize.
	BufferFlagCorrupted    BufferFlags = C.GST_BUFFER_FLAG_CORRUPTED     // (256) – the buffer data is corrupted.
	BufferFlagMarker       BufferFlags = C.GST_BUFFER_FLAG_MARKER        // (512) – the buffer contains a media specific marker. for video this is the end of a frame boundary, for audio this is the start of a talkspurt.
	BufferFlagHeader       BufferFlags = C.GST_BUFFER_FLAG_HEADER        // (1024) – the buffer contains header information that is needed to decode the following data.
	BufferFlagGap          BufferFlags = C.GST_BUFFER_FLAG_GAP           // (2048) – the buffer has been created to fill a gap in the stream and contains media neutral data (elements can switch to optimized code path that ignores the buffer content).
	BufferFlagDroppable    BufferFlags = C.GST_BUFFER_FLAG_DROPPABLE     // (4096) – the buffer can be dropped without breaking the stream, for example to reduce bandwidth.
	BufferFlagDeltaUnit    BufferFlags = C.GST_BUFFER_FLAG_DELTA_UNIT    // (8192) – this unit cannot be decoded independently.
	BufferFlagSyncAfter    BufferFlags = C.GST_BUFFER_FLAG_SYNC_AFTER    // (32768) – Elements which write to disk or permanent storage should ensure the data is synced after writing the contents of this buffer. (Since: 1.6)
	BufferFlagNonDroppable BufferFlags = C.GST_BUFFER_FLAG_NON_DROPPABLE // (65536) – This buffer is important and should not be dropped. This can be used to mark important buffers, e.g. to flag RTP packets carrying keyframes or codec setup data for RTP Forward Error Correction purposes, or to prevent still video frames from being dropped by elements due to QoS. (Since: 1.14)
	BufferFlagLast         BufferFlags = C.GST_BUFFER_FLAG_LAST          // (1048576) – additional media specific flags can be added starting from this flag.
)

Type castings of BufferFlags

type BufferList

type BufferList struct {
	// contains filtered or unexported fields
}

BufferList is a go wrapper around a GstBufferList for grouping Buffers

func FromGstBufferListUnsafeFull

func FromGstBufferListUnsafeFull(buf unsafe.Pointer) *BufferList

FromGstBufferListUnsafeFull wraps the given buffer without taking an additional reference.

func FromGstBufferListUnsafeNone

func FromGstBufferListUnsafeNone(buf unsafe.Pointer) *BufferList

FromGstBufferListUnsafeNone is used for returns from transfer-none methods.

func NewBufferList

func NewBufferList(buffers []*Buffer) *BufferList

NewBufferList returns a new BufferList. The given slice can be nil and the returned buffer list will be empty.

func NewBufferListSized

func NewBufferListSized(size uint) *BufferList

NewBufferListSized creates a new BufferList with the given size.

func ToGstBufferList

func ToGstBufferList(buf unsafe.Pointer) *BufferList

ToGstBufferList converts the given pointer into a BufferList without affecting the ref count or placing finalizers.

func (*BufferList) CalculateSize

func (b *BufferList) CalculateSize() int64

CalculateSize calculates the size of the data contained in this buffer list by adding the size of all buffers.

func (*BufferList) Copy

func (b *BufferList) Copy() *BufferList

Copy creates a shallow copy of the given buffer list. This will make a newly allocated copy of the source list with copies of buffer pointers. The refcount of buffers pointed to will be increased by one.

func (*BufferList) DeepCopy

func (b *BufferList) DeepCopy() *BufferList

DeepCopy creates a copy of the given buffer list. This will make a newly allocated copy of each buffer that the source buffer list contains.

func (*BufferList) ForEach

func (b *BufferList) ForEach(f func(buf *Buffer, idx uint) bool)

ForEach calls the given function for each buffer in list.

The function can modify the passed buffer pointer or its contents. The return value defines if this function returns or if the remaining buffers in the list should be skipped.

func (*BufferList) GetBufferAt

func (b *BufferList) GetBufferAt(idx uint) *Buffer

GetBufferAt gets the buffer at idx.

You must make sure that idx does not exceed the number of buffers available.

func (*BufferList) GetWritableBufferAt

func (b *BufferList) GetWritableBufferAt(idx uint) *Buffer

GetWritableBufferAt gets the buffer at idx, ensuring it is a writable buffer.

You must make sure that idx does not exceed the number of buffers available.

func (*BufferList) Insert

func (b *BufferList) Insert(idx int, buf *Buffer)

Insert inserts a buffer at idx in the list. Other buffers are moved to make room for this new buffer.

A -1 value for idx will append the buffer at the end.

func (*BufferList) Instance

func (b *BufferList) Instance() *C.GstBufferList

Instance returns the underlying GstBufferList.

func (*BufferList) IsWritable

func (b *BufferList) IsWritable() bool

IsWritable returns true if this BufferList is writable.

func (*BufferList) Length

func (b *BufferList) Length() uint

Length returns the number of buffers in the list.

func (*BufferList) MakeWritable

func (b *BufferList) MakeWritable() *BufferList

MakeWritable makes a writable buffer list from this one. If the source buffer list is already writable, this will simply return the same buffer list. A copy will otherwise be made using Copy.

func (*BufferList) Ref

func (b *BufferList) Ref() *BufferList

Ref increases the refcount of the given buffer list by one.

Note that the refcount affects the writability of list and its data, see MakeWritable. It is important to note that keeping additional references to GstBufferList instances can potentially increase the number of memcpy operations in a pipeline.

func (*BufferList) Remove

func (b *BufferList) Remove(idx, length uint)

Remove removes length buffers from the list starting at index. All following buffers are moved to close the gap.

func (*BufferList) Unref

func (b *BufferList) Unref()

Unref decreases the refcount of the buffer list. If the refcount reaches 0, the buffer list will be freed.

type BufferPool

type BufferPool struct{ *Object }

BufferPool is a go wrapper around a GstBufferPool.

For more information refer to the official documentation: https://gstreamer.freedesktop.org/documentation/gstreamer/gstbufferpool.html?gi-language=c

func FromGstBufferPoolUnsafeFull

func FromGstBufferPoolUnsafeFull(bufferPool unsafe.Pointer) *BufferPool

FromGstBufferPoolUnsafeFull wraps the given unsafe.Pointer in a BufferPool instance. It just places a runtime finalizer on the resulting object.

func FromGstBufferPoolUnsafeNone

func FromGstBufferPoolUnsafeNone(bufferPool unsafe.Pointer) *BufferPool

FromGstBufferPoolUnsafeNone wraps the given unsafe.Pointer in a BufferPool instance. It takes a ref and places a runtime finalizer on the resulting object.

func NewBufferPool

func NewBufferPool() *BufferPool

NewBufferPool returns a new BufferPool instance.

func (*BufferPool) AcquireBuffer

func (b *BufferPool) AcquireBuffer(params *BufferPoolAcquireParams) (*Buffer, FlowReturn)

AcquireBuffer acquires a buffer from this pool.

func (*BufferPool) GetConfig

func (b *BufferPool) GetConfig() *BufferPoolConfig

GetConfig retrieves a copy of the current configuration of the pool. This configuration can either be modified and used for the SetConfig call or it must be freed after usage with Free.

func (*BufferPool) GetOptions

func (b *BufferPool) GetOptions() []string

GetOptions retrieves a list of supported bufferpool options for the pool. An option would typically be enabled with AddOption.

func (*BufferPool) HasOption

func (b *BufferPool) HasOption(opt string) bool

HasOption returns true if this BufferPool supports the given option.

func (*BufferPool) Instance

func (b *BufferPool) Instance() *C.GstBufferPool

Instance returns the underlying GstBufferPool instance.

func (*BufferPool) IsActive

func (b *BufferPool) IsActive() bool

IsActive returns true if this BufferPool is active. A pool can be activated with SetActive.

func (*BufferPool) IsFlushing

func (b *BufferPool) IsFlushing() bool

IsFlushing returns true if this BufferPool is currently flushing.

func (*BufferPool) ReleaseBuffer

func (b *BufferPool) ReleaseBuffer(buf *Buffer)

ReleaseBuffer releases the given buffer from the pool. The buffer should have previously been allocated from pool with AcquireBiffer.

This function is usually called automatically when the last ref on buffer disappears.

func (*BufferPool) SetActive

func (b *BufferPool) SetActive(active bool) (ok bool)

SetActive can be used to control the active state of pool. When the pool is inactive, new calls to AcquireBuffer will return with FlowFlushing.

Activating the bufferpool will preallocate all resources in the pool based on the configuration of the pool.

Deactivating will free the resources again when there are no outstanding buffers. When there are outstanding buffers, they will be freed as soon as they are all returned to the pool.

func (*BufferPool) SetConfig

func (b *BufferPool) SetConfig(cfg *BufferPoolConfig) bool

SetConfig sets the configuration of the pool. If the pool is already configured, and the configurations haven't changed, this function will return TRUE. If the pool is active, this method will return FALSE and active configurations will remain. Buffers allocated form this pool must be returned or else this function will do nothing and return FALSE.

config is a GstStructure that contains the configuration parameters for the pool. A default and mandatory set of parameters can be configured with gst_buffer_pool_config_set_params, gst_buffer_pool_config_set_allocator and gst_buffer_pool_config_add_option.

If the parameters in config can not be set exactly, this function returns FALSE and will try to update as much state as possible. The new state can then be retrieved and refined with GetConfig.

This function takes ownership of the given structure.

func (*BufferPool) SetFlushing

func (b *BufferPool) SetFlushing(flushing bool)

SetFlushing enables or disable the flushing state of a pool without freeing or allocating buffers.

type BufferPoolAcquireFlags

type BufferPoolAcquireFlags int

BufferPoolAcquireFlags casts GstBufferPoolAcquireFlags to a go type.

const (
	BufferPoolAcquireFlagNone     BufferPoolAcquireFlags = C.GST_BUFFER_POOL_ACQUIRE_FLAG_NONE     // (0) – no flags
	BufferPoolAcquireFlagKeyUnit  BufferPoolAcquireFlags = C.GST_BUFFER_POOL_ACQUIRE_FLAG_KEY_UNIT // (1) – buffer is keyframe
	BufferPoolAcquireFlagDontWait BufferPoolAcquireFlags = C.GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT // (2) – when the bufferpool is empty, acquire_buffer will by default block until a buffer is released into the pool again. Setting this flag makes acquire_buffer return GST_FLOW_EOS instead of blocking.
	BufferPoolAcquireFlagDiscont  BufferPoolAcquireFlags = C.GST_BUFFER_POOL_ACQUIRE_FLAG_DISCONT  // (4) – buffer is discont
	BufferPoolAcquireFlagLast     BufferPoolAcquireFlags = C.GST_BUFFER_POOL_ACQUIRE_FLAG_LAST     // (65536) – last flag, subclasses can use private flags starting from this value.
)

Type castings of BufferPoolAcquireFlags

type BufferPoolAcquireParams

type BufferPoolAcquireParams struct {
	Format Format                 // format (GstFormat) – the format of start and stop
	Start  int64                  // start (gint64) – the start position
	Stop   int64                  // stop (gint64) – the stop position
	Flags  BufferPoolAcquireFlags // flags (GstBufferPoolAcquireFlags) – additional flags
}

BufferPoolAcquireParams represents parameters to an AcquireBuffer call.

type BufferPoolConfig

type BufferPoolConfig struct{ *Structure }

BufferPoolConfig wraps the Structure interface with extra methods for interacting with BufferPool configurations.

func (*BufferPoolConfig) AddOption

func (b *BufferPoolConfig) AddOption(opt string)

AddOption enables the option in config. This will instruct the bufferpool to enable the specified option on the buffers that it allocates.

The supported options by pool can be retrieved with GetOptions.

func (*BufferPoolConfig) GetAllocator

func (b *BufferPoolConfig) GetAllocator() (*Allocator, *AllocationParams)

GetAllocator retrieves the allocator and params from config.

func (*BufferPoolConfig) GetOption

func (b *BufferPoolConfig) GetOption(index uint) string

GetOption retrieves the option at index of the options API array.

func (*BufferPoolConfig) GetParams

func (b *BufferPoolConfig) GetParams() (caps *Caps, size, minBuffers, maxBuffers uint)

GetParams retrieves the values from this config. All params return 0 or nil if they could not be fetched.

func (*BufferPoolConfig) HasOption

func (b *BufferPoolConfig) HasOption(opt string) bool

HasOption returns true if this config has the given option.

func (*BufferPoolConfig) NumOptions

func (b *BufferPoolConfig) NumOptions() uint

NumOptions retrieves the number of values currently stored in the options array of the config structure.

func (*BufferPoolConfig) SetAllocator

func (b *BufferPoolConfig) SetAllocator(allocator *Allocator, params *AllocationParams)

SetAllocator sets the allocator and params on config.

One of allocator and params can be nil, but not both. When allocator is nil, the default allocator of the pool will use the values in param to perform its allocation. When param is nil, the pool will use the provided allocator with its default AllocationParams.

A call to SetConfig on the BufferPool can update the allocator and params with the values that it is able to do. Some pools are, for example, not able to operate with different allocators or cannot allocate with the values specified in params. Use GetConfig on the pool to get the currently used values.

func (*BufferPoolConfig) SetParams

func (b *BufferPoolConfig) SetParams(caps *Caps, size, minBuffers, maxBuffers uint)

SetParams configures the config with the given parameters.

func (*BufferPoolConfig) Validate

func (b *BufferPoolConfig) Validate(caps *Caps, size, minBuffers, maxBuffers uint) bool

Validate that changes made to config are still valid in the context of the expected parameters. This function is a helper that can be used to validate changes made by a pool to a config when SetConfig returns FALSE. This expects that caps haven't changed and that min_buffers aren't lower then what we initially expected. This does not check if options or allocator parameters are still valid, and won't check if size have changed, since changing the size is valid to adapt padding.

type BufferingMode

type BufferingMode int

BufferingMode is a representation of GstBufferingMode

const (
	BufferingStream    BufferingMode = C.GST_BUFFERING_STREAM    // (0) – a small amount of data is buffered
	BufferingDownload  BufferingMode = C.GST_BUFFERING_DOWNLOAD  // (1) – the stream is being downloaded
	BufferingTimeshift BufferingMode = C.GST_BUFFERING_TIMESHIFT //  (2) – the stream is being downloaded in a ringbuffer
	BufferingLive      BufferingMode = C.GST_BUFFERING_LIVE      // (3) – the stream is a live stream
)

Type casts of buffering modes

func (BufferingMode) String

func (b BufferingMode) String() string

String implements a stringer on a BufferingMode.

type BufferingStats

type BufferingStats struct {
	// The buffering mode
	BufferingMode BufferingMode
	// The average input rate
	AverageIn int
	// The average output rate
	AverageOut int
	// Amount of time until buffering is complete
	BufferingLeft time.Duration
}

BufferingStats represents the buffering stats as retrieved from a GST_MESSAGE_TYPE_BUFFERING.

type Bus

type Bus struct {
	*Object
}

Bus is a Go wrapper around a GstBus. It provides convenience methods for popping messages from the queue.

func FromGstBusUnsafeFull

func FromGstBusUnsafeFull(bus unsafe.Pointer) *Bus

FromGstBusUnsafeFull wraps the given unsafe.Pointer in a bus. It does not increase the ref count and places a runtime finalizer on the instance.

func FromGstBusUnsafeNone

func FromGstBusUnsafeNone(bus unsafe.Pointer) *Bus

FromGstBusUnsafeNone wraps the given unsafe.Pointer in a bus. It takes a ref on the bus and sets a runtime finalizer on it.

func NewBus

func NewBus() *Bus

NewBus returns a new Bus instance.

// Example of using the bus instance

package main

import (
    "fmt"

    "github.com/ArtemMartus/go-gst/gst"
)

func main() {
    gst.Init(nil)

    bus := gst.NewBus()

    elem, err := gst.NewElement("fakesrc")
    if err != nil {
        panic(err)
    }

    bus.Post(gst.NewAsyncStartMessage(elem))

    msg := bus.Pop()

    fmt.Println(msg)
}

// > [fakesrc0] ASYNC-START - Async task started

func (*Bus) AddSignalWatch

func (b *Bus) AddSignalWatch()

AddSignalWatch adds a bus signal watch to the default main context with the default priority (%G_PRIORITY_DEFAULT). It is also possible to use a non-default main context set up using g_main_context_push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').

After calling this statement, the bus will emit the "message" signal for each message posted on the bus.

This function may be called multiple times. To clean up, the caller is responsible for calling RemoveSignalWatch as many times as this function is called.

func (*Bus) AddWatch

func (b *Bus) AddWatch(busFunc BusWatchFunc) bool

AddWatch adds a watch to the default MainContext for messages emitted on this bus. This function is used to receive asynchronous messages in the main loop. There can only be a single bus watch per bus, you must remove it before you can set a new one.

The watch can be removed either by returning false from the function or by using RemoveWatch(). A MainLoop must be running for bus watches to work.

The return value reflects whether the watch was successfully added. False is returned if there is already a function registered.

func (*Bus) BlockPopMessage

func (b *Bus) BlockPopMessage() *Message

BlockPopMessage blocks until a message is available on the bus and then returns it. This function can return nil if the bus is closed.

It is much safer and easier to use the AddWatch or other polling functions. Only use this method if you are unable to also run a MainLoop, or for convenience sake.

func (*Bus) DisableSyncMessageEmission

func (b *Bus) DisableSyncMessageEmission()

DisableSyncMessageEmission instructs GStreamer to stop emitting the "sync-message" signal for this bus. See EnableSyncMessageEmission for more information.

In the event that multiple pieces of code have called EnableSyncMessageEmission, the sync-message emissions will only be stopped after all calls to EnableSyncMessageEmission were "canceled" by calling this function. In this way the semantics are exactly the same as Ref that which calls enable should also call disable.

func (*Bus) EnableSyncMessageEmission

func (b *Bus) EnableSyncMessageEmission()

EnableSyncMessageEmission instructs GStreamer to emit the "sync-message" signal after running the bus's sync handler. This function is here so that code can ensure that they can synchronously receive messages without having to affect what the bin's sync handler is.

This function may be called multiple times. To clean up, the caller is responsible for calling DisableSyncMessageEmission as many times as this function is called.

While this function looks similar to AddSignalWatch, it is not exactly the same -- this function enables *synchronous* emission of signals when messages arrive; AddSignalWatch adds an idle callback to pop messages off the bus asynchronously. The sync-message signal comes from the thread of whatever object posted the message; the "message" signal is marshaled to the main thread via the main loop.

func (*Bus) GetPollFd

func (b *Bus) GetPollFd() *PollFd

GetPollFd gets the file descriptor from the bus which can be used to get notified about messages being available with functions like g_poll, and allows integration into other event loops based on file descriptors. Whenever a message is available, the POLLIN / G_IO_IN event is set.

Warning: NEVER read or write anything to the returned fd but only use it for getting notifications via g_poll or similar and then use the normal GstBus API, e.g. PopMessage.

func (*Bus) HavePending

func (b *Bus) HavePending() bool

HavePending checks if there are pending messages on the bus that should be handled.

func (*Bus) Instance

func (b *Bus) Instance() *C.GstBus

Instance returns the underlying GstBus instance.

func (*Bus) Peek

func (b *Bus) Peek() *Message

Peek peeks the message on the top of the bus' queue. The message will remain on the bus' message queue.

func (*Bus) Poll

func (b *Bus) Poll(msgTypes MessageType, timeout ClockTime) *Message

Poll the bus for messages. Will block while waiting for messages to come. You can specify a maximum time to poll with the timeout parameter. If timeout is negative, this function will block indefinitely.

All messages not in events will be popped off the bus and will be ignored. It is not possible to use message enums beyond MessageExtended in the events mask.

Because poll is implemented using the "message" signal enabled by AddSignalWatch, calling Poll will cause the "message" signal to be emitted for every message that poll sees. Thus a "message" signal handler will see the same messages that this function sees -- neither will steal messages from the other.

This function will run a main loop from the default main context when polling.

You should never use this function, since it is pure evil. This is especially true for GUI applications based on Gtk+ or Qt, but also for any other non-trivial application that uses the GLib main loop. As this function runs a GLib main loop, any callback attached to the default GLib main context may be invoked. This could be timeouts, GUI events, I/O events etc.; even if Poll is called with a 0 timeout. Any of these callbacks

may do things you do not expect, e.g. destroy the main application window or some other resource; change other

application state; display a dialog and run another main loop until the user clicks it away. In short, using this function may add a lot of complexity to your code through unexpected re-entrancy and unexpected changes to your application's state.

For 0 timeouts use gst_bus_pop_filtered instead of this function; for other short timeouts use TimedPopFiltered; everything else is better handled by setting up an asynchronous bus watch and doing things from there.

func (*Bus) Pop

func (b *Bus) Pop() *Message

Pop pops a message from the bus, or returns nil if none are available.

func (*Bus) PopFiltered

func (b *Bus) PopFiltered(msgTypes MessageType) *Message

PopFiltered gets a message matching type from the bus. Will discard all messages on the bus that do not match type and that have been posted before the first message that does match type. If there is no message matching type on the bus, all messages will be discarded. It is not possible to use message enums beyond MessageExtended in the events mask.

func (*Bus) PopMessage

func (b *Bus) PopMessage(timeout ClockTime) *Message

PopMessage attempts to pop a message from the bus. It returns nil if none are available.

It is much safer and easier to use the AddWatch or other polling functions. Only use this method if you are unable to also run a MainLoop, or for convenience sake.

func (*Bus) Post

func (b *Bus) Post(msg *Message) bool

Post a new message on the bus. The bus takes ownership of the message.

func (*Bus) RemoveSignalWatch

func (b *Bus) RemoveSignalWatch()

RemoveSignalWatch removes a signal watch previously added with AddSignalWatch.

func (*Bus) RemoveWatch

func (b *Bus) RemoveWatch() bool

RemoveWatch will remove any watches installed on the bus. This can also be accomplished by returning false from a previously installed function.

The function returns false if there was no watch on the bus.

func (*Bus) SetFlushing

func (b *Bus) SetFlushing(flushing bool)

SetFlushing sets whether to flush out and unref any messages queued in the bus. Releases references to the message origin objects. Will flush future messages until SetFlushing sets flushing to FALSE.

func (*Bus) SetSyncHandler

func (b *Bus) SetSyncHandler(f BusSyncHandler)

SetSyncHandler sets the synchronous handler on the bus. The function will be called every time a new message is posted on the bus. Note that the function will be called in the same thread context as the posting object. This function is usually only called by the creator of the bus. Applications should handle messages asynchronously using the watch and poll functions.

Currently, destroyNotify funcs are not supported.

func (*Bus) TimedPop

func (b *Bus) TimedPop(dur ClockTime) *Message

TimedPop gets a message from the bus, waiting up to the specified timeout.

If timeout is 0, this function behaves like Pop. If timeout is ClockTimeNone, this function will block forever until a message was posted on the bus.

func (*Bus) TimedPopFiltered

func (b *Bus) TimedPopFiltered(dur ClockTime, msgTypes MessageType) *Message

TimedPopFiltered gets a message from the bus whose type matches the message type mask types, waiting up to the specified timeout (and discarding any messages that do not match the mask provided).

If timeout is 0, this function behaves like PopFiltered. If timeout is ClockTimeNone, this function will block forever until a matching message was posted on the bus.

type BusSyncHandler

type BusSyncHandler func(msg *Message) BusSyncReply

BusSyncHandler will be invoked synchronously, when a new message has been injected into the bus. This function is mostly used internally. Only one sync handler can be attached to a given bus.

If the handler returns BusDrop, it should unref the message, else the message should not be unreffed by the sync handler.

type BusSyncReply

type BusSyncReply int

BusSyncReply casts GstBusSyncReply to a go type

const (
	BusDrop  BusSyncReply = C.GST_BUS_DROP  // (0) – drop the message
	BusPass  BusSyncReply = C.GST_BUS_PASS  // (1) – pass the message to the async queue
	BusAsync BusSyncReply = C.GST_BUS_ASYNC // (2) – pass message to async queue, continue if message is handled
)

Type castings of SyncReplies

type BusWatchFunc

type BusWatchFunc func(msg *Message) bool

BusWatchFunc is a go representation of a GstBusFunc. It takes a message as a single argument and returns a bool value for whether to continue processing messages or not.

type Caps

type Caps struct {
	// contains filtered or unexported fields
}

Caps is a go wrapper around GstCaps.

func FromGstCapsUnsafeFull

func FromGstCapsUnsafeFull(caps unsafe.Pointer) *Caps

FromGstCapsUnsafeFull wraps the pointer to the given C GstCaps with the go type. This is meant for internal usage and is exported for visibility to other packages. A finalizer is placed on the object to Unref after leaving scope.

func FromGstCapsUnsafeNone

func FromGstCapsUnsafeNone(caps unsafe.Pointer) *Caps

FromGstCapsUnsafeNone wraps the pointer to the given C GstCaps with the go type. This is meant for internal usage and is exported for visibility to other packages. A ref is taken on the caps and finalizer placed on the object.

func NewAnyCaps

func NewAnyCaps() *Caps

NewAnyCaps creates a new caps that indicate compatibility with any format.

caps := gst.NewAnyCaps()
fmt.Println(caps.IsAny())
// true

func NewCapsFromString

func NewCapsFromString(capsStr string) *Caps

NewCapsFromString creates a new Caps object from the given string.

caps := gst.NewCapsFromString("audio/x-raw, channels=2")
fmt.Println(caps.String())
// audio/x-raw, channels=(int)2

func NewEmptyCaps

func NewEmptyCaps() *Caps

NewEmptyCaps creates a new empty caps object. This is essentially the opposite of NewAnyCamps.

caps := gst.NewEmptyCaps()
fmt.Println(caps.IsEmpty())
// true

func NewEmptySimpleCaps

func NewEmptySimpleCaps(mediaFormat string) *Caps

NewEmptySimpleCaps returns a new empty caps object with the given media format.

caps := gst.NewEmptySimpleCaps("audio/x-raw")
fmt.Println(caps.String())
// audio/x-raw

func NewFullCaps

func NewFullCaps(structures ...*Structure) *Caps

NewFullCaps creates a new caps from the given structures.

func ToGstCaps

func ToGstCaps(caps unsafe.Pointer) *Caps

ToGstCaps converts the given pointer into a Caps without affecting the ref count or placing finalizers.

func ValueGetCaps

func ValueGetCaps(value *glib.Value) *Caps

ValueGetCaps gets the caps from the given value.

func (*Caps) Append

func (c *Caps) Append(caps *Caps)

Append appends the given caps element to these caps. These caps take ownership over the given object. If either caps are ANY, the resulting caps will be ANY.

func (*Caps) AppendStructure

func (c *Caps) AppendStructure(st *Structure)

AppendStructure appends the given structure to this caps instance.

func (*Caps) AppendStructureFull

func (c *Caps) AppendStructureFull(st *Structure, features *CapsFeatures)

AppendStructureFull appends structure with features to caps. The structure is not copied; caps becomes the owner of structure.

func (*Caps) CanIntersect

func (c *Caps) CanIntersect(caps *Caps) bool

CanIntersect tries intersecting these caps with those given and reports whether the result would not be empty.

func (*Caps) Copy

func (c *Caps) Copy() *Caps

Copy creates a new Caps as a copy of these. The new caps will have a refcount of 1, owned by the caller. The structures are copied as well.

Note that this function is the semantic equivalent of a Ref followed by a MakeWritable.

func (*Caps) CopyNth

func (c *Caps) CopyNth(n uint) *Caps

CopyNth creates a new GstCaps and appends a copy of the nth structure contained in caps.

func (*Caps) FilterAndMapInPlace

func (c *Caps) FilterAndMapInPlace(f CapsMapFunc)

FilterAndMapInPlace calls the provided function once for each structure and caps feature in the Caps. In contrast to ForEach, the function may modify the structure and features. In contrast to MapInPlace, the structure and features are removed from the caps if FALSE is returned from the function. The caps must be mutable.

caps := gst.NewCapsFromString("audio/x-raw")

caps.FilterAndMapInPlace(func(features *gst.CapsFeatures, structure *gst.Structure) bool {
    if features.Contains(gst.CapsFeatureMemorySystemMemory) {
        fmt.Println("Removing system memory feature")
        return false
    }
    return true
})

fmt.Println(caps.IsEmpty())

// Removing system memory feature
// true

func (*Caps) Fixate

func (c *Caps) Fixate() *Caps

Fixate modifies the given caps into a representation with only fixed values. First the caps will be truncated and then the first structure will be fixated with Structure's Fixate.

This function takes ownership of caps and will call gst_caps_make_writable on it so you must not use caps afterwards unless you keep an additional reference to it with Ref.

Note that it is not guaranteed that the returned caps have exactly one structure. If caps are empty caps then then returned caps will be the empty too and contain no structure at all.

Calling this function with any caps is not allowed.

func (*Caps) ForEach

func (c *Caps) ForEach(f CapsMapFunc) bool

ForEach calls the provided function once for each structure and caps feature in the GstCaps. The function must not modify the fields. There is an unresolved bug in this function currently and it is better to use MapInPlace instead.

caps := gst.NewCapsFromString("audio/x-raw")

caps.ForEach(func(features *gst.CapsFeatures, structure *gst.Structure) bool {
    fmt.Println(structure)
    return true
})

// audio/x-raw;

func (*Caps) GetFeaturesAt

func (c *Caps) GetFeaturesAt(idx int) *CapsFeatures

GetFeaturesAt returns the feature at the given index, or nil if none exists.

func (*Caps) GetSize

func (c *Caps) GetSize() int

GetSize returns the number of structures inside this caps instance.

func (*Caps) GetStructureAt

func (c *Caps) GetStructureAt(idx int) *Structure

GetStructureAt returns the structure at the given index, or nil if none exists.

func (*Caps) Instance

func (c *Caps) Instance() *C.GstCaps

Instance returns the native GstCaps instance

func (*Caps) Intersect

func (c *Caps) Intersect(caps *Caps) *Caps

Intersect creates a new Caps that contains all the formats that are common to both these caps and those given. Defaults to CapsIntersectZigZag mode.

func (*Caps) IntersectFull

func (c *Caps) IntersectFull(caps *Caps, mode CapsIntersectMode) *Caps

IntersectFull creates a new Caps that contains all the formats that are common to both these caps those given. The order is defined by the CapsIntersectMode used.

func (*Caps) IsAlwaysCompatible

func (c *Caps) IsAlwaysCompatible(caps *Caps) bool

IsAlwaysCompatible returns if this structure is always compatible with another if every media format that is in the first is also contained in the second. That is, these caps are a subset of those given.

func (*Caps) IsAny

func (c *Caps) IsAny() bool

IsAny returns true if these caps match any media format.

func (*Caps) IsEmpty

func (c *Caps) IsEmpty() bool

IsEmpty returns true if these caps are empty.

func (*Caps) IsEqual

func (c *Caps) IsEqual(caps *Caps) bool

IsEqual returns true if the caps given represent the same set as these.

func (*Caps) IsEqualFixed

func (c *Caps) IsEqualFixed(caps *Caps) bool

IsEqualFixed tests if the Caps are equal. This function only works on fixed Caps.

func (*Caps) IsFixed

func (c *Caps) IsFixed() bool

IsFixed returns true if these caps are fixed, that is, they describe exactly one format.

func (*Caps) IsStrictlyEqual

func (c *Caps) IsStrictlyEqual(caps *Caps) bool

IsStrictlyEqual checks if the given caps are exactly the same set of caps.

func (*Caps) IsSubset

func (c *Caps) IsSubset(caps *Caps) bool

IsSubset checks if all caps represented by these are also represented by those given.

func (*Caps) IsSubsetStructure

func (c *Caps) IsSubsetStructure(structure *Structure) bool

IsSubsetStructure checks if the given structure is a subset of these caps.

func (*Caps) IsSubsetStructureFull

func (c *Caps) IsSubsetStructureFull(structure *Structure, features *CapsFeatures) bool

IsSubsetStructureFull checks if the given structure is a subset of these caps with features.

func (*Caps) IsWritable

func (c *Caps) IsWritable() bool

IsWritable returns true if these caps are writable.

func (*Caps) MakeWritable

func (c *Caps) MakeWritable() *Caps

MakeWritable returns a writable copy of caps.

func (*Caps) MapInPlace

func (c *Caps) MapInPlace(f CapsMapFunc) bool

MapInPlace calls the provided function once for each structure and caps feature in the Caps. In contrast to ForEach, the function may modify, but not delete, the structures and features. The caps must be mutable.

func (*Caps) Merge

func (c *Caps) Merge(caps *Caps) *Caps

Merge appends the structures contained in the given caps if they are not yet expressed by these. The structures in the given caps are not copied -- they are transferred to a writable copy of these ones, and then those given are freed. If either caps are ANY, the resulting caps will be ANY.

func (*Caps) MergeStructure

func (c *Caps) MergeStructure(structure *Structure) *Caps

MergeStructure appends structure to caps if its not already expressed by caps.

func (*Caps) MergeStructureFull

func (c *Caps) MergeStructureFull(structure *Structure, features *CapsFeatures) *Caps

MergeStructureFull appends structure with features to the caps if its not already expressed.

func (*Caps) Normalize

func (c *Caps) Normalize() *Caps

Normalize returns a Caps that represents the same set of formats as caps, but contains no lists. Each list is expanded into separate GstStructures.

This function takes ownership of caps and will call MakeWritable on it so you must not use caps afterwards unless you keep an additional reference to it with Ref.

func (*Caps) Ref

func (c *Caps) Ref() *Caps

Ref increases the ref count on these caps by one.

From this point on, until the caller calls Unref or MakeWritable, it is guaranteed that the caps object will not change. This means its structures won't change, etc. To use a Caps object, you must always have a refcount on it -- either the one made implicitly by e.g. NewSimpleCaps, or via taking one explicitly with this function. Note that when a function provided by these bindings returns caps, or they are converted through the FromGstCapsUnsafe methods, a ref is automatically taken if necessary and a runtime Finalizer is used to remove it.

func (*Caps) RemoveStructureAt

func (c *Caps) RemoveStructureAt(idx uint)

RemoveStructureAt removes the structure with the given index from the list of structures.

func (*Caps) SetFeaturesAt

func (c *Caps) SetFeaturesAt(idx uint, features *CapsFeatures)

SetFeaturesAt sets the CapsFeatures features for the structure at index.

func (*Caps) SetFeaturesSimple

func (c *Caps) SetFeaturesSimple(features *CapsFeatures)

SetFeaturesSimple sets the CapsFeatures for all the structures of these caps.

func (*Caps) SetValue

func (c *Caps) SetValue(field string, val interface{})

SetValue sets the given field on all structures of caps to the given value. This is a convenience function for calling SetValue on all structures of caps. If the value cannot be coerced to a C type, then nothing will happen.

func (*Caps) Simplify

func (c *Caps) Simplify() *Caps

Simplify converts the given caps into a representation that represents the same set of formats, but in a simpler form. Component structures that are identical are merged. Component structures that have values that can be merged are also merged.

This function takes ownership of caps and will call MakeWritable on it if necessary, so you must not use caps afterwards unless you keep an additional reference to it with Ref.

This method does not preserve the original order of caps.

func (*Caps) StealStructureAt

func (c *Caps) StealStructureAt(idx uint) *Structure

StealStructureAt retrieves the structure with the given index from the list of structures contained in caps. The caller becomes the owner of the returned structure.

func (*Caps) String

func (c *Caps) String() string

String implements a stringer on a caps instance. This same string can be used for NewCapsFromString.

func (*Caps) Subtract

func (c *Caps) Subtract(caps *Caps) *Caps

Subtract subtracts the given caps from these.

func (*Caps) ToGValue

func (c *Caps) ToGValue() (*glib.Value, error)

ToGValue returns a GValue containing the given caps.

func (*Caps) Truncate

func (c *Caps) Truncate() *Caps

Truncate discards all but the first structure from caps. Useful when fixating.

This function takes ownership of caps and will call gst_caps_make_writable on it if necessary, so you must not use caps afterwards unless you keep an additional reference to it with Ref.

Note that it is not guaranteed that the returned caps have exactly one structure. If caps is any or empty caps then then returned caps will be the same and contain no structure at all.

func (*Caps) Unref

func (c *Caps) Unref()

Unref decreases the ref count on these caps by one.

func (*Caps) Unsafe

func (c *Caps) Unsafe() unsafe.Pointer

Unsafe returns an unsafe.Pointer to the underlying GstCaps.

type CapsFeatures

type CapsFeatures struct {
	// contains filtered or unexported fields
}

CapsFeatures is a go representation of GstCapsFeatures.

func NewCapsFeaturesAny

func NewCapsFeaturesAny() *CapsFeatures

NewCapsFeaturesAny returns a new ANY CapsFeatures.

feats := gst.NewCapsFeaturesAny()
fmt.Println(feats.IsAny())
// true

func NewCapsFeaturesEmpty

func NewCapsFeaturesEmpty() *CapsFeatures

NewCapsFeaturesEmpty returns a new empty CapsFeatures.

feats := gst.NewCapsFeaturesEmpty()
fmt.Println(feats.GetSize())
// 0

func NewCapsFeaturesFromString

func NewCapsFeaturesFromString(features string) *CapsFeatures

NewCapsFeaturesFromString creates new CapsFeatures from the given string.

func ValueGetCapsFeatures

func ValueGetCapsFeatures(value *glib.Value) *CapsFeatures

ValueGetCapsFeatures gets the caps features from the given value.

func (*CapsFeatures) Add

func (c *CapsFeatures) Add(feature string)

Add adds the given feature to these.

feats := gst.NewCapsFeaturesEmpty()

fmt.Println(feats.GetSize())

feats.Add(gst.CapsFeatureMemorySystemMemory)

fmt.Println(feats.GetSize())
fmt.Println(feats.Contains(gst.CapsFeatureMemorySystemMemory))
fmt.Println(feats.GetNth(0))

// 0
// 1
// true
// memory:SystemMemory

func (*CapsFeatures) Contains

func (c *CapsFeatures) Contains(feature string) bool

Contains returns true if the given feature is included in these.

func (*CapsFeatures) Copy

func (c *CapsFeatures) Copy() *CapsFeatures

Copy duplicates these features and all of it's values.

func (*CapsFeatures) Free

func (c *CapsFeatures) Free()

Free frees the memory containing these features. Only call this if you do not intend to pass these features to other methods.

func (*CapsFeatures) GetNth

func (c *CapsFeatures) GetNth(idx uint) string

GetNth returns the feature at index.

func (*CapsFeatures) GetSize

func (c *CapsFeatures) GetSize() uint

GetSize returns the number of features.

func (*CapsFeatures) Instance

func (c *CapsFeatures) Instance() *C.GstCapsFeatures

Instance returns the native underlying GstCapsFeatures instance.

func (*CapsFeatures) IsAny

func (c *CapsFeatures) IsAny() bool

IsAny returns true if these features match any.

func (*CapsFeatures) IsEqual

func (c *CapsFeatures) IsEqual(feats *CapsFeatures) bool

IsEqual returns true if the given CapsFeatures are equal to the provided ones. If the provided structure is nil, this function immediately returns false.

func (*CapsFeatures) Remove

func (c *CapsFeatures) Remove(feature string)

Remove removes the given feature.

func (*CapsFeatures) SetParentRefCount

func (c *CapsFeatures) SetParentRefCount(refCount int) bool

SetParentRefCount sets the parent_refcount field of CapsFeatures. This field is used to determine whether a caps features is mutable or not. This function should only be called by code implementing parent objects of CapsFeatures, as described in the MT Refcounting section of the design documents.

func (*CapsFeatures) String

func (c *CapsFeatures) String() string

String implements a stringer on caps features.

feats := gst.NewCapsFeaturesAny()
fmt.Println(feats.String())
// ANY

func (*CapsFeatures) ToGValue

func (c *CapsFeatures) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer

type CapsIntersectMode

type CapsIntersectMode int

CapsIntersectMode represents the modes of caps intersection. See the official documentation for more details: https://gstreamer.freedesktop.org/documentation/gstreamer/gstcaps.html?gi-language=c#GstCapsIntersectMode

const (
	CapsIntersectZigZag CapsIntersectMode = C.GST_CAPS_INTERSECT_ZIG_ZAG
	CapsIntersectFirst  CapsIntersectMode = C.GST_CAPS_INTERSECT_FIRST
)

Type castings of intersect modes

type CapsMapFunc

type CapsMapFunc func(features *CapsFeatures, structure *Structure) bool

CapsMapFunc represents a function passed to the Caps MapInPlace, ForEach, and FilterAndMapInPlace methods.

type ChildProxy

type ChildProxy struct {
	// contains filtered or unexported fields
}

ChildProxy is an interface that abstracts handling of property sets for elements with children. They all have multiple GstPad or some kind of voice objects. Another use case are container elements like GstBin. The element implementing the interface acts as a parent for those child objects.

Property names are written as "child-name::property-name". The whole naming scheme is recursive. Thus "child1::child2::property" is valid too, if "child1" and "child2" implement the GstChildProxy interface.

func ToChildProxy

func ToChildProxy(elem *Element) *ChildProxy

ToChildProxy returns a ChildProxy for the given element. If the element does not implement a ChildProxy it returns nil.

func (*ChildProxy) ChildAdded

func (c *ChildProxy) ChildAdded(child *glib.Object, name string)

ChildAdded emits the "child-added" signal.

func (*ChildProxy) ChildRemoved

func (c *ChildProxy) ChildRemoved(child *glib.Object, name string)

ChildRemoved emits the "child-removed" signal.

func (*ChildProxy) Get

func (c *ChildProxy) Get(names ...string) []*glib.Value

Get gets properties of the parent object and its children. This is a direct alias to looping over GetProperty and returning the results in the order of the arguments. If any of the results returns nil from an allocation error, nil is returned for the entire slice.

func (*ChildProxy) GetChildByIndex

func (c *ChildProxy) GetChildByIndex(idx uint) *glib.Object

GetChildByIndex fetches a child by its number. This function can return nil if the object is not found.

func (*ChildProxy) GetChildByName

func (c *ChildProxy) GetChildByName(name string) *glib.Object

GetChildByName fetches a child by name. The virtual method's default implementation uses Object together with Object.GetName. If the interface is to be used with GObjects, this method needs to be overridden.

This function can return nil if the object is not found.

func (*ChildProxy) GetChildrenCount

func (c *ChildProxy) GetChildrenCount() uint

GetChildrenCount returns the number of child objects the parent contains.

func (*ChildProxy) GetProperty

func (c *ChildProxy) GetProperty(name string) *glib.Value

GetProperty gets a single property using the ChildProxy mechanism. The bindings take care of freeing the value when it leaves the user's scope. This function can return nil if a failure happens trying to allocate GValues.

func (*ChildProxy) Instance

func (c *ChildProxy) Instance() *C.GstChildProxy

Instance returns the underlying GstChildProxy instance.

func (*ChildProxy) Lookup

func (c *ChildProxy) Lookup(name string) (ok bool, target *glib.Object, param *glib.ParamSpec)

Lookup looks up which object and and parameter would be affected by the given name. If ok is false, the targets could not be found and this function returned nil.

func (*ChildProxy) Set

func (c *ChildProxy) Set(values map[string]*glib.Value)

Set takes a map of names to values and applies them using the ChildProxy mechanism.

func (*ChildProxy) SetProperty

func (c *ChildProxy) SetProperty(name string, value *glib.Value)

SetProperty sets a single property using the ChildProxy mechanism.

type ChildProxyImpl

type ChildProxyImpl interface {
	ChildAdded(self *ChildProxy, child *glib.Object, name string)
	ChildRemoved(self *ChildProxy, child *glib.Object, name string)
	GetChildByIndex(self *ChildProxy, idx uint) *glib.Object
	GetChildByName(self *ChildProxy, name string) *glib.Object
	GetChildrenCount(self *ChildProxy) uint
}

ChildProxyImpl is the reference implementation for a ChildProxy implemented by a Go object.

type Clock

type Clock struct{ *Object }

Clock is a go wrapper around a GstClock.

func FromGstClockUnsafeFull

func FromGstClockUnsafeFull(clock unsafe.Pointer) *Clock

FromGstClockUnsafeFull takes a pointer to a GstClock and wraps it in a Clock instance. A finalizer is set on the returned object.

func FromGstClockUnsafeNone

func FromGstClockUnsafeNone(clock unsafe.Pointer) *Clock

FromGstClockUnsafeNone takes a pointer to a GstClock and wraps it in a Clock instance. A ref is taken on the clock and a finalizer applied.

func (*Clock) AddObservation

func (c *Clock) AddObservation(slaveTime, masterTime ClockTime) (bool, float64)

AddObservation adds the time master of the master clock and the time slave of the slave clock to the list of observations. If enough observations are available, a linear regression algorithm is run on the observations and clock is recalibrated.

If this functions returns TRUE, the float will contain the correlation coefficient of the interpolation. A value of 1.0 means a perfect regression was performed. This value can be used to control the sampling frequency of the master and slave clocks.

func (*Clock) AddObservationUnapplied

func (c *Clock) AddObservationUnapplied(slaveTime, masterTime ClockTime) (ok bool, rSquared float64, internalTime, externalTime, rateNum, rateDenom ClockTime)

AddObservationUnapplied adds a clock observation to the internal slaving algorithm the same as AddObservation, and returns the result of the master clock estimation, without updating the internal calibration.

The caller can then take the results and call SetCalibration with the values, or some modified version of them.

func (*Clock) AdjustUnlocked

func (c *Clock) AdjustUnlocked(internal ClockTime) ClockTime

AdjustUnlocked converts the given internal clock time to the external time, adjusting for the rate and reference time set with SetCalibration and making sure that the returned time is increasing. This function should be called with the clock's OBJECT_LOCK held and is mainly used by clock subclasses.

This function is the reverse of UnadjustUnlocked.

func (*Clock) AdjustWithCalibration

func (c *Clock) AdjustWithCalibration(internalTarget, cinternal, cexternal, cnum, cdenom ClockTime) ClockTime

AdjustWithCalibration converts the given internal_target clock time to the external time, using the passed calibration parameters. This function performs the same calculation as AdjustUnlocked when called using the current calibration parameters, but doesn't ensure a monotonically increasing result as AdjustUnlocked does.

See: https://gstreamer.freedesktop.org/documentation/gstreamer/gstclock.html#gst_clock_adjust_with_calibration

func (*Clock) GetCalibration

func (c *Clock) GetCalibration() (internal, external, rateNum, rateDenom ClockTime)

GetCalibration gets the internal rate and reference time of clock. See gst_clock_set_calibration for more information.

func (*Clock) GetInternalTime

func (c *Clock) GetInternalTime() ClockTime

GetInternalTime gets the current internal time of the given clock in nanoseconds or ClockTimeNone if invalid. The time is returned unadjusted for the offset and the rate.

func (*Clock) GetMaster

func (c *Clock) GetMaster() *Clock

GetMaster returns the master clock that this clock is slaved to or nil when the clock is not slaved to any master clock.

func (*Clock) GetResolution

func (c *Clock) GetResolution() ClockTime

GetResolution gets the accuracy of the clock. The accuracy of the clock is the granularity of the values returned by GetTime.

func (*Clock) GetTime

func (c *Clock) GetTime() ClockTime

GetTime gets the current time of the given clock in nanoseconds or -1 if invalid. The time is always monotonically increasing and adjusted according to the current offset and rate.

func (*Clock) GetTimeout

func (c *Clock) GetTimeout() ClockTime

GetTimeout gets the amount of time that master and slave clocks are sampled.

func (*Clock) Instance

func (c *Clock) Instance() *C.GstClock

Instance returns the underlying GstClock instance.

func (*Clock) InternalString

func (c *Clock) InternalString() string

InternalString returns the string representation of this clock's internal value.

func (*Clock) IsSynced

func (c *Clock) IsSynced() bool

IsSynced returns true if the clock is synced.

func (*Clock) NewPeriodicID

func (c *Clock) NewPeriodicID(startTime, interval ClockTime) *ClockID

NewPeriodicID gets an ID from clock to trigger a periodic notification. The periodic notifications will start at time start_time and will then be fired with the given interval.

func (*Clock) NewSingleShotID

func (c *Clock) NewSingleShotID(at ClockTime) *ClockID

NewSingleShotID gets a ClockID from the clock to trigger a single shot notification at the requested time.

func (*Clock) PeriodicIDReinit

func (c *Clock) PeriodicIDReinit(clockID *ClockID, startTime, interval ClockTime) bool

PeriodicIDReinit reinitializes the provided periodic id to the provided start time and interval. Does not / modify the reference count.

func (*Clock) SetCalibration

func (c *Clock) SetCalibration(internal, external, rateNum, rateDenom ClockTime)

SetCalibration adjusts the rate and time of clock. See: https://gstreamer.freedesktop.org/documentation/gstreamer/gstclock.html#gst_clock_set_calibration.

func (*Clock) SetMaster

func (c *Clock) SetMaster(master *Clock) bool

SetMaster sets master as the master clock for clock. clock will be automatically calibrated so that GetTime reports the same time as the master clock.

A clock provider that slaves its clock to a master can get the current calibration values with GetCalibration.

Master can be nil in which case clock will not be slaved anymore. It will however keep reporting its time adjusted with the last configured rate and time offsets.

func (*Clock) SetResolution

func (c *Clock) SetResolution(resolution ClockTime) ClockTime

SetResolution sets the accuracy of the clock. Some clocks have the possibility to operate with different accuracy at the expense of more resource usage. There is normally no need to change the default resolution of a clock. The resolution of a clock can only be changed if the clock has the ClockFlagCanSetResolution flag set.

func (*Clock) SetSynced

func (c *Clock) SetSynced(synced bool)

SetSynced sets clock to synced and emits the GstClock::synced signal, and wakes up any thread waiting in WaitForSync.

This function must only be called if ClockFlagNeedsStartupSync is set on the clock, and is intended to be called by subclasses only.

func (*Clock) SetTimeout

func (c *Clock) SetTimeout(timeout ClockTime)

SetTimeout sets the amount of time, in nanoseconds, to sample master and slave clocks

func (*Clock) SingleShotIDReinit

func (c *Clock) SingleShotIDReinit(clockID *ClockID, at ClockTime) bool

SingleShotIDReinit reinitializes the provided single shot id to the provided time. Does not modify the reference count.

func (*Clock) String

func (c *Clock) String() string

String returns the string representation of this clock value.

func (*Clock) UnadjustUnlocked

func (c *Clock) UnadjustUnlocked(external ClockTime) ClockTime

UnadjustUnlocked converts the given external clock time to the internal time of clock, using the rate and reference time set with SetCalibration. This function should be called with the clock's OBJECT_LOCK held and is mainly used by clock subclasses.

This function is the reverse of AdjustUnlocked.

func (*Clock) UnadjustWithCalibration

func (c *Clock) UnadjustWithCalibration(externalTarget, cinternal, cexternal, cnum, cdenom ClockTime) ClockTime

UnadjustWithCalibration converts the given external_target clock time to the internal time, using the passed calibration parameters. This function performs the same calculation as UnadjustUnlocked when called using the current calibration parameters.

func (*Clock) WaitForSync

func (c *Clock) WaitForSync(timeout ClockTime) bool

WaitForSync waits until clock is synced for reporting the current time. If timeout is ClockTimeNone it will wait forever, otherwise it will time out after timeout nanoseconds.

For asynchronous waiting, the GstClock::synced signal can be used.

This returns immediately with TRUE if ClockFlagNeedsStartupSync is not set on the clock, or if the clock is already synced.

type ClockCallback

type ClockCallback func(clock *Clock, clockTime ClockTime) bool

ClockCallback is the prototype of a clock callback function.

type ClockEntryType

type ClockEntryType int

ClockEntryType wraps GstClockEntryType

const (
	ClockEntrySingle   ClockEntryType = C.GST_CLOCK_ENTRY_SINGLE   // (0) – a single shot timeout
	ClockEntryPeriodic ClockEntryType = C.GST_CLOCK_ENTRY_PERIODIC // (1) – a periodic timeout request
)

Type castings of ClockEntryTypes

type ClockFlags

type ClockFlags int

ClockFlags wraps GstClockFlags

const (
	ClockFlagCanDoSingleSync    ClockFlags = C.GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC    // (16) – clock can do a single sync timeout request
	ClockFlagCanDoSingleAsync   ClockFlags = C.GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC   // (32) – clock can do a single async timeout request
	ClockFlagCanDoPeriodicSync  ClockFlags = C.GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC  // (64) – clock can do sync periodic timeout requests
	ClockFlagCanDoPeriodicAsync ClockFlags = C.GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC // (128) – clock can do async periodic timeout callbacks
	ClockFlagCanSetResolution   ClockFlags = C.GST_CLOCK_FLAG_CAN_SET_RESOLUTION    // (256) – clock's resolution can be changed
	ClockFlagCanSetMaster       ClockFlags = C.GST_CLOCK_FLAG_CAN_SET_MASTER        // (512) – clock can be slaved to a master clock
	ClockFlagNeedsStartupSync   ClockFlags = C.GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC    // (1024) – clock needs to be synced before it can be used (Since: 1.6)
	ClockFlagLast               ClockFlags = C.GST_CLOCK_FLAG_LAST                  // (4096) – subclasses can add additional flags starting from this flag
)

Type castings of ClockFlags

type ClockID

type ClockID struct {
	// contains filtered or unexported fields
}

ClockID is a go wrapper around a GstClockID.

func (*ClockID) GetClock

func (c *ClockID) GetClock() *Clock

GetClock returns the clock for this ClockID.

func (*ClockID) GetTime

func (c *ClockID) GetTime() ClockTime

GetTime returns the time for this ClockID

func (*ClockID) Instance

func (c *ClockID) Instance() C.GstClockID

Instance returns the underlying pointer.

func (*ClockID) Ref

func (c *ClockID) Ref() *ClockID

Ref increaes the ref count on ClockID.

func (*ClockID) Unref

func (c *ClockID) Unref()

Unref unrefs a ClockID.

func (*ClockID) Unschedule

func (c *ClockID) Unschedule()

Unschedule cancels an outstanding request with id. This can either be an outstanding async notification or a pending sync notification. After this call, id cannot be used anymore to receive sync or async notifications, you need to create a new GstClockID.

func (*ClockID) UsesClock

func (c *ClockID) UsesClock(clock *Clock) bool

UsesClock returns whether id uses clock as the underlying clock. clock can be nil, in which case the return value indicates whether the underlying clock has been freed. If this is the case, the id is no longer usable and should be freed.

func (*ClockID) Wait

func (c *ClockID) Wait() (ret ClockReturn, jitter ClockTimeDiff)

Wait performs a blocking wait on id. id should have been created with NewSingleShotID or NewPeriodicID and should not have been unscheduled with a call to Unschedule.

If the jitter argument is not 0 and this function returns ClockOK or ClockEarly, it will contain the difference against the clock and the time of id when this method was called. Positive values indicate how late id was relative to the clock (in which case this function will return ClockEarly). Negative values indicate how much time was spent waiting on the clock before this function returned.

func (*ClockID) WaitAsync

func (c *ClockID) WaitAsync(f ClockCallback) ClockReturn

WaitAsync registers a callback on the given ClockID id with the given function and user_data. When passing a ClockID with an invalid time to this function, the callback will be called immediately with a time set to ClockTimeNone. The callback will be called when the time of id has been reached.

The callback func can be invoked from any thread, either provided by the core or from a streaming thread. The application should be prepared for this.

// Example

pipeline, _ := gst.NewPipelineFromString("fakesrc ! fakesink")

clock := pipeline.GetPipelineClock()

id := clock.NewSingleShotID(gst.ClockTime(1000000000)) // 1 second

id.WaitAsync(func(clock *gst.Clock, clockTime ClockTime) bool {
    fmt.Println("Single shot triggered at", clockTime.Nanoseconds())
    pipeline.SetState(gst.StateNull)
    return true
})

pipeline.SetState(gst.StatePlaying)
gst.Wait(pipeline)

// Single shot triggered at 1000000000

type ClockReturn

type ClockReturn int

ClockReturn wraps a GstClockReturn

const (
	ClockOK          ClockReturn = C.GST_CLOCK_OK          // (0) – The operation succeeded.
	ClockEarly       ClockReturn = C.GST_CLOCK_EARLY       // (1) – The operation was scheduled too late.
	ClockUnscheduled ClockReturn = C.GST_CLOCK_UNSCHEDULED // (2) – The clockID was unscheduled
	ClockBusy        ClockReturn = C.GST_CLOCK_BUSY        // (3) – The ClockID is busy
	ClockBadTime     ClockReturn = C.GST_CLOCK_BADTIME     // (4) – A bad time was provided to a function.
	ClockError       ClockReturn = C.GST_CLOCK_ERROR       // (5) – An error occurred
	ClockUnsupported ClockReturn = C.GST_CLOCK_UNSUPPORTED // (6) – Operation is not supported
	ClockDone        ClockReturn = C.GST_CLOCK_DONE        // (7) – The ClockID is done waiting
)

Type castings of clock returns

type ClockTime

type ClockTime C.GstClockTime
const ClockTimeNone ClockTime = 0xffffffffffffffff // Ideally this would be set to C.GST_CLOCK_TIME_NONE but this causes issues on MacOS and Windows

ClockTimeNone means infinite timeout or an empty value

func (ClockTime) AsDuration

func (ct ClockTime) AsDuration() *time.Duration

interpret the clocktime as a duration, returns nil on ClockTimeNone

func (ClockTime) AsTimestamp

func (ct ClockTime) AsTimestamp() *time.Time

interpret the clocktime as a timestamp, returns nil on ClockTimeNone

func (ClockTime) String

func (ct ClockTime) String() string

type ClockTimeDiff

type ClockTimeDiff int64

ClockTimeDiff is a datatype to hold a time difference, measured in nanoseconds.

func (ClockTimeDiff) AsDuration

func (ctd ClockTimeDiff) AsDuration() time.Duration

convinience function to convert the diff to a time.Duration

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context wraps a GstContext object.

func FromGstContextUnsafeFull

func FromGstContextUnsafeFull(ctx unsafe.Pointer) *Context

FromGstContextUnsafeFull wraps the given context and places a runtime finalizer on it.

func FromGstContextUnsafeNone

func FromGstContextUnsafeNone(ctx unsafe.Pointer) *Context

FromGstContextUnsafeNone refs and wraps the given context and places a runtime finalizer on it.

func NewContext

func NewContext(ctxType string, persistent bool) *Context

NewContext creates a new context.

// Example

ctx := gst.NewContext("test-context", false)
fmt.Println(ctx.IsPersistent())

ctx = gst.NewContext("test-context", true)
fmt.Println(ctx.IsPersistent())

// false
// true

func (*Context) GetStructure

func (c *Context) GetStructure() *Structure

GetStructure returns the structure of the context. You should not modify or unref it.

func (*Context) GetType

func (c *Context) GetType() string

GetType returns the type of the context.

// Example

ctx := gst.NewContext("test-context", false)
fmt.Println(ctx.GetType())

// test-context

func (*Context) HasContextType

func (c *Context) HasContextType(ctxType string) bool

HasContextType checks if the context has the given type.

// Example

ctx := gst.NewContext("test-context", false)
fmt.Println(ctx.HasContextType("test-context"))
fmt.Println(ctx.HasContextType("another-context"))

// true
// false

func (*Context) Instance

func (c *Context) Instance() *C.GstContext

Instance returns the underlying GstContext instance.

func (*Context) IsPersistent

func (c *Context) IsPersistent() bool

IsPersistent checks if the context is persistent.

func (*Context) IsWritable

func (c *Context) IsWritable() bool

IsWritable returns true if the context is writable.

func (*Context) MakeWritable

func (c *Context) MakeWritable() *Context

MakeWritable returns a writable version of the context.

func (*Context) Ref

func (c *Context) Ref() *Context

Ref increases the ref count on the Context.

func (*Context) Unref

func (c *Context) Unref()

Unref decreases the ref count on the Context.

func (*Context) WritableStructure

func (c *Context) WritableStructure() *Structure

WritableStructure returns a writable version of the structure. You should still not unref it.

type ControlBinding

type ControlBinding struct{ *Object }

func (*ControlBinding) Instance

func (cb *ControlBinding) Instance() *C.GstControlBinding

type DebugCategory

type DebugCategory struct {
	// contains filtered or unexported fields
}

DebugCategory is a struct that describes a category of log messages.

var CAT *DebugCategory

CAT is the global DebugCategory used for logging from the bindings. It is okay to use it from applications, but plugins should use their own.

func NewDebugCategory

func NewDebugCategory(name string, color DebugColorFlags, description string) *DebugCategory

NewDebugCategory initializes a new DebugCategory with the given properties and set to the default threshold.

func (*DebugCategory) GetName

func (d *DebugCategory) GetName() string

GetName returns the name of a debug category.

func (*DebugCategory) Log

func (d *DebugCategory) Log(level DebugLevel, message string, obj ...*Object)

Log logs the given message using the currently registered debugging handlers. You can optionally provide a single object to log the message for. GStreamer will automatically add a newline to the end of the message.

func (*DebugCategory) LogDebug

func (d *DebugCategory) LogDebug(message string, obj ...*Object)

LogDebug is a convenience wrapper for logging a DEBUG level message.

func (*DebugCategory) LogError

func (d *DebugCategory) LogError(message string, obj ...*Object)

LogError is a convenience wrapper for logging an ERROR level message.

func (*DebugCategory) LogInfo

func (d *DebugCategory) LogInfo(message string, obj ...*Object)

LogInfo is a convenience wrapper for logging an INFO level message.

func (*DebugCategory) LogLog

func (d *DebugCategory) LogLog(message string, obj ...*Object)

LogLog is a convenience wrapper for logging a LOG level message.

func (*DebugCategory) LogMemDump

func (d *DebugCategory) LogMemDump(message string, obj ...*Object)

LogMemDump is a convenience wrapper for logging a MEMDUMP level message.

func (*DebugCategory) LogTrace

func (d *DebugCategory) LogTrace(message string, obj ...*Object)

LogTrace is a convenience wrapper for logging a TRACE level message.

func (*DebugCategory) LogWarning

func (d *DebugCategory) LogWarning(message string, obj ...*Object)

LogWarning is a convenience wrapper for logging a WARNING level message.

type DebugColorFlags

type DebugColorFlags int

DebugColorFlags are terminal style flags you can use when creating your debugging categories to make them stand out in debugging output.

const (
	DebugColorNone      DebugColorFlags = 0                      // (0) - No color
	DebugColorFgBlack   DebugColorFlags = C.GST_DEBUG_FG_BLACK   // (0) – Use black as foreground color.
	DebugColorFgRed     DebugColorFlags = C.GST_DEBUG_FG_RED     // (1) – Use red as foreground color.
	DebugColorFgGreen   DebugColorFlags = C.GST_DEBUG_FG_GREEN   // (2) – Use green as foreground color.
	DebugColorFgYellow  DebugColorFlags = C.GST_DEBUG_FG_YELLOW  // (3) – Use yellow as foreground color.
	DebugColorFgBlue    DebugColorFlags = C.GST_DEBUG_FG_BLUE    // (4) – Use blue as foreground color.
	DebugColorFgMagenta DebugColorFlags = C.GST_DEBUG_FG_MAGENTA // (5) – Use magenta as foreground color.
	DebugColorFgCyan    DebugColorFlags = C.GST_DEBUG_FG_CYAN    // (6) – Use cyan as foreground color.
	DebugColorFgWhite   DebugColorFlags = C.GST_DEBUG_FG_WHITE   // (7) – Use white as foreground color.
	DebugColorBgBlack   DebugColorFlags = C.GST_DEBUG_BG_BLACK   // (0) – Use black as background color.
	DebugColorBgRed     DebugColorFlags = C.GST_DEBUG_BG_RED     // (16) – Use red as background color.
	DebugColorBgGreen   DebugColorFlags = C.GST_DEBUG_BG_GREEN   // (32) – Use green as background color.
	DebugColorBgYellow  DebugColorFlags = C.GST_DEBUG_BG_YELLOW  // (48) – Use yellow as background color.
	DebugColorBgBlue    DebugColorFlags = C.GST_DEBUG_BG_BLUE    // (64) – Use blue as background color.
	DebugColorBgMagenta DebugColorFlags = C.GST_DEBUG_BG_MAGENTA // (80) – Use magenta as background color.
	DebugColorBgCyan    DebugColorFlags = C.GST_DEBUG_BG_CYAN    // (96) – Use cyan as background color.
	DebugColorBgWhite   DebugColorFlags = C.GST_DEBUG_BG_WHITE   // (112) – Use white as background color.
	DebugColorBold      DebugColorFlags = C.GST_DEBUG_BOLD       // (256) – Make the output bold.
	DebugColorUnderline DebugColorFlags = C.GST_DEBUG_UNDERLINE  // (512) – Underline the output.
)

Type castings of DebugColorFlags

type DebugColorMode

type DebugColorMode int

DebugColorMode represents how to display colors.

const (
	DebugColorModeOff  DebugColorMode = C.GST_DEBUG_COLOR_MODE_OFF  // (0) – Do not use colors in logs.
	DebugColorModeOn   DebugColorMode = C.GST_DEBUG_COLOR_MODE_ON   // (1) – Paint logs in a platform-specific way.
	DebugColorModeUnix DebugColorMode = C.GST_DEBUG_COLOR_MODE_UNIX // (2) – Paint logs with UNIX terminal color codes no matter what platform GStreamer is running on.
)

Type castings of DebugColorModes

type DebugGraphDetails

type DebugGraphDetails int

DebugGraphDetails casts GstDebugGraphDetails

const (
	DebugGraphShowMediaType        DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE         // (1) – show caps-name on edges
	DebugGraphShowCapsDetails      DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS       // (2) – show caps-details on edges
	DebugGraphShowNonDefaultParams DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS // (4) – show modified parameters on elements
	DebugGraphShowStates           DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_STATES             // (8) – show element states
	DebugGraphShowPullParams       DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_FULL_PARAMS        // (16) – show full element parameter values even if they are very long
	DebugGraphShowAll              DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_ALL                // (15) – show all the typical details that one might want
	DebugGraphShowVerbose          DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_VERBOSE            // (4294967295) – show all details regardless of how large or verbose they make the resulting output
)

Type castings

type DebugLevel

type DebugLevel int

DebugLevel defines the importance of a debugging message. The more important a message is, the greater the probability that the debugging system outputs it.

const (
	LevelNone    DebugLevel = C.GST_LEVEL_NONE    // (0) – No debugging level specified or desired. Used to deactivate debugging output.
	LevelError   DebugLevel = C.GST_LEVEL_ERROR   // (1) – Error messages are to be used only when an error occurred that stops the application from keeping working correctly. An examples is gst_element_error, which outputs a message with this priority. It does not mean that the application is terminating as with g_error.
	LevelWarning DebugLevel = C.GST_LEVEL_WARNING // (2) – Warning messages are to inform about abnormal behavior that could lead to problems or weird behavior later on. An example of this would be clocking issues ("your computer is pretty slow") or broken input data ("Can't synchronize to stream.")
	LevelFixMe   DebugLevel = C.GST_LEVEL_FIXME   // (3) – Fixme messages are messages that indicate that something in the executed code path is not fully implemented or handled yet. Note that this does not replace proper error handling in any way, the purpose of this message is to make it easier to spot incomplete/unfinished pieces of code when reading the debug log.
	LevelInfo    DebugLevel = C.GST_LEVEL_INFO    // (4) – Informational messages should be used to keep the developer updated about what is happening. Examples where this should be used are when a typefind function has successfully determined the type of the stream or when an mp3 plugin detects the format to be used. ("This file has mono sound.")
	LevelDebug   DebugLevel = C.GST_LEVEL_DEBUG   // (5) – Debugging messages should be used when something common happens that is not the expected default behavior, or something that's useful to know but doesn't happen all the time (ie. per loop iteration or buffer processed or event handled). An example would be notifications about state changes or receiving/sending of events.
	LevelLog     DebugLevel = C.GST_LEVEL_LOG     // (6) – Log messages are messages that are very common but might be useful to know. As a rule of thumb a pipeline that is running as expected should never output anything else but LOG messages whilst processing data. Use this log level to log recurring information in chain functions and loop functions, for example.
	LevelTrace   DebugLevel = C.GST_LEVEL_TRACE   // (7) – Tracing-related messages. Examples for this are referencing/dereferencing of objects.
	LevelMemDump DebugLevel = C.GST_LEVEL_MEMDUMP // (9) – memory dump messages are used to log (small) chunks of data as memory dumps in the log. They will be displayed as hexdump with ASCII characters.
)

Type castings of DebugLevels

type DebugMessage

type DebugMessage struct {
	// contains filtered or unexported fields
}

func (*DebugMessage) Get

func (d *DebugMessage) Get() string

Get returns the string representation of a GstDebugMessage.

func (*DebugMessage) GetId

func (d *DebugMessage) GetId() string

GetId returns the id of the object that emitted this message. Can be empty.

type Device

type Device struct{ *Object }

Device is a Go representation of a GstDevice.

func FromGstDeviceUnsafeFull

func FromGstDeviceUnsafeFull(device unsafe.Pointer) *Device

FromGstDeviceUnsafeFull wraps the given device with a finalizer.

func FromGstDeviceUnsafeNone

func FromGstDeviceUnsafeNone(device unsafe.Pointer) *Device

FromGstDeviceUnsafeNone wraps the given device with a ref and finalizer.

func (*Device) CreateElement

func (d *Device) CreateElement(name string) *Element

CreateElement creates a new element with all the required parameters set to use this device. If name is empty, one is automatically generated.

func (*Device) GetCaps

func (d *Device) GetCaps() *Caps

GetCaps returns the caps that this device supports.

func (*Device) GetDeviceClass

func (d *Device) GetDeviceClass() string

GetDeviceClass gets the "class" of a device. This is a "/" separated list of classes that represent this device. They are a subset of the classes of the GstDeviceProvider that produced this device.

func (*Device) GetDisplayName

func (d *Device) GetDisplayName() string

GetDisplayName gets the user-friendly name of the device.

func (*Device) GetProperties

func (d *Device) GetProperties() *Structure

GetProperties gets the extra properties of the device.

func (*Device) HasClasses

func (d *Device) HasClasses(classes []string) bool

HasClasses checks if device matches all of the given classes.

func (*Device) Instance

func (d *Device) Instance() *C.GstDevice

Instance returns the underlying GstDevice object.

func (*Device) ReconfigureElement

func (d *Device) ReconfigureElement(elem *Element) error

ReconfigureElement tries to reconfigure an existing element to use the device. If this function fails, then one must destroy the element and create a new one using Device.CreateElement().

Note: This should only be implemented for elements that can change their device while in the PLAYING state.

type DeviceMonitor

type DeviceMonitor struct {
	// contains filtered or unexported fields
}

DeviceMonitor is a Go representation of a GstDeviceMonitor.

func NewDeviceMonitor

func NewDeviceMonitor() *DeviceMonitor

func (*DeviceMonitor) AddFilter

func (d *DeviceMonitor) AddFilter(classes string, caps *Caps) uint

func (*DeviceMonitor) GetBus

func (d *DeviceMonitor) GetBus() *Bus

GetBus returns the message bus for this pipeline.

func (*DeviceMonitor) GetDevices

func (d *DeviceMonitor) GetDevices() []*Device

func (*DeviceMonitor) GetShowAllDevices

func (d *DeviceMonitor) GetShowAllDevices() bool

func (*DeviceMonitor) RemoveFilter

func (d *DeviceMonitor) RemoveFilter(filterId uint) bool

func (*DeviceMonitor) SetShowAllDevices

func (d *DeviceMonitor) SetShowAllDevices(show bool)

func (*DeviceMonitor) Start

func (d *DeviceMonitor) Start() bool

func (*DeviceMonitor) Stop

func (d *DeviceMonitor) Stop()

type DeviceProvider

type DeviceProvider struct{ *Object }

DeviceProvider is a Go representation of a GstDeviceProvider.

func FindDeviceProviderByName

func FindDeviceProviderByName(factoryName string) *DeviceProvider

func FromGstDeviceProviderUnsafeFull

func FromGstDeviceProviderUnsafeFull(deviceProvider unsafe.Pointer) *DeviceProvider

FromGstDeviceProviderUnsafeFull wraps the given device with a finalizer.

func FromGstDeviceProviderUnsafeNone

func FromGstDeviceProviderUnsafeNone(deviceProvider unsafe.Pointer) *DeviceProvider

FromGstDeviceProviderUnsafeNone wraps the given device with a ref and finalizer.

func (*DeviceProvider) GetBus

func (d *DeviceProvider) GetBus() *Bus

GetBus returns the message bus for this pipeline.

func (*DeviceProvider) GetDevices

func (d *DeviceProvider) GetDevices() []*Device

func (*DeviceProvider) Instance

func (d *DeviceProvider) Instance() *C.GstDeviceProvider

Instance returns the underlying GstDevice object.

func (*DeviceProvider) Start

func (d *DeviceProvider) Start() bool

func (*DeviceProvider) Stop

func (d *DeviceProvider) Stop()

type DirectControlBinding

type DirectControlBinding struct{ ControlBinding }

func NewDirectControlBinding

func NewDirectControlBinding(obj *Object, prop string, csource *InterpolationControlSource) *DirectControlBinding

type Domain

type Domain string

Domain represents the different types of error domains.

const (
	DomainCore     Domain = "CORE"
	DomainLibrary  Domain = "LIBRARY"
	DomainResource Domain = "RESOURCE"
	DomainStream   Domain = "STREAM"
)

ErrorDomain castings

type Element

type Element struct{ *Object }

Element is a Go wrapper around a GstElement.

func FromGstElementUnsafeFull

func FromGstElementUnsafeFull(elem unsafe.Pointer) *Element

FromGstElementUnsafeFull wraps the given element with a finalizer.

func FromGstElementUnsafeNone

func FromGstElementUnsafeNone(elem unsafe.Pointer) *Element

FromGstElementUnsafeNone wraps the given element with a ref and a finalizer.

func NewElement

func NewElement(factory string) (*Element, error)

NewElement creates a new element using the factory of the given name.

func NewElementMany

func NewElementMany(elemNames ...string) ([]*Element, error)

NewElementMany is a convenience wrapper around building many GstElements in a single function call. It returns an error if the creation of any element fails. A slice in the order the names were given is returned.

func NewElementWithName

func NewElementWithName(factory string, name string) (*Element, error)

NewElementWithName creates a new element and sets it's name to the given value.

func NewElementWithProperties

func NewElementWithProperties(factory string, properties map[string]interface{}) (*Element, error)

Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction.

this function is needed for gstreamer props that have the "Construct Only" flag, e.g.: https://gstreamer.freedesktop.org/documentation/audio/gstaudioaggregator.html?gi-language=c#GstAudioAggregator:force-live

func ToElement

func ToElement(obj interface{}) *Element

ToElement returns an Element object for the given Object. It will work on either gst.Object or glib.Object interfaces.

func (*Element) AbortState

func (e *Element) AbortState()

AbortState aborts the state change of the element. This function is used by elements that do asynchronous state changes and find out something is wrong.

func (*Element) AddPad

func (e *Element) AddPad(pad *Pad) bool

AddPad adds a pad (link point) to element. pad's parent will be set to element

Pads are automatically activated when added in the PAUSED or PLAYING state.

The pad and the element should be unlocked when calling this function.

This function will emit the pad-added signal on the element.

func (*Element) BlockSetState

func (e *Element) BlockSetState(state State) error

BlockSetState is a convinience wrapper function for calling SetState and an infinitely blocking GetState

func (*Element) CallAsync

func (e *Element) CallAsync(f func())

CallAsync calls f from another thread. This is to be used for cases when a state change has to be performed from a streaming thread, directly via SetState or indirectly e.g. via SEEK events.

Calling those functions directly from the streaming thread will cause deadlocks in many situations, as they might involve waiting for the streaming thread to shut down from this very streaming thread.

func (*Element) ChangeState

func (e *Element) ChangeState(transition StateChange) StateChangeReturn

ChangeState performs the given transition on this element.

func (*Element) Connect

func (e *Element) Connect(signal string, f interface{}) (glib.SignalHandle, error)

Connect connects to the given signal on this element, and applies f as the callback. The callback must match the signature of the expected callback from the documentation. However, instead of specifying C types for arguments specify the go-gst equivalent (e.g. *gst.Element for almost all GstElement derivatives).

This and the Emit() method may get moved down the hierarchy to the Object level at some point, since

func (*Element) ContinueState

func (e *Element) ContinueState(ret StateChangeReturn) StateChangeReturn

ContinueState commits the state change of the element and proceed to the next pending state if any. This function is used by elements that do asynchronous state changes. The core will normally call this method automatically when an element returned GST_STATE_CHANGE_SUCCESS from the state change function.

If after calling this method the element still has not reached the pending state, the next state change is performed.

This method is used internally and should normally not be called by plugins or applications.

This function must be called with STATE_LOCK held.

func (*Element) Emit

func (e *Element) Emit(signal string, args ...interface{}) (interface{}, error)

Emit is a wrapper around g_signal_emitv() and emits the signal specified by the string s to an Object. This means that it performs identically to g_signal_emit_by_name. Arguments to callback functions connected to this signal must be specified in args. Emit() returns an interface{} which contains the go equivalent of the C return value.

Make sure that the Types are known to go-glib. Special types need to be registered with RegisterGValueMarshalers before calling Emit. Sub libraries of go-gst (sdp, rtp, webrtc, base, etc.) register their types when they are imported via init() functions.

func (*Element) Error

func (e *Element) Error(msg string, err error)

Error is a convenience wrapper around ErrorMessage to simply post the provided go error on the bus. The domain is assumed to be DomainLibrary and the code is assumed to be LibraryErrorFailed.

func (*Element) ErrorMessage

func (e *Element) ErrorMessage(domain Domain, code ErrorCode, text, debug string)

ErrorMessage is a convenience wrapper for posting an error message from inside an element. Only to be used from plugins.

func (*Element) GetBaseTime

func (e *Element) GetBaseTime() ClockTime

Returns the base time of the element. The base time is the absolute time of the clock when this element was last put to PLAYING. Subtracting the base time from the clock time gives the running time of the element.

func (*Element) GetBus

func (e *Element) GetBus() *Bus

GetBus returns the GstBus for retrieving messages from this element. This function returns nil unless the element is a Pipeline.

func (*Element) GetClock

func (e *Element) GetClock() *Clock

GetClock returns the Clock for this element. This is the clock as was last set with gst_element_set_clock. Elements in a pipeline will only have their clock set when the pipeline is in the PLAYING state.

func (*Element) GetCurrentState

func (e *Element) GetCurrentState() State

this returns the value of the `current_state` member of the element:

the current state of an element

see https://gstreamer.freedesktop.org/documentation/gstreamer/gstelement.html?gi-language=c#members

func (*Element) GetFactory

func (e *Element) GetFactory() *ElementFactory

GetFactory returns the factory that created this element. No refcounting is needed.

func (*Element) GetPadTemplates

func (e *Element) GetPadTemplates() []*PadTemplate

GetPadTemplates retrieves a list of the pad templates associated with this element. The list must not be modified by the calling code.

func (*Element) GetPads

func (e *Element) GetPads() ([]*Pad, error)

GetPads retrieves a list of pads associated with the element.

func (*Element) GetRequestPad

func (e *Element) GetRequestPad(name string) *Pad

GetRequestPad gets a request pad from the element based on the name of the pad template. Unlike static pads, request pads are not created automatically but are only created on demand For example, audiomixer has sink template, 'sink_%u', which is used for creating multiple sink pads on demand so that it performs mixing of audio streams by linking multiple upstream elements on it's sink pads created on demand. This returns the request pad created on demand. Otherwise, it returns null if failed to create.

func (*Element) GetSinkPads

func (e *Element) GetSinkPads() ([]*Pad, error)

GetSinkPads retrieves a list of sink pads associated with the element.

func (*Element) GetSrcPads

func (e *Element) GetSrcPads() ([]*Pad, error)

GetSrcPads retrieves a list of src pads associated with the element.

func (*Element) GetStartTime

func (e *Element) GetStartTime() ClockTime

Returns the start time of the element. The start time is the running time of the clock when this element was last put to PAUSED. Usually the start_time is managed by a toplevel element such as GstPipeline. MT safe.

func (*Element) GetState

func (e *Element) GetState(state State, timeout ClockTime) (StateChangeReturn, State)

Gets the state of the element.

For elements that performed an ASYNC state change, as reported by gst_element_set_state, this function will block up to the specified timeout value for the state change to complete. If the element completes the state change or goes into an error, this function returns immediately with a return value of GST_STATE_CHANGE_SUCCESS or GST_STATE_CHANGE_FAILURE respectively.

For elements that did not return GST_STATE_CHANGE_ASYNC, this function returns the current and pending state immediately.

This function returns GST_STATE_CHANGE_NO_PREROLL if the element successfully changed its state but is not able to provide data yet. This mostly happens for live sources that only produce data in GST_STATE_PLAYING. While the state change return is equivalent to GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that some sink elements might not be able to complete their state change because an element is not producing data to complete the preroll. When setting the element to playing, the preroll will complete and playback will start.

func (*Element) GetStaticPad

func (e *Element) GetStaticPad(name string) *Pad

GetStaticPad retrieves a pad from element by name. This version only retrieves already-existing (i.e. 'static') pads.

func (*Element) Has

func (e *Element) Has(flags ElementFlags) bool

Has returns true if this element has the given flags.

func (*Element) InfoMessage

func (e *Element) InfoMessage(domain Domain, text string)

InfoMessage is a convenience wrapper for posting an info message from inside an element. Only to be used from plugins.

func (*Element) Instance

func (e *Element) Instance() *C.GstElement

Instance returns the underlying GstElement instance.

func (*Element) IsURIHandler

func (e *Element) IsURIHandler() bool

IsURIHandler returns true if this element can handle URIs.

func (e *Element) Link(elem *Element) error

Link wraps gst_element_link and links this element to the given one.

func (*Element) LinkFiltered

func (e *Element) LinkFiltered(elem *Element, filter *Caps) error

LinkFiltered wraps gst_element_link_filtered and link this element to the given one using the provided sink caps.

func (*Element) MessageFull

func (e *Element) MessageFull(msgType MessageType, domain Domain, code ErrorCode, text, debug, file, function string, line int)

MessageFull will post an error, warning, or info message on the bus from inside an element. Only to be used from plugins.

func (*Element) ParentChangeState

func (e *Element) ParentChangeState(transition StateChange) StateChangeReturn

ParentChangeState can be used when extending an element to chain up to the parents ChangeState handler.

func (*Element) ParentPostMessage

func (e *Element) ParentPostMessage(msg *Message) bool

ParentPostMessage can be used when extending an element. During a PostMessage, use this method to have the message posted on the bus after processing.

func (*Element) ParentSendEvent added in v1.3.4

func (e *Element) ParentSendEvent(event *Event) bool

ParentSendEvent chains up to the parent SendEvent handler. send_event takes ownership of the incoming event pointer so we have to ref it beforehand in order not to mess up go's gc

func (*Element) Query

func (e *Element) Query(q *Query) bool

Query performs a query on the given element.

For elements that don't implement a query handler, this function forwards the query to a random srcpad or to the peer of a random linked sinkpad of this element.

Please note that some queries might need a running pipeline to work.

func (*Element) QueryConvert

func (e *Element) QueryConvert(srcFormat Format, srcValue int64, destFormat Format) (bool, int64)

QueryConvert queries an element to convert src_val in src_format to dest_format.

func (*Element) QueryDuration

func (e *Element) QueryDuration(format Format) (bool, int64)

QueryDuration queries an element (usually top-level pipeline or playbin element) for the total stream duration in nanoseconds. This query will only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application will receive an ASYNC_DONE message on the pipeline bus when that is the case.

If the duration changes for some reason, you will get a DURATION_CHANGED message on the pipeline bus, in which case you should re-query the duration using this function.

func (*Element) QueryPosition

func (e *Element) QueryPosition(format Format) (bool, int64)

QueryPosition queries an element (usually top-level pipeline or playbin element) for the stream position in nanoseconds. This will be a value between 0 and the stream duration (if the stream duration is known). This query will usually only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application will receive an ASYNC_DONE message on the pipeline bus when that is the case.

func (*Element) ReleaseRequestPad

func (e *Element) ReleaseRequestPad(pad *Pad)

ReleaseRequestPad releases request pad

func (*Element) RemovePad

func (e *Element) RemovePad(pad *Pad) bool

RemovePad removes pad from element. pad will be destroyed if it has not been referenced elsewhere using gst_object_unparent.

This function is used by plugin developers and should not be used by applications. Pads that were dynamically requested from elements with gst_element_request_pad should be released with the gst_element_release_request_pad function instead.

Pads are not automatically deactivated so elements should perform the needed steps to deactivate the pad in case this pad is removed in the PAUSED or PLAYING state. See gst_pad_set_active for more information about deactivating pads.

The pad and the element should be unlocked when calling this function.

This function will emit the pad-removed signal on the element.

func (*Element) SeekDefault

func (e *Element) SeekDefault(position int64, flag SeekFlags) bool

SeekDefault seeks to the given position in the stream. The position is the frame number for video, or sample for audio. The element should be in the PAUSED or PLAYING state and must be a seekable.

func (*Element) SeekSimple

func (e *Element) SeekSimple(position int64, format Format, flag SeekFlags) bool

SeekSimple seeks to the given position in the stream. The element / pipeline should be in the PAUSED or PLAYING state and must be a seekable.

func (*Element) SeekTime

func (e *Element) SeekTime(position time.Duration, flag SeekFlags) bool

SeekTime seeks to the given position time in the stream. The element / pipeline should be in the PAUSED or PLAYING state and must be a seekable.

For example, to seek to 40th second of the stream, use:

pos := int64(time.Duration(40 * time.Second))
element.SeekTime(pos, gst.FormatTime, gst.SeekFlagFlush)

to perform a flush seek to the nearest keyframe before the given position.

func (*Element) SendEvent

func (e *Element) SendEvent(ev *Event) bool

SendEvent sends an event to an element. If the element doesn't implement an event handler, the event will be pushed on a random linked sink pad for downstream events or a random linked source pad for upstream events.

This function takes ownership of the provided event so you should gst_event_ref it if you want to reuse the event after this call.

func (*Element) SetBaseTime

func (e *Element) SetBaseTime(startTime ClockTime)

Set the base time of an element. The base time is the absolute time of the clock when this element was last put to PLAYING. Subtracting the base time from the clock time gives the running time of the element.

func (*Element) SetStartTime

func (e *Element) SetStartTime(startTime ClockTime)

Set the start time of an element. The start time of the element is the running time of the element when it last went to the PAUSED state. In READY or after a flushing seek, it is set to 0.

Toplevel elements like GstPipeline will manage the start_time and base_time on its children. Setting the start_time to GST_CLOCK_TIME_NONE on such a toplevel element will disable the distribution of the base_time to the children and can be useful if the application manages the base_time itself, for example if you want to synchronize capture from multiple pipelines, and you can also ensure that the pipelines have the same clock.

MT safe.

func (*Element) SetState

func (e *Element) SetState(state State) error

SetState sets the target state for this element.

func (*Element) SyncStateWithParent

func (e *Element) SyncStateWithParent() bool

SyncStateWithParent tries to change the state of the element to the same as its parent. If this function returns FALSE, the state of element is undefined.

func (*Element) TOCSetter

func (e *Element) TOCSetter() TOCSetter

TOCSetter returns a TOCSetter interface if implemented by this element. Otherwise it returns nil. Currently this only supports elements built through this package, however, inner application elements could still use the interface as a reference implementation.

func (*Element) TagSetter

func (e *Element) TagSetter() TagSetter

TagSetter returns a TagSetter interface if implemented by this element. Otherwise it returns nil. This currently only supports elements built through this package's bindings, however, inner application elements can still implement the interface themselves if they want.

func (*Element) ToGValue

func (e *Element) ToGValue() (*glib.Value, error)

this prevents go pointers in cgo when setting a gst.Element to a property see (https://github.com/ArtemMartus/go-gst/issues/65) ToGValue implements glib.ValueTransformer.

func (*Element) URIHandler

func (e *Element) URIHandler() URIHandler

URIHandler returns a URIHandler interface if implemented by this element. Otherwise it returns nil. Currently this only supports elements built through this package, however, inner application elements could still use the interface as a reference implementation.

func (e *Element) Unlink(elem *Element)

func (*Element) WarningMessage

func (e *Element) WarningMessage(domain Domain, text string)

WarningMessage is a convenience wrapper for posting a warning message from inside an element. Only to be used from plugins.

type ElementClass

type ElementClass struct{ *glib.ObjectClass }

ElementClass represents the subclass of an element provided by a plugin.

func ToElementClass

func ToElementClass(klass *glib.ObjectClass) *ElementClass

ToElementClass wraps the given ObjectClass in an ElementClass instance.

func (*ElementClass) AddMetadata

func (e *ElementClass) AddMetadata(key, value string)

AddMetadata sets key with the given value in the metadata of the class.

func (*ElementClass) AddPadTemplate

func (e *ElementClass) AddPadTemplate(templ *PadTemplate)

AddPadTemplate adds a padtemplate to an element class. This is mainly used in the ClassInit functions of ObjectSubclasses. If a pad template with the same name as an already existing one is added the old one is replaced by the new one.

templ's reference count will be incremented, and any floating reference will be removed

func (*ElementClass) AddStaticPadTemplate

func (e *ElementClass) AddStaticPadTemplate(templ *PadTemplate)

AddStaticPadTemplate adds a pad template to an element class based on the pad template templ. The template is first converted to a static pad template.

This is mainly used in the ClassInit functions of element implementations. If a pad template with the same name already exists, the old one is replaced by the new one.

func (*ElementClass) GetAllPadTemplates

func (e *ElementClass) GetAllPadTemplates() []*PadTemplate

GetAllPadTemplates retrieves a slice of all the pad templates associated with this class. The list must not be modified.

func (*ElementClass) GetMetadata

func (e *ElementClass) GetMetadata(key string) string

GetMetadata retrieves the metadata associated with key in the class.

func (*ElementClass) GetPadTemplate

func (e *ElementClass) GetPadTemplate(name string) *PadTemplate

GetPadTemplate retrieves the padtemplate with the given name. If no pad template exists with the given name, nil is returned.

func (*ElementClass) Instance

func (e *ElementClass) Instance() *C.GstElementClass

Instance returns the underlying GstElementClass instance.

func (*ElementClass) SetMetadata

func (e *ElementClass) SetMetadata(longname, classification, description, author string)

SetMetadata sets the detailed information for this class.

`longname` - The english long name of the element. E.g "File Sink"

`classification` - A string describing the type of element, as an unordered list separated with slashes ('/'). E.g: "Sink/File"

`description` - Sentence describing the purpose of the element. E.g: "Write stream to a file"

`author` - Name and contact details of the author(s). Use \n to separate multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"

type ElementFactory

type ElementFactory struct{ *PluginFeature }

ElementFactory wraps the GstElementFactory

func Find

func Find(name string) *ElementFactory

Find returns the factory for the given plugin, or nil if it doesn't exist.

func (*ElementFactory) CanSinkAllCaps

func (e *ElementFactory) CanSinkAllCaps(caps *Caps) bool

CanSinkAllCaps checks if the factory can sink all possible capabilities.

func (*ElementFactory) CanSinkAnyCaps

func (e *ElementFactory) CanSinkAnyCaps(caps *Caps) bool

CanSinkAnyCaps checks if the factory can sink any possible capability.

func (*ElementFactory) CanSourceAllCaps

func (e *ElementFactory) CanSourceAllCaps(caps *Caps) bool

CanSourceAllCaps checks if the factory can src all possible capabilities.

func (*ElementFactory) CanSourceAnyCaps

func (e *ElementFactory) CanSourceAnyCaps(caps *Caps) bool

CanSourceAnyCaps checks if the factory can src any possible capability.

func (*ElementFactory) GetMetadata

func (e *ElementFactory) GetMetadata(key string) string

GetMetadata gets the metadata on this factory with key.

func (*ElementFactory) GetMetadataKeys

func (e *ElementFactory) GetMetadataKeys() []string

GetMetadataKeys gets the available keys for the metadata on this factory.

func (*ElementFactory) Instance

func (e *ElementFactory) Instance() *C.GstElementFactory

Instance returns the C GstFactory instance

type ElementFlags

type ElementFlags int

ElementFlags casts C GstElementFlags to a go type

const (
	ElementFlagLockedState  ElementFlags = C.GST_ELEMENT_FLAG_LOCKED_STATE  // (16) – ignore state changes from parent
	ElementFlagSink         ElementFlags = C.GST_ELEMENT_FLAG_SINK          // (32) – the element is a sink
	ElementFlagSource       ElementFlags = C.GST_ELEMENT_FLAG_SOURCE        // (64) – the element is a source.
	ElementFlagProvideClock ElementFlags = C.GST_ELEMENT_FLAG_PROVIDE_CLOCK // (128) – the element can provide a clock
	ElementFlagRequireClock ElementFlags = C.GST_ELEMENT_FLAG_REQUIRE_CLOCK // (256) – the element requires a clock
	ElementFlagIndexable    ElementFlags = C.GST_ELEMENT_FLAG_INDEXABLE     // (512) – the element can use an index
	ElementFlagLast         ElementFlags = C.GST_ELEMENT_FLAG_LAST          // (16384) – offset to define more flags
)

Type casting of element flags

type ElementImpl

type ElementImpl interface {
	// ChangeState is called by SetState to perform an incremental state change.
	ChangeState(*Element, StateChange) StateChangeReturn
	// GetState should return the states of the element
	GetState(self *Element, timeout time.Duration) (ret StateChangeReturn, current, pending State) // should this also be a ClockTime?
	// NoMorePads is called when there are no more pads on the element.
	NoMorePads(*Element)
	// PadAdded is called to add a pad to the element.
	PadAdded(*Element, *Pad)
	// PadRemoved is called to remove a pad from the element.
	PadRemoved(*Element, *Pad)
	// PostMessage is called when a message is posted to the element. Call Element.ParentPostMessage
	// to have it posted on the bus after processing.
	PostMessage(*Element, *Message) bool
	// ProvideClock is called to retrieve the clock provided by the element.
	ProvideClock(*Element) *Clock
	// Query is called to perform a query on the element.
	Query(*Element, *Query) bool
	// ReleasePad is called when a request pad is to be released.
	ReleasePad(*Element, *Pad)
	// RequestNewPad is called when a new pad is requested from the element.
	RequestNewPad(self *Element, templ *PadTemplate, name string, caps *Caps) *Pad
	// SendEvent is called to send an event to the element.
	SendEvent(*Element, *Event) bool
	// SetBus is called to set the Bus on the element.
	SetBus(*Element, *Bus)
	// SetClock is called to set the clock on the element.
	SetClock(*Element, *Clock) bool
	// SetContext is called to set the Context on the element.
	SetContext(*Element, *Context)
	// SetState is called to set a new state on the element.
	SetState(*Element, State) StateChangeReturn
	// StateChanged is called immediately after a new state was set.
	StateChanged(self *Element, old, new, pending State)
}

ElementImpl is an interface containing go equivalents of the virtual methods that can be overridden by a plugin extending an Element.

type ErrorCode

type ErrorCode int

ErrorCode represents GstGError codes.

const (
	CoreErrorFailed         ErrorCode = C.GST_CORE_ERROR_FAILED          // (1) – a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
	CoreErrorTooLazy        ErrorCode = C.GST_CORE_ERROR_TOO_LAZY        // (2) – do not use this except as a placeholder for deciding where to go while developing code.
	CoreErrorNotImplemented ErrorCode = C.GST_CORE_ERROR_NOT_IMPLEMENTED // (3) – use this when you do not want to implement this functionality yet.
	CoreErrorStateChange    ErrorCode = C.GST_CORE_ERROR_STATE_CHANGE    // (4) – used for state change errors.
	CoreErrorPad            ErrorCode = C.GST_CORE_ERROR_PAD             // (5) – used for pad-related errors.
	CoreErrorThread         ErrorCode = C.GST_CORE_ERROR_THREAD          // (6) – used for thread-related errors.
	CoreErrorNegotiation    ErrorCode = C.GST_CORE_ERROR_NEGOTIATION     // (7) – used for negotiation-related errors.
	CoreErrorEvent          ErrorCode = C.GST_CORE_ERROR_EVENT           // (8) – used for event-related errors.
	CoreErrorSeek           ErrorCode = C.GST_CORE_ERROR_SEEK            // (9) – used for seek-related errors.
	CoreErrorCaps           ErrorCode = C.GST_CORE_ERROR_CAPS            // (10) – used for caps-related errors.
	CoreErrorTag            ErrorCode = C.GST_CORE_ERROR_TAG             // (11) – used for negotiation-related errors.
	CoreErrorMissingPlugin  ErrorCode = C.GST_CORE_ERROR_MISSING_PLUGIN  // (12) – used if a plugin is missing.
	CoreErrorClock          ErrorCode = C.GST_CORE_ERROR_CLOCK           // (13) – used for clock related errors.
	CoreErrorDisabled       ErrorCode = C.GST_CORE_ERROR_DISABLED        // (14) – used if functionality has been disabled at compile time.
)

Type castings of CoreErrors

const (
	LibraryErrorFailed   ErrorCode = C.GST_LIBRARY_ERROR_FAILED   // (1) – a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
	LibraryErrorTooLazy  ErrorCode = C.GST_LIBRARY_ERROR_TOO_LAZY // (2) – do not use this except as a placeholder for deciding where to go while developing code.
	LibraryErrorInit     ErrorCode = C.GST_LIBRARY_ERROR_INIT     // (3) – used when the library could not be opened.
	LibraryErrorShutdown ErrorCode = C.GST_LIBRARY_ERROR_SHUTDOWN // (4) – used when the library could not be closed.
	LibraryErrorSettings ErrorCode = C.GST_LIBRARY_ERROR_SETTINGS // (5) – used when the library doesn't accept settings.
	LibraryErrorEncode   ErrorCode = C.GST_LIBRARY_ERROR_ENCODE   // (6) – used when the library generated an encoding error.
)

Type castings for LibraryErrors

const (
	ResourceErrorFailed        ErrorCode = C.GST_RESOURCE_ERROR_FAILED          // (1) – a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
	ResourceErrorTooLazy       ErrorCode = C.GST_RESOURCE_ERROR_TOO_LAZY        // (2) – do not use this except as a placeholder for deciding where to go while developing code.
	ResourceErrorNotFound      ErrorCode = C.GST_RESOURCE_ERROR_NOT_FOUND       // (3) – used when the resource could not be found.
	ResourceErrorBusy          ErrorCode = C.GST_RESOURCE_ERROR_BUSY            // (4) – used when resource is busy.
	ResourceErrorOpenRead      ErrorCode = C.GST_RESOURCE_ERROR_OPEN_READ       // (5) – used when resource fails to open for reading.
	ResourceErrorOpenWrite     ErrorCode = C.GST_RESOURCE_ERROR_OPEN_WRITE      // (6) – used when resource fails to open for writing.
	ResourceErrorOpenReadWrite ErrorCode = C.GST_RESOURCE_ERROR_OPEN_READ_WRITE // (7) – used when resource cannot be opened for both reading and writing, or either (but unspecified which).
	ResourceErrorClose         ErrorCode = C.GST_RESOURCE_ERROR_CLOSE           // (8) – used when the resource can't be closed.
	ResourceErrorRead          ErrorCode = C.GST_RESOURCE_ERROR_READ            // (9) – used when the resource can't be read from.
	ResourceErrorWrite         ErrorCode = C.GST_RESOURCE_ERROR_WRITE           // (10) – used when the resource can't be written to.
	ResourceErrorSeek          ErrorCode = C.GST_RESOURCE_ERROR_SEEK            // (11) – used when a seek on the resource fails.
	ResourceErrorSync          ErrorCode = C.GST_RESOURCE_ERROR_SYNC            // (12) – used when a synchronize on the resource fails.
	ResourceErrorSettings      ErrorCode = C.GST_RESOURCE_ERROR_SETTINGS        // (13) – used when settings can't be manipulated on.
	ResourceErrorNoSpaceLeft   ErrorCode = C.GST_RESOURCE_ERROR_NO_SPACE_LEFT   // (14) – used when the resource has no space left.
	ResourceErrorNotAuthorized ErrorCode = C.GST_RESOURCE_ERROR_NOT_AUTHORIZED  // (15) – used when the resource can't be opened due to missing authorization. (Since: 1.2.4)
)

Type castings for ResourceErrors

const (
	StreamErrorFailed         ErrorCode = C.GST_STREAM_ERROR_FAILED          // (1) – a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
	StreamErrorTooLazy        ErrorCode = C.GST_STREAM_ERROR_TOO_LAZY        // (2) – do not use this except as a placeholder for deciding where to go while developing code.
	StreamErrorNotImplemented ErrorCode = C.GST_STREAM_ERROR_NOT_IMPLEMENTED // (3) – use this when you do not want to implement this functionality yet.
	StreamErrorTypeNotFound   ErrorCode = C.GST_STREAM_ERROR_TYPE_NOT_FOUND  // (4) – used when the element doesn't know the stream's type.
	StreamErrorWrongType      ErrorCode = C.GST_STREAM_ERROR_WRONG_TYPE      // (5) – used when the element doesn't handle this type of stream.
	StreamErrorCodecNotFound  ErrorCode = C.GST_STREAM_ERROR_CODEC_NOT_FOUND // (6) – used when there's no codec to handle the stream's type.
	StreamErrorDecode         ErrorCode = C.GST_STREAM_ERROR_DECODE          // (7) – used when decoding fails.
	StreamErrorEncode         ErrorCode = C.GST_STREAM_ERROR_ENCODE          // (8) – used when encoding fails.
	StreamErrorDemux          ErrorCode = C.GST_STREAM_ERROR_DEMUX           // (9) – used when demuxing fails.
	StreamErrorMux            ErrorCode = C.GST_STREAM_ERROR_MUX             // (10) – used when muxing fails.
	StreamErrorFormat         ErrorCode = C.GST_STREAM_ERROR_FORMAT          // (11) – used when the stream is of the wrong format (for example, wrong caps).
	StreamErrorDecrypt        ErrorCode = C.GST_STREAM_ERROR_DECRYPT         // (12) – used when the stream is encrypted and can't be decrypted because this is not supported by the element.
	StreamErrorDecryptNoKey   ErrorCode = C.GST_STREAM_ERROR_DECRYPT_NOKEY   // (13) – used when the stream is encrypted and can't be decrypted because no suitable key is available.
)

Type castings for StreamErrors

type Event

type Event struct {
	// contains filtered or unexported fields
}

Event is a go wrapper around a GstEvent.

func FromGstEventUnsafeFull

func FromGstEventUnsafeFull(ev unsafe.Pointer) *Event

FromGstEventUnsafeFull wraps the pointer to the given C GstEvent without taking a ref. A finalizer is applied.

func FromGstEventUnsafeNone

func FromGstEventUnsafeNone(ev unsafe.Pointer) *Event

FromGstEventUnsafeNone wraps the pointer to the given C GstEvent with the go type. A ref is taken and finalizer applied.

func NewBufferSizeEvent

func NewBufferSizeEvent(format Format, minSize, maxSize int64, async bool) *Event

NewBufferSizeEvent creates a new buffersize event. The event is sent downstream and notifies elements that they should provide a buffer of the specified dimensions.

When the async flag is set, a thread boundary is preferred.

func NewCapsEvent

func NewCapsEvent(caps *Caps) *Event

NewCapsEvent creates a new CAPS event for caps. The caps event can only travel downstream synchronized with the buffer flow and contains the format of the buffers that will follow after the event.

func NewCustomEvent

func NewCustomEvent(eventType EventType, structure *Structure) *Event

NewCustomEvent creates a new custom-typed event. This can be used for anything not handled by other event-specific functions to pass an event to another element.

func NewEOSEvent

func NewEOSEvent() *Event

NewEOSEvent creates a new EOS event. The eos event can only travel downstream synchronized with the buffer flow. Elements that receive the EOS event on a pad can return FlowEOS as a FlowReturn when data after the EOS event arrives.

The EOS event will travel down to the sink elements in the pipeline which will then post the MessageEOS on the bus after they have finished playing any buffered data.

When all sinks have posted an EOS message, an EOS message is forwarded to the application.

The EOS event itself will not cause any state transitions of the pipeline.

func NewFlushStartEvent

func NewFlushStartEvent() *Event

NewFlushStartEvent allocates a new flush start event. The flush start event can be sent upstream and downstream and travels out-of-bounds with the dataflow.

It marks pads as being flushing and will make them return FlowFlushing when used for data flow with gst_pad_push, gst_pad_chain, gst_pad_get_range and gst_pad_pull_range. Any event (except a EventFlushSStop) received on a flushing pad will return FALSE immediately.

Elements should unlock any blocking functions and exit their streaming functions as fast as possible when this event is received.

This event is typically generated after a seek to flush out all queued data in the pipeline so that the new media is played as soon as possible.

func NewFlushStopEvent

func NewFlushStopEvent(resetTime bool) *Event

NewFlushStopEvent allocates a new flush stop event. The flush stop event can be sent upstream and downstream and travels serialized with the dataflow. It is typically sent after sending a FLUSH_START event to make the pads accept data again.

Elements can process this event synchronized with the dataflow since the preceding FLUSH_START event stopped the dataflow.

This event is typically generated to complete a seek and to resume dataflow.

func NewGapEvent

func NewGapEvent(timestamp, duration ClockTime) *Event

NewGapEvent creates a new GAP event. A gap event can be thought of as conceptually equivalent to a buffer to signal that there is no data for a certain amount of time. This is useful to signal a gap to downstream elements which may wait for data, such as muxers or mixers or overlays, especially for sparse streams such as subtitle streams.

func NewLatencyEvent

func NewLatencyEvent(latency ClockTime) *Event

NewLatencyEvent creates a new latency event. The event is sent upstream from the sinks and notifies elements that they should add an additional latency to the running time before synchronizing against the clock.

The latency is mostly used in live sinks and is always expressed in the time format.

func NewNavigationEvent

func NewNavigationEvent(structure *Structure) *Event

NewNavigationEvent creates a new navigation event from the given description. The event will take ownership of the structure.

func NewProtectionEvent

func NewProtectionEvent(systemID string, buffer *Buffer, origin string) *Event

NewProtectionEvent creates a new event containing information specific to a particular protection system (uniquely identified by system_id), by which that protection system can acquire key(s) to decrypt a protected stream.

In order for a decryption element to decrypt media protected using a specific system, it first needs all the protection system specific information necessary to acquire the decryption key(s) for that stream. The functions defined here enable this information to be passed in events from elements that extract it (e.g., ISOBMFF demuxers, MPEG DASH demuxers) to protection decrypter elements that use it.

Events containing protection system specific information are created using NewProtectionEvent, and they can be parsed by downstream elements using ParseProtection.

In Common Encryption, protection system specific information may be located within ISOBMFF files, both in movie (moov) boxes and movie fragment (moof) boxes; it may also be contained in ContentProtection elements within MPEG DASH MPDs. The events created by gst_event_new_protection contain data identifying from which of these locations the encapsulated protection system specific information originated. This origin information is required as some protection systems use different encodings depending upon where the information originates.

The events returned by NewProtectionEvent are implemented in such a way as to ensure that the most recently-pushed protection info event of a particular origin and system_id will be stuck to the output pad of the sending element.

func NewQOSEvent

func NewQOSEvent(qType QOSType, proportion float64, diff ClockTimeDiff, timestamp ClockTime) *Event

NewQOSEvent allocates a new qos event with the given values. The QOS event is generated in an element that wants an upstream element to either reduce or increase its rate because of high/low CPU load or other resource usage such as network performance or throttling. Typically sinks generate these events for each buffer they receive.

Type indicates the reason for the QoS event. GST_QOS_TYPE_OVERFLOW is used when a buffer arrived in time or when the sink cannot keep up with the upstream datarate. GST_QOS_TYPE_UNDERFLOW is when the sink is not receiving buffers fast enough and thus has to drop late buffers. GST_QOS_TYPE_THROTTLE is used when the datarate is artificially limited by the application, for example to reduce power consumption.

Proportion indicates the real-time performance of the streaming in the element that generated the QoS event (usually the sink). The value is generally computed based on more long term statistics about the streams timestamps compared to the clock. A value < 1.0 indicates that the upstream element is producing data faster than real-time. A value > 1.0 indicates that the upstream element is not producing data fast enough. 1.0 is the ideal proportion value. The proportion value can safely be used to lower or increase the quality of the element.

Diff is the difference against the clock in running time of the last buffer that caused the element to generate the QOS event. A negative value means that the buffer with timestamp arrived in time. A positive value indicates how late the buffer with timestamp was. When throttling is enabled, diff will be set to the requested throttling interval.

Timestamp is the timestamp of the last buffer that cause the element to generate the QOS event. It is expressed in running time and thus an ever increasing value.

The upstream element can use the diff and timestamp values to decide whether to process more buffers. For positive diff, all buffers with timestamp <= timestamp + diff will certainly arrive late in the sink as well. A (negative) diff value so that timestamp + diff would yield a result smaller than 0 is not allowed.

The application can use general event probes to intercept the QoS event and implement custom application specific QoS handling.

func NewReconfigureEvent

func NewReconfigureEvent() *Event

NewReconfigureEvent creates a new reconfigure event. The purpose of the reconfigure event is to travel upstream and make elements renegotiate their caps or reconfigure their buffer pools. This is useful when changing properties on elements or changing the topology of the pipeline.

func NewSeekEvent

func NewSeekEvent(rate float64, format Format, flags SeekFlags, startType SeekType, start int64, stopType SeekType, stop int64) *Event

NewSeekEvent allocates a new seek event with the given parameters.

The seek event configures playback of the pipeline between start to stop at the speed given in rate, also called a playback segment. The start and stop values are expressed in format.

A rate of 1.0 means normal playback rate, 2.0 means double speed. Negatives values means backwards playback. A value of 0.0 for the rate is not allowed and should be accomplished instead by PAUSING the pipeline.

A pipeline has a default playback segment configured with a start position of 0, a stop position of -1 and a rate of 1.0. The currently configured playback segment can be queried with GST_QUERY_SEGMENT.

start_type and stop_type specify how to adjust the currently configured start and stop fields in playback segment. Adjustments can be made relative or absolute to the last configured values. A type of GST_SEEK_TYPE_NONE means that the position should not be updated.

When the rate is positive and start has been updated, playback will start from the newly configured start position.

For negative rates, playback will start from the newly configured stop position (if any). If the stop position is updated, it must be different from -1 (#GST_CLOCK_TIME_NONE) for negative rates.

It is not possible to seek relative to the current playback position, to do this, PAUSE the pipeline, query the current playback position with GST_QUERY_POSITION and update the playback segment current position with a GST_SEEK_TYPE_SET to the desired position.

func NewSegmentDoneEvent

func NewSegmentDoneEvent(format Format, position int64) *Event

NewSegmentDoneEvent creates a new segment-done event. This event is sent by elements that finish playback of a segment as a result of a segment seek.

func NewSegmentEvent

func NewSegmentEvent(segment *Segment) *Event

NewSegmentEvent creates a new SEGMENT event for segment. The segment event can only travel downstream synchronized with the buffer flow and contains timing information and playback properties for the buffers that will follow.

The segment event marks the range of buffers to be processed. All data not within the segment range is not to be processed. This can be used intelligently by plugins to apply more efficient methods of skipping unneeded data. The valid range is expressed with the start and stop values.

The time value of the segment is used in conjunction with the start value to convert the buffer timestamps into the stream time. This is usually done in sinks to report the current stream_time. time represents the stream_time of a buffer carrying a timestamp of start. time cannot be -1.

start cannot be -1, stop can be -1. If there is a valid stop given, it must be greater or equal the start, including when the indicated playback rate is < 0.

The applied_rate value provides information about any rate adjustment that has already been made to the timestamps and content on the buffers of the stream. (@rate * applied_rate) should always equal the rate that has been requested for playback. For example, if an element has an input segment with intended playback rate of 2.0 and applied_rate of 1.0, it can adjust incoming timestamps and buffer content by half and output a segment event with rate of 1.0 and applied_rate of 2.0

After a segment event, the buffer stream time is calculated with:

time + (TIMESTAMP(buf) - start) * ABS (rate * applied_rate)

func NewSelectStreamsEvent

func NewSelectStreamsEvent(streams []*Stream) *Event

NewSelectStreamsEvent allocates a new select-streams event.

The select-streams event requests the specified streams to be activated.

The list of streams corresponds to the "Stream ID" of each stream to be activated. Those ID can be obtained via the GstStream objects present in EventStreamStart, EventStreamCollection or MessageStreamCollection.

Note: The list of streams can not be empty.

func NewSinkMessageEvent

func NewSinkMessageEvent(name string, msg *Message) *Event

NewSinkMessageEvent creates a new sink-message event. The purpose of the sink-message event is to instruct a sink to post the message contained in the event synchronized with the stream.

name is used to store multiple sticky events on one pad.

func NewStepEvent

func NewStepEvent(format Format, amount uint64, rate float64, flush, intermediate bool) *Event

NewStepEvent createss a new step event. The purpose of the step event is to instruct a sink to skip amount (expressed in format) of media. It can be used to implement stepping through the video frame by frame or for doing fast trick modes.

A rate of <= 0.0 is not allowed. Pause the pipeline, for the effect of rate = 0.0 or first reverse the direction of playback using a seek event to get the same effect as rate < 0.0.

The flush flag will clear any pending data in the pipeline before starting the step operation.

The intermediate flag instructs the pipeline that this step operation is part of a larger step operation.

func NewStreamCollectionEvent

func NewStreamCollectionEvent(collection *StreamCollection) *Event

NewStreamCollectionEvent creates a new STREAM_COLLECTION event. The stream collection event can only travel downstream synchronized with the buffer flow.

Source elements, demuxers and other elements that manage collections of streams and post GstStreamCollection messages on the bus also send this event downstream on each pad involved in the collection, so that activation of a new collection can be tracked through the downstream data flow.

func NewStreamGroupDoneEvent

func NewStreamGroupDoneEvent(groupID uint) *Event

NewStreamGroupDoneEvent creates a new Stream Group Done event. The stream-group-done event can only travel downstream synchronized with the buffer flow. Elements that receive the event on a pad should handle it mostly like EOS, and emit any data or pending buffers that would depend on more data arriving and unblock, since there won't be any more data.

This event is followed by EOS at some point in the future, and is generally used when switching pads - to unblock downstream so that new pads can be exposed before sending EOS on the existing pads.

func NewStreamStartEvent

func NewStreamStartEvent(streamID string) *Event

NewStreamStartEvent creates a new STREAM_START event. The stream start event can only travel downstream synchronized with the buffer flow. It is expected to be the first event that is sent for a new stream.

Source elements, demuxers and other elements that create new streams are supposed to send this event as the first event of a new stream. It should not be sent after a flushing seek or in similar situations and is used to mark the beginning of a new logical stream. Elements combining multiple streams must ensure that this event is only forwarded downstream once and not for every single input stream.

The stream_id should be a unique string that consists of the upstream stream-id, / as separator and a unique stream-id for this specific stream. A new stream-id should only be created for a stream if the upstream stream is split into (potentially) multiple new streams, e.g. in a demuxer, but not for every single element in the pipeline. Pad CreateStreamID can be used to create a stream-id. There are no particular semantics for the stream-id, though it should be deterministic (to support stream matching) and it might be used to order streams (besides any information conveyed by stream flags).

func NewTOCEvent

func NewTOCEvent(toc *TOC, updated bool) *Event

NewTOCEvent generates a TOC event from the given toc. The purpose of the TOC event is to inform elements that some kind of the TOC was found.

func NewTOCSelectEvent

func NewTOCSelectEvent(uid string) *Event

NewTOCSelectEvent generates a TOC select event with the given uid. The purpose of the TOC select event is to start playback based on the TOC's entry with the given uid.

func NewTagEvent

func NewTagEvent(tagList *TagList) *Event

NewTagEvent generates a metadata tag event from the given taglist.

The scope of the taglist specifies if the taglist applies to the complete medium or only to this specific stream. As the tag event is a sticky event, elements should merge tags received from upstream with a given scope with their own tags with the same scope and create a new tag event from it.

func ToGstEvent

func ToGstEvent(ev unsafe.Pointer) *Event

ToGstEvent converts the given pointer into an Event without affecting the ref count or placing finalizers.

func (*Event) Copy

func (e *Event) Copy() *Event

Copy copies the event using the event specific copy function.

func (*Event) CopySegment

func (e *Event) CopySegment(segment *Segment)

CopySegment parses a segment event and copies the Segment into the location given by segment.

func (*Event) GetRunningTimeOffset

func (e *Event) GetRunningTimeOffset() int64

GetRunningTimeOffset retrieves the accumulated running time offset of the event.

Events passing through GstPad that have a running time offset set via gst_pad_set_offset will get their offset adjusted according to the pad's offset.

If the event contains any information that related to the running time, this information will need to be updated before usage with this offset.

func (*Event) GetSeqnum

func (e *Event) GetSeqnum() uint32

GetSeqnum retrieves the sequence number of a event.

Events have ever-incrementing sequence numbers, which may also be set explicitly via SetSeqnum. Sequence numbers are typically used to indicate that a event corresponds to some other set of events or messages, for example an EOS event corresponding to a SEEK event. It is considered good practice to make this correspondence when possible, though it is not required.

Note that events and messages share the same sequence number incrementor; two events or messages will never have the same sequence number unless that correspondence was made explicitly.

func (*Event) GetStructure

func (e *Event) GetStructure() *Structure

GetStructure accesses the structure of the event.

func (*Event) HasName

func (e *Event) HasName(name string) bool

HasName checks if event has the given name. This function is usually used to check the name of a custom event.

func (*Event) Instance

func (e *Event) Instance() *C.GstEvent

Instance returns the underlying GstEvent instance.

func (*Event) ParseBufferSize

func (e *Event) ParseBufferSize() (format Format, minSize, maxSize int64, async bool)

ParseBufferSize gets the format, minsize, maxsize and async-flag in the buffersize event.

func (*Event) ParseCaps

func (e *Event) ParseCaps() *Caps

ParseCaps gets the caps from event. The caps remains valid as long as event remains valid.

func (*Event) ParseFlushStop

func (e *Event) ParseFlushStop() (resetTime bool)

ParseFlushStop parses the FLUSH_STOP event and retrieve the reset_time member. Value reflects whether time should be reset.

func (*Event) ParseGap

func (e *Event) ParseGap() (timestamp, duration time.Duration)

ParseGap extracts timestamp and duration from a new GAP event.

func (*Event) ParseGroupID

func (e *Event) ParseGroupID() (ok bool, gid uint)

ParseGroupID returns a group ID if set on the event.

func (*Event) ParseLatency

func (e *Event) ParseLatency() ClockTime

ParseLatency gets the latency in the latency event.

func (*Event) ParseProtection

func (e *Event) ParseProtection() (systemID string, data *Buffer, origin string)

ParseProtection parses an event containing protection system specific information and stores the results in system_id, data and origin. The data stored in system_id, origin and data are valid until event is released.

func (*Event) ParseQOS

func (e *Event) ParseQOS() (qTtype QOSType, proportion float64, diff ClockTimeDiff, timestamp ClockTime)

ParseQOS gets the type, proportion, diff and timestamp in the qos event. See NewQOSEvent for more information about the different QoS values.

timestamp will be adjusted for any pad offsets of pads it was passing through.

func (*Event) ParseSeek

func (e *Event) ParseSeek() (rate float64, format Format, flags SeekFlags, startType SeekType, start int64, stopType SeekType, stop int64)

ParseSeek parses a seek event.

func (*Event) ParseSeekTrickModeInterval

func (e *Event) ParseSeekTrickModeInterval() (interval ClockTime)

ParseSeekTrickModeInterval retrieves the trickmode interval that may have been set on a seek event with SetSeekTrickModeInterval.

func (*Event) ParseSegment

func (e *Event) ParseSegment() *Segment

ParseSegment parses a segment event and stores the result in the given segment location. segment remains valid only until the event is freed. Don't modify the segment and make a copy if you want to modify it or store it for later use.

func (*Event) ParseSegmentDone

func (e *Event) ParseSegmentDone() (Format, int64)

ParseSegmentDone extracts the position and format from the segment done message.

func (*Event) ParseSelectStreams

func (e *Event) ParseSelectStreams() []*Stream

ParseSelectStreams parses the SELECT_STREAMS event and retrieve the contained streams.

func (*Event) ParseSinkMessage

func (e *Event) ParseSinkMessage() *Message

ParseSinkMessage parses the sink-message event. Unref msg after usage.

func (*Event) ParseStep

func (e *Event) ParseStep() (format Format, amount uint64, rate float64, flush, intermediate bool)

ParseStep parses a step message

func (*Event) ParseStream

func (e *Event) ParseStream() *Stream

ParseStream parses a stream-start event and extract the GstStream from it.

func (*Event) ParseStreamCollection

func (e *Event) ParseStreamCollection() *StreamCollection

ParseStreamCollection parses a stream collection from the event.

func (*Event) ParseStreamFlags

func (e *Event) ParseStreamFlags() StreamFlags

ParseStreamFlags parses the stream flags from an event.

func (*Event) ParseStreamGroupDone

func (e *Event) ParseStreamGroupDone() uint

ParseStreamGroupDone parses a stream-group-done event and store the result in the given group_id location.

func (*Event) ParseStreamStart

func (e *Event) ParseStreamStart() string

ParseStreamStart parses a stream-id event and store the result in the given stream_id location.

func (*Event) ParseTOC

func (e *Event) ParseTOC() (toc *TOC, updated bool)

ParseTOC parses a TOC event and store the results in the given toc and updated locations.

func (*Event) ParseTOCSelect

func (e *Event) ParseTOCSelect() string

ParseTOCSelect parses a TOC select event and store the results in the given uid location.

func (*Event) ParseTag

func (e *Event) ParseTag() *TagList

ParseTag parses a tag event and stores the results in the given taglist location. Do not modify or free the returned tag list.

func (*Event) Ref

func (e *Event) Ref() *Event

Ref increases the ref count on the event by one.

func (*Event) Seqnum

func (e *Event) Seqnum() uint32

Seqnum returns the sequence number of the event.

func (*Event) SetGroupID

func (e *Event) SetGroupID(id uint)

SetGroupID sets the group id for the stream. All streams that have the same group id are supposed to be played together, i.e. all streams inside a container file should have the same group id but different stream ids. The group id should change each time the stream is started, resulting in different group ids each time a file is played for example.

Use NextGroupID to get a new group id.

func (*Event) SetRunningTimeOffset

func (e *Event) SetRunningTimeOffset(offset int64)

SetRunningTimeOffset sets the running time offset of a event. See GetRunningTimeOffset for more information.

func (*Event) SetSeekTrickModeInterval

func (e *Event) SetSeekTrickModeInterval(interval ClockTime)

SetSeekTrickModeInterval sets a trickmode interval on a (writable) seek event. Elements that support TRICKMODE_KEY_UNITS seeks SHOULD use this as the minimal interval between each frame they may output.

func (*Event) SetSeqnum

func (e *Event) SetSeqnum(seqnum uint32)

SetSeqnum sets the sequence number of a event.

This function might be called by the creator of a event to indicate that the event relates to other events or messages. See GetSeqnum for more information.

func (*Event) SetStream

func (e *Event) SetStream(stream *Stream)

SetStream sets the stream on the stream-start event

func (*Event) SetStreamFlags

func (e *Event) SetStreamFlags(flags StreamFlags)

SetStreamFlags sets the stream flags on the event.

func (*Event) Timestamp

func (e *Event) Timestamp() time.Duration

Timestamp returns the timestamp of the event.

func (*Event) Type

func (e *Event) Type() EventType

Type returns the type of the event

func (*Event) Unref

func (e *Event) Unref()

Unref decreases the refcount of an event, freeing it if the refcount reaches 0.

func (*Event) WritableStructure

func (e *Event) WritableStructure() *Structure

WritableStructure returns a writable version of the structure.

type EventType

type EventType int

EventType is a go cast for a GstEventType

const (
	EventTypeUnknown          EventType = C.GST_EVENT_UNKNOWN           //(0) – unknown event.
	EventTypeFlushStart       EventType = C.GST_EVENT_FLUSH_START       // (2563) – Start a flush operation. This event clears all data from the pipeline and unblock all streaming threads.
	EventTypeFlushStop        EventType = C.GST_EVENT_FLUSH_STOP        // (5127) – Stop a flush operation. This event resets the running-time of the pipeline.
	EventTypeStreamStart      EventType = C.GST_EVENT_STREAM_START      // (10254) – Event to mark the start of a new stream. Sent before any other serialized event and only sent at the start of a new stream, not after flushing seeks.
	EventTypeCaps             EventType = C.GST_EVENT_CAPS              // (12814) – GstCaps event. Notify the pad of a new media type.
	EventTypeSegment          EventType = C.GST_EVENT_SEGMENT           // (17934) – A new media segment follows in the dataflow. The segment events contains information for clipping buffers and converting buffer timestamps to running-time and stream-time.
	EventTypeStreamCollection EventType = C.GST_EVENT_STREAM_COLLECTION // (19230) – A new GstStreamCollection is available (Since: 1.10)
	EventTypeTag              EventType = C.GST_EVENT_TAG               // (20510) – A new set of metadata tags has been found in the stream.
	EventTypeBufferSize       EventType = C.GST_EVENT_BUFFERSIZE        // (23054) – Notification of buffering requirements. Currently not used yet.
	EventTypeSinkMessage      EventType = C.GST_EVENT_SINK_MESSAGE      // (25630) – An event that sinks turn into a message. Used to send messages that should be emitted in sync with rendering.
	EventTypeStreamGroupDone  EventType = C.GST_EVENT_STREAM_GROUP_DONE // (26894) – Indicates that there is no more data for the stream group ID in the message. Sent before EOS in some instances and should be handled mostly the same. (Since: 1.10)
	EventTypeEOS              EventType = C.GST_EVENT_EOS               // (28174) – End-Of-Stream. No more data is to be expected to follow without either a STREAM_START event, or a FLUSH_STOP and a SEGMENT event.
	EventTypeTOC              EventType = C.GST_EVENT_TOC               // (30750) – An event which indicates that a new table of contents (TOC) was found or updated.
	EventTypeProtection       EventType = C.GST_EVENT_PROTECTION        // (33310) – An event which indicates that new or updated encryption information has been found in the stream.
	EventTypeSegmentDone      EventType = C.GST_EVENT_SEGMENT_DONE      // (38406) – Marks the end of a segment playback.
	EventTypeGap              EventType = C.GST_EVENT_GAP               // (40966) – Marks a gap in the datastream.
	// EventTypeInstantRateChange      EventType = C.GST_EVENT_INSTANT_RATE_CHANGE      // (46090) – Notify downstream that a playback rate override should be applied as soon as possible. (Since: 1.18)
	EventTypeQOS           EventType = C.GST_EVENT_QOS            // (48641) – A quality message. Used to indicate to upstream elements that the downstream elements should adjust their processing rate.
	EventTypeSeek          EventType = C.GST_EVENT_SEEK           // (51201) – A request for a new playback position and rate.
	EventTypeNavigation    EventType = C.GST_EVENT_NAVIGATION     // (53761) – Navigation events are usually used for communicating user requests, such as mouse or keyboard movements, to upstream elements.
	EventTypeLatency       EventType = C.GST_EVENT_LATENCY        // (56321) – Notification of new latency adjustment. Sinks will use the latency information to adjust their synchronization.
	EventTypeStep          EventType = C.GST_EVENT_STEP           // (58881) – A request for stepping through the media. Sinks will usually execute the step operation.
	EventTypeReconfigure   EventType = C.GST_EVENT_RECONFIGURE    // (61441) – A request for upstream renegotiating caps and reconfiguring.
	EventTypeTOCSelect     EventType = C.GST_EVENT_TOC_SELECT     // (64001) – A request for a new playback position based on TOC entry's UID.
	EventTypeSelectStreams EventType = C.GST_EVENT_SELECT_STREAMS // (66561) – A request to select one or more streams (Since: 1.10)
	// EventTypeInstantRateSyncTime    EventType = C.GST_EVENT_INSTANT_RATE_SYNC_TIME   // (66817) – Sent by the pipeline to notify elements that handle the instant-rate-change event about the running-time when the rate multiplier should be applied (or was applied). (Since: 1.18)
	EventTypeCustomUpstream         EventType = C.GST_EVENT_CUSTOM_UPSTREAM          // (69121) – Upstream custom event
	EventTypeCustomDownstream       EventType = C.GST_EVENT_CUSTOM_DOWNSTREAM        // (71686) – Downstream custom event that travels in the data flow.
	EventTypeCustomOOB              EventType = C.GST_EVENT_CUSTOM_DOWNSTREAM_OOB    // (74242) – Custom out-of-band downstream event.
	EventTypeCustomDownstreamSticky EventType = C.GST_EVENT_CUSTOM_DOWNSTREAM_STICKY // (76830) – Custom sticky downstream event.
	EventTypeCustomBoth             EventType = C.GST_EVENT_CUSTOM_BOTH              // (79367) – Custom upstream or downstream event. In-band when traveling downstream.
	EventTypeCustomBothOOB          EventType = C.GST_EVENT_CUSTOM_BOTH_OOB          // (81923) – Custom upstream or downstream out-of-band event.
)

Type casts for EventTypes

func (EventType) String

func (e EventType) String() string

String implements a stringer on event types

type EventTypeFlags

type EventTypeFlags int

EventTypeFlags casts GstEventTypeFlags

const (
	EventTypeFlagUpstream    EventTypeFlags = C.GST_EVENT_TYPE_UPSTREAM     // (1) – Set if the event can travel upstream.
	EventTypeFlagDownstream  EventTypeFlags = C.GST_EVENT_TYPE_DOWNSTREAM   // (2) – Set if the event can travel downstream.
	EventTypeFlagSerialized  EventTypeFlags = C.GST_EVENT_TYPE_SERIALIZED   // (4) – Set if the event should be serialized with data flow.
	EventTypeFlagSticky      EventTypeFlags = C.GST_EVENT_TYPE_STICKY       // (8) – Set if the event is sticky on the pads.
	EventTypeFlagStickyMulti EventTypeFlags = C.GST_EVENT_TYPE_STICKY_MULTI // (16) – Multiple sticky events can be on a pad, each identified by the event name.
)

Type castings

type FlagsetValue

type FlagsetValue struct {
	// contains filtered or unexported fields
}

FlagsetValue is the go wrapper around a GstFlagSet value.

func Flagset

func Flagset(flags, mask uint) *FlagsetValue

Flagset returns a new FlagsetValue. The flags value indicates the values of flags, the mask represents which bits in the flag value have been set, and which are "don't care".

func ValueGetFlagset

func ValueGetFlagset(value *glib.Value) *FlagsetValue

ValueGetFlagset returns the flagset inside his value.

func (*FlagsetValue) Flags

func (f *FlagsetValue) Flags() uint

Flags returns the flags for this flagset.

func (*FlagsetValue) Mask

func (f *FlagsetValue) Mask() uint

Mask returns the mask for this flagset.

func (*FlagsetValue) ToGValue

func (f *FlagsetValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type Float64RangeValue

type Float64RangeValue struct {
	// contains filtered or unexported fields
}

Float64RangeValue is the go wrapper around a GstDoubleRange value.

func Float64Range

func Float64Range(start, end float64) *Float64RangeValue

Float64Range returns a new Float64RangeValue. This is the equivalent of a double range value.

func ValueGetFloat64Range

func ValueGetFloat64Range(value *glib.Value) *Float64RangeValue

ValueGetFloat64Range returns the range from inside this value.

func (*Float64RangeValue) End

func (f *Float64RangeValue) End() float64

End returns the end for this range.

func (*Float64RangeValue) Start

func (f *Float64RangeValue) Start() float64

Start returns the start for this range.

func (*Float64RangeValue) String

func (f *Float64RangeValue) String() string

String returns a string representation of the range.

func (*Float64RangeValue) ToGValue

func (f *Float64RangeValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type FlowReturn

type FlowReturn int

FlowReturn is go type casting for GstFlowReturn.

const (
	FlowOK            FlowReturn = C.GST_FLOW_OK             // Data passing was ok
	FlowNotLinked     FlowReturn = C.GST_FLOW_NOT_LINKED     // Pad is not linked
	FlowFlushing      FlowReturn = C.GST_FLOW_FLUSHING       // Pad is flushing
	FlowEOS           FlowReturn = C.GST_FLOW_EOS            // Pad is EOS
	FlowNotNegotiated FlowReturn = C.GST_FLOW_NOT_NEGOTIATED // Pad is not negotiated
	FlowError         FlowReturn = C.GST_FLOW_ERROR          // Some (fatal) error occurred
	FlowNotSupported  FlowReturn = C.GST_FLOW_NOT_SUPPORTED  // The operation is not supported.
)

Type casting of the GstFlowReturn types. Custom ones are omitted for now.

func (FlowReturn) String

func (f FlowReturn) String() string

String impelements a stringer on FlowReturn

type Format

type Format int

Format is a representation of GstFormat.

const (
	FormatUndefined Format = C.GST_FORMAT_UNDEFINED // (0) – undefined format
	FormatDefault   Format = C.GST_FORMAT_DEFAULT   // (1) – the default format of the pad/element. This can be samples for raw audio, or frames/fields for raw video.
	FormatBytes     Format = C.GST_FORMAT_BYTES     // (2) - bytes
	FormatTime      Format = C.GST_FORMAT_TIME      // (3) – time in nanoseconds
)

Type casts of formats

func (Format) String

func (f Format) String() string

String implements a stringer on GstFormat types

type FractionRangeValue

type FractionRangeValue struct {
	// contains filtered or unexported fields
}

FractionRangeValue represents a GstFractionRange.

func FractionRange

func FractionRange(start, end *FractionValue) *FractionRangeValue

FractionRange returns a new GstFractionRange.

func ValueGetFractionRange

func ValueGetFractionRange(value *glib.Value) *FractionRangeValue

ValueGetFractionRange returns the range inside the given value.

func (*FractionRangeValue) End

End returns the end of the range.

func (*FractionRangeValue) Start

func (g *FractionRangeValue) Start() *FractionValue

Start returns the start of the range.

func (*FractionRangeValue) String

func (g *FractionRangeValue) String() string

String returns a string representation of the range.

func (*FractionRangeValue) ToGValue

func (g *FractionRangeValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type FractionValue

type FractionValue struct {
	// contains filtered or unexported fields
}

FractionValue is a helper structure for building fractions for functions that require them.

func Fraction

func Fraction(numerator, denominator int) *FractionValue

Fraction returns a new GFraction with the given numerator and denominator.

func ValueGetFraction

func ValueGetFraction(value *glib.Value) *FractionValue

ValueGetFraction returns the fraction inside the given value.

func (*FractionValue) Denom

func (g *FractionValue) Denom() int

Denom returns the fraction's denominator.

func (*FractionValue) Num

func (g *FractionValue) Num() int

Num returns the fraction's numerator.

func (*FractionValue) String

func (g *FractionValue) String() string

String returns a string representation of the fraction.

func (*FractionValue) ToGValue

func (g *FractionValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type GError

type GError struct {
	// contains filtered or unexported fields
}

GError is a Go wrapper for a C GError in the context of GStreamer. It implements the error interface and provides additional functions for retrieving debug strings and details.

func NewGError

func NewGError(code ErrorCode, err error) *GError

NewGError wraps the given error inside a GError (to be used with message constructors).

func (*GError) Code

func (e *GError) Code() ErrorCode

Code returns the error code of the error message.

func (*GError) DebugString

func (e *GError) DebugString() string

DebugString returns any debug info alongside the error.

func (*GError) Error

func (e *GError) Error() string

Error implements the error interface and returns the error message.

func (*GError) Message

func (e *GError) Message() string

Message is an alias to `Error()`. It's for clarity when this object is parsed from a `GST_MESSAGE_INFO` or `GST_MESSAGE_WARNING`.

func (*GError) Structure

func (e *GError) Structure() *Structure

Structure returns the structure of the error message which may contain additional metadata.

type GapFlags

type GapFlags int

GapFlags casts GstGapFlags

const (
	GapFlagMissingData GapFlags = 1
)

Type castings

type GhostPad

type GhostPad struct{ *ProxyPad }

GhostPad is a go representation of a GstGhostPad.

func FromGstGhostPadUnsafeFull

func FromGstGhostPadUnsafeFull(pad unsafe.Pointer) *GhostPad

FromGstGhostPadUnsafeFull wraps the given GstGhostPad.

func FromGstGhostPadUnsafeNone

func FromGstGhostPadUnsafeNone(pad unsafe.Pointer) *GhostPad

FromGstGhostPadUnsafeNone wraps the given GstGhostPad.

func NewGhostPad

func NewGhostPad(name string, target *Pad) *GhostPad

NewGhostPad create a new ghostpad with target as the target. The direction will be taken from the target pad. The target must be unlinked. If name is empty, one will be selected.

Will ref the target.

func NewGhostPadFromTemplate

func NewGhostPadFromTemplate(name string, target *Pad, tmpl *PadTemplate) *GhostPad

NewGhostPadFromTemplate creates a new ghostpad with target as the target. The direction will be taken from the target pad. The template used on the ghostpad will be template. If name is empty one will be selected.

Will ref the target.

func NewGhostPadNoTarget

func NewGhostPadNoTarget(name string, direction PadDirection) *GhostPad

NewGhostPadNoTarget creates a new ghostpad without a target with the given direction. A target can be set on the ghostpad later with the SetTarget function. If name is empty, one will be selected.

The created ghostpad will not have a padtemplate.

func NewGhostPadNoTargetFromTemplate

func NewGhostPadNoTargetFromTemplate(name string, tmpl *PadTemplate) *GhostPad

NewGhostPadNoTargetFromTemplate creates a new ghostpad based on templ, without setting a target. The direction will be taken from the templ.

func (*GhostPad) ActivateModeDefault

func (g *GhostPad) ActivateModeDefault(parent *Object, mode PadMode, active bool) bool

ActivateModeDefault invokes the default activate mode function of a ghost pad.

func (*GhostPad) GetTarget

func (g *GhostPad) GetTarget() *Pad

GetTarget gets the target pad of gpad.

func (*GhostPad) Instance

func (g *GhostPad) Instance() *C.GstGhostPad

Instance returns the underlying ghost pad instance.

func (*GhostPad) InternalActivateModeDefault

func (g *GhostPad) InternalActivateModeDefault(parent *Object, mode PadMode, active bool) bool

InternalActivateModeDefault invokes the default activate mode function of a proxy pad that is owned by a ghost pad.

func (*GhostPad) SetTarget

func (g *GhostPad) SetTarget(target *Pad) bool

SetTarget sets the new target of the ghostpad gpad. Any existing target is unlinked and links to the new target are established. if newtarget is nil the target will be cleared.

type Int64RangeValue

type Int64RangeValue struct {
	// contains filtered or unexported fields
}

Int64RangeValue represents a GstInt64Range.

func Int64Range

func Int64Range(start, end, step int64) *Int64RangeValue

Int64Range returns a new Int64RangeValue.

func ValueGetInt64Range

func ValueGetInt64Range(value *glib.Value) *Int64RangeValue

ValueGetInt64Range gets the int64 range from the given value.

func (*Int64RangeValue) End

func (i *Int64RangeValue) End() int64

End returns the end of the range

func (*Int64RangeValue) Start

func (i *Int64RangeValue) Start() int64

Start returns the start of the range

func (*Int64RangeValue) Step

func (i *Int64RangeValue) Step() int64

Step returns the step of the range

func (*Int64RangeValue) String

func (i *Int64RangeValue) String() string

String implements a Stringer.

func (*Int64RangeValue) ToGValue

func (i *Int64RangeValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type IntRangeValue

type IntRangeValue struct {
	// contains filtered or unexported fields
}

IntRangeValue represents a GstIntRange.

func IntRange

func IntRange(start, end, step int) *IntRangeValue

IntRange returns a new IntRangeValue.

func ValueGetIntRange

func ValueGetIntRange(value *glib.Value) *IntRangeValue

ValueGetIntRange gets the int range from the given value.

func (*IntRangeValue) End

func (i *IntRangeValue) End() int

End returns the end of the range

func (*IntRangeValue) Start

func (i *IntRangeValue) Start() int

Start returns the start of the range

func (*IntRangeValue) Step

func (i *IntRangeValue) Step() int

Step returns the step of the range

func (*IntRangeValue) String

func (i *IntRangeValue) String() string

String implements a Stringer.

func (*IntRangeValue) ToGValue

func (i *IntRangeValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type InterpolationControlSource

type InterpolationControlSource struct{ *Object }

func NewInterpolationControlSource

func NewInterpolationControlSource() *InterpolationControlSource

func (*InterpolationControlSource) Instance

func (*InterpolationControlSource) SetInterpolationMode

func (cs *InterpolationControlSource) SetInterpolationMode(mode InterpolationMode)

func (*InterpolationControlSource) SetTimedValue

func (cs *InterpolationControlSource) SetTimedValue(time ClockTime, value float64) bool

func (*InterpolationControlSource) UnsetAll

func (cs *InterpolationControlSource) UnsetAll()

type InterpolationMode

type InterpolationMode int
const (
	//steps-like interpolation, default
	InterpolationModeNone InterpolationMode = 0 // GST_INTERPOLATION_MODE_NONE
	//linear interpolation
	InterpolationModeLinear InterpolationMode = 1 // GST_INTERPOLATION_MODE_LINEAR
	//cubic interpolation (natural), may overshoot the min or max values set by the control point, but is more 'curvy'
	InterpolationModeCubic InterpolationMode = 2 // GST_INTERPOLATION_MODE_CUBIC
	//monotonic cubic interpolation, will not produce any values outside of the min-max range set by the control points (Since: 1.8)
	InterpolationModeCubicMonotonic InterpolationMode = 3 // GST_INTERPOLATION_MODE_CUBIC_MONOTONIC
)

type License

type License string

License represents a type of license used on a plugin.

const (
	LicenseLGPL        License = "LGPL"
	LicenseGPL         License = "GPL"
	LicenseQPL         License = "QPL"
	LicenseGPLQPL      License = "GPL/QPL"
	LicenseMPL         License = "MPL"
	LicenseBSD         License = "BSD"
	LicenseMIT         License = "MIT/X11"
	LicenseProprietary License = "Proprietary"
	LicenseUnknown     License = "unknown"
)

Types of licenses

type LogFunction

type LogFunction = func(
	category *DebugCategory,
	level DebugLevel,
	file string,
	function string,
	line int,
	object *LoggedObject,
	message *DebugMessage,
)

type LoggedObject

type LoggedObject struct {
	// contains filtered or unexported fields
}

C.GObject passed to logging callback might not be full constructed yet (logging before g_object_new() has returned), or they might have a refcount of 0 (logging in finalize), or they might be partially destructed (dispose).

It is not safe for general use. For most needs, use DebugMessage.GetId() instead

func (*LoggedObject) Get

func (l *LoggedObject) Get() unsafe.Pointer

type MapFlags

type MapFlags int

MapFlags is a go casting of GstMapFlags

const (
	MapRead     MapFlags = C.GST_MAP_READ      //  (1) – map for read access
	MapWrite    MapFlags = C.GST_MAP_WRITE     // (2) - map for write access
	MapFlagLast MapFlags = C.GST_MAP_FLAG_LAST // (65536) – first flag that can be used for custom purposes
)

Type casting of the map flag types

type MapInfo

type MapInfo struct {
	// contains filtered or unexported fields
}

MapInfo is a go representation of a GstMapInfo.

func (*MapInfo) AsFloat32BESlice

func (m *MapInfo) AsFloat32BESlice() []float32

AsFloat32BESlice returns the contents of this map as a slice of 32-bit big-endian floats.

func (*MapInfo) AsFloat32LESlice

func (m *MapInfo) AsFloat32LESlice() []float32

AsFloat32LESlice returns the contents of this map as a slice of 32-bit little-endian floats.

func (*MapInfo) AsFloat64BESlice

func (m *MapInfo) AsFloat64BESlice() []float64

AsFloat64BESlice returns the contents of this map as a slice of 64-bit big-endian floats.

func (*MapInfo) AsFloat64LESlice

func (m *MapInfo) AsFloat64LESlice() []float64

AsFloat64LESlice returns the contents of this map as a slice of 64-bit little-endian floats.

func (*MapInfo) AsInt16BESlice

func (m *MapInfo) AsInt16BESlice() []int16

AsInt16BESlice returns the contents of this map as a slice of signed 16-bit big-endian integers.

func (*MapInfo) AsInt16LESlice

func (m *MapInfo) AsInt16LESlice() []int16

AsInt16LESlice returns the contents of this map as a slice of signed 16-bit little-endian integers.

func (*MapInfo) AsInt32BESlice

func (m *MapInfo) AsInt32BESlice() []int32

AsInt32BESlice returns the contents of this map as a slice of signed 32-bit big-endian integers.

func (*MapInfo) AsInt32LESlice

func (m *MapInfo) AsInt32LESlice() []int32

AsInt32LESlice returns the contents of this map as a slice of signed 32-bit little-endian integers.

func (*MapInfo) AsInt64BESlice

func (m *MapInfo) AsInt64BESlice() []int64

AsInt64BESlice returns the contents of this map as a slice of signed 64-bit big-endian integers.

func (*MapInfo) AsInt64LESlice

func (m *MapInfo) AsInt64LESlice() []int64

AsInt64LESlice returns the contents of this map as a slice of signed 64-bit little-endian integers.

func (*MapInfo) AsInt8Slice

func (m *MapInfo) AsInt8Slice() []int8

AsInt8Slice returns the contents of this map as a slice of signed 8-bit integers.

func (*MapInfo) AsUint16BESlice

func (m *MapInfo) AsUint16BESlice() []uint16

AsUint16BESlice returns the contents of this map as a slice of unsigned 16-bit big-endian integers.

func (*MapInfo) AsUint16LESlice

func (m *MapInfo) AsUint16LESlice() []uint16

AsUint16LESlice returns the contents of this map as a slice of unsigned 16-bit little-endian integers.

func (*MapInfo) AsUint32BESlice

func (m *MapInfo) AsUint32BESlice() []uint32

AsUint32BESlice returns the contents of this map as a slice of unsigned 32-bit big-endian integers.

func (*MapInfo) AsUint32LESlice

func (m *MapInfo) AsUint32LESlice() []uint32

AsUint32LESlice returns the contents of this map as a slice of unsigned 32-bit little-endian integers.

func (*MapInfo) AsUint64BESlice

func (m *MapInfo) AsUint64BESlice() []uint64

AsUint64BESlice returns the contents of this map as a slice of unsigned 64-bit big-endian integers.

func (*MapInfo) AsUint64LESlice

func (m *MapInfo) AsUint64LESlice() []uint64

AsUint64LESlice returns the contents of this map as a slice of unsigned 64-bit little-endian integers.

func (*MapInfo) AsUint8Slice

func (m *MapInfo) AsUint8Slice() []uint8

AsUint8Slice returns the contents of this map as a slice of unsigned 8-bit integers.

func (*MapInfo) Bytes

func (m *MapInfo) Bytes() []byte

Bytes returns a byte slice of the data inside this map info.

func (*MapInfo) Data

func (m *MapInfo) Data() unsafe.Pointer

Data returns a pointer to the raw data inside this map.

func (*MapInfo) Flags

func (m *MapInfo) Flags() MapFlags

Flags returns the flags set on this map.

func (*MapInfo) Instance

func (m *MapInfo) Instance() *C.GstMapInfo

Instance returns the underlying GstMapInfo instance.

func (*MapInfo) MaxSize

func (m *MapInfo) MaxSize() int64

MaxSize returns the maximum size of this map.

func (*MapInfo) Memory

func (m *MapInfo) Memory() *Memory

Memory returns the underlying memory object.

func (*MapInfo) Reader

func (m *MapInfo) Reader() io.Reader

Reader returns a Reader for the contents of this map's memory.

func (*MapInfo) Size

func (m *MapInfo) Size() int64

Size returrns the size of this map.

func (*MapInfo) WriteAt

func (m *MapInfo) WriteAt(offset int, data []byte)

WriteAt writes the given data sequence directly to the map's memory at the given offset.

func (*MapInfo) WriteData

func (m *MapInfo) WriteData(data []byte)

WriteData writes the given sequence directly to the map's memory.

func (*MapInfo) Writer

func (m *MapInfo) Writer() io.Writer

Writer returns a writer that will copy the contents passed to Write directly to the map's memory sequentially. An error will be returned if an attempt is made to write more data than the map can hold.

type Memory

type Memory struct {
	// contains filtered or unexported fields
}

Memory is a go representation of GstMemory. This object is implemented in a read-only fashion currently primarily for reference, and as such you should not really use it. You can create new memory blocks, but there are no methods implemented yet for modifying ones already in existence.

Use the Buffer and its Map methods to interact with memory in both a read and writable way.

func FromGstMemoryUnsafe

func FromGstMemoryUnsafe(mem unsafe.Pointer) *Memory

FromGstMemoryUnsafe wraps the given C GstMemory in the go type. It is meant for internal usage and exported for visibility to other packages.

func FromGstMemoryUnsafeFull

func FromGstMemoryUnsafeFull(mem unsafe.Pointer) *Memory

FromGstMemoryUnsafeFull wraps the given memory without taking an additional reference.

func FromGstMemoryUnsafeNone

func FromGstMemoryUnsafeNone(mem unsafe.Pointer) *Memory

FromGstMemoryUnsafeNone is an alias to FromGstMemoryUnsafe.

func NewMemoryWrapped

func NewMemoryWrapped(flags MemoryFlags, data []byte, maxSize, offset int64) *Memory

NewMemoryWrapped allocates a new memory block that wraps the given data.

The prefix/padding must be filled with 0 if flags contains MemoryFlagZeroPrefixed and MemoryFlagZeroPadded respectively.

func (*Memory) Alignment

func (m *Memory) Alignment() int64

Alignment returns the alignment of the memory.

func (*Memory) Allocator

func (m *Memory) Allocator() *Allocator

Allocator returns the allocator for this memory.

func (*Memory) Bytes

func (m *Memory) Bytes() []byte

Bytes will return a byte slice of the data inside this memory if it is readable.

func (*Memory) Copy

func (m *Memory) Copy(offset, size int64) *Memory

Copy returns a copy of size bytes from mem starting from offset. This copy is guaranteed to be writable. size can be set to -1 to return a copy from offset to the end of the memory region.

func (*Memory) Instance

func (m *Memory) Instance() *C.GstMemory

Instance returns the underlying GstMemory instance.

func (*Memory) Map

func (m *Memory) Map(flags MapFlags) *MapInfo

Map the data inside the memory. This function can return nil if the memory is not read or writable. It is safe to call this function multiple times on the same Memory, however it will retain the flags used when mapping the first time. To change between read and write access first unmap and then remap the memory with the appropriate flags, or map initially with both read/write access.

Unmap the Memory after usage.

func (*Memory) MaxSize

func (m *Memory) MaxSize() int64

MaxSize returns the maximum size allocated for this memory block.

func (*Memory) Offset

func (m *Memory) Offset() int64

Offset returns the offset where valid data starts.

func (*Memory) Parent

func (m *Memory) Parent() *Memory

Parent returns this memory block's parent.

func (*Memory) Ref

func (m *Memory) Ref() *Memory

Ref increases the ref count on this memory block by one.

func (*Memory) Size

func (m *Memory) Size() int64

Size returns the size of valid data.

func (*Memory) Unmap

func (m *Memory) Unmap()

Unmap will unmap the data inside this memory. Use this after calling Map on the Memory.

func (*Memory) Unref

func (m *Memory) Unref()

Unref decreases the ref count on this memory block by one. When the refcount reaches zero the memory is freed.

type MemoryFlags

type MemoryFlags int

MemoryFlags represent flags for wrapped memory

const (
	MemoryFlagReadOnly             MemoryFlags = C.GST_MEMORY_FLAG_READONLY              // (2) – memory is readonly. It is not allowed to map the memory with GST_MAP_WRITE.
	MemoryFlagNoShare              MemoryFlags = C.GST_MEMORY_FLAG_NO_SHARE              // (16) – memory must not be shared. Copies will have to be made when this memory needs to be shared between buffers. (DEPRECATED: do not use in new code, instead you should create a custom GstAllocator for memory pooling instead of relying on the GstBuffer they were originally attached to.)
	MemoryFlagZeroPrefixed         MemoryFlags = C.GST_MEMORY_FLAG_ZERO_PREFIXED         // (32) – the memory prefix is filled with 0 bytes
	MemoryFlagZeroPadded           MemoryFlags = C.GST_MEMORY_FLAG_ZERO_PADDED           // (64) – the memory padding is filled with 0 bytes
	MemoryFlagPhysicallyContiguous MemoryFlags = C.GST_MEMORY_FLAG_PHYSICALLY_CONTIGUOUS // (128) – the memory is physically contiguous. (Since: 1.2)
	MemoryFlagNotMappable          MemoryFlags = C.GST_MEMORY_FLAG_NOT_MAPPABLE          // (256) – the memory can't be mapped via gst_memory_map without any preconditions. (Since: 1.2)
	MemoryFlagLast                 MemoryFlags = 1048576                                 // first flag that can be used for custom purposes
)

Type castins of MemoryFlags

type Message

type Message struct {
	// contains filtered or unexported fields
}

Message is a Go wrapper around a GstMessage. It provides convenience methods for unref-ing and parsing the underlying messages.

func FromGstMessageUnsafeFull

func FromGstMessageUnsafeFull(msg unsafe.Pointer) *Message

FromGstMessageUnsafeFull wraps the given unsafe.Pointer in a message. No ref is taken and a finalizer is placed on the resulting object.

func FromGstMessageUnsafeNone

func FromGstMessageUnsafeNone(msg unsafe.Pointer) *Message

FromGstMessageUnsafeNone wraps the given unsafe.Pointer in a message. A ref is taken on the message and a runtime finalizer placed on the object.

func NewApplicationMessage

func NewApplicationMessage(src interface{}, structure *Structure) *Message

NewApplicationMessage creates a new application-typed message. GStreamer will never create these messages; they are a gift from them to you. Enjoy.

The source of all message constructors must be a valid Object or descendant, specifically one created from the go runtime. If not the message returned will be nil.

func NewAsyncDoneMessage

func NewAsyncDoneMessage(src interface{}, runningTime ClockTime) *Message

NewAsyncDoneMessage builds a message that is posted when elements completed an ASYNC state change. RunningTime contains the time of the desired running time when this elements goes to PLAYING. A value less than 0 for runningTime means that the element has no clock interaction and thus doesn't care about the running time of the pipeline.

func NewAsyncStartMessage

func NewAsyncStartMessage(src interface{}) *Message

NewAsyncStartMessage returns a message that is posted by elements when they start an ASYNC state change.

func NewBufferingMessage

func NewBufferingMessage(src interface{}, percent int) *Message

NewBufferingMessage returns a message that can be posted by an element that needs to buffer data before it can continue processing. percent should be a value between 0 and 100. A value of 100 means that the buffering completed.

When percent is < 100 the application should PAUSE a PLAYING pipeline. When percent is 100, the application can set the pipeline (back) to PLAYING. The application must be prepared to receive BUFFERING messages in the PREROLLING state and may only set the pipeline to PLAYING after receiving a message with percent set to 100, which can happen after the pipeline completed prerolling.

func NewClockLostMessage

func NewClockLostMessage(src interface{}, clock *Clock) *Message

NewClockLostMessage creates a clock lost message. This message is posted whenever the clock is not valid anymore.

If this message is posted by the pipeline, the pipeline will select a new clock again when it goes to PLAYING. It might therefore be needed to set the pipeline to PAUSED and PLAYING again.

func NewClockProvideMessage

func NewClockProvideMessage(src interface{}, clock *Clock, ready bool) *Message

NewClockProvideMessage creates a clock provide message. This message is posted whenever an element is ready to provide a clock or lost its ability to provide a clock (maybe because it paused or became EOS).

This message is mainly used internally to manage the clock selection.

func NewCustomMessage

func NewCustomMessage(src interface{}, msgType MessageType, structure *Structure) *Message

NewCustomMessage creates a new custom-typed message. This can be used for anything not handled by other message-specific functions to pass a message to the app. The structure field can be nil.

func NewDeviceAddedMessage

func NewDeviceAddedMessage(src interface{}, device *Device) *Message

NewDeviceAddedMessage creates a new device-added message. The device-added message is produced by a DeviceProvider or a DeviceMonitor. They announce the appearance of monitored devices.

func NewDeviceChangedMessage

func NewDeviceChangedMessage(src interface{}, device, changedDevice *Device) *Message

NewDeviceChangedMessage creates a new device-changed message. The device-changed message is produced by a DeviceProvider or a DeviceMonitor. They announce that a device properties has changed and device represent the new modified version of changed_device.

func NewDeviceRemovedMessage

func NewDeviceRemovedMessage(src interface{}, device *Device) *Message

NewDeviceRemovedMessage creates a new device-removed message. The device-removed message is produced by a DeviceProvider or a DeviceMonitor. They announce the disappearance of monitored devices.

func NewDurationChangedMessage

func NewDurationChangedMessage(src interface{}) *Message

NewDurationChangedMessage creates a new duration changed message. This message is posted by elements that know the duration of a stream when the duration changes. This message is received by bins and is used to calculate the total duration of a pipeline.

func NewEOSMessage

func NewEOSMessage(src interface{}) *Message

NewEOSMessage creates a new eos message. This message is generated and posted in the sink elements of a Bin. The bin will only forward the EOS message to the application if all sinks have posted an EOS message.

func NewElementMessage

func NewElementMessage(src interface{}, structure *Structure) *Message

NewElementMessage creates a new element-specific message. This is meant as a generic way of allowing one-way communication from an element to an application, for example "the firewire cable was unplugged". The format of the message should be documented in the element's documentation. The structure field can be nil.

func NewErrorMessage

func NewErrorMessage(src interface{}, err error, debugStr string, structure *Structure) *Message

NewErrorMessage creates a new error message. The message will copy error and debug. This message is posted by element when a fatal event occurred. The pipeline will probably (partially) stop. The application receiving this message should stop the pipeline. Structure can be nil to not add a structure to the message.

func NewHaveContextMessage

func NewHaveContextMessage(src interface{}, ctx *Context) *Message

NewHaveContextMessage creates a message that is posted when an element has a new local Context.

func NewInfoMessage

func NewInfoMessage(src interface{}, msg string, debugStr string, structure *Structure) *Message

NewInfoMessage creates a new info message. Structure can be nil.

func NewLatencyMessage

func NewLatencyMessage(src interface{}) *Message

NewLatencyMessage creates a message that can be posted by elements when their latency requirements have changed.

func NewNeedContextMessage

func NewNeedContextMessage(src interface{}, ctxType string) *Message

NewNeedContextMessage creates a message that is posted when an element needs a specific Context.

func NewNewClockMessage

func NewNewClockMessage(src interface{}, clock *Clock) *Message

NewNewClockMessage creates a new clock message. This message is posted whenever the pipeline selects a new clock for the pipeline.

func NewProgressMessage

func NewProgressMessage(src interface{}, progressType ProgressType, code, text string) *Message

NewProgressMessage creates messages that are posted by elements when they use an asynchronous task to perform actions triggered by a state change.

Code contains a well defined string describing the action. Text should contain a user visible string detailing the current action.

func NewPropertyNotifyMessage

func NewPropertyNotifyMessage(src interface{}, propName string, val interface{}) *Message

NewPropertyNotifyMessage creates a new message notifying an object's properties have changed. If the source OR the value cannot be coereced to C types, the function will return nil.

func NewQoSMessage

func NewQoSMessage(src interface{}, live bool, runningTime, streamTime, timestamp, duration uint64) *Message

NewQoSMessage creates a message that is posted on the bus whenever an element decides to drop a buffer because of QoS reasons or whenever it changes its processing strategy because of QoS reasons (quality adjustments such as processing at lower accuracy).

This message can be posted by an element that performs synchronization against the clock (live) or it could be dropped by an element that performs QoS because of QOS events received from a downstream element (!live).

running_time, stream_time, timestamp, duration should be set to the respective running-time, stream-time, timestamp and duration of the (dropped) buffer that generated the QoS event. Values can be left to less than zero when unknown.

func NewRedirectMessage

func NewRedirectMessage(src interface{}, location string, tagList *TagList, entryStructure *Structure) *Message

NewRedirectMessage creates a new redirect message and adds a new entry to it. Redirect messages are posted when an element detects that the actual data has to be retrieved from a different location. This is useful if such a redirection cannot be handled inside a source element, for example when HTTP 302/303 redirects return a non-HTTP URL.

The redirect message can hold multiple entries. The first one is added when the redirect message is created, with the given location, tag_list, entry_struct arguments. Use AddRedirectEntry to add more entries.

Each entry has a location, a tag list, and a structure. All of these are optional. The tag list and structure are useful for additional metadata, such as bitrate statistics for the given location.

By default, message recipients should treat entries in the order they are stored. The recipient should therefore try entry #0 first, and if this entry is not acceptable or working, try entry #1 etc. Senders must make sure that they add entries in this order. However, recipients are free to ignore the order and pick an entry that is "best" for them. One example would be a recipient that scans the entries for the one with the highest bitrate tag.

The specified location string is copied. However, ownership over the tag list and structure are transferred to the message.

func NewRequestStateMessage

func NewRequestStateMessage(src interface{}, state State) *Message

NewRequestStateMessage creates a message that can be posted by elements when they want to have their state changed. A typical use case would be an audio server that wants to pause the pipeline because a higher priority stream is being played.

func NewResetTimeMessage

func NewResetTimeMessage(src interface{}, runningTime ClockTime) *Message

NewResetTimeMessage creates a message that is posted when the pipeline running-time should be reset to running_time, like after a flushing seek.

func NewSegmentDoneMessage

func NewSegmentDoneMessage(src interface{}, format Format, position int64) *Message

NewSegmentDoneMessage creates a new segment done message. This message is posted by elements that finish playback of a segment as a result of a segment seek. This message is received by the application after all elements that posted a segment_start have posted the segment_done.

func NewSegmentStartMessage

func NewSegmentStartMessage(src interface{}, format Format, position int64) *Message

NewSegmentStartMessage creates a new segment message. This message is posted by elements that start playback of a segment as a result of a segment seek. This message is not received by the application but is used for maintenance reasons in container elements.

func NewStateChangedMessage

func NewStateChangedMessage(src interface{}, oldState, newState, pendingState State) *Message

NewStateChangedMessage creates a state change message. This message is posted whenever an element changed its state.

func NewStateDirtyMessage

func NewStateDirtyMessage(src interface{}) *Message

NewStateDirtyMessage creates a state dirty message. This message is posted whenever an element changed its state asynchronously and is used internally to update the states of container objects.

func NewStepDoneMessage

func NewStepDoneMessage(src interface{}, format Format, amount uint64, rate float64, flush, intermediate bool, duration uint64, eos bool) *Message

NewStepDoneMessage creates a message that is posted by elements when they complete a part, when intermediate set to TRUE, or a complete step operation.

Duration will contain the amount of time of the stepped amount of media in format format.

func NewStepStartMessage

func NewStepStartMessage(src interface{}, active bool, format Format, amount uint64, rate float64, flush, intermediate bool) *Message

NewStepStartMessage creates a message that is posted by elements when they accept or activate a new step event for amount in format.

Active is set to FALSE when the element accepted the new step event and has queued it for execution in the streaming threads.

Active is set to TRUE when the element has activated the step operation and is now ready to start executing the step in the streaming thread. After this message is emitted, the application can queue a new step operation in the element.

func NewStreamCollectionMessage

func NewStreamCollectionMessage(src interface{}, collection *StreamCollection) *Message

NewStreamCollectionMessage creates a new stream-collection message. The message is used to announce new StreamCollections.

func NewStreamSelectedMessage

func NewStreamSelectedMessage(src interface{}, collection *StreamCollection) *Message

NewStreamSelectedMessage creates a new steams-selected message. The message is used to announce that an array of streams has been selected. This is generally in response to a GST_EVENT_SELECT_STREAMS event, or when an element (such as decodebin3) makes an initial selection of streams.

The message also contains the StreamCollection to which the various streams belong to.

Users of this constructor can add the selected streams with StreamsSelectedAdd.

func NewStreamStartMessage

func NewStreamStartMessage(src interface{}) *Message

NewStreamStartMessage creates a new stream_start message. This message is generated and posted in the sink elements of a Bin. The bin will only forward the StreamStart message to the application if all sinks have posted a StreamStart message.

func NewStreamStatusMessage

func NewStreamStatusMessage(src interface{}, stType StreamStatusType, owner *Element) *Message

NewStreamStatusMessage creates a new stream status message. This message is posted when a streaming thread is created/destroyed or when the state changed.

func NewStructureChangeMessage

func NewStructureChangeMessage(src interface{}, chgType StructureChangeType, owner *Element, busy bool) *Message

NewStructureChangeMessage creates a new structure change message. This message is posted when the structure of a pipeline is in the process of being changed, for example when pads are linked or unlinked.

Src should be the sinkpad that unlinked or linked.

func NewTOCMessage

func NewTOCMessage(src interface{}, toc *TOC, updated bool) *Message

NewTOCMessage creates a new TOC message. The message is posted by elements that discovered or updated a TOC.

func NewTagMessage

func NewTagMessage(src interface{}, tagList *TagList) *Message

NewTagMessage creates a new tag message. The message will take ownership of the tag list. The message is posted by elements that discovered a new taglist.

func NewWarningMessage

func NewWarningMessage(src interface{}, msg string, debugStr string, structure *Structure) *Message

NewWarningMessage creates a new warning message. Structure can be nil.

func ToGstMessage

func ToGstMessage(msg unsafe.Pointer) *Message

ToGstMessage converts the given pointer into a Message without affecting the ref count or placing finalizers.

func (*Message) AddRedirectEntry

func (m *Message) AddRedirectEntry(location string, tagList *TagList, entryStructure *Structure)

AddRedirectEntry creates and appends a new entry to the message.

func (*Message) Copy

func (m *Message) Copy() *Message

Copy will copy this object into a new Message.

func (*Message) GetStructure

func (m *Message) GetStructure() *Structure

GetStructure returns the GstStructure of this message, using the type of the message to determine the method to use. The returned structure must not be freed.

func (*Message) Instance

func (m *Message) Instance() *C.GstMessage

Instance returns the underlying GstMessage object.

func (*Message) NumRedirectEntries

func (m *Message) NumRedirectEntries() int64

NumRedirectEntries returns the number of redirect entries in a MessageRedirect.

func (*Message) ParseAsyncDone

func (m *Message) ParseAsyncDone() ClockTime

ParseAsyncDone extracts the running time from the async task done message.

func (*Message) ParseBuffering

func (m *Message) ParseBuffering() int

ParseBuffering extracts the buffering percent from the GstMessage.

func (*Message) ParseBufferingStats

func (m *Message) ParseBufferingStats() *BufferingStats

ParseBufferingStats extracts the buffering stats values from message.

func (*Message) ParseClockProvide

func (m *Message) ParseClockProvide() (clock *Clock, ready bool)

ParseClockProvide extracts the clock and ready flag from the GstMessage. The clock object returned remains valid until the message is freed.

func (*Message) ParseDeviceAdded

func (m *Message) ParseDeviceAdded() *Device

ParseDeviceAdded parses a device-added message. The device-added message is produced by GstDeviceProvider or a GstDeviceMonitor. It announces the appearance of monitored devices.

func (*Message) ParseDeviceChanged

func (m *Message) ParseDeviceChanged() (newDevice, oldDevice *Device)

ParseDeviceChanged Parses a device-changed message. The device-changed message is produced by GstDeviceProvider or a GstDeviceMonitor. It announces that a device's properties have changed. The first device returned is the updated Device, and the second changedDevice represents the old state of the device.

func (*Message) ParseDeviceRemoved

func (m *Message) ParseDeviceRemoved() *Device

ParseDeviceRemoved parses a device-removed message. The device-removed message is produced by GstDeviceProvider or a GstDeviceMonitor. It announces the disappearance of monitored devices.

func (*Message) ParseError

func (m *Message) ParseError() *GError

ParseError will return a GError from the contents of this message. This will only work if the GstMessageType is `GST_MESSAGE_ERROR`.

func (*Message) ParseHaveContext

func (m *Message) ParseHaveContext() *Context

ParseHaveContext parses the context from a HaveContext message.

func (*Message) ParseInfo

func (m *Message) ParseInfo() *GError

ParseInfo is identical to ParseError. The returned types are the same. However, this is intended for use with GstMessageType `GST_MESSAGE_INFO`.

func (*Message) ParseNewClock

func (m *Message) ParseNewClock() *Clock

ParseNewClock parses the new Clock in the message. The clock object returned remains valid until the message is freed.

func (*Message) ParseProgress

func (m *Message) ParseProgress() (progressType ProgressType, code, text string)

ParseProgress parses the progress type, code and text.

func (*Message) ParsePropertyNotify

func (m *Message) ParsePropertyNotify() (obj *Object, propertName string, propertyValue *glib.Value)

ParsePropertyNotify parses a property-notify message. These will be posted on the bus only when set up with Element.AddPropertyNotifyWatch (TODO) or Element.AddPropertyDeepNotifyWatch (TODO).

func (*Message) ParseQoS

func (m *Message) ParseQoS() *QoSValues

ParseQoS extracts the timestamps and live status from the QoS message. The values reflect those of the dropped buffer. Values of ClockTimeNone or -1 mean unknown values.

func (*Message) ParseRedirectEntryAt

func (m *Message) ParseRedirectEntryAt(idx int64) (location string, tags *TagList, structure *Structure)

ParseRedirectEntryAt parses the redirect entry at the given index. Total indices can be retrieved with NumRedirectEntries().

func (*Message) ParseRequestState

func (m *Message) ParseRequestState() State

ParseRequestState parses the requests state from the message.

func (*Message) ParseResetTime

func (m *Message) ParseResetTime() ClockTime

ParseResetTime extracts the running-time from the ResetTime message.

func (*Message) ParseSegmentDone

func (m *Message) ParseSegmentDone() (Format, int64)

ParseSegmentDone extracts the position and format of the SegmentDone message.

func (*Message) ParseSegmentStart

func (m *Message) ParseSegmentStart() (Format, int64)

ParseSegmentStart extracts the position and format of the SegmentStart message.

func (*Message) ParseStateChanged

func (m *Message) ParseStateChanged() (oldState, newState State)

ParseStateChanged will return the old and new states as Go strings. This will only work if the GstMessageType is `GST_MESSAGE_STATE_CHANGED`.

func (*Message) ParseStepDone

func (m *Message) ParseStepDone() *StepDoneValues

ParseStepDone extracts the values for the StepDone message.

func (*Message) ParseStepStart

func (m *Message) ParseStepStart() *StepStartValues

ParseStepStart extracts the values for the StepStart message.

func (*Message) ParseStreamCollection

func (m *Message) ParseStreamCollection() *StreamCollection

ParseStreamCollection parses a stream-collection message.

func (*Message) ParseStreamStatus

func (m *Message) ParseStreamStatus() (StreamStatusType, *Element)

ParseStreamStatus parses the stream status type of the message as well as the element that produced it.

func (*Message) ParseStreamsSelected

func (m *Message) ParseStreamsSelected() *StreamCollection

ParseStreamsSelected parses a streams-selected message.

func (*Message) ParseStructureChange

func (m *Message) ParseStructureChange() (chgType StructureChangeType, owner *Element, busy bool)

ParseStructureChange extracts the change type and completion status from the GstMessage. If the returned bool is true, the change is still in progress.

func (*Message) ParseTOC

func (m *Message) ParseTOC() (toc *TOC, updated bool)

ParseTOC extracts the TOC from the GstMessage. The TOC returned in the output argument is a copy.

func (*Message) ParseTags

func (m *Message) ParseTags() *TagList

ParseTags extracts the tag list from the GstMessage. Tags are copied.

func (*Message) ParseWarning

func (m *Message) ParseWarning() *GError

ParseWarning is identical to ParseError. The returned types are the same. However, this is intended for use with GstMessageType `GST_MESSAGE_WARNING`.

func (*Message) Ref

func (m *Message) Ref() *Message

Ref will increase the ref count on this message. This increases the total amount of times Unref needs to be called before the object is freed from memory. It returns the underlying message object for convenience.

func (*Message) Source

func (m *Message) Source() string

Source returns the source of the message.

func (*Message) StreamsSelectedAdd

func (m *Message) StreamsSelectedAdd(stream *Stream)

StreamsSelectedAdd adds the stream to the message

func (*Message) StreamsSelectedGetStream

func (m *Message) StreamsSelectedGetStream(index uint) *Stream

StreamsSelectedGetStream retrieves the Stream with index index from the message.

func (*Message) StreamsSelectedSize

func (m *Message) StreamsSelectedSize() uint

StreamsSelectedSize returns the number of streams contained in the message.

func (*Message) String

func (m *Message) String() string

String implements a stringer on the message. It iterates over the type of the message and applies the correct parser, then dumps a string of the basic contents of the message. This function can be expensive and should only be used for debugging purposes or in routines where latency is not a concern.

This stringer really just helps in keeping track of making sure all message types are accounted for in some way. It's the devil, writing it was the devil, and I hope you enjoy being able to `fmt.Println(msg)`.

func (*Message) Type

func (m *Message) Type() MessageType

Type returns the MessageType of the message.

func (*Message) TypeName

func (m *Message) TypeName() string

TypeName returns a Go string of the GstMessageType name.

func (*Message) Unref

func (m *Message) Unref()

Unref will call `gst_message_unref` on the underlying GstMessage, freeing it from memory.

type MessageType

type MessageType int

MessageType is an alias to the C equivalent of GstMessageType. See the official documentation for definitions of the messages: https://gstreamer.freedesktop.org/documentation/gstreamer/gstmessage.html?gi-language=c#GstMessageType

const (
	MessageUnknown          MessageType = C.GST_MESSAGE_UNKNOWN
	MessageEOS              MessageType = C.GST_MESSAGE_EOS
	MessageError            MessageType = C.GST_MESSAGE_ERROR
	MessageWarning          MessageType = C.GST_MESSAGE_WARNING
	MessageInfo             MessageType = C.GST_MESSAGE_INFO
	MessageTag              MessageType = C.GST_MESSAGE_TAG
	MessageBuffering        MessageType = C.GST_MESSAGE_BUFFERING
	MessageStateChanged     MessageType = C.GST_MESSAGE_STATE_CHANGED
	MessageStateDirty       MessageType = C.GST_MESSAGE_STATE_DIRTY
	MessageStepDone         MessageType = C.GST_MESSAGE_STEP_DONE
	MessageClockProvide     MessageType = C.GST_MESSAGE_CLOCK_PROVIDE
	MessageClockLost        MessageType = C.GST_MESSAGE_CLOCK_LOST
	MessageNewClock         MessageType = C.GST_MESSAGE_NEW_CLOCK
	MessageStructureChange  MessageType = C.GST_MESSAGE_STRUCTURE_CHANGE
	MessageStreamStatus     MessageType = C.GST_MESSAGE_STREAM_STATUS
	MessageApplication      MessageType = C.GST_MESSAGE_APPLICATION
	MessageElement          MessageType = C.GST_MESSAGE_ELEMENT
	MessageSegmentStart     MessageType = C.GST_MESSAGE_SEGMENT_START
	MessageSegmentDone      MessageType = C.GST_MESSAGE_SEGMENT_DONE
	MessageDurationChanged  MessageType = C.GST_MESSAGE_DURATION_CHANGED
	MessageLatency          MessageType = C.GST_MESSAGE_LATENCY
	MessageAsyncStart       MessageType = C.GST_MESSAGE_ASYNC_START
	MessageAsyncDone        MessageType = C.GST_MESSAGE_ASYNC_DONE
	MessageRequestState     MessageType = C.GST_MESSAGE_REQUEST_STATE
	MessageStepStart        MessageType = C.GST_MESSAGE_STEP_START
	MessageQoS              MessageType = C.GST_MESSAGE_QOS
	MessageProgress         MessageType = C.GST_MESSAGE_PROGRESS
	MessageTOC              MessageType = C.GST_MESSAGE_TOC
	MessageResetTime        MessageType = C.GST_MESSAGE_RESET_TIME
	MessageStreamStart      MessageType = C.GST_MESSAGE_STREAM_START
	MessageNeedContext      MessageType = C.GST_MESSAGE_NEED_CONTEXT
	MessageHaveContext      MessageType = C.GST_MESSAGE_HAVE_CONTEXT
	MessageExtended         MessageType = C.GST_MESSAGE_EXTENDED
	MessageDeviceAdded      MessageType = C.GST_MESSAGE_DEVICE_ADDED
	MessageDeviceRemoved    MessageType = C.GST_MESSAGE_DEVICE_REMOVED
	MessagePropertyNotify   MessageType = C.GST_MESSAGE_PROPERTY_NOTIFY
	MessageStreamCollection MessageType = C.GST_MESSAGE_STREAM_COLLECTION
	MessageStreamsSelected  MessageType = C.GST_MESSAGE_STREAMS_SELECTED
	MessageRedirect         MessageType = C.GST_MESSAGE_REDIRECT
	MessageDeviceChanged    MessageType = C.GST_MESSAGE_DEVICE_CHANGED
	MessageAny              MessageType = C.GST_MESSAGE_ANY
)

Type casting of GstMessageTypes See the official documentation for definitions of the messages: https://gstreamer.freedesktop.org/documentation/gstreamer/gstmessage.html?gi-language=c#GstMessageType

func (MessageType) String

func (m MessageType) String() string

String implements a stringer on MessageTypes

type Meta

type Meta struct {
	// contains filtered or unexported fields
}

Meta is a go representation of GstMeta.

func FromGstMetaUnsafe

func FromGstMetaUnsafe(ptr unsafe.Pointer) *Meta

FromGstMetaUnsafe wraps the pointer to the given C GstMeta with the go type. This is meant for internal usage and is exported for visibility to other packages.

func (*Meta) Flags

func (m *Meta) Flags() MetaFlags

Flags returns the flags on this Meta instance.

func (*Meta) Info

func (m *Meta) Info() *MetaInfo

Info returns the extra info with this metadata.

func (*Meta) Instance

func (m *Meta) Instance() *C.GstMeta

Instance returns the underlying GstMeta instance.

func (*Meta) SetFlags

func (m *Meta) SetFlags(flags MetaFlags)

SetFlags sets the flags on this Meta instance.

func (*Meta) SetInfo

func (m *Meta) SetInfo(info *MetaInfo)

SetInfo sets the info on this metadata.

type MetaFlags

type MetaFlags int

MetaFlags casts C GstMetaFlags to a go type.

const (
	MetaFlagNone     MetaFlags = C.GST_META_FLAG_NONE     // (0) – no flags
	MetaFlagReadOnly MetaFlags = C.GST_META_FLAG_READONLY // (1) – metadata should not be modified
	MetaFlagPooled   MetaFlags = C.GST_META_FLAG_POOLED   // (2) – metadata is managed by a bufferpool
	MetaFlagLocked   MetaFlags = C.GST_META_FLAG_LOCKED   // (4) – metadata should not be removed
	MetaFlagLast     MetaFlags = C.GST_META_FLAG_LAST     // (65536) – additional flags can be added starting from this flag.
)

Type casts of GstMetaFlags

type MetaFreeFunc

type MetaFreeFunc func(buffer *Buffer)

MetaFreeFunc is a function called when meta is freed in buffer.

type MetaInfo

type MetaInfo struct {
	// contains filtered or unexported fields
}

MetaInfo is a go representation of GstMetaInfo

func FromGstMetaInfoUnsafe

func FromGstMetaInfoUnsafe(ptr unsafe.Pointer) *MetaInfo

FromGstMetaInfoUnsafe wraps the given unsafe pointer in a MetaInfo instance.

func GetAPIInfo

func GetAPIInfo(name string) *MetaInfo

GetAPIInfo gets the MetaInfo for the given api type.

func GetProtectionMetaInfo

func GetProtectionMetaInfo() *MetaInfo

GetProtectionMetaInfo retrieves global ProtectionMetaInfo.

func RegisterMeta

func RegisterMeta(api glib.Type, name string, size int64, cbFuncs *MetaInfoCallbackFuncs) *MetaInfo

RegisterMeta registers and returns a new MetaInfo instance denoting the given type, name, and size.

func (*MetaInfo) API

func (m *MetaInfo) API() glib.Type

API returns the tag identifying the metadata structure and api.

func (*MetaInfo) Instance

func (m *MetaInfo) Instance() *C.GstMetaInfo

Instance returns the underlying GstMetaInfo instance.

func (*MetaInfo) SetAPI

func (m *MetaInfo) SetAPI(t glib.Type)

SetAPI sets the API tag identifying the metadata structure and api.

func (*MetaInfo) SetSize

func (m *MetaInfo) SetSize(size int64)

SetSize sets the size on the metadata.

func (*MetaInfo) SetType

func (m *MetaInfo) SetType(t glib.Type)

SetType sets the type identifying the implementor of the api.

func (*MetaInfo) Size

func (m *MetaInfo) Size() int64

Size returns the size of the metadata.

func (*MetaInfo) Type

func (m *MetaInfo) Type() glib.Type

Type returns the type identifying the implementor of the api.

type MetaInfoCallbackFuncs

type MetaInfoCallbackFuncs struct {
	InitFunc      MetaInitFunc
	FreeFunc      MetaFreeFunc
	TransformFunc MetaTransformFunc
}

MetaInfoCallbackFuncs represents callback functions to include when registering a new meta type.

type MetaInitFunc

type MetaInitFunc func(params interface{}, buffer *Buffer) bool

MetaInitFunc is a function called when meta is initialized in buffer.

type MetaTransformCopy

type MetaTransformCopy struct {
	// true if only region is copied
	Region bool
	// the offset to copy, 0 if region is FALSE, otherwise > 0
	Offset int64
	// the size to copy, -1 or the buffer size when region is FALSE
	Size int64
}

MetaTransformCopy is extra data passed to a MetaTransformFunc

type MetaTransformFunc

type MetaTransformFunc func(transBuf, buf *Buffer, mType string, data *MetaTransformCopy) bool

MetaTransformFunc is a function called for each meta in buf as a result of performing a transformation on transbuf. Additional type specific transform data is passed to the function as data.

type MiniObject

type MiniObject struct {
	// contains filtered or unexported fields
}

MiniObject is an opaque struct meant to form the base of gstreamer classes extending the GstMiniObject. This object is a WIP and is intended primarily for forming the base of extending classes.

func NewMiniObject

func NewMiniObject(flags MiniObjectFlags, gtype glib.Type) *MiniObject

NewMiniObject initializes a new mini object with the desired flags, types, and callbacks. If you don't need any callbacks you can specify nil. TODO: This is more for reference and is not fully implemented.

func (*MiniObject) AddParent

func (m *MiniObject) AddParent(parent *MiniObject)

AddParent adds the given object as a parent of this object. See https://gstreamer.freedesktop.org/documentation/gstreamer/gstminiobject.html?gi-language=c#gst_mini_object_add_parent.

func (*MiniObject) Copy

func (m *MiniObject) Copy() *MiniObject

Copy creates a copy of this object.

func (*MiniObject) GetData

func (m *MiniObject) GetData(name string) unsafe.Pointer

GetData returns the userdata pointer associated with this object at the given key, or nil if none exists.

func (*MiniObject) Instance

func (m *MiniObject) Instance() *C.GstMiniObject

Instance returns the native GstMiniObject instance.

func (*MiniObject) Parent

func (m *MiniObject) Parent() *MiniObject

Parent returns the parent of this MiniObject

func (*MiniObject) Ref

func (m *MiniObject) Ref()

Ref increases the ref count on this object by one.

func (*MiniObject) SetData

func (m *MiniObject) SetData(name string, ptr unsafe.Pointer)

SetData sets a userdata pointer associated with this object at the given key, Use nil to delete an existing key.

func (*MiniObject) Type

func (m *MiniObject) Type() glib.Type

Type returns the type of this mini object.

func (*MiniObject) Unref

func (m *MiniObject) Unref()

Unref decreases the ref count on this object by one.

type MiniObjectFlags

type MiniObjectFlags int

MiniObjectFlags casts GstMiniObjectFlags to a go type.

const (
	MiniObjectFlagLockable     MiniObjectFlags = C.GST_MINI_OBJECT_FLAG_LOCKABLE      // (1) – the object can be locked and unlocked with gst_mini_object_lock and gst_mini_object_unlock.
	MiniObjectFlagLockReadOnly MiniObjectFlags = C.GST_MINI_OBJECT_FLAG_LOCK_READONLY // (2) – the object is permanently locked in READONLY mode. Only read locks can be performed on the object.
	MiniObjectFlagMayBeLeaked  MiniObjectFlags = C.GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED // (4) – the object is expected to stay alive even after gst_deinit has been called and so should be ignored by leak detection tools. (Since: 1.10)
	MiniObjectFlagLast         MiniObjectFlags = C.GST_MINI_OBJECT_FLAG_LAST          // (16) – first flag that can be used by subclasses.
)

Type casting of mini-object flags

type Object

type Object struct{ *glib.InitiallyUnowned }

Object is a go representation of a GstObject.

func FromGstObjectUnsafeFull

func FromGstObjectUnsafeFull(ptr unsafe.Pointer) *Object

FromGstObjectUnsafeFull returns an Object wrapping the given pointer. It meant for internal usage and exported for visibility to other packages.

func FromGstObjectUnsafeNone

func FromGstObjectUnsafeNone(ptr unsafe.Pointer) *Object

FromGstObjectUnsafeNone returns an Object wrapping the given pointer. It meant for internal usage and exported for visibility to other packages.

func (*Object) AddControlBinding

func (o *Object) AddControlBinding(binding *ControlBinding)

func (*Object) BaseObject

func (o *Object) BaseObject() *Object

BaseObject is a convenience method for retrieving this object from embedded structs.

func (*Object) Clear

func (o *Object) Clear()

Clear will will clear all references to this object. If the reference is already null the the function does nothing. Otherwise the reference count is decreased and the pointer set to null.

func (*Object) GObject

func (o *Object) GObject() *glib.Object

GObject returns the underlying GObject instance.

func (*Object) GetName

func (o *Object) GetName() string

GetName returns the name of this object.

func (*Object) GetValue

func (o *Object) GetValue(property string, timestamp ClockTime) *glib.Value

GetValue retrieves the value for the given controlled property at the given timestamp.

func (*Object) GstObject

func (o *Object) GstObject() *C.GstObject

GstObject is an alias to Instance on the underlying GstObject of any extending struct.

func (*Object) Instance

func (o *Object) Instance() *C.GstObject

Instance returns the native C GstObject.

func (*Object) Log

func (o *Object) Log(cat *DebugCategory, level DebugLevel, message string)

Log logs a message to the given category from this object using the currently registered debugging handlers.

func (*Object) Ref

func (o *Object) Ref() *Object

Ref increments the reference count on object. This function does not take the lock on object because it relies on atomic refcounting. For convenience the same object is returned.

func (*Object) SetArg

func (o *Object) SetArg(name, value string)

SetArg sets the argument name to value on this object. Note that function silently returns if object has no property named name or when value cannot be converted to the type for this property.

func (*Object) Unref

func (o *Object) Unref()

Unref decrements the reference count on object. If reference count hits zero, destroy object. This function does not take the lock on object as it relies on atomic refcounting.

type Pad

type Pad struct{ *Object }

Pad is a go representation of a GstPad

func FromGstPadUnsafeFull

func FromGstPadUnsafeFull(pad unsafe.Pointer) *Pad

FromGstPadUnsafeFull wraps the given pad in a reference and finalizer.

func FromGstPadUnsafeNone

func FromGstPadUnsafeNone(pad unsafe.Pointer) *Pad

FromGstPadUnsafeNone wraps the given pad in a finalizer.

func NewPad

func NewPad(name string, direction PadDirection) *Pad

NewPad returns a new pad with the given direction. If name is empty, one will be generated for you.

func NewPadFromTemplate

func NewPadFromTemplate(tmpl *PadTemplate, name string) *Pad

NewPadFromTemplate creates a new pad with the given name from the given template. If name is empty, one will be generated for you.

func (*Pad) ActivateMode

func (p *Pad) ActivateMode(mode PadMode, active bool)

ActivateMode activates or deactivates the given pad in mode via dispatching to the pad's activatemodefunc. For use from within pad activation functions only.

If you don't know what this is, you probably don't want to call it.

func (*Pad) AddProbe

func (p *Pad) AddProbe(mask PadProbeType, f PadProbeCallback) uint64

AddProbe adds a callback to be notified of different states of pads. The provided callback is called for every state that matches mask.

Probes are called in groups: First GST_PAD_PROBE_TYPE_BLOCK probes are called, then others, then finally GST_PAD_PROBE_TYPE_IDLE. The only exception here are GST_PAD_PROBE_TYPE_IDLE probes that are called immediately if the pad is already idle while calling gst_pad_add_probe. In each of the groups, probes are called in the order in which they were added.

A probe ID is returned that can be used to remove the probe.

func (p *Pad) CanLink(sink *Pad) bool

CanLink checks if this pad is compatible with the given sink pad.

func (*Pad) Chain

func (p *Pad) Chain(buffer *Buffer) FlowReturn

Chain a buffer to pad.

The function returns FlowFlushing if the pad was flushing.

If the buffer type is not acceptable for pad (as negotiated with a preceding EventCaps event), this function returns FlowNotNegotiated.

The function proceeds calling the chain function installed on pad (see SetChainFunction) and the return value of that function is returned to the caller. FlowNotSupported is returned if pad has no chain function.

In all cases, success or failure, the caller loses its reference to buffer after calling this function.

func (*Pad) ChainList

func (p *Pad) ChainList(bufferList *BufferList) FlowReturn

ChainList chains a bufferlist to pad.

The function returns FlowFlushing if the pad was flushing.

If pad was not negotiated properly with a CAPS event, this function returns FlowNotNegotiated.

The function proceeds calling the chainlist function installed on pad (see SetChainListFunction) and the return value of that function is returned to the caller. FlowNotSupported is returned if pad has no chainlist function.

In all cases, success or failure, the caller loses its reference to list after calling this function.

func (*Pad) CheckReconfigure

func (p *Pad) CheckReconfigure() bool

CheckReconfigure checks and clear the PadFlagNeedReconfigure flag on pad and return TRUE if the flag was set.

func (*Pad) CreateStreamID

func (p *Pad) CreateStreamID(parent *Element, streamID string) string

CreateStreamID creates a stream-id for the source GstPad pad by combining the upstream information with the optional stream_id of the stream of pad. Pad must have a parent GstElement and which must have zero or one sinkpad. stream_id can only be NULL if the parent element of pad has only a single source pad.

This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending stream_id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.

Since stream IDs are sorted alphabetically, any numbers in the stream ID should be printed with a fixed number of characters, preceded by 0's, such as by using the format %03u instead of %u.

func (*Pad) CurrentCaps

func (p *Pad) CurrentCaps() *Caps

CurrentCaps returns the caps for this Pad or nil.

func (*Pad) Direction

func (p *Pad) Direction() PadDirection

Direction returns the direction of this pad.

func (*Pad) EventDefault

func (p *Pad) EventDefault(parent *Object, event *Event) bool

EventDefault invokes the default event handler for the given pad.

The EOS event will pause the task associated with pad before it is forwarded to all internally linked pads,

The event is sent to all pads internally linked to pad. This function takes ownership of event.

func (*Pad) Forward

func (p *Pad) Forward(f PadForwardFunc) bool

Forward calls the given function for all internally linked pads of pad. This function deals with dynamically changing internal pads and will make sure that the forward function is only called once for each pad.

When forward returns TRUE, no further pads will be processed.

func (*Pad) GetAllowedCaps

func (p *Pad) GetAllowedCaps() *Caps

GetAllowedCaps getss the capabilities of the allowed media types that can flow through pad and its peer.

The allowed capabilities is calculated as the intersection of the results of calling QueryCaps on pad and its peer. The caller owns a reference on the resulting caps.

func (*Pad) GetCurrentCaps

func (p *Pad) GetCurrentCaps() *Caps

GetCurrentCaps gets the capabilities currently configured on pad with the last EventCaps event.

func (*Pad) GetDirection

func (p *Pad) GetDirection() PadDirection

GetDirection gets the direction of the pad. The direction of the pad is decided at construction time so this function does not take the LOCK.

func (*Pad) GetElementPrivate

func (p *Pad) GetElementPrivate() interface{}

GetElementPrivate gets the private data of a pad. No locking is performed in this function.

func (p *Pad) GetInternalLinks() ([]*Pad, error)

GetInternalLinks gets the pads to which the given pad is linked to inside of the parent element.

func (*Pad) GetInternalLinksDefault

func (p *Pad) GetInternalLinksDefault(parent *Object) ([]*Pad, error)

GetInternalLinksDefault gets the list of pads to which the given pad is linked to inside of the parent element. This is the default handler, and thus returns all of the pads inside the parent element with opposite direction.

func (*Pad) GetLastFlowReturn

func (p *Pad) GetLastFlowReturn() FlowReturn

GetLastFlowReturn gets the FlowReturn return from the last data passed by this pad.

func (*Pad) GetOffset

func (p *Pad) GetOffset() int64

GetOffset gets the offset applied to the running time of pad. pad has to be a source pad.

func (*Pad) GetPadTemplate

func (p *Pad) GetPadTemplate() *PadTemplate

GetPadTemplate gets the template for this pad.

func (*Pad) GetPadTemplateCaps

func (p *Pad) GetPadTemplateCaps() *Caps

GetPadTemplateCaps gets the capabilities for pad's template.

func (*Pad) GetParentElement

func (p *Pad) GetParentElement() *Element

GetParentElement gets the parent of pad, cast to a Element. If a pad has no parent or its parent is not an element, return nil.

func (*Pad) GetPeer

func (p *Pad) GetPeer() *Pad

GetPeer gets the peer of pad.

func (*Pad) GetRange

func (p *Pad) GetRange(offset uint64, size uint, buffer *Buffer) (FlowReturn, *Buffer)

GetRange calls the getrange function of pad, see PadGetRangeFunc for a description of a getrange function. If pad has no getrange function installed (see SetGetRangeFunction) this function returns FlowNotSupported.

If buffer points to a variable holding nil, a valid new GstBuffer will be placed in buffer when this function returns FlowOK. The new buffer must be freed with

When buffer points to a variable that points to a valid Buffer, the buffer will be filled with the result data when this function returns FlowOK. If the provided buffer is larger than size, only size bytes will be filled in the result buffer and its size will be updated accordingly.

Note that less than size bytes can be returned in buffer when, for example, an EOS condition is near or when buffer is not large enough to hold size bytes. The caller should check the result buffer size to get the result size.

When this function returns any other result value than FlowOK, buffer will be unchanged.

This is a lowlevel function. Usually PullRange is used.

func (*Pad) GetStickyEvent

func (p *Pad) GetStickyEvent(eventType EventType, idx uint) *Event

GetStickyEvent returns a new reference of the sticky event of type event_type from the event.

func (*Pad) GetStream

func (p *Pad) GetStream() *Stream

GetStream returns the current Stream for the pad, or nil if none has been set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around GetStickyEvent and Event ParseStream.

func (*Pad) GetStreamID

func (p *Pad) GetStreamID() string

GetStreamID returns the current stream-id for the pad, or an empty string if none has been set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around gst_pad_get_sticky_event and gst_event_parse_stream_start.

The returned stream-id string should be treated as an opaque string, its contents should not be interpreted.

func (*Pad) GetTaskState

func (p *Pad) GetTaskState() TaskState

GetTaskState gets the pad task state. If no task is currently set, TaskStopped is returned.

func (*Pad) HasCurrentCaps

func (p *Pad) HasCurrentCaps() bool

HasCurrentCaps checks if pad has caps set on it with a GST_EVENT_CAPS event.

func (*Pad) Instance

func (p *Pad) Instance() *C.GstPad

Instance returns the underlying C GstPad.

func (*Pad) IsActive

func (p *Pad) IsActive() bool

IsActive queries if a pad is active

func (*Pad) IsBlocked

func (p *Pad) IsBlocked() bool

IsBlocked checks if the pad is blocked or not. This function returns the last requested state of the pad. It is not certain that the pad is actually blocking at this point (see IsBlocking).

func (*Pad) IsBlocking

func (p *Pad) IsBlocking() bool

IsBlocking checks if the pad is blocking or not. This is a guaranteed state of whether the pad is actually blocking on a GstBuffer or a GstEvent.

func (*Pad) IsLinked

func (p *Pad) IsLinked() bool

IsLinked checks if a pad is linked to another pad or not.

func (p *Pad) Link(sink *Pad) PadLinkReturn

Link links a sink pad to this source pad.

func (*Pad) LinkFull

func (p *Pad) LinkFull(sink *Pad, flags PadLinkCheck) PadLinkReturn

LinkFull links this source pad and the sink pad.

This variant of Link provides a more granular control on the checks being done when linking. While providing some considerable speedups the caller of this method must be aware that wrong usage of those flags can cause severe issues. Refer to the documentation of GstPadLinkCheck for more information.

func (*Pad) LinkMaybeGhosting

func (p *Pad) LinkMaybeGhosting(sink *Pad) bool

LinkMaybeGhosting links this src to sink, creating any GstGhostPad's in between as necessary.

This is a convenience function to save having to create and add intermediate GstGhostPad's as required for linking across GstBin boundaries.

If src or sink pads don't have parent elements or do not share a common ancestor, the link will fail.

func (*Pad) LinkMaybeGhostingFull

func (p *Pad) LinkMaybeGhostingFull(sink *Pad, flags PadLinkCheck) bool

LinkMaybeGhostingFull links this src to sink, creating any GstGhostPad's in between as necessary.

This is a convenience function to save having to create and add intermediate GstGhostPad's as required for linking across GstBin boundaries.

If src or sink pads don't have parent elements or do not share a common ancestor, the link will fail.

Calling LinkMaybeGhostingFull with flags == PadLinkCheckDefault is the recommended way of linking pads with safety checks applied.

func (*Pad) MarkReconfigure

func (p *Pad) MarkReconfigure()

MarkReconfigure marks this pad for needing reconfiguration. The next call to CheckReconfigure will return TRUE after this call.

func (*Pad) NeedsReconfigure

func (p *Pad) NeedsReconfigure() bool

NeedsReconfigure checks the GST_PAD_FLAG_NEED_RECONFIGURE flag on pad and return TRUE if the flag was set.

func (*Pad) PauseTask

func (p *Pad) PauseTask() bool

PauseTask pauses the task of pad. This function will also wait until the function executed by the task is finished if this function is not called from the task function.

func (*Pad) PeerQuery

func (p *Pad) PeerQuery(query *Query) bool

PeerQuery performs PadQuery on the peer of pad.

The caller is responsible for both the allocation and deallocation of the query structure.

func (*Pad) PeerQueryAcceptCaps

func (p *Pad) PeerQueryAcceptCaps(caps *Caps) bool

PeerQueryAcceptCaps checks if the peer of pad accepts caps. If pad has no peer, this function returns TRUE.

func (*Pad) PeerQueryCaps

func (p *Pad) PeerQueryCaps(filter *Caps) *Caps

PeerQueryCaps gets the capabilities of the peer connected to this pad. Similar to QueryCaps.

When called on srcpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on sinkpads filter contains the caps accepted by downstream in the preferred order. filter might be nil but if it is not nil the returned caps will be a subset of filter.

func (*Pad) PeerQueryConvert

func (p *Pad) PeerQueryConvert(srcFormat, destFormat Format, srcVal int64) (bool, int64)

PeerQueryConvert queries the peer pad of a given sink pad to convert src_val in src_format to dest_format.

func (*Pad) PeerQueryDuration

func (p *Pad) PeerQueryDuration(format Format) (bool, int64)

PeerQueryDuration queries the peer pad of a given sink pad for the total stream duration.

func (*Pad) PeerQueryPosition

func (p *Pad) PeerQueryPosition(format Format) (bool, int64)

PeerQueryPosition queries the peer of a given sink pad for the stream position.

func (*Pad) ProxyQueryAcceptCaps

func (p *Pad) ProxyQueryAcceptCaps(query *Query) bool

ProxyQueryAcceptCaps checks if all internally linked pads of pad accepts the caps in query and returns the intersection of the results.

This function is useful as a default accept caps query function for an element that can handle any stream format, but requires caps that are acceptable for all opposite pads.

func (*Pad) ProxyQueryCaps

func (p *Pad) ProxyQueryCaps(query *Query) bool

ProxyQueryCaps calls QueryCaps for all internally linked pads of pad and returns the intersection of the results.

This function is useful as a default caps query function for an element that can handle any stream format, but requires all its pads to have the same caps. Two such elements are tee and adder.

func (*Pad) PullRange

func (p *Pad) PullRange(offset uint64, size uint, buffer *Buffer) (FlowReturn, *Buffer)

PullRange pulls a buffer from the peer pad or fills up a provided buffer.

This function will first trigger the pad block signal if it was installed.

When pad is not linked GST_FLOW_NOT_LINKED is returned else this function returns the result of GetRange on the peer pad. See GetRange for a list of return values and for the semantics of the arguments of this function.

If buffer points to a variable holding nil, a valid new GstBuffer will be placed in buffer when this function returns GST_FLOW_OK. The new buffer must be freed with When this function returns any other result value, buffer will still point to NULL.

When buffer points to a variable that points to a valid GstBuffer, the buffer will be filled with the result data when this function returns GST_FLOW_OK. When this function returns any other result value, buffer will be unchanged. If the provided buffer is larger than size, only size bytes will be filled in the result buffer and its size will be updated accordingly.

Note that less than size bytes can be returned in buffer when, for example, an EOS condition is near or when buffer is not large enough to hold size bytes. The caller should check the result buffer size to get the result size.

func (*Pad) Push

func (p *Pad) Push(buf *Buffer) FlowReturn

Push pushes a buffer to the peer of pad.

This function will call installed block probes before triggering any installed data probes.

The function proceeds calling Chain on the peer pad and returns the value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will be returned.

In all cases, success or failure, the caller loses its reference to buffer after calling this function.

func (*Pad) PushEvent

func (p *Pad) PushEvent(ev *Event) bool

PushEvent sends the event to the peer of the given pad. This function is mainly used by elements to send events to their peer elements.

This function takes ownership of the provided event so you should Ref it if you want to reuse the event after this call.

func (*Pad) PushList

func (p *Pad) PushList(bufList *BufferList) FlowReturn

PushList pushes a buffer list to the peer of pad.

This function will call installed block probes before triggering any installed data probes.

The function proceeds calling the chain function on the peer pad and returns the value from that function. If pad has no peer, GST_FLOW_NOT_LINKED will be returned. If the peer pad does not have any installed chainlist function every group buffer of the list will be merged into a normal GstBuffer and chained via Chain.

In all cases, success or failure, the caller loses its reference to list after calling this function.

func (*Pad) Query

func (p *Pad) Query(query *Query) bool

Query dispatches a query to a pad. The query should have been allocated by the caller via one of the type-specific allocation functions. The element that the pad belongs to is responsible for filling the query with an appropriate response, which should then be parsed with a type-specific query parsing function.

Again, the caller is responsible for both the allocation and deallocation of the query structure.

Please also note that some queries might need a running pipeline to work.

func (*Pad) QueryAcceptCaps

func (p *Pad) QueryAcceptCaps(caps *Caps) bool

QueryAcceptCaps checks if the given pad accepts the caps.

func (*Pad) QueryCaps

func (p *Pad) QueryCaps(filter *Caps) *Caps

QueryCaps gets the capabilities this pad can produce or consume. Note that this method doesn't necessarily return the caps set by sending a NewCapsEvent - use GetCurrentCaps for that instead. QueryCaps returns all possible caps a pad can operate with, using the pad's CAPS query function, If the query fails, this function will return filter, if not NULL, otherwise ANY.

When called on sinkpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on srcpads filter contains the caps accepted by downstream in the preferred order. filter might be NULL but if it is not NULL the returned caps will be a subset of filter.

Note that this function does not return writable GstCaps, use gst_caps_make_writable before modifying the caps.

func (*Pad) QueryConvert

func (p *Pad) QueryConvert(srcFormat, destFormat Format, srcVal int64) (bool, int64)

QueryConvert queries a pad to convert src_val in src_format to dest_format.

func (*Pad) QueryDefault

func (p *Pad) QueryDefault(parent *Object, query *Query) bool

QueryDefault invokes the default query handler for the given pad. The query is sent to all pads internally linked to pad. Note that if there are many possible sink pads that are internally linked to pad, only one will be sent the query. Multi-sinkpad elements should implement custom query handlers.

func (*Pad) QueryDuration

func (p *Pad) QueryDuration(format Format) (bool, int64)

QueryDuration queries a pad for the total stream duration.

func (*Pad) QueryPosition

func (p *Pad) QueryPosition(format Format) (bool, int64)

QueryPosition queries a pad for the stream position.

func (*Pad) RemoveProbe

func (p *Pad) RemoveProbe(id uint64)

RemoveProbe removes the probe with id from pad.

func (*Pad) SendEvent

func (p *Pad) SendEvent(ev *Event) bool

SendEvent sends the event to the pad. This function can be used by applications to send events in the pipeline.

If pad is a source pad, event should be an upstream event. If pad is a sink pad, event should be a downstream event. For example, you would not send a GST_EVENT_EOS on a src pad; EOS events only propagate downstream. Furthermore, some downstream events have to be serialized with data flow, like EOS, while some can travel out-of-band, like GST_EVENT_FLUSH_START. If the event needs to be serialized with data flow, this function will take the pad's stream lock while calling its event function.

To find out whether an event type is upstream, downstream, or downstream and serialized, see GstEventTypeFlags, gst_event_type_get_flags, GST_EVENT_IS_UPSTREAM, GST_EVENT_IS_DOWNSTREAM, and GST_EVENT_IS_SERIALIZED. Note that in practice that an application or plugin doesn't need to bother itself with this information; the core handles all necessary locks and checks.

This function takes ownership of the provided event so you should gst_event_ref it if you want to reuse the event after this call.

func (*Pad) SetActivateFunction

func (p *Pad) SetActivateFunction(f PadActivateFunc)

SetActivateFunction sets the given active function on the pad. The activate function will dispatch to ActivateMode to perform the actual activation. Only makes sense to set on sink pads.

func (*Pad) SetActivateModeFunction

func (p *Pad) SetActivateModeFunction(f PadActivateModeFunc)

SetActivateModeFunction sets the given activate_mode function for the pad. An activate_mode function prepares the element for data passing.

func (*Pad) SetActive

func (p *Pad) SetActive(active bool) bool

SetActive activates or deactivates the given pad. Normally called from within core state change functions.

If active, makes sure the pad is active. If it is already active, either in push or pull mode, just return. Otherwise dispatches to the pad's activate function to perform the actual activation.

If not active, calls ActivateMode with the pad's current mode and a FALSE argument.

func (*Pad) SetChainFunction

func (p *Pad) SetChainFunction(f PadChainFunc)

SetChainFunction sets the given chain function for the pad. The chain function is called to process an input buffer.

func (*Pad) SetChainListFunction

func (p *Pad) SetChainListFunction(f PadChainListFunc)

SetChainListFunction sets the given chain function for the pad. The chain function is called to process an input buffer list.

func (*Pad) SetElementPrivate

func (p *Pad) SetElementPrivate(data interface{})

SetElementPrivate sets the given private data pointer on the pad. This function can only be used by the element that owns the pad. No locking is performed in this function.

func (*Pad) SetEventFullFunction

func (p *Pad) SetEventFullFunction(f PadEventFullFunc)

SetEventFullFunction sets the given event handler for the pad.

func (*Pad) SetEventFunction

func (p *Pad) SetEventFunction(f PadEventFunc)

SetEventFunction sets the given event handler for the pad.

func (*Pad) SetGetRangeFunction

func (p *Pad) SetGetRangeFunction(f PadGetRangeFunc)

SetGetRangeFunction sets the given getrange function for the pad. The getrange function is called to produce a new Buffer to start the processing pipeline. see PadGetRangeFunc for a description of the getrange function.

func (*Pad) SetIterIntLinkFunction

func (p *Pad) SetIterIntLinkFunction(f PadIterIntLinkFunc)

SetIterIntLinkFunction sets the given internal link iterator function for the pad.

func (*Pad) SetLinkFunction

func (p *Pad) SetLinkFunction(f PadLinkFunc)

SetLinkFunction sets the given link function for the pad. It will be called when the pad is linked with another pad.

The return value PadLinkOK should be used when the connection can be made.

The return value PadLinkRefused should be used when the connection cannot be made for some reason.

If link is installed on a source pad, it should call the Link of the peer sink pad, if present.

func (*Pad) SetOffset

func (p *Pad) SetOffset(offset int64)

SetOffset sets the offset that will be applied to the running time of pad.

func (*Pad) SetQueryFunction

func (p *Pad) SetQueryFunction(f PadQueryFunc)

SetQueryFunction sets the query handler for the pad.

func (*Pad) SetUnlinkFunction

func (p *Pad) SetUnlinkFunction(f PadUnlinkFunc)

SetUnlinkFunction sets the given unlink function for the pad. It will be called when the pad is unlinked.

Note that the pad's lock is already held when the unlink function is called, so most pad functions cannot be called from within the callback.

func (*Pad) StickyEventsForEach

func (p *Pad) StickyEventsForEach(f StickyEventsForEachFunc)

StickyEventsForEach iterates all sticky events on pad and calls foreach_func for every event. If foreach_func returns FALSE the iteration is immediately stopped.

func (*Pad) StoreStickyEvent

func (p *Pad) StoreStickyEvent(ev *Event) FlowReturn

StoreStickyEvent stores the sticky event on pad

func (*Pad) Template

func (p *Pad) Template() *PadTemplate

Template returns the template for this pad or nil.

func (*Pad) ToGValue

func (p *Pad) ToGValue() (*glib.Value, error)

this prevents go pointers in cgo when setting a gst.Pad to a property see (https://github.com/ArtemMartus/go-gst/issues/117) ToGValue implements glib.ValueTransformer.

func (p *Pad) Unlink(pad *Pad) bool

Unlink unlinks this source pad from the sink pad. Will emit the unlinked signal on both pads.

func (*Pad) UseFixedCaps

func (p *Pad) UseFixedCaps()

UseFixedCaps is a helper function you can use that sets the FIXED_CAPS flag This way the default CAPS query will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps.

The negotiated caps are the caps of the last CAPS event that passed on the pad. Use this function on a pad that, once it negotiated to a CAPS, cannot be renegotiated to something else.

type PadActivateFunc

type PadActivateFunc func(self *Pad, parent *Object) bool

PadActivateFunc is called when the pad is activated during the element READY to PAUSED state change. By default this function will call the activate function that puts the pad in push mode but elements can override this function to activate the pad in pull mode if they wish.

type PadActivateModeFunc

type PadActivateModeFunc func(self *Pad, parent *Object, mode PadMode, active bool) bool

PadActivateModeFunc is the prototype of the push and pull activate functions.

type PadChainFunc

type PadChainFunc func(self *Pad, parent *Object, buffer *Buffer) FlowReturn

PadChainFunc is a function that will be called on sinkpads when chaining buffers. The function typically processes the data contained in the buffer and either consumes the data or passes it on to the internally linked pad(s).

The GStreamer API will produce a refcount to buffer, and the bindings will automatically call Unref after the function returns. If you'd like to hold on to the buffer longer, add an additional ref yourself or create a copy.

When a chain function detects an error in the data stream, it must post an error on the bus and return an appropriate FlowReturn value.

type PadChainListFunc

type PadChainListFunc func(self *Pad, parent *Object, list *BufferList) FlowReturn

PadChainListFunc is a function that will be called on sinkpads when chaining buffer lists. The function typically processes the data contained in the buffer list and either consumes the data or passes it on to the internally linked pad(s).

The GStreamer API will produce a refcount to list, and the bindings will automatically call Unref after the function returns. If you'd like to hold on to the list longer, add an additional ref yourself or create a copy.

When a chainlist function detects an error in the data stream, it must post an error on the bus and return an appropriate FlowReturn value.

type PadDirection

type PadDirection int

PadDirection is a cast of GstPadDirection to a go type.

const (
	PadDirectionUnknown PadDirection = C.GST_PAD_UNKNOWN // (0) - the direction is unknown
	PadDirectionSource  PadDirection = C.GST_PAD_SRC     // (1) - the pad is a source pad
	PadDirectionSink    PadDirection = C.GST_PAD_SINK    // (2) - the pad is a sink pad
)

Type casting of pad directions

func (PadDirection) String

func (p PadDirection) String() string

String implements a Stringer on PadDirection.

type PadEventFullFunc

type PadEventFullFunc func(self *Pad, parent *Object, event *Event) FlowReturn

PadEventFullFunc is the function signature to handle an event for the pad. This variant is for specific elements that will take into account the last downstream flow return (from a pad push), in which case they can return it.

type PadEventFunc

type PadEventFunc func(self *Pad, parent *Object, event *Event) bool

PadEventFunc is the function signature to handle an event for the pad

type PadFlags

type PadFlags int

PadFlags is a go cast of GstPadFlags

const (
	PadFlagBlocked         PadFlags = C.GST_PAD_FLAG_BLOCKED          // (16) – is dataflow on a pad blocked
	PadFlagFlushing        PadFlags = C.GST_PAD_FLAG_FLUSHING         // (32) – is pad flushing
	PadFlagEOS             PadFlags = C.GST_PAD_FLAG_EOS              // (64) – is pad in EOS state
	PadFlagBlocking        PadFlags = C.GST_PAD_FLAG_BLOCKING         // (128) – is pad currently blocking on a buffer or event
	PadFlagParent          PadFlags = C.GST_PAD_FLAG_NEED_PARENT      // (256) – ensure that there is a parent object before calling into the pad callbacks.
	PadFlagReconfigure     PadFlags = C.GST_PAD_FLAG_NEED_RECONFIGURE // (512) – the pad should be reconfigured/renegotiated. The flag has to be unset manually after reconfiguration happened.
	PadFlagPendingEvents   PadFlags = C.GST_PAD_FLAG_PENDING_EVENTS   // (1024) – the pad has pending events
	PadFlagFixedCaps       PadFlags = C.GST_PAD_FLAG_FIXED_CAPS       // (2048) – the pad is using fixed caps. This means that once the caps are set on the pad, the default caps query function will only return those caps.
	PadFlagProxyCaps       PadFlags = C.GST_PAD_FLAG_PROXY_CAPS       // (4096) – the default event and query handler will forward all events and queries to the internally linked pads instead of discarding them.
	PadFlagProxyAllocation PadFlags = C.GST_PAD_FLAG_PROXY_ALLOCATION // (8192) – the default query handler will forward allocation queries to the internally linked pads instead of discarding them.
	PadFlagProxyScheduling PadFlags = C.GST_PAD_FLAG_PROXY_SCHEDULING // (16384) – the default query handler will forward scheduling queries to the internally linked pads instead of discarding them.
	PadFlagAcceptIntersect PadFlags = C.GST_PAD_FLAG_ACCEPT_INTERSECT // (32768) – the default accept-caps handler will check it the caps intersect the query-caps result instead of checking for a subset. This is interesting for parsers that can accept incompletely specified caps.
	PadFlagAcceptTemplate  PadFlags = C.GST_PAD_FLAG_ACCEPT_TEMPLATE  // (65536) – the default accept-caps handler will use the template pad caps instead of query caps to compare with the accept caps. Use this in combination with GST_PAD_FLAG_ACCEPT_INTERSECT. (Since: 1.6)
	PadFlagLast            PadFlags = C.GST_PAD_FLAG_LAST             // (1048576) – offset to define more flags
)

Type casts of PadFlags

type PadForwardFunc

type PadForwardFunc func(pad *Pad) bool

PadForwardFunc is called for all internally linked pads, see Pad Forward(). If the function returns true, the procedure is stopped.

type PadFuncMap

type PadFuncMap map[unsafe.Pointer]interface{}

PadFuncMap is an type of map for registering callbacks to a pad instance. It compensates for the lack of userdata in pad callbacks by providing a FuncForPad method that will return the function matching the Pad at the given address.

func (PadFuncMap) FuncForPad

func (p PadFuncMap) FuncForPad(pad unsafe.Pointer) interface{}

FuncForPad will return the function in this map for the given pad.

func (PadFuncMap) RemoveFuncForPad

func (p PadFuncMap) RemoveFuncForPad(pad unsafe.Pointer)

RemoveFuncForPad will remove the function for the given pad from this map.

type PadGetRangeFunc

type PadGetRangeFunc func(self *Pad, parent *Object, offset uint64, length uint) (FlowReturn, *Buffer)

PadGetRangeFunc will be called on source pads when a peer element request a buffer at the specified offset and length. If this function returns FlowOK it must also return a valid buffer.

This function is installed on a source pad with SetGetRangeFunction and can only be called on source pads after they are successfully activated with ActivateMode with the PadModePull.

offset and length are always given in byte units. offset must normally be a value between 0 and the length in bytes of the data available on pad. The length (duration in bytes) can be retrieved with a GST_QUERY_DURATION or with a GST_QUERY_SEEKING.

Any offset larger or equal than the length will make the function return FlowEOS, which corresponds to EOS. In this case buffer does not contain a valid buffer.

The buffer size of buffer will only be smaller than length when offset is near the end of the stream. In all other cases, the size of buffer must be exactly the requested size.

It is allowed to call this function with a 0 length and valid offset, in which case buffer will contain a 0-sized buffer and the function returns FlowOK.

When this function is called with a -1 offset, the sequentially next buffer of length length in the stream is returned.

When this function is called with a -1 length, a buffer with a default optimal length is returned in buffer. The length might depend on the value of offset.

type PadIterIntLinkFunc

type PadIterIntLinkFunc func(self *Pad, parent *Object) []*Pad

PadIterIntLinkFunc is the signature of the internal pad link iterator function. It should return a slice of pads that are linked to the given pad on the inside of the parent element. Currently the function only supports returning a single pad until GstIterator is implemented fully in the bindings.

type PadLinkCheck

type PadLinkCheck int

PadLinkCheck is a go cast of GstPadLinkCheck

const (
	PadLinkCheckNothing       PadLinkCheck = C.GST_PAD_LINK_CHECK_NOTHING        // (0) – Don't check hierarchy or caps compatibility.
	PadLinkCheckHierarchy     PadLinkCheck = C.GST_PAD_LINK_CHECK_HIERARCHY      // (1) – Check the pads have same parents/grandparents. Could be omitted if it is already known that the two elements that own the pads are in the same bin.
	PadLinkCheckTemplateCaps  PadLinkCheck = C.GST_PAD_LINK_CHECK_TEMPLATE_CAPS  // (2) – Check if the pads are compatible by using their template caps. This is much faster than GST_PAD_LINK_CHECK_CAPS, but would be unsafe e.g. if one pad has GST_CAPS_ANY.
	PadLinkCheckCaps          PadLinkCheck = C.GST_PAD_LINK_CHECK_CAPS           // (4) – Check if the pads are compatible by comparing the caps returned by gst_pad_query_caps.
	PadLinkCheckNoReconfigure PadLinkCheck = C.GST_PAD_LINK_CHECK_NO_RECONFIGURE // (8) – Disables pushing a reconfigure event when pads are linked.
	PadLinkCheckDefault       PadLinkCheck = C.GST_PAD_LINK_CHECK_DEFAULT        // (5) – The default checks done when linking pads (i.e. the ones used by gst_pad_link).
)

Type casts of PadLinkChecks

type PadLinkFunc

type PadLinkFunc func(self *Pad, parent *Object, peer *Pad) PadLinkReturn

PadLinkFunc is the function signature to handle a new link on a pad.

type PadLinkReturn

type PadLinkReturn int

PadLinkReturn os a representation of GstPadLinkReturn.

Type casts for PadLinkReturns.

func (PadLinkReturn) String

func (p PadLinkReturn) String() string

String implemeents a stringer on PadLinkReturn

type PadMode

type PadMode int

PadMode is a cast of GstPadMode.

const (
	PadModeNone PadMode = C.GST_PAD_MODE_NONE // (0) – Pad will not handle dataflow
	PadModePush PadMode = C.GST_PAD_MODE_PUSH // (1) – Pad handles dataflow in downstream push mode
	PadModePull PadMode = C.GST_PAD_MODE_PULL // (2) – Pad handles dataflow in upstream pull mode
)

Type casts of PadModes

func (PadMode) String

func (p PadMode) String() string

String implements a stringer on PadMode

type PadPresence

type PadPresence int

PadPresence is a cast of GstPadPresence to a go type.

const (
	PadPresenceAlways    PadPresence = C.GST_PAD_ALWAYS    // (0) - the pad is always available
	PadPresenceSometimes PadPresence = C.GST_PAD_SOMETIMES // (1) - the pad will become available depending on the media stream
	PadPresenceRequest   PadPresence = C.GST_PAD_REQUEST   // (2) - the pad is only available on request with gst_element_request_pad.
)

Type casting of pad presences

func (PadPresence) String

func (p PadPresence) String() string

String implements a stringer on PadPresence.

type PadProbeCallback

type PadProbeCallback func(*Pad, *PadProbeInfo) PadProbeReturn

PadProbeCallback is a callback used by Pad AddProbe. It gets called to notify about the current blocking type.

type PadProbeInfo

type PadProbeInfo struct {
	// contains filtered or unexported fields
}

PadProbeInfo represents the info passed to a PadProbeCallback.

func (*PadProbeInfo) GetBuffer

func (p *PadProbeInfo) GetBuffer() *Buffer

GetBuffer returns the buffer, if any, inside this probe info.

func (*PadProbeInfo) GetBufferList

func (p *PadProbeInfo) GetBufferList() *BufferList

GetBufferList returns the buffer list, if any, inside this probe info.

func (*PadProbeInfo) GetEvent

func (p *PadProbeInfo) GetEvent() *Event

GetEvent returns the event, if any, inside this probe info.

func (*PadProbeInfo) GetQuery

func (p *PadProbeInfo) GetQuery() *Query

GetQuery returns the query, if any, inside this probe info.

func (*PadProbeInfo) ID

func (p *PadProbeInfo) ID() uint32

ID returns the id of the probe.

func (*PadProbeInfo) Offset

func (p *PadProbeInfo) Offset() uint64

Offset returns the offset of pull probe, this field is valid when type contains PadProbeTypePull.

func (*PadProbeInfo) Size

func (p *PadProbeInfo) Size() uint64

Size returns the size of pull probe, this field is valid when type contains PadProbeTypePull.

func (*PadProbeInfo) Type

func (p *PadProbeInfo) Type() PadProbeType

Type returns the type of the probe. The type indicates the type of data that can be expected with the probe.

type PadProbeReturn

type PadProbeReturn int

PadProbeReturn casts GstPadProbeReturn

const (
	PadProbeDrop      PadProbeReturn = C.GST_PAD_PROBE_DROP    // (0) – drop data in data probes. For push mode this means that the data item is not sent downstream. For pull mode, it means that the data item is not passed upstream. In both cases, no other probes are called for this item and GST_FLOW_OK or TRUE is returned to the caller.
	PadProbeOK        PadProbeReturn = C.GST_PAD_PROBE_OK      // (1) – normal probe return value. This leaves the probe in place, and defers decisions about dropping or passing data to other probes, if any. If there are no other probes, the default behavior for the probe type applies ('block' for blocking probes, and 'pass' for non-blocking probes).
	PadProbeRemove    PadProbeReturn = C.GST_PAD_PROBE_REMOVE  // (2) – remove this probe.
	PadProbePass      PadProbeReturn = C.GST_PAD_PROBE_PASS    // (3) – pass the data item in the block probe and block on the next item.
	PadProbeUnhandled PadProbeReturn = C.GST_PAD_PROBE_HANDLED // (4) – Data has been handled in the probe and will not be forwarded further. For events and buffers this is the same behavior as GST_PAD_PROBE_DROP (except that in this case you need to unref the buffer or event yourself). For queries it will also return TRUE to the caller. The probe can also modify the GstFlowReturn value by using the GST_PAD_PROBE_INFO_FLOW_RETURN() accessor. Note that the resulting query must contain valid entries. Since: 1.6
)

Type castings of ProbeReturns

type PadProbeType

type PadProbeType int

PadProbeType casts GstPadProbeType

const (
	PadProbeTypeInvalid         PadProbeType = C.GST_PAD_PROBE_TYPE_INVALID          // (0) – invalid probe type
	PadProbeTypeIdle            PadProbeType = C.GST_PAD_PROBE_TYPE_IDLE             // (1) – probe idle pads and block while the callback is called
	PadProbeTypeBlock           PadProbeType = C.GST_PAD_PROBE_TYPE_BLOCK            // (2) – probe and block pads
	PadProbeTypeBuffer          PadProbeType = C.GST_PAD_PROBE_TYPE_BUFFER           // (16) – probe buffers
	PadProbeTypeBufferList      PadProbeType = C.GST_PAD_PROBE_TYPE_BUFFER_LIST      // (32) – probe buffer lists
	PadProbeTypeEventDownstream PadProbeType = C.GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM // (64) – probe downstream events
	PadProbeTypeEventUpstream   PadProbeType = C.GST_PAD_PROBE_TYPE_EVENT_UPSTREAM   // (128) – probe upstream events
	PadProbeTypeEventFlush      PadProbeType = C.GST_PAD_PROBE_TYPE_EVENT_FLUSH      // (256) – probe flush events. This probe has to be explicitly enabled and is not included in the @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types.
	PadProbeTypeQueryDownstream PadProbeType = C.GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM // (512) – probe downstream queries
	PadProbeTypeQueryUpstream   PadProbeType = C.GST_PAD_PROBE_TYPE_QUERY_UPSTREAM   // (1024) – probe upstream queries
	PadProbeTypePush            PadProbeType = C.GST_PAD_PROBE_TYPE_PUSH             // (4096) – probe push
	PadProbeTypePull            PadProbeType = C.GST_PAD_PROBE_TYPE_PULL             // (8192) – probe pull
	PadProbeTypeBlocking        PadProbeType = C.GST_PAD_PROBE_TYPE_BLOCKING         // (3) – probe and block at the next opportunity, at data flow or when idle
	PadProbeTypeDataDownstream  PadProbeType = C.GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM  // (112) – probe downstream data (buffers, buffer lists, and events)
	PadProbeTypeDataUpstream    PadProbeType = C.GST_PAD_PROBE_TYPE_DATA_UPSTREAM    // (128) – probe upstream data (events)
	PadProbeTypeDataBoth        PadProbeType = C.GST_PAD_PROBE_TYPE_DATA_BOTH        // (240) – probe upstream and downstream data (buffers, buffer lists, and events)
	PadProbeTypeBlockDownstream PadProbeType = C.GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM // (114) – probe and block downstream data (buffers, buffer lists, and events)
	PadProbeTypeBlockUpstream   PadProbeType = C.GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM   // (130) – probe and block upstream data (events)
	PadProbeTypeEventBoth       PadProbeType = C.GST_PAD_PROBE_TYPE_EVENT_BOTH       // (192) – probe upstream and downstream events
	PadProbeTypeQueryBoth       PadProbeType = C.GST_PAD_PROBE_TYPE_QUERY_BOTH       // (1536) – probe upstream and downstream queries
	PadProbeTypeAllBoth         PadProbeType = C.GST_PAD_PROBE_TYPE_ALL_BOTH         // (1776) – probe upstream events and queries and downstream buffers, buffer lists, events and queries
	PadProbeTypeScheduling      PadProbeType = C.GST_PAD_PROBE_TYPE_SCHEDULING       // (12288) – probe push and pull
)

Type castings of PadProbeTypes

type PadQueryFunc

type PadQueryFunc func(self *Pad, parent *Object, query *Query) bool

PadQueryFunc is a function for performing queries on a pad. It should return true if it could handle the query.

type PadTemplate

type PadTemplate struct{ *Object }

PadTemplate is a go representation of a GstPadTemplate

func FromGstPadTemplateUnsafeFull

func FromGstPadTemplateUnsafeFull(tmpl unsafe.Pointer) *PadTemplate

FromGstPadTemplateUnsafeFull wraps the given GstPadTemplate in a finalizer.

func FromGstPadTemplateUnsafeNone

func FromGstPadTemplateUnsafeNone(tmpl unsafe.Pointer) *PadTemplate

FromGstPadTemplateUnsafeNone wraps the given GstPadTemplate in a ref and a finalizer.

func NewPadTemplate

func NewPadTemplate(nameTemplate string, direction PadDirection, presence PadPresence, caps *Caps) *PadTemplate

NewPadTemplate creates a new pad template with a name according to the given template and with the given arguments.

func NewPadTemplateWithGType

func NewPadTemplateWithGType(nameTemplate string, direction PadDirection, presence PadPresence, caps *Caps, gType glib.Type) *PadTemplate

NewPadTemplateWithGType creates a new pad template with a name according to the given template and with the given arguments.

func (*PadTemplate) Caps

func (p *PadTemplate) Caps() *Caps

Caps returns the caps of the pad template.

func (*PadTemplate) Direction

func (p *PadTemplate) Direction() PadDirection

Direction returns the direction of the pad template.

func (*PadTemplate) Instance

func (p *PadTemplate) Instance() *C.GstPadTemplate

Instance returns the underlying C GstPadTemplate.

func (*PadTemplate) Name

func (p *PadTemplate) Name() string

Name returns the name of the pad template.

func (*PadTemplate) PadCreated

func (p *PadTemplate) PadCreated(pad *Pad)

PadCreated emits the pad-created signal for this template when created by this pad.

func (*PadTemplate) Presence

func (p *PadTemplate) Presence() PadPresence

Presence returns the presence of the pad template.

type PadUnlinkFunc

type PadUnlinkFunc func(self *Pad, parent *Object)

PadUnlinkFunc is the function signature to handle a unlinking the pad from its peer.

The pad's lock is already held when the unlink function is called, so most pad functions cannot be called from within the callback.

type ParentBufferMeta

type ParentBufferMeta struct {
	Parent *Meta
	Buffer *Buffer
}

ParentBufferMeta is a go representation of a GstParentBufferMeta

type Pipeline

type Pipeline struct {
	*Bin
	// contains filtered or unexported fields
}

Pipeline is a go implementation of a GstPipeline.

func FromGstPipelineUnsafeFull

func FromGstPipelineUnsafeFull(pipeline unsafe.Pointer) *Pipeline

FromGstPipelineUnsafeFull wraps the given pipeline pointer.

func FromGstPipelineUnsafeNone

func FromGstPipelineUnsafeNone(pipeline unsafe.Pointer) *Pipeline

FromGstPipelineUnsafeNone wraps the given pipeline pointer.

func NewPipeline

func NewPipeline(name string) (*Pipeline, error)

NewPipeline allocates and returns a new empty pipeline. If name is empty, one is generated by gstreamer.

func NewPipelineFromString

func NewPipelineFromString(launchv string) (*Pipeline, error)

NewPipelineFromString creates a new gstreamer pipeline from the given launch string.

func (*Pipeline) ForceClock

func (p *Pipeline) ForceClock(clock *Clock)

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 NULL all clocking will be disabled which will make the pipeline run as fast as possible.

MT safe.

func (*Pipeline) GetPipelineBus

func (p *Pipeline) GetPipelineBus() *Bus

GetPipelineBus returns the message bus for this pipeline.

func (*Pipeline) GetPipelineClock

func (p *Pipeline) GetPipelineClock() *Clock

GetPipelineClock returns the global clock for this pipeline.

func (*Pipeline) Instance

func (p *Pipeline) Instance() *C.GstPipeline

Instance returns the native GstPipeline instance.

func (*Pipeline) SetAutoFlushBus

func (p *Pipeline) SetAutoFlushBus(b bool)

SetAutoFlushBus can be used to disable automatically flushing the message bus when a pipeline goes to StateNull.

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 behavior 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.

func (*Pipeline) Start

func (p *Pipeline) Start() error

Start is the equivalent to calling SetState(StatePlaying) on the underlying GstElement.

type Plugin

type Plugin struct{ *Object }

Plugin is a go representation of a GstPlugin.

func FromGstPluginUnsafeFull

func FromGstPluginUnsafeFull(plugin unsafe.Pointer) *Plugin

FromGstPluginUnsafeFull wraps the given pointer in a Plugin.

func FromGstPluginUnsafeNone

func FromGstPluginUnsafeNone(plugin unsafe.Pointer) *Plugin

FromGstPluginUnsafeNone wraps the given pointer in a Plugin.

func LoadPluginByName

func LoadPluginByName(name string) *Plugin

LoadPluginByName loads the named plugin and places a ref count on it. The function returns nil if the plugin could not be loaded.

func LoadPluginFile

func LoadPluginFile(fpath string) (*Plugin, error)

LoadPluginFile loads the given plugin and refs it. If an error is returned Plugin will be nil.

func (*Plugin) Description

func (p *Plugin) Description() string

Description returns the description for this plugin.

func (*Plugin) Filename

func (p *Plugin) Filename() string

Filename returns the filename for this plugin.

func (*Plugin) Instance

func (p *Plugin) Instance() *C.GstPlugin

Instance returns the underlying GstPlugin instance.

func (*Plugin) License

func (p *Plugin) License() License

License returns the license for this plugin.

func (*Plugin) Origin

func (p *Plugin) Origin() string

Origin returns the origin URL for this plugin.

func (*Plugin) Package

func (p *Plugin) Package() string

Package returns the binary package for this plugin.

func (*Plugin) Source

func (p *Plugin) Source() string

Source returns the source module for this plugin.

func (*Plugin) Version

func (p *Plugin) Version() string

Version returns the version for this plugin.

type PluginFeature

type PluginFeature struct{ *Object }

PluginFeature wraps the C GstPluginFeature.

func (*PluginFeature) GetPlugin

func (p *PluginFeature) GetPlugin() *Plugin

GetPlugin returns the plugin that provides this feature or nil.

func (*PluginFeature) GetPluginName

func (p *PluginFeature) GetPluginName() string

GetPluginName returns the name of the plugin that provides this feature.

func (*PluginFeature) GetPluginRank

func (p *PluginFeature) GetPluginRank() int

func (*PluginFeature) Instance

func (p *PluginFeature) Instance() *C.GstPluginFeature

Instance returns the underlying GstPluginFeature instance

func (*PluginFeature) SetPluginRank

func (p *PluginFeature) SetPluginRank(rank Rank)

type PluginInitFunc

type PluginInitFunc func(*Plugin) bool

PluginInitFunc is a function called by the plugin loader at startup. This function should register all the features of the plugin. The function should return true if the plugin is initialized successfully.

type PluginMetadata

type PluginMetadata struct {
	// The major version number of the GStreamer core that the plugin was compiled for, you can just use VersionMajor here
	MajorVersion Version
	// The minor version number of the GStreamer core that the plugin was compiled for, you can just use VersionMinor here
	MinorVersion Version
	// A unique name of the plugin (ideally prefixed with an application- or library-specific namespace prefix in order to
	// avoid name conflicts in case a similar plugin with the same name ever gets added to GStreamer)
	Name string
	// A description of the plugin
	Description string
	// The function to call when initiliazing the plugin
	Init PluginInitFunc
	// The version of the plugin
	Version string
	// The license for the plugin, must match one of the license constants in this package
	License License
	// The source module the plugin belongs to
	Source string
	// The shipped package the plugin belongs to
	Package string
	// The URL to the provider of the plugin
	Origin string
	// The date of release in ISO 8601 format.
	// See https://gstreamer.freedesktop.org/documentation/gstreamer/gstplugin.html?gi-language=c#GstPluginDesc for more details.
	ReleaseDate string
}

PluginMetadata represents the information to include when registering a new plugin with gstreamer.

func (*PluginMetadata) Export

func (p *PluginMetadata) Export() unsafe.Pointer

Export will export the PluginMetadata to an unsafe pointer to a GstPluginDesc.

type PollFd

type PollFd struct {
	Fd              int
	Events, REvents uint
}

PollFd represents the possible values returned from a GetPollFd. On Windows, there will not be a Fd.

type ProgressType

type ProgressType int

ProgressType is a go representation of a GstProgressType

const (
	ProgressTypeStart    ProgressType = C.GST_PROGRESS_TYPE_START    // (0) – A new task started.
	ProgressTypeContinue ProgressType = C.GST_PROGRESS_TYPE_CONTINUE // (1) – A task completed and a new one continues.
	ProgressTypeComplete ProgressType = C.GST_PROGRESS_TYPE_COMPLETE // (2) – A task completed.
	ProgressTypeCanceled ProgressType = C.GST_PROGRESS_TYPE_CANCELED // (3) – A task was canceled.
	ProgressTypeError    ProgressType = C.GST_PROGRESS_TYPE_ERROR    // (4) – A task caused an error. An error message is also posted on the bus.
)

Type castings of ProgressTypes

func (ProgressType) String

func (p ProgressType) String() string

String implements a stringer on ProgressTypes

type Promise

type Promise struct {
	// contains filtered or unexported fields
}

Promise is a go wrapper around a GstPromise. See: https://gstreamer.freedesktop.org/documentation/gstreamer/gstpromise.html

it can be awaited on-blocking using Await, given the promise was constructed in go and not received from FFI.

func NewPromise

func NewPromise() *Promise

func (*Promise) Await

func (p *Promise) Await(ctx context.Context) (*Structure, error)

Await awaits the promise without blocking the thread. It returns the reply returned by the GstPromise

its implementation is preferred over the blocking gst_promise_wait, which would lock a thread until the promise has changed state.

func (*Promise) Expire

func (p *Promise) Expire()

Expire wraps gst_promise_expire

func (*Promise) GetReply

func (p *Promise) GetReply() *Structure

GetReply wraps gst_promise_get_reply and returns the structure, which can be nil.

func (*Promise) Instance

func (p *Promise) Instance() *C.GstPromise

func (*Promise) Interrupt

func (p *Promise) Interrupt()

Interrupt wraps gst_promise_interrupt

func (*Promise) Ref

func (p *Promise) Ref()

Ref increases the ref count on the promise. Exposed for completeness sake. Should not be called by application code

func (*Promise) Reply

func (p *Promise) Reply(answer *Structure)

Reply wraps gst_promise_reply

func (*Promise) ToGValue

func (p *Promise) ToGValue() (*glib.Value, error)

ToGValue implements glib.ValueTransformer

func (*Promise) Unref

func (p *Promise) Unref()

Unref decreases the ref count on the promise. Exposed for completeness sake. Should not be called by application code

type PromiseResult

type PromiseResult int

func (PromiseResult) String

func (pr PromiseResult) String() string

type ProtectionMeta

type ProtectionMeta struct {
	Meta *Meta
	Info *Structure
}

ProtectionMeta is a go wrapper around C GstProtectionMeta.

type ProxyPad

type ProxyPad struct{ *Pad }

ProxyPad is a go representation of a GstProxyPad.

func (*ProxyPad) ChainDefault

func (p *ProxyPad) ChainDefault(parent *Object, buffer *Buffer) FlowReturn

ChainDefault invokes the default chain function of the proxy pad.

func (*ProxyPad) ChainListDefault

func (p *ProxyPad) ChainListDefault(parent *Object, bufferList *BufferList) FlowReturn

ChainListDefault invokes the default chain list function of the proxy pad.

func (*ProxyPad) GetInternal

func (p *ProxyPad) GetInternal() *ProxyPad

GetInternal gets the internal pad of pad.

The internal pad of a GhostPad is the internally used pad of opposite direction, which is used to link to the target.

func (*ProxyPad) GetInternalLinksDefault

func (p *ProxyPad) GetInternalLinksDefault(parent *Object) ([]*Pad, error)

GetInternalLinksDefault invokes the default iterate internal links function of the proxy pad.

func (*ProxyPad) GetRangeDefault

func (p *ProxyPad) GetRangeDefault(parent *Object, offset uint64, size uint) (FlowReturn, *Buffer)

GetRangeDefault invokes the default getrange function of the proxy pad.

func (*ProxyPad) Instance

func (p *ProxyPad) Instance() *C.GstProxyPad

Instance returns the underlying GstProxyPad instance.

type QOSType

type QOSType int

QOSType casts GstQOSType

const (
	QOSTypeOverflow  QOSType = C.GST_QOS_TYPE_OVERFLOW  // (0) – The QoS event type that is produced when upstream elements are producing data too quickly and the element can't keep up processing the data. Upstream should reduce their production rate. This type is also used when buffers arrive early or in time.
	QOSTypeUnderflow QOSType = C.GST_QOS_TYPE_UNDERFLOW // (1) – The QoS event type that is produced when upstream elements are producing data too slowly and need to speed up their production rate.
	QOSTypeThrottle  QOSType = C.GST_QOS_TYPE_THROTTLE  // (2) – The QoS event type that is produced when the application enabled throttling to limit the data rate.
)

Type castings

type QoSValues

type QoSValues struct {
	// If the message was generated by a live element
	Live bool
	// The running time of the buffer that generated the message
	RunningTime time.Duration // should this be a uint64?
	// The stream time of the buffer that generated the message
	StreamTime time.Duration // should this be a uint64?
	//  The timestamps of the buffer that generated the message
	Timestamp time.Duration // should this be a uint64?
	//  The duration of the buffer that generated the message
	Duration time.Duration // should this be a uint64?
}

QoSValues represents the values inside a QoS message.

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query is a go wrapper around a GstQuery.

func FromGstQueryUnsafeFull

func FromGstQueryUnsafeFull(query unsafe.Pointer) *Query

FromGstQueryUnsafeFull wraps the pointer to the given C GstQuery with the go type. This is meant for internal usage and is exported for visibility to other packages.

func FromGstQueryUnsafeNone

func FromGstQueryUnsafeNone(query unsafe.Pointer) *Query

FromGstQueryUnsafeNone wraps the pointer to the given C GstQuery with the go type. This is meant for internal usage and is exported for visibility to other packages.

func NewAcceptCapsQuery

func NewAcceptCapsQuery(caps *Caps) *Query

NewAcceptCapsQuery constructs a new query object for querying if caps are accepted.

func NewAllocationQuery

func NewAllocationQuery(caps *Caps, needPool bool) *Query

NewAllocationQuery constructs a new query object for querying the allocation properties.

func NewBitrateQuery

func NewBitrateQuery() *Query

NewBitrateQuery constructs a new query object for querying the bitrate.

func NewBufferingQuery

func NewBufferingQuery(format Format) *Query

NewBufferingQuery constructs a new query object for querying the buffering status of a stream.

func NewCapsQuery

func NewCapsQuery(caps *Caps) *Query

NewCapsQuery constructs a new query object for querying the caps.

The CAPS query should return the allowable caps for a pad in the context of the element's state, its link to other elements, and the devices or files it has opened. These caps must be a subset of the pad template caps. In the NULL state with no links, the CAPS query should ideally return the same caps as the pad template. In rare circumstances, an object property can affect the caps returned by the CAPS query, but this is discouraged.

For most filters, the caps returned by CAPS query is directly affected by the allowed caps on other pads. For demuxers and decoders, the caps returned by the srcpad's getcaps function is directly related to the stream data. Again, the CAPS query should return the most specific caps it reasonably can, since this helps with autoplugging.

The filter is used to restrict the result caps, only the caps matching filter should be returned from the CAPS query. Specifying a filter might greatly reduce the amount of processing an element needs to do.

func NewContextQuery

func NewContextQuery(ctxType string) *Query

NewContextQuery constructs a new query object for querying the pipeline-local context.

func NewConvertQuery

func NewConvertQuery(srcFormat, destFormat Format, value int64) *Query

NewConvertQuery constructs a new convert query object. A convert query is used to ask for a conversion between one format and another.

func NewCustomQuery

func NewCustomQuery(queryType QueryType, structure *Structure) *Query

NewCustomQuery constructs a new custom query object.

func NewDrainQuery

func NewDrainQuery() *Query

NewDrainQuery constructs a new query object for querying the drain state.

func NewDurationQuery

func NewDurationQuery(format Format) *Query

NewDurationQuery constructs a new stream duration query object to query in the given format. A duration query will give the total length of the stream.

func NewFormatsQuery

func NewFormatsQuery() *Query

NewFormatsQuery constructs a new query object for querying formats of the stream.

func NewLatencyQuery

func NewLatencyQuery() *Query

NewLatencyQuery constructs a new latency query object. A latency query is usually performed by sinks to compensate for additional latency introduced by elements in the pipeline.

func NewPositionQuery

func NewPositionQuery(format Format) *Query

NewPositionQuery constructs a new query stream position query object. A position query is used to query the current position of playback in the streams, in some format.

func NewSchedulingQuery

func NewSchedulingQuery() *Query

NewSchedulingQuery constructs a new query object for querying the scheduling properties.

func NewSeekingQuery

func NewSeekingQuery(format Format) *Query

NewSeekingQuery constructs a new query object for querying seeking properties of the stream.

func NewSegmentQuery

func NewSegmentQuery(format Format) *Query

NewSegmentQuery constructs a new segment query object. A segment query is used to discover information about the currently configured segment for playback.

func NewURIQuery

func NewURIQuery() *Query

NewURIQuery constructs a new query URI query object. An URI query is used to query the current URI that is used by the source or sink.

func ToGstQuery

func ToGstQuery(query unsafe.Pointer) *Query

ToGstQuery converts the given pointer into a Message without affecting the ref count or placing finalizers.

func (*Query) AddAllocationMeta

func (q *Query) AddAllocationMeta(api glib.Type, structure *Structure)

AddAllocationMeta adds api with params as one of the supported metadata API to query.

func (*Query) AddAllocationParam

func (q *Query) AddAllocationParam(allocator *Allocator, params *AllocationParams)

AddAllocationParam adds allocator and its params as a supported memory allocator.

func (*Query) AddAllocationPool

func (q *Query) AddAllocationPool(pool *BufferPool, size, minBuffers, maxBuffers uint)

AddAllocationPool sets the pool parameters in query.

func (*Query) AddBufferingRange

func (q *Query) AddBufferingRange(start, stop int64) (ok bool)

AddBufferingRange sets the buffering-ranges array field in query. The current last start position of the array should be inferior to start.

func (*Query) AddSchedulingMode

func (q *Query) AddSchedulingMode(mode PadMode)

AddSchedulingMode adds mode as one of the supported scheduling modes to query.

func (*Query) Copy

func (q *Query) Copy() *Query

Copy copies the given query using the copy function of the parent GstStructure.

func (*Query) FindAllocationMeta

func (q *Query) FindAllocationMeta(api glib.Type) (ok bool, index uint)

FindAllocationMeta checks if query has metadata api set. When this function returns TRUE, index will contain the index where the requested API and the parameters can be found.

func (*Query) GetNumAllocationMetas

func (q *Query) GetNumAllocationMetas() uint

GetNumAllocationMetas retrieves the number of values currently stored in the meta API array of the query's structure.

func (*Query) GetNumAllocationParams

func (q *Query) GetNumAllocationParams() uint

GetNumAllocationParams retrieves the number of values currently stored in the allocator params array of the query's structure.

If no memory allocator is specified, the downstream element can handle the default memory allocator. The first memory allocator in the query should be generic and allow mapping to system memory, all following allocators should be ordered by preference with the preferred one first.

func (*Query) GetNumAllocationPools

func (q *Query) GetNumAllocationPools() uint

GetNumAllocationPools retrieves the number of values currently stored in the pool array of the query's structure.

func (*Query) GetNumBufferingRanges

func (q *Query) GetNumBufferingRanges() uint

GetNumBufferingRanges retrieves the number of values currently stored in the buffered-ranges array of the query's structure.

func (*Query) GetNumSchedulingModes

func (q *Query) GetNumSchedulingModes() uint

GetNumSchedulingModes retrieves the number of values currently stored in the scheduling mode array of the query's structure.

func (*Query) GetStructure

func (q *Query) GetStructure() *Structure

GetStructure retrieves the structure of a query.

func (*Query) HasSchedulingMode

func (q *Query) HasSchedulingMode(mode PadMode) bool

HasSchedulingMode checks if query has scheduling mode set.

func (*Query) HasSchedulingModeWithFlags

func (q *Query) HasSchedulingModeWithFlags(mode PadMode, flags SchedulingFlags) bool

HasSchedulingModeWithFlags checks if query has scheduling mode set and flags is set in query scheduling flags.

func (*Query) Instance

func (q *Query) Instance() *C.GstQuery

Instance returns the underlying GstQuery instance.

func (*Query) ParseAcceptCaps

func (q *Query) ParseAcceptCaps() *Caps

ParseAcceptCaps gets the caps from query. The caps remains valid as long as query remains valid.

func (*Query) ParseAcceptCapsResult

func (q *Query) ParseAcceptCapsResult() bool

ParseAcceptCapsResult parses the result from the caps query.

func (*Query) ParseAllocation

func (q *Query) ParseAllocation() (caps *Caps, needPool bool)

ParseAllocation parses an allocation query.

func (*Query) ParseAllocationMetaAt

func (q *Query) ParseAllocationMetaAt(idx uint) (api glib.Type, st *Structure)

ParseAllocationMetaAt parses an available query and get the metadata API at index of the metadata API array.

func (*Query) ParseAllocationParamAt

func (q *Query) ParseAllocationParamAt(idx uint) (*Allocator, *AllocationParams)

ParseAllocationParamAt parses an available query and get the allocator and its params at index of the allocator array.

func (*Query) ParseAllocationPoolAt

func (q *Query) ParseAllocationPoolAt(idx uint) (pool *BufferPool, size, minBuffers, maxBuffers uint)

ParseAllocationPoolAt gets the pool parameters in query.

func (*Query) ParseBitrate

func (q *Query) ParseBitrate() uint

ParseBitrate gets the results of a bitrate query. See also SetBitrate.

func (*Query) ParseBufferingPercent

func (q *Query) ParseBufferingPercent() (busy bool, percent int)

ParseBufferingPercent gets the percentage of buffered data. This is a value between 0 and 100. The busy indicator is TRUE when the buffering is in progress.

func (*Query) ParseBufferingRange

func (q *Query) ParseBufferingRange() (format Format, start, stop, estimatedTotal int64)

ParseBufferingRange parses a buffering range query.

func (*Query) ParseBufferingRangeAt

func (q *Query) ParseBufferingRangeAt(idx uint) (start, stop int64)

ParseBufferingRangeAt parses an available query and get the start and stop values stored at the index of the buffered ranges array.

func (*Query) ParseBufferingStats

func (q *Query) ParseBufferingStats() (mode BufferingMode, avgIn, avgOut int, bufLeft int64)

ParseBufferingStats extracts the buffering stats values from query.

func (*Query) ParseCaps

func (q *Query) ParseCaps() *Caps

ParseCaps gets the filter from the caps query. The caps remains valid as long as query remains valid.

func (*Query) ParseCapsResult

func (q *Query) ParseCapsResult() *Caps

ParseCapsResult gets the caps result from query. The caps remains valid as long as query remains valid.

func (*Query) ParseContext

func (q *Query) ParseContext() *Context

ParseContext gets the context from the context query. The context remains valid as long as query remains valid.

func (*Query) ParseContextType

func (q *Query) ParseContextType() (ok bool, ctxType string)

ParseContextType parses a context type from an existing GST_QUERY_CONTEXT query.

func (*Query) ParseConvert

func (q *Query) ParseConvert() (srcformat, destFormat Format, srcValue, destValue int64)

ParseConvert parses a convert query answer.

func (*Query) ParseDuration

func (q *Query) ParseDuration() (format Format, duration int64)

ParseDuration parses a duration query answer.

func (*Query) ParseFormatAt

func (q *Query) ParseFormatAt(idx uint) Format

ParseFormatAt parses the format query and retrieve the nth format from it into format. If the list contains less elements than nth, format will be set to GST_FORMAT_UNDEFINED.

func (*Query) ParseLatency

func (q *Query) ParseLatency() (live bool, minLatency, maxLatency ClockTime)

ParseLatency parses a latency query answer.

func (*Query) ParseNumFormats

func (q *Query) ParseNumFormats() uint

ParseNumFormats parses the number of formats in the formats query.

func (*Query) ParsePosition

func (q *Query) ParsePosition() (format Format, cur int64)

ParsePosition parses a position query, writing the format into format, and the position into cur, if the respective parameters are non-%NULL.

func (*Query) ParseScheduling

func (q *Query) ParseScheduling() (flags SchedulingFlags, minSize, maxSize, align int)

ParseScheduling sets the scheduling properties.

func (*Query) ParseSchedulingModeAt

func (q *Query) ParseSchedulingModeAt(idx uint) PadMode

ParseSchedulingModeAt parses an available query and get the scheduling mode at index of the scheduling modes array.

func (*Query) ParseSeeking

func (q *Query) ParseSeeking() (format Format, seekable bool, start, end int64)

ParseSeeking parses a seeking query.

func (*Query) ParseSegment

func (q *Query) ParseSegment() (rate float64, format Format, start, stop int64)

ParseSegment parses a segment query answer.

func (*Query) ParseURI

func (q *Query) ParseURI() string

ParseURI parses a URI query.

func (*Query) ParseURIRedirection

func (q *Query) ParseURIRedirection() string

ParseURIRedirection parses a URI query.

func (*Query) ParseURIRedirectionPermanent

func (q *Query) ParseURIRedirectionPermanent() bool

ParseURIRedirectionPermanent parses an URI query, and set permanent to TRUE if there is a redirection and it should be considered permanent. If a redirection is permanent, applications should update their internal storage of the URI, otherwise they should make all future requests to the original URI.

func (*Query) Ref

func (q *Query) Ref() *Query

Ref increases the query ref count by one.

func (*Query) RemoveAllocationMetaAt

func (q *Query) RemoveAllocationMetaAt(idx uint)

RemoveAllocationMetaAt removes the metadata API at index of the metadata API array.

func (*Query) RemoveAllocationParamAt

func (q *Query) RemoveAllocationParamAt(idx uint)

RemoveAllocationParamAt removes the allocation param at index of the allocation param array.

func (*Query) RemoveAllocationPoolAt

func (q *Query) RemoveAllocationPoolAt(idx uint)

RemoveAllocationPoolAt removes the allocation pool at index of the allocation pool array.

func (*Query) SetAcceptCapsResult

func (q *Query) SetAcceptCapsResult(result bool)

SetAcceptCapsResult sets result as the result for the query.

func (*Query) SetAllocationParamAt

func (q *Query) SetAllocationParamAt(idx uint, allocator *Allocator, params *AllocationParams)

SetAllocationParamAt sets allocation params in query.

func (*Query) SetAllocationPoolAt

func (q *Query) SetAllocationPoolAt(idx uint, pool *BufferPool, size, minBuffers, maxBuffers uint)

SetAllocationPoolAt sets the pool parameters in query.

func (*Query) SetBitrate

func (q *Query) SetBitrate(nominal uint)

SetBitrate sets the results of a bitrate query. The nominal bitrate is the average bitrate expected over the length of the stream as advertised in file headers (or similar).

func (*Query) SetBufferingPercent

func (q *Query) SetBufferingPercent(busy bool, percent int)

SetBufferingPercent sets the percentage of buffered data. This is a value between 0 and 100. The busy indicator is TRUE when the buffering is in progress.

func (*Query) SetBufferingRange

func (q *Query) SetBufferingRange(format Format, start, stop, estimatedTotal int64)

SetBufferingRange sets the available query result fields in query.

func (*Query) SetBufferingStats

func (q *Query) SetBufferingStats(mode BufferingMode, avgIn, avgOut int, bufferingLeft int64)

SetBufferingStats configures the buffering stats values in query.

func (*Query) SetCapsResult

func (q *Query) SetCapsResult(caps *Caps)

SetCapsResult sets the caps result in query.

func (*Query) SetContext

func (q *Query) SetContext(ctx *Context)

SetContext answers a context query by setting the requested context.

func (*Query) SetConvert

func (q *Query) SetConvert(srcFormat, destFormat Format, srcValue, destValue int64)

SetConvert answers a convert query by setting the requested values.

func (*Query) SetDuration

func (q *Query) SetDuration(format Format, duration int64)

SetDuration answers a duration query by setting the requested value in the given format.

func (*Query) SetFormats

func (q *Query) SetFormats(formats ...Format)

SetFormats sets the formats query result fields in query. The number of formats passed must be equal to n_formats.

func (*Query) SetLatency

func (q *Query) SetLatency(live bool, minLatency, maxLatency ClockTime)

SetLatency answers a latency query by setting the requested values in the given format.

func (*Query) SetPosition

func (q *Query) SetPosition(format Format, cur int64)

SetPosition answers a position query by setting the requested value in the given format.

func (*Query) SetScheduling

func (q *Query) SetScheduling(flags SchedulingFlags, minSize, maxSize, align int)

SetScheduling sets the scheduling properties.

func (*Query) SetSeeking

func (q *Query) SetSeeking(format Format, seekable bool, segmentStart, segmentEnd int64)

SetSeeking sets the seeking query result fields in query.

func (*Query) SetSegment

func (q *Query) SetSegment(rate float64, format Format, startValue, stopValue int64)

SetSegment answers a segment query by setting the requested values. The normal playback segment of a pipeline is 0 to duration at the default rate of 1.0. If a seek was performed on the pipeline to play a different segment, this query will return the range specified in the last seek.

start_value and stop_value will respectively contain the configured playback range start and stop values expressed in format. The values are always between 0 and the duration of the media and start_value <= stop_value. rate will contain the playback rate. For negative rates, playback will actually happen from stop_value to start_value.

func (*Query) SetURI

func (q *Query) SetURI(uri string)

SetURI answers a URI query by setting the requested URI.

func (*Query) SetURIRedirection

func (q *Query) SetURIRedirection(uri string)

SetURIRedirection answers a URI query by setting the requested URI redirection.

func (*Query) SetURIRedirectionPermanent

func (q *Query) SetURIRedirectionPermanent(permanent bool)

SetURIRedirectionPermanent answers a URI query by setting the requested URI redirection to permanent or not.

func (*Query) Type

func (q *Query) Type() QueryType

Type returns the type of the Query.

func (*Query) Unref

func (q *Query) Unref()

Unref decreases the refcount of the query. If the refcount reaches 0, the query will be freed.

func (*Query) WritableStructure

func (q *Query) WritableStructure() *Structure

WritableStructure gets the structure of a query. This method should be called with a writable query so that the returned structure is guaranteed to be writable.

type QueryType

type QueryType int

QueryType casts GstQueryType

const (
	QueryUnknown    QueryType = C.GST_QUERY_UNKNOWN     // (0) – unknown query type
	QueryPosition   QueryType = C.GST_QUERY_POSITION    // (2563) – current position in stream
	QueryDuration   QueryType = C.GST_QUERY_DURATION    // (5123) – total duration of the stream
	QueryLatency    QueryType = C.GST_QUERY_LATENCY     // (7683) – latency of stream
	QueryJitter     QueryType = C.GST_QUERY_JITTER      // (10243) – current jitter of stream
	QueryRate       QueryType = C.GST_QUERY_RATE        // (12803) – current rate of the stream
	QuerySeeking    QueryType = C.GST_QUERY_SEEKING     // (15363) – seeking capabilities
	QuerySegment    QueryType = C.GST_QUERY_SEGMENT     // (17923) – segment start/stop positions
	QueryConvert    QueryType = C.GST_QUERY_CONVERT     // (20483) – convert values between formats
	QueryFormats    QueryType = C.GST_QUERY_FORMATS     // (23043) – query supported formats for convert
	QueryBuffering  QueryType = C.GST_QUERY_BUFFERING   // (28163) – query available media for efficient seeking.
	QueryCustom     QueryType = C.GST_QUERY_CUSTOM      // (30723) – a custom application or element defined que	QueryType = C.ry.
	QueryURI        QueryType = C.GST_QUERY_URI         // (33283) – query the URI of the source or sink.
	QueryAllocation QueryType = C.GST_QUERY_ALLOCATION  // (35846) – the buffer allocation properties
	QueryScheduling QueryType = C.GST_QUERY_SCHEDULING  // (38401) – the scheduling properties
	QueryAcceptCaps QueryType = C.GST_QUERY_ACCEPT_CAPS // (40963) – the accept caps query
	QueryCaps       QueryType = C.GST_QUERY_CAPS        // (43523) – the caps query
	QueryDrain      QueryType = C.GST_QUERY_DRAIN       // (46086) – wait till all serialized data is consumed downstream
	QueryContext    QueryType = C.GST_QUERY_CONTEXT     // (48643) – query the pipeline-local context from downstream or upstream (since 1.2)
	QueryBitrate    QueryType = C.GST_QUERY_BITRATE     // (51202) – the bitrate query (since 1.16)
)

Type casts

func (QueryType) String

func (q QueryType) String() string

type QueryTypeFlags

type QueryTypeFlags int

QueryTypeFlags casts GstQueryTypeFlags

const (
	QueryTypeUpstream   QueryTypeFlags = C.GST_QUERY_TYPE_UPSTREAM   // (1) – Set if the query can travel upstream.
	QueryTypeDownstream QueryTypeFlags = C.GST_QUERY_TYPE_DOWNSTREAM // (2) – Set if the query can travel downstream.
	QueryTypeSerialized QueryTypeFlags = C.GST_QUERY_TYPE_SERIALIZED // (4) – Set if the query should be serialized with data flow.
)

Type casts

type Rank

type Rank uint

Rank casts GstRank

const (
	RankNone      Rank = C.GST_RANK_NONE      // (0) - will be chosen last or not at all
	RankMarginal  Rank = C.GST_RANK_MARGINAL  // (64) – unlikely to be chosen
	RankSecondary Rank = C.GST_RANK_SECONDARY // (128) – likely to be chosen
	RankPrimary   Rank = C.GST_RANK_PRIMARY   // (256) – will be chosen first
)

type ReferenceTimestampMeta

type ReferenceTimestampMeta struct {
	Parent              *Meta
	Reference           *Caps
	Timestamp, Duration ClockTime
}

ReferenceTimestampMeta is a go representation of a GstReferenceTimestampMeta.

type Registry

type Registry struct{ *Object }

Registry is a go representation of a GstRegistry.

func FromGstRegistryUnsafeFull

func FromGstRegistryUnsafeFull(registry unsafe.Pointer) *Registry

FromGstRegistryUnsafeFull wraps the given GstRegistry pointer.

func FromGstRegistryUnsafeNone

func FromGstRegistryUnsafeNone(registry unsafe.Pointer) *Registry

FromGstRegistryUnsafeNone wraps the given GstRegistry pointer.

func GetRegistry

func GetRegistry() *Registry

GetRegistry returns the default global GstRegistry.

func (*Registry) FindPlugin

func (r *Registry) FindPlugin(name string) (*Plugin, error)

FindPlugin retrieves the plugin by the given name.

func (*Registry) Instance

func (r *Registry) Instance() *C.GstRegistry

Instance returns the underlying GstRegistry instance.

func (*Registry) LookupFeature

func (r *Registry) LookupFeature(name string) (*PluginFeature, error)

LookupFeature looks up the given plugin feature by name.

type Sample

type Sample struct {
	// contains filtered or unexported fields
}

Sample is a go wrapper around a GstSample object.

func FromGstSampleUnsafeFull

func FromGstSampleUnsafeFull(sample unsafe.Pointer) *Sample

FromGstSampleUnsafeFull wraps the pointer to the given C GstSample with the go type. This is meant for internal usage and is exported for visibility to other packages.

func FromGstSampleUnsafeNone

func FromGstSampleUnsafeNone(sample unsafe.Pointer) *Sample

FromGstSampleUnsafeNone wraps the pointer to the given C GstSample with the go type. This is meant for internal usage and is exported for visibility to other packages.

func (*Sample) Copy

func (s *Sample) Copy() *Sample

Copy creates a copy of the given sample. This will also make a newly allocated copy of the data the source sample contains.

func (*Sample) GetBuffer

func (s *Sample) GetBuffer() *Buffer

GetBuffer returns the buffer inside this sample.

func (*Sample) GetBufferList

func (s *Sample) GetBufferList() *BufferList

GetBufferList gets the buffer list associated with this sample.

func (*Sample) GetCaps

func (s *Sample) GetCaps() *Caps

GetCaps returns the caps associated with this sample. Take a ref if you need to hold on to them longer then the life of the sample.

func (*Sample) GetInfo

func (s *Sample) GetInfo() *Structure

GetInfo gets extra information about this sample. The structure remains valid as long as sample is valid.

func (*Sample) GetSegment

func (s *Sample) GetSegment() *Segment

GetSegment gets the segment associated with the sample. The segmenr remains valid as long as sample is valid.

func (*Sample) Instance

func (s *Sample) Instance() *C.GstSample

Instance returns the underlying *GstSample instance.

func (*Sample) Ref

func (s *Sample) Ref() *Sample

Ref increases the ref count on the sample.

func (*Sample) SetBuffer

func (s *Sample) SetBuffer(buf *Buffer)

SetBuffer sets the buffer inside this sample. The sample must be writable.

func (*Sample) SetBufferList

func (s *Sample) SetBufferList(buf *BufferList)

SetBufferList sets the buffer list for this sample. The sample must be writable.

func (*Sample) SetCaps

func (s *Sample) SetCaps(caps *Caps)

SetCaps sets the caps on this sample. The sample must be writable.

func (*Sample) SetInfo

func (s *Sample) SetInfo(st *Structure) bool

SetInfo sets the info on this sample. The sample must be writable.

func (*Sample) SetSegment

func (s *Sample) SetSegment(segment *Segment)

SetSegment sets the segment on this sample. The sample must be writable.

func (*Sample) Unref

func (s *Sample) Unref()

Unref calls gst_sample_unref on the sample.

type SchedulingFlags

type SchedulingFlags int

SchedulingFlags casts GstSchedulingFlags

const (
	SchedulingFlagSeekable         SchedulingFlags = C.GST_SCHEDULING_FLAG_SEEKABLE          // (1) – if seeking is possible
	SchedulingFlagSequential       SchedulingFlags = C.GST_SCHEDULING_FLAG_SEQUENTIAL        // (2) – if sequential access is recommended
	SchedulingFlagBandwidthLimited SchedulingFlags = C.GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED // (4) – if bandwidth is limited and buffering possible (since 1.2)
)

Type casts

type SeekFlags

type SeekFlags int

SeekFlags is a representation of GstSeekFlags.

const (
	SeekFlagNone        SeekFlags = C.GST_SEEK_FLAG_NONE
	SeekFlagFlush       SeekFlags = C.GST_SEEK_FLAG_FLUSH
	SeekFlagAccurate    SeekFlags = C.GST_SEEK_FLAG_ACCURATE
	SeekFlagKeyUnit     SeekFlags = C.GST_SEEK_FLAG_KEY_UNIT
	SeekFlagSegment     SeekFlags = C.GST_SEEK_FLAG_SEGMENT
	SeekFlagSkip        SeekFlags = C.GST_SEEK_FLAG_SKIP
	SeekFlagSnapBefore  SeekFlags = C.GST_SEEK_FLAG_SNAP_BEFORE
	SeekFlagSnapAfter   SeekFlags = C.GST_SEEK_FLAG_SNAP_AFTER
	SeekFlagSnapNearest SeekFlags = C.GST_SEEK_FLAG_SNAP_NEAREST
)

Type casts of SeekFlags

type SeekType

type SeekType int

SeekType is a representation of GstSeekType.

const (
	SeekTypeNone SeekType = C.GST_SEEK_TYPE_NONE
	SeekTypeSet  SeekType = C.GST_SEEK_TYPE_SET
	SeekTypeEnd  SeekType = C.GST_SEEK_TYPE_END
)

Type casts of seek types

type Segment

type Segment struct {
	// contains filtered or unexported fields
}

Segment is a go wrapper around a GstSegment. See: https://gstreamer.freedesktop.org/documentation/gstreamer/gstsegment.html?gi-language=c#GstSegment

func FromGstSegmentUnsafe

func FromGstSegmentUnsafe(segment unsafe.Pointer) *Segment

FromGstSegmentUnsafe wraps the GstSegment pointer.

func NewFormattedSegment

func NewFormattedSegment(f Format) *Segment

NewFormattedSegment returns a new Segment with the given format.

func NewSegment

func NewSegment() *Segment

NewSegment allocates and initializes a new Segment. Free when you are finished.

func ToGstSegment

func ToGstSegment(segment unsafe.Pointer) *Segment

ToGstSegment converts the given pointer into a Segment without affecting the ref count or placing finalizers.

func (*Segment) Clip

func (s *Segment) Clip(format Format, start, stop uint64) (ok bool, clipStart, clipStop uint64)

Clip clips the given start and stop values to the segment boundaries given in segment. start and stop are compared and clipped to segment start and stop values.

If the function returns FALSE, start and stop are known to fall outside of segment and clip_start and clip_stop are not updated.

When the function returns TRUE, clip_start and clip_stop will be updated. If clip_start or clip_stop are different from start or stop respectively, the region fell partially in the segment.

Note that when stop is -1, clip_stop will be set to the end of the segment. Depending on the use case, this may or may not be what you want.

func (*Segment) Copy

func (s *Segment) Copy() *Segment

Copy creates a copy of this segment.

func (*Segment) CopyInto

func (s *Segment) CopyInto(segment *Segment)

CopyInto copies the contents of this segment into the given one.

func (*Segment) DoSeek

func (s *Segment) DoSeek(rate float64, format Format, flags SeekFlags, startType SeekType, start uint64, stopType SeekType, stop uint64) (ok, update bool)

DoSeek updates the segment structure with the field values of a seek event (see NewSeekEvent).

After calling this method, the segment field position and time will contain the requested new position in the segment. The new requested position in the segment depends on rate and start_type and stop_type.

For positive rate, the new position in the segment is the new segment start field when it was updated with a start_type different from SeekTypeNone. If no update was performed on segment start position (#SeekTypeNone), start is ignored and segment position is unmodified.

For negative rate, the new position in the segment is the new segment stop field when it was updated with a stop_type different from SeekTypeNone. If no stop was previously configured in the segment, the duration of the segment will be used to update the stop position. If no update was performed on segment stop position (#SeekTypeNone), stop is ignored and segment position is unmodified.

The applied rate of the segment will be set to 1.0 by default. If the caller can apply a rate change, it should update segment rate and applied_rate after calling this function.

update will be set to TRUE if a seek should be performed to the segment position field. This field can be FALSE if, for example, only the rate has been changed but not the playback position.

func (*Segment) Free

func (s *Segment) Free()

Free frees the allocated segment.

func (*Segment) GetAppliedRate

func (s *Segment) GetAppliedRate() float64

GetAppliedRate returns the applied rate for this segment.

func (*Segment) GetBase

func (s *Segment) GetBase() uint64

GetBase returns the base for this segment.

func (*Segment) GetDuration

func (s *Segment) GetDuration() uint64

GetDuration gets the duration of this segment.

func (*Segment) GetFlags

func (s *Segment) GetFlags() SegmentFlags

GetFlags returns the flags on this segment.

func (*Segment) GetFormat

func (s *Segment) GetFormat() Format

GetFormat returns the format for this segment.

func (*Segment) GetOffset

func (s *Segment) GetOffset() uint64

GetOffset returns the offset for this segment.

func (*Segment) GetPosition

func (s *Segment) GetPosition() uint64

GetPosition returns the position of this segment.

func (*Segment) GetRate

func (s *Segment) GetRate() float64

GetRate returns the rate for this segment.

func (*Segment) GetStart

func (s *Segment) GetStart() uint64

GetStart returns the start of this segment.

func (*Segment) GetStop

func (s *Segment) GetStop() uint64

GetStop returns the stop of this segment.

func (*Segment) GetTime

func (s *Segment) GetTime() uint64

GetTime returns the time of this segment.

func (*Segment) Init

func (s *Segment) Init(format Format)

Init reinitializes a segment to its default values.

func (*Segment) Instance

func (s *Segment) Instance() *C.GstSegment

Instance returns the underlying GstSegment instance.

func (*Segment) IsEqual

func (s *Segment) IsEqual(segment *Segment) bool

IsEqual checks for two segments being equal. Equality here is defined as perfect equality, including floating point values.

func (*Segment) OffsetRunningTime

func (s *Segment) OffsetRunningTime(format Format, offset int64) bool

OffsetRunningTime adjusts the values in segment so that offset is applied to all future running-time calculations.

func (*Segment) PositionFromRunningTime

func (s *Segment) PositionFromRunningTime(format Format, runningTime uint64) uint64

PositionFromRunningTime converts running_time into a position in the segment so that ToRunningTime with that position returns running_time. The position in the segment for runningTime is returned.

func (*Segment) PositionFromRunningTimeFull

func (s *Segment) PositionFromRunningTimeFull(format Format, runningTime uint64) int64

PositionFromRunningTimeFull translates running_time to the segment position using the currently configured segment. Compared to PositionFromRunningTime this function can return negative segment position.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

running_time can be any value and the result of this function for values outside of the segment is extrapolated.

func (*Segment) PositionFromStreamTime

func (s *Segment) PositionFromStreamTime(format Format, streamTime uint64) uint64

PositionFromStreamTime converts stream_time into a position in the segment so that ToStreamTime with that position returns stream_time.

func (*Segment) PositionFromStreamTimeFull

func (s *Segment) PositionFromStreamTimeFull(format Format, streamTime uint64) int64

PositionFromStreamTimeFull translates stream_time to the segment position using the currently configured segment. Compared to PositionFromStreamTime this function can return negative segment position.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

stream_time can be any value and the result of this function for values outside of the segment is extrapolated.

func (*Segment) SetAppliedRate

func (s *Segment) SetAppliedRate(rate float64)

SetAppliedRate sets the applied rate for this segment

func (*Segment) SetFlags

func (s *Segment) SetFlags(flags SegmentFlags)

SetFlags sets the flags on this segment.

func (*Segment) SetFormat

func (s *Segment) SetFormat(f Format)

SetFormat sets the format on this segment.

func (*Segment) SetRate

func (s *Segment) SetRate(rate float64)

SetRate sets the rate for this segment.

func (*Segment) SetRunningTime

func (s *Segment) SetRunningTime(format Format, runningTime uint64) bool

SetRunningTime adjusts the start/stop and base values of segment such that the next valid buffer will be one with running_time.

func (*Segment) ToRunningTime

func (s *Segment) ToRunningTime(format Format, position uint64) uint64

ToRunningTime translates position to the total running time using the currently configured segment. Position is a value between segment start and stop time.

This function is typically used by elements that need to synchronize to the global clock in a pipeline. The running time is a constantly increasing value starting from 0. When segment Init is called, this value will reset to 0.

This function returns -1 if the position is outside of segment start and stop.

func (*Segment) ToRunningTimeFull

func (s *Segment) ToRunningTimeFull(format Format, position uint64) int64

ToRunningTimeFull translates position to the total running time using the currently configured segment. Compared to ToRunningTime this function can return negative running-time.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

position can be any value and the result of this function for values outside of the segment is extrapolated.

func (*Segment) ToStreamTime

func (s *Segment) ToStreamTime(format Format, position uint64) uint64

ToStreamTime translates position to stream time using the currently configured segment. The position value must be between segment start and stop value.

This function is typically used by elements that need to operate on the stream time of the buffers it receives, such as effect plugins. In those use cases, position is typically the buffer timestamp or clock time that one wants to convert to the stream time. The stream time is always between 0 and the total duration of the media stream.

func (*Segment) ToStreamTimeFull

func (s *Segment) ToStreamTimeFull(format Format, position uint64) int64

ToStreamTimeFull translates position to the total stream time using the currently configured segment. Compared to ToStreamTime this function can return negative stream-time.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

position can be any value and the result of this function for values outside of the segment is extrapolated.

type SegmentFlags

type SegmentFlags int

SegmentFlags casts GstSegmentFlags

const (
	SegmentFlagNone      SegmentFlags = C.GST_SEGMENT_FLAG_NONE                // (0) – no flags
	SegmentFlagReset     SegmentFlags = C.GST_SEGMENT_FLAG_RESET               // (1) – reset the pipeline running_time to the segment running_time
	SegmentFlagTrickMode SegmentFlags = C.GST_SEGMENT_FLAG_TRICKMODE           // (16) – perform skip playback (Since: 1.6)
	SegmentFlagSkip      SegmentFlags = C.GST_SEGMENT_FLAG_SKIP                // (16) – Deprecated backward compatibility flag, replaced by GST_SEGMENT_FLAG_TRICKMODE
	SegmentFlagSegment   SegmentFlags = C.GST_SEGMENT_FLAG_SEGMENT             // (8) – send SEGMENT_DONE instead of EOS
	SegmentFlagKeyUnits  SegmentFlags = C.GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS // (128) – Decode only keyframes, where possible (Since: 1.6)
	// SegmentFlagTrickModeForwardPredicted SegmentFlags = C.GST_SEGMENT_FLAG_TRICKMODE_FORWARD_PREDICTED // (512) – Decode only keyframes or forward predicted frames, where possible (Since: 1.18)
	SegmentFlagTrickModeNoAudio SegmentFlags = C.GST_SEGMENT_FLAG_TRICKMODE_NO_AUDIO // (256) – Do not decode any audio, where possible (Since: 1.6)
)

Type castings

type StackTraceFlags

type StackTraceFlags int

StackTraceFlags are flags for configuring stack traces

const (
	StackTraceShowNone StackTraceFlags = 0                           // (0) – Try to retrieve the minimum information available, which may be none on some platforms (Since: 1.18)
	StackTraceShowFull StackTraceFlags = C.GST_STACK_TRACE_SHOW_FULL // (1) – Try to retrieve as much information as possible, including source information when getting the stack trace
)

Type castings of StackTraceFlags

type State

type State int

State is a type cast of the C GstState

const (
	VoidPending  State = C.GST_STATE_VOID_PENDING // (0) – no pending state.
	StateNull    State = C.GST_STATE_NULL         // (1) – the NULL state or initial state of an element.
	StateReady   State = C.GST_STATE_READY        // (2) – the element is ready to go to PAUSED.
	StatePaused  State = C.GST_STATE_PAUSED       // (3) – the element is PAUSED, it is ready to accept and process data. Sink elements however only accept one buffer and then block.
	StatePlaying State = C.GST_STATE_PLAYING      // (4) – the element is PLAYING, the GstClock is running and the data is flowing.
)

Type casting for GstStates

func (State) String

func (s State) String() string

String returns the string representation of this state.

type StateChange

type StateChange int

StateChange is the different state changes an element goes through. StateNull ⇒ StatePlaying is called an upwards state change and StatePlaying ⇒ StateNull a downwards state change.

See https://gstreamer.freedesktop.org/documentation/gstreamer/gstelement.html?gi-language=c#GstStateChange for more information on the responsibiltiies of elements during each transition.

const (
	StateChangeNullToReady      StateChange = C.GST_STATE_CHANGE_NULL_TO_READY
	StateChangeReadyToPaused    StateChange = C.GST_STATE_CHANGE_READY_TO_PAUSED
	StateChangePausedToPlaying  StateChange = C.GST_STATE_CHANGE_PAUSED_TO_PLAYING
	StateChangePlayingToPaused  StateChange = C.GST_STATE_CHANGE_PLAYING_TO_PAUSED
	StateChangePausedToReady    StateChange = C.GST_STATE_CHANGE_PAUSED_TO_READY
	StateChangeReadyToNull      StateChange = C.GST_STATE_CHANGE_READY_TO_NULL
	StateChangeNullToNull       StateChange = C.GST_STATE_CHANGE_NULL_TO_NULL
	StateChangeReadyToReady     StateChange = C.GST_STATE_CHANGE_READY_TO_READY
	StateChangePausedToPaused   StateChange = C.GST_STATE_CHANGE_PAUSED_TO_PAUSED
	StateChangePlayingToPlaying StateChange = C.GST_STATE_CHANGE_PLAYING_TO_PLAYING
)

StateChange castings

func (StateChange) String

func (s StateChange) String() string

String returns the string representation of a StateChange

type StateChangeReturn

type StateChangeReturn int

StateChangeReturn is a representation of GstStateChangeReturn.

Type casts of state change returns

func (StateChangeReturn) String

func (s StateChangeReturn) String() string

type StepDoneValues

type StepDoneValues struct {
	Format       Format
	Amount       uint64
	Rate         float64
	Flush        bool
	Intermediate bool
	Duration     time.Duration
	EOS          bool
}

StepDoneValues represents the values inside a StepDone message.

type StepStartValues

type StepStartValues struct {
	Active       bool
	Format       Format
	Amount       uint64
	Rate         float64
	Flush        bool
	Intermediate bool
}

StepStartValues represents the values inside a StepStart message.

type StickyEventsForEachFunc

type StickyEventsForEachFunc func(pad *Pad, event *Event) bool

StickyEventsForEachFunc is a callback used by StickyEventsForEach. When this function returns TRUE, the next event will be returned. When FALSE is returned, gst_pad_sticky_events_foreach will return.

When event is set to NULL, the item will be removed from the list of sticky events. event can be replaced by assigning a new reference to it. This function is responsible for unreffing the old event when removing or modifying.

type Stream

type Stream struct{ *Object }

Stream is a Go representation of a GstStream.

func FromGstStreamUnsafeFull

func FromGstStreamUnsafeFull(stream unsafe.Pointer) *Stream

FromGstStreamUnsafeFull captures a pointer with just a finalizer.

func FromGstStreamUnsafeNone

func FromGstStreamUnsafeNone(stream unsafe.Pointer) *Stream

FromGstStreamUnsafeNone captures a pointer with a ref and finalizer.

func NewStream

func NewStream(id string, caps *Caps, sType StreamType, flags StreamFlags) *Stream

NewStream returns a new Stream with the given ID, caps, type, and flags.

func (*Stream) Caps

func (s *Stream) Caps() *Caps

Caps returns the caps for this stream.

func (*Stream) Instance

func (s *Stream) Instance() *C.GstStream

Instance returns the underlying GstStream.

func (*Stream) SetCaps

func (s *Stream) SetCaps(caps *Caps)

SetCaps sets the caps for this stream.

func (*Stream) SetStreamFlags

func (s *Stream) SetStreamFlags(flags StreamFlags)

SetStreamFlags sets the flags for this stream.

func (*Stream) SetStreamType

func (s *Stream) SetStreamType(sType StreamType)

SetStreamType sets the type of this stream.

func (*Stream) SetTags

func (s *Stream) SetTags(tags *TagList)

SetTags sets the tags for this stream.

func (*Stream) StreamFlags

func (s *Stream) StreamFlags() StreamFlags

StreamFlags returns the flags for this stream.

func (*Stream) StreamID

func (s *Stream) StreamID() string

StreamID returns the id of this stream.

func (*Stream) StreamType

func (s *Stream) StreamType() StreamType

StreamType returns the type of this stream.

func (*Stream) Tags

func (s *Stream) Tags() *TagList

Tags returns the tag list for this stream.

type StreamCollection

type StreamCollection struct{ *Object }

StreamCollection is a Go representation of a GstStreamCollection.

func FromGstStreamCollectionUnsafeFull

func FromGstStreamCollectionUnsafeFull(stream unsafe.Pointer) *StreamCollection

FromGstStreamCollectionUnsafeFull captures a pointer with just a finalizer.

func FromGstStreamCollectionUnsafeNone

func FromGstStreamCollectionUnsafeNone(stream unsafe.Pointer) *StreamCollection

FromGstStreamCollectionUnsafeNone captures a pointer with a ref and finalizer.

func NewStreamCollection

func NewStreamCollection(upstreamID string) *StreamCollection

NewStreamCollection returns a new StreamCollection with an upstream parent of the given stream ID.

func (*StreamCollection) AddStream

func (s *StreamCollection) AddStream(stream *Stream) error

AddStream adds the given stream to this collection.

func (*StreamCollection) GetSize

func (s *StreamCollection) GetSize() uint

GetSize returns the size of this stream collection.

func (*StreamCollection) GetStreamAt

func (s *StreamCollection) GetStreamAt(idx uint) *Stream

GetStreamAt returns the stream at the given index in this collection.

func (*StreamCollection) GetUpstreamID

func (s *StreamCollection) GetUpstreamID() string

GetUpstreamID retrieves the upstream ID for this collection.

func (*StreamCollection) Instance

func (s *StreamCollection) Instance() *C.GstStreamCollection

Instance returns the underlying GstStreamCollection.

type StreamFlags

type StreamFlags int

StreamFlags represent configuration options for a new stream.

const (
	StreamFlagNone     StreamFlags = C.GST_STREAM_FLAG_NONE     // (0) – This stream has no special attributes
	StreamFlagSparse   StreamFlags = C.GST_STREAM_FLAG_SPARSE   // (1) – This stream is a sparse stream (e.g. a subtitle stream), data may flow only in irregular intervals with large gaps in between.
	StreamFlagSelect   StreamFlags = C.GST_STREAM_FLAG_SELECT   // (2) – This stream should be selected by default. This flag may be used by demuxers to signal that a stream should be selected by default in a playback scenario.
	StreamFlagUnselect StreamFlags = C.GST_STREAM_FLAG_UNSELECT // (4) – This stream should not be selected by default. This flag may be used by demuxers to signal that a stream should not be selected by default in a playback scenario, but only if explicitly selected by the user (e.g. an audio track for the hard of hearing or a director's commentary track).
)

Type castings of StreamFlags

type StreamStatusType

type StreamStatusType int

StreamStatusType represents a type of change in a stream's status

const (
	StreamStatusCreate  StreamStatusType = C.GST_STREAM_STATUS_TYPE_CREATE  // (0) – A new thread need to be created.
	StreamStatusEnter   StreamStatusType = C.GST_STREAM_STATUS_TYPE_ENTER   // (1) – a thread entered its loop function
	StreamStatusLeave   StreamStatusType = C.GST_STREAM_STATUS_TYPE_LEAVE   // (2) – a thread left its loop function
	StreamStatusDestroy StreamStatusType = C.GST_STREAM_STATUS_TYPE_DESTROY // (3) – a thread is destroyed
	StreamStatusStart   StreamStatusType = C.GST_STREAM_STATUS_TYPE_START   // (8) – a thread is started
	StreamStatusPause   StreamStatusType = C.GST_STREAM_STATUS_TYPE_PAUSE   // (9) – a thread is paused
	StreamStatusStop    StreamStatusType = C.GST_STREAM_STATUS_TYPE_STOP    // (10) – a thread is stopped
)

Type castings of the stream status types

func (StreamStatusType) String

func (s StreamStatusType) String() string

type StreamType

type StreamType int

StreamType is a go representation of a GstStreamType

const (
	StreamTypeUnknown   StreamType = C.GST_STREAM_TYPE_UNKNOWN   // (1) – The stream is of unknown (unclassified) type.
	StreamTypeAudio     StreamType = C.GST_STREAM_TYPE_AUDIO     // (2) – The stream is of audio data
	StreamTypeVideo     StreamType = C.GST_STREAM_TYPE_VIDEO     // (4) – The stream carries video data
	StreamTypeContainer StreamType = C.GST_STREAM_TYPE_CONTAINER // (8) – The stream is a muxed container type
	StreamTypeText      StreamType = C.GST_STREAM_TYPE_TEXT      // (16) – The stream contains subtitle / subpicture data.
)

Type castings of stream types

func (StreamType) String

func (s StreamType) String() string

String implements a stringer on StreamTypes.

type Structure

type Structure struct {
	// contains filtered or unexported fields
}

Structure is a go implementation of a C GstStructure.

func FromGstStructureUnsafe

func FromGstStructureUnsafe(st unsafe.Pointer) *Structure

FromGstStructureUnsafe wraps the given unsafe.Pointer in a Structure. This is meant for internal usage and is exported for visibility to other packages.

func MarshalStructure

func MarshalStructure(data interface{}) *Structure

MarshalStructure will convert the given go struct into a GstStructure. Currently nested structs are not supported.

func NewStructure

func NewStructure(name string) *Structure

NewStructure returns a new empty structure with the given name.

func NewStructureFromString

func NewStructureFromString(stStr string) *Structure

NewStructureFromString builds a new GstStructure from the given string.

func ValueGetStructure

func ValueGetStructure(gval *glib.Value) *Structure

ValueGetStructure extracts the GstStructure from a glib.Value, or nil if one does not exist.

func (*Structure) Free

func (s *Structure) Free()

Free frees the memory for the underlying GstStructure.

func (*Structure) GetValue

func (s *Structure) GetValue(key string) (interface{}, error)

GetValue retrieves the value at key.

func (*Structure) Instance

func (s *Structure) Instance() *C.GstStructure

Instance returns the native GstStructure instance.

func (*Structure) Name

func (s *Structure) Name() string

Name returns the name of this structure.

func (*Structure) RemoveValue

func (s *Structure) RemoveValue(key string)

RemoveValue removes the value at the given key. If the key does not exist, the structure is unchanged.

func (*Structure) SetValue

func (s *Structure) SetValue(key string, value interface{}) error

SetValue sets the data at key to the given value.

func (*Structure) Size

func (s *Structure) Size() int

Size returns the number of fields inside this structure.

func (*Structure) String

func (s *Structure) String() string

String implement a stringer on a GstStructure.

func (*Structure) ToGValue

func (s *Structure) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer

func (*Structure) UnmarshalInto

func (s *Structure) UnmarshalInto(data interface{}) error

UnmarshalInto will unmarshal this structure into the given pointer. The object reflected by the pointer must be non-nil.

func (*Structure) Values

func (s *Structure) Values() map[string]interface{}

Values returns a map of all the values inside this structure. If values cannot be converted to an equivalent go type, they are serialized to a string.

type StructureChangeType

type StructureChangeType int

StructureChangeType is a go representation of a GstStructureChangeType

const (
	StructureChangePadLink   StructureChangeType = C.GST_STRUCTURE_CHANGE_TYPE_PAD_LINK   // (0) – Pad linking is starting or done.
	StructureChangePadUnlink StructureChangeType = C.GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK // (1) – Pad unlinking is starting or done.
)

Type castings of StructureChangeTypes

func (StructureChangeType) String

func (s StructureChangeType) String() string

String implements a stringer on StructureChangeTypes.

type SystemClock

type SystemClock struct{ *Clock }

SystemClock wraps GstSystemClock

func ObtainSystemClock

func ObtainSystemClock() *SystemClock

ObtainSystemClock returns the default SystemClock.

type TOC

type TOC struct {
	// contains filtered or unexported fields
}

TOC is a go representation of a GstToc.

func FromGstTOCUnsafeFull

func FromGstTOCUnsafeFull(toc unsafe.Pointer) *TOC

FromGstTOCUnsafeFull wraps the pointer to the given C GstToc with the go type. This is meant for internal usage and is exported for visibility to other packages.

func FromGstTOCUnsafeNone

func FromGstTOCUnsafeNone(toc unsafe.Pointer) *TOC

FromGstTOCUnsafeNone wraps the pointer to the given C GstToc with the go type. This is meant for internal usage and is exported for visibility to other packages.

func NewTOC

func NewTOC(scope TOCScope) *TOC

NewTOC returns a new TOC with the given scope.

func (*TOC) AppendEntry

func (t *TOC) AppendEntry(entry *TOCEntry)

AppendEntry appends the given TOCEntry to this TOC.

func (*TOC) Copy

func (t *TOC) Copy() *TOC

Copy creates a copy of the TOC.

func (*TOC) Dump

func (t *TOC) Dump()

Dump dumps the TOC.

func (*TOC) FindEntry

func (t *TOC) FindEntry(uid string) *TOCEntry

FindEntry finds the entry with the given uid.

func (*TOC) GetEntries

func (t *TOC) GetEntries() []*TOCEntry

GetEntries returns a list of all TOCEntries.

func (*TOC) GetScope

func (t *TOC) GetScope() TOCScope

GetScope returns the scope of this TOC.

func (*TOC) GetTags

func (t *TOC) GetTags() *TagList

GetTags returns the TagList for this TOC.

func (*TOC) Instance

func (t *TOC) Instance() *C.GstToc

Instance returns the underlying GstToc instance.

func (*TOC) MakeWritable

func (t *TOC) MakeWritable() *TOC

MakeWritable returns a writable copy of the TOC if it isn't already,

func (*TOC) MergeTags

func (t *TOC) MergeTags(tagList *TagList, mergeMode TagMergeMode)

MergeTags merges the given tags into this TOC's TagList.

func (*TOC) Ref

func (t *TOC) Ref() *TOC

Ref increases the ref count on the TOC by one.

func (*TOC) SetTags

func (t *TOC) SetTags(tagList *TagList)

SetTags sets tags for the entire TOC.

func (*TOC) Unref

func (t *TOC) Unref()

Unref decreases the ref count on the TOC by one.

type TOCEntry

type TOCEntry struct {
	// contains filtered or unexported fields
}

TOCEntry is a go representation of a GstTocEntry,

func FromGstTocEntryUnsafeFull

func FromGstTocEntryUnsafeFull(entry unsafe.Pointer) *TOCEntry

FromGstTocEntryUnsafeFull wraps the given TOCEntry.

func FromGstTocEntryUnsafeNone

func FromGstTocEntryUnsafeNone(entry unsafe.Pointer) *TOCEntry

FromGstTocEntryUnsafeNone wraps the given TOCEntry.

func NewTOCEntry

func NewTOCEntry(entryType TOCEntryType, uid string) *TOCEntry

NewTOCEntry creates a new TOCEntry with the given UID and type.

func (*TOCEntry) AppendSubEntry

func (t *TOCEntry) AppendSubEntry(subEntry *TOCEntry)

AppendSubEntry appends the given entry as a subentry to this one.

func (*TOCEntry) Copy

func (t *TOCEntry) Copy() *TOCEntry

Copy creates a copy of the TOCEntry

func (*TOCEntry) GetEntryType

func (t *TOCEntry) GetEntryType() TOCEntryType

GetEntryType returns the type of this TOCEntry

func (*TOCEntry) GetEntryTypeString

func (t *TOCEntry) GetEntryTypeString() string

GetEntryTypeString returns a string representation of the entry type.

func (*TOCEntry) GetLoop

func (t *TOCEntry) GetLoop() (bool, TOCLoopType, int)

GetLoop gets the loop type and repeat count for the TOC entry.

func (*TOCEntry) GetParent

func (t *TOCEntry) GetParent() *TOCEntry

GetParent gets the parent of this TOCEntry.

func (*TOCEntry) GetStartStopTimes

func (t *TOCEntry) GetStartStopTimes() (ok bool, startTime, stopTime int64)

GetStartStopTimes gets the start and stop times for the TOCEntry if available.

func (*TOCEntry) GetSubEntries

func (t *TOCEntry) GetSubEntries() []*TOCEntry

GetSubEntries gets all the subentries for this TOCEntry.

func (*TOCEntry) GetTOC

func (t *TOCEntry) GetTOC() *TOC

GetTOC returns the parent TOC of this entry.

func (*TOCEntry) GetTags

func (t *TOCEntry) GetTags() *TagList

GetTags gets the tags for this entry.

func (*TOCEntry) GetUID

func (t *TOCEntry) GetUID() string

GetUID returns the uid of this entry.

func (*TOCEntry) Instance

func (t *TOCEntry) Instance() *C.GstTocEntry

Instance returns the underlying GstTocEntry instance.

func (*TOCEntry) IsAlternative

func (t *TOCEntry) IsAlternative() bool

IsAlternative returns true if this is an alternative entry.

func (*TOCEntry) IsSequence

func (t *TOCEntry) IsSequence() bool

IsSequence returns true if this is a sequence entry.

func (*TOCEntry) MakeWritable

func (t *TOCEntry) MakeWritable() *TOCEntry

MakeWritable returns a writable copy of the TOCEntry if it is not already so.

func (*TOCEntry) MergeTags

func (t *TOCEntry) MergeTags(tagList *TagList, mergeMode TagMergeMode)

MergeTags merges the given tags with the given mode.

func (*TOCEntry) Ref

func (t *TOCEntry) Ref() *TOCEntry

Ref increases the ref count on the TOCEntry by one.

func (*TOCEntry) SetLoop

func (t *TOCEntry) SetLoop(loopType TOCLoopType, repeatCount int)

SetLoop sets the loop type and repeat counts for the entry.

func (*TOCEntry) SetStartStopTimes

func (t *TOCEntry) SetStartStopTimes(startTime, stopTime int64)

SetStartStopTimes sets the start and stop times for the TOC entry.

func (*TOCEntry) SetTags

func (t *TOCEntry) SetTags(tagList *TagList)

SetTags sets the tags on the TOC entry.

func (*TOCEntry) Unref

func (t *TOCEntry) Unref()

Unref decreases the ref count on the TOCEntry by one.

type TOCEntryType

type TOCEntryType int

TOCEntryType represents a GstTocEntryType.

const (
	TOCEntryTypeAngle   TOCEntryType = C.GST_TOC_ENTRY_TYPE_ANGLE   // (-3) – entry is an angle (i.e. an alternative)
	TOCEntryTypeVersion TOCEntryType = C.GST_TOC_ENTRY_TYPE_VERSION // (-2) – entry is a version (i.e. alternative)
	TOCEntryTypeEdition TOCEntryType = C.GST_TOC_ENTRY_TYPE_EDITION // (-1) – entry is an edition (i.e. alternative)
	TOCEntryTypeInvalid TOCEntryType = C.GST_TOC_ENTRY_TYPE_INVALID // (0) – invalid entry type value
	TOCEntryTypeTitle   TOCEntryType = C.GST_TOC_ENTRY_TYPE_TITLE   // (1) – entry is a title (i.e. a part of a sequence)
	TOCEntryTypeTrack   TOCEntryType = C.GST_TOC_ENTRY_TYPE_TRACK   // (2) – entry is a track (i.e. a part of a sequence)
	TOCEntryTypeChapter TOCEntryType = C.GST_TOC_ENTRY_TYPE_CHAPTER // (3) – entry is a chapter (i.e. a part of a sequence)
)

Type castings of TOCEntryTypes

type TOCLoopType

type TOCLoopType int

TOCLoopType represents a GstTocLoopType

const (
	TOCLoopNone     TOCLoopType = C.GST_TOC_LOOP_NONE      // (0) – single forward playback
	TOCLoopForward  TOCLoopType = C.GST_TOC_LOOP_FORWARD   // (1) – repeat forward
	TOCLoopReverse  TOCLoopType = C.GST_TOC_LOOP_REVERSE   // (2) – repeat backward
	TOCLoopPingPong TOCLoopType = C.GST_TOC_LOOP_PING_PONG // (3) – repeat forward and backward
)

Type castings of TOCLoopTypes

type TOCScope

type TOCScope int

TOCScope represents the scope of a TOC.

const (
	// (1) – global TOC representing all selectable options (this is what applications are usually interested in)
	TOCScopeGlobal TOCScope = C.GST_TOC_SCOPE_GLOBAL
	// (2) – TOC for the currently active/selected stream (this is a TOC representing the current stream from start
	// to EOS, and is what a TOC writer / muxer is usually interested in; it will usually be a subset of the global
	// TOC, e.g. just the chapters of the current title, or the chapters selected for playback from the current title)
	TOCScopeCurrent TOCScope = C.GST_TOC_SCOPE_CURRENT
)

Type castings of TOCScopes.

func (TOCScope) String

func (t TOCScope) String() string

String implements a stringer on a TOCScope

type TOCSetter

type TOCSetter interface {
	// Return current TOC the setter uses. The TOC should not be modified without making it writable first.
	GetTOC() *TOC
	// Set the given TOC on the setter. Previously set TOC will be unreffed before setting a new one.
	SetTOC(*TOC)
	// Reset the internal TOC. Elements should call this from within the state-change handler.
	Reset()
}

TOCSetter is an interface that elements can implement to provide TOC writing capabilities.

type Tag

type Tag string

Tag wraps the builtin gstreamer tags

const (
	TagAlbum                        Tag = C.GST_TAG_ALBUM
	TagAlbumArtist                  Tag = C.GST_TAG_ALBUM_ARTIST
	TagAlbumArtistSortName          Tag = C.GST_TAG_ALBUM_ARTIST_SORTNAME
	TagAlbumGain                    Tag = C.GST_TAG_ALBUM_GAIN
	TagAlbumPeak                    Tag = C.GST_TAG_ALBUM_PEAK
	TagAlbumSortName                Tag = C.GST_TAG_ALBUM_SORTNAME
	TagAlbumVolumeCount             Tag = C.GST_TAG_ALBUM_VOLUME_COUNT
	TagAlbumVolumeNumber            Tag = C.GST_TAG_ALBUM_VOLUME_NUMBER
	TagApplicationData              Tag = C.GST_TAG_APPLICATION_DATA
	TagApplicationName              Tag = C.GST_TAG_APPLICATION_NAME
	TagArtist                       Tag = C.GST_TAG_ARTIST
	TagArtistSortName               Tag = C.GST_TAG_ARTIST_SORTNAME
	TagAttachment                   Tag = C.GST_TAG_ATTACHMENT
	TagAudioCodec                   Tag = C.GST_TAG_AUDIO_CODEC
	TagBeatsPerMinute               Tag = C.GST_TAG_BEATS_PER_MINUTE
	TagBitrate                      Tag = C.GST_TAG_BITRATE
	TagCodec                        Tag = C.GST_TAG_CODEC
	TagComment                      Tag = C.GST_TAG_COMMENT
	TagComposer                     Tag = C.GST_TAG_COMPOSER
	TagComposerSortName             Tag = C.GST_TAG_COMPOSER_SORTNAME
	TagConductor                    Tag = C.GST_TAG_CONDUCTOR
	TagContact                      Tag = C.GST_TAG_CONTACT
	TagContainerFormat              Tag = C.GST_TAG_CONTAINER_FORMAT
	TagCopyright                    Tag = C.GST_TAG_COPYRIGHT
	TagCopyrightURI                 Tag = C.GST_TAG_COPYRIGHT_URI
	TagDate                         Tag = C.GST_TAG_DATE
	TagDateTime                     Tag = C.GST_TAG_DATE_TIME
	TagDescription                  Tag = C.GST_TAG_DESCRIPTION
	TagDeviceManufacturer           Tag = C.GST_TAG_DEVICE_MANUFACTURER
	TagDeviceModel                  Tag = C.GST_TAG_DEVICE_MODEL
	TagDuration                     Tag = C.GST_TAG_DURATION
	TagEncodedBy                    Tag = C.GST_TAG_ENCODED_BY
	TagEncoder                      Tag = C.GST_TAG_ENCODER
	TagEncoderVersion               Tag = C.GST_TAG_ENCODER_VERSION
	TagExtendedComment              Tag = C.GST_TAG_EXTENDED_COMMENT
	TagGenre                        Tag = C.GST_TAG_GENRE
	TagGeoLocationCaptureDirection  Tag = C.GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION
	TagGeoLocationCity              Tag = C.GST_TAG_GEO_LOCATION_CITY
	TagGeoLocationCountry           Tag = C.GST_TAG_GEO_LOCATION_COUNTRY
	TagGeoLocationElevation         Tag = C.GST_TAG_GEO_LOCATION_ELEVATION
	TagGeoLocationHoriozontalError  Tag = C.GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR
	TagGeoLocationLatitude          Tag = C.GST_TAG_GEO_LOCATION_LATITUDE
	TagGeoLocationLongitude         Tag = C.GST_TAG_GEO_LOCATION_LONGITUDE
	TagGeoLocationMovementDirection Tag = C.GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
	TagGeoLocationMovementSpeed     Tag = C.GST_TAG_GEO_LOCATION_MOVEMENT_SPEED
	TagGeoLocationName              Tag = C.GST_TAG_GEO_LOCATION_NAME
	TagGeoLocationSubLocation       Tag = C.GST_TAG_GEO_LOCATION_SUBLOCATION
	TagGrouping                     Tag = C.GST_TAG_GROUPING
	TagHomepage                     Tag = C.GST_TAG_HOMEPAGE
	TagImage                        Tag = C.GST_TAG_IMAGE
	TagImageOrientation             Tag = C.GST_TAG_IMAGE_ORIENTATION
	TagInterpretedBy                Tag = C.GST_TAG_INTERPRETED_BY
	TagISRC                         Tag = C.GST_TAG_ISRC
	TagKeywords                     Tag = C.GST_TAG_KEYWORDS
	TagLanguageCode                 Tag = C.GST_TAG_LANGUAGE_CODE
	TagLanguageName                 Tag = C.GST_TAG_LANGUAGE_NAME
	TagLicense                      Tag = C.GST_TAG_LICENSE
	TagLicenseURI                   Tag = C.GST_TAG_LICENSE_URI
	TagLocation                     Tag = C.GST_TAG_LOCATION
	TagLyrics                       Tag = C.GST_TAG_LYRICS
	TagMaximumBitrate               Tag = C.GST_TAG_MAXIMUM_BITRATE
	TagMIDIBaseNote                 Tag = C.GST_TAG_MIDI_BASE_NOTE
	TagMinimumBitrate               Tag = C.GST_TAG_MINIMUM_BITRATE
	TagNominalBitrate               Tag = C.GST_TAG_NOMINAL_BITRATE
	TagOrganization                 Tag = C.GST_TAG_ORGANIZATION
	TagPerformer                    Tag = C.GST_TAG_PERFORMER
	TagPreviewImage                 Tag = C.GST_TAG_PREVIEW_IMAGE
	TagPrivateData                  Tag = C.GST_TAG_PRIVATE_DATA
	TagPublisher                    Tag = C.GST_TAG_PUBLISHER
	TagReferenceLevel               Tag = C.GST_TAG_REFERENCE_LEVEL
	TagSerial                       Tag = C.GST_TAG_SERIAL
	TagShowEpisodeNumber            Tag = C.GST_TAG_SHOW_EPISODE_NUMBER
	TagShowName                     Tag = C.GST_TAG_SHOW_NAME
	TagShowSeasonNumber             Tag = C.GST_TAG_SHOW_SEASON_NUMBER
	TagShowSortName                 Tag = C.GST_TAG_SHOW_SORTNAME
	TagSubtitleCodec                Tag = C.GST_TAG_SUBTITLE_CODEC
	TagTitle                        Tag = C.GST_TAG_TITLE
	TagTitleSortName                Tag = C.GST_TAG_TITLE_SORTNAME
	TagTrackCount                   Tag = C.GST_TAG_TRACK_COUNT
	TagTrackGain                    Tag = C.GST_TAG_TRACK_GAIN
	TagTrackNumber                  Tag = C.GST_TAG_TRACK_NUMBER
	TagTrackPeak                    Tag = C.GST_TAG_TRACK_PEAK
	TagUserRating                   Tag = C.GST_TAG_USER_RATING
	TagVersion                      Tag = C.GST_TAG_VERSION
	TagVideoCodec                   Tag = C.GST_TAG_VIDEO_CODEC
)

Type castings of Tags For more information see: https://gstreamer.freedesktop.org/documentation/gstreamer/gsttaglist.html?gi-language=c#constants

type TagFlag

type TagFlag int

TagFlag represents a GstTagFlag

const (
	TagFlagUndefined TagFlag = C.GST_TAG_FLAG_UNDEFINED // (0) – undefined flag
	TagFlagMeta      TagFlag = C.GST_TAG_FLAG_META      // (1) – tag is meta data
	TagFlagEncoded   TagFlag = C.GST_TAG_FLAG_ENCODED   // (2) – tag is encoded
	TagFlagDecoded   TagFlag = C.GST_TAG_FLAG_DECODED   // (3) – tag is decoded
	TagFlagCount     TagFlag = C.GST_TAG_FLAG_COUNT     // (4) – number of tag flags
)

Type castins of TagFlags

type TagList

type TagList struct {
	// contains filtered or unexported fields
}

TagList is a go wrapper around a GstTagList. For now, until the rest of the methods are implemnented, this struct is primarily used for retrieving serialized copies of the tags.

func FromGstTagListUnsafeFull

func FromGstTagListUnsafeFull(tags unsafe.Pointer) *TagList

FromGstTagListUnsafeFull wraps the pointer to the given C GstTagList with the go type. This is meant for internal usage and is exported for visibility to other packages.

func FromGstTagListUnsafeNone

func FromGstTagListUnsafeNone(tags unsafe.Pointer) *TagList

FromGstTagListUnsafeNone wraps the pointer to the given C GstTagList with the go type. This is meant for internal usage and is exported for visibility to other packages.

func NewEmptyTagList

func NewEmptyTagList() *TagList

NewEmptyTagList returns a new empty tag list.

tagList := gst.NewEmptyTagList()
fmt.Println(tagList.IsEmpty())
// true

func NewTagListFromString

func NewTagListFromString(tags string) *TagList

NewTagListFromString creates a new tag list from the given string. This is the same format produced by the stringer interface on the TagList.

func (*TagList) AddValue

func (t *TagList) AddValue(mergeMode TagMergeMode, tag Tag, value interface{})

AddValue adds a value to a given tag using the given merge mode. If the value provided cannot be coerced to a GValue, nothing will happen.

tagList := gst.NewEmptyTagList()
tagList.AddValue(gst.TagMergeAppend, gst.TagAlbum, "MyNewAlbum")
myAlbum, _ := tagList.GetString(gst.TagAlbum)
fmt.Println(myAlbum)
// MyNewAlbum

func (*TagList) AddValues

func (t *TagList) AddValues(mergeMode TagMergeMode, tag Tag, vals ...interface{})

AddValues can be used to add multiple values to a tag with the given merge mode. Values that cannot be coerced to C types will be ignored.

func (*TagList) Copy

func (t *TagList) Copy() *TagList

Copy creates a new TagList as a copy of the old taglist. The new taglist will have a refcount of 1, owned by the caller, and will be writable as a result.

func (*TagList) ForEach

func (t *TagList) ForEach(f TagListForEachFunc)

ForEach calls the given function for each tag inside the tag list. Note that if there is no tag, the function won't be called at all.

tagList := gst.NewEmptyTagList()

tagList.AddValue(gst.TagMergeAppend, gst.TagAlbumArtist, "tinyzimmer")
tagList.AddValue(gst.TagMergeAppend, gst.TagAlbum, "GstreamerInGo")

tagList.ForEach(func(_ *gst.TagList, tag gst.Tag) {
    val, _ := tagList.GetString(tag)
    fmt.Println(tag, ":", val)
})

// album-artist : tinyzimmer
// album : GstreamerInGo

func (*TagList) GetBool

func (t *TagList) GetBool(tag Tag) (value, ok bool)

GetBool returns the boolean value at the given tag key. If multiple values are associated with the tag they are merged.

func (*TagList) GetBoolIndex

func (t *TagList) GetBoolIndex(tag Tag, idx uint) (value, ok bool)

GetBoolIndex retrieves the bool at the given index in the tag key.

func (*TagList) GetDate

func (t *TagList) GetDate(tag Tag) (value time.Time, ok bool)

GetDate returns the date stored at the given tag key. If there are multiple values, the first one is returned.

func (*TagList) GetDateIndex

func (t *TagList) GetDateIndex(tag Tag, idx uint) (value time.Time, ok bool)

GetDateIndex returns the date stored at the given index in tag key.

func (*TagList) GetDateTime

func (t *TagList) GetDateTime(tag Tag) (value time.Time, ok bool)

GetDateTime returns the date and time stored at the given tag key. If there are multiple values, the first one is returned.

func (*TagList) GetDateTimeIndex

func (t *TagList) GetDateTimeIndex(tag Tag, idx uint) (value time.Time, ok bool)

GetDateTimeIndex returns the date and time stored at the given tag key at the given index.

func (*TagList) GetFloat32

func (t *TagList) GetFloat32(tag Tag) (value float32, ok bool)

GetFloat32 returns the float at the given tag key, merging multiple values into one if multiple values are associated with the tag.

func (*TagList) GetFloat32Index

func (t *TagList) GetFloat32Index(tag Tag, idx uint) (value float32, ok bool)

GetFloat32Index returns the float at the index of the given tag key.

func (*TagList) GetFloat64

func (t *TagList) GetFloat64(tag Tag) (value float64, ok bool)

GetFloat64 returns the float at the given tag key, merging multiple values into one if multiple values are associated with the tag. This is the equivalent of a C double stored in the tag.

func (*TagList) GetFloat64Index

func (t *TagList) GetFloat64Index(tag Tag, idx uint) (value float64, ok bool)

GetFloat64Index returns the float at the index of the given tag key.

func (*TagList) GetInt32

func (t *TagList) GetInt32(tag Tag) (value int32, ok bool)

GetInt32 returns the integer at the given tag key, merging multiple values into one if multiple values are associated with the tag.

func (*TagList) GetInt32Index

func (t *TagList) GetInt32Index(tag Tag, idx uint) (value int32, ok bool)

GetInt32Index returns the integer at the index of the given tag key.

func (*TagList) GetInt64

func (t *TagList) GetInt64(tag Tag) (value int64, ok bool)

GetInt64 returns the integer at the given tag key, merging multiple values into one if multiple values are associated with the tag.

func (*TagList) GetInt64Index

func (t *TagList) GetInt64Index(tag Tag, idx uint) (value int64, ok bool)

GetInt64Index returns the integer at the index of the given tag key.

func (*TagList) GetPointer

func (t *TagList) GetPointer(tag Tag) (value unsafe.Pointer, ok bool)

GetPointer returns the C pointer stored at the given tag key, merging values if there are multiple.

func (*TagList) GetPointerIndex

func (t *TagList) GetPointerIndex(tag Tag, idx uint) (value unsafe.Pointer, ok bool)

GetPointerIndex returns the C pointer stored at the given tag key index.

func (*TagList) GetSample

func (t *TagList) GetSample(tag Tag) (value *Sample, ok bool)

GetSample copies the first sample for the given tag in the taglist.

func (*TagList) GetSampleIndex

func (t *TagList) GetSampleIndex(tag Tag, idx uint) (value *Sample, ok bool)

GetSampleIndex copies the sample for the given index in tag in the taglist.

func (*TagList) GetScope

func (t *TagList) GetScope() TagScope

GetScope returns the scope for this TagList.

func (*TagList) GetString

func (t *TagList) GetString(tag Tag) (value string, ok bool)

GetString returns the string for the given tag, possibly merging multiple values into one.

func (*TagList) GetStringIndex

func (t *TagList) GetStringIndex(tag Tag, idx uint) (value string, ok bool)

GetStringIndex returns the string for the given index in tag.

func (*TagList) GetTagSize

func (t *TagList) GetTagSize(tagKey string) int

GetTagSize returns the number of tag values at the given tag key.

func (*TagList) GetUint32

func (t *TagList) GetUint32(tag Tag) (value uint32, ok bool)

GetUint32 returns the unsigned integer at the given tag key, merging multiple values into one if multiple values are associated with the tag.

func (*TagList) GetUint32Index

func (t *TagList) GetUint32Index(tag Tag, idx uint) (value uint32, ok bool)

GetUint32Index returns the unsigned integer at the index of the given tag key.

func (*TagList) GetUint64

func (t *TagList) GetUint64(tag Tag) (value uint64, ok bool)

GetUint64 returns the unsigned integer at the given tag key, merging multiple values into one if multiple values are associated with the tag.

func (*TagList) GetUint64Index

func (t *TagList) GetUint64Index(tag Tag, idx uint) (value uint64, ok bool)

GetUint64Index returns the unsigned integer at the index of the given tag key.

func (*TagList) GetValueIndex

func (t *TagList) GetValueIndex(tag Tag, idx uint) interface{}

GetValueIndex retrieves the GValue at the given index in tag, or nil if none exists. Note that this function can also return nil if the stored value cannot be cleanly coerced to a go type. It is safer to use the other functions provided when you know the expected return type.

func (*TagList) Insert

func (t *TagList) Insert(tagList *TagList, mergeMode TagMergeMode)

Insert inserts the tags from the provided list using the given merge mode.

func (*TagList) Instance

func (t *TagList) Instance() *C.GstTagList

Instance returns the underlying GstTagList instance.

func (*TagList) IsEmpty

func (t *TagList) IsEmpty() bool

IsEmpty returns true if this tag list is empty.

func (*TagList) IsEqual

func (t *TagList) IsEqual(tagList *TagList) bool

IsEqual checks if the two tag lists are equal.

func (*TagList) IsWritable

func (t *TagList) IsWritable() bool

IsWritable returns true if this TagList is writable.

func (*TagList) MakeWritable

func (t *TagList) MakeWritable() *TagList

MakeWritable will return a writable copy of the tag list if it is not already so.

func (*TagList) Merge

func (t *TagList) Merge(tagList *TagList, mergeMode TagMergeMode) *TagList

Merge merges the two tag lists with the given mode.

func (*TagList) NumTags

func (t *TagList) NumTags() int

NumTags returns the number of key/value pairs in ths TagList

func (*TagList) PeekStringIndex

func (t *TagList) PeekStringIndex(tag Tag, idx uint) (value string, ok bool)

PeekStringIndex peeks at the value that is at the given index for the given tag in the given list.

func (*TagList) Ref

func (t *TagList) Ref() *TagList

Ref increases the ref count on this TagList by one.

func (*TagList) RemoveTag

func (t *TagList) RemoveTag(tag Tag)

RemoveTag removes the values for the given tag in this list.

func (*TagList) SetScope

func (t *TagList) SetScope(scope TagScope)

SetScope sets the scope of this TagList. By default, the scope of a tag list is stream scope.

func (*TagList) String

func (t *TagList) String() string

String implements a stringer on the TagList and serializes it to a string.

func (*TagList) TagNameAt

func (t *TagList) TagNameAt(idx int) string

TagNameAt returns the tag name at the given index.

func (*TagList) Unref

func (t *TagList) Unref()

Unref decreses the ref count on this TagList by one. When the ref count reaches zero, the object is destroyed.

type TagListForEachFunc

type TagListForEachFunc func(tagList *TagList, tag Tag)

TagListForEachFunc is a function that will be called in ForEach. The function may not modify the tag list.

type TagMergeMode

type TagMergeMode int

TagMergeMode represents a GstTagMergeMode. See: https://gstreamer.freedesktop.org/documentation/gstreamer/gsttaglist.html#GstTagMergeMode

const (
	TagMergeUndefined  TagMergeMode = C.GST_TAG_MERGE_UNDEFINED   // (0) – undefined merge mode
	TagMergeReplaceAll TagMergeMode = C.GST_TAG_MERGE_REPLACE_ALL // (1) – replace all tags (clear list and append)
	TagMergeReplace    TagMergeMode = C.GST_TAG_MERGE_REPLACE     // (2) – replace tags
	TagMergeAppend     TagMergeMode = C.GST_TAG_MERGE_APPEND      // (3) – append tags
	TagMergePrepend    TagMergeMode = C.GST_TAG_MERGE_PREPEND     // (4) – prepend tags
	TagMergeKeep       TagMergeMode = C.GST_TAG_MERGE_KEEP        // (5) – keep existing tags
	TagMergeKeepAll    TagMergeMode = C.GST_TAG_MERGE_KEEP_ALL    // (6) – keep all existing tags
	TagMergeCount      TagMergeMode = C.GST_TAG_MERGE_COUNT       // (7) – the number of merge modes
)

Type castings of TagMergeModes

type TagScope

type TagScope int

TagScope represents a GstTagScope

const (
	TagScopeStream TagScope = C.GST_TAG_SCOPE_STREAM // (0) – tags specific to this single stream
	TagScopeGlobal TagScope = C.GST_TAG_SCOPE_GLOBAL // (1) – global tags for the complete medium
)

Type castings of tag scopes

type TagSetter

type TagSetter interface {
	// Returns the current list of tags the setter uses. The list should not be modified or freed.
	GetTagList() *TagList
	// Adds the given tag/value pair using the given merge mode. If the tag value cannot be coerced
	// to a GValue when dealing with C elements, nothing will happen.
	AddTagValue(mergeMode TagMergeMode, tagKey Tag, tagValue interface{})
	// Merges a tag list with the given merge mode
	MergeTags(*TagList, TagMergeMode)
	// Resets the internal tag list. Elements should call this from within the state-change handler.
	ResetTags()
	// Queries the mode by which tags inside the setter are overwritten by tags from events
	GetTagMergeMode() TagMergeMode
	// Sets the given merge mode that is used for adding tags from events to tags specified by this interface.
	// The default is TagMergeKeep, which keeps the tags set with this interface and discards tags from events.
	SetTagMergeMode(TagMergeMode)
}

TagSetter is an interface that elements can implement to provide Tag writing capabilities.

type TaskState

type TaskState int

TaskState casts GstTaskState

const (
	TaskStarted TaskState = C.GST_TASK_STARTED // (0) – the task is started and running
	TaskStopped TaskState = C.GST_TASK_STOPPED // (1) – the task is stopped
	TaskPaused  TaskState = C.GST_TASK_PAUSED  // (2) – the task is paused
)

Type castings

type TypeFindProbability

type TypeFindProbability int

TypeFindProbability represents a probability for type find functions. Higher values reflect higher certainty.

const (
	TypeFindNone          TypeFindProbability = C.GST_TYPE_FIND_NONE           // (0) – type undetected.
	TypeFindMinimum       TypeFindProbability = C.GST_TYPE_FIND_MINIMUM        // (1) – unlikely typefind.
	TypeFindPossible      TypeFindProbability = C.GST_TYPE_FIND_POSSIBLE       // (50) – possible type detected.
	TypeFindLikely        TypeFindProbability = C.GST_TYPE_FIND_LIKELY         // (80) – likely a type was detected.
	TypeFindNearlyCertain TypeFindProbability = C.GST_TYPE_FIND_NEARLY_CERTAIN // (99) – nearly certain that a type was detected.
	TypeFindMaximum       TypeFindProbability = C.GST_TYPE_FIND_MAXIMUM        // (100) – very certain a type was detected.
)

Type castings

type URIHandler

type URIHandler interface {
	// GetURI gets the currently handled URI.
	GetURI() string
	// GetURIType returns the type of URI this element can handle.
	GetURIType() URIType
	// GetProtocols returns the protocols this element can handle.
	GetProtocols() []string
	// SetURI tries to set the URI of the given handler.
	SetURI(string) (bool, error)
}

URIHandler represents an interface that elements can implement to provide URI handling capabilities.

type URIType

type URIType int

URIType casts C GstURIType to a go type

const (
	URIUnknown URIType = C.GST_URI_UNKNOWN // (0) – The URI direction is unknown
	URISink    URIType = C.GST_URI_SINK    // (1) – The URI is a consumer.
	URISource  URIType = C.GST_URI_SRC     // (2) - The URI is a producer.
)

Type cast URI types

func (URIType) String

func (u URIType) String() string

type ValueArrayValue

type ValueArrayValue glib.Value

ValueArrayValue represets a GstValueArray.

func ValueArray

func ValueArray(ss []interface{}) *ValueArrayValue

ValueArray converts the given slice of Go types into a ValueArrayValue. This function can return nil on any conversion or memory allocation errors.

func (*ValueArrayValue) Size

func (v *ValueArrayValue) Size() uint

Size returns the size of the array.

func (*ValueArrayValue) ToGValue

func (v *ValueArrayValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

func (*ValueArrayValue) ValueAt

func (v *ValueArrayValue) ValueAt(idx uint) interface{}

ValueAt returns the value at the index in the array, or nil on any error.

type ValueCmp

type ValueCmp int

ValueCmp represents the result of comparing two values.

const (
	ValueEqual       ValueCmp = C.GST_VALUE_EQUAL        // Indicates that the first value provided to a comparison function (ValueCompare) is equal to the second one.
	ValueGreaterThan ValueCmp = C.GST_VALUE_GREATER_THAN // Indicates that the first value provided to a comparison function (ValueCompare) is greater than the second one.
	ValueLessThan    ValueCmp = C.GST_VALUE_LESS_THAN    // Indicates that the first value provided to a comparison function (ValueCompare) is lesser than the second one.
	ValueUnordered   ValueCmp = C.GST_VALUE_UNORDERED    // Indicates that the comparison function (ValueCompare) can not determine a order for the two provided values.

)

ValueCmp castings

func ValueCompare

func ValueCompare(value1, value2 *glib.Value) ValueCmp

ValueCompare compares value1 and value2. If value1 and value2 cannot be compared, the function returns ValueUnordered. Otherwise, if value1 is greater than value2, ValueGreaterThan is returned. If value1 is less than value2, ValueLessThan is returned. If the values are equal, ValueEqual is returned.

type ValueListValue

type ValueListValue glib.Value

ValueListValue represets a GstValueList.

func ValueList

func ValueList(ss []interface{}) *ValueListValue

ValueList converts the given slice of Go types into a ValueListValue. This function can return nil on any conversion or memory allocation errors.

func (*ValueListValue) Concat

func (v *ValueListValue) Concat(value *ValueListValue) *ValueListValue

Concat concatenates copies of this list and value into a new list. Values that are not of type TypeValueList are treated as if they were lists of length 1. dest will be initialized to the type TypeValueList.

func (*ValueListValue) Merge

func (v *ValueListValue) Merge(value *ValueListValue) *ValueListValue

Merge merges copies of value into this list. Values that are not of type TypeValueList are treated as if they were lists of length 1.

The result will be put into a new value and will either be a list that will not contain any duplicates, or a non-list type (if the lists were equal).

func (*ValueListValue) Size

func (v *ValueListValue) Size() uint

Size returns the size of the list.

func (*ValueListValue) ToGValue

func (v *ValueListValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

func (*ValueListValue) ValueAt

func (v *ValueListValue) ValueAt(idx uint) interface{}

ValueAt returns the value at the index in the lise, or nil on any error.

type Version

type Version int

Version represents information about the current GST version.

const (
	// VersionMajor is the major version number of the GStreamer core.
	VersionMajor Version = C.GST_VERSION_MAJOR
	// VersionMinor is the minor version number of the GStreamer core.
	VersionMinor Version = C.GST_VERSION_MINOR
	VersionMicro Version = C.GST_VERSION_MICRO
)

Directories

Path Synopsis
Package app contains bindings for the gstreamer-app C API.
Package app contains bindings for the gstreamer-app C API.
Package audio contains bindings for the gstaudio C API.
Package audio contains bindings for the gstaudio C API.
Package base contains bindings for extendable GStreamer base objects.
Package base contains bindings for extendable GStreamer base objects.
gstsdp contains bindings for the gstreamer sdp library.
gstsdp contains bindings for the gstreamer sdp library.
gstwebrtc contains bindings for the gstreamer webrtclib.
gstwebrtc contains bindings for the gstreamer webrtclib.
Package pbutils contains bindings for libgstpbutils.
Package pbutils contains bindings for libgstpbutils.
Package rtp contains bindings for the GStreamer RTP library.
Package rtp contains bindings for the GStreamer RTP library.
Package video contains bindings for the gstvideo C API.
Package video contains bindings for the gstvideo C API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL