1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MCEAVCCODEC_H |
|
20 #define MCEAVCCODEC_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <mcevideocodec.h> |
|
24 #include <mcedefs.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 const TUint KMceAvcClockRate = 90000; |
|
29 |
|
30 // Allowedbitrates bitfield combines avc profile-level-id information in |
|
31 // similar manner as defined in RFC 3984. Most significant byte stores |
|
32 // profile-id value, seconds significant byte contains profile-iop value and |
|
33 // last two bytes contain profile-level information. |
|
34 // |
|
35 const TUint KMceAvcBitrateLevel1 = 0x0001; |
|
36 const TUint KMceAvcBitrateLevel1b = 0x0002; |
|
37 const TUint KMceAvcBitrateLevel1_1 = 0x0004; |
|
38 const TUint KMceAvcBitrateLevel1_2 = 0x0008; |
|
39 const TUint KMceAvcBitrateLevel1_3 = 0x0010; |
|
40 const TUint KMceAvcBitrateLevel2 = 0x0020; |
|
41 |
|
42 const TUint KMceAvcCodecProfileIopConstraintSet = 0x0100; |
|
43 const TUint KMceAvcCodecProfileIopConstraintSet1 = 0x0200; |
|
44 const TUint KMceAvcCodecProfileIopConstraintSet2 = 0x0400; |
|
45 |
|
46 const TUint KMceAvcCodecProfileIdBaseline = 0x1000; |
|
47 const TUint KMceAvcCodecProfileIdMain = 0x2000; |
|
48 const TUint KMceAvcCodecProfileIdExtended = 0x4000; |
|
49 const TUint KMceAvcCodecProfileIdHigh = 0x8000; |
|
50 |
|
51 const TUint KMceAllowedAvcBitrateAll = 0x00FF; |
|
52 |
|
53 // Different framerates may be supported depending on profile level. |
|
54 // |
|
55 const TUint KMceAvcFrameRate7_5 = 0x0001; |
|
56 const TUint KMceAvcFrameRate12_5 = 0x0002; |
|
57 const TUint KMceAvcFrameRate15 = 0x0004; |
|
58 const TUint KMceAvcFrameRate30 = 0x0008; |
|
59 const TUint KMceAvcFrameRate36 = 0x0010; |
|
60 |
|
61 const TUint KMceAllowedAvcFrameRateAll = 0x00FF; |
|
62 |
|
63 // Different resolutions may be supported depending on profile level. |
|
64 // |
|
65 const TUint KMceAvcResolution176x144 = 0x0001; |
|
66 const TUint KMceAvcResolution320x240 = 0x0002; |
|
67 const TUint KMceAvcResolution352x288 = 0x0004; |
|
68 |
|
69 const TUint KMceAllowedAvcResolutionAll = 0x000F; |
|
70 |
|
71 |
|
72 // DATA TYPES |
|
73 enum TAvcCodecMode |
|
74 { |
|
75 KMceAvcModeSingleNal, |
|
76 KMceAvcModeNonInterleaved, |
|
77 KMceAvcModeInterleaved |
|
78 }; |
|
79 |
|
80 |
|
81 // CLASS DECLARATION |
|
82 |
|
83 /** |
|
84 * Class for the H264 codec information. |
|
85 * |
|
86 * It checks the validity of inserted values for H264 |
|
87 * |
|
88 * @lib mceclient.lib |
|
89 */ |
|
90 class CMceAvcCodec : public CMceVideoCodec |
|
91 { |
|
92 |
|
93 public: // Constructors and destructor |
|
94 |
|
95 /** |
|
96 * Destructor. |
|
97 */ |
|
98 IMPORT_C ~CMceAvcCodec(); |
|
99 |
|
100 public: |
|
101 |
|
102 /** |
|
103 * Two-phased constructor. |
|
104 * @param aSdpName sdp name |
|
105 */ |
|
106 IMPORT_C static CMceAvcCodec* NewL( TBuf8<KMceMaxSdpNameLength> aSdpName); |
|
107 |
|
108 /** |
|
109 * Two-phased constructor. |
|
110 * @param aSdpName sdp name |
|
111 */ |
|
112 IMPORT_C static CMceAvcCodec* NewLC( TBuf8<KMceMaxSdpNameLength> aSdpName ); |
|
113 |
|
114 public: // From base classes |
|
115 |
|
116 /** |
|
117 * Sets bitrate used with codec for encoding. |
|
118 * @param aBitrate bitrate value for encoding |
|
119 * @return KErrNotSupported if codec doesn't support bitrate |
|
120 * value issued |
|
121 */ |
|
122 virtual TInt SetBitrate( TUint aBitrate ); |
|
123 |
|
124 /** |
|
125 * Sets bitrates allowed with codec. |
|
126 * @param aBitrates allowed bitrate values |
|
127 * @return KErrNotSupported if codec doesn't support bitrate |
|
128 * values issued |
|
129 */ |
|
130 virtual TInt SetAllowedBitrates( TUint aBitrates ); |
|
131 |
|
132 /** |
|
133 * Sets the codec specific mode. |
|
134 * @param aCodecMode mode of the codec |
|
135 * @return KErrNotSupported if codec doesnt' support codec mode |
|
136 * value issued |
|
137 */ |
|
138 virtual TInt SetCodecMode( TUint aCodecMode ); |
|
139 |
|
140 /** |
|
141 * Sets the payload type. |
|
142 * @param aPayloadType type identifier of the payload |
|
143 * @return KErrNotSupported if codec doesn't support payload type issued |
|
144 */ |
|
145 virtual TInt SetPayloadType( TUint8 aPayloadType ); |
|
146 |
|
147 /** |
|
148 * Clones the codec. |
|
149 * @return cloned codec; ownership is transferred |
|
150 */ |
|
151 virtual CMceVideoCodec* CloneL() const; |
|
152 |
|
153 /** |
|
154 * Sets maximum bitrate of the codec. |
|
155 * @param aMaxBitrate value of maximum bitrate used for encoding |
|
156 * @leave KErrNotSupported if codec doesn't support frame sizes issued |
|
157 */ |
|
158 virtual void SetMaxBitrateL( TUint aMaxBitrate ); |
|
159 |
|
160 /** |
|
161 * Sets resolutions allowed with the codec. |
|
162 * @param aResolutions bitfield of allowed resolutions |
|
163 * @leave KErrNotSupported if codec doesn't support resolutions issued |
|
164 */ |
|
165 virtual void SetAllowedResolutionsL( TUint aResolutions ); |
|
166 |
|
167 /** |
|
168 * Sets resolution of the video. |
|
169 * @param aResolution resolution of the video in pixels |
|
170 * @leave KErrNotSupported if codec doesn't support resolution issued |
|
171 */ |
|
172 virtual void SetResolutionL( TSize aResolution ); |
|
173 |
|
174 /** |
|
175 * Sets frame rates allowed with the codec. |
|
176 * @param aFrameRates allowed frame rate values as a bitfield |
|
177 * @leave KErrNotSupported if codec doesn't support frame rates issued |
|
178 */ |
|
179 virtual void SetAllowedFrameRatesL( TUint aFrameRates ); |
|
180 |
|
181 /** |
|
182 * Sets frame rate used with the codec for encoding. |
|
183 * @param aFrameRate frame rate for encoding |
|
184 * @leave KErrNotSupported if codec doesn't support frame rate value |
|
185 * issued |
|
186 */ |
|
187 virtual void SetFrameRateL( TReal aFrameRate ); |
|
188 |
|
189 /** |
|
190 * Sets preferred encoding device for uplink stream and preferred decoding |
|
191 * device for downlink stream. |
|
192 * @param aEncodingDecodingDevice |
|
193 * @leave KErrNotSupported if setting preferred device is not possible |
|
194 */ |
|
195 virtual void SetPreferredEncodingDecodingDeviceL( |
|
196 TUid aEncodingDecodingDevice ); |
|
197 |
|
198 /** |
|
199 * Set config key (sprop-parameter-sets) |
|
200 * @param aConfigKey, config key as Base64 encoded |
|
201 * @leave KErrNotSupported if setting config key is not possible |
|
202 */ |
|
203 virtual void SetConfigKeyL( const TDesC8& aConfigKey ); |
|
204 |
|
205 |
|
206 private: // Helper functions |
|
207 |
|
208 /** |
|
209 * Sets the sdp name. |
|
210 * @param aSdpName the sdp name |
|
211 */ |
|
212 void SetSdpNameL( const TDesC8& aSdpName ); |
|
213 |
|
214 private: // Constructors |
|
215 |
|
216 /** |
|
217 * C++ default constructor. |
|
218 */ |
|
219 CMceAvcCodec(); |
|
220 |
|
221 /** |
|
222 * By default Symbian 2nd phase constructor is private. |
|
223 */ |
|
224 void ConstructL( TBuf8<KMceMaxSdpNameLength> aSdpName); |
|
225 |
|
226 |
|
227 public: // Stub data |
|
228 |
|
229 TUint8 iPacketizationMode; |
|
230 |
|
231 TUint8 iAllowedPacketizationModes; |
|
232 |
|
233 |
|
234 //for testing |
|
235 |
|
236 MCE_UNIT_TEST_DEFS |
|
237 |
|
238 }; |
|
239 |
|
240 |
|
241 #endif |
|
242 |
|
243 // End of File |
|