You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

668 lines
22KB

  1. /*
  2. * Copyright (c) 2001 Heikki Leinonen
  3. * Copyright (c) 2001 Chris Bagwell
  4. * Copyright (c) 2003 Donnie Smith
  5. * Copyright (c) 2014 Paul B Mahol
  6. *
  7. * This file is part of FFmpeg.
  8. *
  9. * FFmpeg is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * FFmpeg is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with FFmpeg; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #include <float.h> /* DBL_MAX */
  24. #include "libavutil/opt.h"
  25. #include "libavutil/timestamp.h"
  26. #include "audio.h"
  27. #include "formats.h"
  28. #include "avfilter.h"
  29. #include "internal.h"
  30. enum SilenceMode {
  31. SILENCE_TRIM,
  32. SILENCE_TRIM_FLUSH,
  33. SILENCE_COPY,
  34. SILENCE_COPY_FLUSH,
  35. SILENCE_STOP
  36. };
  37. typedef struct SilenceRemoveContext {
  38. const AVClass *class;
  39. enum SilenceMode mode;
  40. int start_periods;
  41. int64_t start_duration;
  42. int64_t start_duration_opt;
  43. double start_threshold;
  44. int64_t start_silence;
  45. int64_t start_silence_opt;
  46. int start_mode;
  47. int stop_periods;
  48. int64_t stop_duration;
  49. int64_t stop_duration_opt;
  50. double stop_threshold;
  51. int64_t stop_silence;
  52. int64_t stop_silence_opt;
  53. int stop_mode;
  54. double *start_holdoff;
  55. double *start_silence_hold;
  56. size_t start_holdoff_offset;
  57. size_t start_holdoff_end;
  58. size_t start_silence_offset;
  59. size_t start_silence_end;
  60. int start_found_periods;
  61. double *stop_holdoff;
  62. double *stop_silence_hold;
  63. size_t stop_holdoff_offset;
  64. size_t stop_holdoff_end;
  65. size_t stop_silence_offset;
  66. size_t stop_silence_end;
  67. int stop_found_periods;
  68. double window_ratio;
  69. double *window;
  70. double *window_current;
  71. double *window_end;
  72. int window_size;
  73. double sum;
  74. int restart;
  75. int64_t next_pts;
  76. int detection;
  77. void (*update)(struct SilenceRemoveContext *s, double sample);
  78. double(*compute)(struct SilenceRemoveContext *s, double sample);
  79. } SilenceRemoveContext;
  80. #define OFFSET(x) offsetof(SilenceRemoveContext, x)
  81. #define AF AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
  82. static const AVOption silenceremove_options[] = {
  83. { "start_periods", NULL, OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, 9000, AF },
  84. { "start_duration", NULL, OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
  85. { "start_threshold", NULL, OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF },
  86. { "start_silence", NULL, OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
  87. { "start_mode", NULL, OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, AF, "mode" },
  88. { "any", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "mode" },
  89. { "all", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "mode" },
  90. { "stop_periods", NULL, OFFSET(stop_periods), AV_OPT_TYPE_INT, {.i64=0}, -9000, 9000, AF },
  91. { "stop_duration", NULL, OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
  92. { "stop_threshold", NULL, OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF },
  93. { "stop_silence", NULL, OFFSET(stop_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
  94. { "stop_mode", NULL, OFFSET(stop_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, AF, "mode" },
  95. { "detection", NULL, OFFSET(detection), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, AF, "detection" },
  96. { "peak", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "detection" },
  97. { "rms", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "detection" },
  98. { "window", NULL, OFFSET(window_ratio), AV_OPT_TYPE_DOUBLE, {.dbl=0.02}, 0, 10, AF },
  99. { NULL }
  100. };
  101. AVFILTER_DEFINE_CLASS(silenceremove);
  102. static double compute_peak(SilenceRemoveContext *s, double sample)
  103. {
  104. double new_sum;
  105. new_sum = s->sum;
  106. new_sum -= *s->window_current;
  107. new_sum += fabs(sample);
  108. return new_sum / s->window_size;
  109. }
  110. static void update_peak(SilenceRemoveContext *s, double sample)
  111. {
  112. s->sum -= *s->window_current;
  113. *s->window_current = fabs(sample);
  114. s->sum += *s->window_current;
  115. s->window_current++;
  116. if (s->window_current >= s->window_end)
  117. s->window_current = s->window;
  118. }
  119. static double compute_rms(SilenceRemoveContext *s, double sample)
  120. {
  121. double new_sum;
  122. new_sum = s->sum;
  123. new_sum -= *s->window_current;
  124. new_sum += sample * sample;
  125. return sqrt(new_sum / s->window_size);
  126. }
  127. static void update_rms(SilenceRemoveContext *s, double sample)
  128. {
  129. s->sum -= *s->window_current;
  130. *s->window_current = sample * sample;
  131. s->sum += *s->window_current;
  132. s->window_current++;
  133. if (s->window_current >= s->window_end)
  134. s->window_current = s->window;
  135. }
  136. static av_cold int init(AVFilterContext *ctx)
  137. {
  138. SilenceRemoveContext *s = ctx->priv;
  139. if (s->stop_periods < 0) {
  140. s->stop_periods = -s->stop_periods;
  141. s->restart = 1;
  142. }
  143. switch (s->detection) {
  144. case 0:
  145. s->update = update_peak;
  146. s->compute = compute_peak;
  147. break;
  148. case 1:
  149. s->update = update_rms;
  150. s->compute = compute_rms;
  151. break;
  152. }
  153. return 0;
  154. }
  155. static void clear_window(SilenceRemoveContext *s)
  156. {
  157. memset(s->window, 0, s->window_size * sizeof(*s->window));
  158. s->window_current = s->window;
  159. s->window_end = s->window + s->window_size;
  160. s->sum = 0;
  161. }
  162. static int config_input(AVFilterLink *inlink)
  163. {
  164. AVFilterContext *ctx = inlink->dst;
  165. SilenceRemoveContext *s = ctx->priv;
  166. s->window_size = FFMAX((inlink->sample_rate * s->window_ratio), 1) * inlink->channels;
  167. s->window = av_malloc_array(s->window_size, sizeof(*s->window));
  168. if (!s->window)
  169. return AVERROR(ENOMEM);
  170. clear_window(s);
  171. s->start_duration = av_rescale(s->start_duration_opt, inlink->sample_rate,
  172. AV_TIME_BASE);
  173. s->start_silence = av_rescale(s->start_silence_opt, inlink->sample_rate,
  174. AV_TIME_BASE);
  175. s->stop_duration = av_rescale(s->stop_duration_opt, inlink->sample_rate,
  176. AV_TIME_BASE);
  177. s->stop_silence = av_rescale(s->stop_silence_opt, inlink->sample_rate,
  178. AV_TIME_BASE);
  179. s->start_holdoff = av_malloc_array(FFMAX(s->start_duration, 1),
  180. sizeof(*s->start_holdoff) *
  181. inlink->channels);
  182. if (!s->start_holdoff)
  183. return AVERROR(ENOMEM);
  184. s->start_silence_hold = av_malloc_array(FFMAX(s->start_silence, 1),
  185. sizeof(*s->start_silence_hold) *
  186. inlink->channels);
  187. if (!s->start_silence_hold)
  188. return AVERROR(ENOMEM);
  189. s->start_holdoff_offset = 0;
  190. s->start_holdoff_end = 0;
  191. s->start_found_periods = 0;
  192. s->stop_holdoff = av_malloc_array(FFMAX(s->stop_duration, 1),
  193. sizeof(*s->stop_holdoff) *
  194. inlink->channels);
  195. if (!s->stop_holdoff)
  196. return AVERROR(ENOMEM);
  197. s->stop_silence_hold = av_malloc_array(FFMAX(s->stop_silence, 1),
  198. sizeof(*s->stop_silence_hold) *
  199. inlink->channels);
  200. if (!s->stop_silence_hold)
  201. return AVERROR(ENOMEM);
  202. s->stop_holdoff_offset = 0;
  203. s->stop_holdoff_end = 0;
  204. s->stop_found_periods = 0;
  205. if (s->start_periods)
  206. s->mode = SILENCE_TRIM;
  207. else
  208. s->mode = SILENCE_COPY;
  209. return 0;
  210. }
  211. static void flush(SilenceRemoveContext *s,
  212. AVFrame *out, AVFilterLink *outlink,
  213. int *nb_samples_written, int *ret, int flush_silence)
  214. {
  215. AVFrame *silence;
  216. if (*nb_samples_written) {
  217. out->nb_samples = *nb_samples_written / outlink->channels;
  218. out->pts = s->next_pts;
  219. s->next_pts += av_rescale_q(out->nb_samples,
  220. (AVRational){1, outlink->sample_rate},
  221. outlink->time_base);
  222. *ret = ff_filter_frame(outlink, out);
  223. if (*ret < 0)
  224. return;
  225. *nb_samples_written = 0;
  226. } else {
  227. av_frame_free(&out);
  228. }
  229. if (s->stop_silence_end <= 0 || !flush_silence)
  230. return;
  231. silence = ff_get_audio_buffer(outlink, s->stop_silence_end / outlink->channels);
  232. if (!silence) {
  233. *ret = AVERROR(ENOMEM);
  234. return;
  235. }
  236. if (s->stop_silence_offset < s->stop_silence_end) {
  237. memcpy(silence->data[0],
  238. &s->stop_silence_hold[s->stop_silence_offset],
  239. (s->stop_silence_end - s->stop_silence_offset) * sizeof(double));
  240. }
  241. if (s->stop_silence_offset > 0) {
  242. memcpy(silence->data[0] + (s->stop_silence_end - s->stop_silence_offset) * sizeof(double),
  243. &s->stop_silence_hold[0],
  244. s->stop_silence_offset * sizeof(double));
  245. }
  246. s->stop_silence_offset = 0;
  247. s->stop_silence_end = 0;
  248. silence->pts = s->next_pts;
  249. s->next_pts += av_rescale_q(silence->nb_samples,
  250. (AVRational){1, outlink->sample_rate},
  251. outlink->time_base);
  252. *ret = ff_filter_frame(outlink, silence);
  253. }
  254. static int filter_frame(AVFilterLink *inlink, AVFrame *in)
  255. {
  256. AVFilterContext *ctx = inlink->dst;
  257. AVFilterLink *outlink = ctx->outputs[0];
  258. SilenceRemoveContext *s = ctx->priv;
  259. int i, j, threshold, ret = 0;
  260. int nbs, nb_samples_read, nb_samples_written;
  261. double *obuf, *ibuf = (double *)in->data[0];
  262. AVFrame *out;
  263. nb_samples_read = nb_samples_written = 0;
  264. switch (s->mode) {
  265. case SILENCE_TRIM:
  266. silence_trim:
  267. nbs = in->nb_samples - nb_samples_read / outlink->channels;
  268. if (!nbs)
  269. break;
  270. for (i = 0; i < nbs; i++) {
  271. if (s->start_mode) {
  272. threshold = 0;
  273. for (j = 0; j < outlink->channels; j++) {
  274. threshold |= s->compute(s, ibuf[j]) > s->start_threshold;
  275. }
  276. } else {
  277. threshold = 1;
  278. for (j = 0; j < outlink->channels; j++) {
  279. threshold &= s->compute(s, ibuf[j]) > s->start_threshold;
  280. }
  281. }
  282. if (threshold) {
  283. for (j = 0; j < outlink->channels; j++) {
  284. s->update(s, *ibuf);
  285. s->start_holdoff[s->start_holdoff_end++] = *ibuf++;
  286. }
  287. nb_samples_read += outlink->channels;
  288. if (s->start_holdoff_end >= s->start_duration * outlink->channels) {
  289. if (++s->start_found_periods >= s->start_periods) {
  290. s->mode = SILENCE_TRIM_FLUSH;
  291. goto silence_trim_flush;
  292. }
  293. s->start_holdoff_offset = 0;
  294. s->start_holdoff_end = 0;
  295. s->start_silence_offset = 0;
  296. s->start_silence_end = 0;
  297. }
  298. } else {
  299. s->start_holdoff_end = 0;
  300. for (j = 0; j < outlink->channels; j++) {
  301. s->update(s, ibuf[j]);
  302. if (s->start_silence) {
  303. s->start_silence_hold[s->start_silence_offset++] = ibuf[j];
  304. s->start_silence_end = FFMIN(s->start_silence_end + 1, outlink->channels * s->start_silence);
  305. if (s->start_silence_offset >= outlink->channels * s->start_silence) {
  306. s->start_silence_offset = 0;
  307. }
  308. }
  309. }
  310. ibuf += outlink->channels;
  311. nb_samples_read += outlink->channels;
  312. }
  313. }
  314. break;
  315. case SILENCE_TRIM_FLUSH:
  316. silence_trim_flush:
  317. nbs = s->start_holdoff_end - s->start_holdoff_offset;
  318. nbs -= nbs % outlink->channels;
  319. if (!nbs)
  320. break;
  321. out = ff_get_audio_buffer(outlink, nbs / outlink->channels + s->start_silence_end / outlink->channels);
  322. if (!out) {
  323. av_frame_free(&in);
  324. return AVERROR(ENOMEM);
  325. }
  326. if (s->start_silence_end > 0) {
  327. if (s->start_silence_offset < s->start_silence_end) {
  328. memcpy(out->data[0],
  329. &s->start_silence_hold[s->start_silence_offset],
  330. (s->start_silence_end - s->start_silence_offset) * sizeof(double));
  331. }
  332. if (s->start_silence_offset > 0) {
  333. memcpy(out->data[0] + (s->start_silence_end - s->start_silence_offset) * sizeof(double),
  334. &s->start_silence_hold[0],
  335. s->start_silence_offset * sizeof(double));
  336. }
  337. }
  338. memcpy(out->data[0] + s->start_silence_end * sizeof(double),
  339. &s->start_holdoff[s->start_holdoff_offset],
  340. nbs * sizeof(double));
  341. out->pts = s->next_pts;
  342. s->next_pts += av_rescale_q(out->nb_samples,
  343. (AVRational){1, outlink->sample_rate},
  344. outlink->time_base);
  345. s->start_holdoff_offset += nbs;
  346. ret = ff_filter_frame(outlink, out);
  347. if (s->start_holdoff_offset == s->start_holdoff_end) {
  348. s->start_holdoff_offset = 0;
  349. s->start_holdoff_end = 0;
  350. s->start_silence_offset = 0;
  351. s->start_silence_end = 0;
  352. s->mode = SILENCE_COPY;
  353. goto silence_copy;
  354. }
  355. break;
  356. case SILENCE_COPY:
  357. silence_copy:
  358. nbs = in->nb_samples - nb_samples_read / outlink->channels;
  359. if (!nbs)
  360. break;
  361. out = ff_get_audio_buffer(outlink, nbs);
  362. if (!out) {
  363. av_frame_free(&in);
  364. return AVERROR(ENOMEM);
  365. }
  366. obuf = (double *)out->data[0];
  367. if (s->stop_periods) {
  368. for (i = 0; i < nbs; i++) {
  369. if (s->stop_mode) {
  370. threshold = 0;
  371. for (j = 0; j < outlink->channels; j++) {
  372. threshold |= s->compute(s, ibuf[j]) > s->stop_threshold;
  373. }
  374. } else {
  375. threshold = 1;
  376. for (j = 0; j < outlink->channels; j++) {
  377. threshold &= s->compute(s, ibuf[j]) > s->stop_threshold;
  378. }
  379. }
  380. if (threshold && s->stop_holdoff_end && !s->stop_silence) {
  381. s->mode = SILENCE_COPY_FLUSH;
  382. flush(s, out, outlink, &nb_samples_written, &ret, 0);
  383. goto silence_copy_flush;
  384. } else if (threshold) {
  385. for (j = 0; j < outlink->channels; j++) {
  386. s->update(s, *ibuf);
  387. *obuf++ = *ibuf++;
  388. }
  389. nb_samples_read += outlink->channels;
  390. nb_samples_written += outlink->channels;
  391. } else if (!threshold) {
  392. for (j = 0; j < outlink->channels; j++) {
  393. s->update(s, *ibuf);
  394. if (s->stop_silence) {
  395. s->stop_silence_hold[s->stop_silence_offset++] = *ibuf;
  396. s->stop_silence_end = FFMIN(s->stop_silence_end + 1, outlink->channels * s->stop_silence);
  397. if (s->stop_silence_offset >= outlink->channels * s->stop_silence) {
  398. s->stop_silence_offset = 0;
  399. }
  400. }
  401. s->stop_holdoff[s->stop_holdoff_end++] = *ibuf++;
  402. }
  403. nb_samples_read += outlink->channels;
  404. if (s->stop_holdoff_end >= s->stop_duration * outlink->channels) {
  405. if (++s->stop_found_periods >= s->stop_periods) {
  406. s->stop_holdoff_offset = 0;
  407. s->stop_holdoff_end = 0;
  408. if (!s->restart) {
  409. s->mode = SILENCE_STOP;
  410. flush(s, out, outlink, &nb_samples_written, &ret, 1);
  411. goto silence_stop;
  412. } else {
  413. s->stop_found_periods = 0;
  414. s->start_found_periods = 0;
  415. s->start_holdoff_offset = 0;
  416. s->start_holdoff_end = 0;
  417. s->start_silence_offset = 0;
  418. s->start_silence_end = 0;
  419. clear_window(s);
  420. s->mode = SILENCE_TRIM;
  421. flush(s, out, outlink, &nb_samples_written, &ret, 1);
  422. goto silence_trim;
  423. }
  424. }
  425. s->mode = SILENCE_COPY_FLUSH;
  426. flush(s, out, outlink, &nb_samples_written, &ret, 0);
  427. goto silence_copy_flush;
  428. }
  429. }
  430. }
  431. flush(s, out, outlink, &nb_samples_written, &ret, 0);
  432. } else {
  433. memcpy(obuf, ibuf, sizeof(double) * nbs * outlink->channels);
  434. out->pts = s->next_pts;
  435. s->next_pts += av_rescale_q(out->nb_samples,
  436. (AVRational){1, outlink->sample_rate},
  437. outlink->time_base);
  438. ret = ff_filter_frame(outlink, out);
  439. }
  440. break;
  441. case SILENCE_COPY_FLUSH:
  442. silence_copy_flush:
  443. nbs = s->stop_holdoff_end - s->stop_holdoff_offset;
  444. nbs -= nbs % outlink->channels;
  445. if (!nbs)
  446. break;
  447. out = ff_get_audio_buffer(outlink, nbs / outlink->channels);
  448. if (!out) {
  449. av_frame_free(&in);
  450. return AVERROR(ENOMEM);
  451. }
  452. memcpy(out->data[0], &s->stop_holdoff[s->stop_holdoff_offset],
  453. nbs * sizeof(double));
  454. s->stop_holdoff_offset += nbs;
  455. out->pts = s->next_pts;
  456. s->next_pts += av_rescale_q(out->nb_samples,
  457. (AVRational){1, outlink->sample_rate},
  458. outlink->time_base);
  459. ret = ff_filter_frame(outlink, out);
  460. if (s->stop_holdoff_offset == s->stop_holdoff_end) {
  461. s->stop_holdoff_offset = 0;
  462. s->stop_holdoff_end = 0;
  463. s->stop_silence_offset = 0;
  464. s->stop_silence_end = 0;
  465. s->mode = SILENCE_COPY;
  466. goto silence_copy;
  467. }
  468. break;
  469. case SILENCE_STOP:
  470. silence_stop:
  471. break;
  472. }
  473. av_frame_free(&in);
  474. return ret;
  475. }
  476. static int request_frame(AVFilterLink *outlink)
  477. {
  478. AVFilterContext *ctx = outlink->src;
  479. SilenceRemoveContext *s = ctx->priv;
  480. int ret;
  481. ret = ff_request_frame(ctx->inputs[0]);
  482. if (ret == AVERROR_EOF && (s->mode == SILENCE_COPY_FLUSH ||
  483. s->mode == SILENCE_COPY)) {
  484. int nbs = s->stop_holdoff_end - s->stop_holdoff_offset;
  485. if (nbs) {
  486. AVFrame *frame;
  487. frame = ff_get_audio_buffer(outlink, nbs / outlink->channels);
  488. if (!frame)
  489. return AVERROR(ENOMEM);
  490. memcpy(frame->data[0], &s->stop_holdoff[s->stop_holdoff_offset],
  491. nbs * sizeof(double));
  492. frame->pts = s->next_pts;
  493. s->next_pts += av_rescale_q(frame->nb_samples,
  494. (AVRational){1, outlink->sample_rate},
  495. outlink->time_base);
  496. ret = ff_filter_frame(outlink, frame);
  497. }
  498. s->mode = SILENCE_STOP;
  499. }
  500. return ret;
  501. }
  502. static int query_formats(AVFilterContext *ctx)
  503. {
  504. AVFilterFormats *formats = NULL;
  505. AVFilterChannelLayouts *layouts = NULL;
  506. static const enum AVSampleFormat sample_fmts[] = {
  507. AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE
  508. };
  509. int ret;
  510. layouts = ff_all_channel_counts();
  511. if (!layouts)
  512. return AVERROR(ENOMEM);
  513. ret = ff_set_common_channel_layouts(ctx, layouts);
  514. if (ret < 0)
  515. return ret;
  516. formats = ff_make_format_list(sample_fmts);
  517. if (!formats)
  518. return AVERROR(ENOMEM);
  519. ret = ff_set_common_formats(ctx, formats);
  520. if (ret < 0)
  521. return ret;
  522. formats = ff_all_samplerates();
  523. if (!formats)
  524. return AVERROR(ENOMEM);
  525. return ff_set_common_samplerates(ctx, formats);
  526. }
  527. static av_cold void uninit(AVFilterContext *ctx)
  528. {
  529. SilenceRemoveContext *s = ctx->priv;
  530. av_freep(&s->start_holdoff);
  531. av_freep(&s->start_silence_hold);
  532. av_freep(&s->stop_holdoff);
  533. av_freep(&s->stop_silence_hold);
  534. av_freep(&s->window);
  535. }
  536. static const AVFilterPad silenceremove_inputs[] = {
  537. {
  538. .name = "default",
  539. .type = AVMEDIA_TYPE_AUDIO,
  540. .config_props = config_input,
  541. .filter_frame = filter_frame,
  542. },
  543. { NULL }
  544. };
  545. static const AVFilterPad silenceremove_outputs[] = {
  546. {
  547. .name = "default",
  548. .type = AVMEDIA_TYPE_AUDIO,
  549. .request_frame = request_frame,
  550. },
  551. { NULL }
  552. };
  553. AVFilter ff_af_silenceremove = {
  554. .name = "silenceremove",
  555. .description = NULL_IF_CONFIG_SMALL("Remove silence."),
  556. .priv_size = sizeof(SilenceRemoveContext),
  557. .priv_class = &silenceremove_class,
  558. .init = init,
  559. .uninit = uninit,
  560. .query_formats = query_formats,
  561. .inputs = silenceremove_inputs,
  562. .outputs = silenceremove_outputs,
  563. };