diff options
Diffstat (limited to 'cras/src/server/cras_fmt_conv.c')
-rw-r--r-- | cras/src/server/cras_fmt_conv.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cras/src/server/cras_fmt_conv.c b/cras/src/server/cras_fmt_conv.c index 509db1eb..842529b9 100644 --- a/cras/src/server/cras_fmt_conv.c +++ b/cras/src/server/cras_fmt_conv.c @@ -216,6 +216,19 @@ static size_t stereo_to_51(struct cras_fmt_conv *conv, const uint8_t *in, return s16_stereo_to_51(left, right, center, in, in_frames, out); } +static size_t quad_to_51(struct cras_fmt_conv *conv, const uint8_t *in, + size_t in_frames, uint8_t *out) +{ + size_t fl, fr, rl, rr; + + fl = conv->out_fmt.channel_layout[CRAS_CH_FL]; + fr = conv->out_fmt.channel_layout[CRAS_CH_FR]; + rl = conv->out_fmt.channel_layout[CRAS_CH_RL]; + rr = conv->out_fmt.channel_layout[CRAS_CH_RR]; + + return s16_quad_to_51(fl, fr, rl, rr, in, in_frames, out); +} + static size_t _51_to_stereo(struct cras_fmt_conv *conv, const uint8_t *in, size_t in_frames, uint8_t *out) { @@ -398,6 +411,8 @@ struct cras_fmt_conv *cras_fmt_conv_create(const struct cras_audio_format *in, conv->channel_converter = quad_to_stereo; } else if (in->num_channels == 2 && out->num_channels == 6) { conv->channel_converter = stereo_to_51; + } else if (in->num_channels == 4 && out->num_channels == 6) { + conv->channel_converter = quad_to_51; } else if (in->num_channels == 6 && (out->num_channels == 2 || out->num_channels == 4)) { int in_channel_layout_set = 0; |