diff mbox

[FFmpeg-devel,2/2] avfilter/f_loop: warn about unset loop sizes

Message ID 20190523213718.31673-2-cus@passwd.hu
State Accepted
Commit 1eb54323c82ff6eff18553fd3f2788a695bdf812
Headers show

Commit Message

Marton Balint May 23, 2019, 9:37 p.m. UTC
Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/f_loop.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Paul B Mahol May 24, 2019, 8:01 a.m. UTC | #1
On 5/23/19, Marton Balint <cus@passwd.hu> wrote:
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavfilter/f_loop.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/libavfilter/f_loop.c b/libavfilter/f_loop.c
> index fcbd742eb4..5ec44d9da2 100644
> --- a/libavfilter/f_loop.c
> +++ b/libavfilter/f_loop.c
> @@ -55,6 +55,15 @@ typedef struct LoopContext {
>  #define VFLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
>  #define OFFSET(x) offsetof(LoopContext, x)
>
> +static void check_size(AVFilterContext *ctx)
> +{
> +    LoopContext *s = ctx->priv;
> +
> +    if (!s->size)
> +        av_log(ctx, AV_LOG_WARNING, "Number of %s to loop is not set!\n",
> +               ctx->input_pads[0].type == AVMEDIA_TYPE_VIDEO ? "frames" :
> "samples");
> +}
> +
>  #if CONFIG_ALOOP_FILTER
>
>  static int aconfig_input(AVFilterLink *inlink)
> @@ -67,6 +76,8 @@ static int aconfig_input(AVFilterLink *inlink)
>      if (!s->fifo || !s->left)
>          return AVERROR(ENOMEM);
>
> +    check_size(ctx);
> +
>      return 0;
>  }
>
> @@ -250,6 +261,8 @@ static av_cold int init(AVFilterContext *ctx)
>      if (!s->frames)
>          return AVERROR(ENOMEM);
>
> +    check_size(ctx);
> +
>      return 0;
>  }
>

lgtm

> --
> 2.16.4
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox

Patch

diff --git a/libavfilter/f_loop.c b/libavfilter/f_loop.c
index fcbd742eb4..5ec44d9da2 100644
--- a/libavfilter/f_loop.c
+++ b/libavfilter/f_loop.c
@@ -55,6 +55,15 @@  typedef struct LoopContext {
 #define VFLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 #define OFFSET(x) offsetof(LoopContext, x)
 
+static void check_size(AVFilterContext *ctx)
+{
+    LoopContext *s = ctx->priv;
+
+    if (!s->size)
+        av_log(ctx, AV_LOG_WARNING, "Number of %s to loop is not set!\n",
+               ctx->input_pads[0].type == AVMEDIA_TYPE_VIDEO ? "frames" : "samples");
+}
+
 #if CONFIG_ALOOP_FILTER
 
 static int aconfig_input(AVFilterLink *inlink)
@@ -67,6 +76,8 @@  static int aconfig_input(AVFilterLink *inlink)
     if (!s->fifo || !s->left)
         return AVERROR(ENOMEM);
 
+    check_size(ctx);
+
     return 0;
 }
 
@@ -250,6 +261,8 @@  static av_cold int init(AVFilterContext *ctx)
     if (!s->frames)
         return AVERROR(ENOMEM);
 
+    check_size(ctx);
+
     return 0;
 }