• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 __TrackFragmentRunAtom_H__
19 #define __TrackFragmentRunAtom_H__
20 
21 #include "fullatom.h"
22 #include "a_atomdefs.h"
23 #include "atomutils.h"
24 
25 #define TRACK_RUN_ATOM_FLAGS    0x00000701  // flag specify that only data offset, sample duration,
26 // sample size and sample flags are present
27 
28 #define KEY_FRAME_ENTRY             0x010000
29 
30 struct PVA_FF_TrackRunSample
31 {
32     uint32      sampleDuration;
33     uint32      sampleSize;
34     uint32      sampleFlags;
35     uint32      sampleCompositionTimeOffset;    // not in use
36 };
37 
38 class PVA_FF_TrackFragmentRunAtom : public PVA_FF_FullAtom
39 {
40 
41     public:
42         PVA_FF_TrackFragmentRunAtom();
43 
44         virtual ~PVA_FF_TrackFragmentRunAtom();
45 
46         void    setFlags(uint32 flags);
47         void    setDataOffset(uint32 offset);
48         void    addSample(uint32 size, uint32 ts, uint8 flags);
49         void    updateLastTSEntry(uint32 ts);
50 
51         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP* fp);
getSampleCount()52         uint32 getSampleCount() const
53         {
54             return _sampleCount;
55         }
56     private:
57 
58         uint32      _currentTimestamp;
59         uint8       _firstEntry;
60 
61         uint32      _sampleCount;
62         uint32      _dataOffset;
63         uint32      _firstSampleFlags;
64         bool        _lastTSupdated;
65 
66         Oscl_Vector<PVA_FF_TrackRunSample, OsclMemAllocator>* _psampleEntriesVec;
67 
68         virtual void recomputeSize();
69 };
70 
71 #endif
72