Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
6c7ae493
Commit
6c7ae493
authored
Nov 16, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/frei0r: extend load_path() to support arbitrarily long paths
parent
d6c18488
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
vf_frei0r.c
libavfilter/vf_frei0r.c
+26
-11
No files found.
libavfilter/vf_frei0r.c
View file @
6c7ae493
...
@@ -204,13 +204,15 @@ static int set_params(AVFilterContext *ctx, const char *params)
...
@@ -204,13 +204,15 @@ static int set_params(AVFilterContext *ctx, const char *params)
return
0
;
return
0
;
}
}
static
void
*
load_path
(
AVFilterContext
*
ctx
,
const
char
*
prefix
,
const
char
*
name
)
static
int
load_path
(
AVFilterContext
*
ctx
,
void
**
handle_ptr
,
const
char
*
prefix
,
const
char
*
name
)
{
{
char
path
[
1024
]
;
char
*
path
=
av_asprintf
(
"%s%s%s"
,
prefix
,
name
,
SLIBSUF
)
;
if
(
!
path
)
snprintf
(
path
,
sizeof
(
path
),
"%s%s%s"
,
prefix
,
name
,
SLIBSUF
);
return
AVERROR
(
ENOMEM
);
av_log
(
ctx
,
AV_LOG_DEBUG
,
"Looking for frei0r effect in '%s'
\n
"
,
path
);
av_log
(
ctx
,
AV_LOG_DEBUG
,
"Looking for frei0r effect in '%s'
\n
"
,
path
);
return
dlopen
(
path
,
RTLD_NOW
|
RTLD_LOCAL
);
*
handle_ptr
=
dlopen
(
path
,
RTLD_NOW
|
RTLD_LOCAL
);
av_free
(
path
);
return
0
;
}
}
static
av_cold
int
frei0r_init
(
AVFilterContext
*
ctx
,
static
av_cold
int
frei0r_init
(
AVFilterContext
*
ctx
,
...
@@ -221,6 +223,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
...
@@ -221,6 +223,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
f0r_get_plugin_info_f
f0r_get_plugin_info
;
f0r_get_plugin_info_f
f0r_get_plugin_info
;
f0r_plugin_info_t
*
pi
;
f0r_plugin_info_t
*
pi
;
char
*
path
;
char
*
path
;
int
ret
=
0
;
/* see: http://frei0r.dyne.org/codedoc/html/group__pluglocations.html */
/* see: http://frei0r.dyne.org/codedoc/html/group__pluglocations.html */
if
((
path
=
av_strdup
(
getenv
(
"FREI0R_PATH"
))))
{
if
((
path
=
av_strdup
(
getenv
(
"FREI0R_PATH"
))))
{
...
@@ -237,8 +240,12 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
...
@@ -237,8 +240,12 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
av_free
(
path
);
av_free
(
path
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
frei0r
->
dl_handle
=
load_path
(
ctx
,
p1
,
dl_name
);
ret
=
load_path
(
ctx
,
&
frei0r
->
dl_handle
,
p1
,
dl_name
);
av_free
(
p1
);
av_free
(
p1
);
if
(
ret
<
0
)
{
av_free
(
path
);
return
ret
;
}
if
(
frei0r
->
dl_handle
)
if
(
frei0r
->
dl_handle
)
break
;
break
;
}
}
...
@@ -248,13 +255,21 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
...
@@ -248,13 +255,21 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
char
*
prefix
=
av_asprintf
(
"%s/.frei0r-1/lib/"
,
path
);
char
*
prefix
=
av_asprintf
(
"%s/.frei0r-1/lib/"
,
path
);
if
(
!
prefix
)
if
(
!
prefix
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
frei0r
->
dl_handle
=
load_path
(
ctx
,
prefix
,
dl_name
);
ret
=
load_path
(
ctx
,
&
frei0r
->
dl_handle
,
prefix
,
dl_name
);
av_free
(
prefix
);
av_free
(
prefix
);
if
(
ret
<
0
)
return
ret
;
}
if
(
!
frei0r
->
dl_handle
)
{
ret
=
load_path
(
ctx
,
&
frei0r
->
dl_handle
,
"/usr/local/lib/frei0r-1/"
,
dl_name
);
if
(
ret
<
0
)
return
ret
;
}
if
(
!
frei0r
->
dl_handle
)
{
ret
=
load_path
(
ctx
,
&
frei0r
->
dl_handle
,
"/usr/lib/frei0r-1/"
,
dl_name
);
if
(
ret
<
0
)
return
ret
;
}
}
if
(
!
frei0r
->
dl_handle
)
frei0r
->
dl_handle
=
load_path
(
ctx
,
"/usr/local/lib/frei0r-1/"
,
dl_name
);
if
(
!
frei0r
->
dl_handle
)
frei0r
->
dl_handle
=
load_path
(
ctx
,
"/usr/lib/frei0r-1/"
,
dl_name
);
if
(
!
frei0r
->
dl_handle
)
{
if
(
!
frei0r
->
dl_handle
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Could not find module '%s'
\n
"
,
dl_name
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Could not find module '%s'
\n
"
,
dl_name
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment