diff --git a/src/codec/decoder/mod.rs b/src/codec/decoder/mod.rs index d8abe631..c942ba95 100644 --- a/src/codec/decoder/mod.rs +++ b/src/codec/decoder/mod.rs @@ -34,7 +34,7 @@ pub fn new() -> Decoder { pub fn find(id: Id) -> Option { unsafe { - let ptr = avcodec_find_decoder(id.into()) as *mut AVCodec; + let ptr = avcodec_find_decoder(id.into()); if ptr.is_null() { None @@ -47,7 +47,7 @@ pub fn find(id: Id) -> Option { pub fn find_by_name(name: &str) -> Option { unsafe { let name = CString::new(name).unwrap(); - let ptr = avcodec_find_decoder_by_name(name.as_ptr()) as *mut AVCodec; + let ptr = avcodec_find_decoder_by_name(name.as_ptr()); if ptr.is_null() { None diff --git a/src/codec/encoder/mod.rs b/src/codec/encoder/mod.rs index 4802ee67..13590759 100644 --- a/src/codec/encoder/mod.rs +++ b/src/codec/encoder/mod.rs @@ -37,7 +37,7 @@ pub fn new() -> Encoder { pub fn find(id: Id) -> Option { unsafe { - let ptr = avcodec_find_encoder(id.into()) as *mut AVCodec; + let ptr = avcodec_find_encoder(id.into()); if ptr.is_null() { None @@ -50,7 +50,7 @@ pub fn find(id: Id) -> Option { pub fn find_by_name(name: &str) -> Option { unsafe { let name = CString::new(name).unwrap(); - let ptr = avcodec_find_encoder_by_name(name.as_ptr()) as *mut AVCodec; + let ptr = avcodec_find_encoder_by_name(name.as_ptr()); if ptr.is_null() { None diff --git a/src/device/input.rs b/src/device/input.rs index 17887a2b..548d2379 100644 --- a/src/device/input.rs +++ b/src/device/input.rs @@ -11,7 +11,7 @@ impl Iterator for AudioIter { fn next(&mut self) -> Option<::Item> { unsafe { - let ptr = av_input_audio_device_next(self.0) as *mut AVInputFormat; + let ptr = av_input_audio_device_next(self.0); if ptr.is_null() && !self.0.is_null() { None @@ -35,7 +35,7 @@ impl Iterator for VideoIter { fn next(&mut self) -> Option<::Item> { unsafe { - let ptr = av_input_video_device_next(self.0) as *mut AVInputFormat; + let ptr = av_input_video_device_next(self.0); if ptr.is_null() && !self.0.is_null() { None diff --git a/src/device/output.rs b/src/device/output.rs index b8c723b0..995fef8d 100644 --- a/src/device/output.rs +++ b/src/device/output.rs @@ -11,12 +11,12 @@ impl Iterator for AudioIter { fn next(&mut self) -> Option<::Item> { unsafe { - let ptr = av_output_audio_device_next(self.0) as *mut AVOutputFormat; + let ptr = av_output_audio_device_next(self.0); if ptr.is_null() && !self.0.is_null() { None } else { - self.0 = ptr as *mut AVOutputFormat; + self.0 = ptr; Some(Format::Output(format::Output::wrap(ptr))) } @@ -35,12 +35,12 @@ impl Iterator for VideoIter { fn next(&mut self) -> Option<::Item> { unsafe { - let ptr = av_output_video_device_next(self.0) as *mut AVOutputFormat; + let ptr = av_output_video_device_next(self.0); if ptr.is_null() && !self.0.is_null() { None } else { - self.0 = ptr as *mut AVOutputFormat; + self.0 = ptr; Some(Format::Output(format::Output::wrap(ptr))) } diff --git a/src/format/context/input.rs b/src/format/context/input.rs index e043dd24..5f9cf474 100644 --- a/src/format/context/input.rs +++ b/src/format/context/input.rs @@ -36,7 +36,7 @@ impl Input { impl Input { pub fn format(&self) -> format::Input { - unsafe { format::Input::wrap((*self.as_ptr()).iformat as *mut AVInputFormat) } + unsafe { format::Input::wrap((*self.as_ptr()).iformat) } } #[cfg(not(feature = "ffmpeg_5_0"))] diff --git a/src/format/context/output.rs b/src/format/context/output.rs index 84bac414..50797f64 100644 --- a/src/format/context/output.rs +++ b/src/format/context/output.rs @@ -37,7 +37,7 @@ impl Output { impl Output { pub fn format(&self) -> format::Output { - unsafe { format::Output::wrap((*self.as_ptr()).oformat as *mut AVOutputFormat) } + unsafe { format::Output::wrap((*self.as_ptr()).oformat) } } pub fn write_header(&mut self) -> Result<(), Error> { diff --git a/src/software/scaling/context.rs b/src/software/scaling/context.rs index 4487b567..0469a23e 100644 --- a/src/software/scaling/context.rs +++ b/src/software/scaling/context.rs @@ -155,7 +155,7 @@ impl Context { (*input.as_ptr()).linesize.as_ptr() as *const _, 0, self.input.height as c_int, - (*output.as_mut_ptr()).data.as_ptr() as *const *mut _, + (*output.as_mut_ptr()).data.as_ptr(), (*output.as_mut_ptr()).linesize.as_ptr() as *mut _, ); }