summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-26 23:18:54 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-26 23:18:54 +0200
commit094a4968188b0129d674c1369bad45a86cd0d46d (patch)
tree372eb9e7a5dc4222b7db34c5e10ae578b536ed9b /libavutil
parent0a1cf6621067c4a85b519c8cad5c345c29017f89 (diff)
parent1717ba0cdd587fe3463c1d8560f2c7e13fb21ba3 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: fifo: add FIFO API test program, and fate test fifo: add av_fifo_peek2(), and deprecate av_fifo_peek() postprocess.c: filter name needs to be double 0 terminated doxygen: fix wrong comment syntax, //< vs. ///< doxygen: drop pointless star from pointer variable names Replace deprecated av_find_stream_info() by avformat_find_stream_info(). xmv: eliminate superfluous zeroing of zero data configure: fix typo in avconv dependency list Conflicts: configure doc/APIchanges libavutil/Makefile libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/Makefile3
-rw-r--r--libavutil/avutil.h2
-rw-r--r--libavutil/fifo.c36
-rw-r--r--libavutil/fifo.h24
4 files changed, 51 insertions, 14 deletions
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 5ff5cb8e79..3a5ceba16d 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -77,7 +77,8 @@ OBJS-$(ARCH_ARM) += arm/cpu.o
OBJS-$(ARCH_PPC) += ppc/cpu.o
OBJS-$(ARCH_X86) += x86/cpu.o
-TESTPROGS = adler32 aes avstring base64 cpu crc des eval file lfg lls \
+
+TESTPROGS = adler32 aes avstring base64 cpu crc des eval file fifo lfg lls \
md5 opt pca parseutils rational sha tree
TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 25b55672b2..236622ed83 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -40,7 +40,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 51
-#define LIBAVUTIL_VERSION_MINOR 13
+#define LIBAVUTIL_VERSION_MINOR 14
#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 21687ff905..3ebd5f9b20 100644
--- a/libavutil/fifo.c
+++ b/libavutil/fifo.c
@@ -128,3 +128,39 @@ void av_fifo_drain(AVFifoBuffer *f, int size)
f->rptr -= f->end - f->buffer;
f->rndx += size;
}
+
+#ifdef TEST
+
+#undef printf
+
+int main(void)
+{
+ /* create a FIFO buffer */
+ AVFifoBuffer *fifo = av_fifo_alloc(13 * sizeof(int));
+ int i, j, n;
+
+ /* fill data */
+ for (i = 0; av_fifo_space(fifo) >= sizeof(int); i++)
+ av_fifo_generic_write(fifo, &i, sizeof(int), NULL);
+
+ /* peek at FIFO */
+ n = av_fifo_size(fifo)/sizeof(int);
+ for (i = -n+1; i < n; i++) {
+ int *v = (int *)av_fifo_peek2(fifo, i*sizeof(int));
+ printf("%d: %d\n", i, *v);
+ }
+ printf("\n");
+
+ /* read data */
+ for (i = 0; av_fifo_size(fifo) >= sizeof(int); i++) {
+ av_fifo_generic_read(fifo, &j, sizeof(int), NULL);
+ printf("%d ", j);
+ }
+ printf("\n");
+
+ av_fifo_free(fifo);
+
+ return 0;
+}
+
+#endif
diff --git a/libavutil/fifo.h b/libavutil/fifo.h
index e03d4ba73f..b84eaeab62 100644
--- a/libavutil/fifo.h
+++ b/libavutil/fifo.h
@@ -42,20 +42,20 @@ AVFifoBuffer *av_fifo_alloc(unsigned int size);
/**
* Free an AVFifoBuffer.
- * @param *f AVFifoBuffer to free
+ * @param f AVFifoBuffer to free
*/
void av_fifo_free(AVFifoBuffer *f);
/**
* Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
- * @param *f AVFifoBuffer to reset
+ * @param f AVFifoBuffer to reset
*/
void av_fifo_reset(AVFifoBuffer *f);
/**
* Return the amount of data in bytes in the AVFifoBuffer, that is the
* amount of data you can read from it.
- * @param *f AVFifoBuffer to read from
+ * @param f AVFifoBuffer to read from
* @return size
*/
int av_fifo_size(AVFifoBuffer *f);
@@ -63,27 +63,27 @@ int av_fifo_size(AVFifoBuffer *f);
/**
* Return 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
+ * @param f AVFifoBuffer to write into
* @return size
*/
int av_fifo_space(AVFifoBuffer *f);
/**
* Feed data from an AVFifoBuffer to a user-supplied callback.
- * @param *f AVFifoBuffer to read from
+ * @param f AVFifoBuffer to read from
* @param buf_size number of bytes to read
- * @param *func generic read function
- * @param *dest data destination
+ * @param func generic read function
+ * @param dest data destination
*/
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
/**
* Feed data from a user-supplied callback to an AVFifoBuffer.
- * @param *f AVFifoBuffer to write to
- * @param *src data source; non-const since it may be used as a
+ * @param f AVFifoBuffer to write to
+ * @param src data source; non-const since it may be used as a
* modifiable context by the function defined in func
* @param size number of bytes to write
- * @param *func generic write function; the first parameter is src,
+ * @param func generic write function; the first parameter is src,
* the second is dest_buf, the third is dest_buf_size.
* func must return the number of bytes written to dest_buf, or <= 0 to
* indicate no more data available to write.
@@ -94,7 +94,7 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
/**
* Resize an AVFifoBuffer.
- * @param *f AVFifoBuffer to resize
+ * @param f AVFifoBuffer to resize
* @param size new AVFifoBuffer size in bytes
* @return <0 for failure, >=0 otherwise
*/
@@ -102,7 +102,7 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
/**
* Read and discard the specified amount of data from an AVFifoBuffer.
- * @param *f AVFifoBuffer to read from
+ * @param f AVFifoBuffer to read from
* @param size amount of data to read in bytes
*/
void av_fifo_drain(AVFifoBuffer *f, int size);