[FFmpeg-devel] [PATCH] SubRip decoder

Alexander Strange astrange
Sun Nov 28 23:53:04 CET 2010


On Nov 28, 2010, at 5:31 PM, Aurelien Jacobs wrote:

> Hi,
> 
> $subject
> 
> This SubRip decoder supports all the SubRip features that I know about.
> It especially support everything tested by the sample files from
> http://ale5000.altervista.org/subtitles.htm

What generates files with moving display coordinates?

None of those players support them, and neither does vsfilter:

http://google.com/codesearch/p?hl=en#_g4u1OIsR_M/trunk/src/subtitles/STS.cpp&q=package:vsfilter%20subrip&l=476

Until the day comes when WebSRT is relevant, we might as well be parser compatible with vsfilter and ignore them.

> +    snprintf(header, sizeof(header),
> +             "[Script Info]\r\n"
> +             "ScriptType: v4.00+\r\n"
> +             "\r\n"
> +             "[V4+ Styles]\r\n"

Watch out for the weird default PlayRes* values.

> + * Copyright (c) 2010  Aurelien Jacobs <aurel at gnuage.org>

Double space.

> +        case '{':
> +            an += sscanf(in, "{\\an%*1u}%c", &c) == 1;
> +            if ((an != 1 && sscanf(in, "{\\%*[^}]}%n%c", &len, &c) > 0) ||
> +                sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n%c", &len, &c) > 0) {
> +                in += len - 1;
> +            } else
> +                *out++ = *in;
> +            break;


What does this do? I hate reading handwritten parsers...

> +                    int i, j, unkown = 0;


'unknown'

> +static const char *read_ts(const char *buf, int *ts_start, int *ts_end,
> +                           int *x1, int *y1, int *x2, int *y2)
> +{
> +    int i, hs, ms, ss, he, me, se;
> +
> +    for (i=0; i<2; i++) {


What is the loop for?

Please add some testcases.




More information about the ffmpeg-devel mailing list