gst

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package gst provides wrappers for building gstreamer pipelines and then reading and/or writing from either end of the pipeline.

It uses cgo to interface with the gstreamer-1.0 C API.

A simple opus/webm encoder created from a launch string could look like this:

  import (
	  "os"
	  "github.com/tinyzimmer/go-gst-launch/gst"
  )

  func main() {
	  gst.Init()
	  encoder, err := gst.NewPipelineFromLaunchString("opusenc ! webmmux", gst.PipelineReadWrite)
	  if err != nil {
		  panic(err)
	  }

	  // You should close even if you don't start the pipeline, since this
	  // will free resources created by gstreamer.
	  defer encoder.Close()

	  if err := encoder.Start() ; err != nil {
	      panic(err)
	  }

	  go func() {
		  encoder.Write(...)  // Write raw audio data to the pipeline
	  }()

	  // don't actually do this - copy encoded audio to stdout
	  if _, err  := io.Copy(os.Stdout, encoder) ; err != nil {
		  panic(err)
	  }
  }

You can accomplish the same thing using the "configuration" functionality provided by NewPipelineFromConfig(). Here is an example that will record from a pulse server and make opus/webm data available on the Reader.

  import (
	"io"
	"os"
	"github.com/tinyzimmer/go-gst-launch/gst"
  )

  func main() {
	  gst.Init()
	  encoder, err := gst.NewPipelineFromConfig(&gst.PipelineConfig{
		  Plugins: []*gst.Plugin{
			  {
				  Name: "pulsesrc",
				  Data: map[string]interface{}{
					  "server": "/run/user/1000/pulse/native",
					  "device": "playback-device.monitor",
				  },
				  SinkCaps: gst.NewRawCaps("S16LE", 24000, 2),
			  },
			  {
				  Name: "opusenc",
			  },
			  {
				  Name: "webmmux",
			  },
		  },
	  }, gst.PipelineRead, nil)
	  if err != nil {
		  panic(err)
	  }

	  defer encoder.Close()

	  if err := encoder.Start() ; err != nil {
		  panic(err)
	  }

	  // Create an output file
	  f, err := os.Create("out.opus")
	  if err != nil {
		  panic(err)
	  }

	  // Copy the data from the pipeline to the file
	  if err := io.Copy(f, encoder) ; err != nil {
		  panic(err)
	  }

  }

There are two channels exported for listening for messages from the pipeline. An example of listening to messages on a fake pipeline for 10 seconds:

  package main

  import (
	"fmt"
	"time"

	"github.com/tinyzimmer/go-gst-launch/gst"
  )

  func main() {
	  gst.Init()

	  pipeline, err := gst.NewPipelineFromLaunchString("audiotestsrc ! fakesink",  gst.PipelineInternalOnly)
	  if err != nil {
	 	  panic(err)
	  }

	  defer pipeline.Close()

	  go func() {
		  for msg := range pipeline.MessageChan() {
			  fmt.Println("Got message:", msg.TypeName())
		  }
	  }()

	  go func() {
		  for msg := range pipeline.ErrorChan() {
			  fmt.Println("Got error:", err)
		  }
	  }()

	  if err := pipeline.Start(); err != nil {
		  fmt.Println("Pipeline failed to start")
		  return
	  }

	  time.Sleep(time.Second * 10)
  }

The package also exposes some low level functionality for building pipelines and doing dynamic linking yourself. See the NewPipeline() function for creating an empty pipeline that you can then build out using the other structs and methods provided by this package.

Index

Constants

View Source
const (
	MessageAny          MessageType = C.GST_MESSAGE_ANY
	MessageStreamStart              = C.GST_MESSAGE_STREAM_START
	MessageEOS                      = C.GST_MESSAGE_EOS
	MessageInfo                     = C.GST_MESSAGE_INFO
	MessageWarning                  = C.GST_MESSAGE_WARNING
	MessageError                    = C.GST_MESSAGE_ERROR
	MessageStateChanged             = C.GST_MESSAGE_STATE_CHANGED
	MessageElement                  = C.GST_MESSAGE_ELEMENT
	MessageStreamStatus             = C.GST_MESSAGE_STREAM_STATUS
	MessageBuffering                = C.GST_MESSAGE_BUFFERING
	MessageLatency                  = C.GST_MESSAGE_LATENCY
	MessageNewClock                 = C.GST_MESSAGE_NEW_CLOCK
	MessageAsyncDone                = C.GST_MESSAGE_ASYNC_DONE
	MessageTag                      = C.GST_MESSAGE_TAG
)

