diff mbox series

[FFmpeg-devel] avcodec/decode: remove ff_decode_bsfs_uninit()

Message ID 20200520040011.864-1-jamrial@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avcodec/decode: remove ff_decode_bsfs_uninit() | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

James Almer May 20, 2020, 4 a.m. UTC
It's been a wrapper for a simple av_bsf_free() call since c96904f525.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/decode.c | 7 +------
 libavcodec/decode.h | 2 --
 libavcodec/utils.c  | 4 ++--
 3 files changed, 3 insertions(+), 10 deletions(-)

Comments

mypopy@gmail.com May 21, 2020, 12:34 a.m. UTC | #1
On Wed, May 20, 2020 at 12:08 PM James Almer <jamrial@gmail.com> wrote:
>
> It's been a wrapper for a simple av_bsf_free() call since c96904f525.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/decode.c | 7 +------
>  libavcodec/decode.h | 2 --
>  libavcodec/utils.c  | 4 ++--
>  3 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 48a61d5419..f3327d74af 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -231,7 +231,7 @@ int ff_decode_bsfs_init(AVCodecContext *avctx)
>
>      return 0;
>  fail:
> -    ff_decode_bsfs_uninit(avctx);
> +    av_bsf_free(&avci->bsf);
>      return ret;
>  }
>
> @@ -2005,8 +2005,3 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
>      if (!avctx->refcounted_frames)
>          av_frame_unref(avci->to_free);
>  }
> -
> -void ff_decode_bsfs_uninit(AVCodecContext *avctx)
> -{
> -    av_bsf_free(&avctx->internal->bsf);
> -}
> diff --git a/libavcodec/decode.h b/libavcodec/decode.h
> index c3e0e82f4c..0d69294def 100644
> --- a/libavcodec/decode.h
> +++ b/libavcodec/decode.h
> @@ -66,8 +66,6 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
>
>  int ff_decode_bsfs_init(AVCodecContext *avctx);
I think we better add a comment in the header if need to pairs using
ff_decode_bsfs_init/av_bsf_free
>
> -void ff_decode_bsfs_uninit(AVCodecContext *avctx);
> -
>  /**
>   * Make sure avctx.hw_frames_ctx is set. If it's not set, the function will
>   * try to allocate it from hw_device_ctx. If that is not possible, an error
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 91b271a717..3255679550 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1045,7 +1045,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>          av_packet_free(&avci->last_pkt_props);
>
>          av_packet_free(&avci->ds.in_pkt);
> -        ff_decode_bsfs_uninit(avctx);
> +        av_bsf_free(&avci->bsf);
>
>          av_buffer_unref(&avci->pool);
>      }
> @@ -1106,7 +1106,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
>              avctx->hwaccel->uninit(avctx);
>          av_freep(&avctx->internal->hwaccel_priv_data);
>
> -        ff_decode_bsfs_uninit(avctx);
> +        av_bsf_free(&avctx->internal->bsf);
>
>          av_freep(&avctx->internal);
>      }
> --
> 2.26.2
James Almer May 21, 2020, 3:41 p.m. UTC | #2
On 5/20/2020 9:34 PM, mypopy@gmail.com wrote:
> On Wed, May 20, 2020 at 12:08 PM James Almer <jamrial@gmail.com> wrote:
>>
>> It's been a wrapper for a simple av_bsf_free() call since c96904f525.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavcodec/decode.c | 7 +------
>>  libavcodec/decode.h | 2 --
>>  libavcodec/utils.c  | 4 ++--
>>  3 files changed, 3 insertions(+), 10 deletions(-)
>>
>> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>> index 48a61d5419..f3327d74af 100644
>> --- a/libavcodec/decode.c
>> +++ b/libavcodec/decode.c
>> @@ -231,7 +231,7 @@ int ff_decode_bsfs_init(AVCodecContext *avctx)
>>
>>      return 0;
>>  fail:
>> -    ff_decode_bsfs_uninit(avctx);
>> +    av_bsf_free(&avci->bsf);
>>      return ret;
>>  }
>>
>> @@ -2005,8 +2005,3 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
>>      if (!avctx->refcounted_frames)
>>          av_frame_unref(avci->to_free);
>>  }
>> -
>> -void ff_decode_bsfs_uninit(AVCodecContext *avctx)
>> -{
>> -    av_bsf_free(&avctx->internal->bsf);
>> -}
>> diff --git a/libavcodec/decode.h b/libavcodec/decode.h
>> index c3e0e82f4c..0d69294def 100644
>> --- a/libavcodec/decode.h
>> +++ b/libavcodec/decode.h
>> @@ -66,8 +66,6 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
>>
>>  int ff_decode_bsfs_init(AVCodecContext *avctx);
> I think we better add a comment in the header if need to pairs using
> ff_decode_bsfs_init/av_bsf_free

Added a comment to ff_decode_bsfs_init() and pushed.
diff mbox series

Patch

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 48a61d5419..f3327d74af 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -231,7 +231,7 @@  int ff_decode_bsfs_init(AVCodecContext *avctx)
 
     return 0;
 fail:
-    ff_decode_bsfs_uninit(avctx);
+    av_bsf_free(&avci->bsf);
     return ret;
 }
 
@@ -2005,8 +2005,3 @@  void avcodec_flush_buffers(AVCodecContext *avctx)
     if (!avctx->refcounted_frames)
         av_frame_unref(avci->to_free);
 }
-
-void ff_decode_bsfs_uninit(AVCodecContext *avctx)
-{
-    av_bsf_free(&avctx->internal->bsf);
-}
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index c3e0e82f4c..0d69294def 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -66,8 +66,6 @@  int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
 
 int ff_decode_bsfs_init(AVCodecContext *avctx);
 
-void ff_decode_bsfs_uninit(AVCodecContext *avctx);
-
 /**
  * Make sure avctx.hw_frames_ctx is set. If it's not set, the function will
  * try to allocate it from hw_device_ctx. If that is not possible, an error
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 91b271a717..3255679550 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1045,7 +1045,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
         av_packet_free(&avci->last_pkt_props);
 
         av_packet_free(&avci->ds.in_pkt);
-        ff_decode_bsfs_uninit(avctx);
+        av_bsf_free(&avci->bsf);
 
         av_buffer_unref(&avci->pool);
     }
@@ -1106,7 +1106,7 @@  av_cold int avcodec_close(AVCodecContext *avctx)
             avctx->hwaccel->uninit(avctx);
         av_freep(&avctx->internal->hwaccel_priv_data);
 
-        ff_decode_bsfs_uninit(avctx);
+        av_bsf_free(&avctx->internal->bsf);
 
         av_freep(&avctx->internal);
     }