go-gstreamer: github.com/spreadspace/go-gstreamer Index | Files

package gst

import "github.com/spreadspace/go-gstreamer"

Go bindings for gstreamer1.0. Supports version 1.0 and later.

Functions use the same names as the native C function calls, but use CamelCase. In cases where native gstreamer uses pointers to values to simulate multiple return values, Go's native multiple return values are used instead. Whenever a native gstreamer call could return an unexpected NULL pointer, an additonal error is returned in the Go binding.

gstreamers's C API documentation can be very useful for understanding how the functions in this package work and what each type is for. This documentation can be found at http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/.

In addition to Go versions of the C gstreamer functions, every struct type includes a method named Native (either by direct implementation, or by means of struct embedding). These methods return a uintptr of the native C object the binding type represents. These pointers may be type switched to a native C pointer using unsafe and used with cgo function calls outside this package.

Memory management is handled in proper Go fashion, using runtime finalizers to properly free memory when it is no longer needed. Each time a Go type is created with a pointer to a GObject, a reference is added for Go, sinking the floating reference when necessary. After going out of scope and the next time Go's garbage collector is run, a finalizer is run to remove Go's reference to the GObject. When this reference count hits zero (when neither Go nor gstreamer holds ownership) the object will be freed internally by gstreamer.

Index

Package Files

gst.go gst_1_2.go gst_1_4.go

Constants

const (
    // Infinite timeout (unsigned representation of -1)
    CLOCK_TIME_NONE uint64 = 18446744073709551615
)

func Init Uses

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.

type Bin Uses

type Bin struct {
    Element
}

func BinNew Uses

func BinNew(name string) (*Bin, error)

BinNew() is a wrapper around gst_bin_new().

func (*Bin) Add Uses

func (v *Bin) Add(e IElement) bool

Add() is a wrapper around gst_bin_add().

func (*Bin) Remove Uses

func (v *Bin) Remove(e IElement) bool

Remove() is a wrapper around gst_bin_remove().

type BufferingMode Uses

type BufferingMode int

BufferingMode is a representation of GstBufferingMode

const (
    BUFFERING_STREAM    BufferingMode = C.GST_BUFFERING_STREAM
    BUFFERING_DOWNLOAD  BufferingMode = C.GST_BUFFERING_DOWNLOAD
    BUFFERING_TIMESHIFT BufferingMode = C.GST_BUFFERING_TIMESHIFT
    BUFFERING_LIVE      BufferingMode = C.GST_BUFFERING_LIVE
)

type Bus Uses

type Bus struct {
    Object
}

func (*Bus) AddSignalWatch Uses

func (v *Bus) AddSignalWatch()

AddSignalWatch() is a wrapper around gst_bus_add_signal_watch().

type Element Uses

type Element struct {
    Object
}

func ElementFactoryMake Uses

func ElementFactoryMake(factoryName, name string) (*Element, error)

ElementFactoryMake() is a wrapper around gst_element_factory_make().

func (*Element) AddPad Uses

func (v *Element) AddPad(pad IPad) bool

AddPad() is a wrapper around gst_element_add_pad().

func (*Element) GetBus Uses

func (v *Element) GetBus() (*Bus, error)

GetBus() is a wrapper around gst_element_get_bus().

func (*Element) GetState Uses

func (v *Element) GetState(timeout uint64) (state, pending State, change StateChangeReturn)

GetState() is a wrapper around gst_element_get_state().

func (*Element) GetStaticPad Uses

func (v *Element) GetStaticPad(name string) (*Pad, error)

GetStaticPad() is a wrapper around gst_element_get_static_pad().

func (v *Element) Link(dest IElement) bool

Link() is a wrapper around gst_element_link().

func (*Element) QueryDuration Uses

func (v *Element) QueryDuration(format Format) (cur int64, success bool)

QueryDuration() is a wrapper around gst_element_query_duration().

