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
f3b430e0
Commit
f3b430e0
authored
Sep 10, 2018
by
Tristan Matthews
Committed by
Michael Niedermayer
Sep 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/silencedetect: fix spelling
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
a55adf24
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
af_silencedetect.c
libavfilter/af_silencedetect.c
+9
-9
No files found.
libavfilter/af_silencedetect.c
View file @
f3b430e0
...
...
@@ -38,7 +38,7 @@ typedef struct SilenceDetectContext {
double
duration
;
///< minimum duration of silence until notification
int
mono
;
///< mono mode : check each channel separately (default = check when ALL channels are silent)
int
channels
;
///< number of channels
int
independ
a
nt_channels
;
///< number of entries in following arrays (always 1 in mono mode)
int
independ
e
nt_channels
;
///< number of entries in following arrays (always 1 in mono mode)
int64_t
*
nb_null_samples
;
///< (array) current number of continuous zero samples
int64_t
*
start
;
///< (array) if silence is detected, this value contains the time of the first zero sample (default/unset = INT64_MIN)
int64_t
frame_end
;
///< pts of the end of the current frame (used to compute duration of silence at EOS)
...
...
@@ -77,12 +77,12 @@ static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples,
int
is_silence
,
int
current_sample
,
int64_t
nb_samples_notify
,
AVRational
time_base
)
{
int
channel
=
current_sample
%
s
->
independ
a
nt_channels
;
int
channel
=
current_sample
%
s
->
independ
e
nt_channels
;
if
(
is_silence
)
{
if
(
s
->
start
[
channel
]
==
INT64_MIN
)
{
s
->
nb_null_samples
[
channel
]
++
;
if
(
s
->
nb_null_samples
[
channel
]
>=
nb_samples_notify
)
{
s
->
start
[
channel
]
=
insamples
->
pts
+
av_rescale_q
(
current_sample
/
s
->
channels
+
1
-
nb_samples_notify
*
s
->
independ
a
nt_channels
/
s
->
channels
,
s
->
start
[
channel
]
=
insamples
->
pts
+
av_rescale_q
(
current_sample
/
s
->
channels
+
1
-
nb_samples_notify
*
s
->
independ
e
nt_channels
/
s
->
channels
,
(
AVRational
){
1
,
s
->
last_sample_rate
},
time_base
);
set_meta
(
insamples
,
s
->
mono
?
channel
+
1
:
0
,
"silence_start"
,
av_ts2timestr
(
s
->
start
[
channel
],
&
time_base
));
...
...
@@ -141,14 +141,14 @@ static int config_input(AVFilterLink *inlink)
int
c
;
s
->
channels
=
inlink
->
channels
;
s
->
independ
a
nt_channels
=
s
->
mono
?
s
->
channels
:
1
;
s
->
nb_null_samples
=
av_mallocz_array
(
sizeof
(
*
s
->
nb_null_samples
),
s
->
independ
a
nt_channels
);
s
->
independ
e
nt_channels
=
s
->
mono
?
s
->
channels
:
1
;
s
->
nb_null_samples
=
av_mallocz_array
(
sizeof
(
*
s
->
nb_null_samples
),
s
->
independ
e
nt_channels
);
if
(
!
s
->
nb_null_samples
)
return
AVERROR
(
ENOMEM
);
s
->
start
=
av_malloc_array
(
sizeof
(
*
s
->
start
),
s
->
independ
a
nt_channels
);
s
->
start
=
av_malloc_array
(
sizeof
(
*
s
->
start
),
s
->
independ
e
nt_channels
);
if
(
!
s
->
start
)
return
AVERROR
(
ENOMEM
);
for
(
c
=
0
;
c
<
s
->
independ
a
nt_channels
;
c
++
)
for
(
c
=
0
;
c
<
s
->
independ
e
nt_channels
;
c
++
)
s
->
start
[
c
]
=
INT64_MIN
;
switch
(
inlink
->
format
)
{
...
...
@@ -178,7 +178,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
// scale number of null samples to the new sample rate
if
(
s
->
last_sample_rate
&&
s
->
last_sample_rate
!=
srate
)
for
(
c
=
0
;
c
<
s
->
independ
a
nt_channels
;
c
++
)
{
for
(
c
=
0
;
c
<
s
->
independ
e
nt_channels
;
c
++
)
{
s
->
nb_null_samples
[
c
]
=
srate
*
s
->
nb_null_samples
[
c
]
/
s
->
last_sample_rate
;
}
s
->
last_sample_rate
=
srate
;
...
...
@@ -231,7 +231,7 @@ static av_cold void uninit(AVFilterContext *ctx)
SilenceDetectContext
*
s
=
ctx
->
priv
;
int
c
;
for
(
c
=
0
;
c
<
s
->
independ
a
nt_channels
;
c
++
)
for
(
c
=
0
;
c
<
s
->
independ
e
nt_channels
;
c
++
)
if
(
s
->
start
[
c
]
>
INT64_MIN
)
update
(
s
,
NULL
,
0
,
c
,
0
,
s
->
time_base
);
av_freep
(
&
s
->
nb_null_samples
);
...
...
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