Struct devices::virtio::media::decoder_adapter::VirtioVideoAdapterSession
source · 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>
impl<D: DecoderBackend> VirtioVideoAdapterSession<D>
sourcefn get_or_create_session(&mut self) -> IoctlResult<&mut D::Session>
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.
fn try_send_pending_output_buffers(&mut self) -> IoctlResult<()>
Trait Implementations§
source§impl<D: DecoderBackend> VideoDecoderBackendSession for VirtioVideoAdapterSession<D>
impl<D: DecoderBackend> VideoDecoderBackendSession for VirtioVideoAdapterSession<D>
type BufferStorage = VirtioVideoAdapterBuffer
source§fn current_format(&self, direction: QueueDirection) -> V4l2MplaneFormat
fn current_format(&self, direction: QueueDirection) -> V4l2MplaneFormat
direction
, in a form suitable as a reply to
VIDIOC_G_FMT
.source§fn stream_params(&self) -> StreamParams
fn stream_params(&self) -> StreamParams
source§fn drain(&mut self) -> IoctlResult<()>
fn drain(&mut self) -> IoctlResult<()>
source§fn clear_output_buffers(&mut self) -> IoctlResult<()>
fn clear_output_buffers(&mut self) -> IoctlResult<()>
use_as_output
].source§fn next_event(&mut self) -> Option<VideoDecoderBackendEvent>
fn next_event(&mut self) -> Option<VideoDecoderBackendEvent>
None
if there aren’t any.source§fn buffers_allocated(&mut self, direction: QueueDirection, num_buffers: u32)
fn buffers_allocated(&mut self, direction: QueueDirection, num_buffers: u32)
source§fn poll_fd(&self) -> Option<BorrowedFd<'_>>
fn poll_fd(&self) -> Option<BorrowedFd<'_>>
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<()>
fn decode( &mut self, input: &Self::BufferStorage, index: u32, timestamp: timeval, bytes_used: u32 ) -> IoctlResult<()>
input
, of length bytes_used
, which corresponds to
OUTPUT buffer index
. Read moresource§fn use_as_output(
&mut self,
index: u32,
backing: &mut Self::BufferStorage
) -> IoctlResult<()>
fn use_as_output( &mut self, index: u32, backing: &mut Self::BufferStorage ) -> IoctlResult<()>
backing
as the backing storage for output buffer index
.§fn streaming_state(&mut self, _direction: QueueDirection, _streaming: bool)
fn streaming_state(&mut self, _direction: QueueDirection, _streaming: bool)
Auto Trait Implementations§
impl<D> RefUnwindSafe for VirtioVideoAdapterSession<D>
impl<D> Send for VirtioVideoAdapterSession<D>
impl<D> Sync for VirtioVideoAdapterSession<D>
impl<D> Unpin for VirtioVideoAdapterSession<D>
impl<D> UnwindSafe for VirtioVideoAdapterSession<D>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.