static int asink_query_formats(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; if (buf->sample_fmts) { if (!(formats = ff_make_format_list(buf->sample_fmts))) return AVERROR(ENOMEM); ff_set_common_formats(ctx, formats); } if (buf->channel_layouts || buf->all_channel_counts) { layouts = buf->all_channel_counts ? ff_all_channel_counts() : avfilter_make_format64_list(buf->channel_layouts); if (!layouts) return AVERROR(ENOMEM); ff_set_common_channel_layouts(ctx, layouts); } if (buf->sample_rates) { formats = ff_make_format_list(buf->sample_rates); if (!formats) return AVERROR(ENOMEM); ff_set_common_samplerates(ctx, formats); } return 0; }
static int query_formats(AVFilterContext *ctx) { AVFilterFormats *formats; AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; int ret, i; if (!ctx->inputs[0]->in_channel_layouts || !ctx->inputs[0]->in_channel_layouts->nb_channel_layouts) { av_log(ctx, AV_LOG_WARNING, "No channel layout for input 1\n"); return AVERROR(EAGAIN); } if ((ret = ff_add_channel_layout(&layouts, ctx->inputs[0]->in_channel_layouts->channel_layouts[0])) < 0 || (ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->in_channel_layouts)) < 0) return ret; for (i = 0; i < 2; i++) { layouts = ff_all_channel_counts(); if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[i]->out_channel_layouts)) < 0) return ret; } formats = ff_make_format_list(sample_fmts); if ((ret = ff_set_common_formats(ctx, formats)) < 0) return ret; formats = ff_all_samplerates(); return ff_set_common_samplerates(ctx, formats); }
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); if (ret < 0) return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); ret = ff_set_common_formats(ctx, formats); if (ret < 0) return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); return ff_set_common_samplerates(ctx, formats); }
static int query_formats(AVFilterContext *ctx) { AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts; int ret; layouts = ff_all_channel_counts(); if (!layouts) { ret = AVERROR(ENOMEM); goto fail; } if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLT )) < 0 || (ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLTP)) < 0 || (ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL )) < 0 || (ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBLP)) < 0 || (ret = ff_set_common_formats (ctx, formats)) < 0 || (ret = ff_set_common_channel_layouts(ctx, layouts)) < 0 || (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0) goto fail; return 0; fail: if (layouts) av_freep(&layouts->channel_layouts); av_freep(&layouts); return ret; }
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 }; static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGB0, AV_PIX_FMT_NONE }; int ret; if (s->response) { AVFilterLink *videolink = ctx->outputs[1]; formats = ff_make_format_list(pix_fmts); if ((ret = ff_formats_ref(formats, &videolink->in_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); if (ret < 0) return ret; } else { AVFilterChannelLayouts *mono = NULL; ret = ff_add_channel_layout(&mono, AV_CH_LAYOUT_MONO); if (ret) return ret; if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->out_channel_layouts)) < 0) return ret; if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->in_channel_layouts)) < 0) return ret; if ((ret = ff_channel_layouts_ref(mono, &ctx->inputs[1]->out_channel_layouts)) < 0) return ret; } formats = ff_make_format_list(sample_fmts); if ((ret = ff_set_common_formats(ctx, formats)) < 0) return ret; formats = ff_all_samplerates(); return ff_set_common_samplerates(ctx, formats); }
static int query_formats(AVFilterContext *ctx) { AFormatContext *s = ctx->priv; ff_set_common_formats(ctx, s->formats ? s->formats : ff_all_formats(AVMEDIA_TYPE_AUDIO)); ff_set_common_samplerates(ctx, s->sample_rates ? s->sample_rates : ff_all_samplerates()); ff_set_common_channel_layouts(ctx, s->channel_layouts ? s->channel_layouts : ff_all_channel_counts()); return 0; }
static int query_formats(AVFilterContext *ctx) { AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; int ret; if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_FLT )) < 0 || (ret = ff_set_common_formats(ctx , formats )) < 0) return ret; layouts = ff_all_channel_counts(); if (!layouts) return AVERROR(ENOMEM); ret = ff_set_common_channel_layouts(ctx, layouts); if (ret < 0) return ret; formats = ff_all_samplerates(); return ff_set_common_samplerates(ctx, formats); }
static int query_formats(AVFilterContext *ctx) { AVFilterFormats *formats, *rates = NULL; AVFilterChannelLayouts *layouts = NULL; int ret, i; for (i = 0; i < ctx->nb_inputs; i++) { formats = ff_all_formats(ctx->inputs[i]->type); if ((ret = ff_set_common_formats(ctx, formats)) < 0) 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) return ret; } } return 0; }
static int query_formats(AVFilterContext *ctx) { AResampleContext *aresample = ctx->priv; int out_rate = av_get_int(aresample->swr, "osr", NULL); uint64_t out_layout = av_get_int(aresample->swr, "ocl", NULL); enum AVSampleFormat out_format = av_get_int(aresample->swr, "osf", NULL); AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; AVFilterFormats *in_formats = ff_all_formats(AVMEDIA_TYPE_AUDIO); AVFilterFormats *out_formats; AVFilterFormats *in_samplerates = ff_all_samplerates(); AVFilterFormats *out_samplerates; AVFilterChannelLayouts *in_layouts = ff_all_channel_counts(); AVFilterChannelLayouts *out_layouts; ff_formats_ref (in_formats, &inlink->out_formats); ff_formats_ref (in_samplerates, &inlink->out_samplerates); ff_channel_layouts_ref(in_layouts, &inlink->out_channel_layouts); if(out_rate > 0) { out_samplerates = ff_make_format_list((int[]){ out_rate, -1 });
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE }, [PRECISION_FLOAT] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, [PRECISION_DOUBLE] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE } }; layouts = ff_all_channel_counts(); if (!layouts) return AVERROR(ENOMEM); ff_set_common_channel_layouts(ctx, layouts); formats = ff_make_format_list(sample_fmts[vol->precision]); if (!formats) return AVERROR(ENOMEM); ff_set_common_formats(ctx, formats); formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); ff_set_common_samplerates(ctx, formats); return 0;
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 }; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); ff_set_common_formats(ctx, formats); if (s->nb_inputs) { formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); ff_set_common_samplerates(ctx, formats); } else { int sample_rates[] = { s->sample_rate, -1 }; ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates)); } 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); ff_set_common_channel_layouts(ctx, layouts); } else if (s->nb_inputs == 2 && s->nb_outputs == 2) { layouts = NULL; ff_add_channel_layout(&layouts, AV_CH_LAYOUT_STEREO); ff_set_common_channel_layouts(ctx, layouts); } else { AVFilterLink *outlink = ctx->outputs[0]; if (s->nb_inputs >= 1) { AVFilterLink *inlink = ctx->inputs[0]; int64_t inlayout = FF_COUNT2LAYOUT(s->nb_inputs); layouts = NULL; ff_add_channel_layout(&layouts, inlayout); ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts); if (!s->nb_outputs) ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts); } if (s->nb_outputs >= 1) { int64_t outlayout = FF_COUNT2LAYOUT(s->nb_outputs); layouts = NULL; ff_add_channel_layout(&layouts, outlayout); ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts); } } return 0; }