gst

package module
Version: v0.0.0-...-e6d2974 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: BSD-3-Clause Imports: 5 Imported by: 1

README

Go bindings for GStreamer at a very early stage of maturity.

This package is based on GLib bindings. It should be goinstalable. Try

$ go get github.com/ziutek/gst

Documentation

See examples directory and http://gopkgdoc.appspot.com/pkg/github.com/ziutek/gst

To run examples use go run command:

$ cd examples
$ go run simple.go

To run live WebM example use go run live_webm.go and open http://127.0.0.1:8080 with your browser. You probably need to wait a long time for video because of small bitrate of this stream and big buffer in you browser.

Documentation

Overview

Bindings for GStreamer API

Bindings for GStreamer API

Index

Constants

View Source
const (
	GST_FLOW_OK             = FlowReturn(C.GST_FLOW_OK)
	GST_FLOW_FLUSHING       = FlowReturn(C.GST_FLOW_FLUSHING)
	GST_FLOW_NOT_LINKED     = FlowReturn(C.GST_FLOW_NOT_LINKED)
	GST_FLOW_NOT_NEGOTIATED = FlowReturn(C.GST_FLOW_NOT_NEGOTIATED)
	GST_FLOW_ERROR          = FlowReturn(C.GST_FLOW_ERROR)
	GST_FLOW_NOT_SUPPORTED  = FlowReturn(C.GST_FLOW_NOT_SUPPORTED)
)
View Source
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)
)
View Source
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)
)
View Source
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_PROVIDE    = MessageType(C.GST_MESSAGE_CLOCK_PROVIDE)
	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         = MessageType(C.GST_MESSAGE_DURATION)
	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_ANY = MessageType(C.GST_MESSAGE_ANY)
)
View Source
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)
)
View Source
const (
	PAD_UNKNOWN = PadDirection(C.GST_PAD_UNKNOWN)
	PAD_SRC     = PadDirection(C.GST_PAD_SRC)
	PAD_SINK    = PadDirection(C.GST_PAD_SINK)
)

Variables

View Source
var CLOCK_TIME_NONE = uint64(C.GST_CLOCK_TIME_NONE)
View Source
var TYPE_FOURCC, TYPE_INT_RANGE, TYPE_FRACTION glib.Type

Functions

func Free

func Free(ptr *Memory)

Types

type AppSrc

type AppSrc struct {
	*Element
}

func NewAppSrc

func NewAppSrc(name string) *AppSrc

func (*AppSrc) EOS

func (a *AppSrc) EOS() error

func (*AppSrc) PushBuffer

func (b *AppSrc) PushBuffer(buffer *Buffer) int

func (*AppSrc) SetCaps

func (a *AppSrc) SetCaps(caps *Caps)

func (*AppSrc) Write

func (a *AppSrc) Write(d []byte) (int, error)

type Bin

type Bin struct {
	Element
}

func NewBin

func NewBin(name string) *Bin

func (*Bin) Add

func (b *Bin) Add(els ...*Element) bool

func (*Bin) AsBin

func (b *Bin) AsBin() *Bin

func (*Bin) GetByName

func (b *Bin) GetByName(name string) *Element

GetByName returns the element with the given name from a bin. Returns nil if no element with the given name is found in the bin.

func (*Bin) Remove

func (b *Bin) Remove(els ...*Element) bool

type Buffer

type Buffer struct {
	GstBuffer *GstBufferStruct
}

func NewBuffer

func NewBuffer() *Buffer

func NewBufferAllocate

func NewBufferAllocate(size uint) *Buffer

func (*Buffer) AppendMemory

func (this *Buffer) AppendMemory(memory *Memory)

func (*Buffer) Fill

func (this *Buffer) Fill(offset uint, src unsafe.Pointer, size uint) int

func (*Buffer) FillWithGoSlice

func (this *Buffer) FillWithGoSlice(data []byte) int

func (*Buffer) GetSize

func (this *Buffer) GetSize() uint

func (*Buffer) MemSet

func (this *Buffer) MemSet(offset uint, val byte, size uint) int

func (*Buffer) SetDTS

func (this *Buffer) SetDTS(value uint64)

func (*Buffer) SetDuration

func (this *Buffer) SetDuration(value uint64)

func (*Buffer) SetOffset

func (this *Buffer) SetOffset(value uint64)

func (*Buffer) SetOffsetEnd

func (this *Buffer) SetOffsetEnd(value uint64)

func (*Buffer) SetPTS

func (this *Buffer) SetPTS(value uint64)

