mirror of
https://github.com/encounter/rust-ffmpeg-zmwangx.git
synced 2026-07-10 21:18:40 -07:00
Add Context::new_with_codec
Allows calling `avcodec_alloc_context3` with an AVCodec, setting the default values.
This commit is contained in:
@@ -41,6 +41,15 @@ impl Context {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_with_codec(codec: Codec) -> Self {
|
||||
unsafe {
|
||||
Context {
|
||||
ptr: avcodec_alloc_context3(codec.as_ptr()),
|
||||
owner: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_parameters<P: Into<Parameters>>(parameters: P) -> Result<Self, Error> {
|
||||
let parameters = parameters.into();
|
||||
let mut context = Self::new();
|
||||
|
||||
Reference in New Issue
Block a user