[FFmpeg-devel] [PATCH 1/4] mpl2dec: handle files with CRLF linebreaks correctly

Clément Bœsch ubitux at gmail.com
Thu Aug 8 12:37:05 CEST 2013


On Thu, Aug 08, 2013 at 11:00:21AM +0200, wm4 wrote:
> On Thu, 8 Aug 2013 07:12:52 +0200
> Clément Bœsch <ubitux at gmail.com> wrote:
> 
> > > -        line[strcspn(line, "\r\n")] = 0;
> > > +        line[strcspn(line, "\n")] = 0;
> > >  
> > 
> > This one doesn't thought: line will end up with a \r in it.
> 
> srtdec.c does the same thing,

Are you sure of this?

>                               and indeed, the libavcodec parts filter
> out the \r.

It doesn't look to be the case, but if so, it's possibly a relic from the
past where the whole chunk with timestamps was it.

> Without this change, it would keep the line break if the
> subtitle file is CRLF.

Unless I'm mistaken, without that change, the first character being \r or
\n will be replaced with a 0 character, preventing string like
"foobar\r" from being sent to the decoder (which would happen after your
patch).

-- 
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/20130808/c8dd31da/attachment.asc>


More information about the ffmpeg-devel mailing list