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/*********************************************************************************/
19/*     -------------------------------------------------------------------       */
20/*                            MPEG-4 Movie Fragment Atom Class                             */
21/*     -------------------------------------------------------------------       */
22/*********************************************************************************/
23/*
24*/
25
26
27#ifndef MOVIEFRAGMENTATOM_H_INCLUDED
28#define MOVIEFRAGMENTATOM_H_INCLUDED
29
30#ifndef ATOM_H_INCLUDED
31#include "atom.h"
32#endif
33
34#ifndef TRACKFRAGMENTRUNATOM_H_INCLUDED
35#include "trackfragmentrunatom.h"
36#endif
37
38#ifndef TRACKFRAGMENTATOM_H_INCLUDED
39#include "trackfragmentatom.h"
40#endif
41
42#ifndef MOVIEFRAGMENTHEADERATOM_H_INCLUDED
43#include "moviefragmentheaderatom.h"
44#endif
45
46class MovieFragmentAtom : public Atom
47{
48
49    public:
50
51        MovieFragmentAtom(MP4_FF_FILE *fp,
52                          uint32 &size,
53                          uint32 type,
54                          TrackDurationContainer *trackDurationContainer,
55                          Oscl_Vector<TrackExtendsAtom*, OsclMemAllocator> *trackExtendAtomVec,
56                          bool &parseMoofCompletely,
57                          bool &moofParsingCompleted,
58                          uint32 &countOfTrunsParsed);
59
60
61        virtual ~MovieFragmentAtom();
62
63        int32 getSequenceNumber()
64        {
65            if (_pMovieFragmentHeaderAtom != NULL)
66                return _pMovieFragmentHeaderAtom->getSequenceNumber();
67            return 0;
68        }
69
70        void ParseMoofAtom(MP4_FF_FILE *fp,
71                           uint32 &size,
72                           uint32 type,
73                           TrackDurationContainer *trackDurationContainer,
74                           Oscl_Vector<TrackExtendsAtom*, OsclMemAllocator> *trackExtendAtomVec,
75                           bool &moofParsingCompleted,
76                           uint32 &countOfTrunsParsed);
77
78
79        uint64 getDataOffset();
80        uint32 getSampleCount();
81        Oscl_Vector<TFrunSampleTable*, OsclMemAllocator> getSampleTable();
82        uint64 getBaseDataOffset();
83        uint32 getSampleDescriptionIndex();
84        uint32 getDefaultSampleDuration();
85        uint32 getDefaultSampleSize();
86        uint32 getDefaultSampleFlags();
87        int32 getNextBundledAccessUnits(const uint32 trackID, uint32 *n, uint32 totalSampleRead, GAU *pgau);
88        int32 peekNextBundledAccessUnits(const uint32 trackID, uint32 *n,
89                                         uint32 totalSampleRead,
90                                         MediaMetaInfo *mInfo);
91
92        TrackFragmentAtom * getTrackFragmentforID(uint32 id);
93
94        uint32 _currentTrackFragmentOffset;
95        int32 resetPlayback(uint32 trackID, uint32 time,
96                            uint32 traf_number, uint32 trun_number,
97                            uint32 sample_num);
98        void resetPlayback();
99        uint32 getCurrentTrafDuration(uint32 id);
100        uint32 getTotalSampleInTraf(uint32 id);
101        int32 getOffsetByTime(uint32 id, uint32 ts, int32* sampleFileOffset);
102
103
104
105    private:
106        MovieFragmentHeaderAtom * _pMovieFragmentHeaderAtom;
107        TrackFragmentAtom *_pTrackFragmentAtom;
108        Oscl_Vector<TrackFragmentAtom*, OsclMemAllocator> *_ptrackFragmentArray;
109        uint32 _pMovieFragmentCurrentOffset;
110        uint32 _pMovieFragmentBaseOffset;
111        uint32 _trafIndex;
112        PVLogger *iLogger, *iStateVarLogger, *iParsedDataLogger;
113        bool parseTrafCompletely;
114        bool trafParsingCompleted;
115        uint32 sizeRemaining;
116        uint32 atomtype;
117
118};
119
120#endif
121
122