diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2008-08-19 18:43:34 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2008-08-19 18:43:34 +0000 |
commit | 8257b835cf4d422ca3f0426ac2e151f5dff69ecb (patch) | |
tree | 4e7f62292f381f3516b996757f233795a08de3c9 /libavutil/fifo.c | |
parent | e13894e80e25ecfda73fce3fbf1e206642c695a9 (diff) | |
download | ffmpeg-8257b835cf4d422ca3f0426ac2e151f5dff69ecb.tar.gz |
Implement av_fifo_realloc2().
Originally committed as revision 14846 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/fifo.c')
-rw-r--r-- | libavutil/fifo.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavutil/fifo.c b/libavutil/fifo.c index eda3558436..19715ebce4 100644 --- a/libavutil/fifo.c +++ b/libavutil/fifo.c @@ -55,18 +55,24 @@ int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size) * Resizes a FIFO. */ void av_fifo_realloc(AVFifoBuffer *f, unsigned int new_size) { + av_fifo_realloc2(f, new_size); +} + +int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) { unsigned int old_size= f->end - f->buffer; if(old_size <= new_size){ int len= av_fifo_size(f); AVFifoBuffer f2; - av_fifo_init(&f2, new_size); + if (av_fifo_init(&f2, new_size) < 0) + return -1; av_fifo_read(f, f2.buffer, len); f2.wptr += len; av_free(f->buffer); *f= f2; } + return 0; } void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size) |