diff --git a/src/format/context/destructor.rs b/src/format/context/destructor.rs index 42b41c3..e5c67fc 100644 --- a/src/format/context/destructor.rs +++ b/src/format/context/destructor.rs @@ -23,7 +23,13 @@ impl Drop for Destructor { match self.mode { Mode::Input => avformat_close_input(&mut self.ptr), Mode::Output => { - if (*self.ptr).flags & AVFMT_NOFILE != 0 && !(*(*self.ptr).pb).av_class.is_null() { + if (*self.ptr).flags & AVFMT_NOFILE != 0 + && (*self.ptr) + .pb + .as_ref() + .map(|pb| !(*pb).av_class.is_null()) + .unwrap_or(false) + { avio_close((*self.ptr).pb); } diff --git a/src/format/format/input.rs b/src/format/format/input.rs index 318b2ec..836ff78 100644 --- a/src/format/format/input.rs +++ b/src/format/format/input.rs @@ -7,8 +7,8 @@ pub struct Input { ptr: *mut AVInputFormat, } -unsafe impl Send for Input { } -unsafe impl Sync for Input { } +unsafe impl Send for Input {} +unsafe impl Sync for Input {} impl Input { pub unsafe fn wrap(ptr: *mut AVInputFormat) -> Self { diff --git a/src/format/format/output.rs b/src/format/format/output.rs index 56e3fda..2ff177e 100644 --- a/src/format/format/output.rs +++ b/src/format/format/output.rs @@ -13,8 +13,8 @@ pub struct Output { ptr: *mut AVOutputFormat, } -unsafe impl Send for Output { } -unsafe impl Sync for Output { } +unsafe impl Send for Output {} +unsafe impl Sync for Output {} impl Output { pub unsafe fn wrap(ptr: *mut AVOutputFormat) -> Self {