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>
pull/364/head
Andreas Rheinhardt 3 years ago
parent 55d9d67679
commit 18ec426a86
  1. 27
      libavfilter/aeval.c
  2. 16
      libavfilter/af_acontrast.c
  3. 17
      libavfilter/af_acrossover.c
  4. 17
      libavfilter/af_acrusher.c
  5. 16
      libavfilter/af_adeclick.c
  6. 19
      libavfilter/af_adelay.c
  7. 18
      libavfilter/af_adenorm.c
  8. 20
      libavfilter/af_aderivative.c
  9. 19
      libavfilter/af_aecho.c
  10. 19
      libavfilter/af_aemphasis.c
  11. 19
      libavfilter/af_aexciter.c
  12. 19
      libavfilter/af_afade.c
  13. 18
      libavfilter/af_afftdn.c
  14. 19
      libavfilter/af_afftfilt.c
  15. 17
      libavfilter/af_afir.c
  16. 18
      libavfilter/af_afreqshift.c
  17. 18
      libavfilter/af_afwtdn.c
  18. 19
      libavfilter/af_agate.c
  19. 16
      libavfilter/af_aiir.c
  20. 19
      libavfilter/af_alimiter.c
  21. 6
      libavfilter/af_amerge.c
  22. 6
      libavfilter/af_amix.c
  23. 19
      libavfilter/af_amultiply.c
  24. 18
      libavfilter/af_anlmdn.c
  25. 19
      libavfilter/af_anlms.c
  26. 19
      libavfilter/af_aphaser.c
  27. 3
      libavfilter/af_apulsator.c
  28. 18
      libavfilter/af_arnndn.c
  29. 18
      libavfilter/af_asoftclip.c
  30. 2
      libavfilter/af_asr.c
  31. 19
      libavfilter/af_astats.c
  32. 18
      libavfilter/af_asubboost.c
  33. 18
      libavfilter/af_asupercut.c
  34. 23
      libavfilter/af_atempo.c
  35. 19
      libavfilter/af_axcorrelate.c
  36. 25
      libavfilter/af_biquads.c
  37. 11
      libavfilter/af_bs2b.c
  38. 2
      libavfilter/af_channelmap.c
  39. 2
      libavfilter/af_channelsplit.c
  40. 19
      libavfilter/af_chorus.c
  41. 19
      libavfilter/af_compand.c
  42. 19
      libavfilter/af_compensationdelay.c
  43. 2
      libavfilter/af_crossfeed.c
  44. 18
      libavfilter/af_crystalizer.c
  45. 19
      libavfilter/af_dcshift.c
  46. 18
      libavfilter/af_deesser.c
  47. 19
      libavfilter/af_drmeter.c
  48. 19
      libavfilter/af_dynaudnorm.c
  49. 2
      libavfilter/af_earwax.c
  50. 3
      libavfilter/af_extrastereo.c
  51. 19
      libavfilter/af_firequalizer.c
  52. 19
      libavfilter/af_flanger.c
  53. 3
      libavfilter/af_haas.c
  54. 3
      libavfilter/af_hdcd.c
  55. 5
      libavfilter/af_headphone.c
  56. 2
      libavfilter/af_join.c
  57. 22
      libavfilter/af_ladspa.c
  58. 13
      libavfilter/af_loudnorm.c
  59. 16
      libavfilter/af_lv2.c
  60. 19
      libavfilter/af_mcompand.c
  61. 4
      libavfilter/af_pan.c
  62. 19
      libavfilter/af_rubberband.c
  63. 26
      libavfilter/af_sidechaincompress.c
  64. 11
      libavfilter/af_silencedetect.c
  65. 19
      libavfilter/af_silenceremove.c
  66. 11
      libavfilter/af_sofalizer.c
  67. 19
      libavfilter/af_speechnorm.c
  68. 3
      libavfilter/af_stereotools.c
  69. 3
      libavfilter/af_stereowiden.c
  70. 15
      libavfilter/af_superequalizer.c
  71. 5
      libavfilter/af_surround.c
  72. 19
      libavfilter/af_tremolo.c
  73. 19
      libavfilter/af_vibrato.c
  74. 19
      libavfilter/af_volume.c
  75. 14
      libavfilter/af_volumedetect.c
  76. 20
      libavfilter/asrc_afirsrc.c
  77. 20
      libavfilter/asrc_anoisesrc.c
  78. 4
      libavfilter/asrc_anullsrc.c
  79. 20
      libavfilter/asrc_hilbert.c
  80. 19
      libavfilter/asrc_sinc.c
  81. 19
      libavfilter/asrc_sine.c
  82. 4
      libavfilter/avfiltergraph.c
  83. 14
      libavfilter/f_reverse.c
  84. 10
      libavfilter/f_select.c
  85. 10
      libavfilter/f_streamselect.c
  86. 31
      libavfilter/formats.c
  87. 29
      libavfilter/formats.h
  88. 7
      libavfilter/opencl.c
  89. 5
      libavfilter/vf_amplify.c
  90. 5
      libavfilter/vf_atadenoise.c
  91. 2
      libavfilter/vf_avgblur.c
  92. 5
      libavfilter/vf_bbox.c
  93. 2
      libavfilter/vf_bilateral.c
  94. 5
      libavfilter/vf_bitplanenoise.c
  95. 5
      libavfilter/vf_blackdetect.c
  96. 5
      libavfilter/vf_blackframe.c
  97. 5
      libavfilter/vf_blend.c
  98. 5
      libavfilter/vf_bm3d.c
  99. 6
      libavfilter/vf_bwdif.c
  100. 8
      libavfilter/vf_cas.c
  101. Some files were not shown because too many files have changed in this diff Show More

