Commit Graph

26 Commits

Author SHA1 Message Date
Andreas Rheinhardt 50ea7389ec avfilter: Deduplicate default audio inputs/outputs
Lots of audio filters use very simple inputs or outputs:
An array with a single AVFilterPad whose name is "default"
and whose type is AVMEDIA_TYPE_AUDIO; everything else is unset.

Given that we never use pointer equality for inputs or outputs*,
we can simply use a single AVFilterPad instead of dozens; this
even saves .data.rel.ro (4784B here) as well as relocations.

*: In fact, several filters (like the filters in af_biquads.c)
already use the same inputs; furthermore, ff_filter_alloc()
duplicates the input and output pads so that we do not even
work with the pads directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00
Anton Khirnov b9c928a486 avfilter: add AVFILTER_FLAG_METADATA_ONLY
This flag allows distinguishing between filters that actually modify the
data and those that only modify metadata or gather some stream
information.
2021-12-04 14:07:19 +01: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 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
Marton Balint 7ceb9e6b11 avfilter/formats: allow unknown channel layouts by default
Since the default in the libav fork is to only allow known layouts, making
unknown layouts allowed by default here can be a security risk for filters
directly merged from libav. However, usually it is simple to detect such cases,
use of av_get_channel_layout_nb_channels is a good indicator, so I suggest we
change this regardless.

See http://ffmpeg.org/pipermail/ffmpeg-devel/2016-November/203204.html.

This patch indirectly adds unknown channel layout support for filters where
query_formats is not specified:

abench
afifo
ainterleave
anullsink
apad
aperms
arealtime
aselect
asendcmd
asetnsamples
asetpts
asettb
ashowinfo
azmq

It introduces a query_formats callback for the asyncts filter, which only
supports known channel layouts since it is using libavresample.

And it removes .query_formats callback from filters where it was only there to
support unknown layouts, as this is now the default:

aloop
ametadata
anull
asidedata
asplit
atrim

Acked-by: Nicolas George <george@nsup.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-12-10 11:57:11 +01: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
Anton Khirnov cd43ca0443 lavfi: do not export the filters from shared objects 2013-10-28 15:29:54 +01:00
Paul B Mahol b211607b5c avfilter: various cosmetics
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-12 14:01:43 +00:00
Paul B Mahol d751a2526f lavfi/anull: remove redundant lines
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-10 15:08:12 +00:00
Nicolas George 699b286a21 lavfi/af_anull: accept unknown channel layouts. 2013-01-26 11:15:38 +01:00
Michael Niedermayer 526cb36e4b Merge commit '4436f25a1682ada3f7226cb6fadf429946933161'
* commit '4436f25a1682ada3f7226cb6fadf429946933161':
  build: remove references to unused EXTRAOBJS variable
  lavfi: convert input/ouput list compound literals to named objects
  fate: add h263 obmc vsynth tests
  avconv: remove bogus warning when using avconv -h without parameter
  averror: explicitly define AVERROR_* values
  flashsv: propagate inflateReset() errors
  indeo4/5: remove constant parameter num_bands from wavelet recomposition
  mxfdec: return error if no segments are available in mxf_get_sorted_table_segments
  Double motion vector range for HPEL interlaced picture in proper place

Conflicts:
	libavcodec/v210dec.h
	libavfilter/af_aformat.c
	libavfilter/af_amix.c
	libavfilter/af_asyncts.c
	libavfilter/af_channelmap.c
	libavfilter/af_join.c
	libavfilter/asrc_anullsrc.c
	libavfilter/buffersrc.c
	libavfilter/f_setpts.c
	libavfilter/f_settb.c
	libavfilter/fifo.c
	libavfilter/src_movie.c
	libavfilter/vf_ass.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_boxblur.c
	libavfilter/vf_delogo.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fade.c
	libavfilter/vf_fieldorder.c
	libavfilter/vf_fps.c
	libavfilter/vf_hflip.c
	libavfilter/vf_overlay.c
	libavfilter/vf_pad.c
	libavfilter/vf_select.c
	libavfilter/vf_transpose.c
	libavfilter/vf_yadif.c
	libavfilter/vsrc_testsrc.c
	libavformat/mxfdec.c
	libavutil/error.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-11 15:46:48 +02:00
