Commit Graph

35 Commits

Author SHA1 Message Date
Paul B Mahol 6a1bda3df9 avfilter/af_silenceremove: improve trimming middle silence 2021-09-23 23:34:45 +02:00
Paul B Mahol abd24eaf68 avfilter/af_silenceremove: fix regression in output frame pts 2021-09-09 20:22:02 +02:00
Paul B Mahol 38ab20e591 avfilter/af_silenceremove: fix stop_silence handling 2021-09-08 19:10:39 +02:00
Paul B Mahol 8a42ee6697 avfilter/af_silenceremove: avoid returning 1 sample duration frames 2021-09-08 19:10:39 +02:00
Paul B Mahol 3b331468da avfilter/af_silenceremove: fix processing of periods > 1 2021-09-08 19:10:39 +02:00
Paul B Mahol 5e7e2e5031 avfilter/af_silenceremove: guard against negative numbers 2021-09-08 10:45:53 +02:00
Paul B Mahol c3e11e3092 avfilter/af_silenceremove: add asserts to check for NaNs 2021-09-08 10:45:53 +02:00
Paul B Mahol 4e1ee16cbb avfilter/af_silenceremove: use duration option for window option 2021-09-07 19:44:25 +02:00
Paul B Mahol 15e844ed9d avfilter/af_silenceremove: fix indentation 2021-09-07 19:44:25 +02:00
Paul B Mahol 1d1e8a47b7 avfilter/af_silenceremove: cover default case too 2021-09-07 19:44:25 +02:00
Andreas Rheinhardt 8be701d9f7 avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilter
Up until now, an AVFilter's lists of input and output AVFilterPads
were terminated by a sentinel and the only way to get the length
of these lists was by using avfilter_pad_count(). This has two
drawbacks: first, sizeof(AVFilterPad) is not negligible
(i.e. 64B on 64bit systems); second, getting the size involves
a function call instead of just reading the data.

This commit therefore changes this. The sentinels are removed and new
private fields nb_inputs and nb_outputs are added to AVFilter that
contain the number of elements of the respective AVFilterPad array.

Given that AVFilter.(in|out)puts are the only arrays of zero-terminated
AVFilterPads an API user has access to (AVFilterContext.(in|out)put_pads
are not zero-terminated and they already have a size field) the argument
to avfilter_pad_count() is always one of these lists, so it just has to
find the filter the list belongs to and read said number. This is slower
than before, but a replacement function that just reads the internal numbers
that users are expected to switch to will be added soon; and furthermore,
avfilter_pad_count() is probably never called in hot loops anyway.

This saves about 49KiB from the binary; notice that these sentinels are
not in .bss despite being zeroed: they are in .data.rel.ro due to the
non-sentinels.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-20 12:53:58 +02:00
Andreas Rheinhardt 18ec426a86 avfilter/formats: Factor common function combinations out
Several combinations of functions happen quite often in query_format
functions; e.g. ff_set_common_formats(ctx, ff_make_format_list(sample_fmts))
is very common. This commit therefore adds functions that are equivalent
to commonly used function combinations in order to reduce code
duplication.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-13 17:36:22 +02:00
Paul B Mahol da6975f022 avfilter/af_silenceremove: make window also depends on input sample format 2021-07-25 22:48:25 +02:00
Paul B Mahol d08deb11d2 avfilter/af_silenceremove: add support for more sample formats 2021-07-25 16:42:58 +02:00
Andreas Rheinhardt a04ad248a0 avfilter: Constify all AVFilters
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:05 -03:00
Paul B Mahol 1b262004d3 avfilter/af_silenceremove: use input timestamp for timestamp recalculation 2019-07-02 19:01:42 +02:00
Paul B Mahol 936376f3f7 avfilter/af_silenceremove: use enum for threshold detection modes 2018-10-15 19:03:01 +02:00
Paul B Mahol 631994b62b avfilter/af_silenceremove: add enum for detection modes 2018-10-15 19:03:01 +02:00
Paul B Mahol 454ed32d56 avfilter/af_silenceremove: add options description 2018-10-15 19:03:01 +02:00
Paul B Mahol a853623681 avfilter/af_silenceremove: prefer outlink instead of inlink 2018-10-15 19:03:01 +02:00
Paul B Mahol 346b23237b avfilter/af_silenceremove: add mode options
To control how threshold is calculated in multichannel audio.
2018-10-15 19:03:01 +02:00
Paul B Mahol c07bc1d6ee avfilter/af_silenceremove: add options to keep min duration of silence 2018-10-15 19:03:01 +02:00
Paul B Mahol 3cbf37bf09 avfilter/af_silenceremove: fix max for duration options 2018-10-08 12:22:12 +02:00
Paul B Mahol 2d1594a8d6 avfilter/af_silenceremove: fix possible crash if supplied duration is negative
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-11-27 16:34:09 +01:00
Paul B Mahol 9152bda839 avfilter/af_silenceremove: fix logic error in EOF case
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-11-27 13:38:33 +01:00
Paul B Mahol 7760ed7e96 avfilter/af_silenceremove: set output timestamps
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-15 14:29:18 +02:00
Paul B Mahol 47aaebd63e avfilter/af_silenceremove: make size of window user configurable
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-28 12:23:59 +01:00
Paul B Mahol b841fe002a avfilter/af_silenceremove: lower number of operations in for loop
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-28 12:23:59 +01:00
Paul B Mahol 1809894b2a avfilter/af_silenceremove: add peak detector
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-27 20:49:29 +01:00
Nicolas George 44f660e7e7 lavfi: remove FF_LINK_FLAG_REQUEST_LOOP.
It has no longer any effect.
2015-09-20 19:02:33 +02:00
Paul B Mahol 494b792441 avfilter: use ff_all_channel_counts() instead of ff_all_channel_layouts()
Fixes playback of some files with ffplay.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-09-12 01:43:06 +00:00
Clément Bœsch 5c64ae64bd avfilter/silenceremove: use AV_OPT_TYPE_BOOL for leave_silence option 2015-09-08 23:16:49 +02:00
Paul B Mahol a0854c084e avfilter: handle error in query_formats() in bunch of filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-04-08 13:05:06 +00:00
Michael Niedermayer 1b2390e2bc avfilter/af_silenceremove: remove dead code
Fixes CID1237284

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-06 21:36:56 +02:00
Paul B Mahol 422619646e add silenceremove filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2014-09-05 17:30:57 +00:00