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: u32Session 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: StreamParamsStream parameters, as obtained from the stream itself.
initial_drc_received: boolWhether the initial DRC event has been received. The backend will ignore CAPTURE buffers queued before that.
need_set_output_params: boolWhether 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: EosBufferIndex of the capture buffer we kept in order to signal EOS.
num_output_buffers: usizeNumber 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.