]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_frei0r.c
avio: add a destructor for AVIOContext
[ffmpeg] / libavfilter / vf_frei0r.c
index fde6e1a96c7bf35bd3b0b9b6a6d2ed7d432bdc15..f41fbcbb30675d14b213ee6fee7c3a3de11dbd52 100644 (file)
@@ -149,60 +149,13 @@ static int set_params(AVFilterContext *ctx, const char *params)
         if (*params) {
             if (!(param = av_get_token(&params, "|")))
                 return AVERROR(ENOMEM);
-            params++;               /* skip ':' */
+            if (*params)
+                params++;               /* skip ':' */
             ret = set_param(ctx, info, i, param);
             av_free(param);
             if (ret < 0)
                 return ret;
         }
-
-        av_log(ctx, AV_LOG_VERBOSE,
-               "idx:%d name:'%s' type:%s explanation:'%s' ",
-               i, info.name,
-               info.type == F0R_PARAM_BOOL     ? "bool"     :
-               info.type == F0R_PARAM_DOUBLE   ? "double"   :
-               info.type == F0R_PARAM_COLOR    ? "color"    :
-               info.type == F0R_PARAM_POSITION ? "position" :
-               info.type == F0R_PARAM_STRING   ? "string"   : "unknown",
-               info.explanation);
-
-#ifdef DEBUG
-        av_log(ctx, AV_LOG_DEBUG, "value:");
-        switch (info.type) {
-            void *v;
-            double d;
-            char s[128];
-            f0r_param_color_t col;
-            f0r_param_position_t pos;
-
-        case F0R_PARAM_BOOL:
-            v = &d;
-            s->get_param_value(s->instance, v, i);
-            av_log(ctx, AV_LOG_DEBUG, "%s", d >= 0.5 && d <= 1.0 ? "y" : "n");
-            break;
-        case F0R_PARAM_DOUBLE:
-            v = &d;
-            s->get_param_value(s->instance, v, i);
-            av_log(ctx, AV_LOG_DEBUG, "%f", d);
-            break;
-        case F0R_PARAM_COLOR:
-            v = &col;
-            s->get_param_value(s->instance, v, i);
-            av_log(ctx, AV_LOG_DEBUG, "%f/%f/%f", col.r, col.g, col.b);
-            break;
-        case F0R_PARAM_POSITION:
-            v = &pos;
-            s->get_param_value(s->instance, v, i);
-            av_log(ctx, AV_LOG_DEBUG, "%f/%f", pos.x, pos.y);
-            break;
-        default: /* F0R_PARAM_STRING */
-            v = s;
-            s->get_param_value(s->instance, v, i);
-            av_log(ctx, AV_LOG_DEBUG, "'%s'", s);
-            break;
-        }
-#endif
-        av_log(ctx, AV_LOG_VERBOSE, ".\n");
     }
 
     return 0;
@@ -232,12 +185,18 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
     }
 
     /* see: http://piksel.org/frei0r/1.2/spec/1.2/spec/group__pluglocations.html */
-    if ((path = av_strdup(getenv("FREI0R_PATH")))) {
-        char *p, *ptr = NULL;
-        for (p = path; p = strtok_r(p, ":", &ptr); p = NULL)
-            if (s->dl_handle = load_path(ctx, p, dl_name))
-                break;
-        av_free(path);
+    if (path = getenv("FREI0R_PATH")) {
+        while(*path) {
+            char *ptr = av_get_token((const char **)&path, ":");
+            if (!ptr)
+                return AVERROR(ENOMEM);
+            s->dl_handle = load_path(ctx, ptr, dl_name);
+            av_freep(&ptr);
+            if (s->dl_handle)
+                break;              /* found */
+            if (*path)
+                path++;             /* skip ':' */
+        }
     }
     if (!s->dl_handle && (path = getenv("HOME"))) {
         char prefix[1024];
@@ -452,6 +411,7 @@ static int source_config_props(AVFilterLink *outlink)
     outlink->w = s->w;
     outlink->h = s->h;
     outlink->time_base = s->time_base;
+    outlink->frame_rate = av_inv_q(s->time_base);
 
     if (s->destruct && s->instance)
         s->destruct(s->instance);