1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 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 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 #ifndef __AVCConfigurationBox_H__ 19 #define __AVCConfigurationBox_H__ 20 21 #include "atom.h" 22 #include "atomutils.h" 23 #include "oscl_file_io.h" 24 #include "avcconfigurationbox.h" 25 26 #ifndef OSCL_VECTOR_H_INCLUDED 27 #include "oscl_vector.h" 28 #endif 29 30 31 32 33 34 class AVCConfigurationBox : public Atom 35 { 36 37 public: 38 class ParameterSet 39 { 40 public: ParameterSet()41 ParameterSet() 42 { 43 _parameterSetLength = 0; 44 _pParameterSet = NULL; 45 _success = false; 46 }; 47 48 ParameterSet(uint16 length, MP4_FF_FILE *fp); 49 ~ParameterSet()50 virtual ~ParameterSet() 51 { 52 PV_MP4_ARRAY_DELETE(NULL, _pParameterSet); 53 } 54 getParameterSetLength()55 uint16 getParameterSetLength() 56 { 57 return _parameterSetLength; 58 } 59 getParameterSet()60 uint8* getParameterSet() 61 { 62 return _pParameterSet; 63 } 64 getSuccess()65 bool getSuccess() 66 { 67 return _success; 68 } 69 70 private: 71 bool _success; 72 uint16 _parameterSetLength; 73 uint8 *_pParameterSet; 74 }; 75 76 AVCConfigurationBox(MP4_FF_FILE *fp, uint32 size, uint32 type); 77 virtual ~AVCConfigurationBox(); 78 getConfigurationVersion()79 uint8 getConfigurationVersion() 80 { 81 return _configurationVersion; 82 } 83 getAVCProfileIndication()84 uint8 getAVCProfileIndication() 85 { 86 return _avcProfileIndication; 87 } 88 getProfileCompatibility()89 uint8 getProfileCompatibility() 90 { 91 return _profileCompatibility; 92 } 93 getAVCLevelIndication()94 uint8 getAVCLevelIndication() 95 { 96 return _avcLevelIndication; 97 } 98 getNALLengthSize()99 uint8 getNALLengthSize() 100 { 101 return (uint8)(_lengthSizeMinusOne + 1); 102 } 103 getNumSequenceParamSets()104 uint8 getNumSequenceParamSets() 105 { 106 return _numSequenceParameterSets; 107 } 108 getNumPictureParamSets()109 uint8 getNumPictureParamSets() 110 { 111 return _numPictureParameterSets; 112 } 113 114 OSCL_IMPORT_REF bool getSequenceParamSet(int32 index, uint16 &length, uint8* ¶mSet); 115 116 117 OSCL_IMPORT_REF bool getPictureParamSet(int32 index, uint16 &length, uint8* ¶mSet); 118 getNumofPictureParamSet()119 uint32 getNumofPictureParamSet() 120 { 121 return _pictureParameterSetVec->size(); 122 } 123 getNumofSequenceParamSet()124 uint32 getNumofSequenceParamSet() 125 { 126 return _sequenceParameterSetVec->size(); 127 } 128 getTotalSeqParameterSetLength()129 uint32 getTotalSeqParameterSetLength() 130 { 131 return _totalSeqParameterSetLength; 132 } 133 getTotalPictureParameterSetLength()134 uint32 getTotalPictureParameterSetLength() 135 { 136 return _totalPicutureParameterSetLength; 137 } 138 139 private: 140 uint8 _configurationVersion; 141 uint8 _avcProfileIndication; 142 uint8 _profileCompatibility; 143 uint8 _avcLevelIndication; 144 uint8 _lengthSizeMinusOne; 145 uint8 _numSequenceParameterSets; 146 uint8 _numPictureParameterSets; 147 uint8 _constraint_set0_flag; 148 uint8 _constraint_set1_flag; 149 uint8 _constraint_set2_flag; 150 uint8 _reserved_zero_5bits; 151 uint32 _totalSeqParameterSetLength; 152 uint32 _totalPicutureParameterSetLength; 153 154 Oscl_Vector<ParameterSet*, OsclMemAllocator> *_sequenceParameterSetVec; 155 Oscl_Vector<ParameterSet*, OsclMemAllocator> *_pictureParameterSetVec; 156 157 }; 158 159 160 #endif 161