pub struct EncoderDevice<T: Encoder> {
    cros_capabilities: EncoderCapabilities,
    encoder: T,
    streams: BTreeMap<u32, Stream<T::Session>>,
    resource_bridge: Tube,
    mem: GuestMemory,
}

Fields§

§cros_capabilities: EncoderCapabilities§encoder: T§streams: BTreeMap<u32, Stream<T::Session>>§resource_bridge: Tube§mem: GuestMemory

Implementations§

source§

impl<T: Encoder> EncoderDevice<T>

source

pub fn new( backend: T, resource_bridge: Tube, mem: GuestMemory ) -> Result<Self, VideoError>

Build a new encoder using the provided backend.

source

fn query_capabilities( &self, queue_type: QueueType ) -> Result<VideoCmdResponseType, VideoError>

source

fn stream_create( &mut self, stream_id: u32, desired_format: Format, src_resource_type: ResourceType, dst_resource_type: ResourceType ) -> Result<VideoCmdResponseType, VideoError>

source

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

source

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

source

fn resource_create( &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 resource_queue( &mut self, stream_id: u32, queue_type: QueueType, resource_id: u32, timestamp: u64, data_sizes: Vec<u32> ) -> Result<VideoCmdResponseType, VideoError>

source

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

source

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

source

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

source

fn set_params( &mut self, wait_ctx: &WaitContext<Token>, stream_id: u32, queue_type: QueueType, format: Option<Format>, frame_width: u32, frame_height: u32, frame_rate: u32, plane_formats: Vec<PlaneFormat>, resource_type: Option<ResourceType> ) -> Result<VideoCmdResponseType, VideoError>

source

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

source

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

source

fn set_control( &mut self, wait_ctx: &WaitContext<Token>, stream_id: u32, ctrl_val: CtrlVal ) -> Result<VideoCmdResponseType, VideoError>

Trait Implementations§

source§

impl<T: Encoder> Device for EncoderDevice<T>

source§

fn process_cmd( &mut self, req: 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<T> RefUnwindSafe for EncoderDevice<T>

§

impl<T> Send for EncoderDevice<T>
where T: Send, <T as Encoder>::Session: Send,

§

impl<T> Sync for EncoderDevice<T>
where T: Sync, <T as Encoder>::Session: Sync,

§

impl<T> Unpin for EncoderDevice<T>
where T: Unpin,

§

impl<T> UnwindSafe for EncoderDevice<T>

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