gst

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: LGPL-2.1 Imports: 12 Imported by: 72

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 (
	// ClockFormat is the string used when formatting clock strings
	ClockFormat string = "u:%02u:%02u.%09u"
	// ClockTimeNone means infinite timeout (unsigned representation of -1)
	ClockTimeNone uint64 = 18446744073709551615
)
View Source
const (
	ParameterReadable       ParameterFlags = C.G_PARAM_READABLE        // the parameter is readable
	ParameterWritable                      = C.G_PARAM_WRITABLE        // the parameter is writable
	ParameterConstruct                     = C.G_PARAM_CONSTRUCT       // the parameter will be set upon object construction
	ParameterConstructOnly                 = C.G_PARAM_CONSTRUCT_ONLY  // the parameter can only be set upon object construction
	ParameterLaxValidation                 = C.G_PARAM_LAX_VALIDATION  // upon parameter conversion (see g_param_value_convert()) strict validation is not required
	ParameterStaticName                    = C.G_PARAM_STATIC_NAME     // the string used as name when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter. Since 2.8
	ParameterStaticNick                    = C.G_PARAM_STATIC_NICK     // the string used as nick when constructing the parameter is guaranteed to remain valid and unmmodified for the lifetime of the parameter. Since 2.8
	ParameterStaticBlurb                   = C.G_PARAM_STATIC_BLURB    // the string used as blurb when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter. Since 2.8
	ParameterExplicitNotify                = C.G_PARAM_EXPLICIT_NOTIFY // calls to g_object_set_property() for this property will not automatically result in a "notify" signal being emitted: the implementation must call g_object_notify() themselves in case the property actually changes. Since: 2.42.
	ParameterDeprecated                    = C.G_PARAM_DEPRECATED      // the parameter is deprecated and will be removed in a future version. A warning will be generated if it is used while running with G_ENABLE_DIAGNOSTIC=1. Since 2.26
	ParameterControllable                  = C.GST_PARAM_CONTROLLABLE
	ParameterMutablePlaying                = C.GST_PARAM_MUTABLE_PLAYING
	ParameterMutablePaused                 = C.GST_PARAM_MUTABLE_PAUSED
	ParameterMutableReady                  = C.GST_PARAM_MUTABLE_READY
)

Type casting of GParamFlags

View Source
const (
	URIUnknown URIType = C.GST_URI_UNKNOWN // (0) – The URI direction is unknown
	URISink            = C.GST_URI_SINK    // (1) – The URI is a consumer.
	URISource          = C.GST_URI_SRC     // (2) - The URI is a producer.
)

Type cast URI types

View Source
const (
	CapsFeatureMemorySystemMemory = C.GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY
)

Go casting of caps features constants

Variables

View Source
var (
	CapsFeaturesAny = wrapCapsFeatures(C.gst_caps_features_new_any())
)

Go casting of pre-baked caps features

Functions

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

func NewElementMany

func NewElementMany(elemNames ...string) (map[int]*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 map containing the ordinal of the argument to the Element created is returned.

func Wait

func Wait(p *Pipeline)

Wait waits for the given pipeline to reach end of stream or be stopped.

Types

type Bin

type Bin struct{ *Element }

Bin is a go wrapper arounds a GstBin.

func (*Bin) Add

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

Add wraps `gst_bin_add`.

func (*Bin) AddMany

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

AddMany is a go implementation of `gst_bin_add_many` to compensate for the inability to use variadic functions in cgo.

func (*Bin) GetElementByName

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

GetElementByName returns the element with the given name. 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) GetSinkElements

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

GetSinkElements returns a list of all the sink elements in this pipeline. Unref elements after usage.

func (*Bin) GetSourceElements

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

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

func (*Bin) Instance

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

Instance returns the underlying GstBin instance.

type Buffer

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

Buffer is a go representation of a GstBuffer.

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 (*Buffer) Bytes

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

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

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

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

Instance returns the underlying GstBuffer instance.

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

type BufferingMode

type BufferingMode int

BufferingMode is a representation of GstBufferingMode

const (
	BufferingStream    BufferingMode = C.GST_BUFFERING_STREAM
	BufferingDownload  BufferingMode = C.GST_BUFFERING_DOWNLOAD
	BufferingTimeshift BufferingMode = C.GST_BUFFERING_TIMESHIFT
	BufferingLive      BufferingMode = C.GST_BUFFERING_LIVE
)

Type casts of buffering modes

type Bus

type Bus struct {
	*Object
	// contains filtered or unexported fields
}

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

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.

func (*Bus) Instance

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

Instance returns the underlying GstBus instance.

func (*Bus) MessageChan

func (b *Bus) MessageChan() chan *Message

MessageChan returns a new channel to listen for messages asynchronously. Messages should be unreffed after each usage. Messages are delivered to channels in the order in which this function was called.

