Commit Graph

21 Commits

Author SHA1 Message Date
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
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
James Almer
bc27269694 avfilter/af_adelay: make per channel delay argument an int64_t
Should fix ticket #9196

Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-25 09:22:09 -03:00
Limin Wang
f441fadbcf avfilter/af_adelay: Check sscanf() return value
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-01 06:36:36 +08:00
Paul B Mahol
1ebac3cda9 avfilter/af_adelay: fix buggy behaviour 2019-10-09 09:56:33 +02:00
Paul B Mahol
0633d87ae6 avfilter/af_adelay: add option which changes how unset channels are delayed
Fixes #8032.
2019-10-07 18:10:28 +02:00
Paul B Mahol
35a8179149 avfilter/af_adelay: allow setting delays in seconds 2019-01-01 13:33:16 +01:00
Paul B Mahol
0c7fb6e4a0 avfilter/af_adelay: use av_sscanf() 2018-11-18 21:21:18 +01:00
Paul B Mahol
bd02a6d7ed avfilter/af_adelay: switch to activate
Also use less memory in special case when all channels have common delay.
2018-10-25 23:11:37 +02:00
Paul B Mahol
bf5bdbdb92 avfilter/af_adelay: do not crash if allocation of chandelay failed 2018-10-18 10:24:16 +02:00
Paul B Mahol
88cbd25b19 avfilter: pass outlink to ff_get_audio_buffer()
This is more correct.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-01-03 22:52:47 +01:00
Paul B Mahol
6ccd32c367 avfilter/af_adelay: remove requirement that at least one delay should be provided
Such requirement is not necessary and code works without it just fine.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-08-30 20:24:28 +02:00
Paul B Mahol
b5314333de avfilter/af_adelay: make it possible to delay channels by exact number of samples 2016-08-11 21:46:06 +02:00
Paul B Mahol
142894d720 avfilter: do not leak frame if ff_get_audio_buffer() fails
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-25 21:59:33 +01: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
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
2d6f31730c avfilter/af_adelay: use av_freep(), do not leave stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-07 13:44:26 +02:00
Paul B Mahol
9f2a3bcee7 avfilter: remove superflous lines
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2014-02-26 16:37:59 +00:00
Michael Niedermayer
325f6e0a97 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavfi: do not export the filters from shared objects

Conflicts:
	libavfilter/af_amix.c
	libavfilter/af_anull.c
	libavfilter/asrc_anullsrc.c
	libavfilter/f_select.c
	libavfilter/f_settb.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/vf_aspect.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_colorbalance.c
	libavfilter/vf_copy.c
	libavfilter/vf_crop.c
	libavfilter/vf_cropdetect.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_format.c
	libavfilter/vf_framestep.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_hflip.c
	libavfilter/vf_libopencv.c
	libavfilter/vf_lut.c
	libavfilter/vf_null.c
	libavfilter/vf_overlay.c
	libavfilter/vf_scale.c
	libavfilter/vf_transpose.c
	libavfilter/vf_unsharp.c
	libavfilter/vf_vflip.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-29 11:58:11 +01:00
Paul B Mahol
9d05de2258 avfilter: add adelay filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-16 14:33:07 +00:00