@ -246,28 +246,17 @@ static int query_formats(AVFilterContext *ctx)
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE };
int64_t chlayouts[] = { eval->chlayout ? eval->chlayout : FF_COUNT2LAYOUT(eval->nb_channels) , -1 };
int sample_rates[] = { eval->sample_rate, -1 };
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static int request_frame(AVFilterLink *outlink)
@ -349,7 +338,6 @@ AVFILTER_DEFINE_CLASS(aeval);
static int aeval_query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts;
AVFilterLink *inlink = ctx->inputs[0];
AVFilterLink *outlink = ctx->outputs[0];
@ -365,8 +353,7 @@ static int aeval_query_formats(AVFilterContext *ctx)
return ret;
if (eval->same_chlayout) {
layouts = ff_all_channel_counts();
if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0)
if ((ret = ff_set_common_all_channel_counts(ctx)) < 0)
return ret;
} else {
// outlink supports only requested output channel layout
@ -379,12 +366,10 @@ static int aeval_query_formats(AVFilterContext *ctx)
return ret;
}
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int aeval_config_output(AVFilterLink *outlink)

@ -44,8 +44,6 @@ AVFILTER_DEFINE_CLASS(acontrast);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
@ -53,23 +51,15 @@ static int query_formats(AVFilterContext *ctx)
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void filter_flt(void **d, const void **s,

@ -305,32 +305,21 @@ static void calc_q_factors(int order, double *q)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define BIQUAD_PROCESS(name, type) \

@ -265,32 +265,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

@ -115,31 +115,21 @@ AVFILTER_DEFINE_CLASS(adeclick);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -63,33 +63,20 @@ AVFILTER_DEFINE_CLASS(adelay);
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_U8P, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define DELAY(name, type, fill) \

@ -45,31 +45,19 @@ typedef struct ADenormContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void dc_denorm_fltp(AVFilterContext *ctx, void *dstp,

@ -29,8 +29,6 @@ typedef struct ADerivativeContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat derivative_sample_fmts[] = {
AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP,
@ -40,26 +38,16 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(strcmp(ctx->filter->name, "aintegral") ?
derivative_sample_fmts : integral_sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, strcmp(ctx->filter->name, "aintegral") ?
derivative_sample_fmts : integral_sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define DERIVATIVE(name, type) \

@ -154,33 +154,20 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a))

@ -153,32 +153,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static inline void set_highshelf_rbj(BiquadCoeffs *bq, double freq, double q, double peak, double sr)

@ -220,32 +220,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

@ -59,8 +59,6 @@ enum CurveType { NONE = -1, TRI, QSIN, ESIN, HSIN, LOG, IPAR, QUA, CUB, SQU, CBR
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P,
@ -68,26 +66,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static double fade_gain(int curve, int64_t index, int64_t range)

@ -1349,31 +1349,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,

@ -412,32 +412,19 @@ static int activate(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

@ -715,8 +715,6 @@ static int activate(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AudioFIRContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
@ -729,21 +727,18 @@ static int query_formats(AVFilterContext *ctx)
if (s->response) {
AVFilterLink *videolink = ctx->outputs[1];
formats = ff_make_format_list(pix_fmts);
AVFilterFormats *formats = ff_make_format_list(pix_fmts);
if ((ret = ff_formats_ref(formats, &videolink->incfg.formats)) < 0)
return ret;
}
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
if (s->ir_format) {
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
} else {
AVFilterChannelLayouts *mono = NULL;
AVFilterChannelLayouts *layouts = ff_all_channel_counts();
if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0)
return ret;
@ -759,12 +754,10 @@ static int query_formats(AVFilterContext *ctx)
}
}
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)

@ -49,32 +49,20 @@ typedef struct AFreqShift {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define PFILTER(name, type, sin, cos, cc) \

@ -463,31 +463,19 @@ AVFILTER_DEFINE_CLASS(afwtdn);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define pow2(x) (1U << (x))

@ -189,7 +189,6 @@ AVFILTER_DEFINE_CLASS(agate);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts;
int ret;
if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL)) < 0)
@ -198,18 +197,11 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
@ -346,7 +338,6 @@ static int activate(AVFilterContext *ctx)
static int scquery_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
@ -371,12 +362,10 @@ static int scquery_formats(AVFilterContext *ctx)
return ret;
}
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int scconfig_output(AVFilterLink *outlink)