Type casting of GstMessageTypes

View Source
const (
	FlowOK            FlowReturn = C.GST_FLOW_OK             // Data passing was ok
	FlowNotLinked                = C.GST_FLOW_NOT_LINKED     // Pad is not linked
	FlowFlushing                 = C.GST_FLOW_FLUSHING       // Pad is flushing
	FlowEOS                      = C.GST_FLOW_EOS            // Pad is EOS
	FlowNotNegotiated            = C.GST_FLOW_NOT_NEGOTIATED // Pad is not negotiated
	FlowError                    = C.GST_FLOW_ERROR          // Some (fatal) error occurred
	FlowNotSupported             = C.GST_FLOW_NOT_SUPPORTED  // The operation is not supported.
)

Type casting of the GstFlowReturn types. Custom ones are omitted for now.

View Source
const (
	VoidPending  State = C.GST_STATE_VOID_PENDING // (0) – no pending state.
	StateNull          = C.GST_STATE_NULL         // (1) – the NULL state or initial state of an element.
	StateReady         = C.GST_STATE_READY        // (2) – the element is ready to go to PAUSED.
	StatePaused        = 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       = C.GST_STATE_PLAYING      // (4) – the element is PLAYING, the GstClock is running and the data is flowing.
)

Type casting for GstStates

Variables

View Source
var ErrEOS = errors.New("Pipeline has reached end-of-stream")

ErrEOS represents that the stream has ended.

Functions

func ElementLinkMany added in v0.0.10

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

Init runs `gst_init`. It currently does not support arguments. This should be called before building any pipelines.

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

func Wait(p *Pipeline)

Wait waits for the given pipeline to reach end of stream.

Types

type AppSink added in v0.0.10

type AppSink struct{ *Element }

AppSink wraps an Element object with additional methods for pulling samples.

func NewAppSink added in v0.0.10

func NewAppSink() (*AppSink, error)

NewAppSink returns a new appsink element. Unref after usage.

func (*AppSink) BlockPullSample added in v0.0.10

func (a *AppSink) BlockPullSample() (*Sample, error)

BlockPullSample will block until a sample becomes available or the stream is ended.

func (*AppSink) Instance added in v0.0.10

func (a *AppSink) Instance() *C.GstAppSink

Instance returns the native GstAppSink instance.

func (*AppSink) IsEOS added in v0.0.10

func (a *AppSink) IsEOS() bool

IsEOS returns true if this AppSink has reached the end-of-stream.

func (*AppSink) PullSample added in v0.0.10

func (a *AppSink) PullSample() (*Sample, error)

PullSample will try to pull a sample or return nil if none is available.

type AppSrc added in v0.0.10

type AppSrc struct{ *Element }

AppSrc wraps an Element object with additional methods for pushing samples.

func NewAppSrc added in v0.0.10

func NewAppSrc() (*AppSrc, error)

NewAppSrc returns a new AppSrc element.

func (*AppSrc) EndStream added in v0.0.10

func (a *AppSrc) EndStream() FlowReturn

EndStream signals to the app source that the stream has ended after the last queued buffer.

func (*AppSrc) Instance added in v0.0.10

func (a *AppSrc) Instance() *C.GstAppSrc

Instance returns the native GstAppSink instance.

func (*AppSrc) PushBuffer added in v0.0.10

func (a *AppSrc) PushBuffer(data io.Reader) FlowReturn

PushBuffer pushes a buffer to the appsrc. Currently by default this will block until the source is ready to accept the buffer.

func (*AppSrc) SetDuration added in v0.0.10

func (a *AppSrc) SetDuration(dur time.Duration)

SetDuration sets the duration of the source stream. You should call this if the value is known.

func (*AppSrc) SetLive added in v0.0.10

