diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-03-26 16:08:44 +0400 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-03-26 17:23:42 +0400 |
commit | 975efc8864a9fb994e8f3b70c2e4ed97ac7dd771 (patch) | |
tree | bd4e33f51abb968c29f2d5b3ec7b9b1ab1c0ee9b /libavfilter | |
parent | 54056c6655c2025691127d9bfba6e6fca295aba5 (diff) |
lavfi/mandelbrot: make use of AV_OPT_TYPE_VIDEO_RATE
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vsrc_mandelbrot.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c index 945c7071c6..d754f22b5e 100644 --- a/libavfilter/vsrc_mandelbrot.c +++ b/libavfilter/vsrc_mandelbrot.c @@ -58,9 +58,8 @@ typedef struct Point { typedef struct { const AVClass *class; int w, h; - AVRational time_base; + AVRational frame_rate; uint64_t pts; - char *rate; int maxiter; double start_x; double start_y; @@ -84,8 +83,8 @@ typedef struct { static const AVOption mandelbrot_options[] = { {"size", "set frame size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="640x480"}, CHAR_MIN, CHAR_MAX, FLAGS }, {"s", "set frame size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="640x480"}, CHAR_MIN, CHAR_MAX, FLAGS }, - {"rate", "set frame rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str="25"}, CHAR_MIN, CHAR_MAX, FLAGS }, - {"r", "set frame rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str="25"}, CHAR_MIN, CHAR_MAX, FLAGS }, + {"rate", "set frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, CHAR_MIN, CHAR_MAX, FLAGS }, + {"r", "set frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, CHAR_MIN, CHAR_MAX, FLAGS }, {"maxiter", "set max iterations number", OFFSET(maxiter), AV_OPT_TYPE_INT, {.i64=7189}, 1, INT_MAX, FLAGS }, {"start_x", "set the initial x position", OFFSET(start_x), AV_OPT_TYPE_DOUBLE, {.dbl=-0.743643887037158704752191506114774}, -100, 100, FLAGS }, {"start_y", "set the initial y position", OFFSET(start_y), AV_OPT_TYPE_DOUBLE, {.dbl=-0.131825904205311970493132056385139}, -100, 100, FLAGS }, @@ -112,7 +111,6 @@ AVFILTER_DEFINE_CLASS(mandelbrot); static av_cold int init(AVFilterContext *ctx, const char *args) { MBContext *mb = ctx->priv; - AVRational rate_q; int err; mb->class = &mandelbrot_class; @@ -125,13 +123,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args) mb->start_scale /=mb->h; mb->end_scale /=mb->h; - if (av_parse_video_rate(&rate_q, mb->rate) < 0) { - av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", mb->rate); - return AVERROR(EINVAL); - } - mb->time_base.num = rate_q.den; - mb->time_base.den = rate_q.num; - mb->cache_allocated = mb->w * mb->h * 3; mb->cache_used = 0; mb->point_cache= av_malloc(sizeof(*mb->point_cache)*mb->cache_allocated); @@ -145,7 +136,6 @@ static av_cold void uninit(AVFilterContext *ctx) { MBContext *mb = ctx->priv; - av_freep(&mb->rate); av_freep(&mb->point_cache); av_freep(&mb-> next_cache); av_freep(&mb->zyklus); @@ -172,7 +162,7 @@ static int config_props(AVFilterLink *inlink) inlink->w = mb->w; inlink->h = mb->h; - inlink->time_base = mb->time_base; + inlink->time_base = av_inv_q(mb->frame_rate); return 0; } |