Skip to main content

BaseSrcImpl

Trait BaseSrcImpl 

Source
pub trait BaseSrcImpl: ElementImpl + ObjectSubclass<Type: IsA<BaseSrc>> {
Show 19 methods // Provided methods fn start(&self) -> Result<(), ErrorMessage> { ... } fn stop(&self) -> Result<(), ErrorMessage> { ... } fn is_seekable(&self) -> bool { ... } fn size(&self) -> Option<u64> { ... } fn times( &self, buffer: &BufferRef, ) -> (Option<ClockTime>, Option<ClockTime>) { ... } fn fill( &self, offset: u64, length: u32, buffer: &mut BufferRef, ) -> Result<FlowSuccess, FlowError> { ... } fn alloc(&self, offset: u64, length: u32) -> Result<Buffer, FlowError> { ... } fn create( &self, offset: u64, buffer: Option<&mut BufferRef>, length: u32, ) -> Result<CreateSuccess, FlowError> { ... } fn do_seek(&self, segment: &mut Segment) -> bool { ... } fn query(&self, query: &mut QueryRef) -> bool { ... } fn event(&self, event: &Event) -> bool { ... } fn caps(&self, filter: Option<&Caps>) -> Option<Caps> { ... } fn negotiate(&self) -> Result<(), LoggableError> { ... } fn set_caps(&self, caps: &Caps) -> Result<(), LoggableError> { ... } fn fixate(&self, caps: Caps) -> Caps { ... } fn unlock(&self) -> Result<(), ErrorMessage> { ... } fn unlock_stop(&self) -> Result<(), ErrorMessage> { ... } fn decide_allocation( &self, query: &mut Allocation, ) -> Result<(), LoggableError> { ... } fn prepare_allocator( &self, caps: Option<&Caps>, ) -> Result<(), LoggableError> { ... }
}

Provided Methods§

Source

fn start(&self) -> Result<(), ErrorMessage>

Start processing. Subclasses should open resources and prepare to produce data. Implementation should call BaseSrcExt::start_complete() when the operation completes, either from the current thread or any other thread that finishes the start operation asynchronously.

Source

fn stop(&self) -> Result<(), ErrorMessage>

Stop processing. Subclasses should use this to close resources.

Source

fn is_seekable(&self) -> bool

Check if the source can seek

Source

fn size(&self) -> Option<u64>

Get the total size of the resource in the format set by BaseSrcExt::set_format().

§Returns

true if the size is available and has been set.

Source

fn times(&self, buffer: &BufferRef) -> (Option<ClockTime>, Option<ClockTime>)

Given buffer, return start and end time when it should be pushed out. The base class will sync on the clock using these times.

§Returns
Source

fn fill( &self, offset: u64, length: u32, buffer: &mut BufferRef, ) -> Result<FlowSuccess, FlowError>

Ask the subclass to fill the buffer with data for offset and size. The passed buffer is guaranteed to hold the requested amount of bytes.

Source

fn alloc(&self, offset: u64, length: u32) -> Result<Buffer, FlowError>

Ask the subclass to allocate an output buffer with offset and size, the default implementation will use the negotiated allocator.

§Returns
Source

fn create( &self, offset: u64, buffer: Option<&mut BufferRef>, length: u32, ) -> Result<CreateSuccess, FlowError>

Ask the subclass to create a buffer with offset and size, the default implementation will call alloc if no allocated buf is provided and then call fill.

Source

fn do_seek(&self, segment: &mut Segment) -> bool

Perform seeking on the resource to the indicated segment.

Source

fn query(&self, query: &mut QueryRef) -> bool

Handle a requested query.

Source

fn event(&self, event: &Event) -> bool

Override this to implement custom event handling.

Source

fn caps(&self, filter: Option<&Caps>) -> Option<Caps>

Called to get the caps to report.

Source

fn negotiate(&self) -> Result<(), LoggableError>

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

true if the negotiation succeeded, else false.

Source

fn set_caps(&self, caps: &Caps) -> Result<(), LoggableError>

Set new caps on the basesrc source pad.

§caps

a gst::Caps

§Returns

true if the caps could be set

Source

fn fixate(&self, caps: Caps) -> Caps

Called if, in negotiation, caps need fixating.

§Returns

the fixated caps

Source

fn unlock(&self) -> Result<(), ErrorMessage>

Unlock any pending access to the resource. Subclasses should unblock any blocked function ASAP. In particular, any create() function in progress should be unblocked and should return GST_FLOW_FLUSHING. Any future GstBaseSrcClass::create function call should also return GST_FLOW_FLUSHING until the GstBaseSrcClass::unlock_stop function has been called.

Source

fn unlock_stop(&self) -> Result<(), ErrorMessage>

Clear the previous unlock request. Subclasses should clear any state they set during GstBaseSrcClass::unlock, such as clearing command queues.

Source

fn decide_allocation(&self, query: &mut Allocation) -> Result<(), LoggableError>

configure the allocation query

Source

fn prepare_allocator(&self, caps: Option<&Caps>) -> Result<(), LoggableError>

Orchestrates gst::BufferPool & gst::Allocator configuration for the negotiated caps. Default implementation relies on an Allocation GstQuery & calls decide_allocation().

§caps

the negotiated gst::Caps

§Returns

whether the gst::BufferPool & gst::Allocator could be configured.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§