1 /*
2  * This file is part of Wireless Display Software for Linux OS
3  *
4  * Copyright (C) 2015 Intel Corporation.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef LIBWDS_PUBLIC_AUDIO_CODEC_H_
23 #define LIBWDS_PUBLIC_AUDIO_CODEC_H_
24 
25 #include <bitset>
26 
27 namespace wds {
28 
29 enum AudioFormats {
30   LPCM,
31   AAC,
32   AC3
33 };
34 
35 enum LPCMModes {
36   LPCM_44_1K_16B_2CH,
37   LPCM_48K_16B_2CH
38 };
39 
40 enum AACModes {
41   AAC_48K_16B_2CH,
42   AAC_48K_16B_4CH,
43   AAC_48K_16B_6CH,
44   AAC_48K_16B_8CH
45 };
46 
47 enum AC3Modes {
48   AC3_48K_16B_2CH,
49   AC3_48K_16B_4CH,
50   AC3_48K_16B_6CH
51 };
52 
53 using AudioModes = std::bitset<32>;
54 
55 /**
56  * @brief The AudioCodec struct
57  *
58  * Repersents a <audio-format, modes, latency> tuple used in 'wfd-audio-codecs'.
59  */
60 struct AudioCodec {
AudioCodecAudioCodec61   AudioCodec()
62   : format(LPCM), modes(AudioModes().set(LPCM_48K_16B_2CH)), latency(0) {}
AudioCodecAudioCodec63   AudioCodec(AudioFormats format, const AudioModes& modes, unsigned latency)
64   : format(format), modes(modes), latency(latency) {}
65 
66   AudioFormats format;
67   AudioModes modes;
68   unsigned latency;
69 };
70 
71 }  // namespace wds
72 
73 #endif  // LIBWDS_PUBLIC_AUDIO_CODEC_H_
74