gst

package
v0.2.33 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: LGPL-2.1 Imports: 18 Imported by: 70

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

Variables

View Source
var BufferOffsetNone time.Duration = time.Duration(-1)

BufferOffsetNone is a var for no-offset return results.

View Source
var (
	CapsFeatureMemorySystemMemory string = C.GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY
)

Go casting of pre-baked caps features

View Source
var ClockTimeNone time.Duration = time.Duration(-1)

ClockTimeNone means infinite timeout or an empty value

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 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 added in v0.0.9

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

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

func Deinit added in v0.2.27

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 FilterProtectionSystemByDecryptors added in v0.0.9

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 added in v0.0.9

func GetAPITags(apiType glib.Type) []string

GetAPITags retrieves the tags for the given api type.

func GetMaxBufferMemory added in v0.0.9

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 added in v0.0.9

func NextGroupID() uint

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

func RegisterAPIType added in v0.0.9

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 added in v0.1.7

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.

func RegisterPlugin added in v0.1.7

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 added in v0.0.9

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 ValueDeserialize added in v0.2.15

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 added in v0.2.15

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 added in v0.2.15

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 added in v0.2.15

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 added in v0.2.15

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 added in v0.2.15

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 added in v0.2.15

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

ValueIsSubset checks that value1 is a subset of value2.

func ValueSerialize added in v0.2.15

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 added in v0.2.15

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 added in v0.2.15

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

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

func ValuesCanCompare added in v0.2.15

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

ValuesCanCompare determines if val1 and val2 can be compared.

func ValuesCanIntersect added in v0.2.15

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 added in v0.2.15

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

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

func ValuesCanUnion added in v0.2.15

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 added in v0.0.9

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

AllocationParams wraps the GstAllocationParams.

func FromGstAllocationParamsUnsafe added in v0.1.9

func FromGstAllocationParamsUnsafe(alloc unsafe.Pointer) *AllocationParams

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

func NewAllocationParams added in v0.0.9

func NewAllocationParams() *AllocationParams

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

func (*AllocationParams) Copy added in v0.0.9

Copy copies these AllocationParams.

func (*AllocationParams) Free added in v0.0.9

func (a *AllocationParams) Free()

Free frees the underlying AllocationParams

func (*AllocationParams) GetAlignment added in v0.0.9

func (a *AllocationParams) GetAlignment() int64

GetAlignment returns the desired alignment of the memory.

func (*AllocationParams) GetFlags added in v0.0.9

func (a *AllocationParams) GetFlags() MemoryFlags

GetFlags returns the flags on these AllocationParams.

func (*AllocationParams) GetPadding added in v0.0.9

func (a *AllocationParams) GetPadding() int64

GetPadding returns the desired padding size.

func (*AllocationParams) GetPrefix added in v0.0.9

func (a *AllocationParams) GetPrefix() int64

GetPrefix returns the desired prefix size.

func (*AllocationParams) Init added in v0.0.9

func (a *AllocationParams) Init()

Init initializes these AllocationParams to their original values.

func (*AllocationParams) Instance added in v0.0.9

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

Instance returns the underlying GstAllocationParams.

func (*AllocationParams) SetAlignment added in v0.0.9

func (a *AllocationParams) SetAlignment(align int64)

SetAlignment sets the desired alignment of the memory.

func (*AllocationParams) SetFlags added in v0.0.9

func (a *AllocationParams) SetFlags(flags MemoryFlags)

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

func (*AllocationParams) SetPadding added in v0.0.9

func (a *AllocationParams) SetPadding(padding int64)

SetPadding sets the desired padding size.

func (*AllocationParams) SetPrefix added in v0.0.9

func (a *AllocationParams) SetPrefix(prefix int64)

SetPrefix sets the desired prefix size.

type Allocator added in v0.0.9

type Allocator struct{ *Object }

Allocator is a go representation of a GstAllocator

func DefaultAllocator added in v0.0.9

func DefaultAllocator() *Allocator

DefaultAllocator returns the default GstAllocator.

func FromGstAllocatorUnsafeFull added in v0.2.5

func FromGstAllocatorUnsafeFull(alloc unsafe.Pointer) *Allocator

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

func FromGstAllocatorUnsafeNone added in v0.2.5

func FromGstAllocatorUnsafeNone(alloc unsafe.Pointer) *Allocator

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

func (*Allocator) Alloc added in v0.0.9

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 added in v0.0.9

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

Free memory that was originally allocated with this allocator.

func (*Allocator) Instance added in v0.0.9

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

Instance returns the underlying GstAllocator instance.

func (*Allocator) MemType added in v0.0.9

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 added in v0.0.9

func NewBin(name string) *Bin

NewBin returns a new Bin with the given name.

func NewBinFromString added in v0.2.26

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 added in v0.2.4

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 added in v0.1.0

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 added in v0.1.0

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 added in v0.1.0

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 added in v0.0.9

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. If a pad is found, the caller owns a reference to it and should unref it when it is not needed any longer.

func (*Bin) GetAllByInterface added in v0.1.0

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. The function will return a series of Elements that should be unreffed after use.

func (*Bin) GetByInterface added in v0.1.0

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. Unref after usage.

func (*Bin) GetElementByNameRecursive added in v0.0.9

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. Unref after usage.

func (*Bin) GetElements

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

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

func (*Bin) GetElementsRecursive added in v0.0.9

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

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

func (*Bin) GetElementsSorted added in v0.0.9

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. Unref elements after usage.

func (*Bin) GetSourceElements

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

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

func (*Bin) GetSuppressedFlags added in v0.0.9

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 added in v0.2.4

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

ParentAddElement chains up to the parent AddElement handler.

func (*Bin) ParentDeepElementAdded added in v0.2.4

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

ParentDeepElementAdded chains up to the parent DeepElementAdded handler.

func (*Bin) ParentDeepElementRemoved added in v0.2.4

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

ParentDeepElementRemoved chains up to the parent DeepElementRemoved handler.

func (*Bin) ParentDoLatency added in v0.2.4

func (b *Bin) ParentDoLatency() bool

ParentDoLatency chains up to the parent DoLatency handler.

func (*Bin) ParentElementAdded added in v0.2.4

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

ParentElementAdded chains up to the parent ElementAdded handler.

func (*Bin) ParentElementRemoved added in v0.2.4

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

ParentElementRemoved chains up to the parent ElementRemoved handler.

func (*Bin) ParentHandleMessage added in v0.2.4

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

ParentHandleMessage chains up to the parent HandleMessage handler.

func (*Bin) ParentRemoveElement added in v0.2.4

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

ParentRemoveElement chains up to the parent RemoveElement handler.

func (*Bin) RecalculateLatency added in v0.0.9

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 added in v0.0.9

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

Remove removes an element from the Bin.

func (*Bin) RemoveMany added in v0.0.9

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

RemoveMany is a go implementation of `gst_bin_remove_many`.

func (*Bin) SetSuppressedFlags added in v0.0.9

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 added in v0.0.9

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 added in v0.2.4

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 added in v0.2.15

type Bitmask uint64

Bitmask represents a bitmask value.

func ValueGetBitmask added in v0.2.15

func ValueGetBitmask(value *glib.Value) Bitmask

ValueGetBitmask gets the bitmask from the given value.

func (Bitmask) ToGValue added in v0.2.15

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 added in v0.2.5

func FromGstBufferUnsafeFull(buf unsafe.Pointer) *Buffer

FromGstBufferUnsafeFull wraps the given buffer without taking an additional reference.

func FromGstBufferUnsafeNone added in v0.2.5

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 added in v0.0.9

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 added in v0.0.9

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")
 })
 if buf != nil {
     buf.Unref()
 }

// > buffer was destroyed

func NewBufferWithSize added in v0.1.0

func NewBufferWithSize(size int64) *Buffer

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

func NewEmptyBuffer added in v0.0.9

func NewEmptyBuffer() *Buffer

NewEmptyBuffer returns a new empty buffer.

func ToGstBuffer added in v0.2.8

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 added in v0.0.9

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")

buf.Unref()

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

func (*Buffer) AddParentMeta added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (b *Buffer) AddReferenceTimestampMeta(ref *Caps, timestamp, duration time.Duration) *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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 and BufferOffsetNone.

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 and BufferOffsetNone.

func (*Buffer) DecodingTimestamp

func (b *Buffer) DecodingTimestamp() time.Duration

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 added in v0.0.9

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() time.Duration

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

func (*Buffer) Extract added in v0.0.9

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 added in v0.0.10

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (b *Buffer) GetAllMemory() *Memory

GetAllMemory retrieves all the memory inside this buffer.

func (*Buffer) GetFlags added in v0.0.9

func (b *Buffer) GetFlags() BufferFlags

GetFlags returns the flags on this buffer.

func (*Buffer) GetMemory added in v0.0.9

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

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

func (*Buffer) GetMemoryRange added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (b *Buffer) GetSize() int64

GetSize retrieves the number of Memory blocks in the bffer.

func (*Buffer) GetSizes added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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

HasFlags returns true if this Buffer has the given BufferFlags.

func (*Buffer) InsertMemory added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (b *Buffer) IsWritable() bool

IsWritable returns true if this buffer is writable.

func (*Buffer) IterateMeta added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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() time.Duration

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 added in v0.0.9

func (b *Buffer) Ref() *Buffer

Ref increases the ref count on the buffer by one.

func (*Buffer) RemoveAllMemory added in v0.0.9

func (b *Buffer) RemoveAllMemory()

RemoveAllMemory removes all memory blocks in the buffer.

func (*Buffer) RemoveMemoryAt added in v0.0.9

func (b *Buffer) RemoveMemoryAt(idx uint)

RemoveMemoryAt removes the memory block at the given index.

func (*Buffer) RemoveMemoryRange added in v0.0.9

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 added in v0.0.9

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

RemoveMeta removes the given metadata from the buffer.

func (*Buffer) ReplaceAllMemory added in v0.0.9

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

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

func (*Buffer) ReplaceMemory added in v0.0.9

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

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

func (*Buffer) ReplaceMemoryRange added in v0.0.9

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 added in v0.0.9

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

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

func (*Buffer) ResizeRange added in v0.0.9

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 added in v0.0.10

func (b *Buffer) SetDuration(dur time.Duration)

SetDuration sets the duration on the buffer.

func (*Buffer) SetFlags added in v0.0.9

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

SetFlags sets one or more buffer flags on the buffer.

func (*Buffer) SetPresentationTimestamp added in v0.0.10

func (b *Buffer) SetPresentationTimestamp(dur time.Duration)

SetPresentationTimestamp sets the presentation timestamp on the buffer.

func (*Buffer) SetSize added in v0.0.9

func (b *Buffer) SetSize(size int64)

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

func (*Buffer) Unmap added in v0.1.5

func (b *Buffer) Unmap()

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

func (*Buffer) Unref added in v0.0.9

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 added in v0.0.9

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

UnsetFlags removes one or more flags from the buffer.

type BufferCopyFlags added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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

BufferList is a go wrapper around a GstBufferList for grouping Buffers

func FromGstBufferListUnsafeFull added in v0.2.5

func FromGstBufferListUnsafeFull(buf unsafe.Pointer) *BufferList

FromGstBufferListUnsafeFull wraps the given buffer without taking an additional reference.

func FromGstBufferListUnsafeNone added in v0.2.5

func FromGstBufferListUnsafeNone(buf unsafe.Pointer) *BufferList

FromGstBufferListUnsafeNone is used for returns from transfer-none methods.

func NewBufferList added in v0.0.9

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 added in v0.0.9

func NewBufferListSized(size uint) *BufferList

NewBufferListSized creates a new BufferList with the given size.

func ToGstBufferList added in v0.2.8

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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

Instance returns the underlying GstBufferList.

func (*BufferList) IsWritable added in v0.0.9

func (b *BufferList) IsWritable() bool

IsWritable returns true if this BufferList is writable.

func (*BufferList) Length added in v0.0.9

func (b *BufferList) Length() uint

Length returns the number of buffers in the list.

func (*BufferList) MakeWritable added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.2.5

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 added in v0.2.5

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 added in v0.0.9

func NewBufferPool() *BufferPool

NewBufferPool returns a new BufferPool instance.