func (*Element) QueryPosition Uses

func (v *Element) QueryPosition(format Format) (cur int64, success bool)

QueryPosition() is a wrapper around gst_element_query_position().

func (*Element) RemovePad Uses

func (v *Element) RemovePad(pad IPad) bool

RemovePad() is a wrapper around gst_element_remove_pad().

func (*Element) Seek Uses

func (v *Element) Seek(rate float64, format Format, flags SeekFlags, startType SeekType, start int64, stopType SeekType, stop int64) bool

Seek() is a wrapper around gst_element_seek().

func (*Element) SeekSimple Uses

func (v *Element) SeekSimple(format Format, flags SeekFlags, pos int64) bool

SeekSimple() is a wrapper around gst_element_seek_simple().

func (*Element) SetState Uses

func (v *Element) SetState(state State) StateChangeReturn

SetState() is a wrapper around gst_element_set_state().

func (*Element) SyncStateWithParent Uses

func (v *Element) SyncStateWithParent() bool

SyncStateWithParent() is a wrapper around gst_element_sync_state_with_parent().

type ElementFactory Uses

type ElementFactory struct {
    PluginFeature
}

func ElementFactoryFind Uses

func ElementFactoryFind(name string) (*ElementFactory, error)

ElementFactoryFind() is a wrapper around gst_element_factory_find().

type Format Uses

type Format int

Format is a representation of GstFormat.

const (
    FORMAT_UNDEFINED Format = C.GST_FORMAT_UNDEFINED
    FORMAT_DEFAULT   Format = C.GST_FORMAT_DEFAULT
    FORMAT_BYTES     Format = C.GST_FORMAT_BYTES
    FORMAT_TIME      Format = C.GST_FORMAT_TIME
    FORMAT_BUFFERS   Format = C.GST_FORMAT_BUFFERS
    FORMAT_PERCENT   Format = C.GST_FORMAT_PERCENT
)

type GValueArray Uses

type GValueArray []interface{}

type GhostPad Uses

type GhostPad struct {
    Pad
}

func GhostPadNew Uses

func GhostPadNew(name string, pad IPad) (*GhostPad, error)

GhostPadNew() is a wrapper around gst_ghost_pad_new().

type IBin Uses

type IBin interface {
    // contains filtered or unexported methods
}

IBin is an interface type implemented by all structs embedding a Bin. It is meant to be used as an argument type for wrapper functions that wrap around a C gst function taking a GstBin.

type IElement Uses

type IElement interface {
    // contains filtered or unexported methods
}

IElement is an interface type implemented by all structs embedding a Element. It is meant to be used as an argument type for wrapper functions that wrap around a C gst function taking a GstElement.

type IPad Uses

type IPad interface {
    // contains filtered or unexported methods
}

type Message Uses

type Message struct {
    GstMessage *C.GstMessage
}

Message is a representation of Gst's GstMessage.

func (*Message) GetSeqnum Uses

func (v *Message) GetSeqnum() uint64

GetSeqnum() is a wrapper around GST_MESSAGE_SEQNUM().

func (*Message) GetSourceName Uses

func (v *Message) GetSourceName() string

GetSourceName() is a wrapper around GST_MESSAGE_SRC_NAME().

func (*Message) GetStructure Uses

func (v *Message) GetStructure() *Structure

GetStructure() is a wrapper around gst_message_get_structure().

func (*Message) GetTimestamp Uses

func (v *Message) GetTimestamp() uint64

Timestamp() is a wrapper around GST_MESSAGE_TIMESTAMP().

func (*Message) GetType Uses

func (v *Message) GetType() MessageType

GetType() is a wrapper around GST_MESSAGE_TYPE().

func (*Message) GetTypeName Uses

func (v *Message) GetTypeName() string

GetTypeName() is a wrapper around GST_MESSAGE_TYPE_NAME().

func (*Message) Native Uses

func (v *Message) Native() uintptr

