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 |
| 13 namespace media { |
| 14 |
| 15 class BitReader; |
| 16 |
| 17 namespace mp4 { |
| 18 |
| 19 // This class parses the AAC information from ElementaryStreamDescriptor |
| 20 // embedded in the esds box in an ISO BMFF file. |
| 21 class MEDIA_EXPORT AAC { |
| 22 public: |
| 23 AAC(); |
| 24 ~AAC(); |
| 25 |
| 26 // Initialize the AAC using the raw binary data embedded in esds box. |
| 27 // The function will parse the data and get the ElementaryStreamDescriptor, |
| 28 // then it will parse the ElementaryStreamDescriptor to get audio stream |
| 29 // configurations. |
| 30 bool Initialize(const std::vector<uint8>& esds); |
| 31 |
| 32 uint32 frequency() const; |
| 33 ChannelLayout channel_layout() const; |
| 34 |
| 35 // This function converts raw AAC frame into AAC frame with ADTS header. |
| 36 bool ConvertEsdsToADTS(std::vector<uint8>* buffer) const; |
| 37 |
| 38 private: |
| 39 bool SkipDecoderGASpecificConfig(BitReader* bit_reader) const; |
| 40 bool SkipErrorSpecificConfig(BitReader* bit_reader) const; |
| 41 bool SkipGASpecificConfig(BitReader* bit_reader) const; |
| 42 |
| 43 // The following variables store the AAC specific configuration information |
| 44 // that are used to generate the ADTS header. |
| 45 uint8 profile_; |
| 46 uint8 frequency_index_; |
| 47 uint8 channel_config_; |
| 48 |
| 49 // The following variables store audio configuration information that |
| 50 // can be used by Chromium. They ara based on the AAC specific |
| 51 // configuration but can be overridden by extensions in elementary |
| 52 // stream descriptor. |
| 53 uint32 frequency_; |
| 54 ChannelLayout channel_layout_; |
| 55 }; |
| 56 |
| 57 } // namespace mp4 |
| 58 |
| 59 } // namespace media |
| 60 |
| 61 #endif // MEDIA_MP4_AAC_H_ |
OLD | NEW |