[FFmpeg-devel] [PATCH] avfilter/split: support any channel count for asplit filter
Nicolas George
george at nsup.org
Fri Feb 5 13:09:28 CET 2016
Le septidi 17 pluviôse, an CCXXIV, Paul B Mahol a écrit :
> From eab0be0e21fe312bf40c6330e493d2d0e9fdff2b Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda at gmail.com>
> Date: Fri, 5 Feb 2016 09:11:55 +0100
> Subject: [PATCH] avfilter/split: support any channel count for asplit filter
>
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> libavfilter/split.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/libavfilter/split.c b/libavfilter/split.c
> index 1e4fb42..0d0a96b 100644
> --- a/libavfilter/split.c
> +++ b/libavfilter/split.c
> @@ -32,6 +32,7 @@
>
> #include "avfilter.h"
> #include "audio.h"
> +#include "formats.h"
> #include "internal.h"
> #include "video.h"
>
> @@ -93,6 +94,32 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> return ret;
> }
>
> +static int asplit_query_formats(AVFilterContext *ctx)
> +{
> + AVFilterChannelLayouts *in_layouts = NULL;
> + int i, ret;
> +
> + if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0 ||
> + (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0)
> + return ret;
> +
> + ret = AVERROR(ENOMEM);
> + if ((in_layouts = ff_all_channel_counts()) == NULL ||
> + (ret = ff_channel_layouts_ref(in_layouts, &ctx->inputs[0]->out_channel_layouts)) < 0)
> + return ret;
> +
> + for (i = 0; i < ctx->nb_outputs; i++) {
> + AVFilterChannelLayouts *out_layouts = NULL;
> +
> + ret = AVERROR(ENOMEM);
> + if ((out_layouts = ff_all_channel_counts()) == NULL ||
> + (ret = ff_channel_layouts_ref(out_layouts, &ctx->outputs[i]->in_channel_layouts)) < 0)
> + return ret;
> + }
This look strange. Why do you set a different channel layout on input and
all outputs? The way asplit works, the layout need to be the same on input
and all outputs, since it's the same frames. Or did I miss something?
> +
> + return 0;
> +}
> +
> #define OFFSET(x) offsetof(SplitContext, x)
> #define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_VIDEO_PARAM
> static const AVOption options[] = {
> @@ -143,6 +170,7 @@ AVFilter ff_af_asplit = {
> .priv_class = &asplit_class,
> .init = split_init,
> .uninit = split_uninit,
> + .query_formats = asplit_query_formats,
> .inputs = avfilter_af_asplit_inputs,
> .outputs = NULL,
> .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160205/8aaf823b/attachment.sig>
More information about the ffmpeg-devel
mailing list