Struct EncoderDevice

Source
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> Freeze for EncoderDevice<T>
where T: Freeze,

§

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
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>,

Source§

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>,

Source§

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