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 OMA2BOXES_H_INCLUDED 19 #define OMA2BOXES_H_INCLUDED 20 21 #ifndef FULLATOM_H_INCLUDED 22 #include "fullatom.h" 23 #endif 24 25 #ifndef ATOMUTILS_H_INCLUDED 26 #include "atomutils.h" 27 #endif 28 29 #ifndef ATOMDEFS_H_INCLUDED 30 #include "atomdefs.h" 31 #endif 32 33 #ifndef SAMPLEENTRY_H_INCLUDED 34 #include "sampleentry.h" 35 #endif 36 37 #ifndef ESDATOM_H_INCLUDED 38 #include "esdatom.h" 39 #endif 40 41 #ifndef GPP_AMRDECODERSPECIFICINFO_H_INCLUDED 42 #include "3gpp_amrdecoderspecificinfo.h" 43 #endif 44 45 #ifndef GPP_H263DECODERSPECIFICINFO_H_INCLUDED 46 #include "3gpp_h263decoderspecificinfo.h" 47 #endif 48 49 #ifndef H263DECODERSPECIFICINFO_H_INCLUDED 50 #include "h263decoderspecificinfo.h" 51 #endif 52 53 #ifndef AVCCONFIGURATIONBOX_H_INCLUDED 54 #include "avcconfigurationbox.h" 55 #endif 56 57 #ifndef MPEG4SAMPLEENTRYEXTENSIONS_H_INCLUDED 58 #include "mpeg4sampleentryextensions.h" 59 #endif 60 61 #ifndef DECODERSPECIFICINFO_H_INCLUDED 62 #include "decoderspecificinfo.h" 63 #endif 64 65 class OMADRMKMSBox : public FullAtom 66 { 67 public: 68 OMADRMKMSBox(MP4_FF_FILE *fp, 69 uint32 size, 70 uint32 type); // Default constructor 71 virtual ~OMADRMKMSBox() ; 72 getODKMData()73 uint8* getODKMData() 74 { 75 return _pODKMData; 76 } getODKMDataSize()77 uint32 getODKMDataSize() 78 { 79 return _size; 80 } 81 82 private: 83 uint8* _pODKMData; 84 }; 85 86 87 class MutableDRMInformationBox : public Atom 88 { 89 public: 90 MutableDRMInformationBox(MP4_FF_FILE *fp, 91 uint32 size, 92 uint32 type); // Default constructor ~MutableDRMInformationBox()93 virtual ~MutableDRMInformationBox() {}; 94 95 private: 96 }; 97 98 class SchemeInformationBox : public Atom 99 { 100 public: 101 SchemeInformationBox(MP4_FF_FILE *fp, 102 uint32 size, 103 uint32 type); // Default constructor 104 virtual ~SchemeInformationBox(); // Destructor 105 getTrackLevelOMA2DRMInfoSize()106 uint32 getTrackLevelOMA2DRMInfoSize() 107 { 108 if (_pOMADRMKMSBox != NULL) 109 { 110 return (_pOMADRMKMSBox->getODKMDataSize()); 111 } 112 return 0; 113 } 114 getTrackLevelOMA2DRMInfo()115 uint8* getTrackLevelOMA2DRMInfo() 116 { 117 if (_pOMADRMKMSBox != NULL) 118 { 119 return (_pOMADRMKMSBox->getODKMData()); 120 } 121 return NULL; 122 } 123 124 private: 125 OMADRMKMSBox* _pOMADRMKMSBox; 126 127 }; 128 129 class OriginalFormatbox : public Atom 130 { 131 public: 132 OriginalFormatbox(MP4_FF_FILE *fp, 133 uint32 size, 134 uint32 type); // Default constructor 135 virtual ~OriginalFormatbox(); // Destructor 136 137 private: 138 uint32 _data_format; 139 140 }; 141 142 class ProtectionSchemeInformationBox : public Atom 143 { 144 public: 145 ProtectionSchemeInformationBox(MP4_FF_FILE *fp, 146 uint32 size, 147 uint32 type); // Default constructor 148 virtual ~ProtectionSchemeInformationBox(); // Destructor 149 getTrackLevelOMA2DRMInfoSize()150 uint32 getTrackLevelOMA2DRMInfoSize() 151 { 152 if (_pSchemeInformationBox != NULL) 153 { 154 return (_pSchemeInformationBox->getTrackLevelOMA2DRMInfoSize()); 155 } 156 return 0; 157 } 158 getTrackLevelOMA2DRMInfo()159 uint8* getTrackLevelOMA2DRMInfo() 160 { 161 if (_pSchemeInformationBox != NULL) 162 { 163 return (_pSchemeInformationBox->getTrackLevelOMA2DRMInfo()); 164 } 165 return NULL; 166 } 167 168 private: 169 SchemeInformationBox* _pSchemeInformationBox; 170 OriginalFormatbox* _pOriginalFormatBox; 171 }; 172 173 class EcnaBox : public SampleEntry 174 { 175 176 public: 177 EcnaBox(MP4_FF_FILE *fp, uint32 size, uint32 type); 178 virtual ~EcnaBox(); 179 180 // Member gets and sets getESDAtom()181 const ESDAtom &getESDAtom() const 182 { 183 return *_pes; 184 } 185 getTimeScale()186 uint16 getTimeScale() 187 { 188 return _timeScale; 189 } 190 191 virtual uint32 getESID() const; 192 virtual const ESDescriptor *getESDescriptor() const; 193 virtual uint8 getObjectTypeIndication() const; 194 virtual DecoderSpecificInfo *getDecoderSpecificInfo() const; 195 uint32 getAverageBitrate() const; 196 uint32 getMaxBitrate() const; 197 // Get the max size buffer needed to retrieve the media samples 198 uint32 getMaxBufferSizeDB() const; 199 ProtectionSchemeInformationBox *_pProtectionSchemeInformationBox; 200 201 private: 202 // Reserved constants 203 uint32 _reserved1[2]; // = { 0, 0 }; 204 uint16 _reserved2; // = 2; 205 uint16 _reserved3; // = 16; 206 uint32 _reserved4; // = 0; 207 uint16 _reserved5; // = 0; 208 uint16 _timeScale; 209 210 ESDAtom *_pes; 211 AMRSpecificAtom *_pAMRSpecificAtom; 212 AMRSpecificAtom *_pAMRWBSpecificAtom; 213 Oscl_Vector<DecoderSpecificInfo *, OsclMemAllocator> *_pAMRDecSpecInfoArray; 214 Oscl_Vector<DecoderSpecificInfo *, OsclMemAllocator> *_pAMRWBDecSpecInfoArray; 215 }; 216 217 class EcnvBox : public SampleEntry 218 { 219 220 public: 221 EcnvBox(MP4_FF_FILE *fp, uint32 size, uint32 type); 222 virtual ~EcnvBox(); 223 224 // Member gets and sets getESDAtom()225 const ESDAtom &getESDAtom() const 226 { 227 return *_pes; 228 } 229 230 virtual uint32 getESID() const; 231 virtual const ESDescriptor *getESDescriptor() const; 232 233 // Getting and setting the Mpeg4 VOL header 234 DecoderSpecificInfo *getDecoderSpecificInfo() const; 235 uint8 getObjectTypeIndication() const; 236 237 // Get the max size buffer needed to retrieve the media samples 238 uint32 getMaxBufferSizeDB() const; 239 uint32 getAverageBitrate() const; 240 uint32 getMaxBitrate() const; 241 uint16 getWidth() const; 242 uint16 getHeight() const; 243 ProtectionSchemeInformationBox *_pProtectionSchemeInformationBox; 244 245 private: 246 // Reserved constants 247 uint32 _reserved1[4]; // = { 0, 0, 0, 0 }; 248 uint32 _reserved2; // = 0x014000f0; 249 uint32 _reserved3; // = 0x00480000; 250 uint32 _reserved4; // = 0x00480000; 251 uint32 _reserved5; // = 0; 252 uint16 _reserved6; // = 1; 253 uint8 _reserved7[32]; // = 0; 254 uint16 _reserved8; // = 24; 255 uint16 _reserved9; // = -1; // (16) SIGNED! 256 257 bool createAVCDecoderSpecificInfo(MP4_FF_FILE *fp); 258 ESDAtom *_pes; 259 H263SpecficAtom *_pH263SpecificAtom; 260 H263DecoderSpecificInfo *_pH263decSpecificInfo; 261 DecoderSpecificInfo* _decoderSpecificInfo; 262 AVCConfigurationBox *_pAVCConfigurationBox; 263 MPEG4BitRateBox *_pMPEG4BitRateBox; 264 }; 265 266 class BoxRecord; 267 class FontRecord; 268 class StyleRecord; 269 class FontTableAtom; 270 271 class EnctBox : public SampleEntry 272 { 273 274 public: 275 OSCL_IMPORT_REF EnctBox(MP4_FF_FILE *fp, uint32 size, uint32 type); 276 OSCL_IMPORT_REF virtual ~EnctBox(); // Destructor 277 getDisplayFlags()278 uint32 getDisplayFlags() 279 { 280 return _displayFlags; 281 } 282 getHorzJustification()283 int8 getHorzJustification() 284 { 285 return _horzJustification; 286 } 287 getVertJustification()288 int8 getVertJustification() 289 { 290 return _vertJustification; 291 } 292 getBackgroundColourRGBA()293 uint8 *getBackgroundColourRGBA() 294 { 295 return _pBackgroundRGBA; 296 } 297 298 OSCL_IMPORT_REF int16 getBoxTop(); 299 OSCL_IMPORT_REF int16 getBoxLeft(); 300 OSCL_IMPORT_REF int16 getBoxBottom(); 301 OSCL_IMPORT_REF int16 getBoxRight(); 302 303 OSCL_IMPORT_REF uint16 getStartChar() ; 304 OSCL_IMPORT_REF uint16 getEndChar() ; 305 OSCL_IMPORT_REF uint16 getFontID(); 306 OSCL_IMPORT_REF uint8 getFontStyleFlags() ; 307 OSCL_IMPORT_REF uint8 getfontSize(); 308 OSCL_IMPORT_REF uint8 *getTextColourRGBA(); 309 OSCL_IMPORT_REF uint16 getFontListSize(); 310 OSCL_IMPORT_REF FontRecord *getFontRecordAt(uint16 index) ; 311 ProtectionSchemeInformationBox *_pProtectionSchemeInformationBox; 312 313 private: 314 uint32 _displayFlags; 315 int8 _horzJustification; 316 int8 _vertJustification; 317 uint8 *_pBackgroundRGBA; 318 BoxRecord *_pBoxRecord; 319 StyleRecord *_pStyleRecord; 320 FontTableAtom *_pFontTableAtom; 321 }; 322 323 324 #endif // OMA2BOXES_H_INCLUDED 325 326