diff options
author | wm4 <nfxjfg@googlemail.com> | 2018-03-24 15:37:00 +0300 |
---|---|---|
committer | wm4 <nfxjfg@googlemail.com> | 2018-03-25 20:27:02 +0300 |
commit | b7d0d912ef9b60eae962e4622d72860af31a8b00 (patch) | |
tree | eee27e364492a1cfafb4b7cb81c42d79384d5f20 /libavcodec/decode.c | |
parent | 5b31dd1c6b1e35d91ce068d6cd20eb4a3d3faa38 (diff) |
avcodec: add a subcharenc mode that disables UTF-8 check
This is for applications which want to explicitly check for invalid
UTF-8 manually, and take actions that are better than dropping invalid
subtitles silently. (It's pretty much silent because sporadic avcodec
error messages are so common that you can't reasonably display them in a
prominent and meaningful way in a application GUI.)
Diffstat (limited to 'libavcodec/decode.c')
-rw-r--r-- | libavcodec/decode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c index ea2168ad0c..40c8a8855c 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1057,7 +1057,8 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, sub->format = 1; for (i = 0; i < sub->num_rects; i++) { - if (sub->rects[i]->ass && !utf8_check(sub->rects[i]->ass)) { + if (avctx->sub_charenc_mode != FF_SUB_CHARENC_MODE_IGNORE && + 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"); |