1 // Copyright 2018 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_BASE_BITSTREAM_AUDIO_CODECS_H_
6 #define CHROMECAST_BASE_BITSTREAM_AUDIO_CODECS_H_
7 
8 #include <string>
9 
10 namespace chromecast {
11 
12 constexpr int kBitstreamAudioCodecNone = 0b000000;
13 constexpr int kBitstreamAudioCodecAc3 = 0b000001;
14 constexpr int kBitstreamAudioCodecDts = 0b000010;
15 constexpr int kBitstreamAudioCodecDtsHd = 0b000100;
16 constexpr int kBitstreamAudioCodecEac3 = 0b001000;
17 constexpr int kBitstreamAudioCodecPcmSurround = 0b010000;
18 constexpr int kBitstreamAudioCodecMpegHAudio = 0b100000;
19 constexpr int kBitstreamAudioCodecAll = 0b111111;
20 
21 // Supported bitstream audio codecs and their associated properties.
22 struct BitstreamAudioCodecsInfo {
23   // Bitmap of supported bitstream audio codecs.
24   int codecs = kBitstreamAudioCodecNone;
25 
26   // Bitmap specifying which of the corresponding codecs in |codecs| support
27   // spatial rendering.
28   int spatial_rendering = kBitstreamAudioCodecNone;
29 
30   BitstreamAudioCodecsInfo operator&(
31       const BitstreamAudioCodecsInfo& other) const;
32 
33   bool operator==(const BitstreamAudioCodecsInfo& other) const;
34   bool operator!=(const BitstreamAudioCodecsInfo& other) const;
35 
36   BitstreamAudioCodecsInfo ApplyCodecMask(int mask) const;
37 };
38 
39 std::string BitstreamAudioCodecsToString(int codecs);
40 std::string BitstreamAudioCodecsInfoToString(
41     const BitstreamAudioCodecsInfo& info);
42 
43 }  // namespace chromecast
44 
45 #endif  // CHROMECAST_BASE_BITSTREAM_AUDIO_CODECS_H_
46