OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/mp4/aac.h" | 5 #include "media/mp4/aac.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "media/base/bit_reader.h" | 10 #include "media/base/bit_reader.h" |
11 #include "media/mp4/rcheck.h" | 11 #include "media/mp4/rcheck.h" |
12 | 12 |
13 // The following conversion table is extracted from ISO 14496 Part 3 - | 13 // The following conversion table is extracted from ISO 14496 Part 3 - |
14 // Table 1.16 - Sampling Frequency Index. | 14 // Table 1.16 - Sampling Frequency Index. |
15 static const int kFrequencyMap[] = { | 15 static const int kFrequencyMap[] = { |
16 96000, 88200, 64000, 48000, 44100, 32000, 24000, | 16 96000, 88200, 64000, 48000, 44100, 32000, 24000, |
17 22050, 16000, 12000, 11025, 8000, 7350 | 17 22050, 16000, 12000, 11025, 8000, 7350 |
18 }; | 18 }; |
19 | 19 |
| 20 namespace media { |
| 21 |
20 static ChannelLayout GetChannelLayout(uint8 channel_config) { | 22 static ChannelLayout GetChannelLayout(uint8 channel_config) { |
21 switch (channel_config) { | 23 switch (channel_config) { |
22 case 1: | 24 case 1: |
23 return CHANNEL_LAYOUT_MONO; | 25 return CHANNEL_LAYOUT_MONO; |
24 case 2: | 26 case 2: |
25 return CHANNEL_LAYOUT_STEREO; | 27 return CHANNEL_LAYOUT_STEREO; |
26 case 3: | 28 case 3: |
27 return CHANNEL_LAYOUT_SURROUND; | 29 return CHANNEL_LAYOUT_SURROUND; |
28 case 4: | 30 case 4: |
29 return CHANNEL_LAYOUT_4_0; | 31 return CHANNEL_LAYOUT_4_0; |
30 case 5: | 32 case 5: |
31 return CHANNEL_LAYOUT_5_0; | 33 return CHANNEL_LAYOUT_5_0; |
32 case 6: | 34 case 6: |
33 return CHANNEL_LAYOUT_5_1; | 35 return CHANNEL_LAYOUT_5_1; |
34 case 8: | 36 case 8: |
35 return CHANNEL_LAYOUT_7_1; | 37 return CHANNEL_LAYOUT_7_1; |
36 default: | 38 default: |
37 break; | 39 break; |
38 } | 40 } |
39 | 41 |
40 return CHANNEL_LAYOUT_UNSUPPORTED; | 42 return CHANNEL_LAYOUT_UNSUPPORTED; |
41 } | 43 } |
42 | 44 |
43 namespace media { | |
44 | |
45 namespace mp4 { | 45 namespace mp4 { |
46 | 46 |
47 AAC::AAC() | 47 AAC::AAC() |
48 : profile_(0), frequency_index_(0), channel_config_(0), frequency_(0), | 48 : profile_(0), frequency_index_(0), channel_config_(0), frequency_(0), |
49 extension_frequency_(0), channel_layout_(CHANNEL_LAYOUT_UNSUPPORTED) { | 49 extension_frequency_(0), channel_layout_(CHANNEL_LAYOUT_UNSUPPORTED) { |
50 } | 50 } |
51 | 51 |
52 AAC::~AAC() { | 52 AAC::~AAC() { |
53 } | 53 } |
54 | 54 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 RCHECK(bit_reader->ReadBits(1, &dummy)); // extensionFlag3 | 255 RCHECK(bit_reader->ReadBits(1, &dummy)); // extensionFlag3 |
256 } | 256 } |
257 | 257 |
258 return true; | 258 return true; |
259 } | 259 } |
260 | 260 |
261 } // namespace mp4 | 261 } // namespace mp4 |
262 | 262 |
263 } // namespace media | 263 } // namespace media |
OLD | NEW |