func (a *AppSrc) SetLive(b bool) error

SetLive sets whether or not this is a live stream.

func (*AppSrc) SetSize added in v0.0.10

func (a *AppSrc) SetSize(size int64)

SetSize sets the size of the source stream in bytes. You should call this for streams of fixed length.

type Bin added in v0.0.10

type Bin struct{ *Element }

Bin is a go wrapper arounds a GstBin.

func (*Bin) Add added in v0.0.10

func (b *Bin) Add(elem *Element) error

Add wraps `gst_bin_add`.

func (*Bin) AddMany added in v0.0.10

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

func (b *Bin) GetElementByName(name string) (*Element, error)

GetElementByName returns the element with the given name. Unref after usage.

func (*Bin) GetElements added in v0.0.10

func (b *Bin) GetElements() ([]*Element, error)

GetElements returns a list of the elements added to this pipeline. Unref elements after usage.

func (*Bin) GetSinkElements added in v0.0.10

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

func (b *Bin) GetSourceElements() ([]*Element, error)

GetSourceElements returns a list of all the source elements in this pipeline. Unref elements after usafe.

func (*Bin) Instance added in v0.0.10

func (b *Bin) Instance() *C.GstBin

Instance returns the underlying GstBin instance.

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) 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.

func (*Bus) Instance added in v0.0.10

func (b *Bus) Instance() *C.GstBus

Instance returns the underlying GstBus instance.

func (*Bus) MessageChan added in v0.0.10

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.

type Caps

type Caps struct {
	Type string
	Data map[string]interface{}
}

Caps is a wrapper around GstCaps. It provides a function for easy type conversion.

func NewRawCaps

func NewRawCaps(format string, rate, channels int) *Caps

NewRawCaps returns new GstCaps with the given format, sample-rate, and channels.

func (*Caps) ToGstCaps

func (g *Caps) ToGstCaps() (*C.GstCaps, error)

ToGstCaps returns the GstCaps representation of this Caps instance.

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

func (e *Element) BlockSetState(state State) error

BlockSetState is like SetState except it will block until the transition is complete.

func (*Element) GetBus added in v0.0.10

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

GetBus returns the GstBus for retrieving messages from this element.

func (*Element) GetFactory added in v0.0.10

func (e *Element) GetFactory() *ElementFactory

GetFactory returns the factory that created this element.

func (*Element) GetState added in v0.0.10

func (e *Element) GetState() State

GetState returns the current state of this element.

func (*Element) Instance added in v0.0.10

func (e *Element) Instance() *C.GstElement

Instance returns the underlying GstElement instance.

func (e *Element) Link(elem *Element) error

Link wraps gst_element_link and links this element to the given one.

func (*Element) LinkFiltered added in v0.0.10

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

func (e *Element) SetState(state State) error

SetState sets the target state for this element.

type ElementFactory added in v0.0.10

type ElementFactory struct{ *Object }

ElementFactory wraps the GstElementFactory

func (*ElementFactory) CanSinkAllCaps added in v0.0.10

func (e *ElementFactory) CanSinkAllCaps(caps *C.GstCaps) bool

CanSinkAllCaps checks if the factory can sink all possible capabilities.

func (*ElementFactory) CanSinkAnyCaps added in v0.0.10

func (e *ElementFactory) CanSinkAnyCaps(caps *C.GstCaps) bool

CanSinkAnyCaps checks if the factory can sink any possible capability.

func (*ElementFactory) CanSourceAllCaps added in v0.0.10

func (e *ElementFactory) CanSourceAllCaps(caps *C.GstCaps) bool

CanSourceAllCaps checks if the factory can src all possible capabilities.

func (*ElementFactory) CanSourceAnyCaps added in v0.0.10

func (e *ElementFactory) CanSourceAnyCaps(caps *C.GstCaps) bool

CanSourceAnyCaps checks if the factory can src any possible capability.

func (*ElementFactory) GetMetadata added in v0.0.10

func (e *ElementFactory) GetMetadata(key string) string

GetMetadata gets the metadata on this factory with key.

func (*ElementFactory) GetMetadataKeys added in v0.0.10

func (e *ElementFactory) GetMetadataKeys() []string