@ -79,7 +79,6 @@ static int query_formats(AVFilterContext *ctx)
{
AudioIIRContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
@ -98,25 +97,16 @@ static int query_formats(AVFilterContext *ctx)
return ret;
}
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
sample_fmts[0] = s->sample_format;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define IIR_CH(name, type, min, max, need_clipping) \

@ -278,32 +278,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -76,7 +76,6 @@ static int query_formats(AVFilterContext *ctx)
};
AMergeContext *s = ctx->priv;
int64_t inlayout[SWR_CH_MAX], outlayout = 0;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int i, ret, overlap = 0, nb_ch = 0;
@ -129,8 +128,7 @@ static int query_formats(AVFilterContext *ctx)
if ((inlayout[i] >> c) & 1)
*(route[i]++) = out_ch_number++;
}
formats = ff_make_format_list(packed_sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, packed_sample_fmts)) < 0)
return ret;
for (i = 0; i < s->nb_inputs; i++) {
layouts = NULL;
@ -145,7 +143,7 @@ static int query_formats(AVFilterContext *ctx)
if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0)
return ret;
return ff_set_common_samplerates(ctx, ff_all_samplerates());
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)

@ -603,11 +603,11 @@ static int query_formats(AVFilterContext *ctx)
};
int ret;
if ((ret = ff_set_common_formats(ctx, ff_make_format_list(sample_fmts))) < 0 ||
(ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0 ||
(ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
return ff_set_common_channel_layouts(ctx, ff_all_channel_counts());
return ff_set_common_all_channel_counts(ctx);
}
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,

@ -42,33 +42,20 @@ typedef struct AudioMultiplyContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int activate(AVFilterContext *ctx)

@ -95,31 +95,19 @@ AVFILTER_DEFINE_CLASS(anlmdn);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K)

@ -78,32 +78,19 @@ AVFILTER_DEFINE_CLASS(anlms);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static float fir_sample(AudioNLMSContext *s, float sample, float *delay,

@ -85,8 +85,6 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
@ -94,26 +92,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a))

@ -196,8 +196,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -330,33 +330,21 @@ static int rnnoise_model_from_file(FILE *f, RNNModel **rnn)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret, sample_rates[] = { 48000, -1 };
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static int config_input(AVFilterLink *inlink)

@ -84,32 +84,20 @@ AVFILTER_DEFINE_CLASS(asoftclip);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void filter_flt(ASoftClipContext *s,

@ -133,7 +133,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_formats (ctx , formats )) < 0 ||
(ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_MONO )) < 0 ||
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0 ||
(ret = ff_set_common_samplerates (ctx , ff_make_format_list(sample_rates) )) < 0)
(ret = ff_set_common_samplerates_from_list(ctx, sample_rates )) < 0)
return ret;
return 0;

@ -147,8 +147,6 @@ AVFILTER_DEFINE_CLASS(astats);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P,
@ -157,26 +155,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void reset_stats(AudioStatsContext *s)

