it easier to reuse the fifo.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@17901
9553f0bf-9b14-0410-a0b8-
cfaf0461ba5b
AVFifoBuffer *f= av_mallocz(sizeof(AVFifoBuffer));
if(!f)
return NULL;
- f->wptr = f->rptr =
f->buffer = av_malloc(size);
f->end = f->buffer + size;
+ av_fifo_reset(f);
if (!f->buffer)
av_freep(&f);
return f;
}
}
+void av_fifo_reset(AVFifoBuffer *f)
+{
+ f->wptr = f->rptr = f->buffer;
+ f->wndx = f->rndx = 0;
+}
+
int av_fifo_size(AVFifoBuffer *f)
{
return (uint32_t)(f->wndx - f->rndx);
*/
void av_fifo_free(AVFifoBuffer *f);
+/**
+ * Resets the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
+ * @param *f AVFifoBuffer to reset
+ */
+void av_fifo_reset(AVFifoBuffer *f);
+
/**
* Returns the amount of data in bytes in the AVFifoBuffer, that is the
* amount of data you can read from it.