[FFmpeg-devel] [PATCH v2 2/5] lavfi: add new iteration API
Josh de Kock
josh at itanimul.li
Sat Mar 24 03:28:51 EET 2018
Signed-off-by: Josh de Kock <josh at itanimul.li>
---
configure | 24 +-
doc/APIchanges | 4 +
doc/writing_filters.txt | 6 +-
libavfilter/allfilters.c | 820 +++++++++++++++++++++++++----------------------
libavfilter/avfilter.c | 50 +--
libavfilter/avfilter.h | 29 +-
libavfilter/version.h | 3 +
7 files changed, 481 insertions(+), 455 deletions(-)
diff --git a/configure b/configure
index cc3edeb80f..9966ae3c10 100755
--- a/configure
+++ b/configure
@@ -3561,15 +3561,6 @@ for v in "$@"; do
FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
done
-find_things(){
- thing=$1
- pattern=$2
- file=$source_path/$3
- sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
-}
-
-FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
-
find_things_extern(){
thing=$1
pattern=$2
@@ -3578,6 +3569,13 @@ find_things_extern(){
sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
}
+find_filters_extern(){
+ file=$source_path/$1
+ #sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file
+ sed -E -n "s/^extern AVFilter ff_([avfsinkrc]{2,5})_([a-zA-Z0-9_]+);/\2_filter/p" $file
+}
+
+FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev)
INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
@@ -7088,6 +7086,10 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
cp_if_changed $TMPH libavutil/avconfig.h
+full_filter_name(){
+ sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" $source_path/libavfilter/allfilters.c
+}
+
# generate the lists of enabled components
print_enabled_components(){
file=$1
@@ -7098,6 +7100,9 @@ print_enabled_components(){
for c in $*; do
if enabled $c; then
case $name in
+ filter_list)
+ c=$(full_filter_name $(remove_suffix _filter $c))
+ ;;
indev_list)
c=$(add_suffix _demuxer $(remove_suffix _indev $c))
;;
@@ -7112,6 +7117,7 @@ print_enabled_components(){
cp_if_changed $TMPH $file
}
+print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_LIST
print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
diff --git a/doc/APIchanges b/doc/APIchanges
index d410bcdd75..4052988f59 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2017-10-21
API changes, most recent first:
+2018-xx-xx - xxxxxxx - lavc 7.13.100 - avcodec.h
+ Deprecate use of avfilter_register(), avfilter_register_all(),
+ avfilter_next(). Add av_filter_iterate().
+
2018-03-21 - xxxxxxx - lavc 58.15.100 - avcodec.h
Add av_packet_make_writable().
diff --git a/doc/writing_filters.txt b/doc/writing_filters.txt
index 5cd4ecd6a4..98b9c6f3d2 100644
--- a/doc/writing_filters.txt
+++ b/doc/writing_filters.txt
@@ -31,10 +31,8 @@ If everything went right, you should get a foobar.png with Lena edge-detected.
That's it, your new playground is ready.
Some little details about what's going on:
-libavfilter/allfilters.c:avfilter_register_all() is called at runtime to create
-a list of the available filters, but it's important to know that this file is
-also parsed by the configure script, which in turn will define variables for
-the build system and the C:
+libavfilter/allfilters.c:this file is parsed by the configure script, which in turn
+will define variables for the build system and the C:
--- after running configure ---
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3f67e321bf..2c63f02a54 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -23,410 +23,452 @@
#include "avfilter.h"
#include "config.h"
+extern AVFilter ff_af_abench;
+extern AVFilter ff_af_acompressor;
+extern AVFilter ff_af_acontrast;
+extern AVFilter ff_af_acopy;
+extern AVFilter ff_af_acrossfade;
+extern AVFilter ff_af_acrusher;
+extern AVFilter ff_af_adelay;
+extern AVFilter ff_af_aecho;
+extern AVFilter ff_af_aemphasis;
+extern AVFilter ff_af_aeval;
+extern AVFilter ff_af_afade;
+extern AVFilter ff_af_afftfilt;
+extern AVFilter ff_af_afir;
+extern AVFilter ff_af_aformat;
+extern AVFilter ff_af_agate;
+extern AVFilter ff_af_aiir;
+extern AVFilter ff_af_ainterleave;
+extern AVFilter ff_af_alimiter;
+extern AVFilter ff_af_allpass;
+extern AVFilter ff_af_aloop;
+extern AVFilter ff_af_amerge;
+extern AVFilter ff_af_ametadata;
+extern AVFilter ff_af_amix;
+extern AVFilter ff_af_anequalizer;
+extern AVFilter ff_af_anull;
+extern AVFilter ff_af_apad;
+extern AVFilter ff_af_aperms;
+extern AVFilter ff_af_aphaser;
+extern AVFilter ff_af_apulsator;
+extern AVFilter ff_af_arealtime;
+extern AVFilter ff_af_aresample;
+extern AVFilter ff_af_areverse;
+extern AVFilter ff_af_aselect;
+extern AVFilter ff_af_asendcmd;
+extern AVFilter ff_af_asetnsamples;
+extern AVFilter ff_af_asetpts;
+extern AVFilter ff_af_asetrate;
+extern AVFilter ff_af_asettb;
+extern AVFilter ff_af_ashowinfo;
+extern AVFilter ff_af_asidedata;
+extern AVFilter ff_af_asplit;
+extern AVFilter ff_af_astats;
+extern AVFilter ff_af_astreamselect;
+extern AVFilter ff_af_atempo;
+extern AVFilter ff_af_atrim;
+extern AVFilter ff_af_azmq;
+extern AVFilter ff_af_bandpass;
+extern AVFilter ff_af_bandreject;
+extern AVFilter ff_af_bass;
+extern AVFilter ff_af_biquad;
+extern AVFilter ff_af_bs2b;
+extern AVFilter ff_af_channelmap;
+extern AVFilter ff_af_channelsplit;
+extern AVFilter ff_af_chorus;
+extern AVFilter ff_af_compand;
+extern AVFilter ff_af_compensationdelay;
+extern AVFilter ff_af_crossfeed;
+extern AVFilter ff_af_crystalizer;
+extern AVFilter ff_af_dcshift;
+extern AVFilter ff_af_drmeter;
+extern AVFilter ff_af_dynaudnorm;
+extern AVFilter ff_af_earwax;
+extern AVFilter ff_af_ebur128;
+extern AVFilter ff_af_equalizer;
+extern AVFilter ff_af_extrastereo;
+extern AVFilter ff_af_firequalizer;
+extern AVFilter ff_af_flanger;
+extern AVFilter ff_af_haas;
+extern AVFilter ff_af_hdcd;
+extern AVFilter ff_af_headphone;
+extern AVFilter ff_af_highpass;
+extern AVFilter ff_af_join;
+extern AVFilter ff_af_ladspa;
+extern AVFilter ff_af_loudnorm;
+extern AVFilter ff_af_lowpass;
+extern AVFilter ff_af_lv2;
+extern AVFilter ff_af_mcompand;
+extern AVFilter ff_af_pan;
+extern AVFilter ff_af_replaygain;
+extern AVFilter ff_af_resample;
+extern AVFilter ff_af_rubberband;
+extern AVFilter ff_af_sidechaincompress;
+extern AVFilter ff_af_sidechaingate;
+extern AVFilter ff_af_silencedetect;
+extern AVFilter ff_af_silenceremove;
+extern AVFilter ff_af_sofalizer;
+extern AVFilter ff_af_stereotools;
+extern AVFilter ff_af_stereowiden;
+extern AVFilter ff_af_superequalizer;
+extern AVFilter ff_af_surround;
+extern AVFilter ff_af_treble;
+extern AVFilter ff_af_tremolo;
+extern AVFilter ff_af_vibrato;
+extern AVFilter ff_af_volume;
+extern AVFilter ff_af_volumedetect;
-#define REGISTER_FILTER(X, x, y) \
- { \
- extern AVFilter ff_##y##_##x; \
- if (CONFIG_##X##_FILTER) \
- avfilter_register(&ff_##y##_##x); \
- }
+extern AVFilter ff_asrc_aevalsrc;
+extern AVFilter ff_asrc_anoisesrc;
+extern AVFilter ff_asrc_anullsrc;
+extern AVFilter ff_asrc_flite;
+extern AVFilter ff_asrc_hilbert;
+extern AVFilter ff_asrc_sine;
-#define REGISTER_FILTER_UNCONDITIONAL(x) \
- { \
- extern AVFilter ff_##x; \
- avfilter_register(&ff_##x); \
- }
+extern AVFilter ff_asink_anullsink;
+
+extern AVFilter ff_vf_alphaextract;
+extern AVFilter ff_vf_alphamerge;
+extern AVFilter ff_vf_ass;
+extern AVFilter ff_vf_atadenoise;
+extern AVFilter ff_vf_avgblur;
+extern AVFilter ff_vf_avgblur_opencl;
+extern AVFilter ff_vf_bbox;
+extern AVFilter ff_vf_bench;
+extern AVFilter ff_vf_bitplanenoise;
+extern AVFilter ff_vf_blackdetect;
+extern AVFilter ff_vf_blackframe;
+extern AVFilter ff_vf_blend;
+extern AVFilter ff_vf_boxblur;
+extern AVFilter ff_vf_bwdif;
+extern AVFilter ff_vf_chromakey;
+extern AVFilter ff_vf_ciescope;
+extern AVFilter ff_vf_codecview;
+extern AVFilter ff_vf_colorbalance;
+extern AVFilter ff_vf_colorchannelmixer;
+extern AVFilter ff_vf_colorkey;
+extern AVFilter ff_vf_colorlevels;
+extern AVFilter ff_vf_colormatrix;
+extern AVFilter ff_vf_colorspace;
+extern AVFilter ff_vf_convolution;
+extern AVFilter ff_vf_convolve;
+extern AVFilter ff_vf_copy;
+extern AVFilter ff_vf_coreimage;
+extern AVFilter ff_vf_cover_rect;
+extern AVFilter ff_vf_crop;
+extern AVFilter ff_vf_cropdetect;
+extern AVFilter ff_vf_curves;
+extern AVFilter ff_vf_datascope;
+extern AVFilter ff_vf_dctdnoiz;
+extern AVFilter ff_vf_deband;
+extern AVFilter ff_vf_decimate;
+extern AVFilter ff_vf_deconvolve;
+extern AVFilter ff_vf_deflate;
+extern AVFilter ff_vf_deflicker;
+extern AVFilter ff_vf_deinterlace_qsv;
+extern AVFilter ff_vf_deinterlace_vaapi;
+extern AVFilter ff_vf_dejudder;
+extern AVFilter ff_vf_delogo;
+extern AVFilter ff_vf_denoise_vaapi;
+extern AVFilter ff_vf_deshake;
+extern AVFilter ff_vf_despill;
+extern AVFilter ff_vf_detelecine;
+extern AVFilter ff_vf_dilation;
+extern AVFilter ff_vf_displace;
+extern AVFilter ff_vf_doubleweave;
+extern AVFilter ff_vf_drawbox;
+extern AVFilter ff_vf_drawgraph;
+extern AVFilter ff_vf_drawgrid;
+extern AVFilter ff_vf_drawtext;
+extern AVFilter ff_vf_edgedetect;
+extern AVFilter ff_vf_elbg;
+extern AVFilter ff_vf_entropy;
+extern AVFilter ff_vf_eq;
+extern AVFilter ff_vf_erosion;
+extern AVFilter ff_vf_extractplanes;
+extern AVFilter ff_vf_fade;
+extern AVFilter ff_vf_fftfilt;
+extern AVFilter ff_vf_field;
+extern AVFilter ff_vf_fieldhint;
+extern AVFilter ff_vf_fieldmatch;
+extern AVFilter ff_vf_fieldorder;
+extern AVFilter ff_vf_fillborders;
+extern AVFilter ff_vf_find_rect;
+extern AVFilter ff_vf_floodfill;
+extern AVFilter ff_vf_format;
+extern AVFilter ff_vf_fps;
+extern AVFilter ff_vf_framepack;
+extern AVFilter ff_vf_framerate;
+extern AVFilter ff_vf_framestep;
+extern AVFilter ff_vf_frei0r;
+extern AVFilter ff_vf_fspp;
+extern AVFilter ff_vf_gblur;
+extern AVFilter ff_vf_geq;
+extern AVFilter ff_vf_gradfun;
+extern AVFilter ff_vf_haldclut;
+extern AVFilter ff_vf_hflip;
+extern AVFilter ff_vf_histeq;
+extern AVFilter ff_vf_histogram;
+extern AVFilter ff_vf_hqdn3d;
+extern AVFilter ff_vf_hqx;
+extern AVFilter ff_vf_hstack;
+extern AVFilter ff_vf_hue;
+extern AVFilter ff_vf_hwdownload;
+extern AVFilter ff_vf_hwmap;
+extern AVFilter ff_vf_hwupload;
+extern AVFilter ff_vf_hwupload_cuda;
+extern AVFilter ff_vf_hysteresis;
+extern AVFilter ff_vf_idet;
+extern AVFilter ff_vf_il;
+extern AVFilter ff_vf_inflate;
+extern AVFilter ff_vf_interlace;
+extern AVFilter ff_vf_interleave;
+extern AVFilter ff_vf_kerndeint;
+extern AVFilter ff_vf_lenscorrection;
+extern AVFilter ff_vf_libvmaf;
+extern AVFilter ff_vf_limiter;
+extern AVFilter ff_vf_loop;
+extern AVFilter ff_vf_lumakey;
+extern AVFilter ff_vf_lut;
+extern AVFilter ff_vf_lut2;
+extern AVFilter ff_vf_lut3d;
+extern AVFilter ff_vf_lutrgb;
+extern AVFilter ff_vf_lutyuv;
+extern AVFilter ff_vf_maskedclamp;
+extern AVFilter ff_vf_maskedmerge;
+extern AVFilter ff_vf_mcdeint;
+extern AVFilter ff_vf_mergeplanes;
+extern AVFilter ff_vf_mestimate;
+extern AVFilter ff_vf_metadata;
+extern AVFilter ff_vf_midequalizer;
+extern AVFilter ff_vf_minterpolate;
+extern AVFilter ff_vf_mix;
+extern AVFilter ff_vf_mpdecimate;
+extern AVFilter ff_vf_negate;
+extern AVFilter ff_vf_nlmeans;
+extern AVFilter ff_vf_nnedi;
+extern AVFilter ff_vf_noformat;
+extern AVFilter ff_vf_noise;
+extern AVFilter ff_vf_normalize;
+extern AVFilter ff_vf_null;
+extern AVFilter ff_vf_ocr;
+extern AVFilter ff_vf_ocv;
+extern AVFilter ff_vf_oscilloscope;
+extern AVFilter ff_vf_overlay;
+extern AVFilter ff_vf_overlay_opencl;
+extern AVFilter ff_vf_overlay_qsv;
+extern AVFilter ff_vf_owdenoise;
+extern AVFilter ff_vf_pad;
+extern AVFilter ff_vf_palettegen;
+extern AVFilter ff_vf_paletteuse;
+extern AVFilter ff_vf_perms;
+extern AVFilter ff_vf_perspective;
+extern AVFilter ff_vf_phase;
+extern AVFilter ff_vf_pixdesctest;
+extern AVFilter ff_vf_pixscope;
+extern AVFilter ff_vf_pp;
+extern AVFilter ff_vf_pp7;
+extern AVFilter ff_vf_premultiply;
+extern AVFilter ff_vf_prewitt;
+extern AVFilter ff_vf_procamp_vaapi;
+extern AVFilter ff_vf_program_opencl;
+extern AVFilter ff_vf_pseudocolor;
+extern AVFilter ff_vf_psnr;
+extern AVFilter ff_vf_pullup;
+extern AVFilter ff_vf_qp;
+extern AVFilter ff_vf_random;
+extern AVFilter ff_vf_readeia608;
+extern AVFilter ff_vf_readvitc;
+extern AVFilter ff_vf_realtime;
+extern AVFilter ff_vf_remap;
+extern AVFilter ff_vf_removegrain;
+extern AVFilter ff_vf_removelogo;
+extern AVFilter ff_vf_repeatfields;
+extern AVFilter ff_vf_reverse;
+extern AVFilter ff_vf_roberts;
+extern AVFilter ff_vf_rotate;
+extern AVFilter ff_vf_sab;
+extern AVFilter ff_vf_scale;
+extern AVFilter ff_vf_scale_cuda;
+extern AVFilter ff_vf_scale_npp;
+extern AVFilter ff_vf_scale_qsv;
+extern AVFilter ff_vf_scale_vaapi;
+extern AVFilter ff_vf_scale2ref;
+extern AVFilter ff_vf_select;
+extern AVFilter ff_vf_selectivecolor;
+extern AVFilter ff_vf_sendcmd;
+extern AVFilter ff_vf_separatefields;
+extern AVFilter ff_vf_setdar;
+extern AVFilter ff_vf_setfield;
+extern AVFilter ff_vf_setpts;
+extern AVFilter ff_vf_setrange;
+extern AVFilter ff_vf_setsar;
+extern AVFilter ff_vf_settb;
+extern AVFilter ff_vf_sharpness_vaapi;
+extern AVFilter ff_vf_showinfo;
+extern AVFilter ff_vf_showpalette;
+extern AVFilter ff_vf_shuffleframes;
+extern AVFilter ff_vf_shuffleplanes;
+extern AVFilter ff_vf_sidedata;
+extern AVFilter ff_vf_signalstats;
+extern AVFilter ff_vf_signature;
+extern AVFilter ff_vf_smartblur;
+extern AVFilter ff_vf_sobel;
+extern AVFilter ff_vf_split;
+extern AVFilter ff_vf_spp;
+extern AVFilter ff_vf_ssim;
+extern AVFilter ff_vf_stereo3d;
+extern AVFilter ff_vf_streamselect;
+extern AVFilter ff_vf_subtitles;
+extern AVFilter ff_vf_super2xsai;
+extern AVFilter ff_vf_swaprect;
+extern AVFilter ff_vf_swapuv;
+extern AVFilter ff_vf_tblend;
+extern AVFilter ff_vf_telecine;
+extern AVFilter ff_vf_threshold;
+extern AVFilter ff_vf_thumbnail;
+extern AVFilter ff_vf_thumbnail_cuda;
+extern AVFilter ff_vf_tile;
+extern AVFilter ff_vf_tinterlace;
+extern AVFilter ff_vf_tlut2;
+extern AVFilter ff_vf_tonemap;
+extern AVFilter ff_vf_transpose;
+extern AVFilter ff_vf_trim;
+extern AVFilter ff_vf_unpremultiply;
+extern AVFilter ff_vf_unsharp;
+extern AVFilter ff_vf_unsharp_opencl;
+extern AVFilter ff_vf_uspp;
+extern AVFilter ff_vf_vaguedenoiser;
+extern AVFilter ff_vf_vectorscope;
+extern AVFilter ff_vf_vflip;
+extern AVFilter ff_vf_vidstabdetect;
+extern AVFilter ff_vf_vidstabtransform;
+extern AVFilter ff_vf_vignette;
+extern AVFilter ff_vf_vmafmotion;
+extern AVFilter ff_vf_vpp_qsv;
+extern AVFilter ff_vf_vstack;
+extern AVFilter ff_vf_w3fdif;
+extern AVFilter ff_vf_waveform;
+extern AVFilter ff_vf_weave;
+extern AVFilter ff_vf_xbr;
+extern AVFilter ff_vf_yadif;
+extern AVFilter ff_vf_zmq;
+extern AVFilter ff_vf_zoompan;
+extern AVFilter ff_vf_zscale;
+
+extern AVFilter ff_vsrc_allrgb;
+extern AVFilter ff_vsrc_allyuv;
+extern AVFilter ff_vsrc_cellauto;
+extern AVFilter ff_vsrc_color;
+extern AVFilter ff_vsrc_coreimagesrc;
+extern AVFilter ff_vsrc_frei0r_src;
+extern AVFilter ff_vsrc_haldclutsrc;
+extern AVFilter ff_vsrc_life;
+extern AVFilter ff_vsrc_mandelbrot;
+extern AVFilter ff_vsrc_mptestsrc;
+extern AVFilter ff_vsrc_nullsrc;
+extern AVFilter ff_vsrc_openclsrc;
+extern AVFilter ff_vsrc_rgbtestsrc;
+extern AVFilter ff_vsrc_smptebars;
+extern AVFilter ff_vsrc_smptehdbars;
+extern AVFilter ff_vsrc_testsrc;
+extern AVFilter ff_vsrc_testsrc2;
+extern AVFilter ff_vsrc_yuvtestsrc;
+
+extern AVFilter ff_vsink_nullsink;
+
+/* multimedia filters */
+extern AVFilter ff_avf_abitscope;
+extern AVFilter ff_avf_adrawgraph;
+extern AVFilter ff_avf_ahistogram;
+extern AVFilter ff_avf_aphasemeter;
+extern AVFilter ff_avf_avectorscope;
+extern AVFilter ff_avf_concat;
+extern AVFilter ff_avf_showcqt;
+extern AVFilter ff_avf_showfreqs;
+extern AVFilter ff_avf_showspectrum;
+extern AVFilter ff_avf_showspectrumpic;
+extern AVFilter ff_avf_showvolume;
+extern AVFilter ff_avf_showwaves;
+extern AVFilter ff_avf_showwavespic;
+extern AVFilter ff_vaf_spectrumsynth;
-static void register_all(void)
+/* multimedia sources */
+extern AVFilter ff_avsrc_amovie;
+extern AVFilter ff_avsrc_movie;
+
+/* those filters are part of public or internal API */
+extern AVFilter ff_asrc_abuffer;
+extern AVFilter ff_vsrc_buffer;
+extern AVFilter ff_asink_abuffer;
+extern AVFilter ff_vsink_buffer;
+extern AVFilter ff_af_afifo;
+extern AVFilter ff_vf_fifo;
+
+#include "libavfilter/filter_list.c"
+
+
+const AVFilter *av_filter_iterate(void **opaque)
{
- REGISTER_FILTER(ABENCH, abench, af);
- REGISTER_FILTER(ACOMPRESSOR, acompressor, af);
- REGISTER_FILTER(ACONTRAST, acontrast, af);
- REGISTER_FILTER(ACOPY, acopy, af);
- REGISTER_FILTER(ACROSSFADE, acrossfade, af);
- REGISTER_FILTER(ACRUSHER, acrusher, af);
- REGISTER_FILTER(ADELAY, adelay, af);
- REGISTER_FILTER(AECHO, aecho, af);
- REGISTER_FILTER(AEMPHASIS, aemphasis, af);
- REGISTER_FILTER(AEVAL, aeval, af);
- REGISTER_FILTER(AFADE, afade, af);
- REGISTER_FILTER(AFFTFILT, afftfilt, af);
- REGISTER_FILTER(AFIR, afir, af);
- REGISTER_FILTER(AFORMAT, aformat, af);
- REGISTER_FILTER(AGATE, agate, af);
- REGISTER_FILTER(AIIR, aiir, af);
- REGISTER_FILTER(AINTERLEAVE, ainterleave, af);
- REGISTER_FILTER(ALIMITER, alimiter, af);
- REGISTER_FILTER(ALLPASS, allpass, af);
- REGISTER_FILTER(ALOOP, aloop, af);
- REGISTER_FILTER(AMERGE, amerge, af);
- REGISTER_FILTER(AMETADATA, ametadata, af);
- REGISTER_FILTER(AMIX, amix, af);
- REGISTER_FILTER(ANEQUALIZER, anequalizer, af);
- REGISTER_FILTER(ANULL, anull, af);
- REGISTER_FILTER(APAD, apad, af);
- REGISTER_FILTER(APERMS, aperms, af);
- REGISTER_FILTER(APHASER, aphaser, af);
- REGISTER_FILTER(APULSATOR, apulsator, af);
- REGISTER_FILTER(AREALTIME, arealtime, af);
- REGISTER_FILTER(ARESAMPLE, aresample, af);
- REGISTER_FILTER(AREVERSE, areverse, af);
- REGISTER_FILTER(ASELECT, aselect, af);
- REGISTER_FILTER(ASENDCMD, asendcmd, af);
- REGISTER_FILTER(ASETNSAMPLES, asetnsamples, af);
- REGISTER_FILTER(ASETPTS, asetpts, af);
- REGISTER_FILTER(ASETRATE, asetrate, af);
- REGISTER_FILTER(ASETTB, asettb, af);
- REGISTER_FILTER(ASHOWINFO, ashowinfo, af);
- REGISTER_FILTER(ASIDEDATA, asidedata, af);
- REGISTER_FILTER(ASPLIT, asplit, af);
- REGISTER_FILTER(ASTATS, astats, af);
- REGISTER_FILTER(ASTREAMSELECT, astreamselect, af);
- REGISTER_FILTER(ATEMPO, atempo, af);
- REGISTER_FILTER(ATRIM, atrim, af);
- REGISTER_FILTER(AZMQ, azmq, af);
- REGISTER_FILTER(BANDPASS, bandpass, af);
- REGISTER_FILTER(BANDREJECT, bandreject, af);
- REGISTER_FILTER(BASS, bass, af);
- REGISTER_FILTER(BIQUAD, biquad, af);
- REGISTER_FILTER(BS2B, bs2b, af);
- REGISTER_FILTER(CHANNELMAP, channelmap, af);
- REGISTER_FILTER(CHANNELSPLIT, channelsplit, af);
- REGISTER_FILTER(CHORUS, chorus, af);
- REGISTER_FILTER(COMPAND, compand, af);
- REGISTER_FILTER(COMPENSATIONDELAY, compensationdelay, af);
- REGISTER_FILTER(CROSSFEED, crossfeed, af);
- REGISTER_FILTER(CRYSTALIZER, crystalizer, af);
- REGISTER_FILTER(DCSHIFT, dcshift, af);
- REGISTER_FILTER(DRMETER, drmeter, af);
- REGISTER_FILTER(DYNAUDNORM, dynaudnorm, af);
- REGISTER_FILTER(EARWAX, earwax, af);
- REGISTER_FILTER(EBUR128, ebur128, af);
- REGISTER_FILTER(EQUALIZER, equalizer, af);
- REGISTER_FILTER(EXTRASTEREO, extrastereo, af);
- REGISTER_FILTER(FIREQUALIZER, firequalizer, af);
- REGISTER_FILTER(FLANGER, flanger, af);
- REGISTER_FILTER(HAAS, haas, af);
- REGISTER_FILTER(HDCD, hdcd, af);
- REGISTER_FILTER(HEADPHONE, headphone, af);
- REGISTER_FILTER(HIGHPASS, highpass, af);
- REGISTER_FILTER(JOIN, join, af);
- REGISTER_FILTER(LADSPA, ladspa, af);
- REGISTER_FILTER(LOUDNORM, loudnorm, af);
- REGISTER_FILTER(LOWPASS, lowpass, af);
- REGISTER_FILTER(LV2, lv2, af);
- REGISTER_FILTER(MCOMPAND, mcompand, af);
- REGISTER_FILTER(PAN, pan, af);
- REGISTER_FILTER(REPLAYGAIN, replaygain, af);
- REGISTER_FILTER(RESAMPLE, resample, af);
- REGISTER_FILTER(RUBBERBAND, rubberband, af);
- REGISTER_FILTER(SIDECHAINCOMPRESS, sidechaincompress, af);
- REGISTER_FILTER(SIDECHAINGATE, sidechaingate, af);
- REGISTER_FILTER(SILENCEDETECT, silencedetect, af);
- REGISTER_FILTER(SILENCEREMOVE, silenceremove, af);
- REGISTER_FILTER(SOFALIZER, sofalizer, af);
- REGISTER_FILTER(STEREOTOOLS, stereotools, af);
- REGISTER_FILTER(STEREOWIDEN, stereowiden, af);
- REGISTER_FILTER(SUPEREQUALIZER, superequalizer, af);
- REGISTER_FILTER(SURROUND, surround, af);
- REGISTER_FILTER(TREBLE, treble, af);
- REGISTER_FILTER(TREMOLO, tremolo, af);
- REGISTER_FILTER(VIBRATO, vibrato, af);
- REGISTER_FILTER(VOLUME, volume, af);
- REGISTER_FILTER(VOLUMEDETECT, volumedetect, af);
+ uintptr_t i = (uintptr_t)*opaque;
+ const AVFilter *f = filter_list[i];
+
+ if (f)
+ *opaque = (void*)(i + 1);
- REGISTER_FILTER(AEVALSRC, aevalsrc, asrc);
- REGISTER_FILTER(ANOISESRC, anoisesrc, asrc);
- REGISTER_FILTER(ANULLSRC, anullsrc, asrc);
- REGISTER_FILTER(FLITE, flite, asrc);
- REGISTER_FILTER(HILBERT, hilbert, asrc);
- REGISTER_FILTER(SINE, sine, asrc);
+ return f;
+}
- REGISTER_FILTER(ANULLSINK, anullsink, asink);
+const AVFilter *avfilter_get_by_name(const char *name)
+{
+ const AVFilter *f = NULL;
+ void *opaque = 0;
- REGISTER_FILTER(ALPHAEXTRACT, alphaextract, vf);
- REGISTER_FILTER(ALPHAMERGE, alphamerge, vf);
- REGISTER_FILTER(ASS, ass, vf);
- REGISTER_FILTER(ATADENOISE, atadenoise, vf);
- REGISTER_FILTER(AVGBLUR, avgblur, vf);
- REGISTER_FILTER(AVGBLUR_OPENCL, avgblur_opencl, vf);
- REGISTER_FILTER(BBOX, bbox, vf);
- REGISTER_FILTER(BENCH, bench, vf);
- REGISTER_FILTER(BITPLANENOISE, bitplanenoise, vf);
- REGISTER_FILTER(BLACKDETECT, blackdetect, vf);
- REGISTER_FILTER(BLACKFRAME, blackframe, vf);
- REGISTER_FILTER(BLEND, blend, vf);
- REGISTER_FILTER(BOXBLUR, boxblur, vf);
- REGISTER_FILTER(BWDIF, bwdif, vf);
- REGISTER_FILTER(CHROMAKEY, chromakey, vf);
- REGISTER_FILTER(CIESCOPE, ciescope, vf);
- REGISTER_FILTER(CODECVIEW, codecview, vf);
- REGISTER_FILTER(COLORBALANCE, colorbalance, vf);
- REGISTER_FILTER(COLORCHANNELMIXER, colorchannelmixer, vf);
- REGISTER_FILTER(COLORKEY, colorkey, vf);
- REGISTER_FILTER(COLORLEVELS, colorlevels, vf);
- REGISTER_FILTER(COLORMATRIX, colormatrix, vf);
- REGISTER_FILTER(COLORSPACE, colorspace, vf);
- REGISTER_FILTER(CONVOLUTION, convolution, vf);
- REGISTER_FILTER(CONVOLVE, convolve, vf);
- REGISTER_FILTER(COPY, copy, vf);
- REGISTER_FILTER(COREIMAGE, coreimage, vf);
- REGISTER_FILTER(COVER_RECT, cover_rect, vf);
- REGISTER_FILTER(CROP, crop, vf);
- REGISTER_FILTER(CROPDETECT, cropdetect, vf);
- REGISTER_FILTER(CURVES, curves, vf);
- REGISTER_FILTER(DATASCOPE, datascope, vf);
- REGISTER_FILTER(DCTDNOIZ, dctdnoiz, vf);
- REGISTER_FILTER(DEBAND, deband, vf);
- REGISTER_FILTER(DECIMATE, decimate, vf);
- REGISTER_FILTER(DECONVOLVE, deconvolve, vf);
- REGISTER_FILTER(DEFLATE, deflate, vf);
- REGISTER_FILTER(DEFLICKER, deflicker, vf);
- REGISTER_FILTER(DEINTERLACE_QSV,deinterlace_qsv,vf);
- REGISTER_FILTER(DEINTERLACE_VAAPI, deinterlace_vaapi, vf);
- REGISTER_FILTER(DEJUDDER, dejudder, vf);
- REGISTER_FILTER(DELOGO, delogo, vf);
- REGISTER_FILTER(DENOISE_VAAPI, denoise_vaapi, vf);
- REGISTER_FILTER(DESHAKE, deshake, vf);
- REGISTER_FILTER(DESPILL, despill, vf);
- REGISTER_FILTER(DETELECINE, detelecine, vf);
- REGISTER_FILTER(DILATION, dilation, vf);
- REGISTER_FILTER(DISPLACE, displace, vf);
- REGISTER_FILTER(DOUBLEWEAVE, doubleweave, vf);
- REGISTER_FILTER(DRAWBOX, drawbox, vf);
- REGISTER_FILTER(DRAWGRAPH, drawgraph, vf);
- REGISTER_FILTER(DRAWGRID, drawgrid, vf);
- REGISTER_FILTER(DRAWTEXT, drawtext, vf);
- REGISTER_FILTER(EDGEDETECT, edgedetect, vf);
- REGISTER_FILTER(ELBG, elbg, vf);
- REGISTER_FILTER(ENTROPY, entropy, vf);
- REGISTER_FILTER(EQ, eq, vf);
- REGISTER_FILTER(EROSION, erosion, vf);
- REGISTER_FILTER(EXTRACTPLANES, extractplanes, vf);
- REGISTER_FILTER(FADE, fade, vf);
- REGISTER_FILTER(FFTFILT, fftfilt, vf);
- REGISTER_FILTER(FIELD, field, vf);
- REGISTER_FILTER(FIELDHINT, fieldhint, vf);
- REGISTER_FILTER(FIELDMATCH, fieldmatch, vf);
- REGISTER_FILTER(FIELDORDER, fieldorder, vf);
- REGISTER_FILTER(FILLBORDERS, fillborders, vf);
- REGISTER_FILTER(FIND_RECT, find_rect, vf);
- REGISTER_FILTER(FLOODFILL, floodfill, vf);
- REGISTER_FILTER(FORMAT, format, vf);
- REGISTER_FILTER(FPS, fps, vf);
- REGISTER_FILTER(FRAMEPACK, framepack, vf);
- REGISTER_FILTER(FRAMERATE, framerate, vf);
- REGISTER_FILTER(FRAMESTEP, framestep, vf);
- REGISTER_FILTER(FREI0R, frei0r, vf);
- REGISTER_FILTER(FSPP, fspp, vf);
- REGISTER_FILTER(GBLUR, gblur, vf);
- REGISTER_FILTER(GEQ, geq, vf);
- REGISTER_FILTER(GRADFUN, gradfun, vf);
- REGISTER_FILTER(HALDCLUT, haldclut, vf);
- REGISTER_FILTER(HFLIP, hflip, vf);
- REGISTER_FILTER(HISTEQ, histeq, vf);
- REGISTER_FILTER(HISTOGRAM, histogram, vf);
- REGISTER_FILTER(HQDN3D, hqdn3d, vf);
- REGISTER_FILTER(HQX, hqx, vf);
- REGISTER_FILTER(HSTACK, hstack, vf);
- REGISTER_FILTER(HUE, hue, vf);
- REGISTER_FILTER(HWDOWNLOAD, hwdownload, vf);
- REGISTER_FILTER(HWMAP, hwmap, vf);
- REGISTER_FILTER(HWUPLOAD, hwupload, vf);
- REGISTER_FILTER(HWUPLOAD_CUDA, hwupload_cuda, vf);
- REGISTER_FILTER(HYSTERESIS, hysteresis, vf);
- REGISTER_FILTER(IDET, idet, vf);
- REGISTER_FILTER(IL, il, vf);
- REGISTER_FILTER(INFLATE, inflate, vf);
- REGISTER_FILTER(INTERLACE, interlace, vf);
- REGISTER_FILTER(INTERLEAVE, interleave, vf);
- REGISTER_FILTER(KERNDEINT, kerndeint, vf);
- REGISTER_FILTER(LENSCORRECTION, lenscorrection, vf);
- REGISTER_FILTER(LIBVMAF, libvmaf, vf);
- REGISTER_FILTER(LIMITER, limiter, vf);
- REGISTER_FILTER(LOOP, loop, vf);
- REGISTER_FILTER(LUMAKEY, lumakey, vf);
- REGISTER_FILTER(LUT, lut, vf);
- REGISTER_FILTER(LUT2, lut2, vf);
- REGISTER_FILTER(LUT3D, lut3d, vf);
- REGISTER_FILTER(LUTRGB, lutrgb, vf);
- REGISTER_FILTER(LUTYUV, lutyuv, vf);
- REGISTER_FILTER(MASKEDCLAMP, maskedclamp, vf);
- REGISTER_FILTER(MASKEDMERGE, maskedmerge, vf);
- REGISTER_FILTER(MCDEINT, mcdeint, vf);
- REGISTER_FILTER(MERGEPLANES, mergeplanes, vf);
- REGISTER_FILTER(MESTIMATE, mestimate, vf);
- REGISTER_FILTER(METADATA, metadata, vf);
- REGISTER_FILTER(MIDEQUALIZER, midequalizer, vf);
- REGISTER_FILTER(MINTERPOLATE, minterpolate, vf);
- REGISTER_FILTER(MIX, mix, vf);
- REGISTER_FILTER(MPDECIMATE, mpdecimate, vf);
- REGISTER_FILTER(NEGATE, negate, vf);
- REGISTER_FILTER(NLMEANS, nlmeans, vf);
- REGISTER_FILTER(NNEDI, nnedi, vf);
- REGISTER_FILTER(NOFORMAT, noformat, vf);
- REGISTER_FILTER(NOISE, noise, vf);
- REGISTER_FILTER(NORMALIZE, normalize, vf);
- REGISTER_FILTER(NULL, null, vf);
- REGISTER_FILTER(OCR, ocr, vf);
- REGISTER_FILTER(OCV, ocv, vf);
- REGISTER_FILTER(OSCILLOSCOPE, oscilloscope, vf);
- REGISTER_FILTER(OVERLAY, overlay, vf);
- REGISTER_FILTER(OVERLAY_OPENCL, overlay_opencl, vf);
- REGISTER_FILTER(OVERLAY_QSV, overlay_qsv, vf);
- REGISTER_FILTER(OWDENOISE, owdenoise, vf);
- REGISTER_FILTER(PAD, pad, vf);
- REGISTER_FILTER(PALETTEGEN, palettegen, vf);
- REGISTER_FILTER(PALETTEUSE, paletteuse, vf);
- REGISTER_FILTER(PERMS, perms, vf);
- REGISTER_FILTER(PERSPECTIVE, perspective, vf);
- REGISTER_FILTER(PHASE, phase, vf);
- REGISTER_FILTER(PIXDESCTEST, pixdesctest, vf);
- REGISTER_FILTER(PIXSCOPE, pixscope, vf);
- REGISTER_FILTER(PP, pp, vf);
- REGISTER_FILTER(PP7, pp7, vf);
- REGISTER_FILTER(PREMULTIPLY, premultiply, vf);
- REGISTER_FILTER(PREWITT, prewitt, vf);
- REGISTER_FILTER(PROCAMP_VAAPI, procamp_vaapi, vf);
- REGISTER_FILTER(PROGRAM_OPENCL, program_opencl, vf);
- REGISTER_FILTER(PSEUDOCOLOR, pseudocolor, vf);
- REGISTER_FILTER(PSNR, psnr, vf);
- REGISTER_FILTER(PULLUP, pullup, vf);
- REGISTER_FILTER(QP, qp, vf);
- REGISTER_FILTER(RANDOM, random, vf);
- REGISTER_FILTER(READEIA608, readeia608, vf);
- REGISTER_FILTER(READVITC, readvitc, vf);
- REGISTER_FILTER(REALTIME, realtime, vf);
- REGISTER_FILTER(REMAP, remap, vf);
- REGISTER_FILTER(REMOVEGRAIN, removegrain, vf);
- REGISTER_FILTER(REMOVELOGO, removelogo, vf);
- REGISTER_FILTER(REPEATFIELDS, repeatfields, vf);
- REGISTER_FILTER(REVERSE, reverse, vf);
- REGISTER_FILTER(ROBERTS, roberts, vf);
- REGISTER_FILTER(ROTATE, rotate, vf);
- REGISTER_FILTER(SAB, sab, vf);
- REGISTER_FILTER(SCALE, scale, vf);
- REGISTER_FILTER(SCALE_CUDA, scale_cuda, vf);
- REGISTER_FILTER(SCALE_NPP, scale_npp, vf);
- REGISTER_FILTER(SCALE_QSV, scale_qsv, vf);
- REGISTER_FILTER(SCALE_VAAPI, scale_vaapi, vf);
- REGISTER_FILTER(SCALE2REF, scale2ref, vf);
- REGISTER_FILTER(SELECT, select, vf);
- REGISTER_FILTER(SELECTIVECOLOR, selectivecolor, vf);
- REGISTER_FILTER(SENDCMD, sendcmd, vf);
- REGISTER_FILTER(SEPARATEFIELDS, separatefields, vf);
- REGISTER_FILTER(SETDAR, setdar, vf);
- REGISTER_FILTER(SETFIELD, setfield, vf);
- REGISTER_FILTER(SETPTS, setpts, vf);
- REGISTER_FILTER(SETRANGE, setrange, vf);
- REGISTER_FILTER(SETSAR, setsar, vf);
- REGISTER_FILTER(SETTB, settb, vf);
- REGISTER_FILTER(SHARPNESS_VAAPI, sharpness_vaapi, vf);
- REGISTER_FILTER(SHOWINFO, showinfo, vf);
- REGISTER_FILTER(SHOWPALETTE, showpalette, vf);
- REGISTER_FILTER(SHUFFLEFRAMES, shuffleframes, vf);
- REGISTER_FILTER(SHUFFLEPLANES, shuffleplanes, vf);
- REGISTER_FILTER(SIDEDATA, sidedata, vf);
- REGISTER_FILTER(SIGNALSTATS, signalstats, vf);
- REGISTER_FILTER(SIGNATURE, signature, vf);
- REGISTER_FILTER(SMARTBLUR, smartblur, vf);
- REGISTER_FILTER(SOBEL, sobel, vf);
- REGISTER_FILTER(SPLIT, split, vf);
- REGISTER_FILTER(SPP, spp, vf);
- REGISTER_FILTER(SSIM, ssim, vf);
- REGISTER_FILTER(STEREO3D, stereo3d, vf);
- REGISTER_FILTER(STREAMSELECT, streamselect, vf);
- REGISTER_FILTER(SUBTITLES, subtitles, vf);
- REGISTER_FILTER(SUPER2XSAI, super2xsai, vf);
- REGISTER_FILTER(SWAPRECT, swaprect, vf);
- REGISTER_FILTER(SWAPUV, swapuv, vf);
- REGISTER_FILTER(TBLEND, tblend, vf);
- REGISTER_FILTER(TELECINE, telecine, vf);
- REGISTER_FILTER(THRESHOLD, threshold, vf);
- REGISTER_FILTER(THUMBNAIL, thumbnail, vf);
- REGISTER_FILTER(THUMBNAIL_CUDA, thumbnail_cuda, vf);
- REGISTER_FILTER(TILE, tile, vf);
- REGISTER_FILTER(TINTERLACE, tinterlace, vf);
- REGISTER_FILTER(TLUT2, tlut2, vf);
- REGISTER_FILTER(TONEMAP, tonemap, vf);
- REGISTER_FILTER(TRANSPOSE, transpose, vf);
- REGISTER_FILTER(TRIM, trim, vf);
- REGISTER_FILTER(UNPREMULTIPLY, unpremultiply, vf);
- REGISTER_FILTER(UNSHARP, unsharp, vf);
- REGISTER_FILTER(UNSHARP_OPENCL, unsharp_opencl, vf);
- REGISTER_FILTER(USPP, uspp, vf);
- REGISTER_FILTER(VAGUEDENOISER, vaguedenoiser, vf);
- REGISTER_FILTER(VECTORSCOPE, vectorscope, vf);
- REGISTER_FILTER(VFLIP, vflip, vf);
- REGISTER_FILTER(VIDSTABDETECT, vidstabdetect, vf);
- REGISTER_FILTER(VIDSTABTRANSFORM, vidstabtransform, vf);
- REGISTER_FILTER(VIGNETTE, vignette, vf);
- REGISTER_FILTER(VMAFMOTION, vmafmotion, vf);
- REGISTER_FILTER(VPP_QSV, vpp_qsv, vf);
- REGISTER_FILTER(VSTACK, vstack, vf);
- REGISTER_FILTER(W3FDIF, w3fdif, vf);
- REGISTER_FILTER(WAVEFORM, waveform, vf);
- REGISTER_FILTER(WEAVE, weave, vf);
- REGISTER_FILTER(XBR, xbr, vf);
- REGISTER_FILTER(YADIF, yadif, vf);
- REGISTER_FILTER(ZMQ, zmq, vf);
- REGISTER_FILTER(ZOOMPAN, zoompan, vf);
- REGISTER_FILTER(ZSCALE, zscale, vf);
+ if (!name)
+ return NULL;
- REGISTER_FILTER(ALLRGB, allrgb, vsrc);
- REGISTER_FILTER(ALLYUV, allyuv, vsrc);
- REGISTER_FILTER(CELLAUTO, cellauto, vsrc);
- REGISTER_FILTER(COLOR, color, vsrc);
- REGISTER_FILTER(COREIMAGESRC, coreimagesrc, vsrc);
- REGISTER_FILTER(FREI0R, frei0r_src, vsrc);
- REGISTER_FILTER(HALDCLUTSRC, haldclutsrc, vsrc);
- REGISTER_FILTER(LIFE, life, vsrc);
- REGISTER_FILTER(MANDELBROT, mandelbrot, vsrc);
- REGISTER_FILTER(MPTESTSRC, mptestsrc, vsrc);
- REGISTER_FILTER(NULLSRC, nullsrc, vsrc);
- REGISTER_FILTER(OPENCLSRC, openclsrc, vsrc);
- REGISTER_FILTER(RGBTESTSRC, rgbtestsrc, vsrc);
- REGISTER_FILTER(SMPTEBARS, smptebars, vsrc);
- REGISTER_FILTER(SMPTEHDBARS, smptehdbars, vsrc);
- REGISTER_FILTER(TESTSRC, testsrc, vsrc);
- REGISTER_FILTER(TESTSRC2, testsrc2, vsrc);
- REGISTER_FILTER(YUVTESTSRC, yuvtestsrc, vsrc);
+ while ((f = av_filter_iterate(&opaque)))
+ if (!strcmp(f->name, name))
+ return (AVFilter *)f;
- REGISTER_FILTER(NULLSINK, nullsink, vsink);
+ return NULL;
+}
- /* multimedia filters */
- REGISTER_FILTER(ABITSCOPE, abitscope, avf);
- REGISTER_FILTER(ADRAWGRAPH, adrawgraph, avf);
- REGISTER_FILTER(AHISTOGRAM, ahistogram, avf);
- REGISTER_FILTER(APHASEMETER, aphasemeter, avf);
- REGISTER_FILTER(AVECTORSCOPE, avectorscope, avf);
- REGISTER_FILTER(CONCAT, concat, avf);
- REGISTER_FILTER(SHOWCQT, showcqt, avf);
- REGISTER_FILTER(SHOWFREQS, showfreqs, avf);
- REGISTER_FILTER(SHOWSPECTRUM, showspectrum, avf);
- REGISTER_FILTER(SHOWSPECTRUMPIC, showspectrumpic, avf);
- REGISTER_FILTER(SHOWVOLUME, showvolume, avf);
- REGISTER_FILTER(SHOWWAVES, showwaves, avf);
- REGISTER_FILTER(SHOWWAVESPIC, showwavespic, avf);
- REGISTER_FILTER(SPECTRUMSYNTH, spectrumsynth, vaf);
- /* multimedia sources */
- REGISTER_FILTER(AMOVIE, amovie, avsrc);
- REGISTER_FILTER(MOVIE, movie, avsrc);
+#if FF_API_NEXT
+FF_DISABLE_DEPRECATION_WARNINGS
+static AVOnce av_filter_next_init = AV_ONCE_INIT;
- /* those filters are part of public or internal API => registered
- * unconditionally */
- REGISTER_FILTER_UNCONDITIONAL(asrc_abuffer);
- REGISTER_FILTER_UNCONDITIONAL(vsrc_buffer);
- REGISTER_FILTER_UNCONDITIONAL(asink_abuffer);
- REGISTER_FILTER_UNCONDITIONAL(vsink_buffer);
- REGISTER_FILTER_UNCONDITIONAL(af_afifo);
- REGISTER_FILTER_UNCONDITIONAL(vf_fifo);
+static void av_filter_init_next(void)
+{
+ AVFilter *prev = NULL, *p;
+ void *i = 0;
+ while ((p = (AVFilter*)av_filter_iterate(&i))) {
+ if (prev)
+ prev->next = p;
+ prev = p;
+ }
}
void avfilter_register_all(void)
{
- static AVOnce control = AV_ONCE_INIT;
+ ff_thread_once(&av_filter_next_init, av_filter_init_next);
+}
+
+int avfilter_register(AVFilter *filter)
+{
+ ff_thread_once(&av_filter_next_init, av_filter_init_next);
+
+ return 0;
+}
+
+const AVFilter *avfilter_next(const AVFilter *prev)
+{
+ ff_thread_once(&av_filter_next_init, av_filter_init_next);
- ff_thread_once(&control, register_all);
+ return prev ? prev->next : filter_list[0];
}
+
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 7553f7c36a..ed8161136c 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -575,51 +575,6 @@ int avfilter_process_command(AVFilterContext *filter, const char *cmd, const cha
return AVERROR(ENOSYS);
}
-static AVFilter *first_filter;
-static AVFilter **last_filter = &first_filter;
-
-const AVFilter *avfilter_get_by_name(const char *name)
-{
- const AVFilter *f = NULL;
-
- if (!name)
- return NULL;
-
- while ((f = avfilter_next(f)))
- if (!strcmp(f->name, name))
- return (AVFilter *)f;
-
- return NULL;
-}
-
-static AVMutex filter_register_mutex = AV_MUTEX_INITIALIZER;
-
-int avfilter_register(AVFilter *filter)
-{
- AVFilter **f;
-
- /* the filter must select generic or internal exclusively */
- av_assert0((filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE) != AVFILTER_FLAG_SUPPORT_TIMELINE);
-
- ff_mutex_lock(&filter_register_mutex);
- f = last_filter;
-
- while (*f)
- f = &(*f)->next;
- *f = filter;
- filter->next = NULL;
- last_filter = &filter->next;
-
- ff_mutex_unlock(&filter_register_mutex);
-
- return 0;
-}
-
-const AVFilter *avfilter_next(const AVFilter *prev)
-{
- return prev ? prev->next : first_filter;
-}
-
int avfilter_pad_count(const AVFilterPad *pads)
{
int count;
@@ -648,10 +603,11 @@ static void *filter_child_next(void *obj, void *prev)
static const AVClass *filter_child_class_next(const AVClass *prev)
{
+ void *opaque = NULL;
const AVFilter *f = NULL;
/* find the filter that corresponds to prev */
- while (prev && (f = avfilter_next(f)))
+ while (prev && (f = av_filter_iterate(&opaque)))
if (f->priv_class == prev)
break;
@@ -660,7 +616,7 @@ static const AVClass *filter_child_class_next(const AVClass *prev)
return NULL;
/* find next filter with specific options */
- while ((f = avfilter_next(f)))
+ while ((f = av_filter_iterate(&opaque)))
if (f->priv_class)
return f->priv_class;
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 2d1195eeeb..9d70e7118b 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -697,7 +697,20 @@ int avfilter_config_links(AVFilterContext *filter);
*/
int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags);
+/**
+ * Iterate over all registered filters.
+ *
+ * @param opaque a pointer where libavfilter will store the iteration state. Must
+ * point to NULL to start the iteration.
+ *
+ * @return the next registered filter or NULL when the iteration is
+ * finished
+ */
+const AVFilter *av_filter_iterate(void **opaque);
+
+#if FF_API_NEXT
/** Initialize the filter system. Register all builtin filters. */
+attribute_deprecated
void avfilter_register_all(void);
/**
@@ -710,8 +723,18 @@ void avfilter_register_all(void);
* @return 0 if the registration was successful, a negative value
* otherwise
*/
+attribute_deprecated
int avfilter_register(AVFilter *filter);
+/**
+ * Iterate over all registered filters.
+ * @return If prev is non-NULL, next registered filter after prev or NULL if
+ * prev is the last filter. If prev is NULL, return the first registered filter.
+ */
+attribute_deprecated
+const AVFilter *avfilter_next(const AVFilter *prev);
+#endif
+
/**
* Get a filter definition matching the given name.
*
@@ -721,12 +744,6 @@ int avfilter_register(AVFilter *filter);
*/
const AVFilter *avfilter_get_by_name(const char *name);
-/**
- * Iterate over all registered filters.
- * @return If prev is non-NULL, next registered filter after prev or NULL if
- * prev is the last filter. If prev is NULL, return the first registered filter.
- */
-const AVFilter *avfilter_next(const AVFilter *prev);
/**
* Initialize a filter with the supplied parameters.
diff --git a/libavfilter/version.h b/libavfilter/version.h
index babb4187b4..8d77a500bf 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -58,5 +58,8 @@
#ifndef FF_API_FILTER_GET_SET
#define FF_API_FILTER_GET_SET (LIBAVFILTER_VERSION_MAJOR < 8)
#endif
+#ifndef FF_API_NEXT
+#define FF_API_NEXT (LIBAVFILTER_VERSION_MAJOR < 8)
+#endif
#endif /* AVFILTER_VERSION_H */
--
2.14.3 (Apple Git-98)
More information about the ffmpeg-devel
mailing list