While a message is being delivered to created channels, there is a lock on creating new ones.

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.

type Caps

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

Caps is a go wrapper around GstCaps.

func NewAnyCaps

func NewAnyCaps() *Caps

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

func NewCapsFromString

func NewCapsFromString(capsStr string) *Caps

NewCapsFromString creates a new Caps object from the given string.

func NewEmptyCaps

func NewEmptyCaps() *Caps

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

func NewEmptySimpleCaps

func NewEmptySimpleCaps(mediaFormat string) *Caps

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

func NewFullCaps

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

NewFullCaps creates a new caps from the given structures.

func NewRawCaps

func NewRawCaps(format string, rate, channels int) *Caps

NewRawCaps returns new GstCaps with the given format, sample-rate, and channels.

func NewSimpleCaps

func NewSimpleCaps(mediaFormat string, fieldVals ...interface{}) (*Caps, error)

NewSimpleCaps creates new caps with the given media format and key value pairs. The key of each pair must be a string, followed by any field that can be converted to a GType.

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

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

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

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

func (c *Caps) Ref()

Ref increases the ref count on these caps by one.

func (*Caps) Size

func (c *Caps) Size() int

Size returns the number of structures inside this caps instance.

func (*Caps) Unref

func (c *Caps) Unref()

Unref decreases the ref count on these caps by one.

type CapsFeatures

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

CapsFeatures is a go representation of GstCapsFeatures.

func NewCapsFeaturesFromString

func NewCapsFeaturesFromString(features string) *CapsFeatures

NewCapsFeaturesFromString creates new CapsFeatures from the given string.

func (*CapsFeatures) Equal

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

Equal 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) 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) String

func (c *CapsFeatures) String() string

String implements a stringer on caps features.

type Clock

type Clock struct{ *Object }

Clock is a go wrapper around a GstClock.

func (*Clock) Duration

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

Duration returns the time.Duration equivalent of this clock time.

func (*Clock) Instance

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

Instance returns the underlying GstClock instance.

func (*Clock) InternalDuration

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

InternalDuration returns the time.Duration equivalent of this clock's internal time.

func (*Clock) InternalString

func (c *Clock) InternalString() string

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

func (*Clock) InternalTime

func (c *Clock) InternalTime() uint64

InternalTime 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) IsSynced

func (c *Clock) IsSynced() bool

IsSynced returns true if the clock is synced.

func (*Clock) String

func (c *Clock) String() string

String returns the string representation of this clock value.

func (*Clock) Time

func (c *Clock) Time() uint64

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

type Element

type Element struct{ *Object }

Element is a Go wrapper around a GstElement.

func NewElement

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

NewElement is a generic wrapper around `gst_element_factory_make`.

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

GetPads retrieves a list of pads associated with the element.

func (*Element) GetState

func (e *Element) GetState() State

GetState returns the current state of this element.

func (*Element) GetURIProtocols

func (e *Element) GetURIProtocols() []string

GetURIProtocols returns the protocols this element can handle.

func (*Element) GetURIType

func (e *Element) GetURIType() URIType

GetURIType returns the type of URI this element can handle.

func (*Element) Has

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

Has returns true if this element has the given flags.

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, caps *Caps) error

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

func (*Element) SetState

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

SetState sets the target state for this element.

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 *C.GstCaps) bool

CanSinkAllCaps checks if the factory can sink all possible capabilities.

func (*ElementFactory) CanSinkAnyCaps

func (e *ElementFactory) CanSinkAnyCaps(caps *C.GstCaps) bool

CanSinkAnyCaps checks if the factory can sink any possible capability.

func (*ElementFactory) CanSourceAllCaps

func (e *ElementFactory) CanSourceAllCaps(caps *C.GstCaps) bool

CanSourceAllCaps checks if the factory can src all possible capabilities.

func (*ElementFactory) CanSourceAnyCaps

func (e *ElementFactory) CanSourceAnyCaps(caps *C.GstCaps) 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 EnumValue

type EnumValue struct {
	Value                int
	ValueNick, ValueName string
}

EnumValue is a go representation of a GEnumValue

type FlagsValue

type FlagsValue struct {
	Value                int
	ValueName, ValueNick string
}

FlagsValue is a go representation of GFlagsValue

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.

type Format

type Format int

Format is a representation of GstFormat.

const (
	FormatUndefined Format = C.GST_FORMAT_UNDEFINED
	FormatDefault   Format = C.GST_FORMAT_DEFAULT
	FormatBytes     Format = C.GST_FORMAT_BYTES
	FormatTime      Format = C.GST_FORMAT_TIME
	FormatBuffer    Format = C.GST_FORMAT_BUFFERS
	FormatPercent   Format = C.GST_FORMAT_PERCENT
)

Type casts of formats

