From 5bb3dde74e4099675fe8743b718371a46dc3823e Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Mon, 9 Oct 2017 21:44:48 -0700 Subject: [PATCH] work around #10 with advanced_editlist=false I think this is an ffmpeg bug, which I plan to report. In the meantime, this makes the tests pass. Long-term, even if ffmpeg fixes this, I probably don't want to continue doing acceptance tests against whatever version of ffmpeg happens to be installed - my real targets of interest are the latest versions of Chrome, Firefox, Safari, QuickTime, and VLC. --- src/stream.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/stream.rs b/src/stream.rs index bf7be80..05e143a 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -82,10 +82,20 @@ impl Opener for Ffmpeg { use moonfire_ffmpeg::InputFormatContext; let (mut input, discard_first) = match src { #[cfg(test)] - Source::File(filename) => - (InputFormatContext::open(&CString::new(format!("file:{}", filename)).unwrap(), - &mut moonfire_ffmpeg::Dictionary::new())?, - false), + Source::File(filename) => { + let mut open_options = moonfire_ffmpeg::Dictionary::new(); + + // Work around https://github.com/scottlamb/moonfire-nvr/issues/10 + open_options.set(c_str!("advanced_editlist"), c_str!("false")).unwrap(); + let url = format!("file:{}", filename); + let i = InputFormatContext::open(&CString::new(url.clone()).unwrap(), + &mut open_options)?; + if !open_options.empty() { + warn!("While opening URL {}, some options were not understood: {}", + url, open_options); + } + (i, false) + } Source::Rtsp(url) => { let mut open_options = moonfire_ffmpeg::Dictionary::new(); open_options.set(c_str!("rtsp_transport"), c_str!("tcp")).unwrap();