1 /***************************************************************** 2 | 3 | AP4 - mvhd Atoms 4 | 5 | Copyright 2002-2008 Axiomatic Systems, LLC 6 | 7 | 8 | This file is part of Bento4/AP4 (MP4 Atom Processing Library). 9 | 10 | Unless you have obtained Bento4 under a difference license, 11 | this version of Bento4 is Bento4|GPL. 12 | Bento4|GPL is free software; you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation; either version 2, or (at your option) 15 | any later version. 16 | 17 | Bento4|GPL is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with Bento4|GPL; see the file COPYING. If not, write to the 24 | Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 25 | 02111-1307, USA. 26 | 27 ****************************************************************/ 28 29 #ifndef _AP4_MVHD_ATOM_H_ 30 #define _AP4_MVHD_ATOM_H_ 31 32 /*---------------------------------------------------------------------- 33 | includes 34 +---------------------------------------------------------------------*/ 35 #include "Ap4List.h" 36 #include "Ap4Atom.h" 37 38 /*---------------------------------------------------------------------- 39 | AP4_MvhdAtom 40 +---------------------------------------------------------------------*/ 41 class AP4_MvhdAtom : public AP4_Atom 42 { 43 public: 44 AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_MvhdAtom, AP4_Atom) 45 46 // class methods 47 static AP4_MvhdAtom* Create(AP4_Size size, AP4_ByteStream& stream); 48 49 // methods 50 AP4_MvhdAtom(AP4_UI64 creation_time, 51 AP4_UI64 modification_time, 52 AP4_UI32 time_scale, 53 AP4_UI64 duration, 54 AP4_UI32 rate, 55 AP4_UI16 volume); 56 virtual AP4_Result InspectFields(AP4_AtomInspector& inspector); 57 virtual AP4_Result WriteFields(AP4_ByteStream& stream); GetDuration()58 AP4_UI64 GetDuration() { return m_Duration; } SetDuration(AP4_UI64 duration)59 void SetDuration(AP4_UI64 duration) { m_Duration = duration;} 60 AP4_UI32 GetDurationMs(); GetTimeScale()61 AP4_UI32 GetTimeScale() { return m_TimeScale; } SetTimeScale(AP4_UI32 time_scale)62 AP4_Result SetTimeScale(AP4_UI32 time_scale) { 63 m_TimeScale = time_scale; 64 return AP4_SUCCESS; 65 } SetNextTrackId(AP4_UI32 next_track_id)66 AP4_Result SetNextTrackId(AP4_UI32 next_track_id){ 67 m_NextTrackId = next_track_id; 68 return AP4_SUCCESS; 69 } 70 71 private: 72 // methods 73 AP4_MvhdAtom(AP4_UI32 size, 74 AP4_UI08 version, 75 AP4_UI32 flags, 76 AP4_ByteStream& stream); 77 78 // members 79 AP4_UI64 m_CreationTime; 80 AP4_UI64 m_ModificationTime; 81 AP4_UI32 m_TimeScale; 82 AP4_UI64 m_Duration; 83 AP4_UI32 m_Rate; 84 AP4_UI16 m_Volume; 85 AP4_UI08 m_Reserved1[2]; 86 AP4_UI08 m_Reserved2[8]; 87 AP4_UI32 m_Matrix[9]; 88 AP4_UI08 m_Predefined[24]; 89 AP4_UI32 m_NextTrackId; 90 }; 91 92 #endif // _AP4_MVHD_ATOM_H_ 93