diff options
author | metamuffin <metamuffin@disroot.org> | 2023-01-18 19:13:36 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-01-18 19:13:36 +0100 |
commit | e24a026c58c07a2800662b9f5f4fd3f61d53c1d1 (patch) | |
tree | 91c158ff294508f903f2489f204e313700d42828 /common/src/impl.rs | |
parent | 46ef75431e1d34c63a690726a8ef584d175ddd30 (diff) | |
download | jellything-e24a026c58c07a2800662b9f5f4fd3f61d53c1d1.tar jellything-e24a026c58c07a2800662b9f5f4fd3f61d53c1d1.tar.bz2 jellything-e24a026c58c07a2800662b9f5f4fd3f61d53c1d1.tar.zst |
player config works
Diffstat (limited to 'common/src/impl.rs')
-rw-r--r-- | common/src/impl.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/common/src/impl.rs b/common/src/impl.rs index 0808eb8..c17f1ec 100644 --- a/common/src/impl.rs +++ b/common/src/impl.rs @@ -1,4 +1,4 @@ -use crate::SourceTrackKind; +use crate::{SourceTrack, SourceTrackKind}; impl SourceTrackKind { pub fn letter(&self) -> char { @@ -9,3 +9,23 @@ impl SourceTrackKind { } } } + +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 + )) + } +} |