gst

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: LGPL-2.1 Imports: 13 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) or an otherwise unknown value.
	ClockTimeNone ClockTime = C.GST_CLOCK_TIME_NONE
)
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    // (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
	// 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) 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 method. Only use this method if you are unable to also run a MainLoop.

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.

It is much safer and easier to use the AddWatch method. Only use this method if you are unable to also run a MainLoop.

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 method. Only use this method if you are unable to also run a MainLoop.

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.

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

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

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

type ClockTime uint64

ClockTime is a go representation of a GstClockTime. Most of the time these are casted to time.Duration objects. It represents a time value in nanoseconds.

type Device added in v0.0.8

type Device struct{ *Object }

Device is a Go representation of a GstDevice.

func (*Device) Caps added in v0.0.8

func (d *Device) Caps() *Caps

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

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

func (d *Device) DeviceClass() string

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

func (d *Device) DisplayName() string

DisplayName gets the user-friendly name 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) Properties added in v0.0.8

func (d *Device) Properties() *Structure

Properties gets the extra properties of the device.

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

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

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

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 GhostPad

type GhostPad struct{ *Pad }

GhostPad is a go representation of a GstGhostPad

type MainContext added in v0.0.8

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

MainContext is a go representation of a GMainContext. Most of the time you will just want to use the default GMainContext which can be specified either via DefaultMainContext() or by passing nil to any function that requires it.

func DefaultMainContext added in v0.0.8

func DefaultMainContext() *MainContext

DefaultMainContext returns the default main context.

func NewMainContext added in v0.0.8

func NewMainContext() *MainContext

NewMainContext returns a new main context. This object is still not fully implemented and most of the time you will want to use the DefaultMainContext, or nil, when required.

func (*MainContext) Instance added in v0.0.8

func (m *MainContext) Instance() *C.GMainContext

Instance returns the underlying GMainContext instance.

func (*MainContext) Iteration added in v0.0.8

func (m *MainContext) Iteration(mayBlock bool) bool

Iteration runs a single iteration for the given main loop. This involves checking to see if any event sources are ready to be processed.

If no events sources are ready AND mayBlock is TRUE, it waits for a source to become ready, then dispatches the highest priority events sources that are ready.

Otherwise, if mayBlock is FALSE it does not wait for sources to become ready, only those highest priority events sources will be dispatched (if any), and then the function will return.

The return value reflects whether or not any event sources were dispatched.

func (*MainContext) Pending added in v0.0.8

func (m *MainContext) Pending() bool

Pending checks if any sources have pending events for this context.

func (*MainContext) Ref added in v0.0.8

func (m *MainContext) Ref() *MainContext

Ref increases the reference count on a GMainContext object by one.

func (*MainContext) Unref added in v0.0.8

func (m *MainContext) Unref()

Unref decreases the reference count on a GMainContext object by one. If the result is zero, it frees the context and all associated memory.

func (*MainContext) Wakeup added in v0.0.8

func (m *MainContext) Wakeup()

Wakeup either stops a currently running Iteration() or the next Iteration() from blocking.

type MainLoop added in v0.0.8

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

MainLoop is a go representation of a GMainLoop. It can be used to block execution while a pipeline is running, and also allows for event sources and signals to be used across gstreamer objects.

func NewMainLoop added in v0.0.8

func NewMainLoop(ctx *MainContext, isRunning bool) *MainLoop

NewMainLoop creates a new GMainLoop. If ctx is nil then the default context is used. If isRunning is true the loop will automatically start, however, this function will not block. To block on the loop itself you will still need to call MainLoop.Run().

A MainLoop is required when wishing to handle signals to/from elements asynchronously. Otherwise you will need to iterate on the DefaultMainContext (or an external created one) manually.

func (*MainLoop) GetContext added in v0.0.8

func (m *MainLoop) GetContext() *MainContext

GetContext returns the GMainContext for this loop.

func (*MainLoop) Instance added in v0.0.8

func (m *MainLoop) Instance() *C.GMainLoop

Instance returns the underlying GMainLoop instance.

func (*MainLoop) IsRunning added in v0.0.8

func (m *MainLoop) IsRunning() bool

IsRunning returns true if this main loop is currently running.

func (*MainLoop) Quit added in v0.0.8

func (m *MainLoop) Quit()

Quit stops a MainLoop from running. Any calls to Run() for the loop will return. Note that sources that have already been dispatched when Quit() is called will still be executed.

func (*MainLoop) Ref added in v0.0.8

func (m *MainLoop) Ref() *MainLoop

Ref increases the ref count on the main loop by one. It returns the original main loop for convenience in return functions.

func (*MainLoop) Run added in v0.0.8

func (m *MainLoop) Run()

Run a main loop until Quit() is called on the loop. If this is called from the thread of the loop's GMainContext, it will process events from the loop, otherwise it will simply wait.

func (*MainLoop) RunError added in v0.0.8

func (m *MainLoop) RunError() error

RunError is an alias to Run() except it returns nil as soon as the main loop quits. This is for convenience when wanting to use `return mainLoop.RunError()` at the end of a function that expects an error.

func (*MainLoop) Unref added in v0.0.8

func (m *MainLoop) Unref()

Unref decreases the reference count on a GMainLoop object by one. If the result is zero, it frees the loop and all associated memory.

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

func (o *Object) Unref()

Unref wraps the underlying Unref from glib, and performs an extra check that the object has not already been destroyed.

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 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 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 ClockTime
	//  The duration of the buffer that generated the message
	Duration time.Duration
}

QoSValues represents the values inside a QoS message.

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

type Stream struct{ *Object }

Stream is a Go representation of a GstStream.

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 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 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 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 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 (*TagList) Instance added in v0.0.8

func (t *TagList) Instance() *C.GstTagList

Instance returns the underlying GstTagList instance.

func (*TagList) NumValuesAt added in v0.0.8

func (t *TagList) NumValuesAt(tagKey string) int

NumValuesAt returns the number of tag values at the given tag key.

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

func (t *TagList) Size() int

Size returns the number of key/value pairs in ths TagList

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

type ToC struct{}

ToC is a Go representation of a GstToc.

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