[FFmpeg-cvslog] lavfi/frei0r: use AV_OPT_TYPE_VIDEO_RATE

Paul B Mahol git at videolan.org
Fri Jul 26 17:29:47 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Jul 26 15:24:55 2013 +0000| [7ac736afbd184e4ddf035e8e1a04361654b56f86] | committer: Paul B Mahol

lavfi/frei0r: use AV_OPT_TYPE_VIDEO_RATE

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7ac736afbd184e4ddf035e8e1a04361654b56f86
---

 libavfilter/vf_frei0r.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 9a0ddd2..27d5a26 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -68,7 +68,7 @@ typedef struct Frei0rContext {
     char *dl_name;
     char *params;
     char *size;
-    char *framerate;
+    AVRational framerate;
 
     /* only used by the source */
     int w, h;
@@ -455,19 +455,14 @@ AVFilter avfilter_vf_frei0r = {
 static av_cold int source_init(AVFilterContext *ctx)
 {
     Frei0rContext *s = ctx->priv;
-    AVRational frame_rate_q;
 
     if (av_parse_video_size(&s->w, &s->h, s->size) < 0) {
         av_log(ctx, AV_LOG_ERROR, "Invalid frame size: '%s'\n", s->size);
         return AVERROR(EINVAL);
     }
 
-    if (av_parse_video_rate(&frame_rate_q, s->framerate) < 0) {
-        av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", s->framerate);
-        return AVERROR(EINVAL);
-    }
-    s->time_base.num = frame_rate_q.den;
-    s->time_base.den = frame_rate_q.num;
+    s->time_base.num = s->framerate.den;
+    s->time_base.den = s->framerate.num;
 
     return frei0r_init(ctx, s->dl_name, F0R_PLUGIN_TYPE_SOURCE);
 }
@@ -513,7 +508,7 @@ static int source_request_frame(AVFilterLink *outlink)
 
 static const AVOption frei0r_src_options[] = {
     { "size",          "Dimensions of the generated video.", OFFSET(size),      AV_OPT_TYPE_STRING, { .str = "" },   .flags = FLAGS },
-    { "framerate",     NULL,                                 OFFSET(framerate), AV_OPT_TYPE_STRING, { .str = "25" }, .flags = FLAGS },
+    { "framerate",     NULL,                                 OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, .flags = FLAGS },
     { "filter_name",   NULL,                                 OFFSET(dl_name),   AV_OPT_TYPE_STRING,                  .flags = FLAGS },
     { "filter_params", NULL,                                 OFFSET(params),    AV_OPT_TYPE_STRING,                  .flags = FLAGS },
     { NULL },



More information about the ffmpeg-cvslog mailing list