Mans Rullgard 568c70e79e lavfi: convert input/ouput list compound literals to named objects
A number of compilers, for example those from TI and IBM, choke on
these initialisers.  The current style is also quite ugly.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-10 22:26:12 +01:00
Michael Niedermayer c581cb4e4f Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Fix even more missing includes after the common.h removal
  build: Factor out rangecoder dependencies to CONFIG_RANGECODER
  build: Factor out error resilience dependencies to CONFIG_ERROR_RESILIENCE
  x86: avcodec: Consistently name all init files
  Add more missing includes after removing the implicit common.h
  Add some more missing includes after removing the implicit common.h
  Don't include common.h from avutil.h
  rtmp: Automatically compute the hash for SWFVerification

Conflicts:
	configure
	doc/APIchanges
	doc/examples/decoding_encoding.c
	libavcodec/Makefile
	libavcodec/assdec.c
	libavcodec/audio_frame_queue.c
	libavcodec/avpacket.c
	libavcodec/dv_profile.c
	libavcodec/dwt.c
	libavcodec/libtheoraenc.c
	libavcodec/rawdec.c
	libavcodec/rv40dsp.c
	libavcodec/tiff.c
	libavcodec/tiffenc.c
	libavcodec/v210dec.h
	libavcodec/vc1dsp.c
	libavcodec/x86/Makefile
	libavfilter/asrc_anullsrc.c
	libavfilter/avfilter.c
	libavfilter/buffer.c
	libavfilter/formats.c
	libavfilter/vf_ass.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fade.c
	libavfilter/vf_select.c
	libavfilter/video.c
	libavfilter/vsrc_testsrc.c
	libavformat/version.h
	libavutil/audioconvert.c
	libavutil/error.h
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-16 16:20:30 +02:00
Martin Storsjö 1d9c2dc89a Don't include common.h from avutil.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-15 22:32:06 +03:00
Michael Niedermayer 9023de342f Merge commit '1470ce21cec5ee26e106e2a884c26bbf84e5aaea'
* commit '1470ce21cec5ee26e106e2a884c26bbf84e5aaea':
  Bump libavcodec and libavformat minor versions for G.723.1 decoder and demuxer
  G.723.1 demuxer and decoder
  Add a shift parameter to celp_lp_synthesis_filter()
  libopenjpeg: K&R formatting cosmetics
  yadif: use emms_c() instead of inline assembly for emms invocations.
  ac3: don't use different names for option tables in the template file.
  lavfi: use const for AVFilterPad declarations in all filters.
  adpcm: don't duplicate identical AVSampleFmt array for each encoder.
  configure: cosmetics: Group test dependencies together
  configure: add more passthrough flags in tms470 filter
  configure: move flag filtering functions out of if/else blocks

