summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2012-02-15 00:21:14 +0100
committerClément Bœsch <ubitux@gmail.com>2012-02-15 00:22:47 +0100
commitd3b06399ffbcd2e4b2eefcb2a953762fd0c87789 (patch)
treede1b17e328bd391fccfeb5ce6e485297bc2a5d6c /libavfilter
parent94bc672489a2b209a8972fbce3039f279f447103 (diff)
lavfi/silencedetect: use av_ts2timestr() macro.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/af_silencedetect.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c
index 73521b02be..4f95b54f82 100644
--- a/libavfilter/af_silencedetect.c
+++ b/libavfilter/af_silencedetect.c
@@ -24,6 +24,7 @@
*/
#include "libavutil/opt.h"
+#include "libavutil/timestamp.h"
#include "avfilter.h"
typedef struct {
@@ -32,7 +33,7 @@ typedef struct {
double noise; ///< noise amplitude ratio
int duration; ///< minimum duration of silence until notification
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
} SilenceDetectContext;
@@ -106,18 +107,17 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
if (!silence->start) {
silence->nb_null_samples++;
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,
- "silence_start: %f\n", silence->start);
+ "silence_start: %s\n", av_ts2timestr(silence->start, &inlink->time_base));
}
}
} else {
- if (silence->start) {
- double end = insamples->pts * av_q2d(inlink->time_base);
+ if (silence->start)
av_log(silence, AV_LOG_INFO,
- "silence_end: %f | silence_duration: %f\n",
- end, end - silence->start);
- }
+ "silence_end: %s | silence_duration: %s\n",
+ av_ts2timestr(insamples->pts, &inlink->time_base),
+ av_ts2timestr(insamples->pts - silence->start, &inlink->time_base));
silence->nb_null_samples = silence->start = 0;
}
}