use std::time::Duration;
use serde::{Deserialize, Serialize};
use crate::{
audio::{ChannelLayout, SampleRate},
codec::{Codec, CodecLevel, CodecProfile},
color::{ColorRange, ColorSpace, PixelFormat},
spatial::{FrameRate, Resolution},
types::TrackKind,
};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Track {
pub index: usize,
pub kind: TrackKind,
pub codec: Option<Codec>,
pub bitrate: Option<u64>,
pub language: Option<String>,
pub is_default: bool,
pub title: Option<String>,
pub duration: Option<Duration>,
pub video: Option<VideoTrackInfo>,
pub audio: Option<AudioTrackInfo>,
pub subtitle: Option<SubtitleTrackInfo>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VideoTrackInfo {
pub resolution: Resolution,
pub frame_rate: Option<FrameRate>,
pub pixel_format: Option<PixelFormat>,
pub rotation: Option<i16>,
pub color_space: Option<ColorSpace>,
pub color_range: Option<ColorRange>,
pub bit_depth: Option<u8>,
pub profile: Option<CodecProfile>,
pub level: Option<CodecLevel>,
pub hdr: Option<HdrMetadata>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HdrMetadata {
pub format: HdrFormat,
pub mastering_display: Option<MasteringDisplay>,
pub content_light_level: Option<ContentLightLevel>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum HdrFormat {
Hdr10,
Hdr10Plus,
DolbyVision,
Hlg,
Pq,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MasteringDisplay {
pub primaries: Option<[(f64, f64); 3]>,
pub white_point: Option<(f64, f64)>,
pub luminance: Option<(f64, f64)>,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub struct ContentLightLevel {
pub max_cll: u32,
pub max_fall: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AudioTrackInfo {
pub sample_rate: SampleRate,
pub channels: ChannelLayout,
pub bit_depth: Option<u8>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SubtitleTrackInfo {
pub format: String,
pub forced: bool,
}