[FFmpeg-devel] [PATCH] avfilter/trim: support all channel numbers in atrim filter
Clément Bœsch
u at pkh.me
Wed Dec 30 09:52:14 CET 2015
On Wed, Dec 30, 2015 at 09:17:56AM +0100, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> libavfilter/trim.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/libavfilter/trim.c b/libavfilter/trim.c
> index b2d9c6f..9d040dd 100644
> --- a/libavfilter/trim.c
> +++ b/libavfilter/trim.c
> @@ -345,6 +345,32 @@ drop:
> return 0;
> }
>
> +static int atrim_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);
> + if (ret < 0)
> + return ret;
> +
> + formats = ff_all_formats(AVMEDIA_TYPE_AUDIO);
> + 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);
> +}
> +
> #define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
> static const AVOption atrim_options[] = {
> COMMON_OPTS
> @@ -381,6 +407,7 @@ AVFilter ff_af_atrim = {
> .name = "atrim",
> .description = NULL_IF_CONFIG_SMALL("Pick one continuous section from the input, drop the rest."),
> .init = init,
> + .query_formats = atrim_query_formats,
> .priv_size = sizeof(TrimContext),
> .priv_class = &atrim_class,
> .inputs = atrim_inputs,
Mmmh... It seems we have ff_query_formats_all(); can you use that?
Q: why is it not the default?
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151230/9cb415ae/attachment.sig>
More information about the ffmpeg-devel
mailing list