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
d3b06399
Commit
d3b06399
authored
Feb 14, 2012
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/silencedetect: use av_ts2timestr() macro.
parent
94bc6724
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
af_silencedetect.c
libavfilter/af_silencedetect.c
+8
-8
No files found.
libavfilter/af_silencedetect.c
View file @
d3b06399
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
*/
*/
#include "libavutil/opt.h"
#include "libavutil/opt.h"
#include "libavutil/timestamp.h"
#include "avfilter.h"
#include "avfilter.h"
typedef
struct
{
typedef
struct
{
...
@@ -32,7 +33,7 @@ typedef struct {
...
@@ -32,7 +33,7 @@ typedef struct {
double
noise
;
///< noise amplitude ratio
double
noise
;
///< noise amplitude ratio
int
duration
;
///< minimum duration of silence until notification
int
duration
;
///< minimum duration of silence until notification
int64_t
nb_null_samples
;
///< current number of continuous zero samples
int64_t
nb_null_samples
;
///< current number of continuous zero samples
double
start
;
///< if silence is detected, this value contains the time of the first zero sample
int64_t
start
;
///< if silence is detected, this value contains the time of the first zero sample
int
last_sample_rate
;
///< last sample rate to check for sample rate changes
int
last_sample_rate
;
///< last sample rate to check for sample rate changes
}
SilenceDetectContext
;
}
SilenceDetectContext
;
...
@@ -106,18 +107,17 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
...
@@ -106,18 +107,17 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
if
(
!
silence
->
start
)
{
if
(
!
silence
->
start
)
{
silence
->
nb_null_samples
++
;
silence
->
nb_null_samples
++
;
if
(
silence
->
nb_null_samples
>=
nb_samples_notify
)
{
if
(
silence
->
nb_null_samples
>=
nb_samples_notify
)
{
silence
->
start
=
insamples
->
pts
*
av_q2d
(
inlink
->
time_base
)
-
silence
->
duration
;
silence
->
start
=
insamples
->
pts
-
silence
->
duration
/
av_q2d
(
inlink
->
time_base
)
;
av_log
(
silence
,
AV_LOG_INFO
,
av_log
(
silence
,
AV_LOG_INFO
,
"silence_start: %
f
\n
"
,
silence
->
start
);
"silence_start: %
s
\n
"
,
av_ts2timestr
(
silence
->
start
,
&
inlink
->
time_base
)
);
}
}
}
}
}
else
{
}
else
{
if
(
silence
->
start
)
{
if
(
silence
->
start
)
double
end
=
insamples
->
pts
*
av_q2d
(
inlink
->
time_base
);
av_log
(
silence
,
AV_LOG_INFO
,
av_log
(
silence
,
AV_LOG_INFO
,
"silence_end: %
f | silence_duration: %f
\n
"
,
"silence_end: %
s | silence_duration: %s
\n
"
,
end
,
end
-
silence
->
start
);
av_ts2timestr
(
insamples
->
pts
,
&
inlink
->
time_base
),
}
av_ts2timestr
(
insamples
->
pts
-
silence
->
start
,
&
inlink
->
time_base
));
silence
->
nb_null_samples
=
silence
->
start
=
0
;
silence
->
nb_null_samples
=
silence
->
start
=
0
;
}
}
}
}
...
...
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