1 /*****************************************************************
2 |
3 |    AP4 - Movie Fragments
4 |
5 |    Copyright 2002-2009 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_MOVIE_FRAGMENT_H_
30 #define _AP4_MOVIE_FRAGMENT_H_
31 
32 /*----------------------------------------------------------------------
33 |   includes
34 +---------------------------------------------------------------------*/
35 #include "Ap4Types.h"
36 #include "Ap4MfhdAtom.h"
37 #include "Ap4List.h"
38 
39 /*----------------------------------------------------------------------
40 |   class references
41 +---------------------------------------------------------------------*/
42 class AP4_ByteStream;
43 class AP4_ContainerAtom;
44 class AP4_FragmentSampleTable;
45 class AP4_Movie;
46 class AP4_MoovAtom;
47 
48 /*----------------------------------------------------------------------
49 |   constants
50 +---------------------------------------------------------------------*/
51 const AP4_UI32 AP4_FRAG_FLAG_SAMPLE_IS_DIFFERENCE = 0x00010000;
52 
53 /*----------------------------------------------------------------------
54 |   AP4_MovieFragment
55 +---------------------------------------------------------------------*/
56 class AP4_MovieFragment {
57 public:
58     // this constructor transfers the ownership of the moof atom to the
59     // newly constructed object
60     AP4_MovieFragment(AP4_ContainerAtom* moof);
61     virtual ~AP4_MovieFragment();
62 
GetMoofAtom()63     AP4_ContainerAtom* GetMoofAtom() { return m_MoofAtom;}
GetMfhdAtom()64     AP4_MfhdAtom*      GetMfhdAtom() { return m_MfhdAtom;}
65     AP4_UI32           GetSequenceNumber();
66     AP4_Result         GetTrackIds(AP4_Array<AP4_UI32>& ids);
67     AP4_Result         GetTrafAtom(AP4_UI32 track_id, AP4_ContainerAtom*& traf);
68     AP4_Result         CreateSampleTable(AP4_MoovAtom*             moov,
69                                          AP4_UI32                  track_id,
70                                          AP4_ByteStream*           sample_stream,
71                                          AP4_Position              moof_offset,
72                                          AP4_Position              mdat_payload_offset, // hack because MS doesn't implement the spec properly
73                                          AP4_UI64                  dts_origin,
74                                          AP4_FragmentSampleTable*& sample_table);
75     AP4_Result         CreateSampleTable(AP4_Movie*                movie,
76                                          AP4_UI32                  track_id,
77                                          AP4_ByteStream*           sample_stream,
78                                          AP4_Position              moof_offset,
79                                          AP4_Position              mdat_payload_offset, // hack because MS doesn't implement the spec properly
80                                          AP4_UI64                  dts_origin,
81                                          AP4_FragmentSampleTable*& sample_table);
82 
83 private:
84     // members
85     AP4_ContainerAtom*  m_MoofAtom;
86     AP4_MfhdAtom*       m_MfhdAtom;
87 };
88 
89 #endif // _AP4_MOVIE_FRAGMENT_H_
90