|
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 * A header file for implementation class of AVC editing API. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef VEDAVCEDITIMP_H |
|
23 #define VEDAVCEDITIMP_H |
|
24 |
|
25 // INCLUDES |
|
26 #include "avcdapi.h" |
|
27 #include "vedavcedit.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * CTranscoder Implementation class |
|
35 * @lib VEDAVCEDIT.LIB |
|
36 * @since |
|
37 */ |
|
38 |
|
39 NONSHARABLE_CLASS(CVedAVCEditImp) : public CVedAVCEdit |
|
40 { |
|
41 |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 */ |
|
47 static CVedAVCEditImp* NewL(); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CVedAVCEditImp(); |
|
53 |
|
54 public: // Functions from CVedAVCEdit |
|
55 |
|
56 /** |
|
57 * From CVedAVCEdit Add MDF specific NAL headers to input AVC frame |
|
58 */ |
|
59 void ProcessAVCBitStreamL(TDes8& aBuf, TInt& aFrameLen, TInt aDecInfoSize, TBool aFirstFrame); |
|
60 |
|
61 /** |
|
62 * From CVedAVCEdit Calculate default value for max no. of buffered frames |
|
63 */ |
|
64 TInt GetMaxAVCFrameBuffering(TInt aLevel, TSize aResolution); |
|
65 |
|
66 /** |
|
67 * From CVedAVCEdit Get input bitstream level from SPS |
|
68 */ |
|
69 TInt GetLevel(TDesC8& aBuf, TInt& aLevel); |
|
70 |
|
71 /** |
|
72 * From CVedAVCEdit Get input bitstream resolution from SPS |
|
73 */ |
|
74 TInt GetResolution(TDesC8& aBuf, TSize& aResolution); |
|
75 |
|
76 #ifdef VIDEOEDITORENGINE_AVC_EDITING |
|
77 |
|
78 /** |
|
79 * From CVedAVCEdit Convert AVC decoder config info to AVCDecoderConfigurationRecord -format |
|
80 */ |
|
81 void ConvertAVCHeaderL(TDesC8& aSrcBuf, TDes8& aDstBuf ); |
|
82 |
|
83 /** |
|
84 * From CVedAVCEdit Save SPS/PPS NAL units from AVCDecoderConfigurationRecord |
|
85 */ |
|
86 void SaveAVCDecoderConfigurationRecordL(TDes8& aBuf, TBool aFromEncoder); |
|
87 |
|
88 /** |
|
89 * From CVedAVCEdit Update slice header information: frame number and PPS id |
|
90 */ |
|
91 TInt ParseFrame(HBufC8*& aBuf, TBool aContainsDCR, TBool aFromEncoder); |
|
92 |
|
93 /** |
|
94 * From CVedAVCEdit Constructs AVCDecoderConfigurationRecord for the output sequence |
|
95 */ |
|
96 void ConstructAVCDecoderConfigurationRecordL( TDes8& aDstBuf ); |
|
97 |
|
98 /** |
|
99 * From CVedAVCEdit Set length of NAL size field of output sequence |
|
100 */ |
|
101 void inline SetNALLengthSize( TInt aSize ) { iNalLengthSize = aSize; } |
|
102 |
|
103 /** |
|
104 * From CVedAVCEdit Set output level for constructing AVCDecoderConfigurationRecord |
|
105 */ |
|
106 void inline SetOutputLevel(TInt aLevel) { iOutputLevel = aLevel; } |
|
107 |
|
108 /** |
|
109 * From CVedAVCEdit Check if encoding is required until the next IDR unit |
|
110 */ |
|
111 TBool EncodeUntilIDR(); |
|
112 |
|
113 /** |
|
114 * From CVedAVCEdit Check if NAL unit is an IDR NAL |
|
115 */ |
|
116 TBool IsNALUnitIDR( TDes8& aNalBuf ); |
|
117 |
|
118 /** |
|
119 * From CVedAVCEdit Store PPS id from current slice |
|
120 */ |
|
121 void StoreCurrentPPSId( TDes8& aNalBuf ); |
|
122 |
|
123 /** |
|
124 * From CVedAVCEdit Generate a not coded frame |
|
125 */ |
|
126 TInt GenerateNotCodedFrame( TDes8& aNalBuf, TUint aFrameNumber ); |
|
127 |
|
128 /** |
|
129 * From CVedAVCEdit Modify the frame number of the NAL unit |
|
130 */ |
|
131 void ModifyFrameNumber( TDes8& aNalBuf, TUint aFrameNumber ); |
|
132 |
|
133 private: // Private methods |
|
134 |
|
135 /* |
|
136 * Saves one SPS/PPS NAL unit for later use |
|
137 * |
|
138 * @param aBuf Input buffer containing AVCDecoderConfigurationRecord |
|
139 */ |
|
140 TInt ParseOneNAL(void *aNalUnitData, TUint* aNalUnitLength, TBool aFromEncoder); |
|
141 |
|
142 TInt ParseParameterSet(void *aNalUnitData, TUint* aNalUnitLength, TBool aFromEncoder); |
|
143 #endif |
|
144 |
|
145 private: |
|
146 |
|
147 /** |
|
148 * C++ default constructor. |
|
149 */ |
|
150 CVedAVCEditImp(); |
|
151 |
|
152 /** |
|
153 * 2nd phase constructor |
|
154 */ |
|
155 void ConstructL(); |
|
156 |
|
157 private: // Data |
|
158 |
|
159 avcdDecoder_t* iAvcDecoder; // For parsing AVC content / for CD operations |
|
160 |
|
161 TInt iFrameLengthBytes; // no. of bytes used for length field |
|
162 |
|
163 #ifdef VIDEOEDITORENGINE_AVC_EDITING |
|
164 |
|
165 TInt iNalLengthSize; // The number of bytes used to signal NAL unit's length |
|
166 |
|
167 TInt iOutputLevel; // output level |
|
168 |
|
169 #endif |
|
170 |
|
171 }; |
|
172 |
|
173 |
|
174 #endif |
|
175 |
|
176 // End of File |