• 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 /*
19     This PVA_FF_TimeToSampleAtom Class contains a compact version of a table that allows
20     indexing from decoding to sample number.
21 */
22 
23 
24 #ifndef __TimeToSampleAtom_H__
25 #define __TimeToSampleAtom_H__
26 
27 #include "fullatom.h"
28 
29 #define PV_ERROR -1
30 
31 class PVA_FF_TimeToSampleAtom : public PVA_FF_FullAtom
32 {
33 
34     public:
35         PVA_FF_TimeToSampleAtom(uint32 mediaType); // Constructor
36         virtual ~PVA_FF_TimeToSampleAtom();
37 
38         // Member gets and sets
getEntryCount()39         uint32 getEntryCount() const
40         {
41             return _entryCount;
42         }
43 
44         void nextSample(uint32 ts);
45 
46         void updateLastTSEntry(uint32 ts);
47         // Rendering the PVA_FF_Atom in proper format (bitlengths, etc.) to an ostream
48         virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp);
49 
50     private:
51         void addDelta(int32 delta);
52         void addEntry(uint32 count, int32 delta);
53         void insertEntryAt(int32 index, uint32 count, int32 delta);
54         void replaceEntryAt(int32 index, uint32 count, int32 delta);
55 
56         virtual void recomputeSize();
57 
58         uint32 _entryCount;
59 
60         Oscl_Vector<uint32, OsclMemAllocator> *_psampleCountVec;
61         Oscl_Vector<int32, OsclMemAllocator>  *_psampleDeltaVec;
62 
63         int32 _mediaType;
64 
65         // For visual samples
66         uint32 _currentTimestamp;
67 
68         // Flag to say when the first entry has been received
69         bool _firstEntry;
70 
71         bool _lastTSUpdated;
72 };
73 
74 
75 #endif
76 
77