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 Track Fragment Run Atom Class */ 21 /* ------------------------------------------------------------------- */ 22 /*********************************************************************************/ 23 /* 24 */ 25 26 #ifndef TRACKFRAGMENTRUNATOM_H_INCLUDED 27 #define TRACKFRAGMENTRUNATOM_H_INCLUDED 28 29 #ifndef FULLATOM_H_INCLUDED 30 #include "fullatom.h" 31 #endif 32 33 #ifndef ATOMUTILS_H_INCLUDED 34 #include "atomutils.h" 35 #endif 36 37 class TFrunSampleTable 38 { 39 public: 40 TFrunSampleTable(MP4_FF_FILE *fp , uint32 tr_flag, uint32 base_data_offset, 41 uint64 sampleTS); 42 setDefaultDuration(uint32 sampleTS,uint32 default_duration)43 void setDefaultDuration(uint32 sampleTS, uint32 default_duration) 44 { 45 _sample_timestamp = sampleTS; 46 _sample_duration = default_duration; 47 } setDefaultSampleSize(uint32 sampleoffset,uint32 default_samplesize)48 void setDefaultSampleSize(uint32 sampleoffset, uint32 default_samplesize) 49 { 50 _sample_offset = sampleoffset; 51 _sample_size = default_samplesize; 52 } 53 ~TFrunSampleTable()54 ~TFrunSampleTable() {}; 55 56 uint32 _sample_duration; 57 uint32 _sample_size; 58 uint32 _sample_flags; 59 uint32 _sample_composition_time_offset; 60 uint32 _sample_offset; 61 uint64 _sample_timestamp; 62 private: 63 64 }; 65 66 class TrackFragmentRunAtom : public FullAtom 67 { 68 69 public: 70 TrackFragmentRunAtom(MP4_FF_FILE *fp, 71 uint32 size, 72 uint32 type, 73 uint32 base_data_offset, 74 uint32 ¤tTrunOffset, 75 uint32 &offset, 76 uint64 trackDuration, 77 bool bdo_present, 78 bool &trunParsingCompleted, 79 uint32 &countOfTrunsParsed); 80 81 virtual ~TrackFragmentRunAtom(); 82 83 void ParseTrunAtom(MP4_FF_FILE *fp, 84 uint32 &offset, 85 bool &trunParsingCompleted, 86 uint32 &countOfTrunsParsed); 87 getDataOffset()88 uint64 getDataOffset() 89 { 90 return _data_offset; 91 } getSampleCount()92 uint32 getSampleCount() 93 { 94 return _sample_count; 95 } 96 getSampleTable()97 Oscl_Vector<TFrunSampleTable*, OsclMemAllocator>* getSampleTable() 98 { 99 return _pTFrunSampleTable; 100 } 101 uint32 _sample_offset; 102 uint64 _sampleTimeStamp; 103 void setDefaultDuration(uint32 default_duration); 104 void setDefaultSampleSize(uint32 default_samplesize, uint32& sigmaSampleSize); 105 void setSampleDurationAndTimeStampFromSampleNum(uint32 startSampleNum, uint32 startDuration, uint32 default_duration); 106 107 private: 108 uint32 tr_flag; 109 uint32 _sample_count; 110 uint32 _data_offset; 111 uint32 _first_sample_flags; 112 Oscl_Vector<TFrunSampleTable*, OsclMemAllocator> *_pTFrunSampleTable; 113 uint32 _version; 114 PVLogger *iLogger, *iStateVarLogger, *iParsedDataLogger; 115 uint32 _trun_start_offset; 116 uint32 _samplesToBeParsed; 117 uint32 _partialTrunOffset; 118 119 }; 120 121 #endif 122