aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-10-29 18:44:27 +0100
committerStefano Sabatini <stefasab@gmail.com>2012-11-13 22:54:29 +0100
commit334a0d15c6acd1ea607475d7ae24c949597b5de3 (patch)
tree99d1b7a2539e96319086a7a14b1475eb77f6c948
parent9a2028d4f4d628ba2d70a182414b709aabcb9a17 (diff)
downloadffmpeg-334a0d15c6acd1ea607475d7ae24c949597b5de3.tar.gz
lavfi/frei0r: add additional trailing slash in FREI0R_PATH paths
Allow to accept paths with no ending trailing slash. Based on a patch by rogerdpack <rogerpack2005@gmail.com>.
-rw-r--r--libavfilter/vf_frei0r.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 29353943f2..0ea7c04ef1 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -230,9 +230,18 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
const char *separator = ":";
#endif
char *p, *ptr = NULL;
- 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) {
+ /* add additional trailing slash in case it is missing */
+ char *p1 = av_asprintf("%s/", p);
+ if (!p1) {
+ av_free(path);
+ return AVERROR(ENOMEM);
+ }
+ frei0r->dl_handle = load_path(ctx, p1, dl_name);
+ av_free(p1);
+ if (frei0r->dl_handle)
break;
+ }
av_free(path);
}
if (!frei0r->dl_handle && (path = getenv("HOME"))) {