[FFmpeg-devel] [PATCH 6/8] add SRT muxer and demuxer
Michael Niedermayer
michaelni
Fri Jul 23 00:32:37 CEST 2010
On Thu, Jul 22, 2010 at 10:27:43PM +0200, Aurelien Jacobs wrote:
> On Thu, Jul 22, 2010 at 02:18:43PM +0200, Michael Niedermayer wrote:
> > On Wed, Jul 21, 2010 at 11:53:17AM +0200, Aurelien Jacobs wrote:
> > [...]
> > > +static int srt_read_packet(AVFormatContext *s, AVPacket *pkt)
> > > +{
> > > + char buffer[2048], *ptr = buffer, *ptr2 = ptr;
> > > + int64_t pos = url_ftell(s->pb);
> > > + int res = AVERROR_EOF;
> > > +
> > > + while (!is_eol(*ptr2) && !url_feof(s->pb) && ptr-buffer<sizeof(buffer)-1) {
> >
> > that is_eol looks like its reading from uninited mem
>
> Yes... It looks like it.
> Fixed now.
>
> > > + ptr2 = ptr;
> > > + ptr += ff_get_line(s->pb, ptr, sizeof(buffer)+buffer-ptr);
> > > + }
> >
> > besides why is ff_get_line() in a loop, i would naively have expected
> > a single call to work?
>
> A single call of ff_get_line() will only return a single line of text.
> A single SRT subtitle event is composed of multiple lines, hence the
> loop. Events are separated by an empty line.
ok, didnt know that
>
> Aurel
> Changelog | 1
> doc/general.texi | 1
> libavcodec/avcodec.h | 1
> libavformat/Makefile | 2
> libavformat/allformats.c | 1
> libavformat/avformat.h | 2
> libavformat/raw.c | 12 +++++
> libavformat/srtdec.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++
> 8 files changed, 121 insertions(+), 1 deletion(-)
> d99824b873904ab864194d48a41b87d301a3c29c 06-add-srt-muxer-and-demuxer.patch
> add SRT muxer and demuxer
looks good, assuming it has been tested with /tools/trasher and it
doesnt crash end in infinite loops
and a reg/fate test would be usefull too if this is already possible
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100723/5eec0adb/attachment.pgp>
More information about the ffmpeg-devel
mailing list