aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Guilyardi <list@samalyse.com>2009-04-02 23:22:19 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2009-04-02 23:22:19 +0000
commit7b09db35225e726949f28b59075bc6519f8fdac0 (patch)
tree4cd6cb49b5bf13593b5fbb96749adaf4d0d90d21
parenta8f9e7f641f9d3a8aae99f23b571623a88283ae6 (diff)
downloadffmpeg-7b09db35225e726949f28b59075bc6519f8fdac0.tar.gz
Implement av_fifo_space().
Patch by Olivier Guilyardi list et samalyse DOT c0m. Originally committed as revision 18321 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavutil/avutil.h2
-rw-r--r--libavutil/fifo.c5
-rw-r--r--libavutil/fifo.h8
3 files changed, 14 insertions, 1 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index dfc129bb27..fac1f5e2dd 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -35,7 +35,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 2
+#define LIBAVUTIL_VERSION_MINOR 3
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libavutil/fifo.c b/libavutil/fifo.c
index 52ace0e22c..840b73a57b 100644
--- a/libavutil/fifo.c
+++ b/libavutil/fifo.c
@@ -54,6 +54,11 @@ int av_fifo_size(AVFifoBuffer *f)
return (uint32_t)(f->wndx - f->rndx);
}
+int av_fifo_space(AVFifoBuffer *f)
+{
+ return f->end - f->buffer - av_fifo_size(f);
+}
+
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) {
unsigned int old_size= f->end - f->buffer;
diff --git a/libavutil/fifo.h b/libavutil/fifo.h
index d353844715..a904dfd02e 100644
--- a/libavutil/fifo.h
+++ b/libavutil/fifo.h
@@ -62,6 +62,14 @@ void av_fifo_reset(AVFifoBuffer *f);
int av_fifo_size(AVFifoBuffer *f);
/**
+ * Returns the amount of space in bytes in the AVFifoBuffer, that is the
+ * amount of data you can write into it.
+ * @param *f AVFifoBuffer to write into
+ * @return size
+ */
+int av_fifo_space(AVFifoBuffer *f);
+
+/**
* Feeds data from an AVFifoBuffer to a user-supplied callback.
* @param *f AVFifoBuffer to read from
* @param buf_size number of bytes to read