44 int nb_samples, int64_t nb_samples_notify,
48 #define OFFSET(x) offsetof(SilenceDetectContext, x)
49 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
67 int is_silence, int64_t nb_samples_notify,
88 "silence_end: %s | silence_duration: %s\n",
96 #define SILENCE_DETECT(name, type) \
97 static void silencedetect_##name(SilenceDetectContext *s, AVFrame *insamples, \
98 int nb_samples, int64_t nb_samples_notify, \
99 AVRational time_base) \
101 const type *p = (const type *)insamples->data[0]; \
102 const type noise = s->noise; \
105 for (i = 0; i < nb_samples; i++, p++) \
106 update(s, insamples, *p < noise && *p > -noise, \
107 nb_samples_notify, time_base); \
120 switch (inlink->format) {
124 s->
noise *= INT32_MAX;
128 s->
noise *= INT16_MAX;
150 s->
silencedetect(s, insamples, nb_samples, nb_samples_notify,
205 .
name =
"silencedetect",
209 .
inputs = silencedetect_inputs,
210 .
outputs = silencedetect_outputs,
211 .priv_class = &silencedetect_class,