diff options
author | Guillaume Desmottes <guillaume.desmottes@onestream.live> | 2023-04-13 10:49:03 +0300 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@onestream.live> | 2023-04-13 10:50:15 +0300 |
commit | 367b98bfcb635ca61ebda336b05381bb9a508ffa (patch) | |
tree | a46b4ec57338e37bd8a20af168d8ec73f69e5e58 /mux | |
parent | 371ac83169f1c0eff730a1bb3f48dc5e5331aa06 (diff) |
fmp4: dash_vod example: reformat
Not sure why rustfmt updated those because of my previous change.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1177>
Diffstat (limited to 'mux')
-rw-r--r-- | mux/fmp4/examples/dash_vod.rs | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/mux/fmp4/examples/dash_vod.rs b/mux/fmp4/examples/dash_vod.rs index 3507927cc..2198a7c14 100644 --- a/mux/fmp4/examples/dash_vod.rs +++ b/mux/fmp4/examples/dash_vod.rs @@ -72,7 +72,10 @@ fn main() -> Result<(), Error> { // header, i.e. the `ftyp`, `moov` and other media boxes. // // This might be the initial header or the updated header at the end of the stream. - if first.flags().contains(gst::BufferFlags::DISCONT | gst::BufferFlags::HEADER) { + if first + .flags() + .contains(gst::BufferFlags::DISCONT | gst::BufferFlags::HEADER) + { let mut path = state.path.clone(); std::fs::create_dir_all(&path).expect("failed to create directory"); path.push("init.cmfi"); @@ -99,32 +102,47 @@ fn main() -> Result<(), Error> { // followed by one or more actual media buffers. assert!(first.flags().contains(gst::BufferFlags::HEADER)); - let segment = sample.segment().expect("no segment") - .downcast_ref::<gst::ClockTime>().expect("no time segment"); + let segment = sample + .segment() + .expect("no segment") + .downcast_ref::<gst::ClockTime>() + .expect("no time segment"); // Initialize the start time with the first PTS we observed. This will be used // later for calculating the duration of the whole media for the DASH manifest. // // The PTS of the segment header is equivalent to the earliest PTS of the whole // segment. - let pts = segment.to_running_time(first.pts().unwrap()).expect("can't get running time"); + let pts = segment + .to_running_time(first.pts().unwrap()) + .expect("can't get running time"); if state.start_time.is_none() { state.start_time = Some(pts); } // The metadata of the first media buffer is duplicated to the segment header. // Based on this we can know the timecode of the first frame in this segment. - let meta = first.meta::<gst_video::VideoTimeCodeMeta>().expect("no timecode meta"); + let meta = first + .meta::<gst_video::VideoTimeCodeMeta>() + .expect("no timecode meta"); let mut path = state.path.clone(); path.push(format!("segment_{}.cmfv", state.segments.len() + 1)); - println!("writing segment with timecode {} to {}", meta.tc(), path.display()); + println!( + "writing segment with timecode {} to {}", + meta.tc(), + path.display() + ); // Calculate the end time at this point. The duration of the segment header is set // to the whole duration of this segment. let duration = first.duration().unwrap(); let end_time = first.pts().unwrap() + first.duration().unwrap(); - state.end_time = Some(segment.to_running_time(end_time).expect("can't get running time")); + state.end_time = Some( + segment + .to_running_time(end_time) + .expect("can't get running time"), + ); let mut file = std::fs::File::create(path).expect("failed to open fragment"); for buffer in &*buffer_list { |