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§
Sourcefn descriptor(&self) -> &CodecDescriptor
fn descriptor(&self) -> &CodecDescriptor
Describes what this codec expects and produces.
Sourcefn process(&self, input: FrameLease) -> Result<FrameLease, CodecError>
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.