[FFmpeg-devel] [PATCH 1/4] add SRT parser, demuxer and muxer

Aurelien Jacobs aurel
Wed Jul 7 12:14:58 CEST 2010


On Wed, Jul 07, 2010 at 12:45:34AM -0700, Alexander Strange wrote:
> 
> On Jul 6, 2010, at 1:54 PM, Aurelien Jacobs wrote:
> 
> > 
> > ---
> > libavcodec/Makefile      |    1 +
> > libavcodec/allcodecs.c   |    1 +
> > libavcodec/avcodec.h     |    1 +
> > libavcodec/srt_parser.c  |   82 ++++++++++++++++++++++++++++++++++++++++++++++
> > libavformat/Makefile     |    2 +
> > libavformat/allformats.c |    1 +
> > libavformat/raw.c        |   12 +++++++
> > libavformat/srtdec.c     |   68 ++++++++++++++++++++++++++++++++++++++
> > 8 files changed, 168 insertions(+), 0 deletions(-)
> > create mode 100644 libavcodec/srt_parser.c
> > create mode 100644 libavformat/srtdec.c
> > <add-srt-parser-demuxer-and-mux.patch>
> 
> 
> > +        if (sscanf(buf, "%d:%2d:%2d,%3d --> %*d:%*2d:%*2d,%3d",
> > +                   &hour, &min, &sec, &hsec, &v) == 5) {
> > +            min += 60*hour;
> > +            sec += 60*min;
> > +            return sec*1000+hsec;
> > +        }
> 
> srt can have , or . decimal separators.

While there is no official spec for srt, I've found quite a few
description of it in the wild. All of them specify that , is the decimal
separator.
I've also grabed a whole bunch of samples, and all of them are using ,.
The only reference that I could find for . as a decimal separator is a
test file on http://ale5000.altervista.org/subtitles.htm
So, IMHO, usage of . is not legitimate. But as other players are
supporting it, I've just improved my patch to support it too.

Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-srt-parser-demuxer-and-mux.diff
Type: text/x-diff
Size: 8929 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100707/834b9795/attachment.diff>



More information about the ffmpeg-devel mailing list