[FFmpeg-devel] [RFC, PATCH] RealVideo full-frame demux/decode

Kostya kostya.shishkov
Sun Oct 21 16:15:32 CEST 2007


On Sun, Oct 21, 2007 at 03:59:52PM +0200, Roberto Togni wrote:
> On Sat, 20 Oct 2007 16:14:08 +0300
> Kostya <kostya.shishkov at gmail.com> wrote:
> 
> > Here is another attempt on making lavc RV decoder work
> > with full frames instead of slices.
> > 
> > Attached patches:
> > 0. RM demuxer
> > 1. RV10/20 decoder patch to make it work with slices
> > 2. Indentation after patch #1
> > 
> > Some notes on demuxer: as at least one sample shows that
> > video frame slices may be interleaved with audio slices
> > I store them in special buffer and make packet only when
> > all data for single frame is gathered. 
[actual patch]
> 
> Can this write out of the buffer in case of errors? I'm thinking about
> a case where cur_slice is big and len2 and rm->slices are small.
> Also if a slice is missing the slice table will have some
> uninitialized values.
> 
> > +    get_buffer(pb, rm->videobuf + 1 + 8*rm->slices + pos, len);
> 
> This could be dangerous, since the rm->slices used here is not the same
> used to allocate the buffer. Also pos could be anything.
> 
> > +    rm->remaining_len-= len;
> > +
> > +    if(type == 2 || (pos + len + 1 + 8*rm->slices) ==
> > rm->videobufsize){
> > +         //adjust slice headers
> > +         memmove(rm->videobuf + 1 + 8*rm->cur_slice, rm->videobuf +
> > 1 + 8*rm->slices, rm->videobufsize - 1 - 8*rm->slices);
> > +         ssize = rm->videobufsize - 8*(rm->slices - rm->cur_slice);
> > +
> > +         rm->videobuf[0] = rm->cur_slice-1;
> > +         if(av_new_packet(pkt, ssize) < 0)
> > +             return AVERROR(ENOMEM);
> > +         memcpy(pkt->data, rm->videobuf, ssize);
> > +         return 0;
> > +    }
> > +
> > +    return 1;
> > +}
> > +
> 
> Maybe the easiest solution is to use always the slice number from the
> first slice and just use a counter for the cur_slice number (ignoring
> the value from the header) and write slices in sequence (ignoring pos).
> 
> >  static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
> [...]
> 
> Can you test the attached patch? I only tested with rv10/20. This
> should address all the issues.

Yes, it seems to serve complete frames (and security fixes/checks are good
too).
 
> For all the rest patch ok, and thanks for taking care of this.
> 
> Ciao,
>  Roberto
> 
> -- 
> Better is the enemy of good enough.




More information about the ffmpeg-devel mailing list