Skip to main content

openipc_video/
lib.rs

1//! Low-latency platform video decoding for OpenIPC applications.
2//!
3//! The crate accepts complete Annex-B access units, keeps codec parsing and
4//! backpressure behavior platform-neutral, and delegates actual decoding to a
5//! platform decoder. H.264 and H.265 are supported by the shared API.
6
7#![deny(unsafe_op_in_unsafe_fn)]
8
9/// Platform-neutral decoder inputs, outputs, options, capabilities, and errors.
10pub mod api;
11/// Platform decoder implementations and their retained surface types.
12pub mod backends;
13/// Annex-B parsing and H.264/H.265 configuration tracking.
14pub mod codecs;
15/// Small queue, mailbox, and RTP timestamp utilities for decode runtimes.
16pub mod runtime;
17
18pub use api::{
19    CodecCapability, CodecConfig, CodecStreamInfo, DecodedFrame, DecodedSurface,
20    DecoderCapabilities, DecoderOptions, DecoderStats, EncodedAccessUnit, FrameDimensions,
21    PixelFormat, SubmitOutcome, VideoCodec, VideoDecoder, VideoError, VideoTimestamp,
22};
23pub use codecs::{CodecConfigTracker, ConfigUpdate, H264Config, H265Config};
24
25#[cfg(target_os = "macos")]
26pub use backends::macos::{MacOsDecoder, MacOsVideoFrame};
27/// Decoder selected for the current native operating system.
28#[cfg(target_os = "macos")]
29pub type PlatformDecoder = MacOsDecoder;
30
31#[cfg(target_os = "linux")]
32pub use backends::linux::{LinuxDecoder, LinuxVideoFrame};
33/// Decoder selected for the current native operating system.
34#[cfg(target_os = "linux")]
35pub type PlatformDecoder = LinuxDecoder;
36
37#[cfg(target_os = "windows")]
38pub use backends::windows::{WindowsDecoder, WindowsNv12Frame, WindowsVideoFrame};
39/// Decoder selected for the current native operating system.
40#[cfg(target_os = "windows")]
41pub type PlatformDecoder = WindowsDecoder;
42
43#[cfg(target_os = "android")]
44pub use backends::android::{
45    AndroidDecoder, AndroidImagePlane, AndroidPresentedFrame, AndroidSurfaceDecoder,
46    AndroidVideoFrame,
47};
48/// Decoder selected for the current native operating system.
49#[cfg(target_os = "android")]
50pub type PlatformDecoder = AndroidDecoder;
51
52#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
53pub use backends::web::{WebDecoder, WebVideoFrame};
54/// Decoder selected for a browser/WebAssembly build.
55#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
56pub type PlatformDecoder = WebDecoder;