Conflicts:
	Changelog
	configure
	doc/general.texi
	libavcodec/Makefile
	libavcodec/ac3enc_fixed.c
	libavcodec/allcodecs.c
	libavcodec/eac3enc.c
	libavcodec/g723_1.c
	libavcodec/g723_1_data.h
	libavcodec/libopenjpegdec.c
	libavcodec/libopenjpegenc.c
	libavcodec/v210dec.h
	libavcodec/version.h
	libavfilter/af_anull.c
	libavfilter/asrc_anullsrc.c
	libavfilter/f_settb.c
	libavfilter/fifo.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/vf_aspect.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_boxblur.c
	libavfilter/vf_copy.c
	libavfilter/vf_crop.c
	libavfilter/vf_cropdetect.c
	libavfilter/vf_delogo.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fade.c
	libavfilter/vf_fieldorder.c
	libavfilter/vf_format.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_gradfun.c
	libavfilter/vf_hflip.c
	libavfilter/vf_hqdn3d.c
	libavfilter/vf_libopencv.c
	libavfilter/vf_lut.c
	libavfilter/vf_null.c
	libavfilter/vf_overlay.c
	libavfilter/vf_pad.c
	libavfilter/vf_pixdesctest.c
	libavfilter/vf_scale.c
	libavfilter/vf_select.c
	libavfilter/vf_setpts.c
	libavfilter/vf_showinfo.c
	libavfilter/vf_slicify.c
	libavfilter/vf_transpose.c
	libavfilter/vf_unsharp.c
	libavfilter/vf_vflip.c
	libavfilter/vf_yadif.c
	libavfilter/vsrc_color.c
	libavfilter/vsrc_testsrc.c
	libavformat/Makefile
	libavformat/allformats.c
	libavformat/g723_1.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-22 22:18:18 +02:00
Ronald S. Bultje 3db407038e lavfi: use const for AVFilterPad declarations in all filters. 2012-07-21 16:31:15 -07:00
Michael Niedermayer 1c60088885 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  x86: Only use optimizations with cmov if the CPU supports the instruction
  x86: Add CPU flag for the i686 cmov instruction
  x86: remove unused inline asm macros from dsputil_mmx.h
  x86: move some inline asm macros to the only places they are used
  lavfi: Add the af_channelmap audio channel mapping filter.
  lavfi: add join audio filter.
  lavfi: allow audio filters to request a given number of samples.
  lavfi: support automatically inserting the fifo filter when needed.
  lavfi/audio: eliminate ff_default_filter_samples().

Conflicts:
	Changelog
	libavcodec/x86/h264dsp_mmx.c
	libavfilter/Makefile
	libavfilter/allfilters.c
	libavfilter/avfilter.h
	libavfilter/avfiltergraph.c
	libavfilter/version.h
	libavutil/x86/cpu.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-24 02:09:53 +02:00
Anton Khirnov fa06623930 lavfi/audio: eliminate ff_default_filter_samples().
It currently does the following:
1) get a zeroed audio buffer
2) copy some properties (but not the data) of the input buffer to it
3) pass this buffer to the output filter
This looks useless and is indeed not used by any filters, therefore
delete it.

Make ff_null_filter_samples() (just pass the buffer to the next filter)
the new default.
2012-06-22 20:58:19 +02:00
Michael Niedermayer c7b9eab2be Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtmp: Add a new option 'rtmp_buffer', for setting the client buffer time
  rtmp: Set the client buffer time to 3s instead of 0.26s
  rtmp: Handle server bandwidth packets
  rtmp: Display a verbose message when an unknown packet type is received
  lavfi/audio: use av_samples_copy() instead of custom code.
  configure: add all filters hardcoded into avconv to avconv_deps
  avfiltergraph: remove a redundant call to avfilter_get_by_name().
  lavfi: allow building without swscale.
  build: Do not delete tests/vsynth2 directory, which is no longer created.
  lavfi: replace AVFilterContext.input/output_count with nb_inputs/outputs
  lavfi: make AVFilterPad opaque after two major bumps.
  lavfi: add avfilter_pad_get_type() and avfilter_pad_get_name().
  lavfi: make avfilter_get_video_buffer() private on next bump.
  jack: update to new latency range API as the old one has been deprecated
  rtmp: Tokenize the AMF connection parameters manually instead of using strtok_r
  ppc: Rename H.264 optimization template file for consistency.
  lavfi: add channelsplit audio filter.
  golomb: check remaining bits during unary decoding in get_ur_golomb_jpegls()
  sws: fix planar RGB input conversions for 9/10/16 bpp.

