pub trait DecoderFormatNegotiator {
type Descriptor;
// Required methods
fn stream_info(&self) -> &StreamInfo;
fn frame_pool(
&mut self,
layer: PoolLayer,
) -> Vec<&mut dyn FramePool<Descriptor = Self::Descriptor>>;
fn try_format(&mut self, format: DecodedFormat) -> Result<()>;
}
Expand description
Trait for objects allowing to negotiate the output format of a decoder.
A decoder always has a valid output format set, but that format can change if the stream
requests it. When this happens, the decoder stops accepting new input and a
DecoderEvent::FormatChanged
event is emitted, carrying a negotiator trait object that
allows the client to acknowledge that the format change took place, and (in the future)
negotiate its specifics.
When the object is dropped, the decoder can accept and process new input again.
Required Associated Types§
type Descriptor
Required Methods§
Sourcefn stream_info(&self) -> &StreamInfo
fn stream_info(&self) -> &StreamInfo
Returns the current decoding parameters, as extracted from the stream.
Sourcefn frame_pool(
&mut self,
layer: PoolLayer,
) -> Vec<&mut dyn FramePool<Descriptor = Self::Descriptor>>
fn frame_pool( &mut self, layer: PoolLayer, ) -> Vec<&mut dyn FramePool<Descriptor = Self::Descriptor>>
Returns the frame pool in use for the decoder for layer
set up for the
new format.
Sourcefn try_format(&mut self, format: DecodedFormat) -> Result<()>
fn try_format(&mut self, format: DecodedFormat) -> Result<()>
Attempt to change the pixel format of output frames to format
.