Native returns a pointer to the underlying GdkEvent.

func (*Message) ParseAsyncDone Uses

func (v *Message) ParseAsyncDone() (running_time uint64)

ParseAsyncDone() is a wrapper around gst_message_parse_async_done().

func (*Message) ParseBuffering Uses

func (v *Message) ParseBuffering() (percent int)

ParseBuffering() is a wrapper around gst_message_parse_buffering().

func (*Message) ParseBufferingStats Uses

func (v *Message) ParseBufferingStats() (mode BufferingMode, avgIn, avgOut int, bufferingLeft int64)

ParseBufferingStats() is a wrapper around gst_message_parse_buffering_stats().

func (*Message) ParseError Uses

func (v *Message) ParseError() (err error, debug string)

ParseError() is a wrapper around gst_message_parse_error().

func (*Message) ParseQosStats Uses

func (v *Message) ParseQosStats() (format Format, processed, dropped uint64)

ParseQosStats() is a wrapper around gst_message_parse_qos_stats().

func (*Message) ParseQosValues Uses

func (v *Message) ParseQosValues() (jitter int64, proportion float64, quality int)

ParseQosValues() is a wrapper around gst_message_parse_qos_values().

func (*Message) ParseResetTime Uses

func (v *Message) ParseResetTime() (running_time uint64)

ParseResetTime() is a wrapper around gst_message_parse_reset_time().

func (*Message) ParseSegmentDone Uses

func (v *Message) ParseSegmentDone() (format Format, position int64)

ParseSegmentDone() is a wrapper around gst_message_parse_segment_done().

func (*Message) ParseSegmentStart Uses

func (v *Message) ParseSegmentStart() (format Format, position int64)

ParseSegmentStart() is a wrapper around gst_message_parse_segment_start().

func (*Message) ParseStateChanged Uses

func (v *Message) ParseStateChanged() (oldState, newState, pending State)

ParseStateChanged() is a wrapper around gst_message_parse_state_changed().

func (*Message) ParseStepDone Uses

func (v *Message) ParseStepDone() (format Format, amount uint64, rate float64, flush, intermediate bool, duration uint64, eos bool)

ParseStepDone() is a wrapper around gst_message_parse_step_done().

func (*Message) ParseWarning Uses

func (v *Message) ParseWarning() (err error, debug string)

ParseWarning() is a wrapper around gst_message_parse_warning().

type MessageType Uses

type MessageType int

MessageType is a representation of GstMessageType.

