]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vsrc_color.c
lavfi: make filters less verbose.
[ffmpeg] / libavfilter / vsrc_color.c
index 6d41c8ab71006981078f562b2b42c46ad399dbbe..2d361a1b692bf0e4e5a846cc36ce1ce3baf21e7e 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+/**
+ * @file
+ * color source
+ */
+
 #include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/imgutils.h"
+#include "libavutil/mathematics.h"
 #include "libavutil/parseutils.h"
 #include "drawutils.h"
 
@@ -35,7 +44,7 @@ typedef struct {
     uint64_t pts;
 } ColorContext;
 
-static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int color_init(AVFilterContext *ctx, const char *args)
 {
     ColorContext *color = ctx->priv;
     char color_string[128] = "black";
@@ -94,7 +103,7 @@ static int query_formats(AVFilterContext *ctx)
         PIX_FMT_NONE
     };
 
-    avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+    ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
     return 0;
 }
 
@@ -118,12 +127,13 @@ static int color_config_props(AVFilterLink *inlink)
     ff_fill_line_with_color(color->line, color->line_step, color->w, color->color,
                             inlink->format, rgba_color, &is_packed_rgba, NULL);
 
-    av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n",
+    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n",
            color->w, color->h, color->time_base.den, color->time_base.num,
            color->color[0], color->color[1], color->color[2], color->color[3],
            is_packed_rgba ? "rgba" : "yuva");
     inlink->w = color->w;
     inlink->h = color->h;
+    inlink->time_base = color->time_base;
 
     return 0;
 }
@@ -131,17 +141,17 @@ static int color_config_props(AVFilterLink *inlink)
 static int color_request_frame(AVFilterLink *link)
 {
     ColorContext *color = link->src->priv;
-    AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h);
+    AVFilterBufferRef *picref = ff_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h);
     picref->video->pixel_aspect = (AVRational) {1, 1};
-    picref->pts                 = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q);
-    picref->pos                 = 0;
+    picref->pts                 = color->pts++;
+    picref->pos                 = -1;
 
-    avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
+    ff_start_frame(link, avfilter_ref_buffer(picref, ~0));
     ff_draw_rectangle(picref->data, picref->linesize,
                       color->line, color->line_step, color->hsub, color->vsub,
                       0, 0, color->w, color->h);
-    avfilter_draw_slice(link, 0, color->h, 1);
-    avfilter_end_frame(link);
+    ff_draw_slice(link, 0, color->h, 1);
+    ff_end_frame(link);
     avfilter_unref_buffer(picref);
 
     return 0;