Class AppSrc.Builder<B extends AppSrc.Builder<B>>
- Type Parameters:
B- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
AppSrc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theAppSrcobject.onEndOfStream(AppSrc.EndOfStreamCallback handler) Notifyappsrcthat no more buffer are available.onEnoughData(AppSrc.EnoughDataCallback handler) Signal that the source has enough data.onNeedData(AppSrc.NeedDataCallback handler) Signal that the source needs more data.onPushBuffer(AppSrc.PushBufferCallback handler) Adds a buffer to the queue of buffers that the appsrc element will push to its source pad.Adds a buffer list to the queue of buffers and buffer lists that the appsrc element will push to its source pad.onPushSample(AppSrc.PushSampleCallback handler) 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.onSeekData(AppSrc.SeekDataCallback handler) Seek to the given offset.setBlock(boolean block) When max-bytes are queued and after the enough-data signal has been emitted, block any further push-buffer calls until the amount of queued bytes drops below the max-bytes limit.The GstCaps that will negotiated downstream and will be put on outgoing buffers.setDuration(long duration) The total duration in nanoseconds of the data stream.setEmitSignals(boolean emitSignals) Make appsrc emit the "need-data", "enough-data" and "seek-data" signals.The format to use for segment events.setHandleSegmentChange(boolean handleSegmentChange) When enabled, appsrc will check GstSegment in GstSample which was pushed via gst_app_src_push_sample() or "push-sample" signal action.setIsLive(boolean isLive) Instruct the source to behave like a live source.setLeakyType(AppLeakyType leakyType) 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.setMaxBuffers(long maxBuffers) The maximum amount of buffers that can be queued internally.setMaxBytes(long maxBytes) The maximum amount of bytes that can be queued internally.setMaxLatency(long maxLatency) setMaxTime(long maxTime) The maximum amount of time that can be queued internally.setMinLatency(long minLatency) The minimum latency of the source.setMinPercent(int minPercent) Make appsrc emit the "need-data" signal when the amount of bytes in the queue drops below this percentage of max-bytes.setSize(long size) The total size in bytes of the data stream.setStreamType(AppStreamType streamType) The type of stream that this source is producing.Methods inherited from class org.freedesktop.gstreamer.base.BaseSrc.Builder
setAutomaticEos, setBlocksize, setDoTimestamp, setNumBuffers, setTypefindMethods inherited from class org.freedesktop.gstreamer.gst.Element.Builder
onNoMorePads, onPadAdded, onPadRemovedMethods inherited from class org.freedesktop.gstreamer.gst.GstObject.Builder
onDeepNotify, setName, setParentMethods inherited from class org.gnome.gobject.GObject.Builder
onNotifyMethods inherited from class org.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theAppSrcobject. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])to create a new GObject instance, which is then cast toAppSrc.- Overrides:
buildin classBaseSrc.Builder<B extends AppSrc.Builder<B>>- Returns:
- a new instance of
AppSrcwith the properties that were set in the Builder object.
-
setBlock
When max-bytes are queued and after the enough-data signal has been emitted, block any further push-buffer calls until the amount of queued bytes drops below the max-bytes limit.- Parameters:
block- the value for theblockproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setCaps
-
setDuration
The total duration in nanoseconds of the data stream. If the total duration is known, it is recommended to configure it with this property.- Parameters:
duration- the value for thedurationproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 1.10
-
setEmitSignals
Make appsrc emit the "need-data", "enough-data" and "seek-data" signals. This option is by default enabled for backwards compatibility reasons but can disabled when needed because signal emission is expensive.- Parameters:
emitSignals- the value for theemit-signalsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setFormat
-
setHandleSegmentChange
When enabled, appsrc will check GstSegment in GstSample which was pushed via gst_app_src_push_sample() or "push-sample" signal action. If a GstSegment is changed, corresponding segment event will be followed by next data flow.FIXME: currently only GST_FORMAT_TIME format is supported and therefore GstAppSrc::format should be time. However, possibly
GstAppSrccan support other formats.- Parameters:
handleSegmentChange- the value for thehandle-segment-changeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 1.18
-
setIsLive
Instruct the source to behave like a live source. This includes that it will only push out buffers in the PLAYING state.- Parameters:
isLive- the value for theis-liveproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
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.- Parameters:
leakyType- the value for theleaky-typeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 1.20
-
setMaxBuffers
The maximum amount of buffers that can be queued internally. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal.- Parameters:
maxBuffers- the value for themax-buffersproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 1.20
-
setMaxBytes
The maximum amount of bytes that can be queued internally. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal.- Parameters:
maxBytes- the value for themax-bytesproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setMaxLatency
-
setMaxTime
The maximum amount of time that can be queued internally. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal.- Parameters:
maxTime- the value for themax-timeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 1.20
-
setMinLatency
The minimum latency of the source. A value of -1 will use the default latency calculations ofGstBaseSrc.- Parameters:
minLatency- the value for themin-latencyproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setMinPercent
Make appsrc emit the "need-data" signal when the amount of bytes in the queue drops below this percentage of max-bytes.- Parameters:
minPercent- the value for themin-percentproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setSize
The total size in bytes of the data stream. If the total size is known, it is recommended to configure it with this property.- Parameters:
size- the value for thesizeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setStreamType
The type of stream that this source is producing. For seekable streams the application should connect to the seek-data signal.- Parameters:
streamType- the value for thestream-typeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
onEndOfStream
Notifyappsrcthat no more buffer are available.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onEnoughData
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.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onNeedData
Signal that the source needs more data. In the callback or from another thread you should call push-buffer or end-of-stream.lengthis just a hint and when it is set to -1, any number of bytes can be pushed intoappsrc.You can call push-buffer multiple times until the enough-data signal is fired.
- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onPushBuffer
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.
- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onPushBufferList
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.
- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 1.14
- See Also:
-
onPushSample
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.
- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 1.6
- See Also:
-
onSeekData
Seek to the given offset. The next push-buffer should produce buffers from the newoffset.This callback is only called for seekable stream types.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-