const (
    MESSAGE_UNKNOWN          MessageType = C.GST_MESSAGE_UNKNOWN
    MESSAGE_EOS              MessageType = C.GST_MESSAGE_EOS
    MESSAGE_ERROR            MessageType = C.GST_MESSAGE_ERROR
    MESSAGE_WARNING          MessageType = C.GST_MESSAGE_WARNING
    MESSAGE_INFO             MessageType = C.GST_MESSAGE_INFO
    MESSAGE_TAG              MessageType = C.GST_MESSAGE_TAG
    MESSAGE_BUFFERING        MessageType = C.GST_MESSAGE_BUFFERING
    MESSAGE_STATE_CHANGED    MessageType = C.GST_MESSAGE_STATE_CHANGED
    MESSAGE_STATE_DIRTY      MessageType = C.GST_MESSAGE_STATE_DIRTY
    MESSAGE_STEP_DONE        MessageType = C.GST_MESSAGE_STEP_DONE
    MESSAGE_CLOCK_LOST       MessageType = C.GST_MESSAGE_CLOCK_LOST
    MESSAGE_NEW_CLOCK        MessageType = C.GST_MESSAGE_NEW_CLOCK
    MESSAGE_STRUCTURE_CHANGE MessageType = C.GST_MESSAGE_STRUCTURE_CHANGE
    MESSAGE_STREAM_STATUS    MessageType = C.GST_MESSAGE_STREAM_STATUS
    MESSAGE_APPLICATION      MessageType = C.GST_MESSAGE_APPLICATION
    MESSAGE_ELEMENT          MessageType = C.GST_MESSAGE_ELEMENT
    MESSAGE_SEGMENT_START    MessageType = C.GST_MESSAGE_SEGMENT_START
    MESSAGE_SEGMENT_DONE     MessageType = C.GST_MESSAGE_SEGMENT_DONE
    MESSAGE_DURATION_CHANGED MessageType = C.GST_MESSAGE_DURATION_CHANGED
    MESSAGE_LATENCY          MessageType = C.GST_MESSAGE_LATENCY
    MESSAGE_ASYNC_START      MessageType = C.GST_MESSAGE_ASYNC_START
    MESSAGE_ASYNC_DONE       MessageType = C.GST_MESSAGE_ASYNC_DONE
    MESSAGE_REQUEST_STATE    MessageType = C.GST_MESSAGE_REQUEST_STATE
    MESSAGE_STEP_START       MessageType = C.GST_MESSAGE_STEP_START
    MESSAGE_QOS              MessageType = C.GST_MESSAGE_QOS
    MESSAGE_PROGRESS         MessageType = C.GST_MESSAGE_PROGRESS
    MESSAGE_TOC              MessageType = C.GST_MESSAGE_TOC
    MESSAGE_RESET_TIME       MessageType = C.GST_MESSAGE_RESET_TIME
    MESSAGE_STREAM_START     MessageType = C.GST_MESSAGE_STREAM_START
    MESSAGE_ANY              MessageType = C.GST_MESSAGE_ANY
)
const (
    MESSAGE_NEED_CONTEXT MessageType = C.GST_MESSAGE_NEED_CONTEXT
    MESSAGE_HAVE_CONTEXT MessageType = C.GST_MESSAGE_HAVE_CONTEXT
)

Since 1.2

const (
    MESSAGE_EXTENDED       MessageType = C.GST_MESSAGE_EXTENDED
    MESSAGE_DEVICE_ADDED   MessageType = C.GST_MESSAGE_DEVICE_ADDED
    MESSAGE_DEVICE_REMOVED MessageType = C.GST_MESSAGE_DEVICE_REMOVED
)

Since 1.4

type Object Uses

type Object struct {
    glib.InitiallyUnowned
}

Object is a representation of gst's GstObject.

func (*Object) GetName Uses

func (v *Object) GetName() string

GetName() is a wrapper around gst_object_get_name().

func (*Object) RefSink Uses

func (v *Object) RefSink()

RefSink is a wrapper around gst_object_ref_sink(). This is for internal use.

func (*Object) Unref Uses

func (v *Object) Unref()

Unref is a wrapper around gst_object_unref(). This is for internal use.

type Pad Uses

type Pad struct {
    Object
}

func (*Pad) GetPeer Uses

func (v *Pad) GetPeer() (*Pad, error)

GetPeer() is a wrapper around gst_pad_get_peer().

func (v *Pad) Link(sinkPad IPad) PadLinkReturn

Link is a wrapper around gst_pad_link().

func (*Pad) SetActive Uses

func (v *Pad) SetActive(active bool) bool

SetActive() is a wrapper around gst_pad_set_active().

func (v *Pad) Unlink(sinkPad IPad) bool

Unlink() is a wrapper around gst_pad_unlink().

type PadLinkReturn Uses

type PadLinkReturn int

PadLinkReturn os a representation of GstPadLinkReturn.