func (*BufferPool) AcquireBuffer added in v0.0.9

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

AcquireBuffer acquires a buffer from this pool.

func (*BufferPool) GetConfig added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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

HasOption returns true if this BufferPool supports the given option.

func (*BufferPool) Instance added in v0.0.9

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

Instance returns the underlying GstBufferPool instance.

func (*BufferPool) IsActive added in v0.0.9

func (b *BufferPool) IsActive() bool

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

func (*BufferPool) IsFlushing added in v0.0.9

func (b *BufferPool) IsFlushing() bool

IsFlushing returns true if this BufferPool is currently flushing.

func (*BufferPool) ReleaseBuffer added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (b *BufferPool) SetFlushing(flushing bool)

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

type BufferPoolAcquireFlags added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

type BufferPoolConfig struct{ *Structure }

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

func (*BufferPoolConfig) AddOption added in v0.0.9

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 added in v0.0.9

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

GetAllocator retrieves the allocator and params from config.

func (*BufferPoolConfig) GetOption added in v0.0.9

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

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

func (*BufferPoolConfig) GetParams added in v0.0.9

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 added in v0.0.9

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

HasOption returns true if this config has the given option.

func (*BufferPoolConfig) NumOptions added in v0.0.9

func (b *BufferPoolConfig) NumOptions() uint

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

func (*BufferPoolConfig) SetAllocator added in v0.0.9

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 added in v0.0.9

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

SetParams configures the config with the given parameters.

func (*BufferPoolConfig) Validate added in v0.0.9

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 added in v0.0.8

func (b BufferingMode) String() string

String implements a stringer on a BufferingMode.

type BufferingStats added in v0.0.8

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 added in v0.2.5

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 added in v0.2.5

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 added in v0.0.9

func NewBus() *Bus

NewBus returns a new Bus instance.

// Example of using the bus instance

package main

import (
    "fmt"

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

func main() {
    gst.Init(nil)

    bus := gst.NewBus()
    defer bus.Unref()

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

    bus.Post(gst.NewAsyncStartMessage(elem))

    msg := bus.Pop()
    defer msg.Unref()

    fmt.Println(msg)
}

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

func (*Bus) AddSignalWatch added in v0.0.9

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 added in v0.0.8

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. It is safe to unref the Bus after setting this watch, since the watch itself will take it's own reference to the Bus.

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. The message should be unreffed after usage.

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 added in v0.0.9

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 "cancelled" 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 added in v0.0.9

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 marshalled to the main thread via the main loop.

func (*Bus) GetPollFd added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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. A reference is returned, and needs to be unreffed by the caller.

func (*Bus) Poll added in v0.0.9

func (b *Bus) Poll(msgTypes MessageType, timeout time.Duration) *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 added in v0.0.9

func (b *Bus) Pop() *Message

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

func (*Bus) PopFiltered added in v0.0.9

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 added in v0.0.2

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

PopMessage attempts to pop a message from the bus. It returns nil if none are available. The message should be unreffed after usage.

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 added in v0.0.9

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

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

func (*Bus) RemoveSignalWatch added in v0.0.9

func (b *Bus) RemoveSignalWatch()

RemoveSignalWatch removes a signal watch previously added with AddSignalWatch.

func (*Bus) RemoveWatch added in v0.0.8

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (b *Bus) TimedPop(dur time.Duration) *Message

TimedPop gets a message from the bus, waiting up to the specified timeout. Unref returned messages after usage.

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

func (*Bus) TimedPopFiltered added in v0.0.9

func (b *Bus) TimedPopFiltered(dur time.Duration, 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 < 0, this function will block forever until a matching message was posted on the bus.

type BusSyncHandler added in v0.0.9

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 added in v0.0.9

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 added in v0.0.8

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. There is no need to unref the message unless addtional references are placed on it during processing.

type Caps

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

Caps is a go wrapper around GstCaps.

func FromGstCapsUnsafeFull added in v0.2.5

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 added in v0.2.5

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 added in v0.2.8

func ToGstCaps(caps unsafe.Pointer) *Caps

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

func ValueGetCaps added in v0.2.15

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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. If you only want to hold on to a reference to the data, you should use Ref.

When you are finished with the caps, call Unref on it.

func (*Caps) CopyNth added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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

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

func (*Caps) IsEqualFixed added in v0.0.9

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

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

func (*Caps) IsFixed added in v0.0.9

func (c *Caps) IsFixed() bool

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

func (*Caps) IsStrictlyEqual added in v0.0.9

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

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

func (*Caps) IsSubset added in v0.0.9

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

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

func (*Caps) IsSubsetStructure added in v0.0.9

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

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

func (*Caps) IsSubsetStructureFull added in v0.0.9

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 added in v0.0.9

func (c *Caps) IsWritable() bool

IsWritable returns true if these caps are writable.

func (*Caps) MakeWritable added in v0.0.9

func (c *Caps) MakeWritable() *Caps

MakeWritable returns a writable copy of caps.

func (*Caps) MapInPlace added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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

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

func (*Caps) MergeStructureFull added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (c *Caps) RemoveStructureAt(idx uint)

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

func (*Caps) SetFeaturesAt added in v0.0.9

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

SetFeaturesAt sets the CapsFeatures features for the structure at index.

func (*Caps) SetFeaturesSimple added in v0.0.9

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

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

func (*Caps) SetValue added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (c *Caps) String() string

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

func (*Caps) Subtract added in v0.0.9

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

Subtract subtracts the given caps from these.

func (*Caps) ToGValue added in v0.1.16

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

ToGValue returns a GValue containing the given caps.

func (*Caps) Truncate added in v0.0.9

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 added in v0.2.5

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 added in v0.0.9

func NewCapsFeaturesAny() *CapsFeatures

NewCapsFeaturesAny returns a new ANY CapsFeatures.

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

func NewCapsFeaturesEmpty added in v0.0.9

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 added in v0.2.15

func ValueGetCapsFeatures(value *glib.Value) *CapsFeatures

ValueGetCapsFeatures gets the caps features from the given value.

func (*CapsFeatures) Add added in v0.0.9

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 added in v0.0.9

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

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

func (*CapsFeatures) Copy added in v0.0.9

func (c *CapsFeatures) Copy() *CapsFeatures

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

func (*CapsFeatures) Free added in v0.0.9

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 added in v0.0.9

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

GetNth returns the feature at index.

func (*CapsFeatures) GetSize added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (c *CapsFeatures) Remove(feature string)

Remove removes the given feature.

func (*CapsFeatures) SetParentRefCount added in v0.0.9

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 added in v0.2.15

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

ToGValue implements a glib.ValueTransformer

type CapsIntersectMode added in v0.0.9

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 added in v0.0.9

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

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

type ChildProxy added in v0.0.9

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 added in v0.2.4

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 added in v0.2.4

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

ChildAdded emits the "child-added" signal.

func (*ChildProxy) ChildRemoved added in v0.2.4

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

ChildRemoved emits the "child-removed" signal.

func (*ChildProxy) Get added in v0.2.4

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 added in v0.2.4

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. Unref after usage.

func (*ChildProxy) GetChildByName added in v0.2.4

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. Unref after usage.

func (*ChildProxy) GetChildrenCount added in v0.2.4

func (c *ChildProxy) GetChildrenCount() uint

GetChildrenCount returns the number of child objects the parent contains.

func (*ChildProxy) GetProperty added in v0.2.4

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 added in v0.2.4

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

Instance returns the underlying GstChildProxy instance.

func (*ChildProxy) Lookup added in v0.2.4

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. Unref target after usage.

func (*ChildProxy) Set added in v0.2.4

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 added in v0.2.4

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

SetProperty sets a single property using the ChildProxy mechanism.

type ChildProxyImpl added in v0.2.4

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 added in v0.2.5

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 added in v0.2.5

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 added in v0.0.9

func (c *Clock) AddObservation(slaveTime, masterTime time.Duration) (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 added in v0.0.9

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

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 added in v0.0.9

func (c *Clock) AdjustUnlocked(internal time.Duration) time.Duration

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 added in v0.0.9

func (c *Clock) AdjustWithCalibration(internalTarget, cinternal, cexternal, cnum, cdenom time.Duration) time.Duration

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 added in v0.0.9

func (c *Clock) GetCalibration() (internal, external, rateNum, rateDenom time.Duration)

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

func (*Clock) GetInternalTime added in v0.0.9

func (c *Clock) GetInternalTime() time.Duration

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 added in v0.0.9

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 added in v0.0.9

func (c *Clock) GetResolution() time.Duration

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

func (*Clock) GetTime added in v0.0.9

func (c *Clock) GetTime() time.Duration

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 added in v0.0.9

func (c *Clock) GetTimeout() time.Duration

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 added in v0.0.9

func (c *Clock) NewPeriodicID(startTime, interval time.Duration) *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. ID should be unreffed after usage.

func (*Clock) NewSingleShotID added in v0.0.9

func (c *Clock) NewSingleShotID(at time.Duration) *ClockID

NewSingleShotID gets a ClockID from the clock to trigger a single shot notification at the requested time. The single shot id should be unreffed after usage.

func (*Clock) PeriodicIDReinit added in v0.0.9

func (c *Clock) PeriodicIDReinit(clockID *ClockID, startTime, interval time.Duration) bool

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

func (*Clock) SetCalibration added in v0.0.9

func (c *Clock) SetCalibration(internal, external, rateNum, rateDenom time.Duration)

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

func (*Clock) SetMaster added in v0.0.9

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 added in v0.0.9

func (c *Clock) SetResolution(resolution time.Duration) time.Duration

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 added in v0.0.9

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 added in v0.0.9

func (c *Clock) SetTimeout(timeout time.Duration)

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

func (*Clock) SingleShotIDReinit added in v0.0.9

func (c *Clock) SingleShotIDReinit(clockID *ClockID, at time.Duration) 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 added in v0.0.9

func (c *Clock) UnadjustUnlocked(external time.Duration) time.Duration

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 added in v0.0.9

func (c *Clock) UnadjustWithCalibration(externalTarget, cinternal, cexternal, cnum, cdenom time.Duration) time.Duration

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 added in v0.0.9

func (c *Clock) WaitForSync(timeout time.Duration) 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 added in v0.0.9

type ClockCallback func(clock *Clock, clockTime time.Duration) bool

ClockCallback is the prototype of a clock callback function.

type ClockEntryType added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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

ClockID is a go wrapper around a GstClockID.

func (*ClockID) GetClock added in v0.0.9

func (c *ClockID) GetClock() *Clock

GetClock returns the clock for this ClockID.

func (*ClockID) GetTime added in v0.0.9

func (c *ClockID) GetTime() time.Duration

GetTime returns the time for this ClockID

func (*ClockID) Instance added in v0.0.9

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

Instance returns the underlying pointer.

func (*ClockID) Ref added in v0.0.9

func (c *ClockID) Ref() *ClockID

Ref increaes the ref count on ClockID.

func (*ClockID) Unref added in v0.0.9

func (c *ClockID) Unref()

Unref unrefs a ClockID.

func (*ClockID) Unschedule added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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")
defer pipeline.Unref()

clock := pipeline.GetPipelineClock()

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

id.WaitAsync(func(clock *gst.Clock, clockTime time.Duration) 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 added in v0.0.9

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 ClockTimeDiff added in v0.0.9

type ClockTimeDiff int64

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

type Context added in v0.0.9

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

Context wraps a GstContext object.

func FromGstContextUnsafeFull added in v0.2.5

func FromGstContextUnsafeFull(ctx unsafe.Pointer) *Context

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

func FromGstContextUnsafeNone added in v0.2.5

func FromGstContextUnsafeNone(ctx unsafe.Pointer) *Context

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

func NewContext added in v0.0.9

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 added in v0.0.9

func (c *Context) GetStructure() *Structure

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

func (*Context) GetType added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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

Instance returns the underlying GstContext instance.

func (*Context) IsPersistent added in v0.0.9

func (c *Context) IsPersistent() bool

IsPersistent checks if the context is persistent.

func (*Context) IsWritable added in v0.0.9

func (c *Context) IsWritable() bool

IsWritable returns true if the context is writable.

func (*Context) MakeWritable added in v0.0.9

func (c *Context) MakeWritable() *Context

MakeWritable returns a writable version of the context.

func (*Context) Ref added in v0.2.5

func (c *Context) Ref() *Context

Ref increases the ref count on the Context.

func (*Context) Unref added in v0.2.5

func (c *Context) Unref()

Unref decreases the ref count on the Context.

func (*Context) WritableStructure added in v0.0.9

func (c *Context) WritableStructure() *Structure

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

type DebugCategory added in v0.1.8

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 added in v0.1.8

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) Log added in v0.1.8

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 added in v0.2.23

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

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

func (*DebugCategory) LogError added in v0.2.23

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

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

func (*DebugCategory) LogInfo added in v0.2.23

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

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

func (*DebugCategory) LogLog added in v0.2.23

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

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

func (*DebugCategory) LogMemDump added in v0.2.23

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

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

func (*DebugCategory) LogTrace added in v0.2.23

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

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

func (*DebugCategory) LogWarning added in v0.2.23

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

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

type DebugColorFlags added in v0.1.8

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 added in v0.1.8

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 added in v0.1.0

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 added in v0.1.8

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 behaviour that could lead to problems or weird behaviour 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 Device added in v0.0.8

type Device struct{ *Object }

Device is a Go representation of a GstDevice.

func FromGstDeviceUnsafeFull added in v0.2.5

func FromGstDeviceUnsafeFull(device unsafe.Pointer) *Device

FromGstDeviceUnsafeFull wraps the given device with a finalizer.

func FromGstDeviceUnsafeNone added in v0.2.5

func FromGstDeviceUnsafeNone(device unsafe.Pointer) *Device

FromGstDeviceUnsafeNone wraps the given device with a ref and finalizer.

func (*Device) CreateElement added in v0.0.8

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 added in v0.2.5

func (d *Device) GetCaps() *Caps

GetCaps returns the caps that this device supports. Unref after usage.

func (*Device) GetDeviceClass added in v0.2.5

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 added in v0.2.5

func (d *Device) GetDisplayName() string

GetDisplayName gets the user-friendly name of the device.

func (*Device) GetProperties added in v0.2.5

func (d *Device) GetProperties() *Structure

GetProperties gets the extra properties of the device.

func (*Device) HasClasses added in v0.0.8

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

HasClasses checks if device matches all of the given classes.

func (*Device) Instance added in v0.0.8

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

Instance returns the underlying GstDevice object.

func (*Device) ReconfigureElement added in v0.0.8

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 Domain added in v0.1.7

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 added in v0.2.5

func FromGstElementUnsafeFull(elem unsafe.Pointer) *Element

FromGstElementUnsafeFull wraps the given element with a finalizer.

func FromGstElementUnsafeNone added in v0.2.5

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 added in v0.2.4

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

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

func ToElement added in v0.1.7

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 added in v0.1.0

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 added in v0.1.0

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 like SetState except it will block until the transition is complete.

func (*Element) CallAsync added in v0.1.0

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 added in v0.1.9

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

ChangeState performs the given transition on this element.

func (*Element) Connect added in v0.0.10

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 derivitives).

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

func (*Element) ContinueState added in v0.2.19

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 added in v0.1.0

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. Arguments to callback functions connected to this signal must be specified in args. Emit() returns an interface{} which must be type asserted as the Go equivalent type to the return value for native C callback.

Note that this code is unsafe in that the types of values in args are not checked against whether they are suitable for the callback.

func (*Element) Error added in v0.1.7

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 added in v0.1.8

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) 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) 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 added in v0.2.28

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 added in v0.2.5

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

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

