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 __TrackFragmentRandomAccessAtom_H__ 19 #define __TrackFragmentRandomAccessAtom_H__ 20 21 #include "fullatom.h" 22 #include "a_atomdefs.h" 23 #include "atomutils.h" 24 25 #define TFRA_LENGTH_SIZE 0x15 // all fields are of 2 bytes 26 27 struct PVA_FF_RandomAccessEntry 28 { 29 uint32 time; 30 uint32 moofOffset; 31 uint16 trafNumber; 32 uint16 trunNumber; 33 uint16 sampleNumber; 34 }; 35 36 class PVA_FF_TfraAtom : public PVA_FF_FullAtom 37 { 38 public: 39 PVA_FF_TfraAtom(uint32 trackId); 40 41 virtual ~PVA_FF_TfraAtom(); 42 43 void addSampleEntry(uint32 ts, uint32 moofOffset, 44 uint32 trafNumber, uint32 trunNumber, 45 uint32 sampleNumber); 46 47 uint32 getTrackId(); 48 49 void updateMoofOffset(uint32 offset); 50 51 virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP* fp); 52 53 private: 54 55 uint32 _trackId; 56 57 // initialied for 2 bytes size in constructor 58 uint32 _reserved; 59 60 uint32 _entryCount; 61 62 uint32 _moofUpdateSample; // contains sample number from 63 // where moof offset is to be updated 64 // when current moof is rendered 65 Oscl_Vector<PVA_FF_RandomAccessEntry, OsclMemAllocator> *_pSampleEntries; 66 virtual void recomputeSize(); 67 }; 68 69 #endif 70