[FFmpeg-cvslog] lavfi/perms: use standard options parsing.

Clément Bœsch git at videolan.org
Sun Mar 24 12:33:29 CET 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sun Mar 24 08:42:10 2013 +0100| [f7324c068f48ce57226a11d86323f5ae70fcc5b8] | committer: Clément Bœsch

lavfi/perms: use standard options parsing.

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

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

diff --git a/libavfilter/f_perms.c b/libavfilter/f_perms.c
index ddba03e..74c6e87 100644
--- a/libavfilter/f_perms.c
+++ b/libavfilter/f_perms.c
@@ -52,21 +52,12 @@ static const AVOption options[] = {
 
 static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *class)
 {
-    int ret;
     PermsContext *perms = ctx->priv;
-    static const char *shorthand[] = { "mode", NULL };
-
-    perms->class = class;
-    av_opt_set_defaults(perms);
-
-    if ((ret = av_opt_set_from_string(perms, args, shorthand, "=", ":")) < 0)
-        return ret;
 
     // TODO: add a seed option
     if (perms->mode == MODE_RANDOM)
         av_lfg_init(&perms->lfg, av_get_random_seed());
 
-    av_opt_free(perms);
     return 0;
 }
 
@@ -110,6 +101,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
     return ret;
 }
 
+static const char *const shorthand[] = { "mode", NULL };
+
 #if CONFIG_APERMS_FILTER
 
 #define aperms_options options
@@ -145,6 +138,7 @@ AVFilter avfilter_af_aperms = {
     .inputs      = aperms_inputs,
     .outputs     = aperms_outputs,
     .priv_class  = &aperms_class,
+    .shorthand   = shorthand,
 };
 #endif /* CONFIG_APERMS_FILTER */
 
@@ -183,5 +177,6 @@ AVFilter avfilter_vf_perms = {
     .inputs      = perms_inputs,
     .outputs     = perms_outputs,
     .priv_class  = &perms_class,
+    .shorthand   = shorthand,
 };
 #endif /* CONFIG_PERMS_FILTER */



More information about the ffmpeg-cvslog mailing list