gst

package
v0.0.0-...-e0143e0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2014 License: ISC Imports: 5 Imported by: 0

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

View Source
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 Bin

type Bin struct {
	Element
}

func BinNew

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

BinNew() is a wrapper around gst_bin_new().

func (*Bin) Add

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

Add() is a wrapper around gst_bin_add().

func (*Bin) Remove

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

Remove() is a wrapper around gst_bin_remove().

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

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

ElementFactoryMake() is a wrapper around gst_element_factory_make().

func (*Element) AddPad

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

AddPad() is a wrapper around gst_element_add_pad().

func (*Element) GetBus

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

GetBus() is a wrapper around gst_element_get_bus().

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

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

GetStaticPad() is a wrapper around gst_element_get_static_pad().

func (*Element) QueryDuration

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

QueryDuration() is a wrapper around gst_element_query_duration().

func (*Element) QueryPosition

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

QueryPosition() is a wrapper around gst_element_query_position().

func (*Element) RemovePad

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

RemovePad() is a wrapper around gst_element_remove_pad().

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

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

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

func (v *Element) SyncStateWithParent() bool

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 GhostPad

type GhostPad struct {
	Pad
}

func GhostPadNew

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

GhostPadNew() is a wrapper around gst_ghost_pad_new().

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 IPad

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

type Message

type Message struct {
	GstMessage *C.GstMessage
}

Message is a representation of Gst's GstMessage.

func (*Message) GetSeqnum

func (v *Message) GetSeqnum() uint64

GetSeqnum() is a wrapper around GST_MESSAGE_SEQNUM().

func (*Message) GetTimestamp

func (v *Message) GetTimestamp() uint64

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

func (v *Message) GetTypeName() string

GetTypeName() is a wrapper around GST_MESSAGE_TYPE_NAME().

func (*Message) Native

func (v *Message) Native() uintptr

Native returns a pointer to the underlying GdkEvent.

func (*Message) ParseBuffering

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

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

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

ParseError() is a wrapper around gst_message_parse_error().

func (*Message) ParseQosStats

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

ParseQosStats() is a wrapper around gst_message_parse_qos_stats().

func (*Message) ParseQosValues

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

ParseQosValues() is a wrapper around gst_message_parse_qos_values().

func (*Message) ParseSegmentDone

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

ParseSegmentDone() is a wrapper around gst_message_parse_segment_done().

func (*Message) ParseSegmentStart

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

ParseSegmentStart() is a wrapper around gst_message_parse_segment_start().

func (*Message) ParseStateChanged

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

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

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

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.

func (*Object) GetName

func (v *Object) GetName() string

GetName() is a wrapper around gst_object_get_name().

func (*Object) RefSink

func (v *Object) RefSink()

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

func (*Object) Unref

func (v *Object) Unref()

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

type Pad

type Pad struct {
	Object
}

func (*Pad) GetPeer

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

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

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
)

func (*State) GetName

func (s *State) GetName() string

GetName() is a wrapper around gst_element_state_get_name().

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
)

Jump to

Keyboard shortcuts

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