pub trait VideoDecoderBackend: Sized {
type Session: VideoDecoderBackendSession;
// Required methods
fn new_session(&mut self, id: u32) -> IoctlResult<Self::Session>;
fn close_session(&mut self, session: Self::Session);
fn enum_formats(
&self,
session: &VideoDecoderSession<Self::Session>,
direction: QueueDirection,
index: u32,
) -> Option<v4l2_fmtdesc>;
fn frame_sizes(&self, pixel_format: u32) -> Option<v4l2_frmsize_stepwise>;
fn adjust_format(
&self,
session: &Self::Session,
direction: QueueDirection,
format: V4l2MplaneFormat,
) -> V4l2MplaneFormat;
fn apply_format(
&self,
session: &mut Self::Session,
direction: QueueDirection,
format: &V4l2MplaneFormat,
);
}Expand description
Trait for actual implementations of video decoding, to be used with VideoDecoder.
VideoDecoder takes care of (mostly) abstracting V4L2 away ; implementors of this trait are
the ones that provide the actual video decoding service.
Required Associated Types§
Required Methods§
Sourcefn new_session(&mut self, id: u32) -> IoctlResult<Self::Session>
fn new_session(&mut self, id: u32) -> IoctlResult<Self::Session>
Create a new session with the provided id.
Sourcefn close_session(&mut self, session: Self::Session)
fn close_session(&mut self, session: Self::Session)
Close and destroy session.
Sourcefn enum_formats(
&self,
session: &VideoDecoderSession<Self::Session>,
direction: QueueDirection,
index: u32,
) -> Option<v4l2_fmtdesc>
fn enum_formats( &self, session: &VideoDecoderSession<Self::Session>, direction: QueueDirection, index: u32, ) -> Option<v4l2_fmtdesc>
Returns the format at index for the given queue direction, or None if index is out of
bounds.
Sourcefn frame_sizes(&self, pixel_format: u32) -> Option<v4l2_frmsize_stepwise>
fn frame_sizes(&self, pixel_format: u32) -> Option<v4l2_frmsize_stepwise>
Returns the supported frame sizes for pixel_format, or None if the format is not
supported.
Sourcefn adjust_format(
&self,
session: &Self::Session,
direction: QueueDirection,
format: V4l2MplaneFormat,
) -> V4l2MplaneFormat
fn adjust_format( &self, session: &Self::Session, direction: QueueDirection, format: V4l2MplaneFormat, ) -> V4l2MplaneFormat
Adjust format to make it applicable to the queue with the given direction for the current session.
This method doesn’t fail, implementations must return the closest acceptable format that
can be applied unchanged with Self::apply_format.
Sourcefn apply_format(
&self,
session: &mut Self::Session,
direction: QueueDirection,
format: &V4l2MplaneFormat,
)
fn apply_format( &self, session: &mut Self::Session, direction: QueueDirection, format: &V4l2MplaneFormat, )
Applies format to the queue of the given direction. The format is adjusted if needed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".