avfilter/ff_filter_frame_needs_framing: fix handling of AV_NOPTS_VALUE
[ffmpeg.git] / libavfilter / vsrc_mandelbrot.c
index 0b5deaf..bd22be3 100644 (file)
@@ -119,16 +119,10 @@ static const AVOption mandelbrot_options[] = {
 
 AVFILTER_DEFINE_CLASS(mandelbrot);
 
-static av_cold int init(AVFilterContext *ctx, const char *args)
+static av_cold int init(AVFilterContext *ctx)
 {
     MBContext *mb = ctx->priv;
-    int err;
 
-    mb->class = &mandelbrot_class;
-    av_opt_set_defaults(mb);
-
-    if ((err = (av_set_options_string(mb, args, "=", ":"))) < 0)
-        return err;
     mb->bailout *= mb->bailout;
 
     mb->start_scale /=mb->h;
@@ -281,13 +275,12 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
                 continue;
             if(!mb->morphamp){
                 if(interpol(mb, color, x, y, linesize)){
-                //TODO: reindent
-                if(next_cidx < mb->cache_allocated){
-                    mb->next_cache[next_cidx  ].p[0]= cr;
-                    mb->next_cache[next_cidx  ].p[1]= ci;
-                    mb->next_cache[next_cidx++].val = color[x + y*linesize];
-                }
-                continue;
+                    if(next_cidx < mb->cache_allocated){
+                        mb->next_cache[next_cidx  ].p[0]= cr;
+                        mb->next_cache[next_cidx  ].p[1]= ci;
+                        mb->next_cache[next_cidx++].val = color[x + y*linesize];
+                    }
+                    continue;
                 }
             }else{
                 zr += cos(pts * mb->morphxf) * mb->morphamp;
@@ -404,6 +397,9 @@ static int request_frame(AVFilterLink *link)
 {
     MBContext *mb = link->src->priv;
     AVFrame *picref = ff_get_video_buffer(link, mb->w, mb->h);
+    if (!picref)
+        return AVERROR(ENOMEM);
+
     picref->sample_aspect_ratio = (AVRational) {1, 1};
     picref->pts = mb->pts++;
 
@@ -418,19 +414,17 @@ static const AVFilterPad mandelbrot_outputs[] = {
         .request_frame = request_frame,
         .config_props  = config_props,
     },
-    { NULL },
+    { NULL }
 };
 
 AVFilter avfilter_vsrc_mandelbrot = {
-    .name        = "mandelbrot",
-    .description = NULL_IF_CONFIG_SMALL("Render a Mandelbrot fractal."),
-
-    .priv_size = sizeof(MBContext),
-    .init      = init,
-    .uninit    = uninit,
-
+    .name          = "mandelbrot",
+    .description   = NULL_IF_CONFIG_SMALL("Render a Mandelbrot fractal."),
+    .priv_size     = sizeof(MBContext),
+    .priv_class    = &mandelbrot_class,
+    .init          = init,
+    .uninit        = uninit,
     .query_formats = query_formats,
     .inputs        = NULL,
     .outputs       = mandelbrot_outputs,
-    .priv_class    = &mandelbrot_class,
 };