Skip to content

Commit

Permalink
Add function for creating codec context for codec.
Browse files Browse the repository at this point in the history
  • Loading branch information
hgaiser committed Feb 29, 2024
1 parent 55e2e49 commit 4dfa731
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/codec/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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();
Expand Down

0 comments on commit 4dfa731

Please sign in to comment.