[FFmpeg-devel] Fwd: [PATCH] Psygnosis YOP demuxer
Michael Niedermayer
michaelni
Tue Jan 5 11:56:21 CET 2010
On Thu, Dec 31, 2009 at 09:59:26PM +0530, Mohamed Naufal wrote:
> 2009/12/31 Reimar D?ffinger <Reimar.Doeffinger at gmx.de>
>
> > On Thu, Dec 31, 2009 at 05:02:34PM +0530, Mohamed Naufal wrote:
> > > 2009/12/31 Reimar D?ffinger <Reimar.Doeffinger at gmx.de>
> > >
> >
>
>
> [...]
>
>
> > 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).
> >
>
>
> Done.
>
>
>
> > > + 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.
> >
>
>
> I thought av_destruct_packet_nofree() was deprecated. Changed back.
>
> [...]
>
>
>
> > 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.
> >
>
>
> Implemented goto.
>
> [...]
>
> Also fixed other issues.
>
> Naufal
[...]
> + yop->num_pal_colors = video_dec->extradata[0];
> + yop->audio_block_length = AV_RL16(video_dec->extradata + 6);
> +
> + // 1840 samples per frame, 1 nibble per sample; hence 1840/2 = 920
> + if (yop->audio_block_length < 920 ||
> + yop->audio_block_length >= yop->frame_size) {
> + av_log(s, AV_LOG_ERROR, "YOP has invalid audio block length.\n");
> + return -1;
> + }
> +
> + url_fseek(pb, 2048, SEEK_SET);
> +
> + av_set_pts_info(video_stream, 32, 1, frame_rate);
> +
> + return 0;
> +}
> +
> +static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
> +{
> + YopDecContext *yop = s->priv_data;
> + ByteIOContext *pb = s->pb;
> +
> + int ret;
> + int palette_size = 4 + yop->num_pal_colors * 3;
> + int actual_video_data_size = yop->frame_size -
> + yop->audio_block_length - palette_size;
this still can end up negative, there still are missing checks in the
header parsing
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- 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/20100105/bbcca960/attachment.pgp>
More information about the ffmpeg-devel
mailing list