[Ffmpeg-devel] privatizing FifoBuffer into libavutil

Roman Shaposhnik rvs
Sun Sep 10 22:13:07 CEST 2006


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 ? FifoBuffer
looks like a little nice piece of functionality which is kinda
of independent of everything else in ffmpeg.

> moving it to libavutil would at absolute minimum require
> * av_ prefixes

  easy.

> * 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 ?

> * no dependancy on libavcodec (dunno if there is any...)

  none.

> * the rptr and wptr arguments should be removed as they are never used and
>   confusing
   
  agreed. in fact that's how fifo_peek and fifo_drain are done.

> * the version number of libavutil has to be increased

  sure.

> also the move should be done with
> svn cp libavformat/utils.c libavformat/fifo.c so that no history is lost

  of course.

Thanks,
Roman.





More information about the ffmpeg-devel mailing list