Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,15 @@ pub fn output_as<P: AsRef<Path>>(path: &P, format: &str) -> Result<context::Outp
format.as_ptr(),
path.as_ptr(),
) {
0 => match avio_open(&mut (*ps).pb, path.as_ptr(), AVIO_FLAG_WRITE) {
0 => Ok(context::Output::wrap(ps)),
e => Err(Error::from(e)),
0 => {
let output = context::Output::wrap(ps);
if (output.format().flags() & flag::Flags::NO_FILE) == flag::Flags::NO_FILE {
return Ok(output);
}
match avio_open(&mut (*ps).pb, path.as_ptr(), AVIO_FLAG_WRITE) {
0 => Ok(output),
e => Err(Error::from(e)),
}
},

e => Err(Error::from(e)),
Expand All @@ -303,6 +309,10 @@ pub fn output_as_with<P: AsRef<Path>>(
path.as_ptr(),
) {
0 => {
let output = context::Output::wrap(ps);
if (output.format().flags() & flag::Flags::NO_FILE) == flag::Flags::NO_FILE {
return Ok(output);
}
let res = avio_open2(
&mut (*ps).pb,
path.as_ptr(),
Expand All @@ -314,7 +324,7 @@ pub fn output_as_with<P: AsRef<Path>>(
Dictionary::own(opts);

match res {
0 => Ok(context::Output::wrap(ps)),
0 => Ok(output),
e => Err(Error::from(e)),
}
}
Expand Down