|
1 /* |
|
2 * Copyright (c) 2006 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 |
|
20 |
|
21 #ifndef MCECOMAVCCODEC_H |
|
22 #define MCECOMAVCCODEC_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <mceavccodec.h> |
|
26 #include "mcecomvideocodec.h" |
|
27 #include "mcedefs.h" |
|
28 |
|
29 const TReal KMceAvcDefaultFrameRate = 15; |
|
30 const TInt KMceAvcDefaultFrameSize = 10000; |
|
31 const TInt KMceAvcDefaultAllowedBitrate = KMceAvcCodecProfileIdBaseline | |
|
32 KMceAvcCodecProfileIopConstraintSet | |
|
33 KMceAvcBitrateLevel1; |
|
34 |
|
35 const TInt KMceAvcAllowedBitrateRecommendedHigh = KMceAvcCodecProfileIdBaseline | |
|
36 KMceAvcCodecProfileIopConstraintSet | |
|
37 KMceAvcBitrateLevel1b; |
|
38 |
|
39 const TInt KMceAvcLevel1BitrateBps = 64000; |
|
40 const TInt KMceAvcLevel1bBitrateBps = 128000; |
|
41 const TInt KMceAvcLevel11BitrateBps = 192000; |
|
42 const TInt KMceAvcLevel12BitrateBps = 384000; |
|
43 const TInt KMceAvcLevel13BitrateBps = 768000; |
|
44 const TInt KMceAvcLevel2BitrateBps = 2000000; |
|
45 |
|
46 const TUint KMceAvcDefaultFrameHeight = 176; |
|
47 const TUint KMceAvcDefaultFrameWidth = 144; |
|
48 |
|
49 |
|
50 // CLASS DECLARATION |
|
51 /** |
|
52 * Container class for the codec information. |
|
53 * |
|
54 * @lib |
|
55 */ |
|
56 class CMceComAvcCodec : public CMceComVideoCodec |
|
57 { |
|
58 public: // Constructors and destructor |
|
59 |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 * @param aSdpName sdp name |
|
63 */ |
|
64 static CMceComAvcCodec* NewL( TBuf8<KMceMaxSdpNameLength> aSdpName ); |
|
65 |
|
66 /** |
|
67 * Two-phased constructor. |
|
68 * @param aSdpName sdp name |
|
69 */ |
|
70 static CMceComAvcCodec* NewLC( TBuf8<KMceMaxSdpNameLength> aSdpName ); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 ~CMceComAvcCodec(); |
|
76 |
|
77 public: // from CMceComCodec |
|
78 |
|
79 /** |
|
80 * Sets bitrate used with codec for encoding. |
|
81 * @param aBitrate bitrate value for encoding |
|
82 * @return KErrNotSupported if codec doesn't support bitrate |
|
83 * value issued |
|
84 */ |
|
85 TInt SetBitrate( TUint aBitrate ); |
|
86 |
|
87 /** |
|
88 * Sets bitrates allowed with codec. |
|
89 * @param aBitrates allowed bitrate values |
|
90 * @return KErrNotSupported if codec doesn't support bitrate |
|
91 * values issued |
|
92 */ |
|
93 TInt SetAllowedBitrates( TUint aBitrates ); |
|
94 |
|
95 /** |
|
96 * Returns max bit rate |
|
97 * @return max bit rate |
|
98 */ |
|
99 TUint GetMaxBitRate(); |
|
100 |
|
101 /** |
|
102 * Sets maximum bitrate of the codec. |
|
103 * @param aMaxBitrate value of maximum bitrate used for encoding |
|
104 * @return KErrNotSupported if codec doesn't support bitrate |
|
105 * values issued |
|
106 */ |
|
107 TInt SetMaxBitrate( TUint aMaxBitrate ); |
|
108 |
|
109 /** |
|
110 * Resolve allowed bitrates based on given bitrate value. |
|
111 * @param aBitrate |
|
112 * @param aAllowedBitrates, on return contains allowed bitrates |
|
113 * @return error code |
|
114 */ |
|
115 TInt ResolveAllowedBitrates( TUint aBitrate, TUint& aAllowedBitrates ); |
|
116 |
|
117 /** |
|
118 * Return ETrue, if this codec decodes rtpmap value |
|
119 * @param aRtpmapValue rtp map |
|
120 * @param aFmtpValue fmtp |
|
121 * @param aIsStrictMatch, EFalse if matching is less strict |
|
122 * @return ETrue, if this codec decodes rtpmap value |
|
123 */ |
|
124 TBool Decodes( const TDesC8& aRtpmapValue, |
|
125 const TDesC8& aFmtpValue, |
|
126 TBool aIsStrictMatch = ETrue ); |
|
127 |
|
128 #ifdef MCE_COMMON_SERVER_SIDE |
|
129 |
|
130 /** |
|
131 * Used for storing fmtp proposal but the value is not set as official |
|
132 * fmtp of the codec. Pre-check for fmtp validity |
|
133 * @param aFmtpProposal |
|
134 * @return ETrue if fmtp is valid |
|
135 */ |
|
136 TBool SetFmtpProposalL( const TDesC8& aFmtpProposal ); |
|
137 |
|
138 /** |
|
139 * Set fmtp |
|
140 * @param aReset if ETrue reset fmtp, EFalse append |
|
141 */ |
|
142 void SetFmtpFromIncomingSdpL( const TDesC8& aFmtpAttribute, |
|
143 TBool aRoleAnswerer, |
|
144 TBool aReset = KMceCodecFmtpReset ); |
|
145 |
|
146 /** |
|
147 * Create fmtp for outgoing sdp |
|
148 * @return fmtp, ownership is transferred |
|
149 */ |
|
150 HBufC8* FtmpForOutgoingSdpLC(); |
|
151 |
|
152 private: |
|
153 |
|
154 /** |
|
155 * Removed defined parameter from input parameter and returns it |
|
156 * @return stripped parameter if found, ownership is transferred |
|
157 */ |
|
158 HBufC8* StripFmtpParameterL( TPtr8& aInputFmtp, const TDesC8& aStrippedParameter ); |
|
159 |
|
160 /** |
|
161 * Adds parameter into fmtp. Also separators are added if needed. |
|
162 * @return fmtp containing input fmtp and addded parameter, ownership is transferred |
|
163 */ |
|
164 HBufC8* AddFmtpParameterL( const TDesC8& aInputFmtp, |
|
165 const TDesC8& aAddedParameter, |
|
166 const TDesC8& aAddedParameterVal ); |
|
167 |
|
168 #endif |
|
169 |
|
170 public: // serialization etc |
|
171 |
|
172 /** |
|
173 * Clones |
|
174 * @return clone |
|
175 */ |
|
176 CMceComVideoCodec* CloneL(); |
|
177 |
|
178 private: |
|
179 |
|
180 /** |
|
181 * C++ default constructor. |
|
182 */ |
|
183 CMceComAvcCodec(); |
|
184 |
|
185 /** |
|
186 * By default Symbian 2nd phase constructor is private. |
|
187 */ |
|
188 void ConstructL( TBuf8<KMceMaxSdpNameLength> aSdpName); |
|
189 |
|
190 /** |
|
191 * second-phase copy constructor |
|
192 */ |
|
193 void ConstructL( CMceComAvcCodec& aCodec ); |
|
194 |
|
195 /** |
|
196 * Profile-level-id value from fmtp |
|
197 */ |
|
198 TPtrC8 ParseProfileLevelId( const TDesC8& aFmtpValue ); |
|
199 |
|
200 /** |
|
201 * Packetization-mode value from fmtp |
|
202 */ |
|
203 TPtrC8 ParsePacketizationMode( const TDesC8& aFmtpValue ); |
|
204 |
|
205 /** |
|
206 * Profile-level value part from fmtp |
|
207 */ |
|
208 TPtrC8 ParseProfileLevelIdValPart( const TDesC8& aFmtpValue, |
|
209 TInt aValPartOffset, |
|
210 TInt aValPartLen, |
|
211 const TDesC8& aDefaultVal ); |
|
212 |
|
213 /** |
|
214 * Replace profile level value part of fmtp attribute. |
|
215 */ |
|
216 TInt ReplaceProfileLevelIdValuePart( TDes8& aModifiedFmtp, |
|
217 const TDesC8& aReplacement, |
|
218 TInt aValPartOffset ); |
|
219 |
|
220 /** |
|
221 * Get value part of certain fmtp attribute. |
|
222 */ |
|
223 TPtrC8 GetFmtpAttributeValuePart( const TDesC8& aFmtpValue, |
|
224 const TDesC8& aFmtpAttributeName, |
|
225 TInt aValLen, |
|
226 const TDesC8& aDefaultVal ); |
|
227 |
|
228 public: |
|
229 |
|
230 TUint8 iPacketizationMode; |
|
231 |
|
232 TUint8 iAllowedPacketizationModes; |
|
233 |
|
234 }; |
|
235 |
|
236 |
|
237 #endif // MCECOMAVCCODEC_H |
|
238 |
|
239 // End of File |