diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-08-26 23:18:54 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-08-26 23:18:54 +0200 |
commit | 094a4968188b0129d674c1369bad45a86cd0d46d (patch) | |
tree | 372eb9e7a5dc4222b7db34c5e10ae578b536ed9b /libavutil/fifo.c | |
parent | 0a1cf6621067c4a85b519c8cad5c345c29017f89 (diff) | |
parent | 1717ba0cdd587fe3463c1d8560f2c7e13fb21ba3 (diff) | |
download | ffmpeg-094a4968188b0129d674c1369bad45a86cd0d46d.tar.gz |
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/fifo.c')
-rw-r--r-- | libavutil/fifo.c | 36 |
1 files changed, 36 insertions, 0 deletions
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 |