Home | History | Annotate | Download | only in mp4
      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_ES_DESCRIPTOR_H_
      6 #define MEDIA_MP4_ES_DESCRIPTOR_H_
      7 
      8 #include <vector>
      9 
     10 #include "base/basictypes.h"
     11 #include "media/base/media_export.h"
     12 
     13 namespace media {
     14 
     15 class BitReader;
     16 
     17 namespace mp4 {
     18 
     19 // The following values are extracted from ISO 14496 Part 1 Table 5 -
     20 // objectTypeIndication Values. Only values currently in use are included.
     21 enum ObjectType {
     22   kForbidden = 0,
     23   kISO_14496_3 = 0x40,  // MPEG4 AAC
     24   kISO_13818_7_AAC_LC = 0x67,  // MPEG2 AAC-LC
     25   kEAC3 = 0xa6  // Dolby Digital Plus
     26 };
     27 
     28 // This class parse object type and decoder specific information from an
     29 // elementary stream descriptor, which is usually contained in an esds box.
     30 // Please refer to ISO 14496 Part 1 7.2.6.5 for more details.
     31 class MEDIA_EXPORT ESDescriptor {
     32  public:
     33   // Utility function to check if the given object type is AAC.
     34   static bool IsAAC(uint8 object_type);
     35 
     36   ESDescriptor();
     37   ~ESDescriptor();
     38 
     39   bool Parse(const std::vector<uint8>& data);
     40 
     41   uint8 object_type() const;
     42   const std::vector<uint8>& decoder_specific_info() const;
     43 
     44  private:
     45   enum Tag {
     46     kESDescrTag = 0x03,
     47     kDecoderConfigDescrTag = 0x04,
     48     kDecoderSpecificInfoTag = 0x05
     49   };
     50 
     51   bool ParseDecoderConfigDescriptor(BitReader* reader);
     52   bool ParseDecoderSpecificInfo(BitReader* reader);
     53 
     54   uint8 object_type_;
     55   std::vector<uint8> decoder_specific_info_;
     56 };
     57 
     58 }  // namespace mp4
     59 
     60 }  // namespace media
     61 
     62 #endif  // MEDIA_MP4_ES_DESCRIPTOR_H_
     63