summaryrefslogtreecommitdiff
path: root/libavfilter/filters.h
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2016-12-20 14:58:37 +0100
committerNicolas George <george@nsup.org>2017-01-12 14:06:16 +0100
commitd360ddf03b8461dbc78c90b40cab3cc14d449f07 (patch)
tree98f25eea5f663120ed506d9474f7a7e90de548ea /libavfilter/filters.h
parent2e5af443c376bd2019a633e5c61b97f116b01ad2 (diff)
lavfi: add helpers to consume frames from link FIFOs.
Diffstat (limited to 'libavfilter/filters.h')
-rw-r--r--libavfilter/filters.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 0da1d8bd99..fe3b612fc2 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -55,6 +55,48 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame);
int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame);
/**
+ * Test if a frame is available on the link.
+ * @return >0 if a frame is available
+ */
+int ff_inlink_check_available_frame(AVFilterLink *link);
+
+/**
+ * Test if enough samples are available on the link.
+ * @return >0 if enough samples are available
+ * @note on EOF and error, min becomes 1
+ */
+int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min);
+
+/**
+ * Take a frame from the link's FIFO and update the link's stats.
+ *
+ * If ff_inlink_check_available_frame() was previously called, the
+ * preferred way of expressing it is "av_assert1(ret);" immediately after
+ * ff_inlink_consume_frame(). Negative error codes must still be checked.
+ *
+ * @note May trigger process_command() and/or update is_disabled.
+ * @return >0 if a frame is available,
+ * 0 and set rframe to NULL if no frame available,
+ * or AVERROR code
+ */
+int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe);
+
+/**
+ * Take samples from the link's FIFO and update the link's stats.
+ *
+ * If ff_inlink_check_available_samples() was previously called, the
+ * preferred way of expressing it is "av_assert1(ret);" immediately after
+ * ff_inlink_consume_samples(). Negative error codes must still be checked.
+ *
+ * @note May trigger process_command() and/or update is_disabled.
+ * @return >0 if a frame is available,
+ * 0 and set rframe to NULL if no frame available,
+ * or AVERROR code
+ */
+int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max,
+ AVFrame **rframe);
+
+/**
* Make sure a frame is writable.
* This is similar to av_frame_make_writable() except it uses the link's
* buffer allocation callback, and therefore allows direct rendering.