@ -46,31 +46,19 @@ typedef struct ASubBoostContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int get_coeffs(AVFilterContext *ctx)

@ -51,32 +51,20 @@ typedef struct ASuperCutContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void calc_q_factors(int n, double *q)

@ -995,9 +995,6 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts = NULL;
AVFilterFormats *formats = NULL;
// WSOLA necessitates an internal sliding window ring buffer
// for incoming audio stream.
//
@ -1012,29 +1009,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts) {
return AVERROR(ENOMEM);
}
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats) {
return AVERROR(ENOMEM);
}
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats) {
return AVERROR(ENOMEM);
}
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_props(AVFilterLink *inlink)

@ -48,32 +48,19 @@ typedef struct AudioXCorrelateContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static float mean_sum(const float *in, int size)

@ -146,8 +146,6 @@ typedef struct BiquadsContext {
static int query_formats(AVFilterContext *ctx)
{
BiquadsContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat auto_sample_fmts[] = {
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_S32P,
@ -159,46 +157,33 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
const enum AVSampleFormat *sample_fmts_list = sample_fmts;
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
switch (s->precision) {
case 0:
sample_fmts[0] = AV_SAMPLE_FMT_S16P;
formats = ff_make_format_list(sample_fmts);
break;
case 1:
sample_fmts[0] = AV_SAMPLE_FMT_S32P;
formats = ff_make_format_list(sample_fmts);
break;
case 2:
sample_fmts[0] = AV_SAMPLE_FMT_FLTP;
formats = ff_make_format_list(sample_fmts);
break;
case 3:
sample_fmts[0] = AV_SAMPLE_FMT_DBLP;
formats = ff_make_format_list(sample_fmts);
break;
default:
formats = ff_make_format_list(auto_sample_fmts);
sample_fmts_list = auto_sample_fmts;
break;
}
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts_list);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define BIQUAD_FILTER(name, type, min, max, need_clipping) \

@ -92,7 +92,6 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
@ -111,17 +110,11 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)

@ -284,7 +284,7 @@ static int channelmap_query_formats(AVFilterContext *ctx)
int ret;
if ((ret = ff_set_common_formats (ctx, ff_planar_sample_fmts())) < 0 ||
(ret = ff_set_common_samplerates (ctx , ff_all_samplerates() )) < 0 ||
(ret = ff_set_common_all_samplerates(ctx )) < 0 ||
(ret = ff_add_channel_layout(&channel_layouts, s->output_layout)) < 0 ||
(ret = ff_channel_layouts_ref(channel_layouts,
&ctx->outputs[0]->incfg.channel_layouts)) < 0)

@ -113,7 +113,7 @@ static int query_formats(AVFilterContext *ctx)
int i, ret;
if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 ||
(ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0)
(ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
if ((ret = ff_add_channel_layout(&in_layouts, s->channel_layout)) < 0 ||

@ -156,31 +156,18 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)

@ -102,32 +102,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void count_items(char *item_str, int *nb_items)

@ -65,32 +65,19 @@ AVFILTER_DEFINE_CLASS(compensationdelay);
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -48,7 +48,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_formats (ctx , formats )) < 0 ||
(ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_STEREO)) < 0 ||
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0 ||
(ret = ff_set_common_samplerates (ctx , ff_all_samplerates())) < 0)
(ret = ff_set_common_all_samplerates (ctx )) < 0)
return ret;
return 0;

@ -45,32 +45,20 @@ AVFILTER_DEFINE_CLASS(crystalizer);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
typedef struct ThreadData {

@ -54,31 +54,18 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

@ -70,31 +70,19 @@ AVFILTER_DEFINE_CLASS(deesser);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -55,32 +55,19 @@ AVFILTER_DEFINE_CLASS(drmeter);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)

@ -129,32 +129,19 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static inline int frame_size(int sample_rate, int frame_len_msec)

@ -90,7 +90,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_formats (ctx , formats )) < 0 ||
(ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_STEREO )) < 0 ||
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0 ||
(ret = ff_set_common_samplerates (ctx , ff_make_format_list(sample_rates) )) < 0)
(ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0)
return ret;
return 0;

@ -53,8 +53,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

@ -182,32 +182,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void fast_convolute(FIREqualizerContext *av_restrict s, const float *av_restrict kernel_buf, float *av_restrict conv_buf,

@ -90,31 +90,18 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -91,8 +91,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -1648,8 +1648,7 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
return
ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates) );
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static av_cold void uninit(AVFilterContext *ctx)

