[FFmpeg-cvslog] r14846 - in trunk/libavutil: avutil.h fifo.c fifo.h
stefano
subversion
Tue Aug 19 20:43:34 CEST 2008
Author: stefano
Date: Tue Aug 19 20:43:34 2008
New Revision: 14846
Log:
Implement av_fifo_realloc2().
Modified:
trunk/libavutil/avutil.h
trunk/libavutil/fifo.c
trunk/libavutil/fifo.h
Modified: trunk/libavutil/avutil.h
==============================================================================
--- trunk/libavutil/avutil.h (original)
+++ trunk/libavutil/avutil.h Tue Aug 19 20:43:34 2008
@@ -35,7 +35,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 49
-#define LIBAVUTIL_VERSION_MINOR 9
+#define LIBAVUTIL_VERSION_MINOR 10
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
Modified: trunk/libavutil/fifo.c
==============================================================================
--- trunk/libavutil/fifo.c (original)
+++ trunk/libavutil/fifo.c Tue Aug 19 20:43:34 2008
@@ -55,18 +55,24 @@ int av_fifo_read(AVFifoBuffer *f, uint8_
* 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)
Modified: trunk/libavutil/fifo.h
==============================================================================
--- trunk/libavutil/fifo.h (original)
+++ trunk/libavutil/fifo.h Tue Aug 19 20:43:34 2008
@@ -97,10 +97,19 @@ int av_fifo_generic_write(AVFifoBuffer *
* Resizes an AVFifoBuffer.
* @param *f AVFifoBuffer to resize
* @param size new AVFifoBuffer size in bytes
+ * @see av_fifo_realloc2()
*/
void av_fifo_realloc(AVFifoBuffer *f, unsigned int size);
/**
+ * Resizes an AVFifoBuffer.
+ * @param *f AVFifoBuffer to resize
+ * @param size new AVFifoBuffer size in bytes
+ * @return <0 for failure >=0 otherwise
+ */
+int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
+
+/**
* Reads and discards the specified amount of data from an AVFifoBuffer.
* @param *f AVFifoBuffer to read from
* @param size amount of data to read in bytes
More information about the ffmpeg-cvslog
mailing list