video: Add `configure_video_stream_decoder` to the `VideoBackend` trait
This commit is contained in:
parent
fe2a264a93
commit
a66bec40dd
|
@ -63,6 +63,24 @@ impl VideoBackend for ExternalVideoBackend {
|
||||||
Ok(self.streams.insert(proxy_or_stream))
|
Ok(self.streams.insert(proxy_or_stream))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn configure_video_stream_decoder(
|
||||||
|
&mut self,
|
||||||
|
stream: VideoStreamHandle,
|
||||||
|
configuration_data: &[u8],
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let stream = self
|
||||||
|
.streams
|
||||||
|
.get_mut(stream)
|
||||||
|
.ok_or(Error::VideoStreamIsNotRegistered)?;
|
||||||
|
|
||||||
|
match stream {
|
||||||
|
ProxyOrStream::Proxied(handle) => self
|
||||||
|
.software
|
||||||
|
.configure_video_stream_decoder(*handle, configuration_data),
|
||||||
|
ProxyOrStream::Owned(stream) => stream.decoder.configure_decoder(configuration_data),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn preload_video_stream_frame(
|
fn preload_video_stream_frame(
|
||||||
&mut self,
|
&mut self,
|
||||||
stream: VideoStreamHandle,
|
stream: VideoStreamHandle,
|
||||||
|
|
|
@ -66,6 +66,15 @@ impl VideoBackend for SoftwareVideoBackend {
|
||||||
stream.decoder.preload_frame(encoded_frame)
|
stream.decoder.preload_frame(encoded_frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn configure_video_stream_decoder(
|
||||||
|
&mut self,
|
||||||
|
_stream: VideoStreamHandle,
|
||||||
|
_configuration_data: &[u8],
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
// None of the software decoders require configuration.
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn decode_video_stream_frame(
|
fn decode_video_stream_frame(
|
||||||
&mut self,
|
&mut self,
|
||||||
stream: VideoStreamHandle,
|
stream: VideoStreamHandle,
|
||||||
|
|
|
@ -13,6 +13,11 @@ pub mod screen;
|
||||||
/// Trait for video decoders.
|
/// Trait for video decoders.
|
||||||
/// This should be implemented for each video codec.
|
/// This should be implemented for each video codec.
|
||||||
pub trait VideoDecoder {
|
pub trait VideoDecoder {
|
||||||
|
/// Configure the decoder.
|
||||||
|
fn configure_decoder(&mut self, _configuration_data: &[u8]) -> Result<(), Error> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Preload a frame.
|
/// Preload a frame.
|
||||||
///
|
///
|
||||||
/// No decoding is intended to happen at this point in time. Instead, the
|
/// No decoding is intended to happen at this point in time. Instead, the
|
||||||
|
|
|
@ -26,6 +26,15 @@ pub trait VideoBackend {
|
||||||
filter: VideoDeblocking,
|
filter: VideoDeblocking,
|
||||||
) -> Result<VideoStreamHandle, Error>;
|
) -> Result<VideoStreamHandle, Error>;
|
||||||
|
|
||||||
|
/// Configure the decoder of a given video stream.
|
||||||
|
///
|
||||||
|
/// The `configuration_data` contains codec-specific parameters.
|
||||||
|
fn configure_video_stream_decoder(
|
||||||
|
&mut self,
|
||||||
|
stream: VideoStreamHandle,
|
||||||
|
configuration_data: &[u8],
|
||||||
|
) -> Result<(), Error>;
|
||||||
|
|
||||||
/// Preload a frame of a given video stream.
|
/// Preload a frame of a given video stream.
|
||||||
///
|
///
|
||||||
/// No decoding is intended to happen at this point in time. Instead, the
|
/// No decoding is intended to happen at this point in time. Instead, the
|
||||||
|
|
|
@ -44,6 +44,14 @@ impl VideoBackend for NullVideoBackend {
|
||||||
Ok(self.streams.insert(()))
|
Ok(self.streams.insert(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn configure_video_stream_decoder(
|
||||||
|
&mut self,
|
||||||
|
_stream: VideoStreamHandle,
|
||||||
|
_configuration_data: &[u8],
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn preload_video_stream_frame(
|
fn preload_video_stream_frame(
|
||||||
&mut self,
|
&mut self,
|
||||||
_stream: VideoStreamHandle,
|
_stream: VideoStreamHandle,
|
||||||
|
|
Loading…
Reference in New Issue