[FFmpeg-cvslog] lavfi/frei0r: add additional trailing slash in FREI0R_PATH paths

Stefano Sabatini git at videolan.org
Tue Nov 13 22:58:28 CET 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Mon Oct 29 18:44:27 2012 +0100| [334a0d15c6acd1ea607475d7ae24c949597b5de3] | committer: Stefano Sabatini

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 at gmail.com>.

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

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

diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 2935394..0ea7c04 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"))) {



More information about the ffmpeg-cvslog mailing list