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

Eelco Lempsink eelco at lempsink.nl
Wed Aug 28 23:20:43 CEST 2013


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.7.12.4 (Apple Git-37)



More information about the ffmpeg-devel mailing list