fix: attempt to prevent a segfault when using custom io

This commit is contained in:
meh
2021-03-20 19:25:02 +01:00
parent 1a2fc1709d
commit 0469471ef6
+4 -2
View File
@@ -22,9 +22,11 @@ impl Drop for Destructor {
unsafe {
match self.mode {
Mode::Input => avformat_close_input(&mut self.ptr),
Mode::Output => {
avio_close((*self.ptr).pb);
if (*self.ptr).flags & AVFMT_NOFILE != 0 && !(*(*self.ptr).pb).av_class.is_null() {
avio_close((*self.ptr).pb);
}
avformat_free_context(self.ptr);
}
}