On Fri, Apr 04, 2008 at 01:45:44AM +0200, Michael Niedermayer wrote:
> On Thu, Apr 03, 2008 at 11:53:22PM +0200, Bartlomiej Wolowiec wrote:
> > On niedziela, 30 marca 2008, Michael Niedermayer wrote:
> > > Note, to add the header into the buffer calling ff_combine_frame() with
> > > END_NOT_FOUND and a smaller buffer size should work.
> > >
> > > After its in the buffer you just run the header decoder thing over the
> > > header and when you know the final frame size you call ff_combine_frame
> > > with appropriate next value.
> > >
> > > Anyway iam not insisting on you changing the current aac/ac3 parser to use
> > > ff_combine_frame()
> > > But what you will end up implementing will be quite similar in
> > > functionality to ff_combine_frame()
> > >
> > > [...]
> > 
> > Hmm...
> >  I tried to implement it using ff_combine_frame, but the code which I got 
> > is 
> > in my opinion significantly worse. Main problems which I had:
> > -ff_combine_frame is rather adapted to using on one frame, when in buffer 
> > is 
> > one frame and it currently reads the next one  it isn't convenient (the 
> > whole 
> > buffer size is not just a new frame's size, so that we should remember size 
> > of earlier frames).
> > -in the genuine code there is 
> > memmove(s->frame_start, s->frame_start + 1, s->header_size - 1);
> > s->frame_ptr--;
> > here we can operate on pc->buffer and pc->index (remembering also where the 
> > new frame begins). However, surely it isn't the simpliest solution... 
> 
> What i had in mind is below, this is blindly written and likely contains bugs.
> I did spot one each time i looked at it :)
> But it does not look fundamentally worse to me, it also has the advantage that
> its not full of unneeded memcpys and memmoves.
> 
> while(s->remaining_size <= buf_size){
>     if(s->remaining_size && !s->need_next_header){
>         i= s->remaining_size;
>         s->remaining_size= 0;
>         goto output_frame;
>     }else{ //we need a header first
>         for(i=s->remaining_size; i<buf_size; i++){
>             ctx->state= (ctx->state<<8) + buf[i];
>             if((len=parse_header(ctx->state, &s->need_next_header, 
> &s->new_frame_start)))

just to clarify before you ask ...
state is a 64bit variable in your context unrelated to the 32bit state
ff_combine_frame() plays with.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator

Attachment: signature.asc
Description: Digital signature

_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to