func (*Buffer) Unref

func (this *Buffer) Unref()

type Bus

type Bus struct {
	GstObj
}

func NewBus

func NewBus() *Bus

func (*Bus) AddSignalWatch

func (b *Bus) AddSignalWatch()

func (*Bus) AddSignalWatchFull

func (b *Bus) AddSignalWatchFull(priority int)

func (*Bus) AsBus

func (b *Bus) AsBus() *Bus

func (*Bus) DisableSyncMessageEmission

func (b *Bus) DisableSyncMessageEmission()

func (*Bus) EnableSyncMessageEmission

func (b *Bus) EnableSyncMessageEmission()

func (*Bus) HavePending

func (b *Bus) HavePending() bool

func (*Bus) Peek

func (b *Bus) Peek() *Message

func (*Bus) Poll

func (b *Bus) Poll(events MessageType, timeout int64) *Message

func (*Bus) Pop

func (b *Bus) Pop() *Message

func (*Bus) PopFiltered

func (b *Bus) PopFiltered(types MessageType) *Message

func (*Bus) Post

func (b *Bus) Post(msg *Message) bool

func (*Bus) RemoveSignalWatch

func (b *Bus) RemoveSignalWatch()

func (*Bus) SetFlushing

func (b *Bus) SetFlushing(flushing bool)

func (*Bus) TimedPop

func (b *Bus) TimedPop(timeout uint64) *Message

func (*Bus) TimedPopFiltered

func (b *Bus) TimedPopFiltered(timeout uint64, types MessageType) *Message

type Caps

type Caps C.GstCaps

func CapsFromString

func CapsFromString(s string) *Caps

func NewCapsAny

func NewCapsAny() *Caps

func NewCapsEmpty

func NewCapsEmpty() *Caps

func NewCapsSimple

func NewCapsSimple(media_type string, fields glib.Params) *Caps

func (*Caps) AppendStructure

func (c *Caps) AppendStructure(media_type string, fields glib.Params)

func (*Caps) GetSize

func (c *Caps) GetSize() int

func (*Caps) Ref

func (c *Caps) Ref() *Caps

func (*Caps) RefCount

func (c *Caps) RefCount() int

func (*Caps) String

func (c *Caps) String() string

func (*Caps) Unref

func (c *Caps) Unref()

type Clock

type Clock struct {
	GstObj
}

func (*Clock) AsClock

func (c *Clock) AsClock() *Clock

type Element

type Element struct {
	GstObj
}

func ElementFactoryMake

func ElementFactoryMake(factory_name, name string) *Element

TODO: Move ElementFactoryMake to element_factory.go

func (*Element) AddPad

func (e *Element) AddPad(p *Pad) bool

func (*Element) AsElement

func (e *Element) AsElement() *Element

func (*Element) GetBus

func (e *Element) GetBus() *Bus

func (*Element) GetRequestPad

func (e *Element) GetRequestPad(name string) *Pad

func (*Element) GetState

func (e *Element) GetState(timeout_ns int64) (state, pending State,
	ret StateChangeReturn)

func (*Element) GetStaticPad

func (e *Element) GetStaticPad(name string) *Pad
func (e *Element) Link(next ...*Element) bool

func (*Element) LinkFiltered

func (e *Element) LinkFiltered(dst *Element, filter *Caps) bool

func (*Element) LinkPads

func (e *Element) LinkPads(pad_name string, dst *Element, dst_pad_name string) bool

func (*Element) SetState

func (e *Element) SetState(state State) StateChangeReturn
func (e *Element) Unlink(next ...*Element)

func (*Element) UnlinkPads

func (e *Element) UnlinkPads(pad_name string, dst *Element, dst_pad_name string)

type Event

type Event struct {
	GstEvent *GstEventStruct
}

func Eos

func Eos() *Event

type FlowReturn

type FlowReturn C.GstFlowReturn

func (FlowReturn) String

func (f FlowReturn) String() string

type Fourcc

type Fourcc uint32

func MakeFourcc

func MakeFourcc(a, b, c, d byte) Fourcc

func StrFourcc

func StrFourcc(s string) Fourcc

func ValueFourcc

func ValueFourcc(v *glib.Value) Fourcc

func (Fourcc) String

func (f Fourcc) String() string

func (Fourcc) Type

func (f Fourcc) Type() glib.Type

func (Fourcc) Value

func (f Fourcc) Value() *glib.Value

type Fraction

type Fraction struct {
	Numer, Denom int
}