func (*Element) GetSrcPads added in v0.2.5

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

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

func (*Element) GetState

func (e *Element) GetState() State

GetState returns the current state of this element.

func (*Element) GetStaticPad added in v0.0.10

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 added in v0.1.8

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 added in v0.1.7

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 added in v0.1.11

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 added in v0.1.9

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) Query added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.2.28

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

ReleaseRequestPad releases request pad

func (*Element) RemovePad added in v0.2.21

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) SendEvent added in v0.0.10

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) SetState

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

SetState sets the target state for this element.

func (*Element) SyncStateWithParent added in v0.0.10

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 added in v0.0.9

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 added in v0.0.9

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) URIHandler added in v0.1.0

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 (*Element) WarningMessage added in v0.1.8

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 added in v0.1.7

type ElementClass struct{ *glib.ObjectClass }

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

func ToElementClass added in v0.2.2

func ToElementClass(klass *glib.ObjectClass) *ElementClass

ToElementClass wraps the given ObjectClass in an ElementClass instance.

func (*ElementClass) AddMetadata added in v0.1.7

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

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

func (*ElementClass) AddPadTemplate added in v0.1.7

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 added in v0.1.7

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 added in v0.1.7

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 added in v0.1.7

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

GetMetadata retrieves the metadata associated with key in the class.

func (*ElementClass) GetPadTemplate added in v0.1.7

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

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

func (*ElementClass) Instance added in v0.1.7

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

Instance returns the underlying GstElementClass instance.

func (*ElementClass) SetMetadata added in v0.1.7

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. Unref after usage.

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 added in v0.1.9

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)
	// 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 added in v0.1.7

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 added in v0.0.9

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

Event is a go wrapper around a GstEvent.

func FromGstEventUnsafeFull added in v0.2.5

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 added in v0.2.5

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.10

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func NewGapEvent(timestamp, duration time.Duration) *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 added in v0.0.9

func NewLatencyEvent(latency time.Duration) *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 synchronising against the clock.

The latency is mostly used in live sinks and is always expressed in the time format.

func NewNavigationEvent added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func NewQOSEvent(qType QOSType, proportion float64, diff ClockTimeDiff, timestamp time.Duration) *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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.2.8

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 added in v0.0.9

func (e *Event) Copy() *Event

Copy copies the event using the event specific copy function.

func (*Event) CopySegment added in v0.0.9

func (e *Event) CopySegment(segment *Segment)

CopySegment parses a segment event and copies the Segment into the location given by segment.

func (*Event) GetRunningTimeOffset added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (e *Event) GetStructure() *Structure

GetStructure accesses the structure of the event.

func (*Event) HasName added in v0.0.9

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 added in v0.0.9

func (e *Event) Instance() *C.GstEvent

Instance returns the underlying GstEvent instance.

func (*Event) ParseBufferSize added in v0.0.9

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 added in v0.0.9

func (e *Event) ParseCaps() *Caps

ParseCaps gets the caps from event. The caps remains valid as long as event remains valid.

func (*Event) ParseFlushStop added in v0.0.9

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 added in v0.0.9

func (e *Event) ParseGap() (timestamp, duration time.Duration)

ParseGap extracts timestamp and duration from a new GAP event.

func (*Event) ParseGroupID added in v0.0.9

func (e *Event) ParseGroupID() (ok bool, gid uint)

ParseGroupID returns a group ID if set on the event.

func (*Event) ParseLatency added in v0.0.9

func (e *Event) ParseLatency() time.Duration

ParseLatency gets the latency in the latency event.

func (*Event) ParseProtection added in v0.0.9

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 added in v0.0.9

func (e *Event) ParseQOS() (qTtype QOSType, proportion float64, diff ClockTimeDiff, timestamp time.Duration)

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 added in v0.0.9

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 added in v0.0.9

func (e *Event) ParseSeekTrickModeInterval() (interval time.Duration)

ParseSeekTrickModeInterval retrieves the trickmode interval that may have been set on a seek event with SetSeekTrickModeInterval.

func (*Event) ParseSegment added in v0.0.9

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 added in v0.0.9

func (e *Event) ParseSegmentDone() (Format, int64)

ParseSegmentDone extracts the position and format from the segment done message.

func (*Event) ParseSelectStreams added in v0.0.9

func (e *Event) ParseSelectStreams() []*Stream

ParseSelectStreams parses the SELECT_STREAMS event and retrieve the contained streams.

func (*Event) ParseSinkMessage added in v0.0.9

func (e *Event) ParseSinkMessage() *Message

ParseSinkMessage parses the sink-message event. Unref msg after usage.

func (*Event) ParseStep added in v0.0.9

func (e *Event) ParseStep() (format Format, amount uint64, rate float64, flush, intermediate bool)

ParseStep parses a step message

func (*Event) ParseStream added in v0.0.9

func (e *Event) ParseStream() *Stream

ParseStream parses a stream-start event and extract the GstStream from it.

func (*Event) ParseStreamCollection added in v0.0.9

func (e *Event) ParseStreamCollection() *StreamCollection

ParseStreamCollection parses a stream collection from the event.

func (*Event) ParseStreamFlags added in v0.0.9

func (e *Event) ParseStreamFlags() StreamFlags

ParseStreamFlags parses the stream flags from an event.

func (*Event) ParseStreamGroupDone added in v0.0.9

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 added in v0.0.9

func (e *Event) ParseStreamStart() string

ParseStreamStart parses a stream-id event and store the result in the given stream_id location.

func (*Event) ParseTOC added in v0.0.9

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 added in v0.0.9

func (e *Event) ParseTOCSelect() string

ParseTOCSelect parses a TOC select event and store the results in the given uid location.

func (*Event) ParseTag added in v0.0.9

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 added in v0.0.9

func (e *Event) Ref() *Event

Ref increases the ref count on the event by one.

func (*Event) Seqnum added in v0.0.9

func (e *Event) Seqnum() uint32

Seqnum returns the sequence number of the event.

func (*Event) SetGroupID added in v0.0.9

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 added in v0.0.9

func (e *Event) SetRunningTimeOffset(offset int64)

SetRunningTimeOffset sets the running time offset of a event. See GetRunningTimeOffset for more information.

func (*Event) SetSeekTrickModeInterval added in v0.0.9

func (e *Event) SetSeekTrickModeInterval(interval time.Duration)

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 added in v0.0.9

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 added in v0.0.9

func (e *Event) SetStream(stream *Stream)

SetStream sets the stream on the stream-start event

func (*Event) SetStreamFlags added in v0.0.9

func (e *Event) SetStreamFlags(flags StreamFlags)

SetStreamFlags sets the stream flags on the event.

func (*Event) Timestamp added in v0.0.9

func (e *Event) Timestamp() time.Duration

Timestamp returns the timestamp of the event.

func (*Event) Type added in v0.0.9

func (e *Event) Type() EventType

Type returns the type of the event

func (*Event) Unref added in v0.0.9

func (e *Event) Unref()

Unref decreases the refcount of an event, freeing it if the refcount reaches 0.

func (*Event) WritableStructure added in v0.0.9

func (e *Event) WritableStructure() *Structure

WritableStructure returns a writable version of the structure.

type EventType added in v0.0.9

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 synchronisation.
	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 travelling 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 added in v0.1.0

func (e EventType) String() string

String implements a stringer on event types

type EventTypeFlags added in v0.0.9

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 added in v0.2.15

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

FlagsetValue is the go wrapper around a GstFlagSet value.

func Flagset added in v0.2.15

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 added in v0.2.15

func ValueGetFlagset(value *glib.Value) *FlagsetValue

ValueGetFlagset returns the flagset inside his value.

func (*FlagsetValue) Flags added in v0.2.15

func (f *FlagsetValue) Flags() uint

Flags returns the flags for this flagset.

func (*FlagsetValue) Mask added in v0.2.15

func (f *FlagsetValue) Mask() uint

Mask returns the mask for this flagset.

func (*FlagsetValue) ToGValue added in v0.2.15