@ -624,10 +624,7 @@ static int query_formats(AVFilterContext *ctx)
}
}
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -238,7 +238,7 @@ static int join_query_formats(AVFilterContext *ctx)
}
if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 ||
(ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0)
(ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
return 0;

@ -657,42 +657,28 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
LADSPAContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE };
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
if (s->nb_inputs) {
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_samplerates(ctx, formats);
ret = ff_set_common_all_samplerates(ctx);
if (ret < 0)
return ret;
} else {
int sample_rates[] = { s->sample_rate, -1 };
ret = ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates));
ret = ff_set_common_samplerates_from_list(ctx, sample_rates);
if (ret < 0)
return ret;
}
if (s->nb_inputs == 1 && s->nb_outputs == 1) {
// We will instantiate multiple LADSPA_Handle, one over each channel
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
} else if (s->nb_inputs == 2 && s->nb_outputs == 2) {

@ -685,7 +685,6 @@ static int query_formats(AVFilterContext *ctx)
{
LoudNormContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
AVFilterLink *inlink = ctx->inputs[0];
AVFilterLink *outlink = ctx->outputs[0];
static const int input_srate[] = {192000, -1};
@ -693,19 +692,11 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;

@ -476,32 +476,22 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
LV2Context *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
AVFilterLink *outlink = ctx->outputs[0];
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE };
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
if (s->nb_inputs) {
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_samplerates(ctx, formats);
ret = ff_set_common_all_samplerates(ctx);
if (ret < 0)
return ret;
} else {
int sample_rates[] = { s->sample_rate, -1 };
ret = ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates));
ret = ff_set_common_samplerates_from_list(ctx, sample_rates);
if (ret < 0)
return ret;
}

@ -124,32 +124,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void count_items(char *item_str, int *nb_items, char delimiter)

@ -251,7 +251,6 @@ static int query_formats(AVFilterContext *ctx)
PanContext *pan = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
AVFilterLink *outlink = ctx->outputs[0];
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts;
int ret;
@ -260,8 +259,7 @@ static int query_formats(AVFilterContext *ctx)
if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0)
return ret;
formats = ff_all_samplerates();
if ((ret = ff_set_common_samplerates(ctx, formats)) < 0)
if ((ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
// inlink supports any channel layout

@ -91,32 +91,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE,
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

@ -297,7 +297,6 @@ static int activate(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
@ -322,12 +321,10 @@ static int query_formats(AVFilterContext *ctx)
return ret;
}
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)
@ -433,32 +430,19 @@ static int acompressor_filter_frame(AVFilterLink *inlink, AVFrame *in)
static int acompressor_query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define acompressor_options options

@ -197,7 +197,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
@ -215,17 +214,11 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

@ -889,33 +889,20 @@ static int request_frame(AVFilterLink *outlink)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

@ -648,7 +648,6 @@ static int activate(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
struct SOFAlizerContext *s = ctx->priv;
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
int ret, sample_rates[] = { 48000, -1 };
static const enum AVSampleFormat sample_fmts[] = {
@ -656,10 +655,7 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_NONE
};
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret)
return ret;
@ -681,10 +677,7 @@ static int query_formats(AVFilterContext *ctx)
return ret;
sample_rates[0] = s->sample_rate;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static int getfilter_float(AVFilterContext *ctx, float x, float y, float z,

@ -116,32 +116,19 @@ AVFILTER_DEFINE_CLASS(speechnorm);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int get_pi_samples(PeriodItem *pi, int start, int end, int remain)

@ -111,8 +111,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -64,8 +64,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -272,27 +272,18 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -188,10 +188,7 @@ static int query_formats(AVFilterContext *ctx)
if (ret)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

@ -85,32 +85,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

@ -113,32 +113,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

@ -132,8 +132,6 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
VolumeContext *vol = ctx->priv;
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[][7] = {
[PRECISION_FIXED] = {
AV_SAMPLE_FMT_U8,
@ -155,26 +153,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_NONE
}
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts[vol->precision]);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts[vol->precision]);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static inline void scale_samples_u8(uint8_t *dst, const uint8_t *src,

@ -40,21 +40,11 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE
};
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
if (!(formats = ff_make_format_list(sample_fmts)))
return AVERROR(ENOMEM);
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
return ff_set_common_formats(ctx, formats);
return ff_set_common_formats_from_list(ctx, sample_fmts);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *samples)

