[FFmpeg-devel] [PATCH] avcodec/decode: Do not output subtitle frames if the packet is marked with `AV_PKT_FLAG_DISCARD`.

Darren Mo fumoboy007 at me.com
Wed May 22 20:10:27 EEST 2019


Bump.

> On Apr 29, 2019, at 3:45 PM, fumoboy007 <fumoboy007 at me.com> wrote:
> 
> One situation where a subtitle packet can be marked for discard is when demuxing an MOV file that has an edit list.
> ---
> libavcodec/decode.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 6c31166ec2..204bd50fa3 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1149,8 +1149,14 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
>             }
>         }
> 
> -        if (*got_sub_ptr)
> -            avctx->frame_number++;
> +        if (*got_sub_ptr) {
> +            if (avpkt->flags & AV_PKT_FLAG_DISCARD) {
> +                *got_sub_ptr = 0;
> +                avsubtitle_free(sub);
> +            } else {
> +                avctx->frame_number++;
> +            }
> +        }
>     }
> 
>     return ret;
> -- 
> 2.21.0
> 



More information about the ffmpeg-devel mailing list