Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef MEDIA_MP4_ES_DESCRIPTOR_H_ |
michael@0 | 6 | #define MEDIA_MP4_ES_DESCRIPTOR_H_ |
michael@0 | 7 | |
michael@0 | 8 | #include <vector> |
michael@0 | 9 | |
michael@0 | 10 | #include "mp4_demuxer/basictypes.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace mp4_demuxer { |
michael@0 | 13 | |
michael@0 | 14 | class BitReader; |
michael@0 | 15 | |
michael@0 | 16 | // The following values are extracted from ISO 14496 Part 1 Table 5 - |
michael@0 | 17 | // objectTypeIndication Values. Only values currently in use are included. |
michael@0 | 18 | enum ObjectType { |
michael@0 | 19 | kForbidden = 0, |
michael@0 | 20 | kISO_14496_3 = 0x40, // MPEG4 AAC |
michael@0 | 21 | kISO_13818_7_AAC_LC = 0x67 // MPEG2 AAC-LC |
michael@0 | 22 | }; |
michael@0 | 23 | |
michael@0 | 24 | // This class parse object type and decoder specific information from an |
michael@0 | 25 | // elementary stream descriptor, which is usually contained in an esds box. |
michael@0 | 26 | // Please refer to ISO 14496 Part 1 7.2.6.5 for more details. |
michael@0 | 27 | class ESDescriptor { |
michael@0 | 28 | public: |
michael@0 | 29 | ESDescriptor(); |
michael@0 | 30 | ~ESDescriptor(); |
michael@0 | 31 | |
michael@0 | 32 | bool Parse(const std::vector<uint8_t>& data); |
michael@0 | 33 | |
michael@0 | 34 | uint8_t object_type() const; |
michael@0 | 35 | const std::vector<uint8_t>& decoder_specific_info() const; |
michael@0 | 36 | |
michael@0 | 37 | private: |
michael@0 | 38 | enum Tag { |
michael@0 | 39 | kESDescrTag = 0x03, |
michael@0 | 40 | kDecoderConfigDescrTag = 0x04, |
michael@0 | 41 | kDecoderSpecificInfoTag = 0x05 |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | bool ParseDecoderConfigDescriptor(BitReader* reader); |
michael@0 | 45 | bool ParseDecoderSpecificInfo(BitReader* reader); |
michael@0 | 46 | |
michael@0 | 47 | uint8_t object_type_; |
michael@0 | 48 | std::vector<uint8_t> decoder_specific_info_; |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | } // namespace mp4_demuxer |
michael@0 | 52 | |
michael@0 | 53 | #endif // MEDIA_MP4_ES_DESCRIPTOR_H_ |