Skip to main content

Crate ff_format

Crate ff_format 

Source
Expand description

§ff-format

Common types for video/audio processing - the Rust way.

This crate provides shared type definitions used across the ff-* crate family. It completely hides FFmpeg internals and provides Rust-idiomatic type safety.

§Module Structure

§Usage

use ff_format::prelude::*;

// Access pixel formats
let format = PixelFormat::Yuv420p;
assert!(format.is_planar());

// Access sample formats
let audio = SampleFormat::F32;
assert!(audio.is_float());
assert_eq!(audio.bytes_per_sample(), 4);

// Work with timestamps
let time_base = Rational::new(1, 90000);
let ts = Timestamp::new(90000, time_base);
assert!((ts.as_secs_f64() - 1.0).abs() < 0.001);

// Access color and codec types
use ff_format::color::ColorSpace;
use ff_format::codec::VideoCodec;
let space = ColorSpace::Bt709;
let codec = VideoCodec::H264;

Re-exports§

pub use channel::ChannelLayout;
pub use chapter::ChapterInfo;
pub use chapter::ChapterInfoBuilder;
pub use codec::AudioCodec;
pub use codec::SubtitleCodec;
pub use codec::VideoCodec;
pub use color::ColorPrimaries;
pub use color::ColorRange;
pub use color::ColorSpace;
pub use error::FormatError;
pub use error::FrameError;
pub use frame::AudioFrame;
pub use frame::VideoFrame;
pub use media::MediaInfo;
pub use media::MediaInfoBuilder;
pub use pixel::PixelFormat;
pub use sample::SampleFormat;
pub use stream::AudioStreamInfo;
pub use stream::AudioStreamInfoBuilder;
pub use stream::SubtitleStreamInfo;
pub use stream::SubtitleStreamInfoBuilder;
pub use stream::VideoStreamInfo;
pub use stream::VideoStreamInfoBuilder;
pub use time::Rational;
pub use time::Timestamp;

Modules§

channel
Audio channel layout definitions.
chapter
Chapter information.
codec
Video and audio codec definitions.
color
Color space and related type definitions.
error
Error types for ff-format crate.
frame
Video and audio frame types.
media
Media container information.
pixel
Pixel format definitions for video processing.
prelude
Prelude module for convenient imports.
sample
Audio sample format definitions for audio processing.
stream
Video and audio stream information.
time
Time primitives for video/audio processing.

Structs§

PooledBuffer
A buffer acquired from a FramePool.