[FFmpeg-devel] [PATCH] rl2 format demuxer

Michael Niedermayer michaelni
Fri Mar 21 03:19:14 CET 2008


On Thu, Mar 20, 2008 at 07:44:11PM +0100, Sascha Sommer wrote:
> Hi,
> 
> > > +    int ret = 0;
> > > +
> >
> > trailing whitespace ...
> >
> >
> 
> Fixed.
> 
> > > +    chunk_size = av_malloc(frame_count * sizeof(uint32_t));
> > > +    audio_size = av_malloc(frame_count * sizeof(uint32_t));
> > > +    chunk_offset = av_malloc(frame_count * sizeof(uint32_t));
> > > +
> > > +    if(!chunk_size || !audio_size || !chunk_offset)
> > > +        return AVERROR(ENOMEM);
> >
> > memleak
> >
> 
> Fixed.
> 
> 
> > > +    /** build the sample index */
> > > +    for(i=0;i<frame_count;i++){
> > > +        if(audio_size[i] < 0 || chunk_size[i] < 0 ||
> > > +             audio_size[i] > chunk_size[i]){
> > > +            ret = AVERROR_INVALIDDATA;
> > > +            break;
> > > +        }
> >
> > audio_size[i] < 0 is impossible
> >
> 
> Check removed.
> 
> >
> > pos= INT64_MAX;
> > for(i=0; i<s->nb_streams; i++){
> >     if(   rl2->index_pos[i] < s->streams[i]->nb_index_entries
> >        && s->streams[i]->index_entries[ rl2->index_pos[i] ].pos < pos){
> >         sample = &s->streams[i]->index_entries[ rl2->index_pos[i] ];
> >         pos= sample->pos;
> >         stream_id= i;
> >     }
> > }
> >
> 
> Code uses your version now.
> 
[...]
> +    if(AV_RB32(&p->buf[8]) != RLV2_TAG && 

trailing whitespace


[...]
> +    if(get_buffer(pb,st->codec->extradata,EXTRADATA1_SIZE) != EXTRADATA1_SIZE)
> +        return AVERROR(EIO);
> +
> +    /** get background frame */
> +    if(signature == RLV3_TAG && back_size > 0){
> +        if(get_buffer(pb,st->codec->extradata + EXTRADATA1_SIZE,back_size) != back_size)
> +            return AVERROR(EIO);
> +    }

isnt that the same as

if(get_buffer(pb,st->codec->extradata,st->codec->extradata_size) != st->codec->extradata_size)
    return AVERROR(EIO);

?


[...]
> +    chunk_size = av_malloc(frame_count * sizeof(uint32_t));
> +    audio_size = av_malloc(frame_count * sizeof(uint32_t));
> +    chunk_offset = av_malloc(frame_count * sizeof(uint32_t));

vertical align


[...]
> +    /** fill the packet */
> +    ret = av_get_packet(pb, pkt, sample->size);
> +    if(ret != sample->size)
> +        ret = AVERROR(EIO);

memleak


[...]
> +AVInputFormat rl2_demuxer = {
> +    "rl2",
> +    "rl2 format",
> +    sizeof(Rl2DemuxContext),
> +    rl2_probe,
> +    rl2_read_header,
> +    rl2_read_packet,
> +};

What about adding seeking support? :)

[...]
-- 
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: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080321/3420713a/attachment.pgp>



More information about the ffmpeg-devel mailing list