[FFmpeg-devel] [PATCH] SIFF demuxer and decoder
Michael Niedermayer
michaelni
Tue Oct 16 09:04:58 CEST 2007
On Tue, Oct 16, 2007 at 07:19:10AM +0300, Kostya wrote:
[...]
>
> > [...]
> > > + if(c->has_audio){
> > > + c->blkdata = av_realloc(c->blkdata, size);
> > > + memcpy(c->blkdata, pkt->data, pkt->size);
> > > + }
> > > + flags = pkt->data[0];
> > > + c->next_audio = !!(flags & VB_HAS_AUDIO);
> > > + }else{
> > > + //parse block
> > > + flags = c->blkdata[0];
> > > + snddata = c->blkdata + 2 + ((flags & VB_HAS_GMC) ? 4 : 0);
> > > + size = AV_RL32(snddata) - 4;
> > > + if (av_new_packet(pkt, size) < 0)
> > > + return AVERROR(ENOMEM);
> > > + memcpy(pkt->data, snddata + 4, size);
> > > + }
> >
> > this looks wrong, it passes the audio to the video decoder
> > it also does a lot of unneeded memcpy()
> > please clean this up
> > video -> video stream
> > audio -> audio stream
> > and no memcpy
>
> It's a bit problematic.
> Frame structure:
> whole frame size
> flags
> if(flags & gmc)
> motion vector
> if(flags & audio)
> audio data
> if(flags & video)
> video data
> if(flags & palette)
> palette data
>
> Can you suggest a way to do demuxing?
something like:
frame_size= get()
flags= get()
if(flags & gmc)
mv=get();
if(flags & audio){
aud_pkt= get_packet()
}
if(flags & (video|palette)){
vid_pkt= alloc_packet(vid_size + pal_size + gmc + 1)
vid_pkt->data[0]= flags;
vid_pkt->data[1]= mv
if(flags & video)
read(vid_pkt->data+2, vid_size)
if(flags & palette)
read(vid_pkt->data+2+vid_size, pal_size)
}
if(vid_pkt){
t= vid_pkt; vid_pkt=0
return t;
}
if(aud_pkt){
t= aud_pkt; aud_pkt=0
return t;
}
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- 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/20071016/f981d4d5/attachment.pgp>
More information about the ffmpeg-devel
mailing list