Expand description
Core types and traits for OxiMedia.
oximedia-core provides the foundational types and traits used throughout
the OxiMedia multimedia framework. This includes:
- Types: Rational numbers, timestamps, pixel/sample formats, codec IDs
- Traits: Decoder and demuxer interfaces
- Error handling: Unified error type with patent violation detection
- Memory management: Buffer pools for zero-copy operations
- HDR support: HDR metadata, transfer functions, color primaries, and conversions
§Green List Only
OxiMedia only supports patent-free codecs:
| Video | Audio | Subtitle |
|---|---|---|
| AV1 | Opus | WebVTT |
| VP9 | Vorbis | ASS/SSA |
| VP8 | FLAC | SRT |
| Theora | PCM |
Attempting to use patent-encumbered codecs (H.264, H.265, AAC, etc.)
will result in a PatentViolation error.
§Example
use oximedia_core::types::{Rational, Timestamp, PixelFormat, CodecId};
use oximedia_core::error::OxiResult;
fn example() -> OxiResult<()> {
// Create a timestamp at 1 second with millisecond precision
let ts = Timestamp::new(1000, Rational::new(1, 1000));
assert!((ts.to_seconds() - 1.0).abs() < f64::EPSILON);
// Check codec properties
let codec = CodecId::Av1;
assert!(codec.is_video());
// Check pixel format properties
let format = PixelFormat::Yuv420p;
assert!(format.is_planar());
assert_eq!(format.plane_count(), 3);
Ok(())
}Re-exports§
pub use error::OxiError;pub use error::OxiResult;pub use types::CodecId;pub use types::MediaType;pub use types::PixelFormat;pub use types::Rational;pub use types::SampleFormat;pub use types::Timestamp;
Modules§
- alloc
- Memory allocation utilities for
OxiMedia. - bitrate
- Bitrate estimation and file-size utilities.
- buffer_
pool - Frame buffer pool for zero-copy operations.
- channel_
layout - Audio channel layout definitions and utilities.
- codec_
info - Codec capability and information descriptors.
- codec_
matrix - Codec compatibility matrix helpers.
- codec_
negotiation - Codec negotiation utilities for
OxiMedia. - codec_
params - Codec parameter types for video and audio streams.
- color_
metadata - Color metadata: primaries, transfer characteristics, and matrix coefficients.
- convert
- Format conversion utilities for pixel and audio formats.
- downmix
- Downmix and upmix matrices for audio channel layout conversion.
- error
- Error types for
OxiMedia. - error_
context - Structured error context and error chaining utilities.
- event_
queue - Priority-aware media event queue.
- event_
stream - Time-indexed media event stream.
- fourcc
FourCC(Four Character Code) types and registry for codec/format identification.- frame_
info - Frame metadata and descriptor types.
- frame_
pool - Frame pool with configurable pre-allocation for low-latency pipelines.
- frame_
sharing - Zero-copy frame sharing via ref-counted buffers.
- hdr
- HDR (High Dynamic Range) metadata and conversion support.
- media_
clock - Media clock — monotonic media time, clock drift compensation, and PTS/DTS relationship tracking.
- media_
props - High-level media file property descriptors.
- media_
segment - Media segment data types for HLS/DASH/CMAF streaming pipelines.
- media_
time - Media timing primitives:
MediaTime,TimeRange, andMediaTimeCalc. - memory
- Core memory management primitives for
OxiMedia. - pixel_
format - Pixel format descriptions independent of the main
typesmodule. - pixel_
format_ color - Color primaries and matrix coefficients metadata for pixel formats.
- rational
- Rational number arithmetic for frame rates and time bases.
- resource_
handle - Resource handle tracking for media pipeline objects.
- ring_
buffer - Lock-free ring buffer for media streaming.
- sample_
conv - Audio sample format conversion utilities.
- sample_
format - Audio and video sample format definitions.
- sync
- Core synchronisation primitives for
OxiMedia. - timestamp_
arith - Timestamp arithmetic operations with overflow protection.
- traits
- Traits for multimedia components.
- type_
registry - Runtime type registry for media format negotiation.
- types
- Core types for multimedia processing.
- version
- Semantic versioning helpers for media codec and format metadata.
- work_
queue - A bounded, priority-aware work queue for media pipeline tasks.
- work_
steal - Work-stealing scheduler for multi-threaded media pipelines.