use std::collections::BTreeMap; use relm4::SharedState; pub type StreamIndex = usize; #[derive(Debug, Clone)] pub struct TrackMetadata { pub language: Option, pub title: Option, } #[derive(Debug, Clone)] pub struct SubtitleTrack { pub metadata: TrackMetadata, pub cues: Vec, } #[derive(Debug, Clone)] pub struct SubtitleCue { pub start: gst::ClockTime, pub end: gst::ClockTime, pub text: String, } pub static SUBTITLE_TRACKS: SharedState> = SharedState::new(); impl TrackMetadata { pub fn from_ffmpeg_stream(stream: &ffmpeg::Stream) -> Self { let language_code = stream.metadata().get("language").map(|s| s.to_string()); let title = stream.metadata().get("title").map(|s| s.to_string()); Self { language: language_code.and_then(|code| isolang::Language::from_639_2b(&code)), title, } } }