Skip to content

Commit

Permalink
Put the human-readable part first
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Oct 8, 2024
1 parent c84b40a commit 15b98f1
Showing 1 changed file with 16 additions and 32 deletions.
48 changes: 16 additions & 32 deletions crates/store/re_video/src/demux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,39 +91,23 @@ impl VideoData {
/// The codec used to encode the video.
#[inline]
pub fn human_readable_codec_string(&self) -> String {
let mut string = self.config.stsd.contents.codec_string().unwrap_or_default();

match &self.config.stsd.contents {
re_mp4::StsdBoxContent::Av01 { .. } => {
string += " (AV1)";
}
re_mp4::StsdBoxContent::Avc1 { .. } => {
string += " (H.264)";
}
re_mp4::StsdBoxContent::Hvc1 { .. } => {
string += " (H.265 HVC1)";
}
re_mp4::StsdBoxContent::Hev1 { .. } => {
string += " (H.265 HEV1)";
}
re_mp4::StsdBoxContent::Vp08 { .. } => {
string += " (VP8)";
}
re_mp4::StsdBoxContent::Vp09 { .. } => {
string += " (VP9)";
}
re_mp4::StsdBoxContent::Mp4a { .. } => {
string += " (AAC)";
}
re_mp4::StsdBoxContent::Tx3g { .. } => {
string += " (TTXT)";
}
re_mp4::StsdBoxContent::Unknown(four_cc) => {
string += &format!(" ({four_cc})");
}
let human_readable = match &self.config.stsd.contents {
re_mp4::StsdBoxContent::Av01(_) => "AV1",
re_mp4::StsdBoxContent::Avc1(_) => "H.264",
re_mp4::StsdBoxContent::Hvc1(_) => "H.265 HVC1",
re_mp4::StsdBoxContent::Hev1(_) => "H.265 HEV1",
re_mp4::StsdBoxContent::Vp08(_) => "VP8",
re_mp4::StsdBoxContent::Vp09(_) => "VP9",
re_mp4::StsdBoxContent::Mp4a(_) => "AAC",
re_mp4::StsdBoxContent::Tx3g(_) => "TTXT",
re_mp4::StsdBoxContent::Unknown(_) => "Unknown",
};

if let Some(codec) = self.config.stsd.contents.codec_string() {
format!("{human_readable} ({codec})")
} else {
human_readable.to_owned()
}

string
}

/// The number of samples in the video.
Expand Down

0 comments on commit 15b98f1

Please sign in to comment.