GetMetadataKeys gets the available keys for the metadata on this factory.

func (*ElementFactory) Instance added in v0.0.10

func (e *ElementFactory) Instance() *C.GstElementFactory

Instance returns the C GstFactory instance

type FlowReturn added in v0.0.10

type FlowReturn C.GstFlowReturn

FlowReturn is go type casting for GstFlowReturn.

type GoGError

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

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

func (*GoGError) DebugString

func (e *GoGError) DebugString() string

DebugString returns any debug info alongside the error.

func (*GoGError) Details

func (e *GoGError) Details() map[string]string

Details contains additional metadata about the error if available.

func (*GoGError) Error

func (e *GoGError) Error() string

Error implements the error interface and returns the error message.

func (*GoGError) Message

func (e *GoGError) 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`.

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

func (m *Message) Copy() *Message

Copy will copy this object into a new Message that can be Unrefed separately.

func (*Message) Native

func (m *Message) Native() *C.GstMessage

Native returns the underlying GstMessage object.

func (*Message) ParseError

func (m *Message) ParseError() *GoGError

ParseError will return a GoGError from the contents of this message. This will only work if the GstMessageType is `GST_MESSAGE_ERROR`.

func (*Message) ParseInfo

func (m *Message) ParseInfo() *GoGError

ParseInfo is identical to ParseError. The returned types are the same. However, this is intended for use with GstMessageType `GST_MESSAGE_INFO`.

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) ParseWarning

func (m *Message) ParseWarning() *GoGError

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

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

type MessageType C.GstMessageType

MessageType is an alias to the C equivalent of GstMessageType.

type Object added in v0.0.10

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) Instance added in v0.0.10

func (o *Object) Instance() *C.GstObject

Instance returns the native C GstObject.

func (*Object) Name added in v0.0.10

func (o *Object) Name() string

Name returns the name of this object.

type Pipeline

type Pipeline struct {
	*Bin
	// contains filtered or unexported fields
}

Pipeline is the base implementation of a GstPipeline using CGO to wrap gstreamer API calls. It provides methods to be inherited by the extending PlaybackPipeline and RecordingPipeline objects. The struct itself implements a ReadWriteCloser.

func NewPipeline

func NewPipeline(flags PipelineFlags) (*Pipeline, error)

NewPipeline builds and returns a new empty Pipeline instance.

func NewPipelineFromConfig

func NewPipelineFromConfig(cfg *PipelineConfig, flags PipelineFlags, caps *Caps) (pipeline *Pipeline, err error)

NewPipelineFromConfig builds a new pipeline from the given PipelineConfig. The plugins provided in the configuration will be linked in the order they are given. If using PipelineWrite, you can optionally pass a Caps object to filter between the write-buffer and the start of the pipeline.

func NewPipelineFromLaunchString

func NewPipelineFromLaunchString(launchStr string, flags PipelineFlags) (*Pipeline, error)

NewPipelineFromLaunchString returns a new GstPipeline from the given launch string. If flags contain PipelineRead or PipelineWrite, the launch string is further formatted accordingly.

If using PipelineWrite, you should generally start your pipeline with the caps of the source.

func (*Pipeline) AutoFlush added in v0.0.10

func (p *Pipeline) AutoFlush() bool

AutoFlush returns true if the pipeline is using a GstAppSink and is configured to autoflush to the read-buffer.

func (*Pipeline) BlockFlush added in v0.0.10

func (p *Pipeline) BlockFlush() error

BlockFlush is like Flush but it blocks until a sample is available. This is intended for use with PipelineUseGstApp.

func (*Pipeline) Close

func (p *Pipeline) Close() error

Close implements a Closer and closes all buffers.

func (*Pipeline) Flush added in v0.0.10

func (p *Pipeline) Flush() error

Flush flushes the app sink to the read buffer. It is usually more desirable to interface with the PullSample and BlockPullSample methods on the AppSink interface directly. Or to set autoflush to true.

func (*Pipeline) GetAppSink added in v0.0.10

func (p *Pipeline) GetAppSink() *AppSink

GetAppSink returns the AppSink for this pipeline if created with PipelineUseGstApp. Unref after usage.

func (*Pipeline) GetAppSrc added in v0.0.10

func (p *Pipeline) GetAppSrc() *AppSrc

GetAppSrc returns the AppSrc for this pipeline if created with PipelineUseGstApp. Unref after usage.

func (*Pipeline) GetBus

func (p *Pipeline) GetBus() *Bus

GetBus returns the message bus for this pipeline.

func (*Pipeline) Instance added in v0.0.10

func (p *Pipeline) Instance() *C.GstPipeline

Instance returns the native GstPipeline instance.

func (*Pipeline) IsUsingGstApp added in v0.0.10

func (p *Pipeline) IsUsingGstApp() bool

IsUsingGstApp returns true if the current pipeline is using GstApp instead of file descriptors.

func (*Pipeline) LinkReaderTo

func (p *Pipeline) LinkReaderTo(elem *Element)

LinkReaderTo links the read buffer on this Pipeline to the given element. This must be called when the pipeline is constructed with PipelineRead or PipelineReadWrite.

func (*Pipeline) LinkWriterTo

func (p *Pipeline) LinkWriterTo(elem *Element)

LinkWriterTo links the write buffer on this Pipeline to the given element. This must be called when the pipeline is constructed with PipelineWrite or PipelineReadWrite.

func (*Pipeline) Read

func (p *Pipeline) Read(b []byte) (int, error)

Read implements a Reader and returns data from the read buffer.

func (*Pipeline) ReadBufferSize added in v0.0.10

func (p *Pipeline) ReadBufferSize() int

ReadBufferSize returns the current size of the unread portion of the read-buffer.

func (*Pipeline) SetAutoFlush added in v0.0.10

func (p *Pipeline) SetAutoFlush(b bool)

SetAutoFlush sets whether or not samples should be automatically flushed to the read-buffer (default for pipelines not built with PipelineUseGstApp) and if messages should be flushed on the bus when the pipeline is stopped.

func (*Pipeline) SetWriterCaps added in v0.0.8

func (p *Pipeline) SetWriterCaps(caps *Caps)

SetWriterCaps sets the caps on the write-buffer. You will usually want to call this on a custom pipeline, unless you are using downstream elements that do dynamic pad linking.

func (*Pipeline) Start

func (p *Pipeline) Start() error

Start will start the GstPipeline. It is asynchronous so it does not need to be called within a goroutine, however, it is still safe to do so.

func (*Pipeline) TotalBufferSize added in v0.0.10

func (p *Pipeline) TotalBufferSize() int

TotalBufferSize returns the sum of the Read and Write buffer unread portions.

func (*Pipeline) Write

func (p *Pipeline) Write(b []byte) (int, error)

Write implements a Writer and places data in the write buffer.

func (*Pipeline) WriteBufferSize added in v0.0.10

func (p *Pipeline) WriteBufferSize() int

WriteBufferSize returns the current size of the unread portion of the write-buffer.

type PipelineConfig

type PipelineConfig struct {
	Elements []*PipelineElement
}

PipelineConfig represents a list of elements and their configurations to be used with NewPipelineFromConfig.

func (*PipelineConfig) ElementNames added in v0.0.10

func (p *PipelineConfig) ElementNames() []string

ElementNames returns a string slice of the names of all the plugins.

func (*PipelineConfig) GetElementByName added in v0.0.10

func (p *PipelineConfig) GetElementByName(name string) *PipelineElement

GetElementByName returns the Element configuration for the given name.

type PipelineElement added in v0.0.10

type PipelineElement struct {
	Name     string
	SinkCaps *Caps
	Data     map[string]interface{}
}

PipelineElement represents an `GstElement` in a `GstPipeline` when building a Pipeline with `NewPipelineFromConfig`. The Name should coorespond to a valid gstreamer plugin name. The data are additional fields to set on the element. If SinkCaps is non-nil, they are applied to the sink of this element.

func (*PipelineElement) GetName added in v0.0.10

func (p *PipelineElement) GetName() string

GetName returns the name to use when creating Elements from this configuration.

type PipelineFlags added in v0.0.6

type PipelineFlags int

PipelineFlags represents arguments passed to a new Pipeline.

const (
	// PipelineInternalOnly signals that this pipeline only handles data internally.
	PipelineInternalOnly PipelineFlags = 1 << iota
	// PipelineRead signals that the Read() method can be used on the end of this pipeline.
	PipelineRead
	// PipelineWrite signals that the Write() method can be used on the start of this pipeline.
	PipelineWrite
	// PipelineUseGstApp signals the desire to use an AppSink or AppSrc instead of the default
	// os pipes, fdsrc, and fdsink.
	// When using this flag, you should interact with the pipeline using the GetAppSink and
	// GetAppSrc methods.
	PipelineUseGstApp
	// PipelineReadWrite signals that this pipeline can be both read and written to.
	PipelineReadWrite = PipelineRead | PipelineWrite
)

type Plugin

type Plugin struct{ *Object }

Plugin is a go representation of a GstPlugin.

func (*Plugin) Description added in v0.0.10

func (p *Plugin) Description() string

Description returns the description for this plugin.

func (*Plugin) Filename added in v0.0.10

func (p *Plugin) Filename() string

Filename returns the filename for this plugin.

func (*Plugin) Instance added in v0.0.10

func (p *Plugin) Instance() *C.GstPlugin

Instance returns the underlying GstPlugin instance.

func (*Plugin) License added in v0.0.10

func (p *Plugin) License() string

License returns the license for this plugin.

func (*Plugin) Origin added in v0.0.10

func (p *Plugin) Origin() string

Origin returns the origin URL for this plugin.

func (*Plugin) Package added in v0.0.10

func (p *Plugin) Package() string

Package returns the binary package for this plugin.

func (*Plugin) Source added in v0.0.10

func (p *Plugin) Source() string

Source returns the source module for this plugin.

func (*Plugin) Version added in v0.0.10

func (p *Plugin) Version() string

Version returns the version for this plugin.

type PluginFeature added in v0.0.10

type PluginFeature struct{ *Object }

PluginFeature is a go representation of a GstPluginFeature

func (*PluginFeature) GetPlugin added in v0.0.10

func (p *PluginFeature) GetPlugin() *Plugin

GetPlugin returns the plugin that provides this feature or nil. Unref after usage.

func (*PluginFeature) GetPluginName added in v0.0.10

func (p *PluginFeature) GetPluginName() string

GetPluginName returns the name of the plugin that provides this feature.

func (*PluginFeature) Instance added in v0.0.10

func (p *PluginFeature) Instance() *C.GstPluginFeature

Instance returns the underlying GstPluginFeature instance

type Registry added in v0.0.10

type Registry struct{ *Object }

Registry is a go representation of a GstRegistry.

func GetRegistry added in v0.0.10

func GetRegistry() *Registry

GetRegistry returns the default global GstRegistry.

func (*Registry) FindPlugin added in v0.0.10

func (r *Registry) FindPlugin(name string) (*Plugin, error)

FindPlugin retrieves the plugin by the given name. Unref after usage.

func (*Registry) Instance added in v0.0.10

func (r *Registry) Instance() *C.GstRegistry

Instance returns the underlying GstRegistry instance.

func (*Registry) LookupFeature added in v0.0.10

func (r *Registry) LookupFeature(name string) (*PluginFeature, error)

LookupFeature looks up the given plugin feature by name. Unref after usage.

type Sample added in v0.0.10

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

Sample is a go wrapper around a GstSample object.

func NewSample added in v0.0.10

func NewSample(sample *C.GstSample) *Sample

NewSample creates a new Sample from the given *GstSample.

func (*Sample) GetBuffer added in v0.0.10

func (s *Sample) GetBuffer() io.Reader

GetBuffer returns a Reader for the buffer inside this sample.

func (*Sample) Instance added in v0.0.10

func (s *Sample) Instance() *C.GstSample

Instance returns the underlying *GstSample instance.

func (*Sample) Unref added in v0.0.10

func (s *Sample) Unref()

Unref calls gst_sample_unref on the sample.

type State added in v0.0.10

type State int

State is a type cast of the C GstState

func (State) String added in v0.0.10

func (s State) String() string

Jump to

Keyboard shortcuts

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