1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_MIXER_CHANNEL_LAYOUT_H_
6 #define CHROMECAST_MEDIA_CMA_BACKEND_MIXER_CHANNEL_LAYOUT_H_
7 
8 #include "media/base/audio_parameters.h"
9 #include "media/base/channel_layout.h"
10 
11 namespace chromecast {
12 namespace media {
13 namespace mixer {
14 
15 // Guesses the channel layout based on the number of channels; supports using
16 // CHANNEL_LAYOUT_DISCRETE is there are more than 8 channels.
17 ::media::ChannelLayout GuessChannelLayout(int num_channels);
18 
19 // Creates an AudioParameters with correct support for CHANNEL_LAYOUT_DISCRETE.
20 ::media::AudioParameters CreateAudioParameters(
21     ::media::AudioParameters::Format format,
22     ::media::ChannelLayout channel_layout,
23     int num_channels,
24     int sample_rate,
25     int frames_per_buffer);
26 
27 // Creates AudioParameters for constructing a ChannelMixer.
28 ::media::AudioParameters CreateAudioParametersForChannelMixer(
29     ::media::ChannelLayout channel_layout,
30     int num_channels);
31 
32 }  // namespace mixer
33 }  // namespace media
34 }  // namespace chromecast
35 
36 #endif  // CHROMECAST_MEDIA_CMA_BACKEND_MIXER_CHANNEL_LAYOUT_H_
37