From 1012155722fc6ad1c232deaf99192d54bce6a106 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 9 Apr 2013 22:09:20 +0200 Subject: [PATCH 1/2] vf_split: fix description It now allows an arbitrary number of inputs, not just two. --- libavfilter/split.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/split.c b/libavfilter/split.c index 8c03de5b17..16d0bb3862 100644 --- a/libavfilter/split.c +++ b/libavfilter/split.c @@ -119,7 +119,7 @@ static const AVFilterPad avfilter_vf_split_inputs[] = { AVFilter avfilter_vf_split = { .name = "split", - .description = NULL_IF_CONFIG_SMALL("Pass on the input to two outputs."), + .description = NULL_IF_CONFIG_SMALL("Pass on the input to N video outputs."), .priv_size = sizeof(SplitContext), .priv_class = &split_class, From 949c603ed9210df0e1b8e1aa82c71b93543d8071 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 10 Apr 2013 12:28:51 +0200 Subject: [PATCH 2/2] af_channelmap: remove now unnecessary goto Options are freed from the generic code now, there is no need to call av_opt_free() from the filter. --- libavfilter/af_channelmap.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index 9e1fa76fa4..2aac5381a6 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -122,7 +122,6 @@ static int get_channel(char **map, uint64_t *ch, char delim) static av_cold int channelmap_init(AVFilterContext *ctx) { ChannelMapContext *s = ctx->priv; - int ret = 0; char *mapping, separator = '|'; int map_entries = 0; char buf[256]; @@ -172,8 +171,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) if (map_entries > MAX_CH) { av_log(ctx, AV_LOG_ERROR, "Too many channels mapped: '%d'.\n", map_entries); - ret = AVERROR(EINVAL); - goto fail; + return AVERROR(EINVAL); } for (i = 0; i < map_entries; i++) { @@ -183,9 +181,8 @@ static av_cold int channelmap_init(AVFilterContext *ctx) switch (mode) { case MAP_ONE_INT: if (get_channel_idx(&mapping, &in_ch_idx, separator, MAX_CH) < 0) { - ret = AVERROR(EINVAL); av_log(ctx, AV_LOG_ERROR, err); - goto fail; + return AVERROR(EINVAL); } s->map[i].in_channel_idx = in_ch_idx; s->map[i].out_channel_idx = i; @@ -193,8 +190,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) case MAP_ONE_STR: if (!get_channel(&mapping, &in_ch, separator)) { av_log(ctx, AV_LOG_ERROR, err); - ret = AVERROR(EINVAL); - goto fail; + return AVERROR(EINVAL); } s->map[i].in_channel = in_ch; s->map[i].out_channel_idx = i; @@ -203,8 +199,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) if (get_channel_idx(&mapping, &in_ch_idx, '-', MAX_CH) < 0 || get_channel_idx(&mapping, &out_ch_idx, separator, MAX_CH) < 0) { av_log(ctx, AV_LOG_ERROR, err); - ret = AVERROR(EINVAL); - goto fail; + return AVERROR(EINVAL); } s->map[i].in_channel_idx = in_ch_idx; s->map[i].out_channel_idx = out_ch_idx; @@ -214,8 +209,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) get_channel(&mapping, &out_ch, separator) < 0 || out_ch & out_ch_mask) { av_log(ctx, AV_LOG_ERROR, err); - ret = AVERROR(EINVAL); - goto fail; + return AVERROR(EINVAL); } s->map[i].in_channel_idx = in_ch_idx; s->map[i].out_channel = out_ch; @@ -225,8 +219,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) if (get_channel(&mapping, &in_ch, '-') < 0 || get_channel_idx(&mapping, &out_ch_idx, separator, MAX_CH) < 0) { av_log(ctx, AV_LOG_ERROR, err); - ret = AVERROR(EINVAL); - goto fail; + return AVERROR(EINVAL); } s->map[i].in_channel = in_ch; s->map[i].out_channel_idx = out_ch_idx; @@ -236,8 +229,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) get_channel(&mapping, &out_ch, separator) < 0 || out_ch & out_ch_mask) { av_log(ctx, AV_LOG_ERROR, err); - ret = AVERROR(EINVAL); - goto fail; + return AVERROR(EINVAL); } s->map[i].in_channel = in_ch; s->map[i].out_channel = out_ch; @@ -255,8 +247,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) if ((fmt = av_get_channel_layout(s->channel_layout_str)) == 0) { av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout: '%s'.\n", s->channel_layout_str); - ret = AVERROR(EINVAL); - goto fail; + return AVERROR(EINVAL); } if (mode == MAP_NONE) { int i; @@ -270,14 +261,12 @@ static av_cold int channelmap_init(AVFilterContext *ctx) av_log(ctx, AV_LOG_ERROR, "Output channel layout '%s' does not match the list of channel mapped: '%s'.\n", s->channel_layout_str, buf); - ret = AVERROR(EINVAL); - goto fail; + return AVERROR(EINVAL); } else if (s->nch != av_get_channel_layout_nb_channels(fmt)) { av_log(ctx, AV_LOG_ERROR, "Output channel layout %s does not match the number of channels mapped %d.\n", s->channel_layout_str, s->nch); - ret = AVERROR(EINVAL); - goto fail; + return AVERROR(EINVAL); } s->output_layout = fmt; } @@ -290,9 +279,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) } } -fail: - av_opt_free(s); - return ret; + return 0; } static int channelmap_query_formats(AVFilterContext *ctx)