Trait gstreamer_base::prelude::BaseSrcExt
source · pub trait BaseSrcExt:
IsA<BaseSrc>
+ Sealed
+ 'static {
Show 30 methods
// Provided methods
fn blocksize(&self) -> u32 { ... }
fn buffer_pool(&self) -> Option<BufferPool> { ... }
fn does_timestamp(&self) -> bool { ... }
fn is_async(&self) -> bool { ... }
fn is_live(&self) -> bool { ... }
fn negotiate(&self) -> bool { ... }
fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool { ... }
fn new_segment(&self, segment: &Segment) -> Result<(), BoolError> { ... }
fn push_segment(&self, segment: &Segment) -> bool { ... }
fn set_async(&self, async_: bool) { ... }
fn set_automatic_eos(&self, automatic_eos: bool) { ... }
fn set_blocksize(&self, blocksize: u32) { ... }
fn set_caps(&self, caps: &Caps) -> Result<(), BoolError> { ... }
fn set_do_timestamp(&self, timestamp: bool) { ... }
fn set_dynamic_size(&self, dynamic: bool) { ... }
fn set_format(&self, format: Format) { ... }
fn set_live(&self, live: bool) { ... }
fn start_complete(&self, ret: impl Into<FlowReturn>) { ... }
fn start_wait(&self) -> Result<FlowSuccess, FlowError> { ... }
fn wait_playing(&self) -> Result<FlowSuccess, FlowError> { ... }
fn is_automatic_eos(&self) -> bool { ... }
fn num_buffers(&self) -> i32 { ... }
fn set_num_buffers(&self, num_buffers: i32) { ... }
fn is_typefind(&self) -> bool { ... }
fn set_typefind(&self, typefind: bool) { ... }
fn connect_automatic_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Provided Methods§
sourcefn blocksize(&self) -> u32
fn blocksize(&self) -> u32
Get the number of bytes that self
will push out with each buffer.
§Returns
the number of bytes pushed with each buffer.
sourcefn buffer_pool(&self) -> Option<BufferPool>
fn buffer_pool(&self) -> Option<BufferPool>
§Returns
the instance of the gst::BufferPool
used
by the src; unref it after usage.
sourcefn does_timestamp(&self) -> bool
fn does_timestamp(&self) -> bool
sourcefn is_async(&self) -> bool
fn is_async(&self) -> bool
Get the current async behaviour of self
. See also set_async()
.
§Returns
true
if self
is operating in async mode.
sourcefn negotiate(&self) -> bool
fn negotiate(&self) -> bool
Negotiates src pad caps with downstream elements.
Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again
if GstBaseSrcClass::negotiate
fails.
Do not call this in the GstBaseSrcClass::fill
vmethod. Call this in
GstBaseSrcClass::create
or in GstBaseSrcClass::alloc
, before any
buffer is allocated.
§Returns
sourcefn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool
👎Deprecated: Since 1.18
fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool
Prepare a new seamless segment for emission downstream. This function must
only be called by derived sub-classes, and only from the GstBaseSrcClass::create
function,
as the stream-lock needs to be held.
The format for the new segment will be the current format of the source, as
configured with set_format()
§Deprecated since 1.18
Use new_segment()
§start
The new start value for the segment
§stop
Stop value for the new segment
§time
The new time value for the start of the new segment
§Returns
true
if preparation of the seamless segment succeeded.
sourcefn new_segment(&self, segment: &Segment) -> Result<(), BoolError>
fn new_segment(&self, segment: &Segment) -> Result<(), BoolError>
Prepare a new segment for emission downstream. This function must
only be called by derived sub-classes, and only from the GstBaseSrcClass::create
function,
as the stream-lock needs to be held.
The format for the segment
must be identical with the current format
of the source, as configured with set_format()
.
The format of self
must not be gst::Format::Undefined
and the format
should be configured via set_format()
before calling this method.
§segment
a pointer to a gst::Segment
§Returns
true
if preparation of new segment succeeded.
sourcefn push_segment(&self, segment: &Segment) -> bool
fn push_segment(&self, segment: &Segment) -> bool
Send a new segment downstream. This function must
only be called by derived sub-classes, and only from the GstBaseSrcClass::create
function,
as the stream-lock needs to be held.
This method also requires that an out caps has been configured, so
set_caps()
needs to have been called before.
The format for the segment
must be identical with the current format
of the source, as configured with set_format()
.
The format of self
must not be gst::Format::Undefined
and the format
should be configured via set_format()
before calling this method.
This is a variant of new_segment()
sending the segment right away,
which can be useful to ensure events ordering.
§segment
a pointer to a gst::Segment
§Returns
true
if sending of new segment succeeded.
sourcefn set_async(&self, async_: bool)
fn set_async(&self, async_: bool)
Configure async behaviour in self
, 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.
§async_
new async mode
sourcefn set_automatic_eos(&self, automatic_eos: bool)
fn set_automatic_eos(&self, automatic_eos: bool)
If automatic_eos
is true
, self
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 self
operates in gst::Format::Time
, BaseSrc
will send an EOS
when a buffer outside of the currently configured segment is pushed if
automatic_eos
is true
. Since 1.16, if automatic_eos
is false
an
EOS will be pushed only when the GstBaseSrcClass::create
implementation
returns gst::FlowReturn::Eos
.
§automatic_eos
automatic eos
sourcefn set_blocksize(&self, blocksize: u32)
fn set_blocksize(&self, blocksize: u32)
Set the number of bytes that self
will push out with each buffer. When
blocksize
is set to -1, a default length will be used.
§blocksize
the new blocksize in bytes
sourcefn set_do_timestamp(&self, timestamp: bool)
fn set_do_timestamp(&self, timestamp: bool)
Configure self
to automatically timestamp outgoing buffers based on the
current running_time of the pipeline. This property is mostly useful for live
sources.
§timestamp
enable or disable timestamping
sourcefn set_dynamic_size(&self, dynamic: bool)
fn set_dynamic_size(&self, dynamic: bool)
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.
§dynamic
new dynamic size mode
sourcefn set_format(&self, format: Format)
fn set_format(&self, format: Format)
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_FORMAT_BYTES is set, the element will be able to
operate in pull mode if the GstBaseSrcClass::is_seekable
returns true
.
This function must only be called in states < gst::State::Paused
.
§format
the format to use
sourcefn set_live(&self, live: bool)
fn set_live(&self, live: bool)
If the element listens to a live source, live
should
be set to true
.
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_STATE_CHANGE_NO_PREROLL.
§live
new live-mode
sourcefn start_complete(&self, ret: impl Into<FlowReturn>)
fn start_complete(&self, ret: impl Into<FlowReturn>)
Complete an asynchronous start operation. When the subclass overrides the
start method, it should call start_complete()
when the start
operation completes either from the same thread or from an asynchronous
helper thread.
§ret
sourcefn start_wait(&self) -> Result<FlowSuccess, FlowError>
fn start_wait(&self) -> Result<FlowSuccess, FlowError>
sourcefn wait_playing(&self) -> Result<FlowSuccess, FlowError>
fn wait_playing(&self) -> Result<FlowSuccess, FlowError>
If the GstBaseSrcClass::create
method performs its own synchronisation
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.
This function will block until a state change to PLAYING happens (in which
case this function returns gst::FlowReturn::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::FlowReturn::Flushing
).
§Returns
gst::FlowReturn::Ok
if self
is PLAYING and processing can
continue. Any other return value should be returned from the create vmethod.