]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/f_loop: warn about unset loop sizes
authorMarton Balint <cus@passwd.hu>
Thu, 23 May 2019 20:20:44 +0000 (22:20 +0200)
committerMarton Balint <cus@passwd.hu>
Fri, 24 May 2019 19:39:07 +0000 (21:39 +0200)
Signed-off-by: Marton Balint <cus@passwd.hu>
libavfilter/f_loop.c

index fcbd742eb46548217913860c1411f16f9dca6925..5ec44d9da2e4b3e7d727dfaaaf3c3a48ff4218d1 100644 (file)
@@ -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;
 }