remove near duplicate function

Originally committed as revision 7570 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 18 years ago
parent 870a12d1c2
commit 765d4f3b4a
  1. 21
      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 av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size)
{ {
int size = av_fifo_size(f); return av_fifo_generic_read(f, buf_size, NULL, buf);
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;
} }
/** /**
@ -111,7 +98,11 @@ int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void
return -1; return -1;
while (buf_size > 0) { while (buf_size > 0) {
int len = FFMIN(f->end - f->rptr, buf_size); 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; f->rptr += len;
if (f->rptr >= f->end) if (f->rptr >= f->end)
f->rptr = f->buffer; f->rptr = f->buffer;

Loading…
Cancel
Save