const (
    PAD_LINK_OK              PadLinkReturn = C.GST_PAD_LINK_OK
    PAD_LINK_WRONG_HIERARCHY PadLinkReturn = C.GST_PAD_LINK_WRONG_HIERARCHY
    PAD_LINK_WAS_LINKED      PadLinkReturn = C.GST_PAD_LINK_WAS_LINKED
    PAD_LINK_WRONG_DIRECTION PadLinkReturn = C.GST_PAD_LINK_WRONG_DIRECTION
    PAD_LINK_NOFORMAT        PadLinkReturn = C.GST_PAD_LINK_NOFORMAT
    PAD_LINK_NOSCHED         PadLinkReturn = C.GST_PAD_LINK_NOSCHED
    PAD_LINK_REFUSED         PadLinkReturn = C.GST_PAD_LINK_REFUSED
)

type Pipeline Uses

type Pipeline struct {
    Bin
}

func PipelineNew Uses

func PipelineNew(name string) (*Pipeline, error)

PipelineNew() is a wrapper around gst_pipeline_new().

func (*Pipeline) GetBus Uses

func (v *Pipeline) GetBus() (*Bus, error)

GetBus() is a wrapper around gst_pipeline_get_bus().

type PluginFeature Uses

type PluginFeature struct {
    Object
}

type SeekFlags Uses

type SeekFlags int

SeekFlags is a representation of GstSeekFlags.

const (
    SEEK_FLAG_NONE         SeekFlags = C.GST_SEEK_FLAG_NONE
    SEEK_FLAG_FLUSH        SeekFlags = C.GST_SEEK_FLAG_FLUSH
    SEEK_FLAG_ACCURATE     SeekFlags = C.GST_SEEK_FLAG_ACCURATE
    SEEK_FLAG_KEY_UNIT     SeekFlags = C.GST_SEEK_FLAG_KEY_UNIT
    SEEK_FLAG_SEGMENT      SeekFlags = C.GST_SEEK_FLAG_SEGMENT
    SEEK_FLAG_SKIP         SeekFlags = C.GST_SEEK_FLAG_SKIP
    SEEK_FLAG_SNAP_BEFORE  SeekFlags = C.GST_SEEK_FLAG_SNAP_BEFORE
    SEEK_FLAG_SNAP_AFTER   SeekFlags = C.GST_SEEK_FLAG_SNAP_AFTER
    SEEK_FLAG_SNAP_NEAREST SeekFlags = C.GST_SEEK_FLAG_SNAP_NEAREST
)

type SeekType Uses

type SeekType int

SeekType is a representation of GstSeekType.

const (
    SEEK_TYPE_NONE SeekType = C.GST_SEEK_TYPE_NONE
    SEEK_TYPE_SET  SeekType = C.GST_SEEK_TYPE_SET
    SEEK_TYPE_END  SeekType = C.GST_SEEK_TYPE_END
)

type State Uses

type State int

State is a representation of GstState.

const (
    STATE_VOID_PENDING State = C.GST_STATE_VOID_PENDING
    STATE_NULL         State = C.GST_STATE_NULL
    STATE_READY        State = C.GST_STATE_READY
    STATE_PAUSED       State = C.GST_STATE_PAUSED
    STATE_PLAYING      State = C.GST_STATE_PLAYING
)

func (*State) GetName Uses

func (s *State) GetName() string

GetName() is a wrapper around gst_element_state_get_name().

type StateChangeReturn Uses

type StateChangeReturn int

StateChangeReturn is a representation of GstStateChangeReturn.

const (
    STATE_CHANGE_FAILURE    StateChangeReturn = C.GST_STATE_CHANGE_FAILURE
    STATE_CHANGE_SUCCESS    StateChangeReturn = C.GST_STATE_CHANGE_SUCCESS
    STATE_CHANGE_ASYNC      StateChangeReturn = C.GST_STATE_CHANGE_ASYNC
    STATE_CHANGE_NO_PREROLL StateChangeReturn = C.GST_STATE_CHANGE_NO_PREROLL
)

type Structure Uses

type Structure struct {
    Name string
    Data map[string]interface{}
}

Package gst imports 5 packages (graph) and is imported by 1 packages. Updated 2018-08-05. Refresh now. Tools for package owners.