summaryrefslogtreecommitdiff
path: root/libavfilter/af_pan.c
Commit message (Collapse)AuthorAge
* avfilter: convert to new channel layout APIJames Almer2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter: Replace query_formats callback with union of list and callbackAndreas Rheinhardt2021-10-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one looks at the many query_formats callbacks in existence, one will immediately recognize that there is one type of default callback for video and a slightly different default callback for audio: It is "return ff_set_common_formats_from_list(ctx, pix_fmts);" for video with a filter-specific pix_fmts list. For audio, it is the same with a filter-specific sample_fmts list together with ff_set_common_all_samplerates() and ff_set_common_all_channel_counts(). This commit allows to remove the boilerplate query_formats callbacks by replacing said callback with a union consisting the old callback and pointers for pixel and sample format arrays. For the not uncommon case in which these lists only contain a single entry (besides the sentinel) enum AVPixelFormat and enum AVSampleFormat fields are also added to the union to store them directly in the AVFilter, thereby avoiding a relocation. The state of said union will be contained in a new, dedicated AVFilter field (the nb_inputs and nb_outputs fields have been shrunk to uint8_t in order to create a hole for this new field; this is no problem, as the maximum of all the nb_inputs is four; for nb_outputs it is only two). The state's default value coincides with the earlier default of query_formats being unset, namely that the filter accepts all formats (and also sample rates and channel counts/layouts for audio) provided that these properties agree coincide for all inputs and outputs. By using different union members for audio and video filters the type-unsafety of using the same functions for audio and video lists will furthermore be more confined to formats.c than before. When the new fields are used, they will also avoid allocations: Currently something nearly equivalent to ff_default_query_formats() is called after every successful call to a query_formats callback; yet in the common case that the newly allocated AVFilterFormats are not used at all (namely if there are no free links) these newly allocated AVFilterFormats are freed again without ever being used. Filters no longer using the callback will not exhibit this any more. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilterAndreas Rheinhardt2021-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* avfilter/formats: Factor common function combinations outAndreas Rheinhardt2021-08-13
| | | | | | | | | | | 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>
* avfilter: Constify all AVFiltersAndreas Rheinhardt2021-04-27
| | | | | | | 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>
* lavfi: regroup formats lists in a single structure.Nicolas George2020-09-08
| | | | | | | | | | | | | | | It will allow to refernce it as a whole without clunky macros. Most of the changes have been automatically made with sed: sed -i ' s/-> *in_formats/->incfg.formats/g; s/-> *out_formats/->outcfg.formats/g; s/-> *in_channel_layouts/->incfg.channel_layouts/g; s/-> *out_channel_layouts/->outcfg.channel_layouts/g; s/-> *in_samplerates/->incfg.samplerates/g; s/-> *out_samplerates/->outcfg.samplerates/g; ' src/libavfilter/*(.)
* remove CHAR_MIN/CHAR_MAX usagePaul B Mahol2020-03-17
| | | | It is not needed at all.
* avfilter/af_pan: reject expressions referencing the same channel multiple timesMarton Balint2018-03-29
| | | | | | | | Fixes parsing of expressions like c0=c0+c0 or c0=c0|c0=c1. Previously no error was thrown and for input channels, only the last gain factor was used, for output channels the source channel gains were combined. Signed-off-by: Marton Balint <cus@passwd.hu>
* lavfi/af_pan: fix sign handling in channel coefficient parserMichael Roitzsch2017-11-19
| | | | | When a channel formula ends with a subtraction, the next formula will otherwise have its first coefficient negated.
* avfilter: do not leak AVFrame on failed buffer allocationPaul B Mahol2017-06-24
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter: do not use AVFrame accessorMuhammad Faiz2017-04-23
| | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/af_pan: fix null pointer dereference on empty tokenMarton Balint2017-02-05
| | | | | | Fixes Coverity CID 1396254. Signed-off-by: Marton Balint <cus@passwd.hu>
* lavfi/pan: allow negative gain parameters also for other inputs than the ↵Moritz Barsnick2016-11-24
| | | | | | | | | | | | | | first named Expands the parser to also accept the separator '-' in addition to '+', and take the negative sign into consideration. The optional sign for the first factor in the expression is already covered by parsing for an integer. Signed-off-by: Moritz Barsnick <barsnick@gmx.net> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavfi/pan: renormalize negative gain coefficients properlyMoritz Barsnick2016-10-11
| | | | | | | | | | | The parser for the outdef will accept a negative value for the first named channel's gain. As negative values effectively only invert the phase of the signal, and not negate the level, the gains' absolute values must be used to correctly accumulate the levels. Signed-off-by: Moritz Barsnick <barsnick@gmx.net> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavfi: fix typosMoritz Barsnick2016-10-09
| | | | | Signed-off-by: Moritz Barsnick <barsnick@gmx.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/all: propagate errors of functions from avfilter/formatsGanesh Ajjanagadde2015-10-14
| | | | | | | | | | | | | | | | | | Many of the functions from avfilter/formats can return errors, usually AVERROR(ENOMEM). This propagates the return values. All of these were found by using av_warn_unused_result, demonstrating its utility. Tested with FATE. I am least sure of the changes to avfilter/filtergraph, since I don't know what/how reduce_format is intended to behave and how it should react to errors. Fixes: CID 1325680, 1325679, 1325678. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Previous version Reviewed-by: Nicolas George <george@nsup.org> Previous version Reviewed-by: Clément Bœsch <u@pkh.me> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* lavfi/af_pan: Support a maximum of 64 channels.Carl Eugen Hoyos2015-07-17
| | | | The Soundflower input device supports 64 channels.
* avfilter/af_pan: Do not use SWR_CH_MAXMichael Niedermayer2014-08-10
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/af_pan: check if the number of channels where sucessfully setMichael Niedermayer2014-08-10
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi/pan: use extended_data instead of data.Nicolas George2014-02-19
| | | | Fix trac ticket #3380.
* lavfi/af_pan: support unknown layouts on input.Nicolas George2013-11-03
| | | | Fix trac ticket #2899.
* lavfi/af_pan: support unknown layouts on output.Nicolas George2013-11-03
|
* lavfi: parsing helper for unknown channel layouts.Nicolas George2013-11-03
| | | | Make ff_parse_channel_layout() accept unknown layouts too.
* Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-10-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* avfilter: various cosmeticsPaul B Mahol2013-09-12
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* Update copyrights where my email appears with the new one.Clément Bœsch2013-09-03
|
* lavfi: remove now unused args parameter from AVFilter.init and init_opaqueMichael Niedermayer2013-04-12
| | | | | | | | | This is mostly automated global search and replace The deprecated aconvert filter is disabled, if it still has users it should be updated Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* af_pan: avoid spaces before % to avoid possible issues with MSVCMichael Niedermayer2013-04-12
| | | | | Found-by: ubitux Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* af_pan: switch to an AVOptions-based shorthand system.Michael Niedermayer2013-04-12
| | | | | | TODO: The first argument can be seperated into its own AVOption Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* af_pan: fix parsing arguments from the example in the documentationСерж Нискородов2013-04-12
| | | | | | | pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR didn't actually work ('Expected out channel name, got " FL < FL"')
* lavfi: always check return value of ff_get_{audio,video}_buffer()Paul B Mahol2013-04-08
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter: avoid direct access to AVFrame.channelsMichael Niedermayer2013-03-15
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Merge commit '7e350379f87e7f74420b4813170fe808e2313911'Michael Niedermayer2013-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '7e350379f87e7f74420b4813170fe808e2313911': lavfi: switch to AVFrame. Conflicts: doc/filters.texi libavfilter/af_ashowinfo.c libavfilter/audio.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/buffersink.c libavfilter/buffersrc.c libavfilter/buffersrc.h libavfilter/f_select.c libavfilter/f_setpts.c libavfilter/fifo.c libavfilter/split.c libavfilter/src_movie.c libavfilter/version.h libavfilter/vf_aspect.c libavfilter/vf_bbox.c libavfilter/vf_blackframe.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_frei0r.c libavfilter/vf_gradfun.c libavfilter/vf_hqdn3d.c libavfilter/vf_lut.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_showinfo.c libavfilter/vf_transpose.c libavfilter/vf_vflip.c libavfilter/vf_yadif.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavfilter/yadif.h Following are notes about the merge authorship and various technical details. Michael Niedermayer: * Main merge operation, notably avfilter.c and video.c * Switch to AVFrame: - afade - anullsrc - apad - aresample - blackframe - deshake - idet - il - mandelbrot - mptestsrc - noise - setfield - smartblur - tinterlace * various merge changes and fixes in: - ashowinfo - blackdetect - field - fps - select - testsrc - yadif Nicolas George: * Switch to AVFrame: - make rawdec work with refcounted frames. Adapted from commit 759001c534287a96dc96d1e274665feb7059145d by Anton Khirnov. Also, fix the use of || instead of | in a flags check. - make buffer sink and src, audio and video work all together Clément Bœsch: * Switch to AVFrame: - aevalsrc - alphaextract - blend - cellauto - colormatrix - concat - earwax - ebur128 - edgedetect - geq - histeq - histogram - hue - kerndeint - life - movie - mp (with the help of Michael) - overlay - pad - pan - pp - pp - removelogo - sendcmd - showspectrum - showwaves - silencedetect - stereo3d - subtitles - super2xsai - swapuv - thumbnail - tile Hendrik Leppkes: * Switch to AVFrame: - aconvert - amerge - asetnsamples - atempo - biquads Matthieu Bouron: * Switch to AVFrame - alphamerge - decimate - volumedetect Stefano Sabatini: * Switch to AVFrame: - astreamsync - flite - framestep Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Nicolas George <nicolas.george@normalesup.org> Signed-off-by: Clément Bœsch <ubitux@gmail.com> Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Stefano Sabatini <stefasab@gmail.com> Merged-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi: add a channels field to AVFilterLink.Nicolas George2012-12-20
| | | | | Also: fix af_pan and af_aresample, that forgot to update audio->channels.
* lavfi: convert remaining input/output list compound literals to named objects.Clément Bœsch2012-11-28
| | | | This is following 568c70e79ee267426c15ef4603c69703f6a5884a.
* lavfi: replace filter_samples by filter_frameMichael Niedermayer2012-11-28
| | | | | Based on patch by Anton Khirnov Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Replace rest of libavutil/audioconvert.h with libavutil/channel_layout.hPaul B Mahol2012-11-13
| | | | | | Also remove it in once case when it is not needed. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* af_pan: fix memleak of argMichael Niedermayer2012-10-13
| | | | | Fixes CID718988 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* af_pan: Fix sscanf formats to work with buggy sscanf implementationsHendrik Leppkes2012-09-15
| | | | | | | | | | | | | | | | | | | | Some implementations of sscanf do not handle a space before a trailing %n properly. As an example, MSVC's does this for the second insatnce in this patch, for an input of "0x3:c0=c1:c1=c0": 1) Match the final "c0" or "c1". 2) Realize it's at the end of the string. 3) Check for %n. 4) There is no %n, but a space instead. 5) Leave 'len' unitilialized. So, move it out of the sscanf format strings, and call skip_spaces instead. This bug does not affect skip_spaces since %n is the first and only formatting string. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* amerge/astreamsync/pan: fix license boilerplate.Nicolas George2012-08-03
| | | | | | The boilerplate states that the files are under LGPL, but refer the user to the GPL at one place. These files were (re)implemented specifically for FFmpeg.
* lavfi: decrease logging level of message showing initial parametersStefano Sabatini2012-07-15
| | | | Reduce log clutter, consistent with 1a49a169eb74a97.
* Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: mss3: use standard zigzag table mss3: split DSP functions that are used in MTS2(MSS4) into separate file motion-test: do not use getopt() tcp: add initial timeout limit for incoming connections configure: Change the rdtsc check to a linker check avconv: propagate fatal errors from lavfi. lavfi: add error handling to filter_samples(). fate-run: make avconv() properly deal with multiple inputs. asplit: don't leak the input buffer. af_resample: fix request_frame() behavior. af_asyncts: fix request_frame() behavior. libx264: support aspect ratio switching matroskadec: honor error_recognition when encountering unknown elements. lavr: resampling: add support for s32p, fltp, and dblp internal sample formats lavr: resampling: add filter type and Kaiser window beta to AVOptions lavr: Use AV_SAMPLE_FMT_NONE to auto-select the internal sample format lavr: mix: validate internal sample format in ff_audio_mix_init() Conflicts: ffmpeg.c ffplay.c libavcodec/libx264.c libavfilter/audio.c libavfilter/split.c libavformat/tcp.c tests/fate-run.sh Merged-by: Michael Niedermayer <michaelni@gmx.at>
* Merge commit 'a5e8c41c28f907d98d2a739db08f7aef4cbfcf3a'Michael Niedermayer2012-06-26
| | | | | | | | | | | | | | | | | | | | | | | * commit 'a5e8c41c28f907d98d2a739db08f7aef4cbfcf3a': lavfi: remove 'opaque' parameter from AVFilter.init() mov: do not try to read total disc/track number if data atom is too short. avconv: fix -force_key_frames dxva2_h264: fix signaling of mbaff frames x86: fft: elf64: fix PIC build Conflicts: ffmpeg.c libavcodec/v210dec.h libavfilter/asrc_anullsrc.c libavfilter/buffersrc.c libavfilter/src_movie.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_overlay.c libavfilter/vsrc_color.c libavfilter/vsrc_testsrc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
* lavfi: remove unnecessary inclusion of libavcodec/avcodec.h in avfilter.hStefano Sabatini2012-06-25
| | | | | | | | | | | | libavfilter API was designed in order to be clarly distinguished from the libavcodec API, including avcodec.h in avfilter.h is not going to help to stick to this principle. The inclusion of libavutil/audioconvert.h in many files was required because avcodec.h includes audioconvert.h. libavfilter/avcodec.h is where the lavc/lavfi interface should be entirely placed.
* Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-06-24
| | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* lavfi: update some deprecated functionsPaul B Mahol2012-06-16
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* pan: use ff_parse_channel_layout() instead of av_get_channel_layout().Clément Bœsch2012-05-18
| | | | | This allow specifying hexadecimal channel layout, and also handle the error printing internally.
* lavfi/pan: add supported sample rates to avoid a crash.Clément Bœsch2012-05-17
|
* lavfi: drop planar/packed negotiation supportStefano Sabatini2012-05-16
| | | | | | | | | The planar/packed switch and the packing_formats list is no longer required, since the planar/packed information is now stored in the sample format enum. This is technically a major API break, possibly it should be not too painful as we marked the audio filtering API as unstable.
* Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: (26 commits) fate: use diff -b in oneline comparison Add missing version bumps and APIchanges/Changelog entries. lavfi: move buffer management function to a separate file. lavfi: move formats-related functions from default.c to formats.c lavfi: move video-related functions to a separate file. fate: make smjpeg a demux test fate: separate sierra-vmd audio and video tests fate: separate smacker audio and video tests libmp3lame: set supported channel layouts. avconv: automatically insert asyncts when -async is used. avconv: add support for audio filters. lavfi: add asyncts filter. lavfi: add aformat filter lavfi: add an audio buffer sink. lavfi: add an audio buffer source. buffersrc: add av_buffersrc_write_frame(). buffersrc: fix invalid read in uninit if the fifo hasn't been allocated lavfi: rename vsrc_buffer.c to buffersrc.c avfiltergraph: reindent lavfi: add channel layout/sample rate negotiation. ... Conflicts: Changelog doc/APIchanges doc/filters.texi ffmpeg.c ffprobe.c libavcodec/libmp3lame.c libavfilter/Makefile libavfilter/af_aformat.c libavfilter/allfilters.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/avfiltergraph.c libavfilter/buffersrc.c libavfilter/defaults.c libavfilter/formats.c libavfilter/src_buffer.c libavfilter/version.h libavfilter/vf_yadif.c libavfilter/vsrc_buffer.c libavfilter/vsrc_buffer.h libavutil/avutil.h tests/fate/audio.mak tests/fate/demux.mak tests/fate/video.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>