[FFmpeg-devel] frei0r patches

Stefano Sabatini stefasab at gmail.com
Fri Oct 12 12:36:48 CEST 2012


On date Wednesday 2012-10-10 17:45:23 -0600, Roger Pack encoded:
> These patches allow one to use absolute paths in windows within
> FREI0R_PATH environment variable (which is nice--I wasn't sure if
> there is a better way though), and also adds a trailing slash to the
> paths when they're found within FREI0R_PATH, which I think is right,
> based on  http://piksel.org/frei0r/1.2/spec/1.2/spec/group__pluglocations.html

>From the linked document:

|FREI0R_PATH Environment Variable

|If the environment variable FREI0R_PATH is defined, then it shall be
|considered a colon separated list of directories which replaces the
|default list.  For example:
|
|FREI0R_PATH=/home/foo/frei0r-plugins:/usr/lib/frei0r-1:/etc/frei0r 

BTW, the new site location should be:
http://frei0r.dyne.org/

but it has apparently some problems (and there is no reference to
frei0r API 1.2).

So the question is, how ":"/";" makes any difference?

> Thanks.
> -roger-

> From 6b86dd5dc55a1914d2a7ea3cb4078fd0cd8f7c9c Mon Sep 17 00:00:00 2001
> From: rogerdpack <rogerpack2005 at gmail.com>
> Date: Wed, 10 Oct 2012 17:28:55 -0600
> Subject: [PATCH 1/2] frei0r: allow for windows style paths
> 
> 
> Signed-off-by: rogerdpack <rogerpack2005 at gmail.com>
> ---
>  libavfilter/vf_frei0r.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
> index 0845702..97c6517 100644
> --- a/libavfilter/vf_frei0r.c
> +++ b/libavfilter/vf_frei0r.c
> @@ -225,7 +225,12 @@ 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 = av_strtok(p, ":", &ptr); p = NULL)
> +#ifdef __WIN32 
> +        const char *separator = ";";
> +#else
> +        const char *separator = ":";
> +#endif
> +        for (p = path; p = av_strtok(p, separator, &ptr); p = NULL)
>              if (frei0r->dl_handle = load_path(ctx, p, dl_name))
>                  break;
>          av_free(path);
> -- 
> 1.7.9.5
> 

> From 42212c664c24d813ff5d843dd04aac5cf6d7de45 Mon Sep 17 00:00:00 2001
> From: rogerdpack <rogerpack2005 at gmail.com>
> Date: Wed, 10 Oct 2012 17:38:35 -0600
> Subject: [PATCH 2/2] frei0r: add trailing slash to FREI0R_PATH elements
> 
> 
> Signed-off-by: rogerdpack <rogerpack2005 at gmail.com>
> ---
>  libavfilter/vf_frei0r.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
> index 97c6517..047ab94 100644
> --- a/libavfilter/vf_frei0r.c
> +++ b/libavfilter/vf_frei0r.c
> @@ -230,9 +230,12 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
>  #else
>          const char *separator = ":";
>  #endif
> -        for (p = path; p = av_strtok(p, separator, &ptr); p = NULL)
> -            if (frei0r->dl_handle = load_path(ctx, p, dl_name))
> +        for (p = path; p = av_strtok(p, separator, &ptr); p = NULL) {
> +            char with_trailing_slash[1024];
> +            snprintf(with_trailing_slash, sizeof(with_trailing_slash), "%s/", p);

If path is long >=1024 chars, then the path is cut (you should rather
av_strdup).

Also, what problem is this solving?

> +            if (frei0r->dl_handle = load_path(ctx, with_trailing_slash, dl_name))
>                  break;
> +        }
>          av_free(path);
>      }
>      if (!frei0r->dl_handle && (path = getenv("HOME"))) {
-- 
FFmpeg = Frightening and Free Marvellous Puritan Ecstatic Gadget


More information about the ffmpeg-devel mailing list