pub trait BaseSrcExt: 'static {
Show 26 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 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 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_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(
        f: F
    ) -> SignalHandlerId;
fn connect_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(
        f: F
    ) -> SignalHandlerId;
fn connect_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
        f: F
    ) -> SignalHandlerId;
fn connect_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>(
        f: F
    ) -> SignalHandlerId;
Expand description

Trait containing all BaseSrc methods.


BaseSrc, PushSrc

Required methods

Get the number of bytes that self will push out with each buffer.


the number of bytes pushed with each buffer.


the instance of the gst::BufferPool used by the src; unref it after usage.

Query if self timestamps outgoing buffers based on the current running_time.


true if the base class will automatically timestamp outgoing buffers.

Get the current async behaviour of self. See also set_async().


true if self is operating in async mode.

Check if an element is in live mode.


true if element is in live mode.

This is supported on crate feature v1_18 only.

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.


true if the negotiation succeeded, else false.

👎 Deprecated:

Since 1.18

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 BaseSrcExtManual::new_segment()


The new start value for the segment


Stop value for the new segment


The new time value for the start of the new segment


true if preparation of the seamless segment succeeded.

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.


new async mode

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

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.


the new blocksize in bytes

Set new caps on the basesrc source pad.


a gst::Caps


true if the caps could be set

Configure self to automatically timestamp outgoing buffers based on the current running_time of the pipeline. This property is mostly useful for live sources.


enable or disable timestamping

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.


new dynamic size mode

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.


the format to use

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.


new live-mode

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.


a gst::FlowReturn