summaryrefslogtreecommitdiff
path: root/libavfilter/bufferqueue.h
diff options
context:
space:
mode:
Diffstat (limited to 'libavfilter/bufferqueue.h')
-rw-r--r--libavfilter/bufferqueue.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/libavfilter/bufferqueue.h b/libavfilter/bufferqueue.h
index 34c4c0f08b..adbc0fd895 100644
--- a/libavfilter/bufferqueue.h
+++ b/libavfilter/bufferqueue.h
@@ -23,7 +23,7 @@
#define AVFILTER_BUFFERQUEUE_H
/**
- * FFBufQueue: simple AVFilterBufferRef queue API
+ * FFBufQueue: simple AVFrame queue API
*
* Note: this API is not thread-safe. Concurrent access to the same queue
* must be protected by a mutex or any synchronization mechanism.
@@ -47,7 +47,7 @@
* Structure holding the queue
*/
struct FFBufQueue {
- AVFilterBufferRef *queue[FF_BUFQUEUE_SIZE];
+ AVFrame *queue[FF_BUFQUEUE_SIZE];
unsigned short head;
unsigned short available; /**< number of available buffers */
};
@@ -69,11 +69,11 @@ static inline int ff_bufqueue_is_full(struct FFBufQueue *queue)
* (and unrefed) with a warning before adding the new buffer.
*/
static inline void ff_bufqueue_add(void *log, struct FFBufQueue *queue,
- AVFilterBufferRef *buf)
+ AVFrame *buf)
{
if (ff_bufqueue_is_full(queue)) {
av_log(log, AV_LOG_WARNING, "Buffer queue overflow, dropping.\n");
- avfilter_unref_buffer(BUCKET(--queue->available));
+ av_frame_free(&BUCKET(--queue->available));
}
BUCKET(queue->available++) = buf;
}
@@ -84,8 +84,8 @@ static inline void ff_bufqueue_add(void *log, struct FFBufQueue *queue,
* Buffer with index 0 is the first buffer in the queue.
* Return NULL if the queue has not enough buffers.
*/
-static inline AVFilterBufferRef *ff_bufqueue_peek(struct FFBufQueue *queue,
- unsigned index)
+static inline AVFrame *ff_bufqueue_peek(struct FFBufQueue *queue,
+ unsigned index)
{
return index < queue->available ? BUCKET(index) : NULL;
}
@@ -95,9 +95,9 @@ static inline AVFilterBufferRef *ff_bufqueue_peek(struct FFBufQueue *queue,
*
* Do not use on an empty queue.
*/
-static inline AVFilterBufferRef *ff_bufqueue_get(struct FFBufQueue *queue)
+static inline AVFrame *ff_bufqueue_get(struct FFBufQueue *queue)
{
- AVFilterBufferRef *ret = queue->queue[queue->head];
+ AVFrame *ret = queue->queue[queue->head];
av_assert0(queue->available);
queue->available--;
queue->queue[queue->head] = NULL;
@@ -110,8 +110,10 @@ static inline AVFilterBufferRef *ff_bufqueue_get(struct FFBufQueue *queue)
*/
static inline void ff_bufqueue_discard_all(struct FFBufQueue *queue)
{
- while (queue->available)
- avfilter_unref_buffer(ff_bufqueue_get(queue));
+ while (queue->available) {
+ AVFrame *buf = ff_bufqueue_get(queue);
+ av_frame_free(&buf);
+ }
}
#undef BUCKET