Codec

Trait Codec 

Source
pub trait Codec:
    Send
    + Sync
    + 'static {
    // Required methods
    fn descriptor(&self) -> &CodecDescriptor;
    fn process(&self, input: FrameLease) -> Result<FrameLease, CodecError>;
}
Expand description

Unified codec trait for zero-copy processing.

§Example

use styx_codec::{Codec, CodecDescriptor, CodecError, CodecKind};
use styx_core::prelude::{FourCc, FrameLease};

struct Passthrough {
    desc: CodecDescriptor,
}

impl Codec for Passthrough {
    fn descriptor(&self) -> &CodecDescriptor { &self.desc }
    fn process(&self, input: FrameLease) -> Result<FrameLease, CodecError> {
        Ok(input)
    }
}

Required Methods§

Source

fn descriptor(&self) -> &CodecDescriptor

Describes what this codec expects and produces.

Source

fn process(&self, input: FrameLease) -> Result<FrameLease, CodecError>

Process a frame and return the transformed frame.

Implementations should preserve plane references when possible to avoid copies.

Implementors§