@ -134,29 +134,15 @@ static av_cold int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE
};
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static int parse_string(char *str, float **items, int *nb_items, int *items_size)

@ -90,29 +90,15 @@ static av_cold int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static double white_filter(double white, double *buf, double ha)

@ -87,10 +87,10 @@ static int query_formats(AVFilterContext *ctx)
int ret;
if ((ret = ff_set_common_formats (ctx, ff_all_formats (AVMEDIA_TYPE_AUDIO))) < 0 ||
(ret = ff_set_common_samplerates (ctx, ff_make_format_list (sample_rates ))) < 0)
(ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0)
return ret;
return ff_set_common_channel_layouts(ctx, ff_make_format64_list(chlayouts));
return ff_set_common_channel_layouts_from_list(ctx, chlayouts);
}
static av_cold int config_props(AVFilterLink *outlink)

@ -102,29 +102,15 @@ static av_cold int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE
};
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static av_cold int config_props(AVFilterLink *outlink)

@ -74,28 +74,15 @@ static int query_formats(AVFilterContext *ctx)
int sample_rates[] = { s->sample_rate, -1 };
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE };
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static float bessel_I_0(float x)

@ -183,28 +183,15 @@ static av_cold int query_formats(AVFilterContext *ctx)
int sample_rates[] = { sine->sample_rate, -1 };
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE };
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static av_cold int config_props(AVFilterLink *outlink)

@ -362,7 +362,6 @@ static int filter_query_formats(AVFilterContext *ctx)
int ret, i;
AVFilterFormats *formats;
AVFilterChannelLayouts *chlayouts;
AVFilterFormats *samplerates;
enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type :
ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :
AVMEDIA_TYPE_VIDEO;
@ -386,8 +385,7 @@ static int filter_query_formats(AVFilterContext *ctx)
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
return ret;
if (type == AVMEDIA_TYPE_AUDIO) {
samplerates = ff_all_samplerates();
if ((ret = ff_set_common_samplerates(ctx, samplerates)) < 0)
if ((ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
chlayouts = ff_all_channel_layouts();
if ((ret = ff_set_common_channel_layouts(ctx, chlayouts)) < 0)

@ -149,14 +149,7 @@ const AVFilter ff_vf_reverse = {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
@ -164,10 +157,7 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void reverse_samples_planar(AVFrame *out)

@ -497,7 +497,6 @@ static int query_formats(AVFilterContext *ctx)
if (!select->do_scene_detect) {
return ff_default_query_formats(ctx);
} else {
int ret;
static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA,
AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8,
@ -506,15 +505,8 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, fmts_list);
if (ret < 0)
return ret;
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
return 0;
}
DEFINE_OPTIONS(select, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM);

@ -305,8 +305,7 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats, *rates = NULL;
AVFilterChannelLayouts *layouts = NULL;
AVFilterFormats *formats;
int ret, i;
for (i = 0; i < ctx->nb_inputs; i++) {
@ -315,11 +314,8 @@ static int query_formats(AVFilterContext *ctx)
return ret;
if (ctx->inputs[i]->type == AVMEDIA_TYPE_AUDIO) {
rates = ff_all_samplerates();
if ((ret = ff_set_common_samplerates(ctx, rates)) < 0)
return ret;
layouts = ff_all_channel_counts();
if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0)
if ((ret = ff_set_common_all_samplerates (ctx)) < 0 ||
(ret = ff_set_common_all_channel_counts(ctx)) < 0)
return ret;
}
}

@ -566,6 +566,17 @@ int ff_set_common_channel_layouts(AVFilterContext *ctx,
ff_channel_layouts_ref, ff_channel_layouts_unref);
}
int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx,
const int64_t *fmts)
{
return ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts));
}
int ff_set_common_all_channel_counts(AVFilterContext *ctx)
{
return ff_set_common_channel_layouts(ctx, ff_all_channel_counts());
}
int ff_set_common_samplerates(AVFilterContext *ctx,
AVFilterFormats *samplerates)
{
@ -573,6 +584,17 @@ int ff_set_common_samplerates(AVFilterContext *ctx,
ff_formats_ref, ff_formats_unref);
}
int ff_set_common_samplerates_from_list(AVFilterContext *ctx,
const int *samplerates)
{
return ff_set_common_samplerates(ctx, ff_make_format_list(samplerates));
}
int ff_set_common_all_samplerates(AVFilterContext *ctx)
{
return ff_set_common_samplerates(ctx, ff_all_samplerates());
}
/**
* A helper for query_formats() which sets all links to the same list of
* formats. If there are no links hooked to this filter, the list of formats is
@ -584,6 +606,11 @@ int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
ff_formats_ref, ff_formats_unref);
}
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
{
return ff_set_common_formats(ctx, ff_make_format_list(fmts));
}
int ff_default_query_formats(AVFilterContext *ctx)
{
int ret;
@ -595,10 +622,10 @@ int ff_default_query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
if (type == AVMEDIA_TYPE_AUDIO) {
ret = ff_set_common_channel_layouts(ctx, ff_all_channel_counts());
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
ret = ff_set_common_samplerates(ctx, ff_all_samplerates());
ret = ff_set_common_all_samplerates(ctx);
if (ret < 0)
return ret;
}

@ -164,9 +164,32 @@ AVFilterChannelLayouts *ff_make_format64_list(const int64_t *fmts);
av_warn_unused_result
int ff_set_common_channel_layouts(AVFilterContext *ctx,
AVFilterChannelLayouts *layouts);
/**
* Equivalent to ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts))
*/
av_warn_unused_result
int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx,
const int64_t *fmts);
/**
* Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts())
*/
av_warn_unused_result
int ff_set_common_all_channel_counts(AVFilterContext *ctx);
av_warn_unused_result
int ff_set_common_samplerates(AVFilterContext *ctx,
AVFilterFormats *samplerates);
/**
* Equivalent to ff_set_common_samplerates(ctx, ff_make_format_list(samplerates))
*/
av_warn_unused_result
int ff_set_common_samplerates_from_list(AVFilterContext *ctx,
const int *samplerates);
/**
* Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates())
*/
av_warn_unused_result
int ff_set_common_all_samplerates(AVFilterContext *ctx);
/**
* A helper for query_formats() which sets all links to the same list of
@ -176,6 +199,12 @@ int ff_set_common_samplerates(AVFilterContext *ctx,
av_warn_unused_result
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
/**
* Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
*/
av_warn_unused_result
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts);
av_warn_unused_result
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);

