diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-01-17 22:46:33 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-01-17 22:46:33 +0300 |
commit | 765d4f3b4a49e974c7f122068ae0a10109423048 (patch) | |
tree | f0c8e35d4037f61c62efac97f1974cee8d65067a /libavutil/fifo.c | |
parent | 870a12d1c23b8b1f902c5fec22ec6edd0885154a (diff) |
remove near duplicate function
Originally committed as revision 7570 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/fifo.c')
-rw-r--r-- | libavutil/fifo.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/libavutil/fifo.c b/libavutil/fifo.c index d334c363a0..0f530849df 100644 --- a/libavutil/fifo.c +++ b/libavutil/fifo.c @@ -50,20 +50,7 @@ int av_fifo_size(AVFifoBuffer *f) */ int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size) { - int size = av_fifo_size(f); - - if (size < buf_size) - return -1; - while (buf_size > 0) { - int len = FFMIN(f->end - f->rptr, buf_size); - memcpy(buf, f->rptr, len); - buf += len; - f->rptr += len; - if (f->rptr >= f->end) - f->rptr = f->buffer; - buf_size -= len; - } - return 0; + return av_fifo_generic_read(f, buf_size, NULL, buf); } /** @@ -111,7 +98,11 @@ int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void return -1; while (buf_size > 0) { int len = FFMIN(f->end - f->rptr, buf_size); - func(dest, f->rptr, len); + if(func) func(dest, f->rptr, len); + else{ + memcpy(dest, f->rptr, len); + dest = (uint8_t*)dest + len; + } f->rptr += len; if (f->rptr >= f->end) f->rptr = f->buffer; |