Documentation ¶
Overview ¶
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 ¶
- Constants
- func Init(args *[]string)
- type Bin
- type BufferingMode
- type Bus
- type Element
- func (v *Element) AddPad(pad IPad) bool
- func (v *Element) GetBus() (*Bus, error)
- func (v *Element) GetState(timeout uint64) (state, pending State, change StateChangeReturn)
- func (v *Element) GetStaticPad(name string) (*Pad, error)
- func (v *Element) QueryDuration(format Format) (cur int64, success bool)
- func (v *Element) QueryPosition(format Format) (cur int64, success bool)
- func (v *Element) RemovePad(pad IPad) bool
- func (v *Element) Seek(rate float64, format Format, flags SeekFlags, startType SeekType, start int64, ...) bool
- func (v *Element) SeekSimple(format Format, flags SeekFlags, pos int64) bool
- func (v *Element) SetState(state State) StateChangeReturn
- func (v *Element) SyncStateWithParent() bool
- type ElementFactory
- type Format
- type GhostPad
- type IElement
- type IPad
- type Message
- func (v *Message) GetSeqnum() uint64
- func (v *Message) GetTimestamp() uint64
- func (v *Message) GetType() MessageType
- func (v *Message) GetTypeName() string
- func (v *Message) Native() uintptr
- func (v *Message) ParseBuffering() (percent int)
- func (v *Message) ParseBufferingStats() (mode BufferingMode, avgIn, avgOut int, bufferingLeft int64)
- func (v *Message) ParseError() (err error, debug string)
- func (v *Message) ParseQosStats() (format Format, processed, dropped uint64)
- func (v *Message) ParseQosValues() (jitter int64, proportion float64, quality int)
- func (v *Message) ParseSegmentDone() (format Format, position int64)
- func (v *Message) ParseSegmentStart() (format Format, position int64)
- func (v *Message) ParseStateChanged() (oldState, newState, pending State)
- func (v *Message) ParseStepDone() (format Format, amount uint64, rate float64, flush, intermediate bool, ...)
- func (v *Message) ParseWarning() (err error, debug string)
- type MessageType
- type Object
- type Pad
- type PadLinkReturn
- type PluginFeature
- type SeekFlags
- type SeekType
- type State
- type StateChangeReturn
Constants ¶
const ( // Infinite timeout (unsigned representation of -1) CLOCK_TIME_NONE uint64 = 18446744073709551615 )
Variables ¶
This section is empty.
Functions ¶
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.
Types ¶
type BufferingMode ¶
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 ¶
type Bus struct {
Object
}
func (*Bus) AddSignalWatch ¶
func (v *Bus) AddSignalWatch()
AddSignalWatch() is a wrapper around gst_bus_add_signal_watch().
type Element ¶
type Element struct {
Object
}
func ElementFactoryMake ¶
ElementFactoryMake() is a wrapper around gst_element_factory_make().
func (*Element) GetState ¶
func (v *Element) GetState(timeout uint64) (state, pending State, change StateChangeReturn)
GetState() is a wrapper around gst_element_get_state().
func (*Element) GetStaticPad ¶
GetStaticPad() is a wrapper around gst_element_get_static_pad().
func (*Element) QueryDuration ¶
QueryDuration() is a wrapper around gst_element_query_duration().
func (*Element) QueryPosition ¶
QueryPosition() is a wrapper around gst_element_query_position().
func (*Element) Seek ¶
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 ¶
SeekSimple() is a wrapper around gst_element_seek_simple().
func (*Element) SetState ¶
func (v *Element) SetState(state State) StateChangeReturn
SetState() is a wrapper around gst_element_set_state().
func (*Element) SyncStateWithParent ¶
SyncStateWithParent() is a wrapper around gst_element_sync_state_with_parent().
type ElementFactory ¶
type ElementFactory struct {
PluginFeature
}
func ElementFactoryFind ¶
func ElementFactoryFind(name string) (*ElementFactory, error)
ElementFactoryFind() is a wrapper around gst_element_factory_find().
type Format ¶
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 IElement ¶
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 Message ¶
type Message struct {
GstMessage *C.GstMessage
}
Message is a representation of Gst's GstMessage.
func (*Message) GetTimestamp ¶
Timestamp() is a wrapper around GST_MESSAGE_TIMESTAMP().
func (*Message) GetType ¶
func (v *Message) GetType() MessageType
GetType() is a wrapper around GST_MESSAGE_TYPE().
func (*Message) GetTypeName ¶
GetTypeName() is a wrapper around GST_MESSAGE_TYPE_NAME().
func (*Message) ParseBuffering ¶
ParseBuffering() is a wrapper around gst_message_parse_buffering().
func (*Message) ParseBufferingStats ¶
func (v *Message) ParseBufferingStats() (mode BufferingMode, avgIn, avgOut int, bufferingLeft int64)
ParseBufferingStats() is a wrapper around gst_message_parse_buffering_stats().
func (*Message) ParseError ¶
ParseError() is a wrapper around gst_message_parse_error().
func (*Message) ParseQosStats ¶
ParseQosStats() is a wrapper around gst_message_parse_qos_stats().
func (*Message) ParseQosValues ¶
ParseQosValues() is a wrapper around gst_message_parse_qos_values().
func (*Message) ParseSegmentDone ¶
ParseSegmentDone() is a wrapper around gst_message_parse_segment_done().
func (*Message) ParseSegmentStart ¶
ParseSegmentStart() is a wrapper around gst_message_parse_segment_start().
func (*Message) ParseStateChanged ¶
ParseStateChanged() is a wrapper around gst_message_parse_state_changed().
func (*Message) ParseStepDone ¶
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 ¶
ParseWarning() is a wrapper around gst_message_parse_warning().
type MessageType ¶
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 ¶
type Object struct {
glib.InitiallyUnowned
}
Object is a representation of gst's GstObject.
type Pad ¶
type Pad struct {
Object
}
func (*Pad) Link ¶
func (v *Pad) Link(sinkPad IPad) PadLinkReturn
Link is a wrapper around gst_pad_link().
type PadLinkReturn ¶
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 PluginFeature ¶
type PluginFeature struct {
Object
}
type SeekFlags ¶
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 ¶
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 ¶
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 )
type StateChangeReturn ¶
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 )