type GhostPad

type GhostPad struct{ *Pad }

GhostPad is a go representation of a GstGhostPad

type GoGError

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

GoGError is a Go wrapper for a C GError. It implements the error interface and provides additional functions for retrieving debug strings and details.

func (*GoGError) DebugString

func (e *GoGError) DebugString() string

DebugString returns any debug info alongside the error.

func (*GoGError) Error

func (e *GoGError) Error() string

Error implements the error interface and returns the error message.

func (*GoGError) Message

func (e *GoGError) 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 (*GoGError) Structure

func (e *GoGError) Structure() *Structure

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

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 {
	Memory  unsafe.Pointer // A pointer to the GstMemory object
	Flags   MapFlags
	Data    unsafe.Pointer // A pointer to the actual data
	Size    int64
	MaxSize int64
	// contains filtered or unexported fields
}

MapInfo is a go representation of a GstMapInfo.

func MapBuffer

func MapBuffer(buffer *Buffer) *MapInfo

MapBuffer will retrieve the map info for the given buffer. Unmap after usage.

func (*MapInfo) Unmap

func (m *MapInfo) Unmap()

Unmap will unmap the MapInfo.

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 (*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) ParseError

func (m *Message) ParseError() *GoGError

ParseError will return a GoGError from the contents of this message. This will only work if the GstMessageType is `GST_MESSAGE_ERROR`.

func (*Message) ParseInfo

func (m *Message) ParseInfo() *GoGError

ParseInfo is identical to ParseError. The returned types are the same. However, this is intended for use with GstMessageType `GST_MESSAGE_INFO`.

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

func (m *Message) ParseWarning() *GoGError

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

Type casting of GstMessageTypes

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. Type casting stops here and we do not descend into the glib library.

func (*Object) Class

func (o *Object) Class() *C.GObjectClass

Class returns the GObjectClass of this instance.

func (*Object) Instance

func (o *Object) Instance() *C.GstObject

Instance returns the native C GstObject.

func (*Object) Interfaces

func (o *Object) Interfaces() []string

Interfaces returns the interfaces associated with this object.

func (*Object) ListProperties

func (o *Object) ListProperties() []*ParameterSpec

ListProperties returns a list of the properties associated with this object. The default values assumed in the parameter spec reflect the values currently set in this object, or their defaults.

Unref after usage.

func (*Object) Name

func (o *Object) Name() string

Name returns the name of this object.

func (*Object) Unsafe added in v0.0.3

func (o *Object) Unsafe() unsafe.Pointer

Unsafe returns the unsafe pointer to the underlying object. This method is primarily for internal usage and is exposed for visibility in other packages.

type Pad

type Pad struct{ *Object }

Pad is a go representation of a GstPad

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

func (p *Pad) Instance() *C.GstPad

Instance returns the underlying C GstPad.

func (*Pad) Template

func (p *Pad) Template() *PadTemplate

Template returns the template for this pad or nil.

type PadDirection

type PadDirection int

PadDirection is a cast of GstPadDirection to a go type.

