T4.2: VideoToolbox H.264 encoder/decoder traits (macOS, MVP)

This commit is contained in:
Siavash Sameni
2026-05-12 09:09:57 +04:00
parent bb153a331d
commit 3356ba94c6
6 changed files with 319 additions and 3 deletions

View File

@@ -0,0 +1,15 @@
//! Video decoder trait and platform implementations.
use crate::encoder::{VideoError, VideoFrame};
/// Trait for video decoders.
///
/// Implementations are platform-specific (VideoToolbox on macOS, MediaCodec on
/// Android, OpenH264 as software fallback).
pub trait VideoDecoder: Send {
/// Decode one H.264 access unit into a raw video frame.
///
/// Returns `Ok(Some(frame))` when a frame is ready, `Ok(None)` if more
/// data is needed (e.g., for reordering), or an error.
fn decode(&mut self, access_unit: &[u8]) -> Result<Option<VideoFrame>, VideoError>;
}