pub trait StatefulVideoEncoderBackend<Handle> {
// Required methods
fn consume_request(
&mut self,
request: &mut Option<BackendRequest<Handle>>,
) -> StatefulBackendResult<()>;
fn sync(&mut self) -> StatefulBackendResult<()>;
fn drain(&mut self) -> StatefulBackendResult<Vec<BackendOutput>>;
fn poll(&mut self) -> StatefulBackendResult<Option<BackendOutput>>;
}
Expand description
Generic trait for stateful encoder backends
Required Methods§
Sourcefn consume_request(
&mut self,
request: &mut Option<BackendRequest<Handle>>,
) -> StatefulBackendResult<()>
fn consume_request( &mut self, request: &mut Option<BackendRequest<Handle>>, ) -> StatefulBackendResult<()>
Try to submit encode request to the backend. The backend may not be able to accept the
request eg. if there are not enough available resources or backend desires to finish
previous request first. The function shall not be blocking.
If backend accepts the request for processing it shall take the request
(take ownership of
BackendRequest
and set ref mut to None
.
Sourcefn sync(&mut self) -> StatefulBackendResult<()>
fn sync(&mut self) -> StatefulBackendResult<()>
Function shall block, until the backend can accept request with consume_request
or
will finished processing of some BackendRequest
and poll
can be used to
fetch is result.
Sourcefn drain(&mut self) -> StatefulBackendResult<Vec<BackendOutput>>
fn drain(&mut self) -> StatefulBackendResult<Vec<BackendOutput>>
Blocking function, until the backend finishes processing all BackendRequest
, that the
backend has accepted and all outputs of those requests are returned.
Sourcefn poll(&mut self) -> StatefulBackendResult<Option<BackendOutput>>
fn poll(&mut self) -> StatefulBackendResult<Option<BackendOutput>>
If the processing of any BackendRequest
is finished then the function should yield it’s
corresponding BackendOutput
.