const (
	PadUnknown PadDirection = C.GST_PAD_UNKNOWN // (0) - the direction is unknown
	PadSource  PadDirection = C.GST_PAD_SRC     // (1) - the pad is a source pad
	PadSink    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 PadLinkReturn

type PadLinkReturn int

PadLinkReturn os a representation of GstPadLinkReturn.

Type casts for PadLinkReturns.

type PadPresence

type PadPresence int

PadPresence is a cast of GstPadPresence to a go type.

const (
	PadAlways    PadPresence = C.GST_PAD_ALWAYS    // (0) - the pad is always available
	PadSometimes PadPresence = C.GST_PAD_SOMETIMES // (1) - the pad will become available depending on the media stream
	PadRequest   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 PadTemplate

type PadTemplate struct{ *Object }

PadTemplate is a go representation of a GstPadTemplate

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

func (p *PadTemplate) Presence() PadPresence

Presence returns the presence of the pad template.

type ParameterFlags

type ParameterFlags int

ParameterFlags is a go cast of GParamFlags.

func (ParameterFlags) GstFlagsString

func (p ParameterFlags) GstFlagsString() string

GstFlagsString returns a string of the flags that are relevant specifically to gstreamer.

func (ParameterFlags) Has

Has returns true if these flags contain the provided ones.

func (ParameterFlags) String

func (p ParameterFlags) String() string

type ParameterSpec

type ParameterSpec struct {
	Name         string
	Blurb        string
	Flags        ParameterFlags
	ValueType    glib.Type
	OwnerType    glib.Type
	DefaultValue *glib.Value
	// contains filtered or unexported fields
}

ParameterSpec is a go representation of a C GParamSpec

func (*ParameterSpec) DoubleRange

func (p *ParameterSpec) DoubleRange() (float64, float64)

DoubleRange returns the range of the Double stored in this parameter spec.

func (*ParameterSpec) FloatRange

func (p *ParameterSpec) FloatRange() (float64, float64)

FloatRange returns the range of the Float stored in this parameter spec.

func (*ParameterSpec) GetCaps

func (p *ParameterSpec) GetCaps() *Caps

GetCaps returns the caps in this parameter if it is of type GST_TYPE_CAPS.

func (*ParameterSpec) GetDefaultFlags

func (p *ParameterSpec) GetDefaultFlags() int

GetDefaultFlags returns the default flags for this parameter spec.

func (*ParameterSpec) GetEnumValues

func (p *ParameterSpec) GetEnumValues() []*EnumValue

GetEnumValues returns the possible enum values for this parameter.

func (*ParameterSpec) GetFlagValues

func (p *ParameterSpec) GetFlagValues() []*FlagsValue

GetFlagValues returns the possible flags for this parameter.

func (*ParameterSpec) Int64Range

func (p *ParameterSpec) Int64Range() (int64, int64)

Int64Range returns the range of the Int64 stored in this parameter spec.

func (*ParameterSpec) IntRange

func (p *ParameterSpec) IntRange() (int, int)

IntRange returns the range of the Int stored in this parameter spec.

func (*ParameterSpec) IsBoxed

func (p *ParameterSpec) IsBoxed() bool

IsBoxed returns true if this parameter contains a boxed object.

func (*ParameterSpec) IsCaps

func (p *ParameterSpec) IsCaps() bool

IsCaps returns true if this parameter contains a caps object.

func (*ParameterSpec) IsEnum

func (p *ParameterSpec) IsEnum() bool

IsEnum returns true if this parameter contains an enum.

func (*ParameterSpec) IsFlags

func (p *ParameterSpec) IsFlags() bool

IsFlags returns true if this paramater contains flags.

func (*ParameterSpec) IsFraction

func (p *ParameterSpec) IsFraction() bool

IsFraction returns true if this parameter contains a fraction.

func (*ParameterSpec) IsGstArray

func (p *ParameterSpec) IsGstArray() bool

IsGstArray returns true if this parameter contains a Gst array.

func (*ParameterSpec) IsObject

func (p *ParameterSpec) IsObject() bool

IsObject returns true if this parameter contains an object.

func (*ParameterSpec) IsPointer

func (p *ParameterSpec) IsPointer() bool

IsPointer returns true if this paramater contains a pointer.

func (*ParameterSpec) UInt64Range

func (p *ParameterSpec) UInt64Range() (uint64, uint64)

UInt64Range returns the range of the Uint64 stored in this parameter spec.

func (*ParameterSpec) UIntRange

func (p *ParameterSpec) UIntRange() (uint, uint)

UIntRange returns the range of the Uint stored in this parameter spec.

func (*ParameterSpec) Unref

func (p *ParameterSpec) Unref()

Unref the underlying paramater spec.

type Pipeline

type Pipeline struct {
	*Bin
	// contains filtered or unexported fields
}

Pipeline is a go implementation of a GstPipeline.

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

func (p *Pipeline) Destroy() error

Destroy will attempt to stop the pipeline and then unref once the stream has fully completed.

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 (*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() string

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 Registry

type Registry struct{ *Object }

Registry is a go representation of a GstRegistry.

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

func FromGstSampleUnsafe(sample unsafe.Pointer) *Sample

FromGstSampleUnsafe 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) GetBuffer

func (s *Sample) GetBuffer() *Buffer

GetBuffer returns the buffer inside this sample.

func (*Sample) Instance

func (s *Sample) Instance() *C.GstSample

Instance returns the underlying *GstSample instance.

func (*Sample) Unref

func (s *Sample) Unref()

Unref calls gst_sample_unref on the sample.

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 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 StateChangeReturn

type StateChangeReturn int

StateChangeReturn is a representation of GstStateChangeReturn.

Type casts of state change returns

type Structure

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

Structure is a go implementation of a C GstStructure.

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 StructureFromGValue

func StructureFromGValue(gval *glib.Value) *Structure

StructureFromGValue 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) 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 URIType

type URIType C.GstURIType

URIType casts C GstURIType to a go type

func (URIType) String

func (u URIType) String() string

Directories

Path Synopsis
Package app contains bindings for the gstreamer-app C API.
Package app contains bindings for the gstreamer-app C API.
Package gstauto contains helper methods and objects for building pipelines that satisfy most use cases.
Package gstauto contains helper methods and objects for building pipelines that satisfy most use cases.
app
Package app provides interfaces from the gstauto package that use the gstreamer-app library for interacting with either end of the pipeline.
Package app provides interfaces from the gstauto package that use the gstreamer-app library for interacting with either end of the pipeline.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL