From e24a026c58c07a2800662b9f5f4fd3f61d53c1d1 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 18 Jan 2023 19:13:36 +0100 Subject: player config works --- common/src/impl.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'common/src/impl.rs') 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 + )) + } +} -- cgit v1.2.3-70-g09d2