diff mbox series

[FFmpeg-devel] avcodec/cuviddec: remove unused AVCodec.decode() callback

Message ID 20210617174541.54637-1-jamrial@gmail.com
State Accepted
Commit 854a9d8c6e6e450b43f94c566c13f7956f6defcc
Headers show
Series [FFmpeg-devel] avcodec/cuviddec: remove unused AVCodec.decode() callback | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer June 17, 2021, 5:45 p.m. UTC
The AVCodec.receive_frame() callback takes precedence.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/cuviddec.c | 32 --------------------------------
 1 file changed, 32 deletions(-)

Comments

James Almer June 21, 2021, 5:56 p.m. UTC | #1
On 6/17/2021 2:45 PM, James Almer wrote:
> The AVCodec.receive_frame() callback takes precedence.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/cuviddec.c | 32 --------------------------------
>   1 file changed, 32 deletions(-)
> 
> diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
> index c3496259dc..d8c7f23a37 100644
> --- a/libavcodec/cuviddec.c
> +++ b/libavcodec/cuviddec.c
> @@ -646,37 +646,6 @@ error:
>           return ret;
>   }
>   
> -static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
> -{
> -    CuvidContext *ctx = avctx->priv_data;
> -    AVFrame *frame = data;
> -    int ret = 0;
> -
> -    av_log(avctx, AV_LOG_TRACE, "cuvid_decode_frame\n");
> -
> -    if (ctx->deint_mode_current != cudaVideoDeinterlaceMode_Weave) {
> -        av_log(avctx, AV_LOG_ERROR, "Deinterlacing is not supported via the old API\n");
> -        return AVERROR(EINVAL);
> -    }
> -
> -    if (!ctx->decoder_flushing) {
> -        ret = cuvid_decode_packet(avctx, avpkt);
> -        if (ret < 0)
> -            return ret;
> -    }
> -
> -    ret = cuvid_output_frame(avctx, frame);
> -    if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
> -        *got_frame = 0;
> -    } else if (ret < 0) {
> -        return ret;
> -    } else {
> -        *got_frame = 1;
> -    }
> -
> -    return 0;
> -}
> -
>   static av_cold int cuvid_decode_end(AVCodecContext *avctx)
>   {
>       CuvidContext *ctx = avctx->priv_data;
> @@ -1143,7 +1112,6 @@ static const AVCodecHWConfigInternal *const cuvid_hw_configs[] = {
>           .priv_class     = &x##_cuvid_class, \
>           .init           = cuvid_decode_init, \
>           .close          = cuvid_decode_end, \
> -        .decode         = cuvid_decode_frame, \
>           .receive_frame  = cuvid_output_frame, \
>           .flush          = cuvid_flush, \
>           .bsfs           = bsf_name, \

Will apply.
Timo Rothenpieler June 21, 2021, 6 p.m. UTC | #2
On 21.06.2021 19:56, James Almer wrote:
> On 6/17/2021 2:45 PM, James Almer wrote:
>> The AVCodec.receive_frame() callback takes precedence.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavcodec/cuviddec.c | 32 --------------------------------
>>   1 file changed, 32 deletions(-)
>>
>> diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
>> index c3496259dc..d8c7f23a37 100644
>> --- a/libavcodec/cuviddec.c
>> +++ b/libavcodec/cuviddec.c
>> @@ -646,37 +646,6 @@ error:
>>           return ret;
>>   }
>> -static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int 
>> *got_frame, AVPacket *avpkt)
>> -{
>> -    CuvidContext *ctx = avctx->priv_data;
>> -    AVFrame *frame = data;
>> -    int ret = 0;
>> -
>> -    av_log(avctx, AV_LOG_TRACE, "cuvid_decode_frame\n");
>> -
>> -    if (ctx->deint_mode_current != cudaVideoDeinterlaceMode_Weave) {
>> -        av_log(avctx, AV_LOG_ERROR, "Deinterlacing is not supported 
>> via the old API\n");
>> -        return AVERROR(EINVAL);
>> -    }
>> -
>> -    if (!ctx->decoder_flushing) {
>> -        ret = cuvid_decode_packet(avctx, avpkt);
>> -        if (ret < 0)
>> -            return ret;
>> -    }
>> -
>> -    ret = cuvid_output_frame(avctx, frame);
>> -    if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
>> -        *got_frame = 0;
>> -    } else if (ret < 0) {
>> -        return ret;
>> -    } else {
>> -        *got_frame = 1;
>> -    }
>> -
>> -    return 0;
>> -}
>> -
>>   static av_cold int cuvid_decode_end(AVCodecContext *avctx)
>>   {
>>       CuvidContext *ctx = avctx->priv_data;
>> @@ -1143,7 +1112,6 @@ static const AVCodecHWConfigInternal *const 
>> cuvid_hw_configs[] = {
>>           .priv_class     = &x##_cuvid_class, \
>>           .init           = cuvid_decode_init, \
>>           .close          = cuvid_decode_end, \
>> -        .decode         = cuvid_decode_frame, \
>>           .receive_frame  = cuvid_output_frame, \
>>           .flush          = cuvid_flush, \
>>           .bsfs           = bsf_name, \
> 
> Will apply.
looks good to me!
diff mbox series

Patch

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index c3496259dc..d8c7f23a37 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -646,37 +646,6 @@  error:
         return ret;
 }
 
-static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
-{
-    CuvidContext *ctx = avctx->priv_data;
-    AVFrame *frame = data;
-    int ret = 0;
-
-    av_log(avctx, AV_LOG_TRACE, "cuvid_decode_frame\n");
-
-    if (ctx->deint_mode_current != cudaVideoDeinterlaceMode_Weave) {
-        av_log(avctx, AV_LOG_ERROR, "Deinterlacing is not supported via the old API\n");
-        return AVERROR(EINVAL);
-    }
-
-    if (!ctx->decoder_flushing) {
-        ret = cuvid_decode_packet(avctx, avpkt);
-        if (ret < 0)
-            return ret;
-    }
-
-    ret = cuvid_output_frame(avctx, frame);
-    if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
-        *got_frame = 0;
-    } else if (ret < 0) {
-        return ret;
-    } else {
-        *got_frame = 1;
-    }
-
-    return 0;
-}
-
 static av_cold int cuvid_decode_end(AVCodecContext *avctx)
 {
     CuvidContext *ctx = avctx->priv_data;
@@ -1143,7 +1112,6 @@  static const AVCodecHWConfigInternal *const cuvid_hw_configs[] = {
         .priv_class     = &x##_cuvid_class, \
         .init           = cuvid_decode_init, \
         .close          = cuvid_decode_end, \
-        .decode         = cuvid_decode_frame, \
         .receive_frame  = cuvid_output_frame, \
         .flush          = cuvid_flush, \
         .bsfs           = bsf_name, \