[Ffmpeg-devel] privatizing FifoBuffer into libavutil

Michael Niedermayer michaelni
Tue Sep 12 20:38:09 CEST 2006


Hi

On Sun, Sep 10, 2006 at 01:13:07PM -0700, Roman Shaposhnik wrote:
> Hi
> 
> On Sun, 2006-09-10 at 12:54 +0200, Michael Niedermayer wrote:
> > > P.S. The only caveat here is an implicit put_buffer declaration
> > > in fifo.c
> > 
> > i think fifo.* should stay in libavformat for now
>  
>   is it because of a particular reason or simply because
> what you've mentioned bellow is not satisfied yet ? 

well doing the change in several steps (avformat.h -> fifo.c/h and
then the move to lavutil) seems better to me but iam not against
doing both at once 


[...]
> > * no dependancy on libavformat (put_buffer()) -> put_fifo() must not be moved
> >   to libavutil
> 
>   I actually have a question about this one. Since fifo_read and
> put_fifo have identical code except for:
> 
> --- /tmp/1      2006-09-10 12:52:37.000000000 -0700
> +++ /tmp/2      2006-09-10 12:52:43.000000000 -0700
> @@ -13,8 +13,7 @@
>          len = f->end - rptr;
>          if (len > buf_size)
>              len = buf_size;
> -        memcpy(buf, rptr, len);
> -        buf += len;
> +        put_buffer(pb, rptr, len);
>          rptr += len;
>          if (rptr >= f->end)
>              rptr = f->buffer;
> 
> 
>   how outlandish will it be to create a common function out of
> them called fifo_transfer:
>     
>  int fifo_transfer(FifoBuffer *f, int buf_size, 
>                    void (*transfer_func)(void* out, void* in, int size),
>                    void*  out);
> 
>   so that put_buffer() would become:
>       
>       fifo_transfer(f, size, put_buffer, pb);
> 
>   and so on ?

sadly memcpy() doesnt fit in as the buf+=len cant be done
iam also against the name fifo_transfer() as its not obvious if its a read
or write
except that i like the idea
maybe a 
fifo_read(f, size, put_buffer, pb);
and
fifo_read(f, size, NULL, buf); 
for the memcpy()

would be one possibility

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list