mirror of https://git.ffmpeg.org/ffmpeg.git
avfilter/af_sofalizer: fix getting speaker position
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
f0be7c1057
commit
55740299ef
|
@ -252,7 +252,7 @@ static int get_speaker_pos(AVFilterContext *ctx,
|
||||||
AVChannelLayout *channel_layout = &ctx->inputs[0]->ch_layout;
|
AVChannelLayout *channel_layout = &ctx->inputs[0]->ch_layout;
|
||||||
float azim[64] = { 0 };
|
float azim[64] = { 0 };
|
||||||
float elev[64] = { 0 };
|
float elev[64] = { 0 };
|
||||||
int m, ch, n_conv = ctx->inputs[0]->ch_layout.nb_channels; /* get no. input channels */
|
int ch, n_conv = ctx->inputs[0]->ch_layout.nb_channels; /* get no. input channels */
|
||||||
|
|
||||||
if (n_conv < 0 || n_conv > 64)
|
if (n_conv < 0 || n_conv > 64)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
@ -263,8 +263,8 @@ static int get_speaker_pos(AVFilterContext *ctx,
|
||||||
parse_speaker_pos(ctx);
|
parse_speaker_pos(ctx);
|
||||||
|
|
||||||
/* set speaker positions according to input channel configuration: */
|
/* set speaker positions according to input channel configuration: */
|
||||||
for (m = 0, ch = 0; ch < n_conv && m < 64; m++) {
|
for (ch = 0; ch < n_conv; ch++) {
|
||||||
int chan = av_channel_layout_channel_from_index(channel_layout, m);
|
int chan = av_channel_layout_channel_from_index(channel_layout, ch);
|
||||||
|
|
||||||
switch (chan) {
|
switch (chan) {
|
||||||
case AV_CHAN_FRONT_LEFT: azim[ch] = 30; break;
|
case AV_CHAN_FRONT_LEFT: azim[ch] = 30; break;
|
||||||
|
@ -303,9 +303,9 @@ static int get_speaker_pos(AVFilterContext *ctx,
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->vspkrpos[m].set) {
|
if (s->vspkrpos[ch].set) {
|
||||||
azim[ch] = s->vspkrpos[m].azim;
|
azim[ch] = s->vspkrpos[ch].azim;
|
||||||
elev[ch] = s->vspkrpos[m].elev;
|
elev[ch] = s->vspkrpos[ch].elev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue