On Sun,  8 Apr 2012 19:05:40 -0400, Justin Ruggles <[email protected]> 
wrote:
> This allows the user to use channel layout names instead of having to use the
> channel mask values.
> ---
> Update patch also sets the 'ac' option based on the channel layout. 
> Otherwise the user would have to set both or there would be a mismatch 
> in channel count vs. channel layout. This way it is done automatically.
> 
>  avconv.c |   21 +++++++++++++++++++++
>  1 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/avconv.c b/avconv.c
> index 95dc8d8..1c0cc84 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -4376,6 +4376,26 @@ static void parse_cpuflags(int argc, char **argv, 
> const OptionDef *options)
>          opt_cpuflags("cpuflags", argv[idx + 1]);
>  }
>  
> +static int opt_channel_layout(OptionsContext *o, const char *opt, const char 
> *arg)
> +{
> +    char layout_str[32];
> +    int channels;
> +    uint64_t layout = av_get_channel_layout(arg);
> +    if (!layout) {
> +        av_log(NULL, AV_LOG_ERROR, "Unknown channel layout: %s\n", arg);
> +        return AVERROR(EINVAL);
> +    }
> +    snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout);
> +    opt_default("channel_layout", layout_str);

This discards stream specifiers. Just reuse opt here.

> +
> +    /* set 'ac' option based on channel layout */
> +    channels = av_get_channel_layout_nb_channels(layout);
> +    snprintf(layout_str, sizeof(layout_str), "%d", channels);
> +    parse_option(o, "ac", layout_str, options);

Same here, except it's more work to handle.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to