Documentation ¶
Overview ¶
Package base contains bindings for extendable GStreamer base objects.
The objects and methods provided by this package are mostly for use in building plugins using the go-gst bindings.
Index ¶
- Constants
- Variables
- func TypeFindHelper(pad *gst.Pad, size uint64) *gst.Caps
- func TypeFindHelperForBuffer(obj *gst.Object, buffer *gst.Buffer) (*gst.Caps, gst.TypeFindProbability)
- func TypeFindHelperForBufferWithExtension(obj *gst.Object, buffer *gst.Buffer, extension string) (*gst.Caps, gst.TypeFindProbability)
- func TypeFindHelperForData(obj *gst.Object, data []byte) (*gst.Caps, gst.TypeFindProbability)
- func TypeFindHelperForDataWithExtension(obj *gst.Object, data []byte, extension string) (*gst.Caps, gst.TypeFindProbability)
- func TypeFindHelperForExtension(obj *gst.Object, extension string) *gst.Caps
- type CollectData
- type CollectPads
- func (c *CollectPads) AddPad(pad *gst.Pad, lock bool) *CollectData
- func (c *CollectPads) Available() uint
- func (c *CollectPads) ClipRunningTime(data *CollectData, buf *gst.Buffer) (ret gst.FlowReturn, outbuf *gst.Buffer)
- func (c *CollectPads) EventDefault(data *CollectData, event *gst.Event, discard bool) bool
- func (c *CollectPads) Flush(data *CollectData, size uint) uint
- func (c *CollectPads) Free()
- func (c *CollectPads) Instance() *C.GstCollectPads
- func (c *CollectPads) Peek(data *CollectData) *gst.Buffer
- func (c *CollectPads) Pop(data *CollectData) *gst.Buffer
- func (c *CollectPads) QueryDefault(data *CollectData, query *gst.Query, discard bool) bool
- func (c *CollectPads) ReadBuffer(data *CollectData, size uint) *gst.Buffer
- func (c *CollectPads) RemovePad(pad *gst.Pad) bool
- func (c *CollectPads) SetBufferFunction(f CollectPadsBufferFunc)
- func (c *CollectPads) SetClipFunction(f CollectPadsClipFunc)
- func (c *CollectPads) SetCompareFunction(f CollectPadsCompareFunc)
- func (c *CollectPads) SetEventFunction(f CollectPadsEventFunc)
- func (c *CollectPads) SetFlushFunction(f CollectPadsFlushFunc)
- func (c *CollectPads) SetFlushing(flushing bool)
- func (c *CollectPads) SetFunction(f CollectPadsFunc)
- func (c *CollectPads) SetQueryFunction(f CollectPadsQueryFunc)
- func (c *CollectPads) SetWaiting(data *CollectData, waiting bool)
- func (c *CollectPads) SrcEventDefault(pad *gst.Pad, event *gst.Event) bool
- func (c *CollectPads) Start()
- func (c *CollectPads) Stop()
- func (c *CollectPads) TakeBuffer(data *CollectData, size uint) *gst.Buffer
- type CollectPadsBufferFunc
- type CollectPadsClipFunc
- type CollectPadsCompareFunc
- type CollectPadsEventFunc
- type CollectPadsFlushFunc
- type CollectPadsFunc
- type CollectPadsQueryFunc
- type FlowCombiner
- func (f *FlowCombiner) AddPad(pad *gst.Pad)
- func (f *FlowCombiner) Clear()
- func (f *FlowCombiner) Free()
- func (f *FlowCombiner) Instance() *C.GstFlowCombiner
- func (f *FlowCombiner) Ref() *FlowCombiner
- func (f *FlowCombiner) RemovePad(pad *gst.Pad)
- func (f *FlowCombiner) Reset()
- func (f *FlowCombiner) Unref()
- func (f *FlowCombiner) UpdateFlow(fret gst.FlowReturn) gst.FlowReturn
- func (f *FlowCombiner) UpdatePadFlow(pad *gst.Pad, fret gst.FlowReturn) gst.FlowReturn
- type GstBaseSink
- func (g *GstBaseSink) DoPreroll(obj interface{}) gst.FlowReturn
- func (g *GstBaseSink) GetBlocksize() uint
- func (g *GstBaseSink) GetDropOutOfSegment() bool
- func (g *GstBaseSink) GetLastSample() *gst.Sample
- func (g *GstBaseSink) GetLatency() gst.ClockTime
- func (g *GstBaseSink) GetMaxBitrate() uint64
- func (g *GstBaseSink) GetMaxLateness() int64
- func (g *GstBaseSink) GetProcessingDeadline() gst.ClockTime
- func (g *GstBaseSink) GetRenderDelay() gst.ClockTime
- func (g *GstBaseSink) GetSync() bool
- func (g *GstBaseSink) GetThrottleTime() uint64
- func (g *GstBaseSink) GetTsOffset() gst.ClockTime
- func (g *GstBaseSink) Instance() *C.GstBaseSink
- func (g *GstBaseSink) IsAsyncEnabled() bool
- func (g *GstBaseSink) IsLastSampleEnabled() bool
- func (g *GstBaseSink) IsQoSEnabled() bool
- func (g *GstBaseSink) ParentEvent(ev *gst.Event) bool
- func (g *GstBaseSink) QueryLatency() (ok, live, upstreamLive bool, minLatency, maxLatency gst.ClockTime)
- func (g *GstBaseSink) SetAsyncEnabled(enabled bool)
- func (g *GstBaseSink) SetBlocksize(blocksize uint)
- func (g *GstBaseSink) SetDropOutOfSegment(drop bool)
- func (g *GstBaseSink) SetLastSampleEnabled(enabled bool)
- func (g *GstBaseSink) SetMaxBitrate(bitrate uint64)
- func (g *GstBaseSink) SetMaxLateness(maxLateness int64)
- func (g *GstBaseSink) SetProcessingDeadline(deadline gst.ClockTime)
- func (g *GstBaseSink) SetQoSEnabled(enabled bool)
- func (g *GstBaseSink) SetRenderDelay(delay gst.ClockTime)
- func (g *GstBaseSink) SetSync(sync bool)
- func (g *GstBaseSink) SetThrottleTime(throttle uint64)
- func (g *GstBaseSink) SetTsOffset(offset gst.ClockTimeDiff)
- func (g *GstBaseSink) Wait(timeout gst.ClockTime) (ret gst.FlowReturn, jitter gst.ClockTimeDiff)
- func (g *GstBaseSink) WaitClock(timeout gst.ClockTime) (ret gst.ClockReturn, jitter gst.ClockTimeDiff)
- func (g *GstBaseSink) WaitPreroll() gst.FlowReturn
- type GstBaseSinkImpl
- type GstBaseSrc
- func (g *GstBaseSrc) DoTimestamp() bool
- func (g *GstBaseSrc) GetAllocator() (*gst.Allocator, *gst.AllocationParams)
- func (g *GstBaseSrc) GetBlocksize() uint
- func (g *GstBaseSrc) GetBufferPool() *gst.BufferPool
- func (g *GstBaseSrc) Instance() *C.GstBaseSrc
- func (g *GstBaseSrc) IsAsync() bool
- func (g *GstBaseSrc) IsLive() bool
- func (g *GstBaseSrc) QueryLatency() (ok, live bool, minLatency, maxLatency gst.ClockTime)
- func (g *GstBaseSrc) SetAsync(async bool)
- func (g *GstBaseSrc) SetAutomaticEOS(automaticEOS bool)
- func (g *GstBaseSrc) SetBlocksize(size uint)
- func (g *GstBaseSrc) SetCaps(caps *gst.Caps) bool
- func (g *GstBaseSrc) SetDoTimestamp(doTimestamp bool)
- func (g *GstBaseSrc) SetDynamicSize(dynamic bool)
- func (g *GstBaseSrc) SetFormat(format gst.Format)
- func (g *GstBaseSrc) SetLive(live bool)
- func (g *GstBaseSrc) StartComplete(ret gst.FlowReturn)
- func (g *GstBaseSrc) StartWait() gst.FlowReturn
- func (g *GstBaseSrc) SubmitBufferList(bufferList *gst.BufferList)
- func (g *GstBaseSrc) WaitPlaying() gst.FlowReturn
- type GstBaseSrcImpl
- type GstBaseTransform
- func (g *GstBaseTransform) GetAllocator() (*gst.Allocator, *gst.AllocationParams)
- func (g *GstBaseTransform) GetBufferPool() *gst.BufferPool
- func (g *GstBaseTransform) Instance() *C.GstBaseTransform
- func (g *GstBaseTransform) IsInPlace() bool
- func (g *GstBaseTransform) IsPassthrough() bool
- func (g *GstBaseTransform) IsQoSEnabled() bool
- func (g *GstBaseTransform) QueuedBuffer() *gst.Buffer
- func (g *GstBaseTransform) ReconfigureSink()
- func (g *GstBaseTransform) ReconfigureSrc()
- func (g *GstBaseTransform) SetGapAware(gapAware bool)
- func (g *GstBaseTransform) SetInPlace(inPlace bool)
- func (g *GstBaseTransform) SetPassthrough(passthrough bool)
- func (g *GstBaseTransform) SetPassthroughOnSameCaps(passthrough bool)
- func (g *GstBaseTransform) SetPreferPassthrough(preferPassthrough bool)
- func (g *GstBaseTransform) SetQoSEnabled(enabled bool)
- func (g *GstBaseTransform) SetTransformIPOnPassthrough(enabled bool)
- func (g *GstBaseTransform) SinkPad() *gst.Pad
- func (g *GstBaseTransform) SrcPad() *gst.Pad
- func (g *GstBaseTransform) UpdateQoS(proportion float64, diff, timestamp gst.ClockTime)
- func (g *GstBaseTransform) UpdateSrcCaps(caps *gst.Caps)
- type GstBaseTransformImpl
- type GstPushSrc
- type GstPushSrcImpl
Constants ¶
const GstBaseTransformFlowDropped gst.FlowReturn = C.GST_BASE_TRANSFORM_FLOW_DROPPED
GstBaseTransformFlowDropped is a GstFlowReturn that can be returned from Transform() and TransformIP() to indicate that no output buffer was generated.
Variables ¶
var ( // ExtendsBaseSink is an Extendable for extending a GstBaseSink ExtendsBaseSink glib.Extendable = &extendsBaseSink{parent: gst.ExtendsElement} )
var ( // ExtendsBaseSrc is an Extendable for extending a GstBaseSrc ExtendsBaseSrc glib.Extendable = &extendsBaseSrc{parent: gst.ExtendsElement} )
var ( // ExtendsBaseTransform is an Extendable for extending a GstBaseTransform ExtendsBaseTransform glib.Extendable = &extendsBaseTransform{parent: gst.ExtendsElement} )
var ( // ExtendsPushSrc is an Extendable for extending a GstPushSrc ExtendsPushSrc glib.Extendable = &extendsPushSrc{parent: ExtendsBaseSrc} )
var InvalidRunningTime = time.Duration(C.G_MININT64)
InvalidRunningTime is a cast of C_MININT64 to signify a DTS that is invalid.
Functions ¶
func TypeFindHelper ¶
TypeFindHelper tries to find what type of data is flowing from the given source GstPad. Returns nil if no Caps matches the data stream.
func TypeFindHelperForBuffer ¶
func TypeFindHelperForBuffer(obj *gst.Object, buffer *gst.Buffer) (*gst.Caps, gst.TypeFindProbability)
TypeFindHelperForBuffer tries to find what type of data is contained in the given GstBuffer, the assumption being that the buffer represents the beginning of the stream or file.
All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of gst.TypeFindMaximum, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or nil if the content of the buffer could not be identified.
Object can either be nil or the object doing the typefinding (used for logging).
func TypeFindHelperForBufferWithExtension ¶
func TypeFindHelperForBufferWithExtension(obj *gst.Object, buffer *gst.Buffer, extension string) (*gst.Caps, gst.TypeFindProbability)
TypeFindHelperForBufferWithExtension ries to find what type of data is contained in the given GstBuffer, the assumption being that the buffer represents the beginning of the stream or file.
All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of gst.TypeFindMaximum, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or nil if the content of the buffer could not be identified.
When extension is not empty, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.
func TypeFindHelperForData ¶
TypeFindHelperForData tries to find what type of data is contained in the given data, the assumption being that the buffer represents the beginning of the stream or file.
All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of gst.TypeFindMaximum, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or nil if the content of the buffer could not be identified.
Object can either be nil or the object doing the typefinding (used for logging).
func TypeFindHelperForDataWithExtension ¶
func TypeFindHelperForDataWithExtension(obj *gst.Object, data []byte, extension string) (*gst.Caps, gst.TypeFindProbability)
TypeFindHelperForDataWithExtension ries to find what type of data is contained in the given data, the assumption being that the buffer represents the beginning of the stream or file.
All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of gst.TypeFindMaximum, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or nil if the content of the buffer could not be identified.
When extension is not empty, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.
Object can either be nil or the object doing the typefinding (used for logging).
func TypeFindHelperForExtension ¶
TypeFindHelperForExtension tries to find the best GstCaps associated with extension.
All available typefinders will be checked against the extension in order of rank. The caps of the first typefinder that can handle extension will be returned.
Object can either be nil or the object doing the typefinding (used for logging).
Types ¶
type CollectData ¶
type CollectData struct {
// contains filtered or unexported fields
}
CollectData is a structure used by CollectPads.
func (*CollectData) Buffer ¶
func (c *CollectData) Buffer() *gst.Buffer
Buffer returns the currently queued buffer.
func (*CollectData) Collect ¶
func (c *CollectData) Collect() *CollectPads
Collect returns the owner CollectPads
func (*CollectData) DTS ¶
func (c *CollectData) DTS() time.Duration
DTS returns the signed version of the DTS converted to running time.
func (*CollectData) Instance ¶
func (c *CollectData) Instance() *C.GstCollectData
Instance returns the underly C object
func (*CollectData) Pad ¶
func (c *CollectData) Pad() *gst.Pad
Pad returns the pad managed by this data.
func (*CollectData) Segment ¶
func (c *CollectData) Segment() *gst.Segment
Segment returns the last segment received.
type CollectPads ¶
CollectPads manages a set of pads that operate in collect mode. This means that control is given to the manager of this object when all pads have data. For more information see: https://gstreamer.freedesktop.org/documentation/base/gstcollectpads.html?gi-language=c#gstcollectpads-page
func NewCollectPads ¶
func NewCollectPads() *CollectPads
NewCollectPads creates a new CollectPads instance.
func (*CollectPads) AddPad ¶
func (c *CollectPads) AddPad(pad *gst.Pad, lock bool) *CollectData
AddPad adds a pad to the collection of collect pads. The pad has to be a sinkpad. The refcount of the pad is incremented. Use RemovePad to remove the pad from the collection again.
Keeping a pad locked in waiting state is only relevant when using the default collection algorithm (providing the oldest buffer). It ensures a buffer must be available on this pad for a collection to take place. This is of typical use to a muxer element where non-subtitle streams should always be in waiting state, e.g. to assure that caps information is available on all these streams when initial headers have to be written.
The pad will be automatically activated in push mode when pads is started.
This function can return nil if supplied with invalid arguments.
func (*CollectPads) Available ¶
func (c *CollectPads) Available() uint
Available queries how much bytes can be read from each queued buffer. This means that the result of this call is the maximum number of bytes that can be read from each of the pads.
This function should be called with pads STREAM_LOCK held, such as in the callback.
func (*CollectPads) ClipRunningTime ¶
func (c *CollectPads) ClipRunningTime(data *CollectData, buf *gst.Buffer) (ret gst.FlowReturn, outbuf *gst.Buffer)
ClipRunningTime is a convenience clipping function that converts incoming buffer's timestamp to running time, or clips the buffer if outside configured segment.
Since 1.6, this clipping function also sets the DTS parameter of the GstCollectData structure. This version of the running time DTS can be negative. InvalidRunningTime is used to indicate invalid value.
data is the CollectData of the corresponding pad and buf is the buffer being clipped.
func (*CollectPads) EventDefault ¶
func (c *CollectPads) EventDefault(data *CollectData, event *gst.Event, discard bool) bool
EventDefault is the default GstCollectPads event handling that elements should always chain up to to ensure proper operation. Element might however indicate event should not be forwarded downstream.
func (*CollectPads) Flush ¶
func (c *CollectPads) Flush(data *CollectData, size uint) uint
Flush size bytes from the pad data. Returns the number of bytes actually flushed.
This function should be called with pads STREAM_LOCK held, such as in the callback.
func (*CollectPads) Free ¶
func (c *CollectPads) Free()
Free will free the C references to any go callbacks registered with the CollectPads. This is required due to the way the bindings are implemented around this object currently. While it's safe to assume this data will be collected whenever a program exits, in the context of a plugin that might get reused in a single application, NOT calling this function between starts and stops of your element could lead to memory leaks.
func (*CollectPads) Instance ¶
func (c *CollectPads) Instance() *C.GstCollectPads
Instance returns the underlying C object.
func (*CollectPads) Peek ¶
func (c *CollectPads) Peek(data *CollectData) *gst.Buffer
Peek at the buffer currently queued in data. This function should be called with the pads STREAM_LOCK held, such as in the callback handler.
func (*CollectPads) Pop ¶
func (c *CollectPads) Pop(data *CollectData) *gst.Buffer
Pop the buffer currently queued in data. This function should be called with the pads STREAM_LOCK held, such as in the callback handler.
func (*CollectPads) QueryDefault ¶
func (c *CollectPads) QueryDefault(data *CollectData, query *gst.Query, discard bool) bool
QueryDefault is the Default GstCollectPads query handling that elements should always chain up to to ensure proper operation. Element might however indicate query should not be forwarded downstream.
func (*CollectPads) ReadBuffer ¶
func (c *CollectPads) ReadBuffer(data *CollectData, size uint) *gst.Buffer
ReadBuffer gets a subbuffer of size bytes from the given pad data.
This function should be called with pads STREAM_LOCK held, such as in the callback.
func (*CollectPads) RemovePad ¶
func (c *CollectPads) RemovePad(pad *gst.Pad) bool
RemovePad removes a pad from the collection of collect pads. This function will also free the GstCollectData and all the resources that were allocated with AddPad.
The pad will be deactivated automatically when CollectPads is stopped.
func (*CollectPads) SetBufferFunction ¶
func (c *CollectPads) SetBufferFunction(f CollectPadsBufferFunc)
SetBufferFunction sets the callback that will be called with the oldest buffer when all pads have been collected, or nil on EOS.
func (*CollectPads) SetClipFunction ¶
func (c *CollectPads) SetClipFunction(f CollectPadsClipFunc)
SetClipFunction installs a clipping function that is called after buffers are received on managed pads. See CollectPadsClipFunc for more details.
func (*CollectPads) SetCompareFunction ¶
func (c *CollectPads) SetCompareFunction(f CollectPadsCompareFunc)
SetCompareFunction sets the timestamp comparison function.
func (*CollectPads) SetEventFunction ¶
func (c *CollectPads) SetEventFunction(f CollectPadsEventFunc)
SetEventFunction sets the event callback function that will be called when collectpads has received an event originating from one of the collected pads. If the event being processed is a serialized one, this callback is called with pads STREAM_LOCK held, otherwise not. As this lock should be held when calling a number of CollectPads functions, it should be acquired if so (unusually) needed.
func (*CollectPads) SetFlushFunction ¶
func (c *CollectPads) SetFlushFunction(f CollectPadsFlushFunc)
SetFlushFunction installs a flush function that is called when the internal state of all pads should be flushed as part of flushing seek handling. See CollectPadsFlushFunc for more info.
func (*CollectPads) SetFlushing ¶
func (c *CollectPads) SetFlushing(flushing bool)
SetFlushing changes the flushing state of all the pads in the collection. No pad is able to accept anymore data when flushing is TRUE. Calling this function with flushing FALSE makes pads accept data again. Caller must ensure that downstream streaming (thread) is not blocked, e.g. by sending a FLUSH_START downstream.
func (*CollectPads) SetFunction ¶
func (c *CollectPads) SetFunction(f CollectPadsFunc)
SetFunction sets a function that overrides the behavior around the BufferFunction.
CollectPads provides a default collection algorithm that will determine the oldest buffer available on all of its pads, and then delegate to a configured callback. However, if circumstances are more complicated and/or more control is desired, this sets a callback that will be invoked instead when all the pads added to the collection have buffers queued. Evidently, this callback is not compatible with SetBufferFunction callback. If this callback is set, the former will be unset.
func (*CollectPads) SetQueryFunction ¶
func (c *CollectPads) SetQueryFunction(f CollectPadsQueryFunc)
SetQueryFunction sets the query callback function and user data that will be called after collectpads has received a query originating from one of the collected pads. If the query being processed is a serialized one, this callback is called with pads STREAM_LOCK held, otherwise not. As this lock should be held when calling a number of CollectPads functions, it should be acquired if so (unusually) needed.
func (*CollectPads) SetWaiting ¶
func (c *CollectPads) SetWaiting(data *CollectData, waiting bool)
SetWaiting sets a pad to waiting or non-waiting mode, if at least this pad has not been created with locked waiting state, in which case nothing happens.
This function should be called with pads STREAM_LOCK held, such as in the callback.
func (*CollectPads) SrcEventDefault ¶
SrcEventDefault is the CollectPads event handling for the src pad of elements. Elements can chain up to this to let flushing seek event handling be done by CollectPads.
func (*CollectPads) Start ¶
func (c *CollectPads) Start()
Start starts the processing of data in the collectpads.
func (*CollectPads) Stop ¶
func (c *CollectPads) Stop()
Stop stops the processing of data in the collectpads. It also u nblocks any blocking operations.
func (*CollectPads) TakeBuffer ¶
func (c *CollectPads) TakeBuffer(data *CollectData, size uint) *gst.Buffer
TakeBuffer gets a subbuffer of size bytes from the given pad data. Flushes the amount of read bytes.
This function should be called with pads STREAM_LOCK held, such as in the callback.
type CollectPadsBufferFunc ¶
type CollectPadsBufferFunc func(self *CollectPads, data *CollectData, buf *gst.Buffer) gst.FlowReturn
CollectPadsBufferFunc is a function that will be called when a (considered oldest) buffer can be muxed. If all pads have reached EOS, this function is called with a nil data and buffer.
type CollectPadsClipFunc ¶
type CollectPadsClipFunc func(self *CollectPads, data *CollectData, inbuffer *gst.Buffer) (gst.FlowReturn, *gst.Buffer)
CollectPadsClipFunc is a function that will be called when a buffer is received on the pad managed by data in the collectpad object pads.
The function should use the segment of data and the negotiated media type on the pad to perform clipping of the buffer.
The function should return a nil buffer if it should be dropped. The bindings will take care of ownership of the in-buffer.
type CollectPadsCompareFunc ¶
type CollectPadsCompareFunc func(self *CollectPads, data1 *CollectData, ts1 time.Duration, data2 *CollectData, ts2 time.Duration) int // should this be a ClockTime?
CollectPadsCompareFunc is a function for comparing two timestamps of buffers or newsegments collected on one pad. The function should return an integer less than zero when first timestamp is deemed older than the second one. Zero if the timestamps are deemed equally old. Integer greater than zero when second timestamp is deemed older than the first one.
type CollectPadsEventFunc ¶
type CollectPadsEventFunc func(self *CollectPads, data *CollectData, event *gst.Event) bool
CollectPadsEventFunc is a function that will be called while processing an event. It takes ownership of the event and is responsible for chaining up (to EventDefault) or dropping events (such typical cases being handled by the default handler). It should return true if the pad could handle the event.
type CollectPadsFlushFunc ¶
type CollectPadsFlushFunc func(self *CollectPads)
CollectPadsFlushFunc is a function that will be called while processing a flushing seek event.
The function should flush any internal state of the element and the state of all the pads. It should clear only the state not directly managed by the pads object. It is therefore not necessary to call SetFlushing() nor Clear() from this function.
type CollectPadsFunc ¶
type CollectPadsFunc func(self *CollectPads) gst.FlowReturn
CollectPadsFunc is a function that will be called when all pads have received data.
type CollectPadsQueryFunc ¶
type CollectPadsQueryFunc func(self *CollectPads, data *CollectData, query *gst.Query) bool
CollectPadsQueryFunc is a function that will be called while processing a query. It takes ownership of the query and is responsible for chaining up (to events downstream (with EventDefault()).
The function should return true if the pad could handle the event.
type FlowCombiner ¶
type FlowCombiner struct {
// contains filtered or unexported fields
}
FlowCombiner is a helper structure for aggregating flow returns. This struct is not thread safe. For more information see https://gstreamer.freedesktop.org/documentation/base/gstflowcombiner.html?gi-language=c#GstFlowCombiner
func NewFlowCombiner ¶
func NewFlowCombiner() *FlowCombiner
NewFlowCombiner creates a new flow combiner. Use Free() to free it.
func (*FlowCombiner) AddPad ¶
func (f *FlowCombiner) AddPad(pad *gst.Pad)
AddPad adds a new pad to the FlowCombiner. A reference is taken on the pad.
func (*FlowCombiner) Clear ¶
func (f *FlowCombiner) Clear()
Clear will remove all pads and reset the combiner to its initial state.
func (*FlowCombiner) Free ¶
func (f *FlowCombiner) Free()
Free will free a FlowCombiner and all its internal data.
func (*FlowCombiner) Instance ¶
func (f *FlowCombiner) Instance() *C.GstFlowCombiner
Instance returns the underlying GstFlowCombiner instance.
func (*FlowCombiner) Ref ¶
func (f *FlowCombiner) Ref() *FlowCombiner
Ref will increment the reference count on the FlowCombiner.
func (*FlowCombiner) RemovePad ¶
func (f *FlowCombiner) RemovePad(pad *gst.Pad)
RemovePad will remove a pad from the FlowCombiner.
func (*FlowCombiner) Reset ¶
func (f *FlowCombiner) Reset()
Reset flow combiner and all pads to their initial state without removing pads.
func (*FlowCombiner) Unref ¶
func (f *FlowCombiner) Unref()
Unref decrements the reference count on the Flow Combiner.
func (*FlowCombiner) UpdateFlow ¶
func (f *FlowCombiner) UpdateFlow(fret gst.FlowReturn) gst.FlowReturn
UpdateFlow computes the combined flow return for the pads in it.
The GstFlowReturn parameter should be the last flow return update for a pad in this GstFlowCombiner. It will use this value to be able to shortcut some combinations and avoid looking over all pads again. e.g. The last combined return is the same as the latest obtained GstFlowReturn.
func (*FlowCombiner) UpdatePadFlow ¶
func (f *FlowCombiner) UpdatePadFlow(pad *gst.Pad, fret gst.FlowReturn) gst.FlowReturn
UpdatePadFlow sets the provided pad's last flow return to provided value and computes the combined flow return for the pads in it.
The GstFlowReturn parameter should be the last flow return update for a pad in this GstFlowCombiner. It will use this value to be able to shortcut some combinations and avoid looking over all pads again. e.g. The last combined return is the same as the latest obtained GstFlowReturn.
type GstBaseSink ¶
GstBaseSink represents a GstBaseSink.
func ToGstBaseSink ¶
func ToGstBaseSink(obj interface{}) *GstBaseSink
ToGstBaseSink returns a GstBaseSink object for the given object. It will work on either gst.Object or glib.Object interfaces.
func (*GstBaseSink) DoPreroll ¶
func (g *GstBaseSink) DoPreroll(obj interface{}) gst.FlowReturn
DoPreroll is for if the sink spawns its own thread for pulling buffers from upstream. It should call this method after it has pulled a buffer. If the element needed to preroll, this function will perform the preroll and will then block until the element state is changed.
This function should be called with the PREROLL_LOCK held and the object that caused the preroll.
Since the object will always be a gst.MiniObject (which is not implemented properly), this method will check against the provided types for structs known to be used in this context. The currently known options are events, messages, queries, structures, and buffers. If you come across a need to use this function with an unsupported type, feel free to raise an Issue or open a PR.
func (*GstBaseSink) GetBlocksize ¶
func (g *GstBaseSink) GetBlocksize() uint
GetBlocksize gets the number of bytes that the sink will pull when it is operating in pull mode.
func (*GstBaseSink) GetDropOutOfSegment ¶
func (g *GstBaseSink) GetDropOutOfSegment() bool
GetDropOutOfSegment checks if sink is currently configured to drop buffers which are outside the current segment
func (*GstBaseSink) GetLastSample ¶
func (g *GstBaseSink) GetLastSample() *gst.Sample
GetLastSample gets the last sample that arrived in the sink and was used for preroll or for rendering. This property can be used to generate thumbnails.
The GstCaps on the sample can be used to determine the type of the buffer. Sample will be nil if no buffer has arrived yet.
func (*GstBaseSink) GetLatency ¶
func (g *GstBaseSink) GetLatency() gst.ClockTime
GetLatency gets the currently configured latency.
func (*GstBaseSink) GetMaxBitrate ¶
func (g *GstBaseSink) GetMaxBitrate() uint64
GetMaxBitrate gets the maximum amount of bits per second the sink will render.
func (*GstBaseSink) GetMaxLateness ¶
func (g *GstBaseSink) GetMaxLateness() int64
GetMaxLateness gets the max lateness value.
func (*GstBaseSink) GetProcessingDeadline ¶
func (g *GstBaseSink) GetProcessingDeadline() gst.ClockTime
GetProcessingDeadline gets the processing deadline of the sink.
func (*GstBaseSink) GetRenderDelay ¶
func (g *GstBaseSink) GetRenderDelay() gst.ClockTime
GetRenderDelay gets the render delay for the sink.
func (*GstBaseSink) GetSync ¶
func (g *GstBaseSink) GetSync() bool
GetSync checks if the sink is currently configured to synchronize on the clock.
func (*GstBaseSink) GetThrottleTime ¶
func (g *GstBaseSink) GetThrottleTime() uint64
GetThrottleTime gets the time that will be inserted between frames to control maximum buffers per second.
func (*GstBaseSink) GetTsOffset ¶
func (g *GstBaseSink) GetTsOffset() gst.ClockTime
GetTsOffset gets the synchronization offset of sink.
func (*GstBaseSink) Instance ¶
func (g *GstBaseSink) Instance() *C.GstBaseSink
Instance returns the underlying C GstBaseSrc instance
func (*GstBaseSink) IsAsyncEnabled ¶
func (g *GstBaseSink) IsAsyncEnabled() bool
IsAsyncEnabled checks if the sink is currently configured to perform asynchronous state changes to PAUSED.
func (*GstBaseSink) IsLastSampleEnabled ¶
func (g *GstBaseSink) IsLastSampleEnabled() bool
IsLastSampleEnabled checks if the sink is currently configured to store the last received sample.
func (*GstBaseSink) IsQoSEnabled ¶
func (g *GstBaseSink) IsQoSEnabled() bool
IsQoSEnabled checks if sink is currently configured to send QoS events upstream.
func (*GstBaseSink) ParentEvent ¶
func (g *GstBaseSink) ParentEvent(ev *gst.Event) bool
ParentEvent calls the parent class's event handler for the given event.
func (*GstBaseSink) QueryLatency ¶
func (g *GstBaseSink) QueryLatency() (ok, live, upstreamLive bool, minLatency, maxLatency gst.ClockTime)
QueryLatency queries the sink for the latency parameters. The latency will be queried from the upstream elements. live will be TRUE if sink is configured to synchronize against the clock. upstreamLive will be TRUE if an upstream element is live.
If both live and upstreamLive are TRUE, the sink will want to compensate for the latency introduced by the upstream elements by setting the minLatency to a strictly positive value.
This function is mostly used by subclasses.
func (*GstBaseSink) SetAsyncEnabled ¶
func (g *GstBaseSink) SetAsyncEnabled(enabled bool)
SetAsyncEnabled configures sink to perform all state changes asynchronously. When async is disabled, the sink will immediately go to PAUSED instead of waiting for a preroll buffer. This feature is useful if the sink does not synchronize against the clock or when it is dealing with sparse streams.
func (*GstBaseSink) SetBlocksize ¶
func (g *GstBaseSink) SetBlocksize(blocksize uint)
SetBlocksize sets the number of bytes this sink will pull when operating in pull mode.
func (*GstBaseSink) SetDropOutOfSegment ¶
func (g *GstBaseSink) SetDropOutOfSegment(drop bool)
SetDropOutOfSegment configures sink to drop buffers which are outside the current segment.
func (*GstBaseSink) SetLastSampleEnabled ¶
func (g *GstBaseSink) SetLastSampleEnabled(enabled bool)
SetLastSampleEnabled configures the sink to store the last received sample.
func (*GstBaseSink) SetMaxBitrate ¶
func (g *GstBaseSink) SetMaxBitrate(bitrate uint64)
SetMaxBitrate sets the maximum amount of bits per second the sink will render.
func (*GstBaseSink) SetMaxLateness ¶
func (g *GstBaseSink) SetMaxLateness(maxLateness int64)
SetMaxLateness sets the new max lateness value to max_lateness. This value is used to decide if a buffer should be dropped or not based on the buffer timestamp and the current clock time. A value of -1 means an unlimited time.
func (*GstBaseSink) SetProcessingDeadline ¶
func (g *GstBaseSink) SetProcessingDeadline(deadline gst.ClockTime)
SetProcessingDeadline sets the maximum amount of time (in nanoseconds) that the pipeline can take for processing the buffer. This is added to the latency of live pipelines.
This function is usually called by subclasses.
func (*GstBaseSink) SetQoSEnabled ¶
func (g *GstBaseSink) SetQoSEnabled(enabled bool)
SetQoSEnabled configures sink to send Quality-of-Service events upstream.
func (*GstBaseSink) SetRenderDelay ¶
func (g *GstBaseSink) SetRenderDelay(delay gst.ClockTime)
SetRenderDelay sets the render delay in sink to delay. The render delay is the time between actual rendering of a buffer and its synchronization time. Some devices might delay media rendering which can be compensated for with this function.
After calling this function, this sink will report additional latency and other sinks will adjust their latency to delay the rendering of their media.
This function is usually called by subclasses.
func (*GstBaseSink) SetSync ¶
func (g *GstBaseSink) SetSync(sync bool)
SetSync configures sink to synchronize on the clock or not. When sync is FALSE, incoming samples will be played as fast as possible. If sync is TRUE, the timestamps of the incoming buffers will be used to schedule the exact render time of its contents.
func (*GstBaseSink) SetThrottleTime ¶
func (g *GstBaseSink) SetThrottleTime(throttle uint64)
SetThrottleTime sets the time that will be inserted between rendered buffers. This can be used to control the maximum buffers per second that the sink will render.
func (*GstBaseSink) SetTsOffset ¶
func (g *GstBaseSink) SetTsOffset(offset gst.ClockTimeDiff)
SetTsOffset adjusts the synchronization of sink with offset. A negative value will render buffers earlier than their timestamp. A positive value will delay rendering. This function can be used to fix playback of badly timestamped buffers.
func (*GstBaseSink) Wait ¶
func (g *GstBaseSink) Wait(timeout gst.ClockTime) (ret gst.FlowReturn, jitter gst.ClockTimeDiff)
Wait will wait for preroll to complete and will then block until timeout is reached. It is usually called by subclasses that use their own internal synchronization but want to let some synchronization (like EOS) be handled by the base class.
This function should only be called with the PREROLL_LOCK held (like when receiving an EOS event in the ::event vmethod or when handling buffers in ::render).
The timeout argument should be the running_time of when the timeout should happen and will be adjusted with any latency and offset configured in the sink.
func (*GstBaseSink) WaitClock ¶
func (g *GstBaseSink) WaitClock(timeout gst.ClockTime) (ret gst.ClockReturn, jitter gst.ClockTimeDiff)
WaitClock will block until timeout is reached. It is usually called by subclasses that use their own internal synchronization.
If time is not valid, no synchronization is done and GST_CLOCK_BADTIME is returned. Likewise, if synchronization is disabled in the element or there is no clock, no synchronization is done and GST_CLOCK_BADTIME is returned.
This function should only be called with the PREROLL_LOCK held, like when receiving an EOS event in the event() vmethod or when receiving a buffer in the render() vmethod.
The timeout argument should be the running_time of when this method should return and is not adjusted with any latency or offset configured in the sink.
func (*GstBaseSink) WaitPreroll ¶
func (g *GstBaseSink) WaitPreroll() gst.FlowReturn
WaitPreroll will block until the preroll is complete.
If the render() method performs its own synchronization against the clock it must unblock when going from PLAYING to the PAUSED state and call this method before continuing to render the remaining data.
If the render() method can block on something else than the clock, it must also be ready to unblock immediately on the unlock() method and cause the render() method to immediately call this function. In this case, the subclass must be prepared to continue rendering where it left off if this function returns GST_FLOW_OK.
This function will block until a state change to PLAYING happens (in which case this function returns GST_FLOW_OK) or the processing must be stopped due to a state change to READY or a FLUSH event (in which case this function returns GST_FLOW_FLUSHING).
This function should only be called with the PREROLL_LOCK held, like in the render function.
type GstBaseSinkImpl ¶
type GstBaseSinkImpl interface { // Subclasses should override this when they can provide an alternate method of spawning a thread to // drive the pipeline in pull mode. Should start or stop the pulling thread, depending on the value // of the "active" argument. Called after actually activating the sink pad in pull mode. The default // implementation starts a task on the sink pad. ActivatePull(self *GstBaseSink, active bool) bool // Override this to handle events arriving on the sink pad Event(self *GstBaseSink, event *gst.Event) bool // Only useful in pull mode. Implement if you have ideas about what should be the default values for // the caps you support. Fixate(self *GstBaseSink, caps *gst.Caps) *gst.Caps // Called to get sink pad caps from the subclass GetCaps(self *GstBaseSink, filter *gst.Caps) *gst.Caps // Called to get the start and end times for synchronizing the passed buffer to the clock GetTimes(self *GstBaseSink, buffer *gst.Buffer) (start, end time.Duration) // should this be a ClockTime? // Called to prepare the buffer for render and preroll. This function is called before synchronization // is performed. Prepare(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn // Called to prepare the buffer list for render_list. This function is called before synchronization is // performed. PrepareList(self *GstBaseSink, bufferList *gst.BufferList) gst.FlowReturn // Called to present the preroll buffer if desired. Preroll(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn // Used to configure the allocation query ProposeAllocation(self *GstBaseSink, query *gst.Query) bool // Handle queries on the element Query(self *GstBaseSink, query *gst.Query) bool // Called when a buffer should be presented or output, at the correct moment if the GstBaseSink has been // set to sync to the clock. Render(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn // Same as render but used with buffer lists instead of buffers. RenderList(self *GstBaseSink, bufferList *gst.BufferList) gst.FlowReturn // Notify subclass of changed caps SetCaps(self *GstBaseSink, caps *gst.Caps) bool // Start processing. Ideal for opening resources in the subclass Start(self *GstBaseSink) bool // Stop processing. Subclasses should use this to close resources. Stop(self *GstBaseSink) bool // Unlock any pending access to the resource. Subclasses should unblock any blocked function ASAP and call // WaitPreroll Unlock(self *GstBaseSink) bool // Clear the previous unlock request. Subclasses should clear any state they set during Unlock(), and be ready // to continue where they left off after WaitPreroll, Wait or WaitClock return or Render() is called again. UnlockStop(self *GstBaseSink) bool // Override this to implement custom logic to wait for the event time (for events like EOS and GAP). The bindings // take care of first chaining up to the parent class. WaitEvent(self *GstBaseSink, event *gst.Event) gst.FlowReturn }
GstBaseSinkImpl is the documented interface for extending a GstBaseSink. It does not have to be implemented in it's entirety. Each of the methods it declares will be checked for their presence in the initializing object, and if the object declares an override it will replace the default implementation in the virtual methods.
type GstBaseSrc ¶
GstBaseSrc represents a GstBaseSrc.
func ToGstBaseSrc ¶
func ToGstBaseSrc(obj interface{}) *GstBaseSrc
ToGstBaseSrc returns a GstBaseSrc object for the given object. It will work on either gst.Object or glib.Object interfaces.
func (*GstBaseSrc) DoTimestamp ¶
func (g *GstBaseSrc) DoTimestamp() bool
DoTimestamp will query if the timestamps outgoing on this source's buffers are based on the current running time.
func (*GstBaseSrc) GetAllocator ¶
func (g *GstBaseSrc) GetAllocator() (*gst.Allocator, *gst.AllocationParams)
GetAllocator retrieves the memory allocator used by this base src.
func (*GstBaseSrc) GetBlocksize ¶
func (g *GstBaseSrc) GetBlocksize() uint
GetBlocksize returns the number of bytes that the source will push out with each buffer.
func (*GstBaseSrc) GetBufferPool ¶
func (g *GstBaseSrc) GetBufferPool() *gst.BufferPool
GetBufferPool returns the BufferPool used by this source.
func (*GstBaseSrc) Instance ¶
func (g *GstBaseSrc) Instance() *C.GstBaseSrc
Instance returns the underlying C GstBaseSrc instance
func (*GstBaseSrc) IsAsync ¶
func (g *GstBaseSrc) IsAsync() bool
IsAsync retrieves the current async behavior of the source.
func (*GstBaseSrc) IsLive ¶
func (g *GstBaseSrc) IsLive() bool
IsLive checks if this source is in live mode.
func (*GstBaseSrc) QueryLatency ¶
func (g *GstBaseSrc) QueryLatency() (ok, live bool, minLatency, maxLatency gst.ClockTime)
QueryLatency queries the source for the latency parameters. live will be TRUE when src is configured as a live source. minLatency and maxLatency will be set to the difference between the running time and the timestamp of the first buffer.
This function is mostly used by subclasses.
func (*GstBaseSrc) SetAsync ¶
func (g *GstBaseSrc) SetAsync(async bool)
SetAsync configures async behavior in src, no state change will block. The open, close, start, stop, play and pause virtual methods will be executed in a different thread and are thus allowed to perform blocking operations. Any blocking operation should be unblocked with the unlock vmethod.
func (*GstBaseSrc) SetAutomaticEOS ¶
func (g *GstBaseSrc) SetAutomaticEOS(automaticEOS bool)
SetAutomaticEOS sets whether EOS should be automatically emitted.
If automaticEOS is TRUE, src will automatically go EOS if a buffer after the total size is returned. By default this is TRUE but sources that can't return an authoritative size and only know that they're EOS when trying to read more should set this to FALSE.
When src operates in gst.FormatTime, GstBaseSrc will send an EOS when a buffer outside of the currently configured segment is pushed if automaticEOS is TRUE. Since 1.16, if automatic_eos is FALSE an EOS will be pushed only when the Create() implementation returns gst.FlowEOS.
func (*GstBaseSrc) SetBlocksize ¶
func (g *GstBaseSrc) SetBlocksize(size uint)
SetBlocksize sets the number of bytes that src will push out with each buffer. When blocksize is set to -1, a default length will be used.
func (*GstBaseSrc) SetCaps ¶
func (g *GstBaseSrc) SetCaps(caps *gst.Caps) bool
SetCaps sets new caps on the source pad.
func (*GstBaseSrc) SetDoTimestamp ¶
func (g *GstBaseSrc) SetDoTimestamp(doTimestamp bool)
SetDoTimestamp configures src to automatically timestamp outgoing buffers based on the current running_time of the pipeline. This property is mostly useful for live sources.
func (*GstBaseSrc) SetDynamicSize ¶
func (g *GstBaseSrc) SetDynamicSize(dynamic bool)
SetDynamicSize sets if the size is dynamic for this source.
If not dynamic, size is only updated when needed, such as when trying to read past current tracked size. Otherwise, size is checked for upon each read.
func (*GstBaseSrc) SetFormat ¶
func (g *GstBaseSrc) SetFormat(format gst.Format)
SetFormat sets the default format of the source. This will be the format used for sending SEGMENT events and for performing seeks.
If a format of gst.FormatBytes is set, the element will be able to operate in pull mode if the IsSeekable returns TRUE.
This function must only be called in when the element is paused.
func (*GstBaseSrc) SetLive ¶
func (g *GstBaseSrc) SetLive(live bool)
SetLive sets if the element listens to a live source.
A live source will not produce data in the PAUSED state and will therefore not be able to participate in the PREROLL phase of a pipeline. To signal this fact to the application and the pipeline, the state change return value of the live source will be gst.StateChangeNoPreroll.
func (*GstBaseSrc) StartComplete ¶
func (g *GstBaseSrc) StartComplete(ret gst.FlowReturn)
StartComplete completes an asynchronous start operation. When the subclass overrides the start method, it should call StartComplete when the start operation completes either from the same thread or from an asynchronous helper thread.
func (*GstBaseSrc) StartWait ¶
func (g *GstBaseSrc) StartWait() gst.FlowReturn
StartWait waits until the start operation is complete.
func (*GstBaseSrc) SubmitBufferList ¶
func (g *GstBaseSrc) SubmitBufferList(bufferList *gst.BufferList)
SubmitBufferList submits a list of buffers to the source.
Subclasses can call this from their create virtual method implementation to submit a buffer list to be pushed out later. This is useful in cases where the create function wants to produce multiple buffers to be pushed out in one go in form of a GstBufferList, which can reduce overhead drastically, especially for packetised inputs (for data streams where the packetisation/chunking is not important it is usually more efficient to return larger buffers instead).
Subclasses that use this function from their create function must return GST_FLOW_OK and no buffer from their create virtual method implementation. If a buffer is returned after a buffer list has also been submitted via this function the behavior is undefined.
Subclasses must only call this function once per create function call and subclasses must only call this function when the source operates in push mode.
func (*GstBaseSrc) WaitPlaying ¶
func (g *GstBaseSrc) WaitPlaying() gst.FlowReturn
WaitPlaying will block until a state change to PLAYING happens (in which case this function returns gst.FlowOK) or the processing must be stopped due to a state change to READY or a FLUSH event (in which case this function returns GST_FLOW_FLUSHING).
If the Create() method performs its own synchronization against the clock it must unblock when going from PLAYING to the PAUSED state and call this method before continuing to produce the remaining data.
gst.FlowOK will be returned if the source is PLAYING and processing can continue. Any other return value should be returned from the Create() vmethod.
type GstBaseSrcImpl ¶
type GstBaseSrcImpl interface { // GetCaps retrieves the caps for this class. GetCaps(*GstBaseSrc, *gst.Caps) *gst.Caps // Negotiate decides on the caps for this source. Negotiate(*GstBaseSrc) bool // Fixate is called if, during negotiation, caps need fixating. Fixate(*GstBaseSrc, *gst.Caps) *gst.Caps // SetCaps is used to notify this class of new caps. SetCaps(*GstBaseSrc, *gst.Caps) bool // DecideAllocation sets up an allocation query. DecideAllocation(*GstBaseSrc, *gst.Query) bool // Start the source, ideal for opening resources. Start(*GstBaseSrc) bool // Stop the source, ideal for closing resources. Stop(*GstBaseSrc) bool // GetTimes should, given a buffer, return start and stop time when it should be pushed. // The base class will sync on the clock using these times. GetTimes(*GstBaseSrc, *gst.Buffer) (start, end time.Duration) // should this be a ClockTime? // GetSize should get the total size of the resource in bytes. GetSize(*GstBaseSrc) (bool, int64) // IsSeekable should check if the resource is seekable. IsSeekable(*GstBaseSrc) bool // PrepareSeekSegment prepares the segment on which to perform DoSeek, converting to the // current basesrc format. PrepareSeekSegment(*GstBaseSrc, *gst.Event, *gst.Segment) bool // DoSeek is used to notify subclasses of a seek. DoSeek(*GstBaseSrc, *gst.Segment) bool // Unlock should unlock any pending access to the resource. Subclasses should perform the unlock // ASAP. Unlock(*GstBaseSrc) bool // UnlockStop should clear any pending unlock request, as we succeeded in unlocking. UnlockStop(*GstBaseSrc) bool // Query is used to notify subclasses of a query. Query(*GstBaseSrc, *gst.Query) bool // Event is used to notify subclasses of an event. Event(*GstBaseSrc, *gst.Event) bool // Create asks the subclass to create a buffer with offset and size. The default implementation // will call alloc and fill. Create(self *GstBaseSrc, offset uint64, size uint) (gst.FlowReturn, *gst.Buffer) // Alloc asks the subclass to allocate an output buffer. The default implementation will use the negotiated // allocator. Alloc(self *GstBaseSrc, offset uint64, size uint) (gst.FlowReturn, *gst.Buffer) // Fill asks the subclass to fill the buffer with data from offset and size. Fill(self *GstBaseSrc, offset uint64, size uint, buffer *gst.Buffer) gst.FlowReturn }
GstBaseSrcImpl is the documented interface for an element extending a GstBaseSrc. It does not have to be implemented in it's entirety. Each of the methods it declares will be checked for their presence in the initializing object, and if the object declares an override it will replace the default implementation in the virtual methods.
type GstBaseTransform ¶
GstBaseTransform represents a GstBaseTransform.
func ToGstBaseTransform ¶
func ToGstBaseTransform(obj interface{}) *GstBaseTransform
ToGstBaseTransform returns a GstBaseTransform object for the given object. It will work on either gst.Object or glib.Object interfaces.
func (*GstBaseTransform) GetAllocator ¶
func (g *GstBaseTransform) GetAllocator() (*gst.Allocator, *gst.AllocationParams)
GetAllocator retrieves the memory allocator used by this base transform.
func (*GstBaseTransform) GetBufferPool ¶
func (g *GstBaseTransform) GetBufferPool() *gst.BufferPool
GetBufferPool returns the BufferPool used by this transform.
func (*GstBaseTransform) Instance ¶
func (g *GstBaseTransform) Instance() *C.GstBaseTransform
Instance returns the underlying C GstBaseTransform instance
func (*GstBaseTransform) IsInPlace ¶
func (g *GstBaseTransform) IsInPlace() bool
IsInPlace returns if the transform is configured to do in-place transform.
func (*GstBaseTransform) IsPassthrough ¶
func (g *GstBaseTransform) IsPassthrough() bool
IsPassthrough returns if the transform is configured for passthrough.
func (*GstBaseTransform) IsQoSEnabled ¶
func (g *GstBaseTransform) IsQoSEnabled() bool
IsQoSEnabled queries if the transform will handle QoS.
func (*GstBaseTransform) QueuedBuffer ¶
func (g *GstBaseTransform) QueuedBuffer() *gst.Buffer
QueuedBuffer returns the currentl queued buffer.
func (*GstBaseTransform) ReconfigureSink ¶
func (g *GstBaseTransform) ReconfigureSink()
ReconfigureSink instructs transform to request renegotiation upstream. This function is typically called after properties on the transform were set that influence the input format.
func (*GstBaseTransform) ReconfigureSrc ¶
func (g *GstBaseTransform) ReconfigureSrc()
ReconfigureSrc instructs trans to renegotiate a new downstream transform on the next buffer. This function is typically called after properties on the transform were set that influence the output format.
func (*GstBaseTransform) SetGapAware ¶
func (g *GstBaseTransform) SetGapAware(gapAware bool)
SetGapAware configures how buffers are handled. If gapAware is FALSE (the default), output buffers will have the GST_BUFFER_FLAG_GAP flag unset.
If set to TRUE, the element must handle output buffers with this flag set correctly, i.e. it can assume that the buffer contains neutral data but must unset the flag if the output is no neutral data.
func (*GstBaseTransform) SetInPlace ¶
func (g *GstBaseTransform) SetInPlace(inPlace bool)
SetInPlace determines whether a non-writable buffer will be copied before passing to the TransformIP function. This is always true if no Transform() function is implemented, and always false if ONLY a Transform() function is implemented.
func (*GstBaseTransform) SetPassthrough ¶
func (g *GstBaseTransform) SetPassthrough(passthrough bool)
SetPassthrough sets the default passthrough mode for this filter. The is mostly useful for filters that do not care about negotiation. This is always true for filters which don't implement either a Transform(), TransformIP(), or GenerateOutput() method.
func (*GstBaseTransform) SetPassthroughOnSameCaps ¶
func (g *GstBaseTransform) SetPassthroughOnSameCaps(passthrough bool)
SetPassthroughOnSameCaps when set to true will automatically enable passthrough if caps are the same.
func (*GstBaseTransform) SetPreferPassthrough ¶
func (g *GstBaseTransform) SetPreferPassthrough(preferPassthrough bool)
SetPreferPassthrough sets whether passthrough is preferred. If preferPassthrough is TRUE (the default), trans will check and prefer passthrough caps from the list of caps returned by the TransformCaps() vmethod.
If set to FALSE, the element must order the caps returned from the TransformCaps() function in such a way that the preferred format is first in the list. This can be interesting for transforms that can do passthrough transforms but prefer to do something else, like a capsfilter.
func (*GstBaseTransform) SetQoSEnabled ¶
func (g *GstBaseTransform) SetQoSEnabled(enabled bool)
SetQoSEnabled enables or disables QoS handling in the filter.
func (*GstBaseTransform) SetTransformIPOnPassthrough ¶
func (g *GstBaseTransform) SetTransformIPOnPassthrough(enabled bool)
SetTransformIPOnPassthrough If set to TRUE, TransformIP() will be called in passthrough mode. The passed buffer might not be writable. When FALSE, neither Transform() nor TransformIP() will be called in passthrough mode. Set to TRUE by default.
func (*GstBaseTransform) SinkPad ¶
func (g *GstBaseTransform) SinkPad() *gst.Pad
SinkPad returns the sink pad object for this element.
func (*GstBaseTransform) SrcPad ¶
func (g *GstBaseTransform) SrcPad() *gst.Pad
SrcPad returns the src pad object for this element.
func (*GstBaseTransform) UpdateQoS ¶
func (g *GstBaseTransform) UpdateQoS(proportion float64, diff, timestamp gst.ClockTime)
UpdateQoS sets the QoS parameters in the transform. This function is called internally when a QOS event is received but subclasses can provide custom information when needed.
proportion is the proportion, diff is the diff against the clock, and timestamp is the timestamp of the buffer generating the QoS expressed in running_time.
func (*GstBaseTransform) UpdateSrcCaps ¶
func (g *GstBaseTransform) UpdateSrcCaps(caps *gst.Caps)
UpdateSrcCaps updates the srcpad caps and sends the caps downstream. This function can be used by subclasses when they have already negotiated their caps but found a change in them (or computed new information). This way, they can notify downstream about that change without losing any buffer.
type GstBaseTransformImpl ¶
type GstBaseTransformImpl interface { // Optional. Subclasses can override this method to check if caps can be handled by the element. // The default implementation might not be the most optimal way to check this in all cases. AcceptCaps(self *GstBaseTransform, direction gst.PadDirection, caps *gst.Caps) bool // Optional. This method is called right before the base class will start processing. Dynamic // properties or other delayed configuration could be performed in this method. BeforeTransform(self *GstBaseTransform, buffer *gst.Buffer) // Optional. Copy the metadata from the input buffer to the output buffer. The default implementation // will copy the flags, timestamps and offsets of the buffer. CopyMetadata(self *GstBaseTransform, input, output *gst.Buffer) bool // Setup the allocation parameters for allocating output buffers. The passed in query contains the // result of the downstream allocation query. This function is only called when not operating in // passthrough mode. The default implementation will remove all memory dependent metadata. If there is // a FilterMeta method implementation, it will be called for all metadata API in the downstream query, // otherwise the metadata API is removed. DecideAllocation(self *GstBaseTransform, query *gst.Query) bool // Return TRUE if the metadata API should be proposed in the upstream allocation query. The default // implementation is NULL and will cause all metadata to be removed. FilterMeta(self *GstBaseTransform, query *gst.Query, api glib.Type, params *gst.Structure) bool // Optional. Given the pad in this direction and the given caps, fixate the caps on the other pad. // The function returns a fixated version of othercaps. othercaps itself is not guaranteed to be writable // and the bindings will Unref them after the callback is complete. So if you want to return othercaps // with small modifications, take a copy first with Caps.Copy(), otherwise return a Ref(). FixateCaps(self *GstBaseTransform, directon gst.PadDirection, caps *gst.Caps, othercaps *gst.Caps) *gst.Caps // Called after each new input buffer is submitted repeatedly until it either generates an error or fails to // generate an output buffer. The default implementation takes the contents of the queued_buf variable, // generates an output buffer if needed by calling the class PrepareOutputBuffer, and then calls either // Transform() or TransformIP(). Elements that don't do 1-to-1 transformations of input to output buffers can // either return GstBaseTransformFlowDropped or simply not generate an output buffer until they are ready to do // so. (Since: 1.6) GenerateOutput(self *GstBaseTransform) (gst.FlowReturn, *gst.Buffer) // Required if the transform is not in-place. Get the size in bytes of one unit for the given caps. GetUnitSize(self *GstBaseTransform, caps *gst.Caps) (ok bool, size int64) // Optional. Subclasses can override this to do their own allocation of output buffers. Elements that only // do analysis can return a subbuffer or even just return a reference to the input buffer (if in passthrough // mode). The default implementation will use the negotiated allocator or bufferpool and TransformSize to // allocate an output buffer or it will return the input buffer in passthrough mode. PrepareOutputBuffer(self *GstBaseTransform, input *gst.Buffer) (gst.FlowReturn, *gst.Buffer) // Propose buffer allocation parameters for upstream elements. This function must be implemented if the element // reads or writes the buffer content. The query that was passed to the DecideAllocation is passed in this // method (or nil when the element is in passthrough mode). The default implementation will pass the query // downstream when in passthrough mode and will copy all the filtered metadata API in non-passthrough mode. ProposeAllocation(self *GstBaseTransform, decideQuery, query *gst.Query) bool // Optional. Handle a requested query. Subclasses that implement this must chain up to the parent if they // didn't handle the query Query(self *GstBaseTransform, direction gst.PadDirection, query *gst.Query) bool // Allows the subclass to be notified of the actual caps set. SetCaps(self *GstBaseTransform, incaps, outcaps *gst.Caps) bool // Optional. Event handler on the sink pad. The default implementation handles the event and forwards it // downstream. SinkEvent(self *GstBaseTransform, event *gst.Event) bool // Optional. Event handler on the source pad. The default implementation handles the event and forwards it // upstream. SrcEvent(self *GstBaseTransform, event *gst.Event) bool // Optional. Called when the element starts processing. Allows opening external resources. Start(self *GstBaseTransform) bool // Optional. Called when the element stops processing. Allows closing external resources. Stop(self *GstBaseTransform) bool // Function which accepts a new input buffer and pre-processes it. The default implementation performs caps // (re)negotiation, then QoS if needed, and places the input buffer into the queued_buf member variable. If // the buffer is dropped due to QoS, it returns GstBaseTransformFlowDropped. If this input buffer is not // contiguous with any previous input buffer, then isDiscont is set to TRUE. (Since: 1.6) SubmitInputBuffer(self *GstBaseTransform, isDiscont bool, input *gst.Buffer) gst.FlowReturn // Required if the element does not operate in-place. Transforms one incoming buffer to one outgoing buffer. // The function is allowed to change size/timestamp/duration of the outgoing buffer. Transform(self *GstBaseTransform, inbuf, outbuf *gst.Buffer) gst.FlowReturn // Optional. Given the pad in this direction and the given caps, what caps are allowed on the other pad in // this element ? TransformCaps(self *GstBaseTransform, direction gst.PadDirection, caps, filter *gst.Caps) *gst.Caps // Required if the element operates in-place. Transform the incoming buffer in-place. TransformIP(self *GstBaseTransform, buf *gst.Buffer) gst.FlowReturn // Optional. Transform the metadata on the input buffer to the output buffer. By default this method copies // all meta without tags. Subclasses can implement this method and return TRUE if the metadata is to be copied. TransformMeta(self *GstBaseTransform, outbuf *gst.Buffer, meta *gst.Meta, inbuf *gst.Buffer) bool // Optional. Given the size of a buffer in the given direction with the given caps, calculate the size in // bytes of a buffer on the other pad with the given other caps. The default implementation uses GetUnitSize // and keeps the number of units the same. TransformSize(self *GstBaseTransform, direction gst.PadDirection, caps *gst.Caps, size int64, othercaps *gst.Caps) (ok bool, othersize int64) }
GstBaseTransformImpl is the interface for an element extending a GstBaseTransform. Subclasses can override any of the available virtual methods or not, as needed. At minimum either Transform or TransformIP need to be overridden. If the element can overwrite the input data with the results (data is of the same type and quantity) it should provide TransformIP.
For more information: https://gstreamer.freedesktop.org/documentation/base/gstbasetransform.html?gi-language=c
type GstPushSrc ¶
type GstPushSrc struct{ *GstBaseSrc }
GstPushSrc represents a GstBaseSrc.
func ToGstPushSrc ¶
func ToGstPushSrc(obj interface{}) *GstPushSrc
ToGstPushSrc returns a GstPushSrc object for the given object.
func (*GstPushSrc) Instance ¶
func (g *GstPushSrc) Instance() *C.GstPushSrc
Instance returns the underlying C GstBaseSrc instance
type GstPushSrcImpl ¶
type GstPushSrcImpl interface { // Asks the subclass to allocate a buffer. The subclass decides which size this buffer should be. // The default implementation will create a new buffer from the negotiated allocator. Alloc(*GstPushSrc) (gst.FlowReturn, *gst.Buffer) // Asks the subclass to create a buffer. The subclass decides which size this buffer should be. Other // then that, refer to GstBaseSrc.create for more details. If this method is not implemented, alloc // followed by fill will be called. Create(*GstPushSrc) (gst.FlowReturn, *gst.Buffer) // Asks the subclass to fill the buffer with data. Fill(*GstPushSrc, *gst.Buffer) gst.FlowReturn }
GstPushSrcImpl is the documented interface for an element extending a GstPushSrc. It does not have to be implemented in it's entirety. Each of the methods it declares will be checked for their presence in the initializing object, and if the object declares an override it will replace the default implementation in the virtual methods.
Source Files ¶
- doc.go
- gst_base_sink.go
- gst_base_sink_exports.go
- gst_base_sink_impl.go
- gst_base_src.go
- gst_base_src_exports.go
- gst_base_src_impl.go
- gst_base_transform.go
- gst_base_transform_exports.go
- gst_base_transform_impl.go
- gst_collect_pads.go
- gst_collect_pads_exports.go
- gst_flow_combiner.go
- gst_push_src.go
- gst_push_src_exports.go
- gst_push_src_impl.go
- gst_type_find.go
- pkg_config.go
- util.go