aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_frei0r.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2014-02-22 17:46:25 +0100
committerMarton Balint <cus@passwd.hu>2014-02-26 22:48:37 +0100
commitead0dd3cf6e524743a8cedc61223423ac6d6e784 (patch)
tree06e385f29a13b249b34950b07fc2269260e6368e /libavfilter/vf_frei0r.c
parent35ead1f281ad589a436613cac0775d3e52a76ac3 (diff)
downloadffmpeg-ead0dd3cf6e524743a8cedc61223423ac6d6e784.tar.gz
lavfi/frei0r: factorize plugin loading with static path
Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavfilter/vf_frei0r.c')
-rw-r--r--libavfilter/vf_frei0r.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 54b50b32b6..dbf3398986 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include "config.h"
#include "libavutil/avstring.h"
+#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
@@ -231,6 +232,13 @@ 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/"
+ };
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 && i < FF_ARRAY_ELEMS(frei0r_pathlist); i++) {
+ ret = load_path(ctx, &s->dl_handle, frei0r_pathlist[i], dl_name);
if (ret < 0)
return ret;
}