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
a0b2e8e1
Commit
a0b2e8e1
authored
Dec 06, 2012
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/silencedetect: use eval builtin to parse dB.
Also update FATE test to use the dB form.
parent
15784c2b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
13 deletions
+5
-13
af_silencedetect.c
libavfilter/af_silencedetect.c
+4
-12
filter.mak
tests/fate/filter.mak
+1
-1
No files found.
libavfilter/af_silencedetect.c
View file @
a0b2e8e1
...
...
@@ -23,6 +23,8 @@
* Audio silence detector
*/
#include <float.h>
/* DBL_MAX */
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavutil/timestamp.h"
...
...
@@ -33,7 +35,6 @@
typedef
struct
{
const
AVClass
*
class
;
char
*
noise_str
;
///< noise option string
double
noise
;
///< noise amplitude ratio
double
duration
;
///< minimum duration of silence until notification
int64_t
nb_null_samples
;
///< current number of continuous zero samples
...
...
@@ -44,8 +45,8 @@ typedef struct {
#define OFFSET(x) offsetof(SilenceDetectContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
static
const
AVOption
silencedetect_options
[]
=
{
{
"n"
,
"set noise tolerance"
,
OFFSET
(
noise
_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"-60dB"
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"noise"
,
"set noise tolerance"
,
OFFSET
(
noise
_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"-60dB"
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"n"
,
"set noise tolerance"
,
OFFSET
(
noise
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
0
.
001
},
0
,
DBL_MAX
,
FLAGS
},
{
"noise"
,
"set noise tolerance"
,
OFFSET
(
noise
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
0
.
001
},
0
,
DBL_MAX
,
FLAGS
},
{
"d"
,
"set minimum duration in seconds"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
2
.},
0
,
24
*
60
*
60
,
FLAGS
},
{
"duration"
,
"set minimum duration in seconds"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
2
.},
0
,
24
*
60
*
60
,
FLAGS
},
{
NULL
},
...
...
@@ -56,7 +57,6 @@ AVFILTER_DEFINE_CLASS(silencedetect);
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
int
ret
;
char
*
tail
;
SilenceDetectContext
*
silence
=
ctx
->
priv
;
silence
->
class
=
&
silencedetect_class
;
...
...
@@ -65,14 +65,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
if
((
ret
=
av_set_options_string
(
silence
,
args
,
"="
,
":"
))
<
0
)
return
ret
;
silence
->
noise
=
strtod
(
silence
->
noise_str
,
&
tail
);
if
(
!
strcmp
(
tail
,
"dB"
))
{
silence
->
noise
=
pow
(
10
,
silence
->
noise
/
20
);
}
else
if
(
*
tail
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid value '%s' for noise parameter.
\n
"
,
silence
->
noise_str
);
return
AVERROR
(
EINVAL
);
}
av_opt_free
(
silence
);
return
0
;
...
...
tests/fate/filter.mak
View file @
a0b2e8e1
...
...
@@ -68,7 +68,7 @@ fate-filter-metadata-scenedetect: CMD = run $(FILTER_METADATA_COMMAND) "sws_flag
SILENCEDETECT_DEPS = FFPROBE LAVFI_INDEV AMOVIE_FILTER AMR_DEMUXER AMRWB_DECODER
FATE_METADATA_FILTER-$(call ALLYES, $(SILENCEDETECT_DEPS)) += fate-filter-metadata-silencedetect
fate-filter-metadata-silencedetect: SRC = $(SAMPLES)/amrwb/seed-12k65.awb
fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=d=
.1
"
fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=d=
-20dB
"
FATE_SAMPLES_FFPROBE += $(FATE_METADATA_FILTER-yes)
...
...
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