1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ESDS_H_ 18 19 #define ESDS_H_ 20 21 #include <stdint.h> 22 23 #include <media/stagefright/MediaErrors.h> 24 25 namespace android { 26 27 class ESDS { 28 public: 29 ESDS(const void *data, size_t size); 30 ~ESDS(); 31 32 status_t InitCheck() const; 33 34 status_t getCodecSpecificInfo(const void **data, size_t *size) const; 35 36 private: 37 enum { 38 kTag_ESDescriptor = 0x03, 39 kTag_DecoderConfigDescriptor = 0x04, 40 kTag_DecoderSpecificInfo = 0x05 41 }; 42 43 uint8_t *mData; 44 size_t mSize; 45 46 status_t mInitCheck; 47 48 size_t mDecoderSpecificOffset; 49 size_t mDecoderSpecificLength; 50 51 status_t skipDescriptorHeader( 52 size_t offset, size_t size, 53 uint8_t *tag, size_t *data_offset, size_t *data_size) const; 54 55 status_t parse(); 56 status_t parseESDescriptor(size_t offset, size_t size); 57 status_t parseDecoderConfigDescriptor(size_t offset, size_t size); 58 59 ESDS(const ESDS &); 60 ESDS &operator=(const ESDS &); 61 }; 62 63 } // namespace android 64 #endif // ESDS_H_ 65