pub enum PortContract {
Packets(MediaKindSet),
Frames(MediaKindSet, MemoryDomainSet),
}Expand description
What one port deals in.
Split by encoding rather than carrying an optional domain, because the
two halves ask different questions. Encoded media is always host
memory, so Self::Packets has nowhere to put a domain and nowhere to
forget one. Decoded frames always live somewhere specific, so
Self::Frames always states it — an element that genuinely takes any
backend says MemoryDomainSet::ALL, which reads as the deliberate
claim it is rather than as an omission.
The two never link to each other. That falls out of the shape, and it
matches MediaKind: no packet kind is a frame kind.
Variants§
Packets(MediaKindSet)
Encoded media — MediaKind::VideoPacket/MediaKind::AudioPacket.
Frames(MediaKindSet, MemoryDomainSet)
Decoded frames — MediaKind::VideoFrame/MediaKind::AudioFrame
— together with the backends their memory may live in.
Implementations§
Source§impl PortContract
impl PortContract
Sourcepub const fn frame(kind: MediaKind, memory: MemoryDomain) -> Self
pub const fn frame(kind: MediaKind, memory: MemoryDomain) -> Self
One decoded kind in one backend’s memory.
Sourcepub const fn any_frame(kind: MediaKind) -> Self
pub const fn any_frame(kind: MediaKind) -> Self
One decoded kind, wherever it lives — for an element that forwards or counts frames without reading them.
Sourcepub fn accepts(&self, produced: &PortContract) -> bool
pub fn accepts(&self, produced: &PortContract) -> bool
Returns whether a producer emitting produced can feed a consumer
accepting self.
Every kind the producer may emit has to be accepted, and so does every domain its frames may live in. Encoded media and decoded frames never satisfy each other.
Trait Implementations§
Source§impl Clone for PortContract
impl Clone for PortContract
Source§fn clone(&self) -> PortContract
fn clone(&self) -> PortContract
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more