1 /*****************************************************************
2 |
3 |    AP4 - moov 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_MOOV_ATOM_H_
30 #define _AP4_MOOV_ATOM_H_
31 
32 /*----------------------------------------------------------------------
33 |   includes
34 +---------------------------------------------------------------------*/
35 #include "Ap4List.h"
36 #include "Ap4ContainerAtom.h"
37 
38 /*----------------------------------------------------------------------
39 |   class references
40 +---------------------------------------------------------------------*/
41 class AP4_AtomFactory;
42 class AP4_TrakAtom;
43 class AP4_PsshAtom;
44 
45 /*----------------------------------------------------------------------
46 |   AP4_MoovAtom
47 +---------------------------------------------------------------------*/
48 class AP4_MoovAtom : public AP4_ContainerAtom
49 {
50 public:
AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_MoovAtom,AP4_ContainerAtom)51     AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_MoovAtom, AP4_ContainerAtom)
52 
53     // class methods
54     static AP4_MoovAtom* Create(AP4_Size         size,
55                                 AP4_ByteStream&  stream,
56                                 AP4_AtomFactory& atom_factory) {
57         return new AP4_MoovAtom(size, stream, atom_factory);
58     }
59 
60     // methods
61     AP4_MoovAtom();
GetTrakAtoms()62     AP4_List<AP4_TrakAtom>& GetTrakAtoms() {
63         return m_TrakAtoms;
64     }
65 	AP4_Result AddTrakAtoms(AP4_List<AP4_TrakAtom>& atoms, AP4_List<AP4_TrakAtom>::Item* &first_item);
66 
GetPsshAtoms()67 	AP4_List<AP4_PsshAtom>& GetPsshAtoms() {
68 		return m_PsshAtoms;
69 	}
GetTimeScale()70 	AP4_UI32 GetTimeScale() {
71         return m_TimeScale;
72     }
73     AP4_Result AdjustChunkOffsets(AP4_SI64 offset);
74 
75     // AP4_AtomParent methods
76     void OnChildAdded(AP4_Atom* atom);
77     void OnChildRemoved(AP4_Atom* atom);
78 
79 private:
80     // methods
81     AP4_MoovAtom(AP4_UI32         size,
82                  AP4_ByteStream&  stream,
83                  AP4_AtomFactory& atom_factory);
84 
85     // members
86 	AP4_List<AP4_TrakAtom> m_TrakAtoms;
87 	AP4_List<AP4_PsshAtom> m_PsshAtoms;
88     AP4_UI32               m_TimeScale;
89 };
90 
91 #endif // _AP4_MOOV_ATOM_H_
92