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 PV_AVIFILE_INDX_H_INCLUDED 19 #define PV_AVIFILE_INDX_H_INCLUDED 20 21 #ifndef PV_AVIFILE_TYPEDEFS_H_INCLUDED 22 #include "pv_avifile_typedefs.h" 23 #endif 24 25 #ifndef PV_AVIFILE_PARSER_UTILS_H_INCLUDED 26 #include "pv_avifile_parser_utils.h" 27 #endif 28 29 typedef Oscl_Vector<IdxTblType, OsclMemAllocator> IndxTblVector; 30 31 //class to parse values in index chunk. index chunk contains offset and size info of media sample. 32 class PVAviFileIdxChunk: public PVAviFileParserStatus 33 { 34 35 public: 36 37 //constructor 38 PVAviFileIdxChunk(PVFile* aFp, uint32 aIndxSize, uint32 aNumStreams); 39 40 //destructor ~PVAviFileIdxChunk()41 ~PVAviFileIdxChunk() { }; 42 GetOffset(uint32 aStreamNo,uint32 aSampleNo)43 uint32 GetOffset(uint32 aStreamNo, uint32 aSampleNo) 44 { 45 return (((iIndexTable[aStreamNo])[aSampleNo]).offset); 46 } 47 GetSampleSize(uint32 aStreamNo,uint32 aSampleNo)48 uint32 GetSampleSize(uint32 aStreamNo, uint32 aSampleNo) 49 { 50 return (((iIndexTable[aStreamNo])[aSampleNo]).size); 51 } 52 GetNumberOfSamplesInStream(uint32 aStreamNo)53 uint32 GetNumberOfSamplesInStream(uint32 aStreamNo) 54 { 55 return ((iIndexTable[aStreamNo]).size()); 56 } 57 IsOffsetFromMoviList()58 bool IsOffsetFromMoviList() 59 { 60 return iOffsetFrmMoviLst; 61 } 62 63 Oscl_Vector<IndxTblVector, OsclMemAllocator> GetIndexTable()64 GetIndexTable() 65 { 66 return iIndexTable; 67 } 68 69 private: 70 71 // variable iIndexTable stores the offset and size info of ever sample in a stream 72 // size of IndxTblTypeVector = number of samples ("movi" Subchunks) in a stream. 73 // size of iIndexTable = number of streams. 74 75 Oscl_Vector < IndxTblVector, 76 OsclMemAllocator > iIndexTable; 77 uint32 iIndexSize; 78 uint32 iNumStreams; 79 bool iOffsetFrmMoviLst; 80 81 }; 82 83 #endif //#ifndef PV_AVIFILE_INDX_H_INCLUDED 84 85