Documentation
¶
Overview ¶
Package gstauto contains helper methods and objects for building pipelines that satisfy most use cases. It provides an abstraction over the lower-level building blocks provided in the gst package.
Index ¶
- func NewPipelineFromConfig(cfg *PipelineConfig) (*gst.Pipeline, error)
- type PipelineConfig
- type PipelineElement
- type PipelineReadWriter
- type PipelineReadWriterSimple
- type PipelineReader
- type PipelineReaderSimple
- type PipelineWriter
- type PipelineWriterSimple
- type Pipeliner
- type PipelinerSimple
- type ReadPipeliner
- type ReadWritePipeliner
- type WritePipeliner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPipelineFromConfig ¶
func NewPipelineFromConfig(cfg *PipelineConfig) (*gst.Pipeline, 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.
Types ¶
type PipelineConfig ¶
type PipelineConfig struct {
Elements []*PipelineElement
}
PipelineConfig represents a list of elements and their configurations to be used with NewPipelineFromConfig.
func (*PipelineConfig) Apply ¶
func (p *PipelineConfig) Apply(pipeline *gst.Pipeline) error
Apply applies this configuration to the given Pipeline.
func (*PipelineConfig) ElementNames ¶
func (p *PipelineConfig) ElementNames() []string
ElementNames returns a string slice of the names of all the plugins.
func (*PipelineConfig) GetElementByName ¶
func (p *PipelineConfig) GetElementByName(name string) *PipelineElement
GetElementByName returns the Element configuration for the given name.
func (*PipelineConfig) PushPluginToTop ¶ added in v0.0.3
func (p *PipelineConfig) PushPluginToTop(elem *PipelineElement)
PushPluginToTop pushes a plugin to the top of the list of elements.
type PipelineElement ¶
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 ¶
func (p *PipelineElement) GetName() string
GetName returns the name to use when creating Elements from this configuration.
type PipelineReadWriter ¶
type PipelineReadWriter struct {
// contains filtered or unexported fields
}
PipelineReadWriter is the base struct to be used to implement ReadWritePipeliners.
func NewPipelineReadWriter ¶
func NewPipelineReadWriter(name string) (*PipelineReadWriter, error)
NewPipelineReadWriter returns a new PipelineReadWriter with an empty pipeline. Use an empty name to have gstreamer auto-generate one. This method is intended for use in the construction of other interfaces.
func NewPipelineReadWriterFromString ¶
func NewPipelineReadWriterFromString(launchStr string) (*PipelineReadWriter, error)
NewPipelineReadWriterFromString returns a new PipelineReadWriter with a pipeline populated by the provided gstreamer launch string. If you are looking to build a simple ReadWritePipeliner you probably want to use NewPipelineReadWriterSimpleFromString.
func (*PipelineReadWriter) Close ¶
func (rw *PipelineReadWriter) Close() error
Close will stop and unref the underlying pipeline and read/write buffers.
func (*PipelineReadWriter) CloseAsync ¶
func (rw *PipelineReadWriter) CloseAsync() error
CloseAsync will close the underlying pipeline asynchronously. It is the caller's responsibility to call Unref on the pipeline and close buffers once it is no longer being used. This can be accomplished via calling a regular Close (which is idempotent).
func (*PipelineReadWriter) Pipeline ¶
func (rw *PipelineReadWriter) Pipeline() *gst.Pipeline
Pipeline returns the underlying Pipeline instance for this pipeliner. It implements the Pipeliner interface.
func (*PipelineReadWriter) ReaderFd ¶
func (rw *PipelineReadWriter) ReaderFd() int
ReaderFd returns the file descriptor that can be written to for the read-buffer. This value is used when wanting to allow an underlying pipeline to write to the internal buffer (e.g. when using a fdsink).
func (*PipelineReadWriter) Start ¶ added in v0.0.7
func (rw *PipelineReadWriter) Start() error
Start sets the underlying Pipeline state to PLAYING.
func (*PipelineReadWriter) WriterFd ¶
func (rw *PipelineReadWriter) WriterFd() int
WriterFd returns the file descriptor that can be used to read from the write-buffer. This value is used when wanting to allow an underlying pipeline the ability to read data written to the buffer (e.g. when using a fdsrc).
type PipelineReadWriterSimple ¶
type PipelineReadWriterSimple struct {
*PipelineReadWriter
}
PipelineReadWriterSimple implements a ReadWritePipeliner that configures gstreamer to read from the internal write-buffer via an fdsrc and write to the internal read-buffer via an fdsink.
func NewPipelineReadWriterSimpleFromConfig ¶
func NewPipelineReadWriterSimpleFromConfig(cfg *PipelineConfig) (*PipelineReadWriterSimple, error)
NewPipelineReadWriterSimpleFromConfig returns a new PipelineReadWriterSimple populated from the given launch config. An fdsrc is added to the start of the launch config and tied to the write buffer, and an fdsink is added to the end tied to the read-buffer.
func NewPipelineReadWriterSimpleFromString ¶
func NewPipelineReadWriterSimpleFromString(launchStr string) (*PipelineReadWriterSimple, error)
NewPipelineReadWriterSimpleFromString returns a new PipelineReadWriterSimple from the given launch string. An fdsrc listening on the write buffer and an fdsink to the read buffer are formatted into the provided string.
type PipelineReader ¶
type PipelineReader struct {
// contains filtered or unexported fields
}
PipelineReader is the base struct to be used to implement ReadPipeliners.
func NewPipelineReader ¶
func NewPipelineReader(name string) (*PipelineReader, error)
NewPipelineReader returns a new PipelineReader with an empty pipeline. Use an empty name to have gstreamer auto-generate one. This method is intended for use in the construction of other interfaces.
func NewPipelineReaderFromString ¶
func NewPipelineReaderFromString(launchStr string) (*PipelineReader, error)
NewPipelineReaderFromString returns a new PipelineReader with a pipeline populated by the provided gstreamer launch string. If you are looking to build a simple ReadPipeliner you probably want to use NewPipelineReaderSimpleFromString.
func (*PipelineReader) Close ¶
func (r *PipelineReader) Close() error
Close will stop and unref the underlying pipeline.
func (*PipelineReader) CloseAsync ¶
func (r *PipelineReader) CloseAsync() error
CloseAsync will close the underlying pipeline asynchronously. It is the caller's responsibility to call Unref on the pipeline and close buffers once it is no longer being used. This can be accomplished via calling a regular Close (which is idempotent).
func (*PipelineReader) Pipeline ¶
func (r *PipelineReader) Pipeline() *gst.Pipeline
Pipeline returns the underlying Pipeline instance for this pipeliner. It implements the Pipeliner interface.
func (*PipelineReader) ReaderFd ¶
func (r *PipelineReader) ReaderFd() int
ReaderFd returns the file descriptor that can be written to for the read-buffer. This value is used when wanting to allow an underlying pipeline to write to the internal buffer (e.g. when using a fdsink).
func (*PipelineReader) Start ¶ added in v0.0.7
func (r *PipelineReader) Start() error
Start sets the underlying Pipeline state to PLAYING.
type PipelineReaderSimple ¶
type PipelineReaderSimple struct {
*PipelineReader
}
PipelineReaderSimple implements a ReadPipeliner that configures gstreamer to write directly to the internal read-buffer via an fdsink.
func NewPipelineReaderSimpleFromConfig ¶
func NewPipelineReaderSimpleFromConfig(cfg *PipelineConfig) (*PipelineReaderSimple, error)
NewPipelineReaderSimpleFromConfig returns a new PipelineReaderSimple populated from the given launch config. An fdsink is added to the end of the launch config and tied to the read buffer.
func NewPipelineReaderSimpleFromString ¶
func NewPipelineReaderSimpleFromString(launchStr string) (*PipelineReaderSimple, error)
NewPipelineReaderSimpleFromString returns a new PipelineReaderSimple populated from the given launch string. An fdsink is added to the end of the launch string and tied to the read buffer.
type PipelineWriter ¶
type PipelineWriter struct {
// contains filtered or unexported fields
}
PipelineWriter is the base struct to be used to implement WritePipeliners.
func NewPipelineWriter ¶
func NewPipelineWriter(name string) (*PipelineWriter, error)
NewPipelineWriter returns a new PipelineWriter with an empty pipeline. Use an empty name to have gstreamer auto-generate one. This method is intended for use in the construction of other interfaces.
func NewPipelineWriterFromString ¶
func NewPipelineWriterFromString(launchStr string) (*PipelineWriter, error)
NewPipelineWriterFromString returns a new PipelineWriter with a pipeline populated by the provided gstreamer launch string. If you are looking to build a simple WritePipeliner you probably want to use NewPipelineWriterSimpleFromString.
func (*PipelineWriter) Close ¶
func (w *PipelineWriter) Close() error
Close will stop and unref the underlying pipeline.
func (*PipelineWriter) CloseAsync ¶
func (w *PipelineWriter) CloseAsync() error
CloseAsync will close the underlying pipeline asynchronously. It is the caller's responsibility to call Unref on the pipeline and close buffers once it is no longer being used. This can be accomplished via calling a regular Close (which is idempotent).
func (*PipelineWriter) Pipeline ¶
func (w *PipelineWriter) Pipeline() *gst.Pipeline
Pipeline returns the underlying Pipeline instance for this pipeliner. It implements the Pipeliner interface.
func (*PipelineWriter) Start ¶ added in v0.0.7
func (w *PipelineWriter) Start() error
Start sets the underlying Pipeline state to PLAYING.
func (*PipelineWriter) WriterFd ¶
func (w *PipelineWriter) WriterFd() int
WriterFd returns the file descriptor that can be used to read from the write-buffer. This value is used when wanting to allow an underlying pipeline the ability to read data written to the buffer (e.g. when using a fdsrc).
type PipelineWriterSimple ¶
type PipelineWriterSimple struct {
*PipelineWriter
}
PipelineWriterSimple implements a WritePipeliner that configures gstreamer to read directly from the internal write-buffer via a fdsrc.
func NewPipelineWriterSimpleFromConfig ¶
func NewPipelineWriterSimpleFromConfig(cfg *PipelineConfig) (*PipelineWriterSimple, error)
NewPipelineWriterSimpleFromConfig returns a new PipelineWriterSimple populated from the given launch config. An fdsrc is added to the start of the launch config and tied to the write buffer.
func NewPipelineWriterSimpleFromString ¶
func NewPipelineWriterSimpleFromString(launchStr string) (*PipelineWriterSimple, error)
NewPipelineWriterSimpleFromString returns a new PipelineWriterSimple populated from the given launch string. An fdsrc is added to the beginning of the string and tied to the write buffer.
type Pipeliner ¶
type Pipeliner interface { io.Closer // Pipeline should return the underlying pipeline Pipeline() *gst.Pipeline // Start should start the underlying pipeline. Start() error }
Pipeliner is a the base interface for structs extending the functionality of the Pipeline object. It provides a single method which returns the underlying Pipeline object.
type PipelinerSimple ¶
type PipelinerSimple struct {
// contains filtered or unexported fields
}
PipelinerSimple is a simple struct that implements the Pipeliner interface. It doesn't provide any additional read/write capabilities. Its primary intention is for pipelines where the caller does not wish to personally read or write from either end of the buffer.
func NewPipelinerSimple ¶
func NewPipelinerSimple(name string) (*PipelinerSimple, error)
NewPipelinerSimple returns a new empty PipelinerSimple. Pass an empty string for name to use an auto-generated one.
func NewPipelinerSimpleFromConfig ¶
func NewPipelinerSimpleFromConfig(cfg *PipelineConfig) (*PipelinerSimple, error)
NewPipelinerSimpleFromConfig returns a new PipelinerSimple from the given PipelineConfig.
func NewPipelinerSimpleFromString ¶
func NewPipelinerSimpleFromString(launchStr string) (*PipelinerSimple, error)
NewPipelinerSimpleFromString returns a new PipelinerSimpler from the given launch string.
func (*PipelinerSimple) Close ¶ added in v0.0.7
func (s *PipelinerSimple) Close() error
Close stops and unrefs the underlying pipeline.
func (*PipelinerSimple) Pipeline ¶
func (s *PipelinerSimple) Pipeline() *gst.Pipeline
Pipeline implements the Pipeliner interface.
func (*PipelinerSimple) Start ¶ added in v0.0.7
func (s *PipelinerSimple) Start() error
Start sets the underlying Pipeline state to PLAYING.
type ReadPipeliner ¶
ReadPipeliner is a Pipeliner that also implements a ReadCloser.
type ReadWritePipeliner ¶
type ReadWritePipeliner interface { Pipeliner io.ReadWriter }
ReadWritePipeliner is a Pipeliner that also implements a ReadWriteCloser.
type WritePipeliner ¶
WritePipeliner is a Pipeliner that also implements a WriteCloser.