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>

source

pub fn new(backend: D, resource_bridge: Tube, mem: GuestMemory) -> Self

Build a new decoder using the provided backend.

source

fn query_capabilities(&self, queue_type: QueueType) -> CmdResponse

source

fn create_stream( &mut self, stream_id: u32, coded_format: Format, input_resource_type: ResourceType, output_resource_type: ResourceType ) -> Result<VideoCmdResponseType, VideoError>

source

fn destroy_stream(&mut self, stream_id: u32)

source

fn create_session( decoder: &mut D, wait_ctx: &WaitContext<Token>, ctx: &Context<D::Session>, stream_id: u32 ) -> Result<D::Session, VideoError>

source

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>

source

fn destroy_all_resources( &mut self, stream_id: u32, queue_type: QueueType ) -> Result<VideoCmdResponseType, VideoError>

source

fn queue_input_resource( &mut self, stream_id: u32, resource_id: u32, timestamp: u64, data_sizes: Vec<u32> ) -> Result<VideoCmdResponseType, VideoError>

source

fn queue_output_resource( &mut self, stream_id: u32, resource_id: u32 ) -> Result<VideoCmdResponseType, VideoError>

source

fn get_params( &self, stream_id: u32, queue_type: QueueType, is_ext: bool ) -> Result<VideoCmdResponseType, VideoError>

source

fn set_params( &mut self, stream_id: u32, queue_type: QueueType, params: Params, is_ext: bool ) -> Result<VideoCmdResponseType, VideoError>

source

fn query_control( &self, ctrl_type: QueryCtrlType ) -> Result<VideoCmdResponseType, VideoError>

source

fn get_control( &self, stream_id: u32, ctrl_type: CtrlType ) -> Result<VideoCmdResponseType, VideoError>

source

fn drain_stream( &mut self, stream_id: u32 ) -> Result<VideoCmdResponseType, VideoError>

source

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>

source§

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 more
source§

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 more
source§

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>
where <D as DecoderBackend>::Session: Send,

§

impl<D> Sync for Decoder<D>
where D: Sync, <D as DecoderBackend>::Session: Sync,

§

impl<D> Unpin for Decoder<D>
where D: Unpin,

§

impl<D> UnwindSafe for Decoder<D>

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