OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_MP4_AAC_H_ |
| 6 #define MEDIA_MP4_AAC_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "media/base/channel_layout.h" |
| 12 #include "media/base/media_export.h" |
| 13 |
| 14 namespace media { |
| 15 |
| 16 class BitReader; |
| 17 |
| 18 namespace mp4 { |
| 19 |
| 20 // This class parses the AAC information from decoder specific information |
| 21 // embedded in the esds box in an ISO BMFF file. |
| 22 // Please refer to ISO 14496 Part 3 Table 1.13 - Syntax of AudioSpecificConfig |
| 23 // for more details. |
| 24 class MEDIA_EXPORT AAC { |
| 25 public: |
| 26 AAC(); |
| 27 ~AAC(); |
| 28 |
| 29 // Parse the AAC config from the raw binary data embedded in esds box. |
| 30 // The function will parse the data and get the ElementaryStreamDescriptor, |
| 31 // then it will parse the ElementaryStreamDescriptor to get audio stream |
| 32 // configurations. |
| 33 bool Parse(const std::vector<uint8>& data); |
| 34 |
| 35 uint32 frequency() const; |
| 36 ChannelLayout channel_layout() const; |
| 37 |
| 38 // This function converts a raw AAC frame into an AAC frame with an ADTS |
| 39 // header. On success, the function returns true and stores the converted data |
| 40 // in the buffer. The function returns false on failure and leaves the buffer |
| 41 // unchanged. |
| 42 bool ConvertEsdsToADTS(std::vector<uint8>* buffer) const; |
| 43 |
| 44 private: |
| 45 bool SkipDecoderGASpecificConfig(BitReader* bit_reader) const; |
| 46 bool SkipErrorSpecificConfig() const; |
| 47 bool SkipGASpecificConfig(BitReader* bit_reader) const; |
| 48 |
| 49 // The following variables store the AAC specific configuration information |
| 50 // that are used to generate the ADTS header. |
| 51 uint8 profile_; |
| 52 uint8 frequency_index_; |
| 53 uint8 channel_config_; |
| 54 |
| 55 // The following variables store audio configuration information that |
| 56 // can be used by Chromium. They are based on the AAC specific |
| 57 // configuration but can be overridden by extensions in elementary |
| 58 // stream descriptor. |
| 59 uint32 frequency_; |
| 60 ChannelLayout channel_layout_; |
| 61 }; |
| 62 |
| 63 } // namespace mp4 |
| 64 |
| 65 } // namespace media |
| 66 |
| 67 #endif // MEDIA_MP4_AAC_H_ |
OLD | NEW |