Skip to content

Commit

Permalink
Remove unecessary lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavenVolkoff committed Apr 20, 2024
1 parent eb873e5 commit fde5356
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions crates/ffmpeg/src/codec_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ pub(crate) struct FFmpegCodecContext {
ptr: *mut AVCodecContext,
}

impl<'a> FFmpegCodecContext {
impl FFmpegCodecContext {
pub(crate) fn new() -> Result<Self, Error> {
let ctx = unsafe { avcodec_alloc_context3(ptr::null_mut()) };
if ctx.is_null() {
Err(FFmpegError::VideoCodecAllocation)?;
}

Ok(Self {
ref_: *unsafe { ctx.as_mut::<'a>() }.ok_or(FFmpegError::NullError)?,
ref_: *unsafe { ctx.as_mut() }.ok_or(FFmpegError::NullError)?,
ptr: ctx,
})
}

pub(crate) fn as_ref(&'a self) -> &'a AVCodecContext {
pub(crate) fn as_ref(&self) -> &AVCodecContext {
&self.ref_
}

pub(crate) fn as_mut(&'a mut self) -> &'a mut AVCodecContext {
pub(crate) fn as_mut(&mut self) -> &mut AVCodecContext {
&mut self.ref_
}

Expand Down
8 changes: 4 additions & 4 deletions crates/ffmpeg/src/format_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub(crate) struct FFmpegFormatContext {
ptr: *mut AVFormatContext,
}

impl<'a> FFmpegFormatContext {
impl FFmpegFormatContext {
pub(crate) fn open_file(filename: CString, options: &mut FFmpegDict) -> Result<Self, Error> {
let mut ctx = ptr::null_mut();

Expand All @@ -68,16 +68,16 @@ impl<'a> FFmpegFormatContext {
)?;

Ok(Self {
ref_: *unsafe { ctx.as_mut::<'a>() }.ok_or(FFmpegError::NullError)?,
ref_: *unsafe { ctx.as_mut() }.ok_or(FFmpegError::NullError)?,
ptr: ctx,
})
}

pub(crate) fn as_ref(&'a self) -> &'a AVFormatContext {
pub(crate) fn as_ref(&self) -> &AVFormatContext {
&self.ref_
}

pub(crate) fn as_mut(&'a mut self) -> &'a mut AVFormatContext {
pub(crate) fn as_mut(&mut self) -> &mut AVFormatContext {
&mut self.ref_
}

Expand Down

0 comments on commit fde5356

Please sign in to comment.