Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e21ba176
Commit
e21ba176
authored
Jan 06, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_sidechaincompress: add support for commands
parent
51927d33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
18 deletions
+43
-18
filters.texi
doc/filters.texi
+8
-0
af_sidechaincompress.c
libavfilter/af_sidechaincompress.c
+35
-18
No files found.
doc/filters.texi
View file @
e21ba176
...
...
@@ -443,6 +443,10 @@ How much to use compressed signal in output. Default is 1.
Range
is
between
0
and
1.
@
end
table
@
subsection
Commands
This
filter
supports
the
all
above
options
as
@
ref
{
commands
}.
@
section
acontrast
Simple
audio
dynamic
range
compression
/
expansion
filter
.
...
...
@@ -4680,6 +4684,10 @@ How much to use compressed signal in output. Default is 1.
Range is between 0 and 1.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@subsection Examples
@itemize
...
...
libavfilter/af_sidechaincompress.c
View file @
e21ba176
...
...
@@ -70,26 +70,27 @@ typedef struct SidechainCompressContext {
#define OFFSET(x) offsetof(SidechainCompressContext, x)
#define A AV_OPT_FLAG_AUDIO_PARAM
#define F AV_OPT_FLAG_FILTERING_PARAM
#define R AV_OPT_FLAG_RUNTIME_PARAM
static
const
AVOption
options
[]
=
{
{
"level_in"
,
"set input gain"
,
OFFSET
(
level_in
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
.
015625
,
64
,
A
|
F
},
{
"mode"
,
"set mode"
,
OFFSET
(
mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
A
|
F
,
"mode"
},
{
"downward"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
A
|
F
,
"mode"
},
{
"upward"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
A
|
F
,
"mode"
},
{
"threshold"
,
"set threshold"
,
OFFSET
(
threshold
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
0
.
125
},
0
.
000
976563
,
1
,
A
|
F
},
{
"ratio"
,
"set ratio"
,
OFFSET
(
ratio
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
2
},
1
,
20
,
A
|
F
},
{
"attack"
,
"set attack"
,
OFFSET
(
attack
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
20
},
0
.
01
,
2000
,
A
|
F
},
{
"release"
,
"set release"
,
OFFSET
(
release
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
250
},
0
.
01
,
9000
,
A
|
F
},
{
"makeup"
,
"set make up gain"
,
OFFSET
(
makeup
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
1
,
64
,
A
|
F
},
{
"knee"
,
"set knee"
,
OFFSET
(
knee
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
2
.
82843
},
1
,
8
,
A
|
F
},
{
"link"
,
"set link type"
,
OFFSET
(
link
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
A
|
F
,
"link"
},
{
"average"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
A
|
F
,
"link"
},
{
"maximum"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
A
|
F
,
"link"
},
{
"detection"
,
"set detection"
,
OFFSET
(
detection
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
1
,
A
|
F
,
"detection"
},
{
"peak"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
A
|
F
,
"detection"
},
{
"rms"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
A
|
F
,
"detection"
},
{
"level_sc"
,
"set sidechain gain"
,
OFFSET
(
level_sc
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
.
015625
,
64
,
A
|
F
},
{
"mix"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
A
|
F
},
{
"level_in"
,
"set input gain"
,
OFFSET
(
level_in
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
.
015625
,
64
,
A
|
F
|
R
},
{
"mode"
,
"set mode"
,
OFFSET
(
mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
A
|
F
|
R
,
"mode"
},
{
"downward"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
A
|
F
|
R
,
"mode"
},
{
"upward"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
A
|
F
|
R
,
"mode"
},
{
"threshold"
,
"set threshold"
,
OFFSET
(
threshold
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
0
.
125
},
0
.
000
976563
,
1
,
A
|
F
|
R
},
{
"ratio"
,
"set ratio"
,
OFFSET
(
ratio
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
2
},
1
,
20
,
A
|
F
|
R
},
{
"attack"
,
"set attack"
,
OFFSET
(
attack
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
20
},
0
.
01
,
2000
,
A
|
F
|
R
},
{
"release"
,
"set release"
,
OFFSET
(
release
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
250
},
0
.
01
,
9000
,
A
|
F
|
R
},
{
"makeup"
,
"set make up gain"
,
OFFSET
(
makeup
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
1
,
64
,
A
|
F
|
R
},
{
"knee"
,
"set knee"
,
OFFSET
(
knee
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
2
.
82843
},
1
,
8
,
A
|
F
|
R
},
{
"link"
,
"set link type"
,
OFFSET
(
link
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
A
|
F
|
R
,
"link"
},
{
"average"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
A
|
F
|
R
,
"link"
},
{
"maximum"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
A
|
F
|
R
,
"link"
},
{
"detection"
,
"set detection"
,
OFFSET
(
detection
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
1
,
A
|
F
|
R
,
"detection"
},
{
"peak"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
A
|
F
|
R
,
"detection"
},
{
"rms"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
A
|
F
|
R
,
"detection"
},
{
"level_sc"
,
"set sidechain gain"
,
OFFSET
(
level_sc
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
.
015625
,
64
,
A
|
F
|
R
},
{
"mix"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
A
|
F
|
R
},
{
NULL
}
};
...
...
@@ -214,6 +215,20 @@ static void compressor(SidechainCompressContext *s,
}
}
static
int
process_command
(
AVFilterContext
*
ctx
,
const
char
*
cmd
,
const
char
*
args
,
char
*
res
,
int
res_len
,
int
flags
)
{
int
ret
;
ret
=
ff_filter_process_command
(
ctx
,
cmd
,
args
,
res
,
res_len
,
flags
);
if
(
ret
<
0
)
return
ret
;
compressor_config_output
(
ctx
->
outputs
[
0
]);
return
0
;
}
#if CONFIG_SIDECHAINCOMPRESS_FILTER
static
int
activate
(
AVFilterContext
*
ctx
)
{
...
...
@@ -382,6 +397,7 @@ AVFilter ff_af_sidechaincompress = {
.
uninit
=
uninit
,
.
inputs
=
sidechaincompress_inputs
,
.
outputs
=
sidechaincompress_outputs
,
.
process_command
=
process_command
,
};
#endif
/* CONFIG_SIDECHAINCOMPRESS_FILTER */
...
...
@@ -475,5 +491,6 @@ AVFilter ff_af_acompressor = {
.
query_formats
=
acompressor_query_formats
,
.
inputs
=
acompressor_inputs
,
.
outputs
=
acompressor_outputs
,
.
process_command
=
process_command
,
};
#endif
/* CONFIG_ACOMPRESSOR_FILTER */
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