• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 getObjectTypeIndication(uint8_t *objectTypeIndication) const;
35     status_t getCodecSpecificInfo(const void **data, size_t *size) const;
36 
37 private:
38     enum {
39         kTag_ESDescriptor            = 0x03,
40         kTag_DecoderConfigDescriptor = 0x04,
41         kTag_DecoderSpecificInfo     = 0x05
42     };
43 
44     uint8_t *mData;
45     size_t mSize;
46 
47     status_t mInitCheck;
48 
49     size_t mDecoderSpecificOffset;
50     size_t mDecoderSpecificLength;
51     uint8_t mObjectTypeIndication;
52 
53     status_t skipDescriptorHeader(
54             size_t offset, size_t size,
55             uint8_t *tag, size_t *data_offset, size_t *data_size) const;
56 
57     status_t parse();
58     status_t parseESDescriptor(size_t offset, size_t size);
59     status_t parseDecoderConfigDescriptor(size_t offset, size_t size);
60 
61     ESDS(const ESDS &);
62     ESDS &operator=(const ESDS &);
63 };
64 
65 }  // namespace android
66 #endif  // ESDS_H_
67