#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "internal.h"
+#include "formats.h"
+#include "video.h"
#define WIDTH 512
#define HEIGHT 512
{ NULL },
};
-static const char *mptestsrc_get_name(void *ctx)
-{
- return "mptestsrc";
-}
-
-static const AVClass mptestsrc_class = {
- "MPTestContext",
- mptestsrc_get_name,
- mptestsrc_options
-};
+AVFILTER_DEFINE_CLASS(mptestsrc);
static double c[64];
}
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
MPTestContext *test = ctx->priv;
AVRational frame_rate_q;
return ret;
}
- if ((ret = av_parse_video_rate(&frame_rate_q, test->rate)) < 0 ||
- frame_rate_q.den <= 0 || frame_rate_q.num <= 0) {
+ if ((ret = av_parse_video_rate(&frame_rate_q, test->rate)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate);
return ret;
}
test->frame_nb = 0;
test->pts = 0;
- av_log(ctx, AV_LOG_INFO, "rate:%d/%d duration:%f\n",
+ av_log(ctx, AV_LOG_VERBOSE, "rate:%d/%d duration:%f\n",
frame_rate_q.num, frame_rate_q.den,
duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base));
init_idct();
PIX_FMT_YUV420P, PIX_FMT_NONE
};
- avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
if (test->max_pts >= 0 && test->pts > test->max_pts)
return AVERROR_EOF;
- picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, w, h);
+ picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, w, h);
picref->pts = test->pts++;
// clean image
test->frame_nb++;
- avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
- avfilter_draw_slice(outlink, 0, picref->video->h, 1);
- avfilter_end_frame(outlink);
+ ff_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
+ ff_draw_slice(outlink, 0, picref->video->h, 1);
+ ff_end_frame(outlink);
avfilter_unref_buffer(picref);
return 0;