pub struct VirtioVideoAdapterSession<D: DecoderBackend> {
Show 13 fields id: u32, backend_session: Option<D::Session>, poller: WaitContext<u32>, backend: Arc<Mutex<D>>, input_format: Format, output_format: Format, coded_size: (u32, u32), stream_params: StreamParams, initial_drc_received: bool, need_set_output_params: bool, pending_output_buffers: Vec<(u32, Option<GuestResource>)>, eos_capture_buffer: EosBuffer, num_output_buffers: usize,
}

Fields§

§id: u32

Session ID.

§backend_session: Option<D::Session>

The backend session can only be created once we know the input format.

§poller: WaitContext<u32>

Proxy poller. We need this because this backend creates the actual session with a delay, but the device needs the session FD as soon as it is created.

§backend: Arc<Mutex<D>>

Shared reference to the device backend. Required so we can create the session lazily.

§input_format: Format§output_format: Format§coded_size: (u32, u32)

Coded size currently set for the CAPTURE buffers.

§stream_params: StreamParams

Stream parameters, as obtained from the stream itself.

§initial_drc_received: bool

Whether the initial DRC event has been received. The backend will ignore CAPTURE buffers queued before that.

§need_set_output_params: bool

Whether the set_output_parameters of the backend needs to be called before a CAPTURE buffer is sent.

§pending_output_buffers: Vec<(u32, Option<GuestResource>)>

Indices of CAPTURE buffers that are queued but not send to the backend.

§eos_capture_buffer: EosBuffer

Index of the capture buffer we kept in order to signal EOS.

§num_output_buffers: usize

Number of output buffers that have been allocated, as reported by the decoder device.

This is required to call set_output_parameters on the virtio-video session.

Implementations§

source§

impl<D: DecoderBackend> VirtioVideoAdapterSession<D>

source

fn get_or_create_session(&mut self) -> IoctlResult<&mut D::Session>

Get the currently existing backend session if it exists, or create it using the current input format if it doesn’t.

source

fn try_send_pending_output_buffers(&mut self) -> IoctlResult<()>

Trait Implementations§

source§

impl<D: DecoderBackend> VideoDecoderBackendSession for VirtioVideoAdapterSession<D>

§

type BufferStorage = VirtioVideoAdapterBuffer

source§

fn current_format(&self, direction: QueueDirection) -> V4l2MplaneFormat

Returns the current format set for the given direction, in a form suitable as a reply to VIDIOC_G_FMT.
source§

fn stream_params(&self) -> StreamParams

Returns the stream parameters as read from the input.
source§

fn drain(&mut self) -> IoctlResult<()>

Start draining the decoder pipeline for all buffers still in it. Read more
source§

fn clear_output_buffers(&mut self) -> IoctlResult<()>

Remove any output buffer that has been previously added using [use_as_output].
source§

fn next_event(&mut self) -> Option<VideoDecoderBackendEvent>

Returns the next pending event if there is one, or None if there aren’t any.
source§

fn buffers_allocated(&mut self, direction: QueueDirection, num_buffers: u32)

Called whenever the decoder device has allocated buffers for a given queue. Read more
source§

fn poll_fd(&self) -> Option<BorrowedFd<'_>>

Returns a file descriptor that signals POLLIN whenever an event is pending and can be read using [next_event], or None if the backend does not support this.
source§

fn decode( &mut self, input: &Self::BufferStorage, index: u32, timestamp: timeval, bytes_used: u32 ) -> IoctlResult<()>

Decode the encoded stream in input, of length bytes_used, which corresponds to OUTPUT buffer index. Read more
source§

fn use_as_output( &mut self, index: u32, backing: &mut Self::BufferStorage ) -> IoctlResult<()>

Use backing as the backing storage for output buffer index.
§

fn streaming_state(&mut self, _direction: QueueDirection, _streaming: bool)

Optional hook called whenever the streaming state of a queue changes. Some backends may need this information to operate properly.
§

fn resume(&mut self)

Optional hook called by the decoder to signal it has processed a pausing event sent by the backend. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V