|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * Header for VOL header parser. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __VEDVOLREADER_H__ |
|
23 #define __VEDVOLREADER_H__ |
|
24 |
|
25 |
|
26 // INCLUDES |
|
27 #include <e32base.h> |
|
28 #include <e32std.h> |
|
29 #include <vedcommon.h> |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 // DATA TYPES |
|
36 |
|
37 /** |
|
38 * Structure for the Video Object Layer header data |
|
39 */ |
|
40 struct TVolHeader |
|
41 { |
|
42 TInt iProfileLevelId; // Indicates the Level Id (0,1,2,3,4,8 or 9) of the Simple |
|
43 // Profile the Video Object conforms to |
|
44 TInt iVoPriority; // Priority assigned to the Video Object |
|
45 // a value between 1(lowest)-7(highest). |
|
46 // If not in the bitstream, set to zero |
|
47 |
|
48 TInt iVoId; // id of the Video Object |
|
49 TInt iVolId; // id of the Video Object Layer |
|
50 TInt iRandomAccessibleVol;// set to 1 if all the VOPs in the stream are I-VOP. |
|
51 TInt iPixelAspectRatio; // see MPEG-4 visual spec. pp. 71 |
|
52 |
|
53 TInt iTimeIncrementResolution; |
|
54 // Resolution to interpret the time_increment |
|
55 // fields in the VOP headers |
|
56 |
|
57 TInt iLumWidth; // Frame width of the Y component in pixels |
|
58 TInt iLumHeight; // Frame height of the Y component in pixels |
|
59 |
|
60 TUint8 iErrorResDisable; // Flag ON if no resynchronization markers are |
|
61 // used inside frames. |
|
62 // When OFF it doesn't mean they ARE used. |
|
63 TUint8 iDataPartitioned; // Flag indicating if data partitioning inside |
|
64 // a VP is used or not. |
|
65 TUint8 iReversibleVlc; // flag indicating the usage of reversible |
|
66 // VLC codes |
|
67 |
|
68 // the following parameters concern the input video signal, |
|
69 // see MPEG-4 visual spec. pp. 66-70, and "Note" in viddemux_mpeg.c |
|
70 // Not used in the current implementatnion. |
|
71 TInt iVideoFormat; |
|
72 TInt iVideoRange; |
|
73 TInt iColourPrimaries; |
|
74 TInt iTransferCharacteristics; |
|
75 TInt iMatrixCoefficients; |
|
76 |
|
77 // the following parameters are used in the Video Buffering Verifier |
|
78 // (Annex D) to monitor the input bit buffer, complexity, memory buffer |
|
79 // used in the decoding process. The conformance of a stream can be checked |
|
80 // using these parameters. |
|
81 // Not used in the current implementatnion. |
|
82 TUint32 iBitRate; |
|
83 TUint32 iVbvBufferSize; |
|
84 TUint32 iVbvOccupancy; |
|
85 |
|
86 HBufC8* iUserData; // User Data if available |
|
87 }; |
|
88 |
|
89 |
|
90 |
|
91 // CLASS DECLARATION |
|
92 |
|
93 /** |
|
94 * A class for parsing the Video Object Layer header |
|
95 */ |
|
96 class CVedVolReader : public CBase |
|
97 { |
|
98 public: |
|
99 |
|
100 /** |
|
101 * Two-phased constructor. |
|
102 */ |
|
103 IMPORT_C static CVedVolReader* NewL(); |
|
104 |
|
105 /** |
|
106 * Destructor. |
|
107 */ |
|
108 virtual ~CVedVolReader(); |
|
109 |
|
110 /** |
|
111 * Parses given Video Object Layer header |
|
112 * @param aData Buffer from where to parse the header |
|
113 * @return error code |
|
114 */ |
|
115 IMPORT_C TInt ParseVolHeaderL(TDesC8& aData); |
|
116 |
|
117 /** |
|
118 * Returns the time increment resolution that was read from the VOL header |
|
119 * @return time increment resolution |
|
120 */ |
|
121 IMPORT_C TInt TimeIncrementResolution() const; |
|
122 |
|
123 /** |
|
124 * Returns the width of the video that was read from the VOL header |
|
125 * @return width |
|
126 */ |
|
127 IMPORT_C TInt Width() const; |
|
128 |
|
129 /** |
|
130 * Returns the height of the video that was read from the VOL header |
|
131 * @return height |
|
132 */ |
|
133 IMPORT_C TInt Height() const; |
|
134 |
|
135 /** |
|
136 * Returns the Level Id of the Simple Profile the Video Object conforms to |
|
137 * @return profile level Id |
|
138 */ |
|
139 IMPORT_C TInt ProfileLevelId() const; |
|
140 |
|
141 /** |
|
142 * Returns the bitstream mode of the video |
|
143 * @return bitstream mode |
|
144 */ |
|
145 IMPORT_C TVedVideoBitstreamMode BitstreamMode() const; |
|
146 |
|
147 /** |
|
148 * Returns the size of the VOL header |
|
149 * @return size of the header |
|
150 */ |
|
151 IMPORT_C TInt HeaderSize() const; |
|
152 |
|
153 private: |
|
154 |
|
155 /** |
|
156 * Structure for internal buffer of the header sequence |
|
157 */ |
|
158 struct TSeqHeaderBuffer |
|
159 { |
|
160 TDesC8& iData; // The actual data of the buffer |
|
161 TInt iGetIndex; // Index of getting from the buffer |
|
162 TInt iBitInOctet; // Bit index in the buffer |
|
163 |
|
164 TSeqHeaderBuffer(TDesC8& aData, TInt aGetIndex, TInt aBitInOctet) : |
|
165 iData(aData), iGetIndex(aGetIndex), iBitInOctet(aBitInOctet) {} |
|
166 }; |
|
167 |
|
168 /** |
|
169 * C++ default constructor. |
|
170 */ |
|
171 CVedVolReader(); |
|
172 |
|
173 /** |
|
174 * By default Symbian OS constructor is private. |
|
175 */ |
|
176 void ConstructL(); |
|
177 |
|
178 /** |
|
179 * Reads requested bits from given buffer |
|
180 * @param aBuffer Buffer from where to read the bits |
|
181 * @param aNumBits Amount of bits to read |
|
182 * @param aFlush Discard the bits that were read |
|
183 * @return The bits that were read |
|
184 */ |
|
185 TUint32 ReadSeqHeaderBits(TSeqHeaderBuffer& aBuffer, TInt aNumBits, TBool aFlush); |
|
186 |
|
187 /** |
|
188 * Reads user data from given buffer |
|
189 * @param aBuffer Buffer from where to read the user data |
|
190 */ |
|
191 void ReadUserDataL(TSeqHeaderBuffer& aBuffer); |
|
192 |
|
193 /** |
|
194 * Checks what is the bit stream mode the video |
|
195 * @param aErd Flag error resilience disable used |
|
196 * @param aDp Flag data partitioned used |
|
197 * @param aRvlc Flag reversible vlc used |
|
198 * @return The bit stream mode |
|
199 */ |
|
200 TVedVideoBitstreamMode CheckBitstreamMode(TUint8 aErd, TUint8 aDp, TUint8 aRvlc); |
|
201 |
|
202 private: |
|
203 |
|
204 // Member variables |
|
205 |
|
206 static const TInt KMaxUserDataLength; // The maximum allocated memory for |
|
207 // user data (UD). Only this much of the UD |
|
208 // from the bitstream is stored |
|
209 |
|
210 static const TUint8 KMsbMask[8]; // Mask for extracting the needed bits |
|
211 static const TUint8 KLsbMask[9]; |
|
212 |
|
213 TVolHeader iHeader; // For storing the header data |
|
214 |
|
215 TVedVideoBitstreamMode iBitstreamMode; |
|
216 TInt iHeaderSize; |
|
217 |
|
218 }; |
|
219 |
|
220 #endif // __VEDVOLREADER_H__ |
|
221 |