[FFmpeg-devel] [PATCH 2/2] lavc: check decoded subtitles encoding.

Clément Bœsch ubitux at gmail.com
Sun Apr 21 18:38:14 CEST 2013


On Sun, Apr 21, 2013 at 05:25:49PM +0200, Nicolas George wrote:
> Address trac ticket #2431.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavcodec/utils.c            |   31 ++++++++++++++++++++++++++++++-
>  tests/fate/subtitles.mak      |    8 ++++----
>  tests/ref/fate/sub-aqtitle    |    2 +-
>  tests/ref/fate/sub-subviewer1 |    2 +-
>  4 files changed, 36 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 1733d0f..1f4793c 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
[...]
>  
> +            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");

Not sure about the wording, possibly "The decoded subtitle line doesn't
look like UTF-8 so the input character encoding need to be known for
correct decoding (see -sub_charenc input option)\n".

> +                    avsubtitle_free(sub);
> +                    return AVERROR_INVALIDDATA;
> +                }
> +            }
> +

So if you don't have a build with iconv, you just can't decode it (ok,
partially) anymore? I would be much more comfortable with a warning...

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130421/96b763ff/attachment.asc>


More information about the ffmpeg-devel mailing list