pub struct Decoder<D: DecoderBackend> {
decoder: D,
capability: Capability,
contexts: ContextMap<D::Session>,
resource_bridge: Tube,
mem: GuestMemory,
}
Expand description
Represents information of a decoder backed by a DecoderBackend
.
Fields§
§decoder: D
§capability: Capability
§contexts: ContextMap<D::Session>
§resource_bridge: Tube
§mem: GuestMemory
Implementations§
source§impl<D: DecoderBackend> Decoder<D>
impl<D: DecoderBackend> Decoder<D>
sourcepub fn new(backend: D, resource_bridge: Tube, mem: GuestMemory) -> Self
pub fn new(backend: D, resource_bridge: Tube, mem: GuestMemory) -> Self
Build a new decoder using the provided backend
.
fn query_capabilities(&self, queue_type: QueueType) -> CmdResponse
fn create_stream( &mut self, stream_id: u32, coded_format: Format, input_resource_type: ResourceType, output_resource_type: ResourceType ) -> Result<VideoCmdResponseType, VideoError>
fn destroy_stream(&mut self, stream_id: u32)
fn create_session( decoder: &mut D, wait_ctx: &WaitContext<Token>, ctx: &Context<D::Session>, stream_id: u32 ) -> Result<D::Session, VideoError>
fn create_resource( &mut self, wait_ctx: &WaitContext<Token>, stream_id: u32, queue_type: QueueType, resource_id: u32, plane_offsets: Vec<u32>, plane_entries: Vec<Vec<UnresolvedResourceEntry>> ) -> Result<VideoCmdResponseType, VideoError>
fn destroy_all_resources( &mut self, stream_id: u32, queue_type: QueueType ) -> Result<VideoCmdResponseType, VideoError>
fn queue_input_resource( &mut self, stream_id: u32, resource_id: u32, timestamp: u64, data_sizes: Vec<u32> ) -> Result<VideoCmdResponseType, VideoError>
fn queue_output_resource( &mut self, stream_id: u32, resource_id: u32 ) -> Result<VideoCmdResponseType, VideoError>
fn get_params( &self, stream_id: u32, queue_type: QueueType, is_ext: bool ) -> Result<VideoCmdResponseType, VideoError>
fn set_params( &mut self, stream_id: u32, queue_type: QueueType, params: Params, is_ext: bool ) -> Result<VideoCmdResponseType, VideoError>
fn query_control( &self, ctrl_type: QueryCtrlType ) -> Result<VideoCmdResponseType, VideoError>
fn get_control( &self, stream_id: u32, ctrl_type: CtrlType ) -> Result<VideoCmdResponseType, VideoError>
fn drain_stream( &mut self, stream_id: u32 ) -> Result<VideoCmdResponseType, VideoError>
fn clear_queue( &mut self, stream_id: u32, queue_type: QueueType, wait_ctx: &WaitContext<Token> ) -> Result<VideoCmdResponseType, VideoError>
Trait Implementations§
source§impl<D: DecoderBackend> Device for Decoder<D>
impl<D: DecoderBackend> Device for Decoder<D>
source§fn process_cmd(
&mut self,
cmd: VideoCmd,
wait_ctx: &WaitContext<Token>
) -> (VideoCmdResponseType, Option<(u32, Vec<VideoEvtResponseType>)>)
fn process_cmd( &mut self, cmd: VideoCmd, wait_ctx: &WaitContext<Token> ) -> (VideoCmdResponseType, Option<(u32, Vec<VideoEvtResponseType>)>)
Processes a virtio-video command.
If the command expects a synchronous response, it returns a response as
VideoCmdResponseType::Sync
. Otherwise, it returns a name of the descriptor chain that
will be used when a response is prepared. Implementations of this method is passed a
WaitContext object which can be used to add or remove descriptors to wait on. It is
expected that only Token::Event items would be added. When a Token::Event event arrives,
process_event() will be invoked. Read moresource§fn process_event(
&mut self,
desc_map: &mut AsyncCmdDescMap,
stream_id: u32,
wait_ctx: &WaitContext<Token>
) -> Option<Vec<VideoEvtResponseType>>
fn process_event( &mut self, desc_map: &mut AsyncCmdDescMap, stream_id: u32, wait_ctx: &WaitContext<Token> ) -> Option<Vec<VideoEvtResponseType>>
Processes an available
Token::Event
event and returns a list of VideoEvtResponseType
responses. It returns None if an invalid event comes.
For responses to be sent via command queue, the return type is
VideoEvtResponseType::AsyncCmd
. For responses to be sent via event queue, the return
type is VideoEvtResponseType::Event
. Read moresource§fn process_buffer_barrier(
&mut self,
stream_id: u32,
wait_ctx: &WaitContext<Token>
) -> Option<Vec<VideoEvtResponseType>>
fn process_buffer_barrier( &mut self, stream_id: u32, wait_ctx: &WaitContext<Token> ) -> Option<Vec<VideoEvtResponseType>>
Processes a
Token::BufferBarrier
event and returns a list of VideoEvtResponseType
responses. Only needs to be implemented for devices that adds Token::BufferBarrier
tokens
to the wait context.Auto Trait Implementations§
impl<D> RefUnwindSafe for Decoder<D>
impl<D> Send for Decoder<D>
impl<D> Sync for Decoder<D>
impl<D> Unpin for Decoder<D>where
D: Unpin,
impl<D> UnwindSafe for Decoder<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
Mutably borrows from an owned value. Read more
§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>
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>
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)
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)
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.