summaryrefslogtreecommitdiffstats
path: root/libavcodec/decode.c
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2018-03-24 13:37:00 +0100
committerwm4 <nfxjfg@googlemail.com>2018-03-25 19:27:02 +0200
commitb7d0d912ef9b60eae962e4622d72860af31a8b00 (patch)
treeeee27e364492a1cfafb4b7cb81c42d79384d5f20 /libavcodec/decode.c
parent5b31dd1c6b1e35d91ce068d6cd20eb4a3d3faa38 (diff)
downloadffmpeg-streaming-b7d0d912ef9b60eae962e4622d72860af31a8b00.zip
ffmpeg-streaming-b7d0d912ef9b60eae962e4622d72860af31a8b00.tar.gz
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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index ea2168a..40c8a88 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");
OpenPOWER on IntegriCloud