75 #define OFFSET(x) offsetof(SilenceRemoveContext, x)
76 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
169 new_sum += sample *
sample;
186 int *nb_samples_written,
int *
ret)
188 if (*nb_samples_written) {
191 *nb_samples_written = 0;
202 int i, j, threshold,
ret = 0;
203 int nbs, nb_samples_read, nb_samples_written;
204 double *obuf, *ibuf = (
double *)in->
data[0];
207 nb_samples_read = nb_samples_written = 0;
216 for (i = 0; i < nbs; i++) {
218 for (j = 0; j < inlink->
channels; j++) {
223 for (j = 0; j < inlink->
channels; j++) {
232 goto silence_trim_flush;
241 for (j = 0; j < inlink->
channels; j++)
245 nb_samples_read += inlink->
channels;
264 nbs *
sizeof(
double));
288 obuf = (
double *)
out->data[0];
291 for (i = 0; i < nbs; i++) {
293 for (j = 0; j < inlink->
channels; j++)
298 flush(
out, outlink, &nb_samples_written, &ret);
299 goto silence_copy_flush;
300 }
else if (threshold) {
301 for (j = 0; j < inlink->
channels; j++) {
305 nb_samples_written++;
307 }
else if (!threshold) {
308 for (j = 0; j < inlink->
channels; j++) {
312 nb_samples_written++;
326 flush(
out, outlink, &nb_samples_written, &ret);
335 flush(
out, outlink, &nb_samples_written, &ret);
340 flush(
out, outlink, &nb_samples_written, &ret);
341 goto silence_copy_flush;
345 flush(
out, outlink, &nb_samples_written, &ret);
347 memcpy(obuf, ibuf,
sizeof(
double) * nbs * inlink->
channels);
366 nbs *
sizeof(
double));
406 nbs *
sizeof(
double));
470 .
name =
"silenceremove",
473 .priv_class = &silenceremove_class,
477 .
inputs = silenceremove_inputs,
478 .
outputs = silenceremove_outputs,