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
76954663
Commit
76954663
authored
Dec 08, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/volume_justin: add support to option shorthands and introspection
parent
402ac72b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
filters.texi
doc/filters.texi
+7
-1
af_volume_justin.c
libavfilter/af_volume_justin.c
+11
-17
version.h
libavfilter/version.h
+1
-1
No files found.
doc/filters.texi
View file @
76954663
...
...
@@ -923,7 +923,13 @@ raising it by +5 dB causes clipping for 6 samples, etc.
Adjust the input audio volume.
The filter accepts the following named parameters:
The filter accepts the following named parameters. If the key of the
first options is omitted, the arguments are interpreted according to
the following syntax:
@example
drawbox=@var{volume}:@var{precision}
@end example
@table @option
@item volume
...
...
libavfilter/af_volume_justin.c
View file @
76954663
...
...
@@ -41,37 +41,32 @@ static const char *precision_str[] = {
#define OFFSET(x) offsetof(VolumeContext, x)
#define A AV_OPT_FLAG_AUDIO_PARAM
#define F AV_OPT_FLAG_FILTERING_PARAM
static
const
AVOption
options
[]
=
{
static
const
AVOption
volume_
options
[]
=
{
{
"volume"
,
"set volume adjustment"
,
OFFSET
(
volume
),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
1
.
0
},
0
,
0x7fffff
,
A
},
OFFSET
(
volume
),
AV_OPT_TYPE_DOUBLE
,
{
.
dbl
=
1
.
0
},
0
,
0x7fffff
,
A
|
F
},
{
"precision"
,
"select mathematical precision"
,
OFFSET
(
precision
),
AV_OPT_TYPE_INT
,
{
.
i64
=
PRECISION_FLOAT
},
PRECISION_FIXED
,
PRECISION_DOUBLE
,
A
,
"precision"
},
{
"fixed"
,
"select 8-bit fixed-point"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRECISION_FIXED
},
INT_MIN
,
INT_MAX
,
A
,
"precision"
},
{
"float"
,
"select 32-bit floating-point"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRECISION_FLOAT
},
INT_MIN
,
INT_MAX
,
A
,
"precision"
},
{
"double"
,
"select 64-bit floating-point"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRECISION_DOUBLE
},
INT_MIN
,
INT_MAX
,
A
,
"precision"
},
OFFSET
(
precision
),
AV_OPT_TYPE_INT
,
{
.
i64
=
PRECISION_FLOAT
},
PRECISION_FIXED
,
PRECISION_DOUBLE
,
A
|
F
,
"precision"
},
{
"fixed"
,
"select 8-bit fixed-point"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRECISION_FIXED
},
INT_MIN
,
INT_MAX
,
A
|
F
,
"precision"
},
{
"float"
,
"select 32-bit floating-point"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRECISION_FLOAT
},
INT_MIN
,
INT_MAX
,
A
|
F
,
"precision"
},
{
"double"
,
"select 64-bit floating-point"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRECISION_DOUBLE
},
INT_MIN
,
INT_MAX
,
A
|
F
,
"precision"
},
{
NULL
},
};
static
const
AVClass
volume_class
=
{
.
class_name
=
"volume filter"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
AVFILTER_DEFINE_CLASS
(
volume
);
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
VolumeContext
*
vol
=
ctx
->
priv
;
static
const
char
*
shorthand
[]
=
{
"volume"
,
"precision"
,
NULL
};
int
ret
;
vol
->
class
=
&
volume_class
;
av_opt_set_defaults
(
vol
);
if
((
ret
=
av_set_options_string
(
vol
,
args
,
"="
,
":"
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Error parsing options string '%s'.
\n
"
,
args
);
if
((
ret
=
av_opt_set_from_string
(
vol
,
args
,
shorthand
,
"="
,
":"
))
<
0
)
return
ret
;
}
if
(
vol
->
precision
==
PRECISION_FIXED
)
{
vol
->
volume_i
=
(
int
)(
vol
->
volume
*
256
+
0
.
5
);
...
...
@@ -182,8 +177,6 @@ static inline void scale_samples_s32(uint8_t *dst, const uint8_t *src,
smp_dst
[
i
]
=
av_clipl_int32
((((
int64_t
)
smp_src
[
i
]
*
volume
+
128
)
>>
8
));
}
static
void
volume_init
(
VolumeContext
*
vol
)
{
vol
->
samples_align
=
1
;
...
...
@@ -314,4 +307,5 @@ AVFilter avfilter_af_volume_justin = {
.
init
=
init
,
.
inputs
=
avfilter_af_volume_inputs
,
.
outputs
=
avfilter_af_volume_outputs
,
.
priv_class
=
&
volume_class
,
};
libavfilter/version.h
View file @
76954663
...
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 25
#define LIBAVFILTER_VERSION_MICRO 10
1
#define LIBAVFILTER_VERSION_MICRO 10
2
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
...
...
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