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
bc6461c2
Commit
bc6461c2
authored
Feb 26, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
af_compand: replace strtok_r() with av_get_token()
parent
fb3b2f5d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
9 deletions
+24
-9
configure
configure
+0
-1
af_compand.c
libavfilter/af_compand.c
+24
-8
No files found.
configure
View file @
bc6461c2
...
...
@@ -2015,7 +2015,6 @@ unix_protocol_select="network"
# filters
blackframe_filter_deps
=
"gpl"
boxblur_filter_deps
=
"gpl"
compand_filter_deps
=
"strtok_r"
cropdetect_filter_deps
=
"gpl"
delogo_filter_deps
=
"gpl"
drawtext_filter_deps
=
"libfreetype"
...
...
libavfilter/af_compand.c
View file @
bc6461c2
...
...
@@ -29,6 +29,7 @@
#include <string.h>
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/mathematics.h"
...
...
@@ -330,7 +331,7 @@ static int config_output(AVFilterLink *outlink)
CompandContext
*
s
=
ctx
->
priv
;
const
int
sample_rate
=
outlink
->
sample_rate
;
double
radius
=
s
->
curve_dB
*
M_LN10
/
20
.
0
;
c
har
*
p
,
*
saveptr
=
NULL
;
c
onst
char
*
p
;
const
int
channels
=
av_get_channel_layout_nb_channels
(
outlink
->
channel_layout
);
int
nb_attacks
,
nb_decays
,
nb_points
;
...
...
@@ -368,25 +369,34 @@ static int config_output(AVFilterLink *outlink)
p
=
s
->
attacks
;
for
(
i
=
0
,
new_nb_items
=
0
;
i
<
nb_attacks
;
i
++
)
{
char
*
tstr
=
strtok_r
(
p
,
"|"
,
&
saveptr
);
p
=
NULL
;
char
*
tstr
=
av_get_token
(
&
p
,
"|"
);
if
(
!
tstr
)
return
AVERROR
(
ENOMEM
);
new_nb_items
+=
sscanf
(
tstr
,
"%f"
,
&
s
->
channels
[
i
].
attack
)
==
1
;
av_freep
(
&
tstr
);
if
(
s
->
channels
[
i
].
attack
<
0
)
{
uninit
(
ctx
);
return
AVERROR
(
EINVAL
);
}
if
(
*
p
)
p
++
;
}
nb_attacks
=
new_nb_items
;
p
=
s
->
decays
;
for
(
i
=
0
,
new_nb_items
=
0
;
i
<
nb_decays
;
i
++
)
{
char
*
tstr
=
strtok_r
(
p
,
"|"
,
&
saveptr
);
p
=
NULL
;
char
*
tstr
=
av_get_token
(
&
p
,
"|"
);
if
(
!
tstr
)
return
AVERROR
(
ENOMEM
);
new_nb_items
+=
sscanf
(
tstr
,
"%f"
,
&
s
->
channels
[
i
].
decay
)
==
1
;
av_freep
(
&
tstr
);
if
(
s
->
channels
[
i
].
decay
<
0
)
{
uninit
(
ctx
);
return
AVERROR
(
EINVAL
);
}
if
(
*
p
)
p
++
;
}
nb_decays
=
new_nb_items
;
...
...
@@ -401,9 +411,13 @@ static int config_output(AVFilterLink *outlink)
#define S(x) s->segments[2 * ((x) + 1)]
p
=
s
->
points
;
for
(
i
=
0
,
new_nb_items
=
0
;
i
<
nb_points
;
i
++
)
{
char
*
tstr
=
strtok_r
(
p
,
"|"
,
&
saveptr
);
p
=
NULL
;
if
(
sscanf
(
tstr
,
"%f/%f"
,
&
S
(
i
).
x
,
&
S
(
i
).
y
)
!=
2
)
{
char
*
tstr
=
av_get_token
(
&
p
,
"|"
);
if
(
!
tstr
)
return
AVERROR
(
ENOMEM
);
err
=
sscanf
(
tstr
,
"%f/%f"
,
&
S
(
i
).
x
,
&
S
(
i
).
y
);
av_freep
(
&
tstr
);
if
(
err
!=
2
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid and/or missing input/output value.
\n
"
);
uninit
(
ctx
);
...
...
@@ -418,6 +432,8 @@ static int config_output(AVFilterLink *outlink)
S
(
i
).
y
-=
S
(
i
).
x
;
av_log
(
ctx
,
AV_LOG_DEBUG
,
"%d: x=%f y=%f
\n
"
,
i
,
S
(
i
).
x
,
S
(
i
).
y
);
new_nb_items
++
;
if
(
*
p
)
p
++
;
}
num
=
new_nb_items
;
...
...
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