Browse code

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

Olivier Guilyardi authored on 2009/04/03 08:22:19
Showing 3 changed files
... ...
@@ -35,7 +35,7 @@
35 35
 #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
36 36
 
37 37
 #define LIBAVUTIL_VERSION_MAJOR 50
38
-#define LIBAVUTIL_VERSION_MINOR  2
38
+#define LIBAVUTIL_VERSION_MINOR  3
39 39
 #define LIBAVUTIL_VERSION_MICRO  0
40 40
 
41 41
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
... ...
@@ -54,6 +54,11 @@ int av_fifo_size(AVFifoBuffer *f)
54 54
     return (uint32_t)(f->wndx - f->rndx);
55 55
 }
56 56
 
57
+int av_fifo_space(AVFifoBuffer *f)
58
+{
59
+    return f->end - f->buffer - av_fifo_size(f);
60
+}
61
+
57 62
 int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) {
58 63
     unsigned int old_size= f->end - f->buffer;
59 64
 
... ...
@@ -62,6 +62,14 @@ void av_fifo_reset(AVFifoBuffer *f);
62 62
 int av_fifo_size(AVFifoBuffer *f);
63 63
 
64 64
 /**
65
+ * Returns the amount of space in bytes in the AVFifoBuffer, that is the
66
+ * amount of data you can write into it.
67
+ * @param *f AVFifoBuffer to write into
68
+ * @return size
69
+ */
70
+int av_fifo_space(AVFifoBuffer *f);
71
+
72
+/**
65 73
  * Feeds data from an AVFifoBuffer to a user-supplied callback.
66 74
  * @param *f AVFifoBuffer to read from
67 75
  * @param buf_size number of bytes to read