[FFmpeg-devel] [PATCH 2/2] lavfi/frei0r: factorize plugin loading with static path
Marton Balint
cus at passwd.hu
Sat Feb 22 17:57:52 CET 2014
Signed-off-by: Marton Balint <cus at passwd.hu>
---
libavfilter/vf_frei0r.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 54b50b3..03b8e70 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -231,6 +231,14 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
f0r_plugin_info_t *pi;
char *path;
int ret = 0;
+ int i;
+ static const char* const frei0r_pathlist[] = {
+ "/usr/local/lib/frei0r-1/",
+ "/usr/lib/frei0r-1/",
+ "/usr/local/lib64/frei0r-1/",
+ "/usr/lib64/frei0r-1/",
+ NULL
+ };
if (!dl_name) {
av_log(ctx, AV_LOG_ERROR, "No filter name provided.\n");
@@ -274,23 +282,8 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
if (ret < 0)
return ret;
}
- if (!s->dl_handle) {
- ret = load_path(ctx, &s->dl_handle, "/usr/local/lib/frei0r-1/", dl_name);
- if (ret < 0)
- return ret;
- }
- if (!s->dl_handle) {
- ret = load_path(ctx, &s->dl_handle, "/usr/lib/frei0r-1/", dl_name);
- if (ret < 0)
- return ret;
- }
- if (!s->dl_handle) {
- ret = load_path(ctx, &s->dl_handle, "/usr/local/lib64/frei0r-1/", dl_name);
- if (ret < 0)
- return ret;
- }
- if (!s->dl_handle) {
- ret = load_path(ctx, &s->dl_handle, "/usr/lib64/frei0r-1/", dl_name);
+ for (i = 0; !s->dl_handle && frei0r_pathlist[i];) {
+ ret = load_path(ctx, &s->dl_handle, frei0r_pathlist[i++], dl_name);
if (ret < 0)
return ret;
}
--
1.8.4.5
More information about the ffmpeg-devel
mailing list