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: GuestMemoryImplementations§
source§impl<T: Encoder> EncoderDevice<T>
 
impl<T: Encoder> EncoderDevice<T>
sourcepub fn new(
    backend: T,
    resource_bridge: Tube,
    mem: GuestMemory,
) -> Result<Self, VideoError>
 
pub fn new( backend: T, resource_bridge: Tube, mem: GuestMemory, ) -> Result<Self, VideoError>
Build a new encoder using the provided backend.
fn query_capabilities( &self, queue_type: QueueType, ) -> Result<VideoCmdResponseType, VideoError>
fn stream_create( &mut self, stream_id: u32, desired_format: Format, src_resource_type: ResourceType, dst_resource_type: ResourceType, ) -> Result<VideoCmdResponseType, VideoError>
fn stream_destroy( &mut self, stream_id: u32, ) -> Result<VideoCmdResponseType, VideoError>
fn stream_drain( &mut self, stream_id: u32, ) -> Result<VideoCmdResponseType, VideoError>
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>
fn resource_queue( &mut self, stream_id: u32, queue_type: QueueType, resource_id: u32, timestamp: u64, data_sizes: Vec<u32>, ) -> Result<VideoCmdResponseType, VideoError>
fn resource_destroy_all( &mut self, stream_id: u32, ) -> Result<VideoCmdResponseType, VideoError>
fn queue_clear( &mut self, stream_id: u32, queue_type: QueueType, ) -> Result<VideoCmdResponseType, VideoError>
fn get_params( &mut self, stream_id: u32, queue_type: QueueType, is_ext: bool, ) -> Result<VideoCmdResponseType, VideoError>
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>
fn query_control( &self, query_ctrl_type: QueryCtrlType, ) -> Result<VideoCmdResponseType, VideoError>
fn get_control( &self, stream_id: u32, ctrl_type: CtrlType, ) -> Result<VideoCmdResponseType, VideoError>
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>
 
impl<T: Encoder> Device for EncoderDevice<T>
source§fn process_cmd(
    &mut self,
    req: VideoCmd,
    wait_ctx: &WaitContext<Token>,
) -> (VideoCmdResponseType, Option<(u32, Vec<VideoEvtResponseType>)>)
 
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 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<T> Freeze for EncoderDevice<T>where
    T: Freeze,
impl<T> RefUnwindSafe for EncoderDevice<T>
impl<T> Send for EncoderDevice<T>
impl<T> Sync for EncoderDevice<T>
impl<T> Unpin for EncoderDevice<T>where
    T: Unpin,
impl<T> UnwindSafe for EncoderDevice<T>
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.