[FFmpeg-devel] [PATCH] libavcodec: Do not return encoding errors when -sub_charenc_mode is do_nothing

wm4 nfxjfg at googlemail.com
Wed Aug 28 23:29:15 CEST 2013


On Wed, 28 Aug 2013 23:20:43 +0200
Eelco Lempsink <eelco at lempsink.nl> wrote:

> Signed-off-by: Eelco Lempsink <eml at tupil.com>
> ---
>  libavcodec/utils.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index d77b5ec..2b1e92d 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -2294,11 +2294,16 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
>  
>              for (i = 0; i < sub->num_rects; i++) {
>                  if (sub->rects[i]->ass && !utf8_check(sub->rects[i]->ass)) {
> -                    av_log(avctx, AV_LOG_ERROR,
> -                           "Invalid UTF-8 in decoded subtitles text; "
> -                           "maybe missing -sub_charenc option\n");
> -                    avsubtitle_free(sub);
> -                    return AVERROR_INVALIDDATA;
> +                    if (avctx->sub_charenc_mode != FF_SUB_CHARENC_MODE_DO_NOTHING) {
> +                        av_log(avctx, AV_LOG_ERROR,
> +                               "Invalid UTF-8 in decoded subtitles text; "
> +                               "maybe missing -sub_charenc option\n");
> +                        avsubtitle_free(sub);
> +                        return AVERROR_INVALIDDATA;
> +                    } else {
> +                        av_log(avctx, AV_LOG_WARNING,
> +                               "Invalid UTF-8 in decoded subtitles text.\n");
> +                    }
>                  }
>              }
>  

+1


More information about the ffmpeg-devel mailing list