diff --git a/src/codec/encoder/audio.rs b/src/codec/encoder/audio.rs index 25045bb..41f9190 100644 --- a/src/codec/encoder/audio.rs +++ b/src/codec/encoder/audio.rs @@ -35,6 +35,20 @@ impl Audio { } } + pub fn open_with(mut self, options: Dictionary) -> Result { + unsafe { + let mut opts = options.disown(); + let res = avcodec_open2(self.as_mut_ptr(), ptr::null(), &mut opts); + + Dictionary::own(opts); + + match res { + 0 => Ok(Encoder(self)), + e => Err(Error::from(e)) + } + } + } + pub fn open_as_with(mut self, codec: E, options: Dictionary) -> Result { unsafe { if let Some(codec) = codec.encoder() {