Documentation ¶
Index ¶
- Variables
- type AppLeakyType
- type AppSrc
- func (appsrc *AppSrc) Caps() *gst.Caps
- func (appsrc *AppSrc) ConnectEndOfStream(f func() (flowReturn gst.FlowReturn)) coreglib.SignalHandle
- func (appsrc *AppSrc) ConnectEnoughData(f func()) coreglib.SignalHandle
- func (appsrc *AppSrc) ConnectNeedData(f func(length uint)) coreglib.SignalHandle
- func (appsrc *AppSrc) ConnectPushBuffer(f func(buffer *gst.Buffer) (flowReturn gst.FlowReturn)) coreglib.SignalHandle
- func (appsrc *AppSrc) ConnectPushBufferList(f func(bufferList *gst.BufferList) (flowReturn gst.FlowReturn)) coreglib.SignalHandle
- func (appsrc *AppSrc) ConnectPushSample(f func(sample *gst.Sample) (flowReturn gst.FlowReturn)) coreglib.SignalHandle
- func (appsrc *AppSrc) ConnectSeekData(f func(offset uint64) (ok bool)) coreglib.SignalHandle
- func (appsrc *AppSrc) CurrentLevelBuffers() uint64
- func (appsrc *AppSrc) CurrentLevelBytes() uint64
- func (appsrc *AppSrc) CurrentLevelTime() gst.ClockTime
- func (appsrc *AppSrc) Duration() gst.ClockTime
- func (appsrc *AppSrc) EmitSignals() bool
- func (appsrc *AppSrc) EndOfStream() gst.FlowReturn
- func (appsrc *AppSrc) Latency() (min, max uint64)
- func (appsrc *AppSrc) LeakyType() AppLeakyType
- func (appsrc *AppSrc) MaxBuffers() uint64
- func (appsrc *AppSrc) MaxBytes() uint64
- func (appsrc *AppSrc) MaxTime() gst.ClockTime
- func (appsrc *AppSrc) PushBuffer(buffer *gst.Buffer) gst.FlowReturn
- func (appsrc *AppSrc) PushBufferList(bufferList *gst.BufferList) gst.FlowReturn
- func (appsrc *AppSrc) PushSample(sample *gst.Sample) gst.FlowReturn
- func (appsrc *AppSrc) SetCaps(caps *gst.Caps)
- func (appsrc *AppSrc) SetDuration(duration gst.ClockTime)
- func (appsrc *AppSrc) SetEmitSignals(emit bool)
- func (appsrc *AppSrc) SetLatency(min, max uint64)
- func (appsrc *AppSrc) SetLeakyType(leaky AppLeakyType)
- func (appsrc *AppSrc) SetMaxBuffers(max uint64)
- func (appsrc *AppSrc) SetMaxBytes(max uint64)
- func (appsrc *AppSrc) SetMaxTime(max gst.ClockTime)
- func (appsrc *AppSrc) SetSize(size int64)
- func (appsrc *AppSrc) SetStreamType(typ AppStreamType)
- func (appsrc *AppSrc) Size() int64
- func (appsrc *AppSrc) StreamType() AppStreamType
- type AppSrcClass
- type AppSrcOverrides
- type AppStreamType
Constants ¶
This section is empty.
Variables ¶
var ( GTypeAppStreamType = coreglib.Type(C.gst_app_stream_type_get_type()) GTypeAppSrc = coreglib.Type(C.gst_app_src_get_type()) )
GType values.
var (
GTypeAppLeakyType = coreglib.Type(C.gst_app_leaky_type_get_type())
)
GType values.
Functions ¶
This section is empty.
Types ¶
type AppLeakyType ¶
AppLeakyType: buffer dropping scheme to avoid the element's internal queue to block when full.
const ( // AppLeakyTypeNone: not Leaky. AppLeakyTypeNone AppLeakyType = iota // AppLeakyTypeUpstream: leaky on upstream (new buffers). AppLeakyTypeUpstream // AppLeakyTypeDownstream: leaky on downstream (old buffers). AppLeakyTypeDownstream )
func (AppLeakyType) String ¶
func (a AppLeakyType) String() string
String returns the name in string for AppLeakyType.
type AppSrc ¶
type AppSrc struct { gstbase.BaseSrc gst.URIHandler // contains filtered or unexported fields }
AppSrc: appsrc element can be used by applications to insert data into a GStreamer pipeline. Unlike most GStreamer elements, appsrc provides external API functions.
appsrc can be used by linking with the libgstapp library to access the methods directly or by using the appsrc action signals.
Before operating appsrc, the caps property must be set to fixed caps describing the format of the data that will be pushed with appsrc. An exception to this is when pushing buffers with unknown caps, in which case no caps should be set. This is typically true of file-like sources that push raw byte buffers. If you don't want to explicitly set the caps, you can use gst_app_src_push_sample. This method gets the caps associated with the sample and sets them on the appsrc replacing any previously set caps (if different from sample's caps).
The main way of handing data to the appsrc element is by calling the gst_app_src_push_buffer() method or by emitting the push-buffer action signal. This will put the buffer onto a queue from which appsrc will read from in its streaming thread. It is important to note that data transport will not happen from the thread that performed the push-buffer call.
The "max-bytes", "max-buffers" and "max-time" properties control how much data can be queued in appsrc before appsrc considers the queue full. A filled internal queue will always signal the "enough-data" signal, which signals the application that it should stop pushing data into appsrc. The "block" property will cause appsrc to block the push-buffer method until free data becomes available again.
When the internal queue is running out of data, the "need-data" signal is emitted, which signals the application that it should start pushing more data into appsrc.
In addition to the "need-data" and "enough-data" signals, appsrc can emit the "seek-data" signal when the "stream-mode" property is set to "seekable" or "random-access". The signal argument will contain the new desired position in the stream expressed in the unit set with the "format" property. After receiving the seek-data signal, the application should push-buffers from the new position.
These signals allow the application to operate the appsrc in two different ways:
The push mode, in which the application repeatedly calls the push-buffer/push-sample method with a new buffer/sample. Optionally, the queue size in the appsrc can be controlled with the enough-data and need-data signals by respectively stopping/starting the push-buffer/push-sample calls. This is a typical mode of operation for the stream-type "stream" and "seekable". Use this mode when implementing various network protocols or hardware devices.
The pull mode, in which the need-data signal triggers the next push-buffer call. This mode is typically used in the "random-access" stream-type. Use this mode for file access or other randomly accessible sources. In this mode, a buffer of exactly the amount of bytes given by the need-data signal should be pushed into appsrc.
In all modes, the size property on appsrc should contain the total stream size in bytes. Setting this property is mandatory in the random-access mode. For the stream and seekable modes, setting this property is optional but recommended.
When the application has finished pushing data into appsrc, it should call gst_app_src_end_of_stream() or emit the end-of-stream action signal. After this call, no more buffers can be pushed into appsrc until a flushing seek occurs or the state of the appsrc has gone through READY.
func (*AppSrc) Caps ¶
Caps: get the configured caps on appsrc.
The function returns the following values:
- caps produced by the source. gst_caps_unref() after usage.
func (*AppSrc) ConnectEndOfStream ¶
func (appsrc *AppSrc) ConnectEndOfStream(f func() (flowReturn gst.FlowReturn)) coreglib.SignalHandle
ConnectEndOfStream: notify appsrc that no more buffer are available.
func (*AppSrc) ConnectEnoughData ¶
func (appsrc *AppSrc) ConnectEnoughData(f func()) coreglib.SignalHandle
ConnectEnoughData: signal that the source has enough data. It is recommended that the application stops calling push-buffer until the need-data signal is emitted again to avoid excessive buffer queueing.
func (*AppSrc) ConnectNeedData ¶
func (appsrc *AppSrc) ConnectNeedData(f func(length uint)) coreglib.SignalHandle
ConnectNeedData: signal that the source needs more data. In the callback or from another thread you should call push-buffer or end-of-stream.
length is just a hint and when it is set to -1, any number of bytes can be pushed into appsrc.
You can call push-buffer multiple times until the enough-data signal is fired.
func (*AppSrc) ConnectPushBuffer ¶
func (appsrc *AppSrc) ConnectPushBuffer(f func(buffer *gst.Buffer) (flowReturn gst.FlowReturn)) coreglib.SignalHandle
ConnectPushBuffer adds a buffer to the queue of buffers that the appsrc element will push to its source pad.
This function does not take ownership of the buffer, but it takes a reference so the buffer can be unreffed at any time after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
func (*AppSrc) ConnectPushBufferList ¶
func (appsrc *AppSrc) ConnectPushBufferList(f func(bufferList *gst.BufferList) (flowReturn gst.FlowReturn)) coreglib.SignalHandle
ConnectPushBufferList adds a buffer list to the queue of buffers and buffer lists that the appsrc element will push to its source pad.
This function does not take ownership of the buffer list, but it takes a reference so the buffer list can be unreffed at any time after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
func (*AppSrc) ConnectPushSample ¶
func (appsrc *AppSrc) ConnectPushSample(f func(sample *gst.Sample) (flowReturn gst.FlowReturn)) coreglib.SignalHandle
ConnectPushSample: extract a buffer from the provided sample and adds the extracted buffer to the queue of buffers that the appsrc element will push to its source pad. This function set the appsrc caps based on the caps in the sample and reset the caps if they change. Only the caps and the buffer of the provided sample are used and not for example the segment in the sample.
This function does not take ownership of the sample, but it takes a reference so the sample can be unreffed at any time after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
func (*AppSrc) ConnectSeekData ¶
func (appsrc *AppSrc) ConnectSeekData(f func(offset uint64) (ok bool)) coreglib.SignalHandle
ConnectSeekData: seek to the given offset. The next push-buffer should produce buffers from the new offset. This callback is only called for seekable stream types.
func (*AppSrc) CurrentLevelBuffers ¶
CurrentLevelBuffers: get the number of currently queued buffers inside appsrc.
The function returns the following values:
- guint64: number of currently queued buffers.
func (*AppSrc) CurrentLevelBytes ¶
CurrentLevelBytes: get the number of currently queued bytes inside appsrc.
The function returns the following values:
- guint64: number of currently queued bytes.
func (*AppSrc) CurrentLevelTime ¶
CurrentLevelTime: get the amount of currently queued time inside appsrc.
The function returns the following values:
- clockTime: amount of currently queued time.
func (*AppSrc) Duration ¶
Duration: get the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is not known.
The function returns the following values:
- clockTime: duration of the stream previously set with gst_app_src_set_duration();.
func (*AppSrc) EmitSignals ¶
EmitSignals: check if appsrc will emit the "new-preroll" and "new-buffer" signals.
The function returns the following values:
- ok: TRUE if appsrc is emitting the "new-preroll" and "new-buffer" signals.
func (*AppSrc) EndOfStream ¶
func (appsrc *AppSrc) EndOfStream() gst.FlowReturn
EndOfStream indicates to the appsrc element that the last buffer queued in the element is the last buffer of the stream.
The function returns the following values:
- flowReturn when the EOS was successfully queued. T_FLOW_FLUSHING when appsrc is not PAUSED or PLAYING.
func (*AppSrc) Latency ¶
Latency: retrieve the min and max latencies in min and max respectively.
The function returns the following values:
- min latency.
- max latency.
func (*AppSrc) LeakyType ¶
func (appsrc *AppSrc) LeakyType() AppLeakyType
LeakyType returns the currently set AppLeakyType. See gst_app_src_set_leaky_type() for more details.
The function returns the following values:
- appLeakyType: currently set AppLeakyType.
func (*AppSrc) MaxBuffers ¶
MaxBuffers: get the maximum amount of buffers that can be queued in appsrc.
The function returns the following values:
- guint64: maximum amount of buffers that can be queued.
func (*AppSrc) MaxBytes ¶
MaxBytes: get the maximum amount of bytes that can be queued in appsrc.
The function returns the following values:
- guint64: maximum amount of bytes that can be queued.
func (*AppSrc) MaxTime ¶
MaxTime: get the maximum amount of time that can be queued in appsrc.
The function returns the following values:
- clockTime: maximum amount of time that can be queued.
func (*AppSrc) PushBuffer ¶
func (appsrc *AppSrc) PushBuffer(buffer *gst.Buffer) gst.FlowReturn
PushBuffer adds a buffer to the queue of buffers that the appsrc element will push to its source pad. This function takes ownership of the buffer.
When the block property is TRUE, this function can block until free space becomes available in the queue.
The function takes the following parameters:
- buffer to push.
The function returns the following values:
- flowReturn when the buffer was successfully queued. T_FLOW_FLUSHING when appsrc is not PAUSED or PLAYING. T_FLOW_EOS when EOS occurred.
func (*AppSrc) PushBufferList ¶
func (appsrc *AppSrc) PushBufferList(bufferList *gst.BufferList) gst.FlowReturn
PushBufferList adds a buffer list to the queue of buffers and buffer lists that the appsrc element will push to its source pad. This function takes ownership of buffer_list.
When the block property is TRUE, this function can block until free space becomes available in the queue.
The function takes the following parameters:
- bufferList to push.
The function returns the following values:
- flowReturn when the buffer list was successfully queued. T_FLOW_FLUSHING when appsrc is not PAUSED or PLAYING. T_FLOW_EOS when EOS occurred.
func (*AppSrc) PushSample ¶
func (appsrc *AppSrc) PushSample(sample *gst.Sample) gst.FlowReturn
PushSample: extract a buffer from the provided sample and adds it to the queue of buffers that the appsrc element will push to its source pad. Any previous caps that were set on appsrc will be replaced by the caps associated with the sample if not equal.
This function does not take ownership of the sample so the sample needs to be unreffed after calling this function.
When the block property is TRUE, this function can block until free space becomes available in the queue.
The function takes the following parameters:
- sample from which buffer and caps may be extracted.
The function returns the following values:
- flowReturn when the buffer was successfully queued. T_FLOW_FLUSHING when appsrc is not PAUSED or PLAYING. T_FLOW_EOS when EOS occurred.
func (*AppSrc) SetCaps ¶
SetCaps: set the capabilities on the appsrc element. This function takes a copy of the caps structure. After calling this method, the source will only produce caps that match caps. caps must be fixed and the caps on the buffers must match the caps or left NULL.
The function takes the following parameters:
- caps (optional) to set.
func (*AppSrc) SetDuration ¶
SetDuration: set the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is not known.
The function takes the following parameters:
- duration to set.
func (*AppSrc) SetEmitSignals ¶
SetEmitSignals: make appsrc emit the "new-preroll" and "new-buffer" signals. This option is by default disabled because signal emission is expensive and unneeded when the application prefers to operate in pull mode.
The function takes the following parameters:
- emit: new state.
func (*AppSrc) SetLatency ¶
SetLatency: configure the min and max latency in src. If min is set to -1, the default latency calculations for pseudo-live sources will be used.
The function takes the following parameters:
- min latency.
- max latency.
func (*AppSrc) SetLeakyType ¶
func (appsrc *AppSrc) SetLeakyType(leaky AppLeakyType)
SetLeakyType: when set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsrc will drop any buffers that are pushed into it once its internal queue is full. The selected type defines whether to drop the oldest or new buffers.
The function takes the following parameters:
- leaky: AppLeakyType.
func (*AppSrc) SetMaxBuffers ¶
SetMaxBuffers: set the maximum amount of buffers that can be queued in appsrc. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal.
The function takes the following parameters:
- max: maximum number of buffers to queue.
func (*AppSrc) SetMaxBytes ¶
SetMaxBytes: set the maximum amount of bytes that can be queued in appsrc. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal.
The function takes the following parameters:
- max: maximum number of bytes to queue.
func (*AppSrc) SetMaxTime ¶
SetMaxTime: set the maximum amount of time that can be queued in appsrc. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal.
The function takes the following parameters:
- max: maximum amonut of time to queue.
func (*AppSrc) SetSize ¶
SetSize: set the size of the stream in bytes. A value of -1 means that the size is not known.
The function takes the following parameters:
- size to set.
func (*AppSrc) SetStreamType ¶
func (appsrc *AppSrc) SetStreamType(typ AppStreamType)
SetStreamType: set the stream type on appsrc. For seekable streams, the "seek" signal must be connected to.
A stream_type stream.
The function takes the following parameters:
- typ: new state.
func (*AppSrc) Size ¶
Size: get the size of the stream in bytes. A value of -1 means that the size is not known.
The function returns the following values:
- gint64: size of the stream previously set with gst_app_src_set_size();.
func (*AppSrc) StreamType ¶
func (appsrc *AppSrc) StreamType() AppStreamType
StreamType: get the stream type. Control the stream type of appsrc with gst_app_src_set_stream_type().
The function returns the following values:
- appStreamType: stream type.
type AppSrcClass ¶
type AppSrcClass struct {
// contains filtered or unexported fields
}
AppSrcClass: instance of this type is always passed by reference.
func (*AppSrcClass) BasesrcClass ¶
func (a *AppSrcClass) BasesrcClass() *gstbase.BaseSrcClass
type AppSrcOverrides ¶
type AppSrcOverrides struct { // EndOfStream indicates to the appsrc element that the last buffer queued // in the element is the last buffer of the stream. // // The function returns the following values: // // - flowReturn when the EOS was successfully queued. T_FLOW_FLUSHING when // appsrc is not PAUSED or PLAYING. // EndOfStream func() gst.FlowReturn EnoughData func() // The function takes the following parameters: // NeedData func(length uint) // PushBuffer adds a buffer to the queue of buffers that the appsrc element // will push to its source pad. This function takes ownership of the buffer. // // When the block property is TRUE, this function can block until free space // becomes available in the queue. // // The function takes the following parameters: // // - buffer to push. // // The function returns the following values: // // - flowReturn when the buffer was successfully queued. T_FLOW_FLUSHING // when appsrc is not PAUSED or PLAYING. T_FLOW_EOS when EOS occurred. // PushBuffer func(buffer *gst.Buffer) gst.FlowReturn // PushBufferList adds a buffer list to the queue of buffers and buffer // lists that the appsrc element will push to its source pad. This function // takes ownership of buffer_list. // // When the block property is TRUE, this function can block until free space // becomes available in the queue. // // The function takes the following parameters: // // - bufferList to push. // // The function returns the following values: // // - flowReturn when the buffer list was successfully queued. // T_FLOW_FLUSHING when appsrc is not PAUSED or PLAYING. T_FLOW_EOS when // EOS occurred. // PushBufferList func(bufferList *gst.BufferList) gst.FlowReturn // PushSample: extract a buffer from the provided sample and adds it to the // queue of buffers that the appsrc element will push to its source pad. Any // previous caps that were set on appsrc will be replaced by the caps // associated with the sample if not equal. // // This function does not take ownership of the sample so the sample needs // to be unreffed after calling this function. // // When the block property is TRUE, this function can block until free space // becomes available in the queue. // // The function takes the following parameters: // // - sample from which buffer and caps may be extracted. // // The function returns the following values: // // - flowReturn when the buffer was successfully queued. T_FLOW_FLUSHING // when appsrc is not PAUSED or PLAYING. T_FLOW_EOS when EOS occurred. // PushSample func(sample *gst.Sample) gst.FlowReturn // The function takes the following parameters: // // The function returns the following values: // SeekData func(offset uint64) bool }
AppSrcOverrides contains methods that are overridable.
type AppStreamType ¶
AppStreamType: stream type.
const ( // AppStreamTypeStream: no seeking is supported in the stream, such as a // live stream. AppStreamTypeStream AppStreamType = iota // AppStreamTypeSeekable: stream is seekable but seeking might not be very // fast, such as data from a webserver. AppStreamTypeSeekable // AppStreamTypeRandomAccess: stream is seekable and seeking is fast, such // as in a local file. AppStreamTypeRandomAccess )
func (AppStreamType) String ¶
func (a AppStreamType) String() string
String returns the name in string for AppStreamType.