Conflicts:
	Changelog
	configure
	doc/APIchanges
	ffmpeg.c
	libavcodec/golomb.h
	libavcodec/v210dec.h
	libavfilter/Makefile
	libavfilter/allfilters.c
	libavfilter/asrc_anullsrc.c
	libavfilter/audio.c
	libavfilter/avfilter.c
	libavfilter/avfilter.h
	libavfilter/avfiltergraph.c
	libavfilter/buffersrc.c
	libavfilter/formats.c
	libavfilter/version.h
	libavfilter/vf_frei0r.c
	libavfilter/vf_pad.c
	libavfilter/vf_scale.c
	libavfilter/video.h
	libavfilter/vsrc_color.c
	libavformat/rtmpproto.c
	libswscale/input.c
	tests/Makefile

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-13 22:43:57 +02:00
Anton Khirnov 9d0bfc5052 lavfi: make AVFilterPad opaque after two major bumps.
It will allow adding new fields to it without ABI breaks.
2012-06-13 11:11:33 +02:00
Michael Niedermayer 7ef5c80cb4 af_null: fix copyright
Authors according to blame are:
     16 S.N. Hemanth Meenakshisundaram
      4 Stefano Sabatini
      3 Anton Khirnov
      2 Reimar Döffinger

Initial commit was:
	commit 99046339fc
	Author: S.N. Hemanth Meenakshisundaram <smeenaks@ucsd.edu>
	Date:   Fri Aug 20 23:16:51 2010 +0000

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-24 05:08:48 +02:00
Michael Niedermayer 015903294c Merge remote-tracking branch 'qatar/master'
* qatar/master: (25 commits)
  rv40dsp x86: MMX/MMX2/3DNow/SSE2/SSSE3 implementations of MC
  ape: Use unsigned integer maths
  arm: dsputil: fix overreads in put/avg_pixels functions
  h264: K&R formatting cosmetics for header files (part II/II)
  h264: K&R formatting cosmetics for header files (part I/II)
  rtmp: Implement check bandwidth notification.
  rtmp: Support 'rtmp_swfurl', an option which specifies the URL of the SWF player.
  rtmp: Support 'rtmp_flashver', an option which overrides the version of the Flash plugin.
  rtmp: Support 'rtmp_tcurl', an option which overrides the URL of the target stream.
  cmdutils: Add fallback case to switch in check_stream_specifier().
  sctp: be consistent with socket option level
  configure: Add _XOPEN_SOURCE=600 to Solaris preprocessor flags.
  vcr1enc: drop pointless empty encode_init() wrapper function
  vcr1: drop pointless write-only AVCodecContext member from VCR1Context
  vcr1: group encoder code together to save #ifdefs
  vcr1: cosmetics: K&R prettyprinting, typos, parentheses, dead code, comments
  mov: make one comment slightly more specific
  lavr: replace the SSE version of ff_conv_fltp_to_flt_6ch() with SSE4 and AVX
  lavfi: move audio-related functions to a separate file.
  lavfi: remove some audio-related function from public API.
  ...

Conflicts:
	cmdutils.c
	libavcodec/h264.h
	libavcodec/h264_mvpred.h
	libavcodec/vcr1.c
	libavfilter/avfilter.c
	libavfilter/avfilter.h
	libavfilter/defaults.c
	libavfilter/internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-10 23:30:42 +02:00
Anton Khirnov 472fb3bbfa lavfi: remove some audio-related function from public API.
Those functions are only useful inside filters. It is better to not
support user filters until the API is more stable.

This breaks audio filtering API and ABI in theory, but since it's
unusable right now this shouldn't be a problem.
2012-05-09 20:31:56 +02:00
Reimar Döffinger 5af7daabc4 Mark AVFilterPad[] compound literals as const.
GCC 4.6.2 at least still seems to fail to put them in .rodata though,
see also http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2011-11-06 00:05:14 +01:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
S.N. Hemanth Meenakshisundaram 99046339fc Add null audio filter.
Patch by S.N. Hemanth Meenakshisundaram -af smeenaks,ucsd,edu.

Originally committed as revision 24856 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-20 23:16:51 +00:00