diff mbox

[FFmpeg-devel,13/17] lavfi: add ff_inlink_set_frame_wanted().

Message ID 20161229143403.2851-13-george@nsup.org
State New
Headers show

Commit Message

Nicolas George Dec. 29, 2016, 2:33 p.m. UTC
Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/avfilter.c | 8 ++++++++
 libavfilter/filters.h  | 8 ++++++++
 2 files changed, 16 insertions(+)


Changes in this commit: rename ff_link -> ff_inlink and move to filters.h.

Comments

Michael Niedermayer Dec. 31, 2016, 2:42 a.m. UTC | #1
On Thu, Dec 29, 2016 at 03:33:59PM +0100, Nicolas George wrote:
> Signed-off-by: Nicolas George <george@nsup.org>
> ---
>  libavfilter/avfilter.c | 8 ++++++++
>  libavfilter/filters.h  | 8 ++++++++
>  2 files changed, 16 insertions(+)
> 
> 
> Changes in this commit: rename ff_link -> ff_inlink and move to filters.h.
> 
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 7e02d9ca8b..d7677d5f23 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -1634,6 +1634,14 @@ void ff_inlink_process_timeline(AVFilterLink *link, const AVFrame *frame)
>      dstctx->is_disabled = fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) < 0.5;
>  }
>  
> +void ff_inlink_set_frame_wanted(AVFilterLink *link)
> +{
> +    av_assert1(!link->status_in);
> +    av_assert1(!link->status_out);
> +    link->frame_wanted_out = 1;
> +    ff_filter_set_ready(link->src, 100);
> +}
> +
>  const AVClass *avfilter_get_class(void)
>  {
>      return &avfilter_class;
> diff --git a/libavfilter/filters.h b/libavfilter/filters.h
> index 95df86c911..4ffddf117f 100644
> --- a/libavfilter/filters.h
> +++ b/libavfilter/filters.h
> @@ -100,4 +100,12 @@ int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe);
>   */
>  int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus);
>  
> +/**
> + * Mark that a frame is wanted on the link.
> + * Unlike ff_filter_frame(), it must not be called when the link has a
> + * non-zero status, and thus does not acknowledge it.
> + * Also it cannot fail.
> + */
> +void ff_inlink_set_frame_wanted(AVFilterLink *link);

iam tempted to suggest to call this
ff_inlink_request_frame()

it would be the better name if ff_request_frame() didnt exist.


[...]
diff mbox

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 7e02d9ca8b..d7677d5f23 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1634,6 +1634,14 @@  void ff_inlink_process_timeline(AVFilterLink *link, const AVFrame *frame)
     dstctx->is_disabled = fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) < 0.5;
 }
 
+void ff_inlink_set_frame_wanted(AVFilterLink *link)
+{
+    av_assert1(!link->status_in);
+    av_assert1(!link->status_out);
+    link->frame_wanted_out = 1;
+    ff_filter_set_ready(link->src, 100);
+}
+
 const AVClass *avfilter_get_class(void)
 {
     return &avfilter_class;
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 95df86c911..4ffddf117f 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -100,4 +100,12 @@  int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe);
  */
 int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus);
 
+/**
+ * Mark that a frame is wanted on the link.
+ * Unlike ff_filter_frame(), it must not be called when the link has a
+ * non-zero status, and thus does not acknowledge it.
+ * Also it cannot fail.
+ */
+void ff_inlink_set_frame_wanted(AVFilterLink *link);
+
 #endif /* AVFILTER_FILTERS_H */