@ -31,13 +31,8 @@ int ff_opencl_filter_query_formats(AVFilterContext *avctx)
AV_PIX_FMT_OPENCL,
AV_PIX_FMT_NONE,
};
AVFilterFormats *formats;
formats = ff_make_format_list(pix_fmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(avctx, formats);
return ff_set_common_formats_from_list(avctx, pix_fmts);
}
static int opencl_filter_set_device(AVFilterContext *avctx,

@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
AV_PIX_FMT_NONE
};
AVFilterFormats *formats = ff_make_format_list(pixel_fmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, formats);
return ff_set_common_formats_from_list(ctx, pixel_fmts);
}
static av_cold int init(AVFilterContext *ctx)

@ -120,10 +120,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
AV_PIX_FMT_NONE
};
AVFilterFormats *formats = ff_make_format_list(pixel_fmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, formats);
return ff_set_common_formats_from_list(ctx, pixel_fmts);
}
static av_cold int init(AVFilterContext *ctx)

@ -246,7 +246,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

@ -72,10 +72,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE,
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
#define SET_META(key, value) \

@ -89,7 +89,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int config_params(AVFilterContext *ctx)

@ -67,10 +67,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *formats = ff_make_format_list(pixfmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, formats);
return ff_set_common_formats_from_list(ctx, pixfmts);
}
static int config_input(AVFilterLink *inlink)

@ -98,10 +98,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int config_input(AVFilterLink *inlink)

@ -54,10 +54,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
#define SET_META(key, format, value) \

@ -680,10 +680,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static av_cold void uninit(AVFilterContext *ctx)

@ -188,10 +188,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int do_search_boundary(int pos, int plane_boundary, int search_range, int search_step)

@ -321,11 +321,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int config_props(AVFilterLink *link)

@ -230,13 +230,7 @@ static av_cold int query_formats(AVFilterContext *avctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *formats = NULL;
formats = ff_make_format_list(pixel_fmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(avctx, formats);
return ff_set_common_formats_from_list(avctx, pixel_fmts);
}
static av_cold int config_input(AVFilterLink *inlink)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save