[FFmpeg-devel] [PATCH] lavf/srtdec: fix probing files with negative first timestamps

Clément Bœsch u at pkh.me
Mon Jun 6 20:47:44 CEST 2016


On Mon, Jun 06, 2016 at 01:26:40PM -0500, Rodger Combs wrote:
> ---
>  libavformat/srtdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
> index 585aa6a..06061a8 100644
> --- a/libavformat/srtdec.c
> +++ b/libavformat/srtdec.c
> @@ -52,7 +52,7 @@ static int srt_probe(AVProbeData *p)
>      /* Check if the next line matches a SRT timestamp */
>      if (ff_subtitles_read_line(&tr, buf, sizeof(buf)) < 0)
>          return 0;
> -    if (buf[0] >= '0' && buf[0] <= '9' && strstr(buf, " --> ")
> +    if (((buf[0] >= '0' && buf[0] <= '9') || buf[0] == '-') && strstr(buf, " --> ")

It would be more correct to just skip the '-' if present and still do the
[0-9] range check after that. So maybe if (buf[0] == '-') buf++ just
before the unchanged if.

Thanks

>          && sscanf(buf, "%*d:%*d:%*d%*1[,.]%*d --> %*d:%*d:%*d%*1[,.]%d", &v) == 1)
>          return AVPROBE_SCORE_MAX;
>  

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


More information about the ffmpeg-devel mailing list