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 __MovieFragmentAtom_H__ 19 #define __MovieFragmentAtom_H__ 20 21 #include "atom.h" 22 #include "a_atomdefs.h" 23 #include "atomutils.h" 24 25 #include "moviefragmentheaderatom.h" 26 #include "trackfragmentatom.h" 27 28 class PVA_FF_MovieFragmentAtom : public PVA_FF_Atom 29 { 30 31 public: 32 // constructor and destructor 33 PVA_FF_MovieFragmentAtom(uint32 sequenceNumber, uint32 movieFragmentDuration, 34 uint32 interleaveDuration); 35 virtual ~PVA_FF_MovieFragmentAtom(); 36 37 // Add and get track fragment 38 void addTrackFragment(uint32 mediaType, uint32 codecType, uint32 trackId, 39 uint32 timescale); 40 41 PVA_FF_TrackFragmentAtom* getTrackFragment(uint32 trackId); 42 43 44 void addSampleToFragment(uint32 trackId, uint32 size, 45 uint32 ts, uint8 flags, uint32 baseOffset, bool otrunStart); 46 47 int32 getTrackFragmentDuration(uint32 trackId); 48 49 50 uint32 getSequenceNumber(); 51 52 void setTrackFragmentHeaderData(uint32 trackId, uint32 flags); 53 54 void setTrackFragmentBaseDataOffset(uint32 trackId, uint32 offset); 55 56 uint32 getTrackFragmentNumber(uint32 trackId); 57 58 virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP* fp); 59 60 int32 getMaxTrackDuration(); 61 62 63 private: 64 65 uint32 _movieFragmentDuration; // determine the duration of samples in this movie fragment 66 uint32 _interleaveDuration; // determine the duration of samples in each trun 67 68 uint32 _fragmentDuration; // determines the duration of samples in this fragment 69 70 71 PVA_FF_MovieFragmentHeaderAtom *_pMfhdAtom; 72 Oscl_Vector <PVA_FF_TrackFragmentAtom*, OsclMemAllocator> *_pTrafList; // list of TRAF corresponding to tracks 73 74 virtual void recomputeSize(); 75 }; 76 77 #endif 78