pub enum MediaKind {
VideoPacket,
AudioPacket,
VideoFrame,
AudioFrame,
}Expand description
Which MediaBuffer payloads a port deals
in, split by medium as well as by encoding.
The medium is part of the kind because
MediaBuffer::Packet alone does
not carry it: a demuxer’s audio and video pads emit the same variant,
so without this split, wiring a container’s audio stream into a video
decoder is a link the check cannot see. Every element that deals in
packets does know its own medium when it is constructed — from the
stream parameters it was opened with, or from being an audio encoder
rather than a video one — so the distinction costs nothing to state.
MediaBuffer::Eos is deliberately
absent: every sink must accept EOS, so it is never part of what a
contract can rule out.
Variants§
VideoPacket
Encoded video, as MediaBuffer::Packet.
AudioPacket
Encoded audio, as MediaBuffer::Packet.
VideoFrame
Decoded MediaBuffer::Video.
AudioFrame
Decoded MediaBuffer::Audio.
Implementations§
Source§impl MediaKind
impl MediaKind
Sourcepub fn packet_for(medium: Type) -> Option<Self>
pub fn packet_for(medium: Type) -> Option<Self>
The encoded kind a stream of medium carries, or None for a
medium none of this crate’s elements handle (subtitles, data). A
caller with no kind to state declares
OutputContract::Unknown/InputContract::Unknown and leaves
that pad to the runtime check, rather than guessing.