1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use crate::{SourceTrack, SourceTrackKind};
impl SourceTrackKind {
pub fn letter(&self) -> char {
match self {
SourceTrackKind::Video { .. } => 'v',
SourceTrackKind::Audio { .. } => 'a',
SourceTrackKind::Subtitles => 's',
}
}
}
impl std::fmt::Display for SourceTrack {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let kspec = match &self.kind {
SourceTrackKind::Video { width, height, fps } => {
format!("Video: {width}x{height} {fps}fps ")
}
SourceTrackKind::Audio {
channels,
sample_rate,
bit_depth,
} => format!("Audio: {channels}ch {sample_rate}Hz {bit_depth}bits "),
SourceTrackKind::Subtitles => format!("Subtitles: "),
};
f.write_fmt(format_args!(
"{} {:?} {} ({})",
kspec, self.name, self.language, self.codec
))
}
}
|