codec/context: more Into

This commit is contained in:
Tae-il Lim
2016-12-03 08:43:26 +09:00
committed by meh
parent 2ca2ff4a2c
commit edb6d91f59
2 changed files with 5 additions and 3 deletions

View File

@ -104,9 +104,11 @@ impl Context {
}
}
pub fn set_parameters(&mut self, params: &Parameters) -> Result<(), Error> {
pub fn set_parameters<P: Into<Parameters>>(&mut self, parameters: P) -> Result<(), Error> {
let parameters = parameters.into();
unsafe {
match avcodec_parameters_to_context(self.as_mut_ptr(), params.as_ptr()) {
match avcodec_parameters_to_context(self.as_mut_ptr(), parameters.as_ptr()) {
e if e < 0 => Err(Error::from(e)),
_ => Ok(()),
}