func (f *FlagsetValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type Float64RangeValue added in v0.2.15

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

Float64RangeValue is the go wrapper around a GstDoubleRange value.

func Float64Range added in v0.2.15

func Float64Range(start, end float64) *Float64RangeValue

Float64Range returns a new Float64RangeValue. This is the equivalent of a double range value.

func ValueGetFloat64Range added in v0.2.15

func ValueGetFloat64Range(value *glib.Value) *Float64RangeValue

ValueGetFloat64Range returns the range from inside this value.

func (*Float64RangeValue) End added in v0.2.15

func (f *Float64RangeValue) End() float64

End returns the end for this range.

func (*Float64RangeValue) Start added in v0.2.15

func (f *Float64RangeValue) Start() float64

Start returns the start for this range.

func (*Float64RangeValue) String added in v0.2.15

func (f *Float64RangeValue) String() string

String returns a string representation of the range.

func (*Float64RangeValue) ToGValue added in v0.2.15

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 added in v0.0.9

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 added in v0.0.8

func (f Format) String() string

String implements a stringer on GstFormat types

type FractionRangeValue added in v0.2.15

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

FractionRangeValue represents a GstFractionRange.

func FractionRange added in v0.2.15

func FractionRange(start, end *FractionValue) *FractionRangeValue

FractionRange returns a new GstFractionRange.

func ValueGetFractionRange added in v0.2.15

func ValueGetFractionRange(value *glib.Value) *FractionRangeValue

ValueGetFractionRange returns the range inside the given value.

func (*FractionRangeValue) End added in v0.2.15

End returns the end of the range.

func (*FractionRangeValue) Start added in v0.2.15

func (g *FractionRangeValue) Start() *FractionValue

Start returns the start of the range.

func (*FractionRangeValue) String added in v0.2.15

func (g *FractionRangeValue) String() string

String returns a string representation of the range.

func (*FractionRangeValue) ToGValue added in v0.2.15

func (g *FractionRangeValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type FractionValue added in v0.2.14

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

FractionValue is a helper structure for building fractions for functions that require them.

func Fraction added in v0.1.0

func Fraction(numerator, denominator int) *FractionValue

Fraction returns a new GFraction with the given numerator and denominator.

func ValueGetFraction added in v0.2.15

func ValueGetFraction(value *glib.Value) *FractionValue

ValueGetFraction returns the fraction inside the given value.

func (*FractionValue) Denom added in v0.2.14

func (g *FractionValue) Denom() int

Denom returns the fraction's denominator.

func (*FractionValue) Num added in v0.2.14

func (g *FractionValue) Num() int

Num returns the fraction's numerator.

func (*FractionValue) String added in v0.2.14

func (g *FractionValue) String() string

String returns a string representation of the fraction.

func (*FractionValue) ToGValue added in v0.2.14

func (g *FractionValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type GError added in v0.0.8

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 added in v0.0.9

func NewGError(code ErrorCode, err error) *GError

NewGError wraps the given error inside a GError (to be used with message constructors).

func (*GError) Code added in v0.1.7

func (e *GError) Code() ErrorCode

Code returns the error code of the error message.

func (*GError) DebugString added in v0.0.8

func (e *GError) DebugString() string

DebugString returns any debug info alongside the error.

func (*GError) Error added in v0.0.8

func (e *GError) Error() string

Error implements the error interface and returns the error message.

func (*GError) Message added in v0.0.8

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 added in v0.0.8

func (e *GError) Structure() *Structure

Structure returns the structure of the error message which may contain additional metadata.

type GapFlags added in v0.0.9

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 added in v0.2.5

func FromGstGhostPadUnsafeFull(pad unsafe.Pointer) *GhostPad

FromGstGhostPadUnsafeFull wraps the given GstGhostPad.

func FromGstGhostPadUnsafeNone added in v0.2.5

func FromGstGhostPadUnsafeNone(pad unsafe.Pointer) *GhostPad

FromGstGhostPadUnsafeNone wraps the given GstGhostPad.

func NewGhostPad added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (g *GhostPad) GetTarget() *Pad

GetTarget gets the target pad of gpad.

func (*GhostPad) Instance added in v0.0.9

func (g *GhostPad) Instance() *C.GstGhostPad

Instance returns the underlying ghost pad instance.

func (*GhostPad) InternalActivateModeDefault added in v0.0.9

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 added in v0.0.9

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 added in v0.2.15

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

Int64RangeValue represents a GstInt64Range.

func Int64Range added in v0.2.15

func Int64Range(start, end, step int64) *Int64RangeValue

Int64Range returns a new Int64RangeValue.

func ValueGetInt64Range added in v0.2.15

func ValueGetInt64Range(value *glib.Value) *Int64RangeValue

ValueGetInt64Range gets the int64 range from the given value.

func (*Int64RangeValue) End added in v0.2.15

func (i *Int64RangeValue) End() int64

End returns the end of the range

func (*Int64RangeValue) Start added in v0.2.15

func (i *Int64RangeValue) Start() int64

Start returns the start of the range

func (*Int64RangeValue) Step added in v0.2.15

func (i *Int64RangeValue) Step() int64

Step returns the step of the range

func (*Int64RangeValue) String added in v0.2.15

func (i *Int64RangeValue) String() string

String implements a Stringer.

func (*Int64RangeValue) ToGValue added in v0.2.15

func (i *Int64RangeValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type IntRangeValue added in v0.2.15

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

IntRangeValue represents a GstIntRange.

func IntRange added in v0.2.15

func IntRange(start, end, step int) *IntRangeValue

IntRange returns a new IntRangeValue.

func ValueGetIntRange added in v0.2.15

func ValueGetIntRange(value *glib.Value) *IntRangeValue

ValueGetIntRange gets the int range from the given value.

func (*IntRangeValue) End added in v0.2.15

func (i *IntRangeValue) End() int

End returns the end of the range

func (*IntRangeValue) Start added in v0.2.15

func (i *IntRangeValue) Start() int

Start returns the start of the range

func (*IntRangeValue) Step added in v0.2.15

func (i *IntRangeValue) Step() int

Step returns the step of the range

func (*IntRangeValue) String added in v0.2.15

func (i *IntRangeValue) String() string

String implements a Stringer.

func (*IntRangeValue) ToGValue added in v0.2.15

func (i *IntRangeValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

type License added in v0.1.7

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 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 added in v0.1.9

func (m *MapInfo) AsFloat32BESlice() []float32

AsFloat32BESlice returns the contents of this map as a slice of 32-bit big-endian floats.

func (*MapInfo) AsFloat32LESlice added in v0.1.9

func (m *MapInfo) AsFloat32LESlice() []float32

AsFloat32LESlice returns the contents of this map as a slice of 32-bit little-endian floats.

func (*MapInfo) AsFloat64BESlice added in v0.1.9

func (m *MapInfo) AsFloat64BESlice() []float64

AsFloat64BESlice returns the contents of this map as a slice of 64-bit big-endian floats.

func (*MapInfo) AsFloat64LESlice added in v0.1.9

func (m *MapInfo) AsFloat64LESlice() []float64

AsFloat64LESlice returns the contents of this map as a slice of 64-bit little-endian floats.

func (*MapInfo) AsInt16BESlice added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.0.10

func (m *MapInfo) AsInt8Slice() []int8

AsInt8Slice returns the contents of this map as a slice of signed 8-bit integers.

func (*MapInfo) AsUint16BESlice added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.0.10

func (m *MapInfo) AsUint8Slice() []uint8

AsUint8Slice returns the contents of this map as a slice of unsigned 8-bit integers.

func (*MapInfo) Bytes added in v0.0.9

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 added in v0.1.5

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.1.0

func (m *MapInfo) WriteData(data []byte)

WriteData writes the given sequence directly to the map's memory.

func (*MapInfo) Writer added in v0.1.9

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 added in v0.0.9

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 added in v0.2.5

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 added in v0.2.5

func FromGstMemoryUnsafeFull(mem unsafe.Pointer) *Memory

FromGstMemoryUnsafeFull wraps the given memory without taking an additional reference.

func FromGstMemoryUnsafeNone added in v0.2.5

func FromGstMemoryUnsafeNone(mem unsafe.Pointer) *Memory

FromGstMemoryUnsafeNone is an alias to FromGstMemoryUnsafe.

func NewMemoryWrapped added in v0.0.9

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 added in v0.0.9

func (m *Memory) Alignment() int64

Alignment returns the alignment of the memory.

func (*Memory) Allocator added in v0.0.9

func (m *Memory) Allocator() *Allocator

Allocator returns the allocator for this memory.

func (*Memory) Bytes added in v0.0.9

func (m *Memory) Bytes() []byte

Bytes will return a byte slice of the data inside this memory if it is readable.

func (*Memory) Copy added in v0.0.9

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 added in v0.0.9

func (m *Memory) Instance() *C.GstMemory

Instance returns the underlying GstMemory instance.

func (*Memory) Map added in v0.0.9

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 added in v0.0.9

func (m *Memory) MaxSize() int64

MaxSize returns the maximum size allocated for this memory block.

func (*Memory) Offset added in v0.0.9

func (m *Memory) Offset() int64

Offset returns the offset where valid data starts.

func (*Memory) Parent added in v0.0.9

func (m *Memory) Parent() *Memory

Parent returns this memory block's parent.

func (*Memory) Ref added in v0.0.9

func (m *Memory) Ref() *Memory

Ref increases the ref count on this memory block by one.

func (*Memory) Size added in v0.0.9

func (m *Memory) Size() int64

Size returns the size of valid data.

func (*Memory) Unmap added in v0.1.5

func (m *Memory) Unmap()

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

func (*Memory) Unref added in v0.0.9

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 added in v0.0.9

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 added in v0.2.5

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 added in v0.2.5

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 added in v0.0.9

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 added in v0.0.9

func NewAsyncDoneMessage(src interface{}, runningTime time.Duration) *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 added in v0.0.9

func NewAsyncStartMessage(src interface{}) *Message

NewAsyncStartMessage returns a message that is posted by elements when they start an ASYNC state change.

func NewBufferingMessage added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func NewHaveContextMessage(src interface{}, ctx *Context) *Message

NewHaveContextMessage creates a message that is posted when an element has a new local Context.

func NewInfoMessage added in v0.0.9

func NewInfoMessage(src interface{}, msg string, debugStr string, structure *Structure) *Message

NewInfoMessage creates a new info message. Structure can be nil.

func NewLatencyMessage added in v0.0.9

func NewLatencyMessage(src interface{}) *Message

NewLatencyMessage creates a message that can be posted by elements when their latency requirements have changed.

func NewNeedContextMessage added in v0.0.9

func NewNeedContextMessage(src interface{}, ctxType string) *Message

NewNeedContextMessage creates a message that is posted when an element needs a specific Context.

func NewNewClockMessage added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func NewQoSMessage(src interface{}, live bool, runningTime, streamTime, timestamp, duration time.Duration) *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 synchronisation 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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func NewResetTimeMessage(src interface{}, runningTime time.Duration) *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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func NewStepDoneMessage(src interface{}, format Format, amount uint64, rate float64, flush, intermediate bool, duration time.Duration, 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 added in v0.0.9

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 added in v0.0.9

func NewStreamCollectionMessage(src interface{}, collection *StreamCollection) *Message

NewStreamCollectionMessage creates a new stream-collection message. The message is used to announce new StreamCollections.

func NewStreamSelectedMessage added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func NewWarningMessage(src interface{}, msg string, debugStr string, structure *Structure) *Message

NewWarningMessage creates a new warning message. Structure can be nil.

func ToGstMessage added in v0.2.8

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 added in v0.0.9

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 that can be Unrefed separately.

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 added in v0.0.3

func (m *Message) Instance() *C.GstMessage

Instance returns the underlying GstMessage object.

func (*Message) NumRedirectEntries added in v0.0.8

func (m *Message) NumRedirectEntries() int64

NumRedirectEntries returns the number of redirect entries in a MessageRedirect.

func (*Message) ParseAsyncDone added in v0.0.8

func (m *Message) ParseAsyncDone() time.Duration

ParseAsyncDone extracts the running time from the async task done message.

func (*Message) ParseBuffering added in v0.0.8

func (m *Message) ParseBuffering() int

ParseBuffering extracts the buffering percent from the GstMessage.

func (*Message) ParseBufferingStats added in v0.0.8

func (m *Message) ParseBufferingStats() *BufferingStats

ParseBufferingStats extracts the buffering stats values from message.

func (*Message) ParseClockProvide added in v0.0.8

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 added in v0.0.8

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 added in v0.0.8

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 added in v0.0.8

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 added in v0.0.9

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 added in v0.0.8

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 added in v0.0.8

func (m *Message) ParseProgress() (progressType ProgressType, code, text string)

ParseProgress parses the progress type, code and text.

func (*Message) ParsePropertyNotify added in v0.0.8

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 added in v0.0.8

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 added in v0.0.8

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 added in v0.0.8

func (m *Message) ParseRequestState() State

ParseRequestState parses the requests state from the message.

func (*Message) ParseResetTime added in v0.0.8

func (m *Message) ParseResetTime() time.Duration

ParseResetTime extracts the running-time from the ResetTime message.

func (*Message) ParseSegmentDone added in v0.0.8

func (m *Message) ParseSegmentDone() (Format, int64)

ParseSegmentDone extracts the position and format of the SegmentDone message.

func (*Message) ParseSegmentStart added in v0.0.8

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 added in v0.0.8

func (m *Message) ParseStepDone() *StepDoneValues

ParseStepDone extracts the values for the StepDone message.

func (*Message) ParseStepStart added in v0.0.8

func (m *Message) ParseStepStart() *StepStartValues

ParseStepStart extracts the values for the StepStart message.

func (*Message) ParseStreamCollection added in v0.0.8

func (m *Message) ParseStreamCollection() *StreamCollection

ParseStreamCollection parses a stream-collection message.

func (*Message) ParseStreamStatus added in v0.0.8

func (m *Message) ParseStreamStatus() (StreamStatusType, *Element)

ParseStreamStatus parses the stream status type of the message as well as the element that produced it. The element returned should NOT be unrefed.

func (*Message) ParseStreamsSelected added in v0.0.8

func (m *Message) ParseStreamsSelected() *StreamCollection

ParseStreamsSelected parses a streams-selected message.

func (*Message) ParseStructureChange added in v0.0.8

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 added in v0.1.0

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; the caller must free it with Unref when done.

func (*Message) ParseTags added in v0.0.8

func (m *Message) ParseTags() *TagList

ParseTags extracts the tag list from the GstMessage. Tags are copied and should be unrefed after usage.

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 added in v0.0.8

func (m *Message) Source() string

Source returns the source of the message.

func (*Message) StreamsSelectedAdd added in v0.0.9

func (m *Message) StreamsSelectedAdd(stream *Stream)

StreamsSelectedAdd adds the stream to the message

func (*Message) StreamsSelectedGetStream added in v0.0.9

func (m *Message) StreamsSelectedGetStream(index uint) *Stream

StreamsSelectedGetStream retrieves the Stream with index index from the message.

func (*Message) StreamsSelectedSize added in v0.0.9

func (m *Message) StreamsSelectedSize() uint

StreamsSelectedSize returns the number of streams contained in the message.

func (*Message) String added in v0.0.8

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 added in v0.0.8

func (m MessageType) String() string

String implements a stringer on MessageTypes

type Meta added in v0.0.9

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

Meta is a go representation of GstMeta.

func FromGstMetaUnsafe added in v0.1.0

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 added in v0.0.9

func (m *Meta) Flags() MetaFlags

Flags returns the flags on this Meta instance.

func (*Meta) Info added in v0.0.9

func (m *Meta) Info() *MetaInfo

Info returns the extra info with this metadata.

func (*Meta) Instance added in v0.0.9

func (m *Meta) Instance() *C.GstMeta

Instance returns the underlying GstMeta instance.

func (*Meta) SetFlags added in v0.1.9

func (m *Meta) SetFlags(flags MetaFlags)

SetFlags sets the flags on this Meta instance.

func (*Meta) SetInfo added in v0.1.9

func (m *Meta) SetInfo(info *MetaInfo)

SetInfo sets the info on this metadata.

type MetaFlags added in v0.0.9

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 added in v0.0.9

type MetaFreeFunc func(buffer *Buffer)

MetaFreeFunc is a function called when meta is freed in buffer.

type MetaInfo added in v0.0.9

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

MetaInfo is a go representation of GstMetaInfo

func FromGstMetaInfoUnsafe added in v0.2.13

func FromGstMetaInfoUnsafe(ptr unsafe.Pointer) *MetaInfo

FromGstMetaInfoUnsafe wraps the given unsafe pointer in a MetaInfo instance.

func GetAPIInfo added in v0.0.9

func GetAPIInfo(name string) *MetaInfo

GetAPIInfo gets the MetaInfo for the given api type.

func GetProtectionMetaInfo added in v0.0.9

func GetProtectionMetaInfo() *MetaInfo

GetProtectionMetaInfo retrieves global ProtectionMetaInfo.

func RegisterMeta added in v0.0.9

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 added in v0.0.9

func (m *MetaInfo) API() glib.Type

API returns the tag identifying the metadata structure and api.

func (*MetaInfo) Instance added in v0.0.9

func (m *MetaInfo) Instance() *C.GstMetaInfo

Instance returns the underlying GstMetaInfo instance.

func (*MetaInfo) SetAPI added in v0.1.9

func (m *MetaInfo) SetAPI(t glib.Type)

SetAPI sets the API tag identifying the metadata structure and api.

func (*MetaInfo) SetSize added in v0.1.9

func (m *MetaInfo) SetSize(size int64)

SetSize sets the size on the metadata.

func (*MetaInfo) SetType added in v0.1.9

func (m *MetaInfo) SetType(t glib.Type)

SetType sets the type identifying the implementor of the api.

func (*MetaInfo) Size added in v0.0.9

func (m *MetaInfo) Size() int64

Size returns the size of the metadata.

func (*MetaInfo) Type added in v0.0.9

func (m *MetaInfo) Type() glib.Type

Type returns the type identifying the implementor of the api.

type MetaInfoCallbackFuncs added in v0.0.9

type MetaInfoCallbackFuncs struct {
	InitFunc      MetaInitFunc
	FreeFunc      MetaFreeFunc
	TransformFunc MetaTransformFunc
}

MetaInfoCallbackFuncs represents callback functions to includ when registering a new meta type.

type MetaInitFunc added in v0.0.9

type MetaInitFunc func(params interface{}, buffer *Buffer) bool

MetaInitFunc is a function called when meta is initialized in buffer.

type MetaTransformCopy added in v0.0.9

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 added in v0.0.9

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 decresaes 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 added in v0.2.5

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 added in v0.2.5

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) BaseObject added in v0.0.9

func (o *Object) BaseObject() *Object

BaseObject is a convenience method for retrieving this object from embedded structs.

func (*Object) Clear added in v0.2.4

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 added in v0.2.4

func (o *Object) GObject() *glib.Object

GObject returns the underlying GObject instance.

func (*Object) GetName added in v0.2.4

func (o *Object) GetName() string

GetName returns the name of this object.

func (*Object) GetValue added in v0.2.4

func (o *Object) GetValue(property string, timestamp time.Duration) *glib.Value

GetValue retrieves the value for the given controlled property at the given timestamp.

func (*Object) GstObject added in v0.0.9

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 added in v0.1.8

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 added in v0.2.4

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 added in v0.2.17

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 added in v0.0.7

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 added in v0.2.5

func FromGstPadUnsafeFull(pad unsafe.Pointer) *Pad

FromGstPadUnsafeFull wraps the given pad in a reference and finalizer.

func FromGstPadUnsafeNone added in v0.2.5

func FromGstPadUnsafeNone(pad unsafe.Pointer) *Pad

FromGstPadUnsafeNone wraps the given pad in a finalizer.

func NewPad added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (p *Pad) GetCurrentCaps() *Caps

GetCurrentCaps gets the capabilities currently configured on pad with the last EventCaps event.

func (*Pad) GetDirection added in v0.0.9

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 added in v0.0.9

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.

Unref each pad after use.

func (*Pad) GetInternalLinksDefault added in v0.0.9

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 added in v0.0.9

func (p *Pad) GetLastFlowReturn() FlowReturn

GetLastFlowReturn gets the FlowReturn return from the last data passed by this pad.

func (*Pad) GetOffset added in v0.0.9

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 added in v0.0.9

func (p *Pad) GetPadTemplate() *PadTemplate

GetPadTemplate gets the template for this pad.

func (*Pad) GetPadTemplateCaps added in v0.0.9

func (p *Pad) GetPadTemplateCaps() *Caps

GetPadTemplateCaps gets the capabilities for pad's template.

func (*Pad) GetParentElement added in v0.0.9

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 added in v0.0.9

func (p *Pad) GetPeer() *Pad

GetPeer gets the peer of pad. This function refs the peer pad so you need to unref it after use.

func (*Pad) GetRange added in v0.0.9

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 Unref after usage.

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (p *Pad) GetTaskState() TaskState

GetTaskState gets the pad task state. If no task is currently set, TaskStopped is returned.

func (*Pad) HasCurrentCaps added in v0.0.9

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 added in v0.0.9

func (p *Pad) IsActive() bool

IsActive queries if a pad is active

func (*Pad) IsBlocked added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (p *Pad) PeerQueryPosition(format Format) (bool, int64)

PeerQueryPosition queries the peer of a given sink pad for the stream position.

func (*Pad) ProxyQueryAcceptCaps added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 Unref after usage. 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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (p *Pad) QueryAcceptCaps(caps *Caps) bool

QueryAcceptCaps checks if the given pad accepts the caps.

func (*Pad) QueryCaps added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (p *Pad) QueryDuration(format Format) (bool, int64)

QueryDuration queries a pad for the total stream duration.

func (*Pad) QueryPosition added in v0.0.9

func (p *Pad) QueryPosition(format Format) (bool, int64)

QueryPosition queries a pad for the stream position.

func (*Pad) RemoveProbe added in v0.0.9

func (p *Pad) RemoveProbe(id uint64)

RemoveProbe removes the probe with id from pad.

func (*Pad) SendEvent added in v0.0.9

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 added in v0.1.10

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 added in v0.1.10

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 added in v0.0.9

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 added in v0.1.10

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 added in v0.1.10

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 added in v0.0.9

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 added in v0.1.10

func (p *Pad) SetEventFullFunction(f PadEventFullFunc)

SetEventFullFunction sets the given event handler for the pad.

func (*Pad) SetEventFunction added in v0.1.10

func (p *Pad) SetEventFunction(f PadEventFunc)

SetEventFunction sets the given event handler for the pad.

func (*Pad) SetGetRangeFunction added in v0.1.10

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 added in v0.1.10

func (p *Pad) SetIterIntLinkFunction(f PadIterIntLinkFunc)

SetIterIntLinkFunction sets the given internal link iterator function for the pad.

func (*Pad) SetLinkFunction added in v0.1.10

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 added in v0.0.9

func (p *Pad) SetOffset(offset int64)

SetOffset sets the offset that will be applied to the running time of pad.

func (*Pad) SetQueryFunction added in v0.1.10

func (p *Pad) SetQueryFunction(f PadQueryFunc)

SetQueryFunction sets the query handler for the pad.

func (*Pad) SetUnlinkFunction added in v0.1.10

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 added in v0.0.9

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 added in v0.0.9

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 (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 added in v0.0.9

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 added in v0.1.10

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 added in v0.1.10

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 added in v0.1.10

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 added in v0.1.10

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 added in v0.1.10

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 added in v0.1.10

type PadEventFunc func(self *Pad, parent *Object, event *Event) bool

PadEventFunc is the function signature to handle an event for the pad

type PadFlags added in v0.0.9

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 added in v0.0.9

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 added in v0.1.10

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 added in v0.1.10

func (p PadFuncMap) FuncForPad(pad unsafe.Pointer) interface{}

FuncForPad will return the function in this map for the given pad.

func (PadFuncMap) RemoveFuncForPad added in v0.1.10

func (p PadFuncMap) RemoveFuncForPad(pad unsafe.Pointer)

RemoveFuncForPad will remove the function for the given pad from this map.

type PadGetRangeFunc added in v0.1.10

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 added in v0.1.10

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 added in v0.0.9

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 added in v0.1.10

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 added in v0.0.9

func (p PadLinkReturn) String() string

String implemeents a stringer on PadLinkReturn

type PadMode added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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

PadProbeInfo represents the info passed to a PadProbeCallback.

func (*PadProbeInfo) GetBuffer added in v0.0.9

func (p *PadProbeInfo) GetBuffer() *Buffer

GetBuffer returns the buffer, if any, inside this probe info.

func (*PadProbeInfo) GetBufferList added in v0.0.9

func (p *PadProbeInfo) GetBufferList() *BufferList

GetBufferList returns the buffer list, if any, inside this probe info.

func (*PadProbeInfo) GetEvent added in v0.0.9

func (p *PadProbeInfo) GetEvent() *Event

GetEvent returns the event, if any, inside this probe info.

func (*PadProbeInfo) GetQuery added in v0.0.9

func (p *PadProbeInfo) GetQuery() *Query

GetQuery returns the query, if any, inside this probe info.

func (*PadProbeInfo) ID added in v0.0.9

func (p *PadProbeInfo) ID() uint32

ID returns the id of the probe.

func (*PadProbeInfo) Offset added in v0.0.9

func (p *PadProbeInfo) Offset() uint64

Offset returns the offset of pull probe, this field is valid when type contains PadProbeTypePull.

func (*PadProbeInfo) Size added in v0.0.9

func (p *PadProbeInfo) Size() uint64

Size returns the size of pull probe, this field is valid when type contains PadProbeTypePull.

func (*PadProbeInfo) Type added in v0.0.9

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 added in v0.0.9

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 behaviour 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 behaviour 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 added in v0.0.9

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 added in v0.1.10

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 added in v0.2.5

func FromGstPadTemplateUnsafeFull(tmpl unsafe.Pointer) *PadTemplate

FromGstPadTemplateUnsafeFull wraps the given GstPadTemplate in a finalizer.

func FromGstPadTemplateUnsafeNone added in v0.2.5

func FromGstPadTemplateUnsafeNone(tmpl unsafe.Pointer) *PadTemplate

FromGstPadTemplateUnsafeNone wraps the given GstPadTemplate in a ref and a finalizer.

func NewPadTemplate added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.1.10

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 added in v0.0.9

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 added in v0.2.5

func FromGstPipelineUnsafeFull(pipeline unsafe.Pointer) *Pipeline

FromGstPipelineUnsafeFull wraps the given pipeline pointer.

func FromGstPipelineUnsafeNone added in v0.2.5

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) GetPipelineBus added in v0.0.2

func (p *Pipeline) GetPipelineBus() *Bus

GetPipelineBus returns the message bus for this pipeline.

func (*Pipeline) GetPipelineClock added in v0.0.2

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 added in v0.0.2

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 behaviour can be disabled using this function.

It is important that all messages on the bus are handled when the automatic flushing is disabled else memory leaks will be introduced.

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 added in v0.2.5

func FromGstPluginUnsafeFull(plugin unsafe.Pointer) *Plugin

FromGstPluginUnsafeFull wraps the given pointer in a Plugin.

func FromGstPluginUnsafeNone added in v0.2.5

func FromGstPluginUnsafeNone(plugin unsafe.Pointer) *Plugin

FromGstPluginUnsafeNone wraps the given pointer in a Plugin.

func LoadPluginByName added in v0.1.7

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 added in v0.1.7

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. Unref after usage.

func (*PluginFeature) GetPluginName

func (p *PluginFeature) GetPluginName() string

GetPluginName returns the name of the plugin that provides this feature.

func (*PluginFeature) Instance

func (p *PluginFeature) Instance() *C.GstPluginFeature

Instance returns the underlying GstPluginFeature instance

type PluginInitFunc added in v0.1.7

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 added in v0.1.7

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 added in v0.1.7

func (p *PluginMetadata) Export() unsafe.Pointer

Export will export the PluginMetadata to an unsafe pointer to a GstPluginDesc.

type PollFd added in v0.0.9

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 added in v0.0.8

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.
	ProgressTypeCancelled 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 added in v0.0.8

func (p ProgressType) String() string

String implements a stringer on ProgressTypes

type ProtectionMeta added in v0.0.9

type ProtectionMeta struct {
	Meta *Meta
	Info *Structure
}

ProtectionMeta is a go wrapper around C GstProtectionMeta.

type ProxyPad added in v0.0.9

type ProxyPad struct{ *Pad }

ProxyPad is a go representation of a GstProxyPad.

func (*ProxyPad) ChainDefault added in v0.0.9

func (p *ProxyPad) ChainDefault(parent *Object, buffer *Buffer) FlowReturn

ChainDefault invokes the default chain function of the proxy pad.

func (*ProxyPad) ChainListDefault added in v0.0.9

func (p *ProxyPad) ChainListDefault(parent *Object, bufferList *BufferList) FlowReturn

ChainListDefault invokes the default chain list function of the proxy pad.

func (*ProxyPad) GetInternal added in v0.0.9

func (p *ProxyPad) GetInternal() *ProxyPad

GetInternal gets the internal pad of pad. Unref target pad after usage.

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 added in v0.0.9

func (p *ProxyPad) GetInternalLinksDefault(parent *Object) ([]*Pad, error)

GetInternalLinksDefault invokes the default iterate internal links function of the proxy pad.

func (*ProxyPad) GetRangeDefault added in v0.0.9

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 added in v0.0.9

func (p *ProxyPad) Instance() *C.GstProxyPad

Instance returns the underlying GstProxyPad instance.

type QOSType added in v0.0.9

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 added in v0.0.8

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
	// The stream time of the buffer that generated the message
	StreamTime time.Duration
	//  The timestamps of the buffer that generated the message
	Timestamp time.Duration
	//  The duration of the buffer that generated the message
	Duration time.Duration
}

QoSValues represents the values inside a QoS message.

type Query added in v0.0.9

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

Query is a go wrapper around a GstQuery.

func FromGstQueryUnsafeFull added in v0.2.5

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 added in v0.2.5

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 added in v0.0.9

func NewAcceptCapsQuery(caps *Caps) *Query

NewAcceptCapsQuery constructs a new query object for querying if caps are accepted.

func NewAllocationQuery added in v0.0.9

func NewAllocationQuery(caps *Caps, needPool bool) *Query

NewAllocationQuery constructs a new query object for querying the allocation properties.

func NewBitrateQuery added in v0.0.9

func NewBitrateQuery() *Query

NewBitrateQuery constructs a new query object for querying the bitrate.

func NewBufferingQuery added in v0.0.9

func NewBufferingQuery(format Format) *Query

NewBufferingQuery constructs a new query object for querying the buffering status of a stream.

func NewCapsQuery added in v0.0.9

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 added in v0.0.9

func NewContextQuery(ctxType string) *Query

NewContextQuery constructs a new query object for querying the pipeline-local context.

func NewConvertQuery added in v0.0.9

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 added in v0.0.9

func NewCustomQuery(queryType QueryType, structure *Structure) *Query

NewCustomQuery constructs a new custom query object.

func NewDrainQuery added in v0.0.9

func NewDrainQuery() *Query

NewDrainQuery constructs a new query object for querying the drain state.

func NewDurationQuery added in v0.0.9

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 added in v0.0.9

func NewFormatsQuery() *Query

NewFormatsQuery constructs a new query object for querying formats of the stream.

func NewLatencyQuery added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func NewSchedulingQuery() *Query

NewSchedulingQuery constructs a new query object for querying the scheduling properties.

func NewSeekingQuery added in v0.0.9

func NewSeekingQuery(format Format) *Query

NewSeekingQuery constructs a new query object for querying seeking properties of the stream.

func NewSegmentQuery added in v0.0.9

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 added in v0.0.9

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 added in v0.2.8

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 added in v0.0.9

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 added in v0.0.9

func (q *Query) AddAllocationParam(allocator *Allocator, params *AllocationParams)

AddAllocationParam adds allocator and its params as a supported memory allocator.

func (*Query) AddAllocationPool added in v0.0.9

func (q *Query) AddAllocationPool(pool *BufferPool, size, minBuffers, maxBuffers uint)

AddAllocationPool sets the pool parameters in query.

func (*Query) AddBufferingRange added in v0.0.9

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 added in v0.0.9

func (q *Query) AddSchedulingMode(mode PadMode)

AddSchedulingMode adds mode as one of the supported scheduling modes to query.

func (*Query) Copy added in v0.0.9

func (q *Query) Copy() *Query

Copy copies the given query using the copy function of the parent GstStructure.

func (*Query) FindAllocationMeta added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (q *Query) GetStructure() *Structure

GetStructure retrieves the structure of a query.

func (*Query) HasSchedulingMode added in v0.0.9

func (q *Query) HasSchedulingMode(mode PadMode) bool

HasSchedulingMode checks if query has scheduling mode set.

func (*Query) HasSchedulingModeWithFlags added in v0.0.9

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 added in v0.0.9

func (q *Query) Instance() *C.GstQuery

Instance returns the underlying GstQuery instance.

func (*Query) ParseAcceptCaps added in v0.0.9

func (q *Query) ParseAcceptCaps() *Caps

ParseAcceptCaps gets the caps from query. The caps remains valid as long as query remains valid.

func (*Query) ParseAcceptCapsResult added in v0.0.9

func (q *Query) ParseAcceptCapsResult() bool

ParseAcceptCapsResult parses the result from the caps query.

func (*Query) ParseAllocation added in v0.0.9

func (q *Query) ParseAllocation() (caps *Caps, needPool bool)

ParseAllocation parses an allocation query.

func (*Query) ParseAllocationMetaAt added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (q *Query) ParseAllocationPoolAt(idx uint) (pool *BufferPool, size, minBuffers, maxBuffers uint)

ParseAllocationPoolAt gets the pool parameters in query.

func (*Query) ParseBitrate added in v0.0.9

func (q *Query) ParseBitrate() uint

ParseBitrate gets the results of a bitrate query. See also SetBitrate.

func (*Query) ParseBufferingPercent added in v0.0.9

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 added in v0.0.9

func (q *Query) ParseBufferingRange() (format Format, start, stop, estimatedTotal int64)

ParseBufferingRange parses a buffering range query.

func (*Query) ParseBufferingRangeAt added in v0.0.9

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 added in v0.0.9

func (q *Query) ParseBufferingStats() (mode BufferingMode, avgIn, avgOut int, bufLeft int64)

ParseBufferingStats extracts the buffering stats values from query.

func (*Query) ParseCaps added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (q *Query) ParseContextType() (ok bool, ctxType string)

ParseContextType parses a context type from an existing GST_QUERY_CONTEXT query.

func (*Query) ParseConvert added in v0.0.9

func (q *Query) ParseConvert() (srcformat, destFormat Format, srcValue, destValue int64)

ParseConvert parses a convert query answer.

func (*Query) ParseDuration added in v0.0.9

func (q *Query) ParseDuration() (format Format, duration int64)

ParseDuration parses a duration query answer.

func (*Query) ParseFormatAt added in v0.0.9

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 added in v0.0.9

func (q *Query) ParseLatency() (live bool, minLatency, maxLatency time.Duration)

ParseLatency parses a latency query answer.

func (*Query) ParseNumFormats added in v0.0.9

func (q *Query) ParseNumFormats() uint

ParseNumFormats parses the number of formats in the formats query.

func (*Query) ParsePosition added in v0.0.9

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 added in v0.0.9

func (q *Query) ParseScheduling() (flags SchedulingFlags, minSize, maxSize, align int)

ParseScheduling sets the scheduling properties.

func (*Query) ParseSchedulingModeAt added in v0.0.9

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 added in v0.0.9

func (q *Query) ParseSeeking() (format Format, seekable bool, start, end int64)

ParseSeeking parses a seeking query.

func (*Query) ParseSegment added in v0.0.9

func (q *Query) ParseSegment() (rate float64, format Format, start, stop int64)

ParseSegment parses a segment query answer.

func (*Query) ParseURI added in v0.0.9

func (q *Query) ParseURI() string

ParseURI parses a URI query.

func (*Query) ParseURIRedirection added in v0.0.9

func (q *Query) ParseURIRedirection() string

ParseURIRedirection parses a URI query.

func (*Query) ParseURIRedirectionPermanent added in v0.0.9

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 added in v0.0.9

func (q *Query) Ref() *Query

Ref increases the query ref count by one.

func (*Query) RemoveAllocationMetaAt added in v0.0.9

func (q *Query) RemoveAllocationMetaAt(idx uint)

RemoveAllocationMetaAt removes the metadata API at index of the metadata API array.

func (*Query) RemoveAllocationParamAt added in v0.0.9

func (q *Query) RemoveAllocationParamAt(idx uint)

RemoveAllocationParamAt removes the allocation param at index of the allocation param array.

func (*Query) RemoveAllocationPoolAt added in v0.0.9

func (q *Query) RemoveAllocationPoolAt(idx uint)

RemoveAllocationPoolAt removes the allocation pool at index of the allocation pool array.

func (*Query) SetAcceptCapsResult added in v0.0.9

func (q *Query) SetAcceptCapsResult(result bool)

SetAcceptCapsResult sets result as the result for the query.

func (*Query) SetAllocationParamAt added in v0.0.9

func (q *Query) SetAllocationParamAt(idx uint, allocator *Allocator, params *AllocationParams)

SetAllocationParamAt sets allocation params in query.

func (*Query) SetAllocationPoolAt added in v0.0.9

func (q *Query) SetAllocationPoolAt(idx uint, pool *BufferPool, size, minBuffers, maxBuffers uint)

SetAllocationPoolAt sets the pool parameters in query.

func (*Query) SetBitrate added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (q *Query) SetBufferingRange(format Format, start, stop, estimatedTotal int64)

SetBufferingRange sets the available query result fields in query.

func (*Query) SetBufferingStats added in v0.0.9

func (q *Query) SetBufferingStats(mode BufferingMode, avgIn, avgOut int, bufferingLeft int64)

SetBufferingStats configures the buffering stats values in query.

func (*Query) SetCapsResult added in v0.0.9

func (q *Query) SetCapsResult(caps *Caps)

SetCapsResult sets the caps result in query.

func (*Query) SetContext added in v0.0.9

func (q *Query) SetContext(ctx *Context)

SetContext answers a context query by setting the requested context.

func (*Query) SetConvert added in v0.0.9

func (q *Query) SetConvert(srcFormat, destFormat Format, srcValue, destValue int64)

SetConvert answers a convert query by setting the requested values.

func (*Query) SetDuration added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (q *Query) SetLatency(live bool, minLatency, maxLatency time.Duration)

SetLatency answers a latency query by setting the requested values in the given format.

func (*Query) SetPosition added in v0.0.9

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 added in v0.0.9

func (q *Query) SetScheduling(flags SchedulingFlags, minSize, maxSize, align int)

SetScheduling sets the scheduling properties.

func (*Query) SetSeeking added in v0.0.9

func (q *Query) SetSeeking(format Format, seekable bool, segmentStart, segmentEnd int64)

SetSeeking sets the seeking query result fields in query.

func (*Query) SetSegment added in v0.0.9

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 added in v0.0.9

func (q *Query) SetURI(uri string)

SetURI answers a URI query by setting the requested URI.

func (*Query) SetURIRedirection added in v0.0.9

func (q *Query) SetURIRedirection(uri string)

SetURIRedirection answers a URI query by setting the requested URI redirection.

func (*Query) SetURIRedirectionPermanent added in v0.0.9

func (q *Query) SetURIRedirectionPermanent(permanent bool)

SetURIRedirectionPermanent answers a URI query by setting the requested URI redirection to permanent or not.

func (*Query) Type added in v0.1.10

func (q *Query) Type() QueryType

Type returns the type of the Query.

func (*Query) Unref added in v0.0.9

func (q *Query) Unref()

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

func (*Query) WritableStructure added in v0.0.9

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 added in v0.0.9

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 added in v0.1.10

func (q QueryType) String() string

type QueryTypeFlags added in v0.0.9

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 added in v0.1.7

type Rank uint

Rank represents a level of importance when autoplugging elements.

const (
	RankNone Rank = 0
)

For now just a single RankNone is provided

type ReferenceTimestampMeta added in v0.0.9

type ReferenceTimestampMeta struct {
	Parent              *Meta
	Reference           *Caps
	Timestamp, Duration time.Duration
}

ReferenceTimestampMeta is a go representation of a GstReferenceTimestampMeta.

type Registry

type Registry struct{ *Object }

Registry is a go representation of a GstRegistry.

func FromGstRegistryUnsafeFull added in v0.2.5

func FromGstRegistryUnsafeFull(registry unsafe.Pointer) *Registry

FromGstRegistryUnsafeFull wraps the given GstRegistry pointer.

func FromGstRegistryUnsafeNone added in v0.2.5

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. Unref after usage.

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. Unref after usage.

type Sample

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

Sample is a go wrapper around a GstSample object.

func FromGstSampleUnsafeFull added in v0.2.5

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 added in v0.2.5

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 added in v0.1.9

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 added in v0.1.9

func (s *Sample) GetBufferList() *BufferList

GetBufferList gets the buffer list associated with this sample.

func (*Sample) GetCaps added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

func (s *Sample) Ref() *Sample

Ref increases the ref count on the sample.

func (*Sample) SetBuffer added in v0.1.9

func (s *Sample) SetBuffer(buf *Buffer)

SetBuffer sets the buffer inside this sample. The sample must be writable.

func (*Sample) SetBufferList added in v0.1.9

func (s *Sample) SetBufferList(buf *BufferList)

SetBufferList sets the buffer list for this sample. The sample must be writable.

func (*Sample) SetCaps added in v0.1.9

func (s *Sample) SetCaps(caps *Caps)

SetCaps sets the caps on this sample. The sample must be writable.

func (*Sample) SetInfo added in v0.1.9

func (s *Sample) SetInfo(st *Structure) bool

SetInfo sets the info on this sample. The sample must be writable.

func (*Sample) SetSegment added in v0.1.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.1.7

func FromGstSegmentUnsafe(segment unsafe.Pointer) *Segment

FromGstSegmentUnsafe wraps the GstSegment pointer.

func NewFormattedSegment added in v0.1.11

func NewFormattedSegment(f Format) *Segment

NewFormattedSegment returns a new Segment with the given format.

func NewSegment added in v0.0.9

func NewSegment() *Segment

NewSegment allocates and initializes a new Segment. Free when you are finished.

func ToGstSegment added in v0.2.8

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 added in v0.0.9

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 added in v0.0.9

func (s *Segment) Copy() *Segment

Copy creates a copy of this segment.

func (*Segment) CopyInto added in v0.0.9

func (s *Segment) CopyInto(segment *Segment)

CopyInto copies the contents of this segment into the given one.

func (*Segment) DoSeek added in v0.0.9

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 added in v0.0.9

func (s *Segment) Free()

Free frees the allocated segment.

func (*Segment) GetAppliedRate added in v0.0.9

func (s *Segment) GetAppliedRate() float64

GetAppliedRate returns the applied rate for this segment.

func (*Segment) GetBase added in v0.0.9

func (s *Segment) GetBase() uint64

GetBase returns the base for this segment.

func (*Segment) GetDuration added in v0.0.9

func (s *Segment) GetDuration() uint64

GetDuration gets the duration of this segment.

func (*Segment) GetFlags added in v0.0.9

func (s *Segment) GetFlags() SegmentFlags

GetFlags returns the flags on this segment.

func (*Segment) GetFormat added in v0.0.9

func (s *Segment) GetFormat() Format

GetFormat returns the format for this segment.

func (*Segment) GetOffset added in v0.0.9

func (s *Segment) GetOffset() uint64

GetOffset returns the offset for this segment.

func (*Segment) GetPosition added in v0.0.9

func (s *Segment) GetPosition() uint64

GetPosition returns the position of this segment.

func (*Segment) GetRate added in v0.0.9

func (s *Segment) GetRate() float64

GetRate returns the rate for this segment.

func (*Segment) GetStart added in v0.0.9

func (s *Segment) GetStart() uint64

GetStart returns the start of this segment.

func (*Segment) GetStop added in v0.0.9

func (s *Segment) GetStop() uint64

GetStop returns the stop of this segment.

func (*Segment) GetTime added in v0.0.9

func (s *Segment) GetTime() uint64

GetTime returns the time of this segment.

func (*Segment) Init added in v0.0.9

func (s *Segment) Init(format Format)

Init reinitializes a segment to its default values.

func (*Segment) Instance added in v0.0.9

func (s *Segment) Instance() *C.GstSegment

Instance returns the underlying GstSegment instance.

func (*Segment) IsEqual added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.1.11

func (s *Segment) SetAppliedRate(rate float64)

SetAppliedRate sets the applied rate for this segment

func (*Segment) SetFlags added in v0.1.11

func (s *Segment) SetFlags(flags SegmentFlags)

SetFlags sets the flags on this segment.

func (*Segment) SetFormat added in v0.1.11

func (s *Segment) SetFormat(f Format)

SetFormat sets the format on this segment.

func (*Segment) SetRate added in v0.1.11

func (s *Segment) SetRate(rate float64)

SetRate sets the rate for this segment.

func (*Segment) SetRunningTime added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.1.8

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 added in v0.1.9

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 added in v0.1.9

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 added in v0.1.9

func (s StateChangeReturn) String() string

type StepDoneValues added in v0.0.8

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 added in v0.0.8

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 added in v0.0.9

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 added in v0.0.8

type Stream struct{ *Object }

Stream is a Go representation of a GstStream.

func FromGstStreamUnsafeFull added in v0.2.5

func FromGstStreamUnsafeFull(stream unsafe.Pointer) *Stream

FromGstStreamUnsafeFull captures a pointer with just a finalizer.

func FromGstStreamUnsafeNone added in v0.2.5

func FromGstStreamUnsafeNone(stream unsafe.Pointer) *Stream

FromGstStreamUnsafeNone captures a pointer with a ref and finalizer.

func NewStream added in v0.0.8

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 added in v0.0.8

func (s *Stream) Caps() *Caps

Caps returns the caps for this stream.

func (*Stream) Instance added in v0.0.8

func (s *Stream) Instance() *C.GstStream

Instance returns the underlying GstStream.

func (*Stream) SetCaps added in v0.0.8

func (s *Stream) SetCaps(caps *Caps)

SetCaps sets the caps for this stream.

func (*Stream) SetStreamFlags added in v0.0.8

func (s *Stream) SetStreamFlags(flags StreamFlags)

SetStreamFlags sets the flags for this stream.

func (*Stream) SetStreamType added in v0.0.8

func (s *Stream) SetStreamType(sType StreamType)

SetStreamType sets the type of this stream.

func (*Stream) SetTags added in v0.0.8

func (s *Stream) SetTags(tags *TagList)

SetTags sets the tags for this stream.

func (*Stream) StreamFlags added in v0.0.8

func (s *Stream) StreamFlags() StreamFlags

StreamFlags returns the flags for this stream.

func (*Stream) StreamID added in v0.0.8

func (s *Stream) StreamID() string

StreamID returns the id of this stream.

func (*Stream) StreamType added in v0.0.8

func (s *Stream) StreamType() StreamType

StreamType returns the type of this stream.

func (*Stream) Tags added in v0.0.8

func (s *Stream) Tags() *TagList

Tags returns the tag list for this stream.

type StreamCollection added in v0.0.8

type StreamCollection struct{ *Object }

StreamCollection is a Go representation of a GstStreamCollection.

func FromGstStreamCollectionUnsafeFull added in v0.2.5

func FromGstStreamCollectionUnsafeFull(stream unsafe.Pointer) *StreamCollection

FromGstStreamCollectionUnsafeFull captures a pointer with just a finalizer.

func FromGstStreamCollectionUnsafeNone added in v0.2.5

func FromGstStreamCollectionUnsafeNone(stream unsafe.Pointer) *StreamCollection

FromGstStreamCollectionUnsafeNone captures a pointer with a ref and finalizer.

func NewStreamCollection added in v0.0.8

func NewStreamCollection(upstreamID string) *StreamCollection

NewStreamCollection returns a new StreamCollection with an upstream parent of the given stream ID.

func (*StreamCollection) AddStream added in v0.0.8

func (s *StreamCollection) AddStream(stream *Stream) error

AddStream adds the given stream to this collection.

func (*StreamCollection) GetSize added in v0.0.8

func (s *StreamCollection) GetSize() uint

GetSize returns the size of this stream collection.

func (*StreamCollection) GetStreamAt added in v0.0.8

func (s *StreamCollection) GetStreamAt(idx uint) *Stream

GetStreamAt returns the stream at the given index in this collection.

func (*StreamCollection) GetUpstreamID added in v0.0.8

func (s *StreamCollection) GetUpstreamID() string

GetUpstreamID retrieves the upstream ID for this collection.

func (*StreamCollection) Instance added in v0.0.8

func (s *StreamCollection) Instance() *C.GstStreamCollection

Instance returns the underlying GstStreamCollection.

type StreamFlags added in v0.0.8

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 added in v0.0.8

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 added in v0.0.8

func (s StreamStatusType) String() string

type StreamType added in v0.0.8

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 added in v0.0.8

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 added in v0.1.9

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 added in v0.0.10

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 added in v0.2.15

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 added in v0.2.15

func (s *Structure) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer

func (*Structure) UnmarshalInto added in v0.0.10

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 added in v0.0.8

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 added in v0.0.8

func (s StructureChangeType) String() string

String implements a stringer on StructureChangeTypes.

type SystemClock added in v0.0.9

type SystemClock struct{ *Clock }

SystemClock wraps GstSystemClock

func ObtainSystemClock added in v0.0.9

func ObtainSystemClock() *SystemClock

ObtainSystemClock returns the default SystemClock. The refcount of the clock will be increased so you need to unref the clock after usage.

type TOC added in v0.0.9

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

TOC is a go representation of a GstToc.

func FromGstTOCUnsafeFull added in v0.2.5

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 added in v0.2.5

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 added in v0.0.9

func NewTOC(scope TOCScope) *TOC

NewTOC returns a new TOC with the given scope.

func (*TOC) AppendEntry added in v0.0.9

func (t *TOC) AppendEntry(entry *TOCEntry)

AppendEntry appends the given TOCEntry to this TOC.

func (*TOC) Copy added in v0.0.9

func (t *TOC) Copy() *TOC

Copy creates a copy of the TOC.

func (*TOC) Dump added in v0.0.9

func (t *TOC) Dump()

Dump dumps the TOC.

func (*TOC) FindEntry added in v0.0.9

func (t *TOC) FindEntry(uid string) *TOCEntry

FindEntry finds the entry with the given uid.

func (*TOC) GetEntries added in v0.0.9

func (t *TOC) GetEntries() []*TOCEntry

GetEntries returns a list of all TOCEntries.

func (*TOC) GetScope added in v0.0.9

func (t *TOC) GetScope() TOCScope

GetScope returns the scope of this TOC.

func (*TOC) GetTags added in v0.0.9

func (t *TOC) GetTags() *TagList

GetTags returns the TagList for this TOC.

func (*TOC) Instance added in v0.0.9

func (t *TOC) Instance() *C.GstToc

Instance returns the underlying GstToc instance.

func (*TOC) MakeWritable added in v0.0.9

func (t *TOC) MakeWritable() *TOC

MakeWritable returns a writable copy of the TOC if it isn't already,

func (*TOC) MergeTags added in v0.0.9

func (t *TOC) MergeTags(tagList *TagList, mergeMode TagMergeMode)

MergeTags merges the given tags into this TOC's TagList.

func (*TOC) Ref added in v0.0.9

func (t *TOC) Ref() *TOC

Ref increases the ref count on the TOC by one.

func (*TOC) SetTags added in v0.0.9

func (t *TOC) SetTags(tagList *TagList)

SetTags sets tags for the entire TOC.

func (*TOC) Unref added in v0.0.9

func (t *TOC) Unref()

Unref decreases the ref count on the TOC by one.

type TOCEntry added in v0.0.9

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

TOCEntry is a go representation of a GstTocEntry,

func FromGstTocEntryUnsafeFull added in v0.2.5

func FromGstTocEntryUnsafeFull(entry unsafe.Pointer) *TOCEntry

FromGstTocEntryUnsafeFull wraps the given TOCEntry.

func FromGstTocEntryUnsafeNone added in v0.2.5

func FromGstTocEntryUnsafeNone(entry unsafe.Pointer) *TOCEntry

FromGstTocEntryUnsafeNone wraps the given TOCEntry.

func NewTOCEntry added in v0.0.9

func NewTOCEntry(entryType TOCEntryType, uid string) *TOCEntry

NewTOCEntry creates a new TOCEntry with the given UID and type.

func (*TOCEntry) AppendSubEntry added in v0.0.9

func (t *TOCEntry) AppendSubEntry(subEntry *TOCEntry)

AppendSubEntry appends the given entry as a subentry to this one.

func (*TOCEntry) Copy added in v0.0.9

func (t *TOCEntry) Copy() *TOCEntry

Copy creates a copy of the TOCEntry

func (*TOCEntry) GetEntryType added in v0.0.9

func (t *TOCEntry) GetEntryType() TOCEntryType

GetEntryType returns the type of this TOCEntry

func (*TOCEntry) GetEntryTypeString added in v0.0.9

func (t *TOCEntry) GetEntryTypeString() string

GetEntryTypeString returns a string representation of the entry type.

func (*TOCEntry) GetLoop added in v0.0.9

func (t *TOCEntry) GetLoop() (bool, TOCLoopType, int)

GetLoop gets the loop type and repeat count for the TOC entry.

func (*TOCEntry) GetParent added in v0.0.9

func (t *TOCEntry) GetParent() *TOCEntry

GetParent gets the parent of this TOCEntry.

func (*TOCEntry) GetStartStopTimes added in v0.0.9

func (t *TOCEntry) GetStartStopTimes() (ok bool, startTime, stopTime int64)

GetStartStopTimes gets the start and stop times for the TOCEntry if available.

func (*TOCEntry) GetSubEntries added in v0.0.9

func (t *TOCEntry) GetSubEntries() []*TOCEntry

GetSubEntries gets all the subentries for this TOCEntry.

func (*TOCEntry) GetTOC added in v0.0.9

func (t *TOCEntry) GetTOC() *TOC

GetTOC returns the parent TOC of this entry.

func (*TOCEntry) GetTags added in v0.0.9

func (t *TOCEntry) GetTags() *TagList

GetTags gets the tags for this entry.

func (*TOCEntry) GetUID added in v0.0.9

func (t *TOCEntry) GetUID() string

GetUID returns the uid of this entry.

func (*TOCEntry) Instance added in v0.0.9

func (t *TOCEntry) Instance() *C.GstTocEntry

Instance returns the underlying GstTocEntry instance.

func (*TOCEntry) IsAlternative added in v0.0.9

func (t *TOCEntry) IsAlternative() bool

IsAlternative returns true if this is an alternative entry.

func (*TOCEntry) IsSequence added in v0.0.9

func (t *TOCEntry) IsSequence() bool

IsSequence returns true if this is a sequence entry.

func (*TOCEntry) MakeWritable added in v0.0.9

func (t *TOCEntry) MakeWritable() *TOCEntry

MakeWritable returns a writable copy of the TOCEntry if it is not already so.

func (*TOCEntry) MergeTags added in v0.0.9

func (t *TOCEntry) MergeTags(tagList *TagList, mergeMode TagMergeMode)

MergeTags merges the given tags with the given mode.

func (*TOCEntry) Ref added in v0.0.9

func (t *TOCEntry) Ref() *TOCEntry

Ref increases the ref count on the TOCEntry by one.

func (*TOCEntry) SetLoop added in v0.0.9

func (t *TOCEntry) SetLoop(loopType TOCLoopType, repeatCount int)

SetLoop sets the loop type and repeat counts for the entry.

func (*TOCEntry) SetStartStopTimes added in v0.0.9

func (t *TOCEntry) SetStartStopTimes(startTime, stopTime int64)

SetStartStopTimes sets the start and stop times for the TOC entry.

func (*TOCEntry) SetTags added in v0.0.9

func (t *TOCEntry) SetTags(tagList *TagList)

SetTags sets the tags on the TOC entry.

func (*TOCEntry) Unref added in v0.0.9

func (t *TOCEntry) Unref()

Unref decreases the ref count on the TOCEntry by one.

type TOCEntryType added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.1.0

func (t TOCScope) String() string

String implements a stringer on a TOCScope

type TOCSetter added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.8

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 added in v0.2.5

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 added in v0.2.5

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 added in v0.0.9

func NewEmptyTagList() *TagList

NewEmptyTagList returns a new empty tag list.

tagList := gst.NewEmptyTagList()
fmt.Println(tagList.IsEmpty())
// true

func NewTagListFromString added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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.

Note that this function is the semantic equivalent of a Ref followed by a MakeWritable. If you only want to hold on to a reference to the data, you should use Ref.

When you are finished with the taglist, call Unref on it.

func (*TagList) ForEach added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (t *TagList) GetSample(tag Tag) (value *Sample, ok bool)

GetSample copies the first sample for the given tag in the taglist. Free the sample with Unref when it is no longer needed.

func (*TagList) GetSampleIndex added in v0.0.9

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. Free the sample with Unref when it is no longer needed.

func (*TagList) GetScope added in v0.0.9

func (t *TagList) GetScope() TagScope

GetScope returns the scope for this TagList.

func (*TagList) GetString added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (t *TagList) GetTagSize(tagKey string) int

GetTagSize returns the number of tag values at the given tag key.

func (*TagList) GetUint32 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

func (t *TagList) Insert(tagList *TagList, mergeMode TagMergeMode)

Insert inserts the tags from the provided list using the given merge mode.

func (*TagList) Instance added in v0.0.8

func (t *TagList) Instance() *C.GstTagList

Instance returns the underlying GstTagList instance.

func (*TagList) IsEmpty added in v0.0.9

func (t *TagList) IsEmpty() bool

IsEmpty returns true if this tag list is empty.

func (*TagList) IsEqual added in v0.0.9

func (t *TagList) IsEqual(tagList *TagList) bool

IsEqual checks if the two tag lists are equal.

func (*TagList) IsWritable added in v0.0.9

func (t *TagList) IsWritable() bool

IsWritable returns true if this TagList is writable.

func (*TagList) MakeWritable added in v0.0.9

func (t *TagList) MakeWritable() *TagList

MakeWritable will return a writable copy of the tag list if it is not already so.

func (*TagList) Merge added in v0.0.9

func (t *TagList) Merge(tagList *TagList, mergeMode TagMergeMode) *TagList

Merge merges the two tag lists with the given mode.

func (*TagList) NumTags added in v0.0.9

func (t *TagList) NumTags() int

NumTags returns the number of key/value pairs in ths TagList

func (*TagList) PeekStringIndex added in v0.0.9

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 added in v0.0.8

func (t *TagList) Ref() *TagList

Ref increases the ref count on this TagList by one.

func (*TagList) RemoveTag added in v0.0.9

func (t *TagList) RemoveTag(tag Tag)

RemoveTag removes the values for the given tag in this list.

func (*TagList) SetScope added in v0.0.9

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 added in v0.0.8

func (t *TagList) String() string

String implements a stringer on the TagList and serializes it to a string.

func (*TagList) TagNameAt added in v0.0.8

func (t *TagList) TagNameAt(idx int) string

TagNameAt returns the tag name at the given index.

func (*TagList) Unref added in v0.0.8

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.0.9

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 added in v0.1.9

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 added in v0.1.0

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 added in v0.2.17

type ValueArrayValue glib.Value

ValueArrayValue represets a GstValueArray.

func ValueArray added in v0.2.17

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 added in v0.2.17

func (v *ValueArrayValue) Size() uint

Size returns the size of the array.

func (*ValueArrayValue) ToGValue added in v0.2.17

func (v *ValueArrayValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

func (*ValueArrayValue) ValueAt added in v0.2.17

func (v *ValueArrayValue) ValueAt(idx uint) interface{}

ValueAt returns the value at the index in the array, or nil on any error.

type ValueCmp added in v0.2.15

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 added in v0.2.15

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 added in v0.2.17

type ValueListValue glib.Value

ValueListValue represets a GstValueList.

func ValueList added in v0.2.17

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 added in v0.2.17

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 added in v0.2.17

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 added in v0.2.17

func (v *ValueListValue) Size() uint

Size returns the size of the list.

func (*ValueListValue) ToGValue added in v0.2.17

func (v *ValueListValue) ToGValue() (*glib.Value, error)

ToGValue implements a glib.ValueTransformer.

func (*ValueListValue) ValueAt added in v0.2.17

func (v *ValueListValue) ValueAt(idx uint) interface{}

ValueAt returns the value at the index in the lise, or nil on any error.

type Version added in v0.1.7

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
)

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.
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