|
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 #include "mcemanager.h" |
|
20 #include "mceinsessionobserver.h" |
|
21 #include "mcesessionobserver.h" |
|
22 #include "mcesession.h" |
|
23 #include "mcetransactiondatacontainer.h" |
|
24 #include "mceamrcodec.h" |
|
25 #include "mceh263codec.h" |
|
26 #include "mceavccodec.h" |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CMceManager::NewL |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 EXPORT_C CMceManager* CMceManager::NewL( |
|
36 const TUid& aAppUid, |
|
37 TMceTransactionDataContainer* aContainer ) |
|
38 { |
|
39 |
|
40 CMceManager* self = |
|
41 new (ELeave) CMceManager( aAppUid, aContainer ); |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 |
|
47 } |
|
48 |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CMceManager::~CMceManager |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 EXPORT_C CMceManager::~CMceManager() |
|
55 { |
|
56 if (iContainer) |
|
57 { |
|
58 iContainer->Clear(); |
|
59 iContainer = 0; |
|
60 } |
|
61 |
|
62 iSessions.Reset(); |
|
63 iSessions.Close(); |
|
64 |
|
65 iSupportedAudioCodecs.ResetAndDestroy(); |
|
66 iSupportedVideoCodecs.ResetAndDestroy(); |
|
67 |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CMceManager::SetInSessionObserver |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 EXPORT_C void CMceManager::SetInSessionObserver( |
|
75 MMceInSessionObserver* aInSessionObserver ) |
|
76 { |
|
77 iInSessionObserver = aInSessionObserver; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CMceManager::SetInEventObserver |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 EXPORT_C void CMceManager::SetInEventObserver( |
|
85 MMceInEventObserver* /*aInEventObserver*/ ) |
|
86 { |
|
87 // NOP |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CMceManager::SetInReferObserver |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 EXPORT_C void CMceManager::SetInReferObserver( |
|
95 MMceInReferObserver* /*aInReferObserver*/ ) |
|
96 { |
|
97 // NOP |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CMceManager::SetSessionObserver |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 EXPORT_C void CMceManager::SetSessionObserver( |
|
105 MMceSessionObserver* aSessionObserver ) |
|
106 { |
|
107 iSessionObserver = aSessionObserver; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CMceManager::SetEventObserver |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C void CMceManager::SetEventObserver( |
|
115 MMceEventObserver* /*aEventObserver*/ ) |
|
116 { |
|
117 // NOP |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CMceManager::SetReferObserver |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C void CMceManager::SetReferObserver( |
|
125 MMceReferObserver* /*aReferObserver*/ ) |
|
126 { |
|
127 // NOP |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CMceManager::SetMediaObserver |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C void CMceManager::SetMediaObserver( |
|
135 MMceStreamObserver* aMediaObserver ) |
|
136 { |
|
137 iMediaObserver = aMediaObserver; |
|
138 } |
|
139 |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CMceManager::SetRtpObserver |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 EXPORT_C void CMceManager::SetRtpObserver( |
|
146 MMceRtpObserver* aRtpObserver ) |
|
147 { |
|
148 iRtpObserver = aRtpObserver; |
|
149 } |
|
150 |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CMceManager::SupportedAudioCodecs |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C const RPointerArray<const CMceAudioCodec>& |
|
157 CMceManager::SupportedAudioCodecs() const |
|
158 { |
|
159 return iSupportedAudioCodecs; |
|
160 } |
|
161 |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 EXPORT_C const RPointerArray<const CMceVideoCodec>& |
|
168 CMceManager::SupportedVideoCodecs() const |
|
169 { |
|
170 return iSupportedVideoCodecs; |
|
171 } |
|
172 |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CMceManager::Sessions |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 EXPORT_C const RPointerArray<CMceSession>& CMceManager::Sessions() const |
|
179 { |
|
180 return iSessions; |
|
181 } |
|
182 |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // CMceManager::SetDefaultHeadersL |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 EXPORT_C void CMceManager::SetDefaultHeadersL( CDesC8Array* aMethods, |
|
189 CDesC8Array* aHeaders ) |
|
190 { |
|
191 delete aMethods; |
|
192 delete aHeaders; |
|
193 } |
|
194 |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // CMceManager::DefaultHeadersL |
|
198 // ----------------------------------------------------------------------------- |
|
199 // |
|
200 EXPORT_C CDesC8Array* CMceManager::DefaultHeadersL( const TDesC8& /*aMethod*/ ) const |
|
201 { |
|
202 return NULL; |
|
203 } |
|
204 |
|
205 |
|
206 // ----------------------------------------------------------------------------- |
|
207 // CMceManager::InSessionObserver |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 MMceInSessionObserver* CMceManager::InSessionObserver() const |
|
211 { |
|
212 return iInSessionObserver; |
|
213 } |
|
214 |
|
215 |
|
216 // ----------------------------------------------------------------------------- |
|
217 // CMceManager::SessionObserver |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 MMceSessionObserver* CMceManager::SessionObserver() const |
|
221 { |
|
222 return iSessionObserver; |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CMceManager::MediaObserver |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 MMceStreamObserver* CMceManager::MediaObserver() const |
|
230 { |
|
231 return iMediaObserver; |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // CMceManager::RtpObserver |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 MMceRtpObserver* CMceManager::RtpObserver() const |
|
239 { |
|
240 return iRtpObserver; |
|
241 } |
|
242 |
|
243 |
|
244 // ----------------------------------------------------------------------------- |
|
245 // CMceManager::TransactionContainer |
|
246 // ----------------------------------------------------------------------------- |
|
247 // |
|
248 TMceTransactionDataContainer* CMceManager::TransactionContainer() const |
|
249 { |
|
250 return iContainer; |
|
251 } |
|
252 |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CMceManager::CMceManager |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 CMceManager::CMceManager( const TUid& /*aAppUid*/, |
|
259 TMceTransactionDataContainer* aContainer ) |
|
260 :iContainer( aContainer ) |
|
261 { |
|
262 |
|
263 } |
|
264 |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // CMceManager::ConstructL |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 void CMceManager::ConstructL() |
|
271 { |
|
272 // Fake having PCMU codec |
|
273 iSupportedAudioCodecs.AppendL( CMceAmrCodec::NewLC( KMceSDPNamePCMU() ) ); |
|
274 CleanupStack::Pop(); |
|
275 |
|
276 iSupportedAudioCodecs.AppendL( CMceAmrCodec::NewLC( KMceSDPNameAMR() ) ); |
|
277 CleanupStack::Pop(); |
|
278 |
|
279 // Avc codec, level default 1 |
|
280 iSupportedVideoCodecs.AppendL( CMceAvcCodec::NewLC( KMceSDPNameH264() ) ); |
|
281 CleanupStack::Pop(); |
|
282 |
|
283 // Avc codec, level default 1, no profile id or constraint set defined |
|
284 CMceVideoCodec* avc_2nd_Level_1 = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
285 avc_2nd_Level_1->SetAllowedBitrates( KMceAvcBitrateLevel1 ); |
|
286 iSupportedVideoCodecs.AppendL( avc_2nd_Level_1 ); |
|
287 CleanupStack::Pop( avc_2nd_Level_1 ); |
|
288 |
|
289 // Avc codec, level 1_3 |
|
290 CMceVideoCodec* avcLevel_1_3 = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
291 avcLevel_1_3->SetAllowedBitrates( KMceAvcCodecProfileIdBaseline | |
|
292 KMceAvcCodecProfileIopConstraintSet | |
|
293 KMceAvcBitrateLevel1_3 ); |
|
294 iSupportedVideoCodecs.AppendL( avcLevel_1_3 ); |
|
295 CleanupStack::Pop( avcLevel_1_3 ); |
|
296 |
|
297 // H263 codec |
|
298 iSupportedVideoCodecs.AppendL( CMceH263Codec::NewLC( KMceSDPNameH2632000() ) ); |
|
299 CleanupStack::Pop(); |
|
300 } |
|
301 |
|
302 |