diff options
author | metamuffin <metamuffin@disroot.org> | 2024-01-28 17:55:11 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-01-28 17:55:11 +0100 |
commit | 727be96686a2c6c5747b26be15933e11c9cab9c6 (patch) | |
tree | 817accf6c4965e814cc8736fdbd17b423fae0669 /remuxer/src/lib.rs | |
parent | 5b587f2914908daa804bb643ac216001290077ab (diff) | |
download | jellything-727be96686a2c6c5747b26be15933e11c9cab9c6.tar jellything-727be96686a2c6c5747b26be15933e11c9cab9c6.tar.bz2 jellything-727be96686a2c6c5747b26be15933e11c9cab9c6.tar.zst |
clean up some code + subrip support?
Diffstat (limited to 'remuxer/src/lib.rs')
-rw-r--r-- | remuxer/src/lib.rs | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/remuxer/src/lib.rs b/remuxer/src/lib.rs index 96aeca1..b49dedc 100644 --- a/remuxer/src/lib.rs +++ b/remuxer/src/lib.rs @@ -61,13 +61,25 @@ pub fn ebml_track_entry( SourceTrackKind::Video { width, height, - fps: _, + display_height, + display_width, + fps, } => { els.push(MatroskaTag::TrackType(1)); - els.push(MatroskaTag::Video(Master::Collected(vec![ + let mut props = vec![ MatroskaTag::PixelWidth(width), MatroskaTag::PixelHeight(height), - ]))) + ]; + if let Some(display_width) = display_width { + props.push(MatroskaTag::DisplayWidth(display_width)) + } + if let Some(display_height) = display_height { + props.push(MatroskaTag::DisplayHeight(display_height)) + } + if let Some(fps) = fps { + props.push(MatroskaTag::FrameRate(fps)) + } + els.push(MatroskaTag::Video(Master::Collected(props))) } SourceTrackKind::Audio { channels, @@ -75,11 +87,14 @@ pub fn ebml_track_entry( bit_depth, } => { els.push(MatroskaTag::TrackType(2)); - els.push(MatroskaTag::Audio(Master::Collected(vec![ + let mut props = vec![ MatroskaTag::SamplingFrequency(sample_rate), MatroskaTag::Channels(channels.try_into().unwrap()), - ]))); - els.push(MatroskaTag::BitDepth(bit_depth.try_into().unwrap())); + ]; + if let Some(bit_depth) = bit_depth { + props.push(MatroskaTag::BitDepth(bit_depth.try_into().unwrap())); + } + els.push(MatroskaTag::Audio(Master::Collected(props))); } SourceTrackKind::Subtitles => { els.push(MatroskaTag::TrackType(17)); |