ff_format/stream/mod.rs
1//! Video, audio, and subtitle stream information.
2//!
3//! This module provides structs for representing metadata about the
4//! streams within media files.
5//!
6//! # Examples
7//!
8//! ```
9//! use ff_format::stream::{VideoStreamInfo, AudioStreamInfo};
10//! use ff_format::{PixelFormat, SampleFormat, Rational};
11//! use ff_format::codec::{VideoCodec, AudioCodec};
12//! use ff_format::color::{ColorSpace, ColorRange, ColorPrimaries};
13//! use ff_format::channel::ChannelLayout;
14//! use std::time::Duration;
15//!
16//! // Create video stream info
17//! let video = VideoStreamInfo::builder()
18//! .index(0)
19//! .codec(VideoCodec::H264)
20//! .width(1920)
21//! .height(1080)
22//! .frame_rate(Rational::new(30, 1))
23//! .pixel_format(PixelFormat::Yuv420p)
24//! .build();
25//!
26//! assert_eq!(video.width(), 1920);
27//! assert_eq!(video.height(), 1080);
28//!
29//! // Create audio stream info
30//! let audio = AudioStreamInfo::builder()
31//! .index(1)
32//! .codec(AudioCodec::Aac)
33//! .sample_rate(48000)
34//! .channels(2)
35//! .sample_format(SampleFormat::F32)
36//! .build();
37//!
38//! assert_eq!(audio.sample_rate(), 48000);
39//! assert_eq!(audio.channels(), 2);
40//! ```
41
42mod audio;
43mod subtitle;
44mod video;
45
46pub use audio::{AudioStreamInfo, AudioStreamInfoBuilder};
47pub use subtitle::{SubtitleStreamInfo, SubtitleStreamInfoBuilder};
48pub use video::{VideoStreamInfo, VideoStreamInfoBuilder};