[FFmpeg-devel] Fwd: [PATCH] Psygnosis YOP demuxer

Reimar Döffinger Reimar.Doeffinger
Thu Dec 31 14:20:57 CET 2009


On Thu, Dec 31, 2009 at 05:02:34PM +0530, Mohamed Naufal wrote:
> 2009/12/31 Reimar D?ffinger <Reimar.Doeffinger at gmx.de>
> 
> 
> [...]
> 
> 
> > > +    ret = av_get_packet(pb, pkt, 920);
> >
> > Note that this will set pkt.pos to the start of the audio data, but your
> > demuxer can not start demuxing from that position, thus your demuxer
> > can not support seeking via AVFMT_GENERIC_INDEX - which it IMO should
> > though.
> >
> >
> 
> Sorry, how do I do that?

Add
.flags = AVFMT_GENERIC_INDEX,
to yop_demuxer, test seeking (e.g. with ffplay).
It should only work reliable if you set pkt.pos to a file position from
which your demuxer can start (i.e. the start of the palette data).

> +    if (yop->video_packet.data) {
> +        *pkt = yop->video_packet;
> +        yop->video_packet.data = NULL;
> +        yop->video_packet.size = 0;

I'm undecided if this is better or (mis?-)using destruct_nofree.

> +        av_free_packet(&yop->video_packet);
> +        av_free_packet(&yop->video_packet);
> +        av_free_packet(&yop->video_packet);

Duplicated quite a few times.

> +    ret = get_buffer(pb, yop->video_packet.data + palette_size,
> +                     actual_video_data_size);
> +    if (ret < 0)
> +        return ret;

And here you forgot the free.
I was quite serious when is suggested to use "goto err_out" to handle
the freeing in one single place, if you don't you _will_ have memleaks,
I have seen it often enough.

> +    else if (ret < actual_video_data_size)
> +        av_shrink_packet(&yop->video_packet, ret);

ret + palette_size



More information about the ffmpeg-devel mailing list