func ValueFraction

func ValueFraction(v *glib.Value) *Fraction

func (*Fraction) String

func (r *Fraction) String() string

func (*Fraction) Type

func (f *Fraction) Type() glib.Type

func (*Fraction) Value

func (f *Fraction) Value() *glib.Value

type GhostPad

type GhostPad struct {
	Pad
}

func NewGhostPad

func NewGhostPad(name string, target *Pad) *GhostPad

func NewGhostPadNoTarget

func NewGhostPadNoTarget(name string, dir PadDirection) *GhostPad

func (*GhostPad) AsGhostPad

func (p *GhostPad) AsGhostPad() *GhostPad

func (*GhostPad) Construct

func (p *GhostPad) Construct() bool

func (*GhostPad) GetTarget

func (p *GhostPad) GetTarget() *Pad

func (*GhostPad) SetTarget

func (p *GhostPad) SetTarget(new_target *Pad) bool

type GstBufferStruct

type GstBufferStruct C.GstBuffer

type GstEventStruct

type GstEventStruct C.GstEvent

type GstObj

type GstObj struct {
	glib.Object
}

func (*GstObj) AsGstObj

func (o *GstObj) AsGstObj() *GstObj

func (*GstObj) GetName

func (o *GstObj) GetName() string

MT safe.

func (*GstObj) GetParent

func (o *GstObj) GetParent() *GstObj

Returns the parent of o. Increases the refcount of the parent object so you should Unref it after usage.

func (*GstObj) GetPathString

func (o *GstObj) GetPathString() string

Generates a string describing the path of object in the object hierarchy. Only useful (or used) for debugging.

func (*GstObj) SetName

func (o *GstObj) SetName(name string) bool

Sets the name of object. Returns true if the name could be set. MT safe.

func (*GstObj) SetParent

func (o *GstObj) SetParent(p *GstObj) bool

Sets the parent of o to p. This function causes the parent-set signal to be emitted when the parent was successfully set.

func (*GstObj) Unparent

func (o *GstObj) Unparent()

Clear the parent of object, removing the associated reference. This function decreases the refcount of o. MT safe. Grabs and releases object's lock.

type IntRange

type IntRange struct {
	Start, End int
}

func ValueRange

func ValueRange(v *glib.Value) *IntRange

func (*IntRange) String

func (r *IntRange) String() string

func (*IntRange) Type

func (r *IntRange) Type() glib.Type

func (*IntRange) Value

func (r *IntRange) Value() *glib.Value

type Memory

type Memory C.GstMemory

func Allocate

func Allocate(size uint32) *Memory

type Message

type Message C.GstMessage

func (*Message) GetSrc

func (m *Message) GetSrc() *GstObj

func (*Message) GetStructure

func (m *Message) GetStructure() (string, glib.Params)

func (*Message) GetType

func (m *Message) GetType() MessageType

func (*Message) ParseError

func (m *Message) ParseError() (err *glib.Error, debug string)

func (*Message) Ref

func (m *Message) Ref() *Message

func (*Message) Type

func (m *Message) Type() glib.Type

func (*Message) Unref

func (m *Message) Unref()

type MessageType

type MessageType C.GstMessageType

func (MessageType) String

func (t MessageType) String() string

type Pad

type Pad struct {
	GstObj
}

func (*Pad) AsPad

func (p *Pad) AsPad() *Pad
func (p *Pad) CanLink(sink_pad *Pad) bool
func (p *Pad) Link(sink_pad *Pad) PadLinkReturn

type PadDirection

type PadDirection C.GstPadDirection

func (PadDirection) String

func (p PadDirection) String() string

type PadLinkReturn

type PadLinkReturn C.GstPadLinkReturn

func (PadLinkReturn) String

func (p PadLinkReturn) String() string

type Pipeline

type Pipeline struct {
	Bin
}

func NewPipeline

func NewPipeline(name string) *Pipeline

func ParseLaunch

func ParseLaunch(pipeline_description string) (*Pipeline, error)

func (*Pipeline) AsPipeline

func (p *Pipeline) AsPipeline() *Pipeline

func (*Pipeline) Free

func (p *Pipeline) Free()

type State

type State C.GstState

func (State) String

func (s State) String() string

type StateChangeReturn

type StateChangeReturn C.GstStateChangeReturn

Directories

Path Synopsis
This simple test application create live H264 (or WebM - see commented lines) content from test source, decode it and display.
This simple test application create live H264 (or WebM - see commented lines) content from test source, decode it and display.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL