pan: use ff_parse_channel_layout() instead of av_get_channel_layout().
This allow specifying hexadecimal channel layout, and also handle the error printing internally.
This commit is contained in:
parent
7c2bb79f3b
commit
48f30595f5
@ -34,6 +34,7 @@
|
|||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
#include "formats.h"
|
#include "formats.h"
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
#define MAX_CHANNELS 63
|
#define MAX_CHANNELS 63
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args0, void *opaque)
|
|||||||
{
|
{
|
||||||
PanContext *const pan = ctx->priv;
|
PanContext *const pan = ctx->priv;
|
||||||
char *arg, *arg0, *tokenizer, *args = av_strdup(args0);
|
char *arg, *arg0, *tokenizer, *args = av_strdup(args0);
|
||||||
int out_ch_id, in_ch_id, len, named;
|
int out_ch_id, in_ch_id, len, named, ret;
|
||||||
int nb_in_channels[2] = { 0, 0 }; // number of unnamed and named input channels
|
int nb_in_channels[2] = { 0, 0 }; // number of unnamed and named input channels
|
||||||
double gain;
|
double gain;
|
||||||
|
|
||||||
@ -111,11 +112,9 @@ static av_cold int init(AVFilterContext *ctx, const char *args0, void *opaque)
|
|||||||
if (!args)
|
if (!args)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
arg = av_strtok(args, ":", &tokenizer);
|
arg = av_strtok(args, ":", &tokenizer);
|
||||||
pan->out_channel_layout = av_get_channel_layout(arg);
|
ret = ff_parse_channel_layout(&pan->out_channel_layout, arg, ctx);
|
||||||
if (!pan->out_channel_layout) {
|
if (ret < 0)
|
||||||
av_log(ctx, AV_LOG_ERROR, "Unknown channel layout \"%s\"\n", arg);
|
return ret;
|
||||||
return AVERROR(EINVAL);
|
|
||||||
}
|
|
||||||
pan->nb_output_channels = av_get_channel_layout_nb_channels(pan->out_channel_layout);
|
pan->nb_output_channels = av_get_channel_layout_nb_channels(pan->out_channel_layout);
|
||||||
|
|
||||||
/* parse channel specifications */
|
/* parse channel specifications */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user