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 /*********************************************************************************/ 19 /* ------------------------------------------------------------------- */ 20 /* MPEG-4 TimeToSampleAtom Class */ 21 /* ------------------------------------------------------------------- */ 22 /*********************************************************************************/ 23 /* 24 This TimeToSampleAtom Class contains a compact version of a table that allows 25 indexing from decoding to sample number. 26 */ 27 28 29 #ifndef TIMETOSAMPLEATOM_H_INCLUDED 30 #define TIMETOSAMPLEATOM_H_INCLUDED 31 32 #ifndef OSCL_FILE_IO_H_INCLUDED 33 #include "oscl_file_io.h" 34 #endif 35 36 #ifndef FULLATOM_H_INCLUDED 37 #include "fullatom.h" 38 #endif 39 40 #define PV_ERROR -1 41 42 class TimeToSampleAtom : public FullAtom 43 { 44 45 public: 46 TimeToSampleAtom(MP4_FF_FILE *fp, 47 uint32 mediaType, 48 uint32 size, 49 uint32 type, 50 OSCL_wString& filename, 51 uint32 parsingMode = 0); 52 virtual ~TimeToSampleAtom(); 53 54 // Member gets and sets getEntryCount()55 uint32 getEntryCount() const 56 { 57 return _entryCount; 58 } 59 60 uint32 getSampleCountAt(int32 index); 61 int32 getSampleDeltaAt(int32 index); 62 int32 getSampleNumberFromTimestamp(uint32 ts, 63 bool oAlwaysRetSampleCount = false); 64 int32 getTimeDeltaForSampleNumber(uint32 num); 65 int32 getTimestampForSampleNumber(uint32 num); 66 67 int32 getTimeDeltaForSampleNumberPeek(uint32 num); 68 int32 getTimeDeltaForSampleNumberGet(uint32 num); 69 70 int32 resetStateVariables(); 71 int32 resetStateVariables(uint32 sampleNum); 72 73 int32 resetPeekwithGet(); getCurrPeekSampleCount()74 uint32 getCurrPeekSampleCount() 75 { 76 return _currPeekSampleCount; 77 } 78 79 80 81 private: 82 bool ParseEntryUnit(uint32 entry_cnt); 83 void CheckAndParseEntry(uint32 i); 84 uint32 _entryCount; 85 86 uint32 *_psampleCountVec; 87 uint32 *_psampleDeltaVec; 88 89 uint32 _mediaType; 90 91 // For visual samples 92 uint32 _currentTimestamp; 93 94 MP4_FF_FILE *_fileptr; 95 96 MP4_FF_FILE *_curr_fptr; 97 uint32 *_stbl_fptr_vec; 98 uint32 _stbl_buff_size; 99 uint32 _curr_entry_point; 100 uint32 _curr_buff_number; 101 uint32 _next_buff_number; 102 103 uint32 _parsed_entry_cnt; 104 105 uint32 _currGetSampleCount; 106 int32 _currGetIndex; 107 int32 _currGetTimeDelta; 108 uint32 _currPeekSampleCount; 109 int32 _currPeekIndex; 110 int32 _currPeekTimeDelta; 111 uint32 _parsing_mode; 112 PVLogger *iLogger, *iStateVarLogger, *iParsedDataLogger; 113 114 }; 115 116 #endif // TIMETOSAMPLEATOM_H_INCLUDED 117 118