|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <mmf/common/mmfaudio.h> |
|
17 #include "mmfstandardcustomcommands.h" |
|
18 #include "MMFVideoFrameMessage.h" |
|
19 #include "MMFSCCPanicCodes.h" |
|
20 #include <badesca.h> |
|
21 |
|
22 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
23 #include <mmf/common/mmfstandardcustomcommandsenums.h> |
|
24 #include <mmf/common/mmfstandardcustomcommandsimpl.h> |
|
25 #include <mmf/common/mmfvideoenums.h> |
|
26 #endif |
|
27 |
|
28 |
|
29 const TInt KBufExpandSize8 = 8;//two TInts! |
|
30 const TInt KBufExpandSize32 = 32; |
|
31 |
|
32 const TInt KBufMimeTypeGranularity = 4; |
|
33 const TInt KMaxMimeTypeLength = 256; |
|
34 |
|
35 class TMimeTypeBufferInfo |
|
36 { |
|
37 public: |
|
38 TInt32 count; |
|
39 TInt32 bufferLen; |
|
40 }; |
|
41 |
|
42 EXPORT_C RMMFAudioPlayDeviceCustomCommands::RMMFAudioPlayDeviceCustomCommands(RMMFController& aController) : |
|
43 RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlayDevice) |
|
44 { |
|
45 } |
|
46 |
|
47 EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetVolume(TInt aVolume) const |
|
48 { |
|
49 TPckgBuf<TMMFAudioConfig> configPackage; |
|
50 configPackage().iVolume = aVolume; |
|
51 return iController.CustomCommandSync(iDestinationPckg, |
|
52 EMMFAudioPlayDeviceSetVolume, |
|
53 configPackage, |
|
54 KNullDesC8); |
|
55 } |
|
56 |
|
57 |
|
58 EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetMaxVolume(TInt& aMaxVolume) const |
|
59 { |
|
60 TPckgBuf<TMMFAudioConfig> configPackage; |
|
61 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
62 EMMFAudioPlayDeviceGetMaxVolume, |
|
63 KNullDesC8, |
|
64 KNullDesC8, |
|
65 configPackage); |
|
66 if (!error) |
|
67 aMaxVolume = configPackage().iMaxVolume; |
|
68 return error; |
|
69 } |
|
70 |
|
71 EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetVolume(TInt& aVolume) const |
|
72 { |
|
73 TPckgBuf<TMMFAudioConfig> configPackage; |
|
74 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
75 EMMFAudioPlayDeviceGetVolume, |
|
76 KNullDesC8, |
|
77 KNullDesC8, |
|
78 configPackage); |
|
79 if (!error) |
|
80 aVolume = configPackage().iVolume; |
|
81 return error; |
|
82 } |
|
83 |
|
84 EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) const |
|
85 { |
|
86 TPckgBuf<TMMFAudioConfig> configPackage; |
|
87 configPackage().iRampDuration = aRampDuration; |
|
88 return iController.CustomCommandSync(iDestinationPckg, |
|
89 EMMFAudioPlayDeviceSetVolumeRamp, |
|
90 configPackage, |
|
91 KNullDesC8); |
|
92 } |
|
93 |
|
94 EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetBalance(TInt aBalance) const |
|
95 { |
|
96 TPckgBuf<TMMFAudioConfig> configPackage; |
|
97 configPackage().iBalance = aBalance; |
|
98 return iController.CustomCommandSync(iDestinationPckg, |
|
99 EMMFAudioPlayDeviceSetBalance, |
|
100 configPackage, |
|
101 KNullDesC8); |
|
102 } |
|
103 |
|
104 EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetBalance(TInt& aBalance) const |
|
105 { |
|
106 TPckgBuf<TMMFAudioConfig> configPackage; |
|
107 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
108 EMMFAudioPlayDeviceGetBalance, |
|
109 KNullDesC8, |
|
110 KNullDesC8, |
|
111 configPackage); |
|
112 if (!error) |
|
113 aBalance = configPackage().iBalance; |
|
114 return error; |
|
115 } |
|
116 |
|
117 EXPORT_C CMMFAudioPlayDeviceCustomCommandParser* CMMFAudioPlayDeviceCustomCommandParser::NewL(MMMFAudioPlayDeviceCustomCommandImplementor& aImplementor) |
|
118 { |
|
119 return new(ELeave) CMMFAudioPlayDeviceCustomCommandParser(aImplementor); |
|
120 } |
|
121 |
|
122 EXPORT_C CMMFAudioPlayDeviceCustomCommandParser::~CMMFAudioPlayDeviceCustomCommandParser() |
|
123 { |
|
124 } |
|
125 |
|
126 CMMFAudioPlayDeviceCustomCommandParser::CMMFAudioPlayDeviceCustomCommandParser(MMMFAudioPlayDeviceCustomCommandImplementor& aImplementor) : |
|
127 CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlayDevice), |
|
128 iImplementor(aImplementor) |
|
129 { |
|
130 } |
|
131 |
|
132 |
|
133 void CMMFAudioPlayDeviceCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
134 { |
|
135 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlayDevice) |
|
136 { |
|
137 TRAPD(error, DoHandleRequestL(aMessage)); |
|
138 if (error) |
|
139 aMessage.Complete(error); |
|
140 } |
|
141 else |
|
142 { |
|
143 aMessage.Complete(KErrNotSupported); |
|
144 } |
|
145 } |
|
146 |
|
147 void CMMFAudioPlayDeviceCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
148 { |
|
149 TBool complete = ETrue; |
|
150 switch (aMessage.Function()) |
|
151 { |
|
152 case EMMFAudioPlayDeviceSetVolume: |
|
153 complete = DoSetVolumeL(aMessage); |
|
154 break; |
|
155 case EMMFAudioPlayDeviceGetMaxVolume: |
|
156 complete = DoGetMaxVolumeL(aMessage); |
|
157 break; |
|
158 case EMMFAudioPlayDeviceGetVolume: |
|
159 complete = DoGetVolumeL(aMessage); |
|
160 break; |
|
161 case EMMFAudioPlayDeviceSetVolumeRamp: |
|
162 complete = DoSetVolumeRampL(aMessage); |
|
163 break; |
|
164 case EMMFAudioPlayDeviceSetBalance: |
|
165 complete = DoSetBalanceL(aMessage); |
|
166 break; |
|
167 case EMMFAudioPlayDeviceGetBalance: |
|
168 complete = DoGetBalanceL(aMessage); |
|
169 break; |
|
170 default: |
|
171 User::Leave(KErrNotSupported); |
|
172 break; |
|
173 } |
|
174 if (complete) |
|
175 aMessage.Complete(KErrNone); |
|
176 } |
|
177 |
|
178 |
|
179 TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetVolumeL(TMMFMessage& aMessage) |
|
180 { |
|
181 TPckgBuf<TMMFAudioConfig> pckg; |
|
182 aMessage.ReadData1FromClientL(pckg); |
|
183 iImplementor.MapdSetVolumeL(pckg().iVolume); |
|
184 return ETrue; |
|
185 } |
|
186 |
|
187 TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetMaxVolumeL(TMMFMessage& aMessage) |
|
188 { |
|
189 TInt maxVol = 0; |
|
190 iImplementor.MapdGetMaxVolumeL(maxVol); |
|
191 TPckgBuf<TMMFAudioConfig> pckg; |
|
192 pckg().iMaxVolume = maxVol; |
|
193 aMessage.WriteDataToClientL(pckg); |
|
194 return ETrue; |
|
195 } |
|
196 |
|
197 TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetVolumeL(TMMFMessage& aMessage) |
|
198 { |
|
199 TInt vol = 0; |
|
200 iImplementor.MapdGetVolumeL(vol); |
|
201 TPckgBuf<TMMFAudioConfig> pckg; |
|
202 pckg().iVolume = vol; |
|
203 aMessage.WriteDataToClientL(pckg); |
|
204 return ETrue; |
|
205 } |
|
206 |
|
207 TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetVolumeRampL(TMMFMessage& aMessage) |
|
208 { |
|
209 TPckgBuf<TMMFAudioConfig> pckg; |
|
210 aMessage.ReadData1FromClientL(pckg); |
|
211 iImplementor.MapdSetVolumeRampL(pckg().iRampDuration); |
|
212 return ETrue; |
|
213 } |
|
214 |
|
215 TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetBalanceL(TMMFMessage& aMessage) |
|
216 { |
|
217 TPckgBuf<TMMFAudioConfig> pckg; |
|
218 aMessage.ReadData1FromClientL(pckg); |
|
219 iImplementor.MapdSetBalanceL(pckg().iBalance); |
|
220 return ETrue; |
|
221 } |
|
222 |
|
223 TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetBalanceL(TMMFMessage& aMessage) |
|
224 { |
|
225 TInt bal = 0; |
|
226 iImplementor.MapdGetBalanceL(bal); |
|
227 TPckgBuf<TMMFAudioConfig> pckg; |
|
228 pckg().iBalance = bal; |
|
229 aMessage.WriteDataToClientL(pckg); |
|
230 return ETrue; |
|
231 } |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 EXPORT_C RMMFAudioRecordDeviceCustomCommands::RMMFAudioRecordDeviceCustomCommands(RMMFController& aController) : |
|
256 RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioRecordDevice) |
|
257 { |
|
258 } |
|
259 |
|
260 EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::SetGain(TInt aGain) const |
|
261 { |
|
262 TPckgBuf<TMMFAudioConfig> configPackage; |
|
263 configPackage().iGain = aGain; |
|
264 return iController.CustomCommandSync(iDestinationPckg, |
|
265 EMMFAudioRecordDeviceSetGain, |
|
266 configPackage, |
|
267 KNullDesC8); |
|
268 } |
|
269 |
|
270 EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetMaxGain(TInt& aMaxGain) const |
|
271 { |
|
272 TPckgBuf<TMMFAudioConfig> configPackage; |
|
273 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
274 EMMFAudioRecordDeviceGetMaxGain, |
|
275 KNullDesC8, |
|
276 KNullDesC8, |
|
277 configPackage); |
|
278 if (!error) |
|
279 aMaxGain = configPackage().iMaxGain; |
|
280 return error; |
|
281 } |
|
282 |
|
283 EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetGain(TInt& aGain) const |
|
284 { |
|
285 TPckgBuf<TMMFAudioConfig> configPackage; |
|
286 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
287 EMMFAudioRecordDeviceGetGain, |
|
288 KNullDesC8, |
|
289 KNullDesC8, |
|
290 configPackage); |
|
291 if (!error) |
|
292 aGain = configPackage().iGain; |
|
293 return error; |
|
294 } |
|
295 |
|
296 EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::SetBalance(TInt aBalance) const |
|
297 { |
|
298 TPckgBuf<TMMFAudioConfig> configPackage; |
|
299 configPackage().iBalance = aBalance; |
|
300 return iController.CustomCommandSync(iDestinationPckg, |
|
301 EMMFAudioRecordDeviceSetBalance, |
|
302 configPackage, |
|
303 KNullDesC8); |
|
304 } |
|
305 |
|
306 EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetBalance(TInt& aBalance) const |
|
307 { |
|
308 TPckgBuf<TMMFAudioConfig> configPackage; |
|
309 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
310 EMMFAudioRecordDeviceGetBalance, |
|
311 KNullDesC8, |
|
312 KNullDesC8, |
|
313 configPackage); |
|
314 if (!error) |
|
315 aBalance = configPackage().iBalance; |
|
316 return error; |
|
317 } |
|
318 |
|
319 EXPORT_C CMMFAudioRecordDeviceCustomCommandParser* CMMFAudioRecordDeviceCustomCommandParser::NewL(MMMFAudioRecordDeviceCustomCommandImplementor& aImplementor) |
|
320 { |
|
321 return new(ELeave) CMMFAudioRecordDeviceCustomCommandParser(aImplementor); |
|
322 } |
|
323 |
|
324 CMMFAudioRecordDeviceCustomCommandParser::CMMFAudioRecordDeviceCustomCommandParser(MMMFAudioRecordDeviceCustomCommandImplementor& aImplementor) : |
|
325 CMMFCustomCommandParserBase(KUidInterfaceMMFAudioRecordDevice), |
|
326 iImplementor(aImplementor) |
|
327 { |
|
328 } |
|
329 |
|
330 EXPORT_C CMMFAudioRecordDeviceCustomCommandParser::~CMMFAudioRecordDeviceCustomCommandParser() |
|
331 { |
|
332 } |
|
333 |
|
334 void CMMFAudioRecordDeviceCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
335 { |
|
336 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioRecordDevice) |
|
337 { |
|
338 TRAPD(error, DoHandleRequestL(aMessage)); |
|
339 if (error) |
|
340 aMessage.Complete(error); |
|
341 } |
|
342 else |
|
343 { |
|
344 aMessage.Complete(KErrNotSupported); |
|
345 } |
|
346 } |
|
347 |
|
348 void CMMFAudioRecordDeviceCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
349 { |
|
350 TBool complete = ETrue; |
|
351 switch (aMessage.Function()) |
|
352 { |
|
353 case EMMFAudioRecordDeviceSetGain: |
|
354 complete = DoSetGainL(aMessage); |
|
355 break; |
|
356 case EMMFAudioRecordDeviceGetMaxGain: |
|
357 complete = DoGetMaxGainL(aMessage); |
|
358 break; |
|
359 case EMMFAudioRecordDeviceGetGain: |
|
360 complete = DoGetGainL(aMessage); |
|
361 break; |
|
362 case EMMFAudioRecordDeviceSetBalance: |
|
363 complete = DoSetBalanceL(aMessage); |
|
364 break; |
|
365 case EMMFAudioRecordDeviceGetBalance: |
|
366 complete = DoGetBalanceL(aMessage); |
|
367 break; |
|
368 default: |
|
369 User::Leave(KErrNotSupported); |
|
370 break; |
|
371 } |
|
372 if (complete) |
|
373 aMessage.Complete(KErrNone); |
|
374 } |
|
375 |
|
376 TBool CMMFAudioRecordDeviceCustomCommandParser::DoSetGainL(TMMFMessage& aMessage) |
|
377 { |
|
378 TPckgBuf<TMMFAudioConfig> pckg; |
|
379 aMessage.ReadData1FromClientL(pckg); |
|
380 iImplementor.MardSetGainL(pckg().iGain); |
|
381 return ETrue; |
|
382 } |
|
383 |
|
384 TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetMaxGainL(TMMFMessage& aMessage) |
|
385 { |
|
386 TInt maxGain = 0; |
|
387 iImplementor.MardGetMaxGainL(maxGain); |
|
388 TPckgBuf<TMMFAudioConfig> pckg; |
|
389 pckg().iMaxGain = maxGain; |
|
390 aMessage.WriteDataToClientL(pckg); |
|
391 return ETrue; |
|
392 } |
|
393 |
|
394 TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetGainL(TMMFMessage& aMessage) |
|
395 { |
|
396 TInt gain = 0; |
|
397 iImplementor.MardGetGainL(gain); |
|
398 TPckgBuf<TMMFAudioConfig> pckg; |
|
399 pckg().iGain = gain; |
|
400 aMessage.WriteDataToClientL(pckg); |
|
401 return ETrue; |
|
402 } |
|
403 |
|
404 TBool CMMFAudioRecordDeviceCustomCommandParser::DoSetBalanceL(TMMFMessage& aMessage) |
|
405 { |
|
406 TPckgBuf<TMMFAudioConfig> pckg; |
|
407 aMessage.ReadData1FromClientL(pckg); |
|
408 iImplementor.MardSetBalanceL(pckg().iBalance); |
|
409 return ETrue; |
|
410 } |
|
411 |
|
412 TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetBalanceL(TMMFMessage& aMessage) |
|
413 { |
|
414 TInt balance = 0; |
|
415 iImplementor.MardGetBalanceL(balance); |
|
416 TPckgBuf<TMMFAudioConfig> pckg; |
|
417 pckg().iBalance = balance; |
|
418 aMessage.WriteDataToClientL(pckg); |
|
419 return ETrue; |
|
420 } |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 EXPORT_C RMMFAudioPlayControllerCustomCommands::RMMFAudioPlayControllerCustomCommands(RMMFController& aController) : |
|
443 RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlayController) |
|
444 { |
|
445 } |
|
446 |
|
447 EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::SetPlaybackWindow(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd) const |
|
448 { |
|
449 TPckgBuf<TMMFAudioConfig> configPackage; |
|
450 configPackage().iStartPosition = aStart; |
|
451 configPackage().iEndPosition = aEnd; |
|
452 return iController.CustomCommandSync(iDestinationPckg, |
|
453 EMMFAudioPlayControllerSetPlaybackWindow, |
|
454 configPackage, |
|
455 KNullDesC8); |
|
456 } |
|
457 |
|
458 |
|
459 EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::DeletePlaybackWindow() |
|
460 { |
|
461 return iController.CustomCommandSync(iDestinationPckg, |
|
462 EMMFAudioPlayControllerDeletePlaybackWindow, |
|
463 KNullDesC8, |
|
464 KNullDesC8); |
|
465 } |
|
466 |
|
467 EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::GetLoadingProgress(TInt& aPercentageComplete) const |
|
468 { |
|
469 TPckgBuf<TMMFAudioConfig> configPackage; |
|
470 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
471 EMMFAudioPlayControllerGetLoadingProgress, |
|
472 KNullDesC8, |
|
473 KNullDesC8, |
|
474 configPackage); |
|
475 if (!error) |
|
476 aPercentageComplete = configPackage().iLoadingCompletePercentage; |
|
477 return error; |
|
478 } |
|
479 |
|
480 |
|
481 |
|
482 EXPORT_C CMMFAudioPlayControllerCustomCommandParser* CMMFAudioPlayControllerCustomCommandParser::NewL(MMMFAudioPlayControllerCustomCommandImplementor& aImplementor) |
|
483 { |
|
484 return new(ELeave) CMMFAudioPlayControllerCustomCommandParser(aImplementor); |
|
485 } |
|
486 |
|
487 CMMFAudioPlayControllerCustomCommandParser::CMMFAudioPlayControllerCustomCommandParser(MMMFAudioPlayControllerCustomCommandImplementor& aImplementor) : |
|
488 CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlayController), |
|
489 iImplementor(aImplementor) |
|
490 { |
|
491 } |
|
492 |
|
493 EXPORT_C CMMFAudioPlayControllerCustomCommandParser::~CMMFAudioPlayControllerCustomCommandParser() |
|
494 { |
|
495 } |
|
496 |
|
497 void CMMFAudioPlayControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
498 { |
|
499 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlayController) |
|
500 { |
|
501 TRAPD(error, DoHandleRequestL(aMessage)); |
|
502 if (error) |
|
503 aMessage.Complete(error); |
|
504 } |
|
505 else |
|
506 { |
|
507 aMessage.Complete(KErrNotSupported); |
|
508 } |
|
509 } |
|
510 |
|
511 void CMMFAudioPlayControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
512 { |
|
513 TBool complete = ETrue; |
|
514 switch (aMessage.Function()) |
|
515 { |
|
516 case EMMFAudioPlayControllerSetPlaybackWindow: |
|
517 complete = DoSetPlaybackWindowL(aMessage); |
|
518 break; |
|
519 case EMMFAudioPlayControllerDeletePlaybackWindow: |
|
520 complete = DoDeletePlaybackWindowL(aMessage); |
|
521 break; |
|
522 case EMMFAudioPlayControllerGetLoadingProgress: |
|
523 complete = DoGetLoadingProgressL(aMessage); |
|
524 break; |
|
525 default: |
|
526 User::Leave(KErrNotSupported); |
|
527 break; |
|
528 } |
|
529 if (complete) |
|
530 aMessage.Complete(KErrNone); |
|
531 } |
|
532 |
|
533 TBool CMMFAudioPlayControllerCustomCommandParser::DoSetPlaybackWindowL(TMMFMessage& aMessage) |
|
534 { |
|
535 TPckgBuf<TMMFAudioConfig> pckg; |
|
536 aMessage.ReadData1FromClientL(pckg); |
|
537 iImplementor.MapcSetPlaybackWindowL(pckg().iStartPosition, pckg().iEndPosition); |
|
538 return ETrue; |
|
539 } |
|
540 |
|
541 TBool CMMFAudioPlayControllerCustomCommandParser::DoDeletePlaybackWindowL(TMMFMessage& /*aMessage*/) |
|
542 { |
|
543 iImplementor.MapcDeletePlaybackWindowL(); |
|
544 return ETrue; |
|
545 } |
|
546 |
|
547 TBool CMMFAudioPlayControllerCustomCommandParser::DoGetLoadingProgressL(TMMFMessage& aMessage) |
|
548 { |
|
549 TInt progress; |
|
550 iImplementor.MapcGetLoadingProgressL(progress); |
|
551 TPckgBuf<TMMFAudioConfig> pckg; |
|
552 pckg().iLoadingCompletePercentage = progress; |
|
553 aMessage.WriteDataToClientL(pckg); |
|
554 return ETrue; |
|
555 } |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 EXPORT_C RMMFAudioRecordControllerCustomCommands::RMMFAudioRecordControllerCustomCommands(RMMFController& aController) : |
|
568 RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioRecordController) |
|
569 { |
|
570 } |
|
571 |
|
572 EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::GetRecordTimeAvailable(TTimeIntervalMicroSeconds& aTime) const |
|
573 { |
|
574 TPckgBuf<TMMFAudioConfig> configPackage; |
|
575 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
576 EMMFAudioRecordControllerGetRecordTimeAvailable, |
|
577 KNullDesC8, |
|
578 KNullDesC8, |
|
579 configPackage); |
|
580 if (!error) |
|
581 aTime = configPackage().iRecordTimeAvailable; |
|
582 return error; |
|
583 } |
|
584 |
|
585 EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::SetMaxDuration(const TTimeIntervalMicroSeconds& aMaxDuration) const |
|
586 { |
|
587 TPckgBuf<TMMFAudioConfig> configPackage; |
|
588 configPackage().iMaxDuration = aMaxDuration; |
|
589 return iController.CustomCommandSync(iDestinationPckg, |
|
590 EMMFAudioRecordControllerSetMaxDuration, |
|
591 configPackage, |
|
592 KNullDesC8); |
|
593 } |
|
594 |
|
595 EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::SetMaxFileSize(TInt aMaxSize) const |
|
596 { |
|
597 TPckgBuf<TMMFAudioConfig> configPackage; |
|
598 configPackage().iMaxFileSize = aMaxSize; |
|
599 return iController.CustomCommandSync(iDestinationPckg, |
|
600 EMMFAudioRecordControllerSetMaxFileSize, |
|
601 configPackage, |
|
602 KNullDesC8); |
|
603 } |
|
604 |
|
605 EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::Crop(TBool aToEnd) |
|
606 { |
|
607 TPckgBuf<TMMFAudioConfig> configPackage; |
|
608 configPackage().iCropToEnd = aToEnd; |
|
609 return iController.CustomCommandSync(iDestinationPckg, |
|
610 EMMFAudioRecordControllerCrop, |
|
611 configPackage, |
|
612 KNullDesC8); |
|
613 } |
|
614 |
|
615 EXPORT_C void RMMFAudioRecordControllerCustomCommands::AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry) |
|
616 { |
|
617 CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32); |
|
618 CleanupStack::PushL(buf); |
|
619 RBufWriteStream s; |
|
620 s.Open(*buf); |
|
621 CleanupClosePushL(s); |
|
622 aNewEntry.ExternalizeL(s); |
|
623 TPtr8 bufData = buf->Ptr(0); |
|
624 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
625 EMMFAudioRecordControllerAddMetaDataEntry, |
|
626 bufData, |
|
627 KNullDesC8)); |
|
628 CleanupStack::PopAndDestroy(2);//s, buf |
|
629 } |
|
630 |
|
631 EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::RemoveMetaDataEntry(TInt aIndex) |
|
632 { |
|
633 TPckgBuf<TInt> pckg(aIndex); |
|
634 return iController.CustomCommandSync(iDestinationPckg, |
|
635 EMMFAudioRecordControllerRemoveMetaDataEntry, |
|
636 pckg, |
|
637 KNullDesC8); |
|
638 } |
|
639 |
|
640 EXPORT_C void RMMFAudioRecordControllerCustomCommands::ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry) |
|
641 { |
|
642 TPckgBuf<TInt> indexPckg(aIndex); |
|
643 CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32); |
|
644 CleanupStack::PushL(buf); |
|
645 RBufWriteStream s; |
|
646 s.Open(*buf); |
|
647 CleanupClosePushL(s); |
|
648 aNewEntry.ExternalizeL(s); |
|
649 TPtr8 bufData = buf->Ptr(0); |
|
650 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
651 EMMFAudioRecordControllerReplaceMetaDataEntry, |
|
652 bufData, |
|
653 indexPckg)); |
|
654 CleanupStack::PopAndDestroy(2);//s, buf |
|
655 } |
|
656 |
|
657 EXPORT_C CMMFAudioRecordControllerCustomCommandParser* CMMFAudioRecordControllerCustomCommandParser::NewL(MMMFAudioRecordControllerCustomCommandImplementor& aImplementor) |
|
658 { |
|
659 return new(ELeave) CMMFAudioRecordControllerCustomCommandParser(aImplementor); |
|
660 } |
|
661 |
|
662 CMMFAudioRecordControllerCustomCommandParser::CMMFAudioRecordControllerCustomCommandParser(MMMFAudioRecordControllerCustomCommandImplementor& aImplementor) : |
|
663 CMMFCustomCommandParserBase(KUidInterfaceMMFAudioRecordController), |
|
664 iImplementor(aImplementor) |
|
665 { |
|
666 } |
|
667 |
|
668 EXPORT_C CMMFAudioRecordControllerCustomCommandParser::~CMMFAudioRecordControllerCustomCommandParser() |
|
669 { |
|
670 } |
|
671 |
|
672 void CMMFAudioRecordControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
673 { |
|
674 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioRecordController) |
|
675 { |
|
676 TRAPD(error, DoHandleRequestL(aMessage)); |
|
677 if (error) |
|
678 aMessage.Complete(error); |
|
679 } |
|
680 else |
|
681 { |
|
682 aMessage.Complete(KErrNotSupported); |
|
683 } |
|
684 } |
|
685 |
|
686 void CMMFAudioRecordControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
687 { |
|
688 TBool complete = ETrue; |
|
689 switch (aMessage.Function()) |
|
690 { |
|
691 case EMMFAudioRecordControllerGetRecordTimeAvailable: |
|
692 complete = DoGetRecordTimeAvailableL(aMessage); |
|
693 break; |
|
694 case EMMFAudioRecordControllerSetMaxDuration: |
|
695 complete = DoSetMaxDurationL(aMessage); |
|
696 break; |
|
697 case EMMFAudioRecordControllerSetMaxFileSize: |
|
698 complete = DoSetMaxFileSizeL(aMessage); |
|
699 break; |
|
700 case EMMFAudioRecordControllerCrop: |
|
701 complete = DoCropL(aMessage); |
|
702 break; |
|
703 case EMMFAudioRecordControllerAddMetaDataEntry: |
|
704 complete = DoAddMetaDataEntryL(aMessage); |
|
705 break; |
|
706 case EMMFAudioRecordControllerRemoveMetaDataEntry: |
|
707 complete = DoRemoveMetaDataEntryL(aMessage); |
|
708 break; |
|
709 case EMMFAudioRecordControllerReplaceMetaDataEntry: |
|
710 complete = DoReplaceMetaDataEntryL(aMessage); |
|
711 break; |
|
712 default: |
|
713 User::Leave(KErrNotSupported); |
|
714 break; |
|
715 } |
|
716 if (complete) |
|
717 aMessage.Complete(KErrNone); |
|
718 } |
|
719 |
|
720 TBool CMMFAudioRecordControllerCustomCommandParser::DoGetRecordTimeAvailableL(TMMFMessage& aMessage) |
|
721 { |
|
722 TTimeIntervalMicroSeconds time; |
|
723 iImplementor.MarcGetRecordTimeAvailableL(time); |
|
724 TPckgBuf<TMMFAudioConfig> pckg; |
|
725 pckg().iRecordTimeAvailable = time; |
|
726 aMessage.WriteDataToClientL(pckg); |
|
727 return ETrue; |
|
728 } |
|
729 |
|
730 TBool CMMFAudioRecordControllerCustomCommandParser::DoSetMaxDurationL(TMMFMessage& aMessage) |
|
731 { |
|
732 TPckgBuf<TMMFAudioConfig> pckg; |
|
733 aMessage.ReadData1FromClientL(pckg); |
|
734 iImplementor.MarcSetMaxDurationL(pckg().iMaxDuration); |
|
735 return ETrue; |
|
736 } |
|
737 |
|
738 TBool CMMFAudioRecordControllerCustomCommandParser::DoSetMaxFileSizeL(TMMFMessage& aMessage) |
|
739 { |
|
740 TPckgBuf<TMMFAudioConfig> pckg; |
|
741 aMessage.ReadData1FromClientL(pckg); |
|
742 iImplementor.MarcSetMaxFileSizeL(pckg().iMaxFileSize); |
|
743 return ETrue; |
|
744 } |
|
745 |
|
746 TBool CMMFAudioRecordControllerCustomCommandParser::DoCropL(TMMFMessage& aMessage) |
|
747 { |
|
748 TPckgBuf<TMMFAudioConfig> pckg; |
|
749 aMessage.ReadData1FromClientL(pckg); |
|
750 iImplementor.MarcCropL(pckg().iCropToEnd); |
|
751 return ETrue; |
|
752 } |
|
753 |
|
754 TBool CMMFAudioRecordControllerCustomCommandParser::DoAddMetaDataEntryL(TMMFMessage& aMessage) |
|
755 { |
|
756 TInt bufSize = aMessage.SizeOfData1FromClient(); |
|
757 // Leaving here in order to prevent a panic in the NewLC if the value is negative |
|
758 User::LeaveIfError(bufSize); |
|
759 HBufC8* buf = HBufC8::NewLC(bufSize); |
|
760 TPtr8 ptr = buf->Des(); |
|
761 aMessage.ReadData1FromClientL(ptr); |
|
762 RDesReadStream stream; |
|
763 stream.Open(ptr); |
|
764 CleanupClosePushL(stream); |
|
765 CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL(); |
|
766 CleanupStack::PushL(metaData); |
|
767 metaData->InternalizeL(stream); |
|
768 iImplementor.MarcAddMetaDataEntryL(*metaData); |
|
769 CleanupStack::PopAndDestroy(3);//metaData, stream, buf |
|
770 return ETrue; |
|
771 } |
|
772 |
|
773 TBool CMMFAudioRecordControllerCustomCommandParser::DoRemoveMetaDataEntryL(TMMFMessage& aMessage) |
|
774 { |
|
775 TPckgBuf<TInt> pckg; |
|
776 aMessage.ReadData1FromClientL(pckg); |
|
777 iImplementor.MarcRemoveMetaDataEntryL(pckg()); |
|
778 return ETrue; |
|
779 } |
|
780 |
|
781 TBool CMMFAudioRecordControllerCustomCommandParser::DoReplaceMetaDataEntryL(TMMFMessage& aMessage) |
|
782 { |
|
783 // Get new meta data |
|
784 TInt bufSize = aMessage.SizeOfData1FromClient(); |
|
785 // Leaving here in order to prevent a panic in the NewLC if the value is negative |
|
786 User::LeaveIfError(bufSize); |
|
787 HBufC8* buf = HBufC8::NewLC(bufSize); |
|
788 TPtr8 ptr = buf->Des(); |
|
789 aMessage.ReadData1FromClientL(ptr); |
|
790 RDesReadStream stream; |
|
791 stream.Open(ptr); |
|
792 CleanupClosePushL(stream); |
|
793 CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL(); |
|
794 CleanupStack::PushL(metaData); |
|
795 metaData->InternalizeL(stream); |
|
796 |
|
797 |
|
798 // Get index to replace |
|
799 TPckgBuf<TInt> indexPckg; |
|
800 aMessage.ReadData2FromClientL(indexPckg); |
|
801 |
|
802 iImplementor.MarcReplaceMetaDataEntryL(indexPckg(), *metaData); |
|
803 |
|
804 CleanupStack::PopAndDestroy(3);//metaData, stream, buf |
|
805 return ETrue; |
|
806 } |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 EXPORT_C RMMFAudioControllerCustomCommands::RMMFAudioControllerCustomCommands(RMMFController& aController) : |
|
825 RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioController) |
|
826 { |
|
827 } |
|
828 |
|
829 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceSampleRate(TUint aSampleRate) const |
|
830 { |
|
831 TPckgBuf<TMMFAudioConfig> configPackage; |
|
832 configPackage().iSampleRate = aSampleRate; |
|
833 return iController.CustomCommandSync(iDestinationPckg, |
|
834 EMMFAudioControllerSetSourceSampleRate, |
|
835 configPackage, |
|
836 KNullDesC8); |
|
837 } |
|
838 |
|
839 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceNumChannels(TUint aNumChannels) const |
|
840 { |
|
841 TPckgBuf<TMMFAudioConfig> configPackage; |
|
842 configPackage().iChannels = aNumChannels; |
|
843 return iController.CustomCommandSync(iDestinationPckg, |
|
844 EMMFAudioControllerSetSourceNumChannels, |
|
845 configPackage, |
|
846 KNullDesC8); |
|
847 } |
|
848 |
|
849 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceFormat(TUid aFormatUid) const |
|
850 { |
|
851 TPckgBuf<TMMFAudioConfig> configPackage; |
|
852 configPackage().iFormatUid = aFormatUid; |
|
853 return iController.CustomCommandSync(iDestinationPckg, |
|
854 EMMFAudioControllerSetSourceFormat, |
|
855 configPackage, |
|
856 KNullDesC8); |
|
857 } |
|
858 |
|
859 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkSampleRate(TUint aSampleRate) const |
|
860 { |
|
861 TPckgBuf<TMMFAudioConfig> configPackage; |
|
862 configPackage().iSampleRate = aSampleRate; |
|
863 return iController.CustomCommandSync(iDestinationPckg, |
|
864 EMMFAudioControllerSetSinkSampleRate, |
|
865 configPackage, |
|
866 KNullDesC8); |
|
867 } |
|
868 |
|
869 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkNumChannels(TUint aNumChannels) const |
|
870 { |
|
871 TPckgBuf<TMMFAudioConfig> configPackage; |
|
872 configPackage().iChannels = aNumChannels; |
|
873 return iController.CustomCommandSync(iDestinationPckg, |
|
874 EMMFAudioControllerSetSinkNumChannels, |
|
875 configPackage, |
|
876 KNullDesC8); |
|
877 } |
|
878 |
|
879 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkFormat(TUid aFormatUid) const |
|
880 { |
|
881 TPckgBuf<TMMFAudioConfig> configPackage; |
|
882 configPackage().iFormatUid = aFormatUid; |
|
883 return iController.CustomCommandSync(iDestinationPckg, |
|
884 EMMFAudioControllerSetSinkFormat, |
|
885 configPackage, |
|
886 KNullDesC8); |
|
887 } |
|
888 |
|
889 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetCodec(TFourCC aSourceDataType, TFourCC aSinkDataType) const |
|
890 { |
|
891 TPckgBuf<TMMFAudioConfig> configPackage; |
|
892 configPackage().iSourceDataTypeCode = aSourceDataType; |
|
893 configPackage().iSinkDataTypeCode = aSinkDataType; |
|
894 return iController.CustomCommandSync(iDestinationPckg, |
|
895 EMMFAudioControllerSetCodec, |
|
896 configPackage, |
|
897 KNullDesC8); |
|
898 } |
|
899 |
|
900 |
|
901 |
|
902 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceBitRate(TUint aRate) const |
|
903 { |
|
904 TPckgBuf<TMMFAudioConfig> configPackage; |
|
905 configPackage().iSampleRate = aRate; |
|
906 return iController.CustomCommandSync(iDestinationPckg, |
|
907 EMMFAudioControllerSetSourceBitRate, |
|
908 configPackage, |
|
909 KNullDesC8); |
|
910 } |
|
911 |
|
912 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceDataType(TFourCC aDataType) const |
|
913 { |
|
914 TPckgBuf<TMMFAudioConfig> configPackage; |
|
915 configPackage().iSourceDataTypeCode = aDataType; |
|
916 return iController.CustomCommandSync(iDestinationPckg, |
|
917 EMMFAudioControllerSetSourceDataType, |
|
918 configPackage, |
|
919 KNullDesC8); |
|
920 } |
|
921 |
|
922 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkBitRate(TUint aRate) const |
|
923 { |
|
924 TPckgBuf<TMMFAudioConfig> configPackage; |
|
925 configPackage().iSampleRate = aRate; |
|
926 return iController.CustomCommandSync(iDestinationPckg, |
|
927 EMMFAudioControllerSetSinkBitRate, |
|
928 configPackage, |
|
929 KNullDesC8); |
|
930 } |
|
931 |
|
932 EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkDataType(TFourCC aDataType) const |
|
933 { |
|
934 TPckgBuf<TMMFAudioConfig> configPackage; |
|
935 configPackage().iSinkDataTypeCode = aDataType; |
|
936 return iController.CustomCommandSync(iDestinationPckg, |
|
937 EMMFAudioControllerSetSinkDataType, |
|
938 configPackage, |
|
939 KNullDesC8); |
|
940 } |
|
941 |
|
942 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceSampleRate(TUint& aRate) const |
|
943 { |
|
944 TPckgBuf<TMMFAudioConfig> configPackage; |
|
945 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
946 EMMFAudioControllerGetSourceSampleRate, |
|
947 KNullDesC8, |
|
948 KNullDesC8, |
|
949 configPackage); |
|
950 if (!error) |
|
951 aRate = configPackage().iSampleRate; |
|
952 return error; |
|
953 } |
|
954 |
|
955 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceBitRate(TUint& aRate) const |
|
956 { |
|
957 TPckgBuf<TMMFAudioConfig> configPackage; |
|
958 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
959 EMMFAudioControllerGetSourceBitRate, |
|
960 KNullDesC8, |
|
961 KNullDesC8, |
|
962 configPackage); |
|
963 if (!error) |
|
964 aRate = configPackage().iSampleRate; |
|
965 return error; |
|
966 } |
|
967 |
|
968 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceNumChannels(TUint& aNumChannels) const |
|
969 { |
|
970 TPckgBuf<TMMFAudioConfig> configPackage; |
|
971 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
972 EMMFAudioControllerGetSourceNumChannels, |
|
973 KNullDesC8, |
|
974 KNullDesC8, |
|
975 configPackage); |
|
976 if (!error) |
|
977 aNumChannels = configPackage().iChannels; |
|
978 return error; |
|
979 } |
|
980 |
|
981 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceFormat(TUid& aFormat) const |
|
982 { |
|
983 TPckgBuf<TMMFAudioConfig> configPackage; |
|
984 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
985 EMMFAudioControllerGetSourceFormat, |
|
986 KNullDesC8, |
|
987 KNullDesC8, |
|
988 configPackage); |
|
989 if (!error) |
|
990 aFormat = configPackage().iFormatUid; |
|
991 return error; |
|
992 } |
|
993 |
|
994 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceDataType(TFourCC& aDataType) const |
|
995 { |
|
996 TPckgBuf<TMMFAudioConfig> configPackage; |
|
997 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
998 EMMFAudioControllerGetSourceDataType, |
|
999 KNullDesC8, |
|
1000 KNullDesC8, |
|
1001 configPackage); |
|
1002 if (!error) |
|
1003 aDataType = configPackage().iSourceDataTypeCode; |
|
1004 return error; |
|
1005 } |
|
1006 |
|
1007 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkSampleRate(TUint& aRate) const |
|
1008 { |
|
1009 TPckgBuf<TMMFAudioConfig> configPackage; |
|
1010 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1011 EMMFAudioControllerGetSinkSampleRate, |
|
1012 KNullDesC8, |
|
1013 KNullDesC8, |
|
1014 configPackage); |
|
1015 if (!error) |
|
1016 aRate = configPackage().iSampleRate; |
|
1017 return error; |
|
1018 } |
|
1019 |
|
1020 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkBitRate(TUint& aRate) const |
|
1021 { |
|
1022 TPckgBuf<TMMFAudioConfig> configPackage; |
|
1023 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1024 EMMFAudioControllerGetSinkBitRate, |
|
1025 KNullDesC8, |
|
1026 KNullDesC8, |
|
1027 configPackage); |
|
1028 if (!error) |
|
1029 aRate = configPackage().iSampleRate; |
|
1030 return error; |
|
1031 } |
|
1032 |
|
1033 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkNumChannels(TUint& aNumChannels) const |
|
1034 { |
|
1035 TPckgBuf<TMMFAudioConfig> configPackage; |
|
1036 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1037 EMMFAudioControllerGetSinkNumChannels, |
|
1038 KNullDesC8, |
|
1039 KNullDesC8, |
|
1040 configPackage); |
|
1041 if (!error) |
|
1042 aNumChannels = configPackage().iChannels; |
|
1043 return error; |
|
1044 } |
|
1045 |
|
1046 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkFormat(TUid& aFormat) const |
|
1047 { |
|
1048 TPckgBuf<TMMFAudioConfig> configPackage; |
|
1049 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1050 EMMFAudioControllerGetSinkFormat, |
|
1051 KNullDesC8, |
|
1052 KNullDesC8, |
|
1053 configPackage); |
|
1054 if (!error) |
|
1055 aFormat = configPackage().iFormatUid; |
|
1056 return error; |
|
1057 } |
|
1058 |
|
1059 EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkDataType(TFourCC& aDataType) const |
|
1060 { |
|
1061 TPckgBuf<TMMFAudioConfig> configPackage; |
|
1062 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1063 EMMFAudioControllerGetSinkDataType, |
|
1064 KNullDesC8, |
|
1065 KNullDesC8, |
|
1066 configPackage); |
|
1067 if (!error) |
|
1068 aDataType = configPackage().iSinkDataTypeCode; |
|
1069 return error; |
|
1070 } |
|
1071 |
|
1072 EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceSampleRatesL(RArray<TUint>& aSupportedRates) const |
|
1073 { |
|
1074 DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSourceSampleRates); |
|
1075 } |
|
1076 |
|
1077 EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceBitRatesL(RArray<TUint>& aSupportedRates) const |
|
1078 { |
|
1079 DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSourceBitRates); |
|
1080 } |
|
1081 |
|
1082 EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceNumChannelsL(RArray<TUint>& aSupportedChannels) const |
|
1083 { |
|
1084 DoGetUintArrayL(aSupportedChannels, EMMFAudioControllerGetSupportedSourceNumChannels); |
|
1085 } |
|
1086 |
|
1087 EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const |
|
1088 { |
|
1089 DoGetFourCCArrayL(aSupportedDataTypes, EMMFAudioControllerGetSupportedSourceDataTypes); |
|
1090 } |
|
1091 |
|
1092 EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkSampleRatesL(RArray<TUint>& aSupportedRates) const |
|
1093 { |
|
1094 DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSinkSampleRates); |
|
1095 } |
|
1096 |
|
1097 EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkBitRatesL(RArray<TUint>& aSupportedRates) const |
|
1098 { |
|
1099 DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSinkBitRates); |
|
1100 } |
|
1101 |
|
1102 EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkNumChannelsL(RArray<TUint>& aSupportedChannels) const |
|
1103 { |
|
1104 DoGetUintArrayL(aSupportedChannels, EMMFAudioControllerGetSupportedSinkNumChannels); |
|
1105 } |
|
1106 |
|
1107 EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const |
|
1108 { |
|
1109 DoGetFourCCArrayL(aSupportedDataTypes, EMMFAudioControllerGetSupportedSinkDataTypes); |
|
1110 } |
|
1111 |
|
1112 |
|
1113 |
|
1114 void RMMFAudioControllerCustomCommands::DoGetUintArrayL(RArray<TUint>& aArray, TMMFAudioControllerMessages aIpc) const |
|
1115 { |
|
1116 aArray.Reset(); |
|
1117 |
|
1118 TPckgBuf<TInt> numberOfElementsPckg; |
|
1119 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
1120 aIpc, |
|
1121 KNullDesC8, |
|
1122 KNullDesC8, |
|
1123 numberOfElementsPckg)); |
|
1124 |
|
1125 HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TUint)); |
|
1126 TPtr8 ptr = buf->Des(); |
|
1127 |
|
1128 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
1129 EMMFAudioControllerCopyArrayData, |
|
1130 KNullDesC8, |
|
1131 KNullDesC8, |
|
1132 ptr)); |
|
1133 RDesReadStream stream(ptr); |
|
1134 CleanupClosePushL(stream); |
|
1135 |
|
1136 for (TInt i=0; i<numberOfElementsPckg(); i++) |
|
1137 { |
|
1138 User::LeaveIfError(aArray.Append(stream.ReadUint32L())); |
|
1139 } |
|
1140 |
|
1141 CleanupStack::PopAndDestroy(2);//stream, buf |
|
1142 } |
|
1143 |
|
1144 void RMMFAudioControllerCustomCommands::DoGetFourCCArrayL(RArray<TFourCC>& aArray, TMMFAudioControllerMessages aIpc) const |
|
1145 { |
|
1146 aArray.Reset(); |
|
1147 |
|
1148 TPckgBuf<TInt> numberOfElementsPckg; |
|
1149 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
1150 aIpc, |
|
1151 KNullDesC8, |
|
1152 KNullDesC8, |
|
1153 numberOfElementsPckg)); |
|
1154 |
|
1155 HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); |
|
1156 TPtr8 ptr = buf->Des(); |
|
1157 |
|
1158 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
1159 EMMFAudioControllerCopyArrayData, |
|
1160 KNullDesC8, |
|
1161 KNullDesC8, |
|
1162 ptr)); |
|
1163 RDesReadStream stream(ptr); |
|
1164 CleanupClosePushL(stream); |
|
1165 |
|
1166 for (TInt i=0; i<numberOfElementsPckg(); i++) |
|
1167 { |
|
1168 User::LeaveIfError(aArray.Append(stream.ReadInt32L())); |
|
1169 } |
|
1170 |
|
1171 CleanupStack::PopAndDestroy(2);//stream, buf |
|
1172 } |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 EXPORT_C CMMFAudioControllerCustomCommandParser* CMMFAudioControllerCustomCommandParser::NewL(MMMFAudioControllerCustomCommandImplementor& aImplementor) |
|
1188 { |
|
1189 return new(ELeave) CMMFAudioControllerCustomCommandParser(aImplementor); |
|
1190 } |
|
1191 |
|
1192 CMMFAudioControllerCustomCommandParser::CMMFAudioControllerCustomCommandParser(MMMFAudioControllerCustomCommandImplementor& aImplementor) : |
|
1193 CMMFCustomCommandParserBase(KUidInterfaceMMFAudioController), |
|
1194 iImplementor(aImplementor) |
|
1195 { |
|
1196 } |
|
1197 |
|
1198 EXPORT_C CMMFAudioControllerCustomCommandParser::~CMMFAudioControllerCustomCommandParser() |
|
1199 { |
|
1200 delete iDataCopyBuffer; |
|
1201 } |
|
1202 |
|
1203 void CMMFAudioControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
1204 { |
|
1205 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioController) |
|
1206 { |
|
1207 TRAPD(error, DoHandleRequestL(aMessage)); |
|
1208 if (error) |
|
1209 aMessage.Complete(error); |
|
1210 } |
|
1211 else |
|
1212 { |
|
1213 aMessage.Complete(KErrNotSupported); |
|
1214 } |
|
1215 } |
|
1216 |
|
1217 |
|
1218 void CMMFAudioControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
1219 { |
|
1220 TBool complete = ETrue; |
|
1221 switch (aMessage.Function()) |
|
1222 { |
|
1223 case EMMFAudioControllerSetSourceSampleRate: |
|
1224 complete = DoSetSourceSampleRateL(aMessage); |
|
1225 break; |
|
1226 case EMMFAudioControllerSetSourceBitRate: |
|
1227 complete = DoSetSourceBitRateL(aMessage); |
|
1228 break; |
|
1229 case EMMFAudioControllerSetSourceNumChannels: |
|
1230 complete = DoSetSourceNumChannelsL(aMessage); |
|
1231 break; |
|
1232 case EMMFAudioControllerSetSourceFormat: |
|
1233 complete = DoSetSourceFormatL(aMessage); |
|
1234 break; |
|
1235 case EMMFAudioControllerSetSourceDataType: |
|
1236 complete = DoSetSourceDataTypeL(aMessage); |
|
1237 break; |
|
1238 case EMMFAudioControllerSetSinkSampleRate: |
|
1239 complete = DoSetSinkSampleRateL(aMessage); |
|
1240 break; |
|
1241 case EMMFAudioControllerSetSinkBitRate: |
|
1242 complete = DoSetSinkBitRateL(aMessage); |
|
1243 break; |
|
1244 case EMMFAudioControllerSetSinkNumChannels: |
|
1245 complete = DoSetSinkNumChannelsL(aMessage); |
|
1246 break; |
|
1247 case EMMFAudioControllerSetSinkFormat: |
|
1248 complete = DoSetSinkFormatL(aMessage); |
|
1249 break; |
|
1250 case EMMFAudioControllerSetSinkDataType: |
|
1251 complete = DoSetSinkDataTypeL(aMessage); |
|
1252 break; |
|
1253 case EMMFAudioControllerSetCodec: |
|
1254 complete = DoSetCodecL(aMessage); |
|
1255 break; |
|
1256 case EMMFAudioControllerGetSourceSampleRate: |
|
1257 complete = DoGetSourceSampleRateL(aMessage); |
|
1258 break; |
|
1259 case EMMFAudioControllerGetSourceBitRate: |
|
1260 complete = DoGetSourceBitRateL(aMessage); |
|
1261 break; |
|
1262 case EMMFAudioControllerGetSourceNumChannels: |
|
1263 complete = DoGetSourceNumChannelsL(aMessage); |
|
1264 break; |
|
1265 case EMMFAudioControllerGetSourceFormat: |
|
1266 complete = DoGetSourceFormatL(aMessage); |
|
1267 break; |
|
1268 case EMMFAudioControllerGetSourceDataType: |
|
1269 complete = DoGetSourceDataTypeL(aMessage); |
|
1270 break; |
|
1271 case EMMFAudioControllerGetSinkSampleRate: |
|
1272 complete = DoGetSinkSampleRateL(aMessage); |
|
1273 break; |
|
1274 case EMMFAudioControllerGetSinkBitRate: |
|
1275 complete = DoGetSinkBitRateL(aMessage); |
|
1276 break; |
|
1277 case EMMFAudioControllerGetSinkNumChannels: |
|
1278 complete = DoGetSinkNumChannelsL(aMessage); |
|
1279 break; |
|
1280 case EMMFAudioControllerGetSinkFormat: |
|
1281 complete = DoGetSinkFormatL(aMessage); |
|
1282 break; |
|
1283 case EMMFAudioControllerGetSinkDataType: |
|
1284 complete = DoGetSinkDataTypeL(aMessage); |
|
1285 break; |
|
1286 case EMMFAudioControllerGetSupportedSourceSampleRates: |
|
1287 complete = DoGetSupportedSourceSampleRatesL(aMessage); |
|
1288 break; |
|
1289 case EMMFAudioControllerGetSupportedSourceBitRates: |
|
1290 complete = DoGetSupportedSourceBitRatesL(aMessage); |
|
1291 break; |
|
1292 case EMMFAudioControllerGetSupportedSourceNumChannels: |
|
1293 complete = DoGetSupportedSourceNumChannelsL(aMessage); |
|
1294 break; |
|
1295 case EMMFAudioControllerGetSupportedSourceDataTypes: |
|
1296 complete = DoGetSupportedSourceDataTypesL(aMessage); |
|
1297 break; |
|
1298 case EMMFAudioControllerGetSupportedSinkSampleRates: |
|
1299 complete = DoGetSupportedSinkSampleRatesL(aMessage); |
|
1300 break; |
|
1301 case EMMFAudioControllerGetSupportedSinkBitRates: |
|
1302 complete = DoGetSupportedSinkBitRatesL(aMessage); |
|
1303 break; |
|
1304 case EMMFAudioControllerGetSupportedSinkNumChannels: |
|
1305 complete = DoGetSupportedSinkNumChannelsL(aMessage); |
|
1306 break; |
|
1307 case EMMFAudioControllerGetSupportedSinkDataTypes: |
|
1308 complete = DoGetSupportedSinkDataTypesL(aMessage); |
|
1309 break; |
|
1310 case EMMFAudioControllerCopyArrayData: |
|
1311 complete = DoCopyArrayDataL(aMessage); |
|
1312 break; |
|
1313 default: |
|
1314 User::Leave(KErrNotSupported); |
|
1315 break; |
|
1316 } |
|
1317 if (complete) |
|
1318 aMessage.Complete(KErrNone); |
|
1319 } |
|
1320 |
|
1321 TBool CMMFAudioControllerCustomCommandParser::DoSetSourceSampleRateL(TMMFMessage& aMessage) |
|
1322 { |
|
1323 TPckgBuf<TMMFAudioConfig> pckg; |
|
1324 aMessage.ReadData1FromClientL(pckg); |
|
1325 iImplementor.MacSetSourceSampleRateL(pckg().iSampleRate); |
|
1326 return ETrue; |
|
1327 } |
|
1328 |
|
1329 TBool CMMFAudioControllerCustomCommandParser::DoSetSourceNumChannelsL(TMMFMessage& aMessage) |
|
1330 { |
|
1331 TPckgBuf<TMMFAudioConfig> pckg; |
|
1332 aMessage.ReadData1FromClientL(pckg); |
|
1333 iImplementor.MacSetSourceNumChannelsL(pckg().iChannels); |
|
1334 return ETrue; |
|
1335 } |
|
1336 |
|
1337 TBool CMMFAudioControllerCustomCommandParser::DoSetSourceFormatL(TMMFMessage& aMessage) |
|
1338 { |
|
1339 TPckgBuf<TMMFAudioConfig> pckg; |
|
1340 aMessage.ReadData1FromClientL(pckg); |
|
1341 iImplementor.MacSetSourceFormatL(pckg().iFormatUid); |
|
1342 return ETrue; |
|
1343 } |
|
1344 |
|
1345 TBool CMMFAudioControllerCustomCommandParser::DoSetSinkSampleRateL(TMMFMessage& aMessage) |
|
1346 { |
|
1347 TPckgBuf<TMMFAudioConfig> pckg; |
|
1348 aMessage.ReadData1FromClientL(pckg); |
|
1349 iImplementor.MacSetSinkSampleRateL(pckg().iSampleRate); |
|
1350 return ETrue; |
|
1351 } |
|
1352 |
|
1353 TBool CMMFAudioControllerCustomCommandParser::DoSetSinkNumChannelsL(TMMFMessage& aMessage) |
|
1354 { |
|
1355 TPckgBuf<TMMFAudioConfig> pckg; |
|
1356 aMessage.ReadData1FromClientL(pckg); |
|
1357 iImplementor.MacSetSinkNumChannelsL(pckg().iChannels); |
|
1358 return ETrue; |
|
1359 } |
|
1360 |
|
1361 TBool CMMFAudioControllerCustomCommandParser::DoSetSinkFormatL(TMMFMessage& aMessage) |
|
1362 { |
|
1363 TPckgBuf<TMMFAudioConfig> pckg; |
|
1364 aMessage.ReadData1FromClientL(pckg); |
|
1365 iImplementor.MacSetSinkFormatL(pckg().iFormatUid); |
|
1366 return ETrue; |
|
1367 } |
|
1368 |
|
1369 TBool CMMFAudioControllerCustomCommandParser::DoSetCodecL(TMMFMessage& aMessage) |
|
1370 { |
|
1371 TPckgBuf<TMMFAudioConfig> pckg; |
|
1372 aMessage.ReadData1FromClientL(pckg); |
|
1373 iImplementor.MacSetCodecL(pckg().iSourceDataTypeCode, pckg().iSinkDataTypeCode); |
|
1374 return ETrue; |
|
1375 } |
|
1376 |
|
1377 |
|
1378 TBool CMMFAudioControllerCustomCommandParser::DoSetSourceBitRateL(TMMFMessage& aMessage) |
|
1379 { |
|
1380 TPckgBuf<TMMFAudioConfig> pckg; |
|
1381 aMessage.ReadData1FromClientL(pckg); |
|
1382 iImplementor.MacSetSourceBitRateL(pckg().iSampleRate); |
|
1383 return ETrue; |
|
1384 } |
|
1385 |
|
1386 TBool CMMFAudioControllerCustomCommandParser::DoSetSourceDataTypeL(TMMFMessage& aMessage) |
|
1387 { |
|
1388 TPckgBuf<TMMFAudioConfig> pckg; |
|
1389 aMessage.ReadData1FromClientL(pckg); |
|
1390 iImplementor.MacSetSourceDataTypeL(pckg().iSourceDataTypeCode); |
|
1391 return ETrue; |
|
1392 } |
|
1393 |
|
1394 TBool CMMFAudioControllerCustomCommandParser::DoSetSinkBitRateL(TMMFMessage& aMessage) |
|
1395 { |
|
1396 TPckgBuf<TMMFAudioConfig> pckg; |
|
1397 aMessage.ReadData1FromClientL(pckg); |
|
1398 iImplementor.MacSetSinkBitRateL(pckg().iSampleRate); |
|
1399 return ETrue; |
|
1400 } |
|
1401 |
|
1402 TBool CMMFAudioControllerCustomCommandParser::DoSetSinkDataTypeL(TMMFMessage& aMessage) |
|
1403 { |
|
1404 TPckgBuf<TMMFAudioConfig> pckg; |
|
1405 aMessage.ReadData1FromClientL(pckg); |
|
1406 iImplementor.MacSetSinkDataTypeL(pckg().iSinkDataTypeCode); |
|
1407 return ETrue; |
|
1408 } |
|
1409 |
|
1410 TBool CMMFAudioControllerCustomCommandParser::DoGetSourceSampleRateL(TMMFMessage& aMessage) |
|
1411 { |
|
1412 TUint rate = 0; |
|
1413 iImplementor.MacGetSourceSampleRateL(rate); |
|
1414 TPckgBuf<TMMFAudioConfig> pckg; |
|
1415 pckg().iSampleRate = rate; |
|
1416 aMessage.WriteDataToClientL(pckg); |
|
1417 return ETrue; |
|
1418 } |
|
1419 |
|
1420 TBool CMMFAudioControllerCustomCommandParser::DoGetSourceBitRateL(TMMFMessage& aMessage) |
|
1421 { |
|
1422 TUint rate = 0; |
|
1423 iImplementor.MacGetSourceBitRateL(rate); |
|
1424 TPckgBuf<TMMFAudioConfig> pckg; |
|
1425 pckg().iSampleRate = rate; |
|
1426 aMessage.WriteDataToClientL(pckg); |
|
1427 return ETrue; |
|
1428 } |
|
1429 |
|
1430 TBool CMMFAudioControllerCustomCommandParser::DoGetSourceNumChannelsL(TMMFMessage& aMessage) |
|
1431 { |
|
1432 TUint channels = 0; |
|
1433 iImplementor.MacGetSourceNumChannelsL(channels); |
|
1434 TPckgBuf<TMMFAudioConfig> pckg; |
|
1435 pckg().iChannels = channels; |
|
1436 aMessage.WriteDataToClientL(pckg); |
|
1437 return ETrue; |
|
1438 } |
|
1439 |
|
1440 TBool CMMFAudioControllerCustomCommandParser::DoGetSourceFormatL(TMMFMessage& aMessage) |
|
1441 { |
|
1442 TUid format; |
|
1443 iImplementor.MacGetSourceFormatL(format); |
|
1444 TPckgBuf<TMMFAudioConfig> pckg; |
|
1445 pckg().iFormatUid = format; |
|
1446 aMessage.WriteDataToClientL(pckg); |
|
1447 return ETrue; |
|
1448 } |
|
1449 |
|
1450 TBool CMMFAudioControllerCustomCommandParser::DoGetSourceDataTypeL(TMMFMessage& aMessage) |
|
1451 { |
|
1452 TFourCC fourCC; |
|
1453 iImplementor.MacGetSourceDataTypeL(fourCC); |
|
1454 TPckgBuf<TMMFAudioConfig> pckg; |
|
1455 pckg().iSourceDataTypeCode = fourCC; |
|
1456 aMessage.WriteDataToClientL(pckg); |
|
1457 return ETrue; |
|
1458 } |
|
1459 |
|
1460 TBool CMMFAudioControllerCustomCommandParser::DoGetSinkSampleRateL(TMMFMessage& aMessage) |
|
1461 { |
|
1462 TUint rate = 0; |
|
1463 iImplementor.MacGetSinkSampleRateL(rate); |
|
1464 TPckgBuf<TMMFAudioConfig> pckg; |
|
1465 pckg().iSampleRate = rate; |
|
1466 aMessage.WriteDataToClientL(pckg); |
|
1467 return ETrue; |
|
1468 } |
|
1469 |
|
1470 TBool CMMFAudioControllerCustomCommandParser::DoGetSinkBitRateL(TMMFMessage& aMessage) |
|
1471 { |
|
1472 TUint rate = 0; |
|
1473 iImplementor.MacGetSinkBitRateL(rate); |
|
1474 TPckgBuf<TMMFAudioConfig> pckg; |
|
1475 pckg().iSampleRate = rate; |
|
1476 aMessage.WriteDataToClientL(pckg); |
|
1477 return ETrue; |
|
1478 } |
|
1479 |
|
1480 TBool CMMFAudioControllerCustomCommandParser::DoGetSinkNumChannelsL(TMMFMessage& aMessage) |
|
1481 { |
|
1482 TUint channels = 0; |
|
1483 iImplementor.MacGetSinkNumChannelsL(channels); |
|
1484 TPckgBuf<TMMFAudioConfig> pckg; |
|
1485 pckg().iChannels = channels; |
|
1486 aMessage.WriteDataToClientL(pckg); |
|
1487 return ETrue; |
|
1488 } |
|
1489 |
|
1490 TBool CMMFAudioControllerCustomCommandParser::DoGetSinkFormatL(TMMFMessage& aMessage) |
|
1491 { |
|
1492 TUid format; |
|
1493 iImplementor.MacGetSinkFormatL(format); |
|
1494 TPckgBuf<TMMFAudioConfig> pckg; |
|
1495 pckg().iFormatUid = format; |
|
1496 aMessage.WriteDataToClientL(pckg); |
|
1497 return ETrue; |
|
1498 } |
|
1499 |
|
1500 TBool CMMFAudioControllerCustomCommandParser::DoGetSinkDataTypeL(TMMFMessage& aMessage) |
|
1501 { |
|
1502 TFourCC fourCC; |
|
1503 iImplementor.MacGetSinkDataTypeL(fourCC); |
|
1504 TPckgBuf<TMMFAudioConfig> pckg; |
|
1505 pckg().iSinkDataTypeCode = fourCC; |
|
1506 aMessage.WriteDataToClientL(pckg); |
|
1507 return ETrue; |
|
1508 } |
|
1509 |
|
1510 TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceSampleRatesL(TMMFMessage& aMessage) |
|
1511 { |
|
1512 RArray<TUint> rates; |
|
1513 CleanupClosePushL(rates); |
|
1514 iImplementor.MacGetSupportedSourceSampleRatesL(rates); |
|
1515 |
|
1516 DoCreateBufFromUintArrayL(rates); |
|
1517 |
|
1518 TPckgBuf<TInt> pckg; |
|
1519 pckg() = rates.Count(); |
|
1520 aMessage.WriteDataToClientL(pckg); |
|
1521 |
|
1522 CleanupStack::PopAndDestroy();//rates |
|
1523 return ETrue; |
|
1524 } |
|
1525 |
|
1526 void CMMFAudioControllerCustomCommandParser::DoCreateBufFromUintArrayL(RArray<TUint>& aArray) |
|
1527 { |
|
1528 delete iDataCopyBuffer; |
|
1529 iDataCopyBuffer = NULL; |
|
1530 |
|
1531 iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8); |
|
1532 RBufWriteStream stream; |
|
1533 stream.Open(*iDataCopyBuffer); |
|
1534 CleanupClosePushL(stream); |
|
1535 for (TInt i=0;i<aArray.Count();i++) |
|
1536 stream.WriteUint32L(aArray[i]); |
|
1537 CleanupStack::PopAndDestroy();//stream |
|
1538 } |
|
1539 |
|
1540 void CMMFAudioControllerCustomCommandParser::DoCreateBufFromFourCCArrayL(RArray<TFourCC>& aArray) |
|
1541 { |
|
1542 delete iDataCopyBuffer; |
|
1543 iDataCopyBuffer = NULL; |
|
1544 |
|
1545 iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8); |
|
1546 RBufWriteStream stream; |
|
1547 stream.Open(*iDataCopyBuffer); |
|
1548 CleanupClosePushL(stream); |
|
1549 for (TInt i=0;i<aArray.Count();i++) |
|
1550 { |
|
1551 stream.WriteInt32L(aArray[i].FourCC()); |
|
1552 } |
|
1553 CleanupStack::PopAndDestroy();//stream |
|
1554 } |
|
1555 |
|
1556 TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceBitRatesL(TMMFMessage& aMessage) |
|
1557 { |
|
1558 RArray<TUint> rates; |
|
1559 CleanupClosePushL(rates); |
|
1560 iImplementor.MacGetSupportedSourceBitRatesL(rates); |
|
1561 |
|
1562 DoCreateBufFromUintArrayL(rates); |
|
1563 |
|
1564 TPckgBuf<TInt> pckg; |
|
1565 pckg() = rates.Count(); |
|
1566 aMessage.WriteDataToClientL(pckg); |
|
1567 |
|
1568 CleanupStack::PopAndDestroy();//rates |
|
1569 return ETrue; |
|
1570 } |
|
1571 |
|
1572 TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceNumChannelsL(TMMFMessage& aMessage) |
|
1573 { |
|
1574 RArray<TUint> array; |
|
1575 CleanupClosePushL(array); |
|
1576 iImplementor.MacGetSupportedSourceNumChannelsL(array); |
|
1577 |
|
1578 DoCreateBufFromUintArrayL(array); |
|
1579 |
|
1580 TPckgBuf<TInt> pckg; |
|
1581 pckg() = array.Count(); |
|
1582 aMessage.WriteDataToClientL(pckg); |
|
1583 |
|
1584 CleanupStack::PopAndDestroy();//array |
|
1585 return ETrue; |
|
1586 } |
|
1587 |
|
1588 TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceDataTypesL(TMMFMessage& aMessage) |
|
1589 { |
|
1590 RArray<TFourCC> array; |
|
1591 CleanupClosePushL(array); |
|
1592 iImplementor.MacGetSupportedSourceDataTypesL(array); |
|
1593 |
|
1594 DoCreateBufFromFourCCArrayL(array); |
|
1595 |
|
1596 TPckgBuf<TInt> pckg; |
|
1597 pckg() = array.Count(); |
|
1598 aMessage.WriteDataToClientL(pckg); |
|
1599 |
|
1600 CleanupStack::PopAndDestroy();//array |
|
1601 return ETrue; |
|
1602 } |
|
1603 |
|
1604 TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkSampleRatesL(TMMFMessage& aMessage) |
|
1605 { |
|
1606 RArray<TUint> array; |
|
1607 CleanupClosePushL(array); |
|
1608 iImplementor.MacGetSupportedSinkSampleRatesL(array); |
|
1609 |
|
1610 DoCreateBufFromUintArrayL(array); |
|
1611 |
|
1612 TPckgBuf<TInt> pckg; |
|
1613 pckg() = array.Count(); |
|
1614 aMessage.WriteDataToClientL(pckg); |
|
1615 |
|
1616 CleanupStack::PopAndDestroy();//array |
|
1617 return ETrue; |
|
1618 } |
|
1619 |
|
1620 TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkBitRatesL(TMMFMessage& aMessage) |
|
1621 { |
|
1622 RArray<TUint> array; |
|
1623 CleanupClosePushL(array); |
|
1624 iImplementor.MacGetSupportedSinkBitRatesL(array); |
|
1625 |
|
1626 DoCreateBufFromUintArrayL(array); |
|
1627 |
|
1628 TPckgBuf<TInt> pckg; |
|
1629 pckg() = array.Count(); |
|
1630 aMessage.WriteDataToClientL(pckg); |
|
1631 |
|
1632 CleanupStack::PopAndDestroy();//array |
|
1633 return ETrue; |
|
1634 } |
|
1635 |
|
1636 TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkNumChannelsL(TMMFMessage& aMessage) |
|
1637 { |
|
1638 RArray<TUint> array; |
|
1639 CleanupClosePushL(array); |
|
1640 iImplementor.MacGetSupportedSinkNumChannelsL(array); |
|
1641 |
|
1642 DoCreateBufFromUintArrayL(array); |
|
1643 |
|
1644 TPckgBuf<TInt> pckg; |
|
1645 pckg() = array.Count(); |
|
1646 aMessage.WriteDataToClientL(pckg); |
|
1647 |
|
1648 CleanupStack::PopAndDestroy();//array |
|
1649 return ETrue; |
|
1650 } |
|
1651 |
|
1652 TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkDataTypesL(TMMFMessage& aMessage) |
|
1653 { |
|
1654 RArray<TFourCC> array; |
|
1655 CleanupClosePushL(array); |
|
1656 iImplementor.MacGetSupportedSinkDataTypesL(array); |
|
1657 |
|
1658 DoCreateBufFromFourCCArrayL(array); |
|
1659 |
|
1660 TPckgBuf<TInt> pckg; |
|
1661 pckg() = array.Count(); |
|
1662 aMessage.WriteDataToClientL(pckg); |
|
1663 |
|
1664 CleanupStack::PopAndDestroy();//array |
|
1665 return ETrue; |
|
1666 } |
|
1667 |
|
1668 TBool CMMFAudioControllerCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage) |
|
1669 { |
|
1670 if (!iDataCopyBuffer) |
|
1671 User::Leave(KErrNotReady); |
|
1672 aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0)); |
|
1673 return ETrue; |
|
1674 } |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 TBool CMMFVideoRecordControllerCustomCommandParser::DoCopyCDesC8ArrayDataL(TMMFMessage& aMessage) |
|
1680 { |
|
1681 if (!iDataCopyBuffer) |
|
1682 User::Leave(KErrNotReady); |
|
1683 aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0)); |
|
1684 return ETrue; |
|
1685 } |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 EXPORT_C RMMFVideoControllerCustomCommands::RMMFVideoControllerCustomCommands(RMMFController& aController) : |
|
1711 RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoController) |
|
1712 { |
|
1713 } |
|
1714 |
|
1715 EXPORT_C TInt RMMFVideoControllerCustomCommands::GetFrameRate(TReal32& aFramesPerSecond) const |
|
1716 { |
|
1717 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1718 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1719 EMMFVideoControllerGetFrameRate, |
|
1720 KNullDesC8, |
|
1721 KNullDesC8, |
|
1722 configPackage); |
|
1723 if (!error) |
|
1724 aFramesPerSecond = configPackage().iFramesPerSecond; |
|
1725 return error; |
|
1726 } |
|
1727 |
|
1728 EXPORT_C TInt RMMFVideoControllerCustomCommands::SetFrameRate(TReal32 aFramesPerSecond) const |
|
1729 { |
|
1730 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1731 configPackage().iFramesPerSecond = aFramesPerSecond; |
|
1732 return iController.CustomCommandSync(iDestinationPckg, |
|
1733 EMMFVideoControllerSetFrameRate, |
|
1734 configPackage, |
|
1735 KNullDesC8); |
|
1736 } |
|
1737 |
|
1738 |
|
1739 EXPORT_C void RMMFVideoPlayControllerCustomCommands::GetFrame(CFbsBitmap& aBitmap,TRequestStatus& aStatus) |
|
1740 { |
|
1741 TInt handle = aBitmap.Handle(); |
|
1742 |
|
1743 iConfigPackage().iFrameBitmapServerHandle = handle; |
|
1744 iController.CustomCommandAsync(iDestinationPckg, |
|
1745 EMMFVideoPlayControllerGetFrame, |
|
1746 iConfigPackage, |
|
1747 KNullDesC8, |
|
1748 aStatus); |
|
1749 } |
|
1750 |
|
1751 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::UpdateDisplayRegion(const TRegion& aRegion) const |
|
1752 { |
|
1753 TPckgBuf<TInt> numberOfRectsPckg; |
|
1754 numberOfRectsPckg() = aRegion.Count(); |
|
1755 const TRect* rects = aRegion.RectangleList(); |
|
1756 TPtrC8 rectMemory(REINTERPRET_CAST(TUint8*,(void*) rects), numberOfRectsPckg() * sizeof(TRect)); |
|
1757 |
|
1758 return iController.CustomCommandSync(iDestinationPckg, |
|
1759 EMMFVideoPlayControllerUpdateDisplayRegion, |
|
1760 numberOfRectsPckg, |
|
1761 rectMemory); |
|
1762 } |
|
1763 |
|
1764 |
|
1765 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::DirectScreenAccessEvent(const TMMFDSAEvent aDSAEvent) const |
|
1766 { |
|
1767 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1768 configPackage().iDSAEvent = (TInt)aDSAEvent; |
|
1769 return iController.CustomCommandSync(iDestinationPckg, |
|
1770 EMMFVideoPlayControllerDSAEvent, |
|
1771 configPackage, |
|
1772 KNullDesC8); |
|
1773 } |
|
1774 |
|
1775 |
|
1776 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::Play(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd) const |
|
1777 { |
|
1778 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1779 configPackage().iStartPosition = aStart; |
|
1780 configPackage().iEndPosition = aEnd; |
|
1781 return iController.CustomCommandSync(iDestinationPckg, |
|
1782 EMMFVideoPlayControllerPlay, |
|
1783 configPackage, |
|
1784 KNullDesC8); |
|
1785 } |
|
1786 |
|
1787 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::RefreshFrame() const |
|
1788 { |
|
1789 return iController.CustomCommandSync(iDestinationPckg, |
|
1790 EMMFVideoPlayControllerRefreshFrame, |
|
1791 KNullDesC8, |
|
1792 KNullDesC8); |
|
1793 } |
|
1794 |
|
1795 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetLoadingProgress(TInt& aPercentageComplete) const |
|
1796 { |
|
1797 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1798 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1799 EMMFVideoPlayControllerGetLoadingProgress, |
|
1800 KNullDesC8, |
|
1801 KNullDesC8, |
|
1802 configPackage); |
|
1803 if (!error) |
|
1804 aPercentageComplete = configPackage().iLoadingCompletePercentage; |
|
1805 return error; |
|
1806 } |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoFrameSize(TSize& aVideoFrameSize) const |
|
1812 { |
|
1813 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1814 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1815 EMMFVideoControllerGetVideoFrameSize, |
|
1816 KNullDesC8, |
|
1817 KNullDesC8, |
|
1818 configPackage); |
|
1819 if (!error) |
|
1820 aVideoFrameSize = configPackage().iVideoFrameSize; |
|
1821 return error; |
|
1822 } |
|
1823 |
|
1824 EXPORT_C TInt RMMFVideoControllerCustomCommands::GetAudioBitRate(TInt& aBitRate) const |
|
1825 { |
|
1826 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1827 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1828 EMMFVideoControllerGetAudioBitRate, |
|
1829 KNullDesC8, |
|
1830 KNullDesC8, |
|
1831 configPackage); |
|
1832 if (!error) |
|
1833 aBitRate = configPackage().iAudioBitRate; |
|
1834 return error; |
|
1835 } |
|
1836 |
|
1837 EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoBitRate(TInt& aBitRate) const |
|
1838 { |
|
1839 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1840 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1841 EMMFVideoControllerGetVideoBitRate, |
|
1842 KNullDesC8, |
|
1843 KNullDesC8, |
|
1844 configPackage); |
|
1845 if (!error) |
|
1846 aBitRate = configPackage().iVideoBitRate; |
|
1847 return error; |
|
1848 } |
|
1849 EXPORT_C TInt RMMFVideoControllerCustomCommands::GetAudioCodec(TFourCC& aCodec) const |
|
1850 { |
|
1851 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1852 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
1853 EMMFVideoControllerGetAudioCodec, |
|
1854 KNullDesC8, |
|
1855 KNullDesC8, |
|
1856 configPackage); |
|
1857 if (!error) |
|
1858 aCodec = configPackage().iAudioCodec; |
|
1859 return error; |
|
1860 } |
|
1861 |
|
1862 |
|
1863 EXPORT_C void Reserved1( void ) |
|
1864 { |
|
1865 // dummy reserved function to replace GetVideoCodec() which was removed. |
|
1866 // this should never be called so generate a panic |
|
1867 Panic( ENoGetVideoCodec ); |
|
1868 } |
|
1869 |
|
1870 EXPORT_C void Reserved2( void ) |
|
1871 { |
|
1872 // dummy reserved function to replace GetSupportedSourceVideoTypes() which was removed. |
|
1873 // this should never be called so generate a panic |
|
1874 Panic( ENoGetSourceVideoTypes ); |
|
1875 } |
|
1876 |
|
1877 EXPORT_C void Reserved3( void ) |
|
1878 { |
|
1879 // dummy reserved function to replace GetSupportedSourceAudioTypes() which was removed. |
|
1880 // this should never be called so generate a panic |
|
1881 Panic( ENoGetSourceAudioTypes ); |
|
1882 } |
|
1883 |
|
1884 |
|
1885 EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoMimeType(TDes8& aMimeType) const |
|
1886 { |
|
1887 TInt err = iController.CustomCommandSync(iDestinationPckg, |
|
1888 EMMFVideoControllerGetVideoMimeType, |
|
1889 KNullDesC8, |
|
1890 KNullDesC8, |
|
1891 aMimeType); |
|
1892 return err; |
|
1893 } |
|
1894 |
|
1895 |
|
1896 void RMMFVideoRecordControllerCustomCommands::DoGetFourCCArrayL(RArray<TFourCC>& aArray) const |
|
1897 { |
|
1898 aArray.Reset(); |
|
1899 |
|
1900 TPckgBuf<TInt> numberOfElementsPckg; |
|
1901 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
1902 EMMFVideoRecordControllerGetSupportedSinkAudioTypes, |
|
1903 KNullDesC8, |
|
1904 KNullDesC8, |
|
1905 numberOfElementsPckg)); |
|
1906 |
|
1907 HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); |
|
1908 TPtr8 ptr = buf->Des(); |
|
1909 |
|
1910 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
1911 EMMFVideoRecordControllerCopyFourCCArrayData, |
|
1912 KNullDesC8, |
|
1913 KNullDesC8, |
|
1914 ptr)); |
|
1915 RDesReadStream stream(ptr); |
|
1916 CleanupClosePushL(stream); |
|
1917 |
|
1918 for (TInt i=0; i<numberOfElementsPckg(); i++) |
|
1919 { |
|
1920 User::LeaveIfError(aArray.Append(stream.ReadInt32L())); |
|
1921 } |
|
1922 |
|
1923 CleanupStack::PopAndDestroy(2);//stream, buf |
|
1924 } |
|
1925 |
|
1926 |
|
1927 void RMMFVideoRecordControllerCustomCommands::DoGetCDesC8ArrayL(CDesC8Array& aArray, TMMFVideoRecordControllerMessages aIpc) const |
|
1928 { |
|
1929 aArray.Reset(); |
|
1930 |
|
1931 TPckgBuf<TMimeTypeBufferInfo> bufferInfoPckg; |
|
1932 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
1933 aIpc, |
|
1934 KNullDesC8, |
|
1935 KNullDesC8, |
|
1936 bufferInfoPckg)); |
|
1937 |
|
1938 // allocate a buffer of size dictated by server side |
|
1939 HBufC8* buf = HBufC8::NewLC(bufferInfoPckg().bufferLen); |
|
1940 TPtr8 ptr = buf->Des(); |
|
1941 |
|
1942 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
1943 EMMFVideoRecordControllerCopyDescriptorArrayData, |
|
1944 KNullDesC8, |
|
1945 KNullDesC8, |
|
1946 ptr)); |
|
1947 RDesReadStream stream(ptr); |
|
1948 CleanupClosePushL(stream); |
|
1949 |
|
1950 TInt32 len; |
|
1951 |
|
1952 for (TInt i=0; i < bufferInfoPckg().count; i++) |
|
1953 { |
|
1954 User::LeaveIfError(len = stream.ReadInt32L()); |
|
1955 |
|
1956 HBufC8* tempDesc = HBufC8::NewLC(len); |
|
1957 TPtr8 tempPtr = tempDesc->Des(); |
|
1958 |
|
1959 stream.ReadL(tempPtr, len); |
|
1960 aArray.AppendL(tempPtr); |
|
1961 |
|
1962 CleanupStack::PopAndDestroy(tempDesc); |
|
1963 } |
|
1964 |
|
1965 CleanupStack::PopAndDestroy(2);//stream, buf |
|
1966 |
|
1967 } |
|
1968 |
|
1969 |
|
1970 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetDisplayWindow(const TRect& aWindowRect, |
|
1971 const TRect& aClipRect) const |
|
1972 { |
|
1973 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1974 configPackage().iWindowRect = aWindowRect; |
|
1975 configPackage().iClipRect = aClipRect; |
|
1976 |
|
1977 return iController.CustomCommandSync(iDestinationPckg, |
|
1978 EMMFVideoPlayControllerSetDisplayWindow, |
|
1979 configPackage, |
|
1980 KNullDesC8); |
|
1981 } |
|
1982 |
|
1983 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetAudioEnabled(TBool& aEnabled) const |
|
1984 { |
|
1985 TPckgBuf<TMMFVideoConfig> configPackage; |
|
1986 |
|
1987 TInt err = iController.CustomCommandSync(iDestinationPckg, |
|
1988 EMMFVideoPlayControllerGetAudioEnabled, |
|
1989 KNullDesC8, |
|
1990 KNullDesC8, |
|
1991 configPackage); |
|
1992 |
|
1993 if (!err) |
|
1994 aEnabled = configPackage().iAudioEnabled; |
|
1995 return err; |
|
1996 } |
|
1997 |
|
1998 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::Prepare() |
|
1999 { |
|
2000 return iController.CustomCommandSync(iDestinationPckg, |
|
2001 EMMFVideoPlayControllerPrepare, |
|
2002 KNullDesC8, |
|
2003 KNullDesC8); |
|
2004 } |
|
2005 |
|
2006 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetRotation(TVideoRotation aRotation) const |
|
2007 { |
|
2008 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2009 configPackage().iVideoRotation = aRotation; |
|
2010 |
|
2011 return iController.CustomCommandSync(iDestinationPckg, |
|
2012 EMMFVideoPlayControllerSetRotation, |
|
2013 configPackage, |
|
2014 KNullDesC8); |
|
2015 } |
|
2016 |
|
2017 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetRotation(TVideoRotation& aRotation) const |
|
2018 { |
|
2019 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2020 |
|
2021 TInt err = iController.CustomCommandSync(iDestinationPckg, |
|
2022 EMMFVideoPlayControllerGetRotation, |
|
2023 KNullDesC8, |
|
2024 KNullDesC8, |
|
2025 configPackage); |
|
2026 |
|
2027 if (!err) |
|
2028 aRotation = configPackage().iVideoRotation; |
|
2029 return err; |
|
2030 } |
|
2031 |
|
2032 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetScaleFactor(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering) const |
|
2033 { |
|
2034 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2035 configPackage().iWidthScalePercentage = aWidthPercentage; |
|
2036 configPackage().iHeightScalePercentage = aHeightPercentage; |
|
2037 configPackage().iAntiAliasFiltering = aAntiAliasFiltering; |
|
2038 |
|
2039 return iController.CustomCommandSync(iDestinationPckg, |
|
2040 EMMFVideoPlayControllerSetScaleFactor, |
|
2041 configPackage, |
|
2042 KNullDesC8); |
|
2043 } |
|
2044 |
|
2045 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetScaleFactor(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const |
|
2046 { |
|
2047 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2048 |
|
2049 TInt err = iController.CustomCommandSync(iDestinationPckg, |
|
2050 EMMFVideoPlayControllerGetScaleFactor, |
|
2051 KNullDesC8, |
|
2052 KNullDesC8, |
|
2053 configPackage); |
|
2054 |
|
2055 if (!err) |
|
2056 { |
|
2057 aWidthPercentage = configPackage().iWidthScalePercentage; |
|
2058 aHeightPercentage = configPackage().iHeightScalePercentage; |
|
2059 aAntiAliasFiltering = configPackage().iAntiAliasFiltering; |
|
2060 } |
|
2061 return err; |
|
2062 } |
|
2063 |
|
2064 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetCropRegion(const TRect& aCropRegion) const |
|
2065 { |
|
2066 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2067 configPackage().iCropRectangle = aCropRegion; |
|
2068 |
|
2069 return iController.CustomCommandSync(iDestinationPckg, |
|
2070 EMMFVideoPlayControllerSetCropRegion, |
|
2071 configPackage, |
|
2072 KNullDesC8); |
|
2073 } |
|
2074 |
|
2075 EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetCropRegion(TRect& aCropRegion) const |
|
2076 { |
|
2077 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2078 |
|
2079 TInt err = iController.CustomCommandSync(iDestinationPckg, |
|
2080 EMMFVideoPlayControllerGetCropRegion, |
|
2081 KNullDesC8, |
|
2082 KNullDesC8, |
|
2083 configPackage); |
|
2084 |
|
2085 if (!err) |
|
2086 { |
|
2087 aCropRegion = configPackage().iCropRectangle; |
|
2088 } |
|
2089 return err; |
|
2090 } |
|
2091 |
|
2092 EXPORT_C RMMFVideoRecordControllerCustomCommands::RMMFVideoRecordControllerCustomCommands(RMMFController& aController) : |
|
2093 RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoRecordController) |
|
2094 { |
|
2095 } |
|
2096 |
|
2097 |
|
2098 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoFormat(TUid aFormatUid) const |
|
2099 { |
|
2100 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2101 configPackage().iFormatUid = aFormatUid; |
|
2102 return iController.CustomCommandSync(iDestinationPckg, |
|
2103 EMMFVideoRecordControllerSetVideoFormat, |
|
2104 configPackage, |
|
2105 KNullDesC8); |
|
2106 } |
|
2107 |
|
2108 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoCodec(const TDesC8& aVideoCodec) const |
|
2109 { |
|
2110 return iController.CustomCommandSync(iDestinationPckg, |
|
2111 EMMFVideoRecordControllerSetVideoCodec, |
|
2112 aVideoCodec, |
|
2113 KNullDesC8); |
|
2114 } |
|
2115 |
|
2116 |
|
2117 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioCodec(TFourCC aAudioCodec) const |
|
2118 { |
|
2119 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2120 configPackage().iAudioCodec = aAudioCodec; |
|
2121 return iController.CustomCommandSync(iDestinationPckg, |
|
2122 EMMFVideoRecordControllerSetAudioCodec, |
|
2123 configPackage, |
|
2124 KNullDesC8); |
|
2125 } |
|
2126 |
|
2127 |
|
2128 EXPORT_C void RMMFVideoRecordControllerCustomCommands::AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry) const |
|
2129 { |
|
2130 CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32); |
|
2131 CleanupStack::PushL(buf); |
|
2132 RBufWriteStream s; |
|
2133 s.Open(*buf); |
|
2134 CleanupClosePushL(s); |
|
2135 aNewEntry.ExternalizeL(s); |
|
2136 TPtr8 bufData = buf->Ptr(0); |
|
2137 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
2138 EMMFVideoRecordControllerAddMetaDataEntry, |
|
2139 bufData, |
|
2140 KNullDesC8)); |
|
2141 CleanupStack::PopAndDestroy(2);//s, buf |
|
2142 } |
|
2143 |
|
2144 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::RemoveMetaDataEntry(TInt aIndex) const |
|
2145 { |
|
2146 TPckgBuf<TInt> pckg(aIndex); |
|
2147 return iController.CustomCommandSync(iDestinationPckg, |
|
2148 EMMFVideoRecordControllerRemoveMetaDataEntry, |
|
2149 pckg, |
|
2150 KNullDesC8); |
|
2151 } |
|
2152 |
|
2153 EXPORT_C void RMMFVideoRecordControllerCustomCommands::ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry) const |
|
2154 { |
|
2155 TPckgBuf<TInt> indexPckg(aIndex); |
|
2156 CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32); |
|
2157 CleanupStack::PushL(buf); |
|
2158 RBufWriteStream s; |
|
2159 s.Open(*buf); |
|
2160 CleanupClosePushL(s); |
|
2161 aNewEntry.ExternalizeL(s); |
|
2162 TPtr8 bufData = buf->Ptr(0); |
|
2163 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
2164 EMMFVideoRecordControllerReplaceMetaDataEntry, |
|
2165 bufData, |
|
2166 indexPckg)); |
|
2167 CleanupStack::PopAndDestroy(2);//s, buf |
|
2168 } |
|
2169 |
|
2170 |
|
2171 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetMaxFileSize(TInt aMaxSize) const |
|
2172 { |
|
2173 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2174 configPackage().iMaxFileSize = aMaxSize; |
|
2175 return iController.CustomCommandSync(iDestinationPckg, |
|
2176 EMMFVideoRecordControllerSetMaxFileSize, |
|
2177 configPackage, |
|
2178 KNullDesC8); |
|
2179 } |
|
2180 |
|
2181 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoBitRate(TInt aRate) const |
|
2182 { |
|
2183 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2184 configPackage().iVideoBitRate = aRate; |
|
2185 |
|
2186 return iController.CustomCommandSync(iDestinationPckg, |
|
2187 EMMFVideoRecordControllerSetVideoBitRate, |
|
2188 configPackage, |
|
2189 KNullDesC8); |
|
2190 |
|
2191 } |
|
2192 |
|
2193 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioBitRate(TInt aRate) const |
|
2194 { |
|
2195 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2196 configPackage().iAudioBitRate = aRate; |
|
2197 |
|
2198 return iController.CustomCommandSync(iDestinationPckg, |
|
2199 EMMFVideoRecordControllerSetAudioBitRate, |
|
2200 configPackage, |
|
2201 KNullDesC8); |
|
2202 } |
|
2203 |
|
2204 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoFrameSize(TSize aSize) const |
|
2205 { |
|
2206 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2207 configPackage().iVideoFrameSize = aSize; |
|
2208 |
|
2209 return iController.CustomCommandSync(iDestinationPckg, |
|
2210 EMMFVideoRecordControllerSetVideoFrameSize, |
|
2211 configPackage, |
|
2212 KNullDesC8); |
|
2213 } |
|
2214 |
|
2215 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioEnabled(TBool aEnabled) const |
|
2216 { |
|
2217 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2218 configPackage().iAudioEnabled = aEnabled; |
|
2219 |
|
2220 return iController.CustomCommandSync(iDestinationPckg, |
|
2221 EMMFVideoRecordControllerSetAudioEnabled, |
|
2222 configPackage, |
|
2223 KNullDesC8); |
|
2224 } |
|
2225 |
|
2226 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::Prepare() const |
|
2227 { |
|
2228 |
|
2229 return iController.CustomCommandSync(iDestinationPckg, |
|
2230 EMMFVideoRecordControllerPrepare, |
|
2231 KNullDesC8, |
|
2232 KNullDesC8); |
|
2233 } |
|
2234 |
|
2235 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetCameraHandle(TInt aCameraHandle) const |
|
2236 { |
|
2237 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2238 configPackage().iCameraHandle = aCameraHandle; |
|
2239 |
|
2240 return iController.CustomCommandSync(iDestinationPckg, |
|
2241 EMMFVideoRecordControllerSetCameraHandle, |
|
2242 configPackage, |
|
2243 KNullDesC8); |
|
2244 } |
|
2245 |
|
2246 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetRecordTimeAvailable(TTimeIntervalMicroSeconds& aTime) const |
|
2247 { |
|
2248 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2249 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
2250 EMMFVideoRecordControllerGetRecordTimeAvailable, |
|
2251 KNullDesC8, |
|
2252 KNullDesC8, |
|
2253 configPackage); |
|
2254 if (!error) |
|
2255 aTime = configPackage().iRecordTimeAvailable; |
|
2256 return error; |
|
2257 } |
|
2258 |
|
2259 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetSupportedSinkVideoTypes(CDesC8Array& aSupportedDataTypes) const |
|
2260 { |
|
2261 TInt err; |
|
2262 TRAP(err, DoGetCDesC8ArrayL(aSupportedDataTypes, EMMFVideoRecordControllerGetSupportedSinkVideoTypes)); |
|
2263 return err; |
|
2264 } |
|
2265 |
|
2266 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetSupportedSinkAudioTypes(RArray<TFourCC>& aSupportedDataTypes) const |
|
2267 { |
|
2268 TInt err; |
|
2269 TRAP(err, DoGetFourCCArrayL(aSupportedDataTypes)); |
|
2270 return err; |
|
2271 } |
|
2272 |
|
2273 |
|
2274 // New method as part of INC23777. |
|
2275 EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetAudioEnabled(TBool& aEnabled) const |
|
2276 { |
|
2277 TPckgBuf<TMMFVideoConfig> configPackage; |
|
2278 |
|
2279 TInt err = iController.CustomCommandSync(iDestinationPckg, |
|
2280 EMMFVideoRecordControllerGetAudioEnabled, |
|
2281 KNullDesC8, |
|
2282 KNullDesC8, |
|
2283 configPackage); |
|
2284 |
|
2285 if (!err) |
|
2286 aEnabled = configPackage().iAudioEnabled; |
|
2287 return err; |
|
2288 } |
|
2289 |
|
2290 EXPORT_C CMMFVideoControllerCustomCommandParser* CMMFVideoControllerCustomCommandParser::NewL(MMMFVideoControllerCustomCommandImplementor& aImplementor) |
|
2291 { |
|
2292 return new(ELeave) CMMFVideoControllerCustomCommandParser(aImplementor); |
|
2293 } |
|
2294 |
|
2295 EXPORT_C CMMFVideoControllerCustomCommandParser::~CMMFVideoControllerCustomCommandParser() |
|
2296 { |
|
2297 } |
|
2298 |
|
2299 CMMFVideoControllerCustomCommandParser::CMMFVideoControllerCustomCommandParser(MMMFVideoControllerCustomCommandImplementor& aImplementor) : |
|
2300 CMMFCustomCommandParserBase(KUidInterfaceMMFVideoController), |
|
2301 iImplementor(aImplementor) |
|
2302 { |
|
2303 } |
|
2304 |
|
2305 void CMMFVideoControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
2306 { |
|
2307 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoController) |
|
2308 { |
|
2309 TRAPD(error, DoHandleRequestL(aMessage)); |
|
2310 if (error) |
|
2311 aMessage.Complete(error); |
|
2312 } |
|
2313 else |
|
2314 { |
|
2315 aMessage.Complete(KErrNotSupported); |
|
2316 } |
|
2317 } |
|
2318 |
|
2319 void CMMFVideoControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
2320 { |
|
2321 TBool complete = ETrue; |
|
2322 switch (aMessage.Function()) |
|
2323 { |
|
2324 case EMMFVideoControllerGetAudioBitRate: |
|
2325 complete = DoGetAudioBitRateL(aMessage); |
|
2326 break; |
|
2327 case EMMFVideoControllerGetVideoBitRate: |
|
2328 complete = DoGetVideoBitRateL(aMessage); |
|
2329 break; |
|
2330 case EMMFVideoControllerGetAudioCodec: |
|
2331 complete = DoGetAudioCodecL(aMessage); |
|
2332 break; |
|
2333 case EMMFVideoControllerGetVideoFrameSize: |
|
2334 complete = DoGetVideoFrameSizeL(aMessage); |
|
2335 break; |
|
2336 case EMMFVideoControllerSetFrameRate: |
|
2337 complete = DoSetFrameRateL(aMessage); |
|
2338 break; |
|
2339 case EMMFVideoControllerGetFrameRate: |
|
2340 complete = DoGetFrameRateL(aMessage); |
|
2341 break; |
|
2342 case EMMFVideoControllerGetVideoMimeType: |
|
2343 complete = DoGetVideoMimeTypeL(aMessage); |
|
2344 break; |
|
2345 default: |
|
2346 User::Leave(KErrNotSupported); |
|
2347 break; |
|
2348 } |
|
2349 if (complete) |
|
2350 aMessage.Complete(KErrNone); |
|
2351 } |
|
2352 |
|
2353 TBool CMMFVideoControllerCustomCommandParser::DoGetVideoFrameSizeL(TMMFMessage& aMessage) |
|
2354 { |
|
2355 TSize size; |
|
2356 iImplementor.MvcGetVideoFrameSizeL(size); |
|
2357 TPckgBuf<TMMFVideoConfig> pckg; |
|
2358 pckg().iVideoFrameSize = size; |
|
2359 aMessage.WriteDataToClientL(pckg); |
|
2360 return ETrue; |
|
2361 } |
|
2362 |
|
2363 TBool CMMFVideoControllerCustomCommandParser::DoGetAudioCodecL(TMMFMessage& aMessage) |
|
2364 { |
|
2365 TFourCC audioCodec; |
|
2366 iImplementor.MvcGetAudioCodecL(audioCodec); |
|
2367 TPckgBuf<TMMFVideoConfig> pckg; |
|
2368 pckg().iAudioCodec = audioCodec; |
|
2369 aMessage.WriteDataToClientL(pckg); |
|
2370 return ETrue; |
|
2371 } |
|
2372 |
|
2373 TBool CMMFVideoControllerCustomCommandParser::DoGetVideoBitRateL(TMMFMessage& aMessage) |
|
2374 { |
|
2375 TInt videoBitRate; |
|
2376 iImplementor.MvcGetVideoBitRateL(videoBitRate); |
|
2377 TPckgBuf<TMMFVideoConfig> pckg; |
|
2378 pckg().iVideoBitRate = videoBitRate; |
|
2379 aMessage.WriteDataToClientL(pckg); |
|
2380 return ETrue; |
|
2381 } |
|
2382 |
|
2383 TBool CMMFVideoControllerCustomCommandParser::DoGetAudioBitRateL(TMMFMessage& aMessage) |
|
2384 { |
|
2385 TInt audioBitRate; |
|
2386 iImplementor.MvcGetAudioBitRateL(audioBitRate); |
|
2387 TPckgBuf<TMMFVideoConfig> pckg; |
|
2388 pckg().iAudioBitRate = audioBitRate; |
|
2389 aMessage.WriteDataToClientL(pckg); |
|
2390 return ETrue; |
|
2391 } |
|
2392 |
|
2393 TBool CMMFVideoControllerCustomCommandParser::DoSetFrameRateL(TMMFMessage& aMessage) |
|
2394 { |
|
2395 TPckgBuf<TMMFVideoConfig> pckg; |
|
2396 aMessage.ReadData1FromClientL(pckg); |
|
2397 iImplementor.MvcSetFrameRateL(pckg().iFramesPerSecond); |
|
2398 return ETrue; |
|
2399 } |
|
2400 |
|
2401 TBool CMMFVideoControllerCustomCommandParser::DoGetFrameRateL(TMMFMessage& aMessage) |
|
2402 { |
|
2403 TReal32 frameRate = 0; |
|
2404 iImplementor.MvcGetFrameRateL(frameRate); |
|
2405 TPckgBuf<TMMFVideoConfig> pckg; |
|
2406 pckg().iFramesPerSecond = frameRate; |
|
2407 aMessage.WriteDataToClientL(pckg); |
|
2408 return ETrue; |
|
2409 } |
|
2410 |
|
2411 TBool CMMFVideoControllerCustomCommandParser::DoGetVideoMimeTypeL(TMMFMessage& aMessage) |
|
2412 { |
|
2413 TBuf8<KMaxMimeTypeLength> mimeType; |
|
2414 iImplementor.MvcGetVideoMimeTypeL(mimeType); |
|
2415 |
|
2416 aMessage.WriteDataToClientL(mimeType); |
|
2417 return ETrue; |
|
2418 } |
|
2419 |
|
2420 |
|
2421 TBool CMMFVideoRecordControllerCustomCommandParser::DoGetSupportedSinkAudioTypesL(TMMFMessage& aMessage) |
|
2422 { |
|
2423 RArray<TFourCC> array; |
|
2424 CleanupClosePushL(array); |
|
2425 iImplementor.MvrcGetSupportedSinkAudioTypesL(array); |
|
2426 |
|
2427 DoCreateBufFromFourCCArrayL(array); |
|
2428 |
|
2429 TPckgBuf<TInt> pckg; |
|
2430 pckg() = array.Count(); |
|
2431 aMessage.WriteDataToClientL(pckg); |
|
2432 |
|
2433 CleanupStack::PopAndDestroy();//array |
|
2434 return ETrue; |
|
2435 } |
|
2436 |
|
2437 |
|
2438 TBool CMMFVideoRecordControllerCustomCommandParser::DoGetSupportedSinkVideoTypesL(TMMFMessage& aMessage) |
|
2439 { |
|
2440 CDesC8ArrayFlat* array = new (ELeave) CDesC8ArrayFlat(KBufMimeTypeGranularity); |
|
2441 CleanupStack::PushL(array); |
|
2442 |
|
2443 iImplementor.MvrcGetSupportedSinkVideoTypesL(*array); |
|
2444 |
|
2445 TInt32 len = DoCreateBufFromCDesC8ArrayL(*array); |
|
2446 |
|
2447 TPckgBuf<TMimeTypeBufferInfo> pckg; |
|
2448 pckg().count = array->Count(); |
|
2449 pckg().bufferLen = len; |
|
2450 |
|
2451 aMessage.WriteDataToClientL(pckg); |
|
2452 |
|
2453 CleanupStack::PopAndDestroy();//array |
|
2454 return ETrue; |
|
2455 } |
|
2456 |
|
2457 void CMMFVideoRecordControllerCustomCommandParser::DoCreateBufFromFourCCArrayL(RArray<TFourCC>& aArray) |
|
2458 { |
|
2459 delete iDataCopyBuffer; |
|
2460 iDataCopyBuffer = NULL; |
|
2461 |
|
2462 iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8); |
|
2463 RBufWriteStream stream; |
|
2464 stream.Open(*iDataCopyBuffer); |
|
2465 CleanupClosePushL(stream); |
|
2466 for (TInt i=0;i<aArray.Count();i++) |
|
2467 { |
|
2468 stream.WriteInt32L(aArray[i].FourCC()); |
|
2469 } |
|
2470 CleanupStack::PopAndDestroy();//stream |
|
2471 } |
|
2472 |
|
2473 TInt32 CMMFVideoRecordControllerCustomCommandParser::DoCreateBufFromCDesC8ArrayL(CDesC8Array& aArray) |
|
2474 { |
|
2475 TInt32 bufferLen = 0; |
|
2476 TInt32 len = 0; |
|
2477 |
|
2478 delete iDataCopyBuffer; |
|
2479 iDataCopyBuffer = NULL; |
|
2480 |
|
2481 iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8); |
|
2482 RBufWriteStream stream; |
|
2483 stream.Open(*iDataCopyBuffer); |
|
2484 CleanupClosePushL(stream); |
|
2485 for (TInt i = 0; i < aArray.Count(); i++) |
|
2486 { |
|
2487 len = aArray[i].Length(); |
|
2488 stream.WriteInt32L(len); |
|
2489 stream.WriteL(aArray[i]); |
|
2490 |
|
2491 bufferLen += (len + sizeof(TInt32));; // get a cumulative total buffer size |
|
2492 } |
|
2493 CleanupStack::PopAndDestroy();//stream |
|
2494 |
|
2495 return bufferLen; |
|
2496 } |
|
2497 |
|
2498 |
|
2499 // -------------------------------------------------------------------------------- |
|
2500 EXPORT_C RMMFVideoPlayControllerCustomCommands::RMMFVideoPlayControllerCustomCommands(RMMFController& aController) : |
|
2501 RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPlayController) |
|
2502 { |
|
2503 } |
|
2504 |
|
2505 EXPORT_C CMMFVideoPlayControllerCustomCommandParser* CMMFVideoPlayControllerCustomCommandParser::NewL(MMMFVideoPlayControllerCustomCommandImplementor& aImplementor) |
|
2506 { |
|
2507 return new(ELeave) CMMFVideoPlayControllerCustomCommandParser(aImplementor); |
|
2508 } |
|
2509 |
|
2510 EXPORT_C CMMFVideoPlayControllerCustomCommandParser::~CMMFVideoPlayControllerCustomCommandParser() |
|
2511 { |
|
2512 delete iVideoFrameMessage; |
|
2513 } |
|
2514 |
|
2515 CMMFVideoPlayControllerCustomCommandParser::CMMFVideoPlayControllerCustomCommandParser(MMMFVideoPlayControllerCustomCommandImplementor& aImplementor) : |
|
2516 CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPlayController), |
|
2517 iImplementor(aImplementor) |
|
2518 { |
|
2519 } |
|
2520 |
|
2521 void CMMFVideoPlayControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
2522 { |
|
2523 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPlayController) |
|
2524 { |
|
2525 TRAPD(error, DoHandleRequestL(aMessage)); |
|
2526 if (error) |
|
2527 aMessage.Complete(error); |
|
2528 } |
|
2529 else |
|
2530 { |
|
2531 aMessage.Complete(KErrNotSupported); |
|
2532 } |
|
2533 } |
|
2534 |
|
2535 void CMMFVideoPlayControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
2536 { |
|
2537 TBool complete = ETrue; |
|
2538 switch (aMessage.Function()) |
|
2539 { |
|
2540 case EMMFVideoPlayControllerGetFrame: |
|
2541 complete = DoGetFrameL(aMessage); |
|
2542 break; |
|
2543 case EMMFVideoPlayControllerSetDisplayWindow: |
|
2544 complete = DoSetDisplayWindowL(aMessage); |
|
2545 break; |
|
2546 case EMMFVideoPlayControllerGetAudioEnabled: |
|
2547 complete = DoGetAudioEnabledL(aMessage); |
|
2548 break; |
|
2549 case EMMFVideoPlayControllerUpdateDisplayRegion: |
|
2550 complete = DoUpdateDisplayRegionL(aMessage); |
|
2551 break; |
|
2552 case EMMFVideoPlayControllerDSAEvent: |
|
2553 complete = DoDirectScreenAccessEventL(aMessage); |
|
2554 break; |
|
2555 case EMMFVideoPlayControllerPlay: |
|
2556 complete = DoPlayL(aMessage); |
|
2557 break; |
|
2558 case EMMFVideoPlayControllerRefreshFrame: |
|
2559 complete = DoRefreshFrameL(aMessage); |
|
2560 break; |
|
2561 case EMMFVideoPlayControllerGetLoadingProgress: |
|
2562 complete = DoGetLoadingProgressL(aMessage); |
|
2563 break; |
|
2564 case EMMFVideoPlayControllerPrepare: |
|
2565 complete = DoPrepareL(aMessage); |
|
2566 break; |
|
2567 case EMMFVideoPlayControllerSetRotation: |
|
2568 complete = DoSetRotationL(aMessage); |
|
2569 break; |
|
2570 case EMMFVideoPlayControllerGetRotation: |
|
2571 complete = DoGetRotationL(aMessage); |
|
2572 break; |
|
2573 case EMMFVideoPlayControllerSetScaleFactor: |
|
2574 complete = DoSetScaleFactorL(aMessage); |
|
2575 break; |
|
2576 case EMMFVideoPlayControllerGetScaleFactor: |
|
2577 complete = DoGetScaleFactorL(aMessage); |
|
2578 break; |
|
2579 case EMMFVideoPlayControllerSetCropRegion: |
|
2580 complete = DoSetCropRegionL(aMessage); |
|
2581 break; |
|
2582 case EMMFVideoPlayControllerGetCropRegion: |
|
2583 complete = DoGetCropRegionL(aMessage); |
|
2584 break; |
|
2585 |
|
2586 default: |
|
2587 User::Leave(KErrNotSupported); |
|
2588 break; |
|
2589 } |
|
2590 if (complete) |
|
2591 aMessage.Complete(KErrNone); |
|
2592 } |
|
2593 |
|
2594 TBool CMMFVideoPlayControllerCustomCommandParser::DoUpdateDisplayRegionL(TMMFMessage& aMessage) |
|
2595 { |
|
2596 TPckgBuf<TInt> numberOfRectsPckg; |
|
2597 aMessage.ReadData1FromClientL(numberOfRectsPckg); |
|
2598 TUint rectSize = numberOfRectsPckg() * sizeof(TRect); |
|
2599 TUint8* rectMemory = STATIC_CAST(TUint8*, User::AllocLC(rectSize)); |
|
2600 TPtr8 rectMemoryPtr(rectMemory,rectSize); |
|
2601 aMessage.ReadData2FromClientL(rectMemoryPtr); |
|
2602 TRect* rects = REINTERPRET_CAST(TRect*, rectMemory); |
|
2603 RRegion region(numberOfRectsPckg(), rects); |
|
2604 CleanupStack::Pop(rectMemory); // rectMemory now owned by region |
|
2605 CleanupClosePushL(region); |
|
2606 iImplementor.MvpcUpdateDisplayRegionL(region); |
|
2607 CleanupStack::PopAndDestroy();//region |
|
2608 |
|
2609 return ETrue; |
|
2610 } |
|
2611 |
|
2612 TBool CMMFVideoPlayControllerCustomCommandParser::DoGetFrameL(TMMFMessage& aMessage) |
|
2613 { |
|
2614 delete iVideoFrameMessage; |
|
2615 iVideoFrameMessage = NULL; |
|
2616 |
|
2617 iVideoFrameMessage = CMMFVideoFrameMessage::NewL(aMessage); |
|
2618 iImplementor.MvpcGetFrameL(*iVideoFrameMessage); |
|
2619 return EFalse; |
|
2620 } |
|
2621 |
|
2622 TBool CMMFVideoPlayControllerCustomCommandParser::DoSetDisplayWindowL(TMMFMessage& aMessage) |
|
2623 { |
|
2624 TPckgBuf<TMMFVideoConfig> pckg; |
|
2625 aMessage.ReadData1FromClientL(pckg); |
|
2626 iImplementor.MvpcSetDisplayWindowL(pckg().iWindowRect, pckg().iClipRect); |
|
2627 return ETrue; |
|
2628 } |
|
2629 |
|
2630 TBool CMMFVideoPlayControllerCustomCommandParser::DoGetAudioEnabledL(TMMFMessage& aMessage) |
|
2631 { |
|
2632 TBool enabled; |
|
2633 iImplementor.MvpcGetAudioEnabledL(enabled); |
|
2634 TPckgBuf<TMMFVideoConfig> pckg; |
|
2635 pckg().iAudioEnabled = enabled; |
|
2636 aMessage.WriteDataToClientL(pckg); |
|
2637 return ETrue; |
|
2638 } |
|
2639 |
|
2640 TBool CMMFVideoPlayControllerCustomCommandParser::DoDirectScreenAccessEventL(TMMFMessage& aMessage) |
|
2641 { |
|
2642 TPckgBuf<TMMFVideoConfig> pckg; |
|
2643 aMessage.ReadData1FromClientL(pckg); |
|
2644 iImplementor.MvpcDirectScreenAccessEventL((TMMFDSAEvent)pckg().iDSAEvent); |
|
2645 return ETrue; |
|
2646 } |
|
2647 |
|
2648 TBool CMMFVideoPlayControllerCustomCommandParser::DoPlayL(TMMFMessage& aMessage) |
|
2649 { |
|
2650 TPckgBuf<TMMFVideoConfig> pckg; |
|
2651 aMessage.ReadData1FromClientL(pckg); |
|
2652 iImplementor.MvpcPlayL(pckg().iStartPosition, pckg().iEndPosition); |
|
2653 return ETrue; |
|
2654 } |
|
2655 |
|
2656 TBool CMMFVideoPlayControllerCustomCommandParser::DoRefreshFrameL(TMMFMessage& /*aMessage*/) |
|
2657 { |
|
2658 iImplementor.MvpcRefreshFrameL(); |
|
2659 return ETrue; |
|
2660 } |
|
2661 |
|
2662 TBool CMMFVideoPlayControllerCustomCommandParser::DoGetLoadingProgressL(TMMFMessage& aMessage) |
|
2663 { |
|
2664 TInt progress; |
|
2665 iImplementor.MvpcGetLoadingProgressL(progress); |
|
2666 TPckgBuf<TMMFVideoConfig> pckg; |
|
2667 pckg().iLoadingCompletePercentage = progress; |
|
2668 aMessage.WriteDataToClientL(pckg); |
|
2669 return ETrue; |
|
2670 } |
|
2671 |
|
2672 TBool CMMFVideoPlayControllerCustomCommandParser::DoPrepareL(TMMFMessage& /*aMessage*/) |
|
2673 { |
|
2674 iImplementor.MvpcPrepare(); |
|
2675 return ETrue; |
|
2676 } |
|
2677 |
|
2678 TBool CMMFVideoPlayControllerCustomCommandParser::DoSetRotationL(TMMFMessage& aMessage) |
|
2679 { |
|
2680 TPckgBuf<TMMFVideoConfig> pckg; |
|
2681 aMessage.ReadData1FromClientL(pckg); |
|
2682 iImplementor.MvpcSetRotationL(pckg().iVideoRotation); |
|
2683 return ETrue; |
|
2684 } |
|
2685 |
|
2686 TBool CMMFVideoPlayControllerCustomCommandParser::DoGetRotationL(TMMFMessage& aMessage) |
|
2687 { |
|
2688 TPckgBuf<TMMFVideoConfig> pckg; |
|
2689 iImplementor.MvpcGetRotationL(pckg().iVideoRotation); |
|
2690 aMessage.WriteDataToClientL(pckg); |
|
2691 return ETrue; |
|
2692 } |
|
2693 |
|
2694 TBool CMMFVideoPlayControllerCustomCommandParser::DoSetScaleFactorL(TMMFMessage& aMessage) |
|
2695 { |
|
2696 TPckgBuf<TMMFVideoConfig> pckg; |
|
2697 aMessage.ReadData1FromClientL(pckg); |
|
2698 iImplementor.MvpcSetScaleFactorL(pckg().iWidthScalePercentage, pckg().iHeightScalePercentage, pckg().iAntiAliasFiltering); |
|
2699 return ETrue; |
|
2700 } |
|
2701 |
|
2702 TBool CMMFVideoPlayControllerCustomCommandParser::DoGetScaleFactorL(TMMFMessage& aMessage) |
|
2703 { |
|
2704 TPckgBuf<TMMFVideoConfig> pckg; |
|
2705 iImplementor.MvpcGetScaleFactorL(pckg().iWidthScalePercentage, pckg().iHeightScalePercentage, pckg().iAntiAliasFiltering); |
|
2706 aMessage.WriteDataToClientL(pckg); |
|
2707 return ETrue; |
|
2708 } |
|
2709 |
|
2710 TBool CMMFVideoPlayControllerCustomCommandParser::DoSetCropRegionL(TMMFMessage& aMessage) |
|
2711 { |
|
2712 TPckgBuf<TMMFVideoConfig> pckg; |
|
2713 aMessage.ReadData1FromClientL(pckg); |
|
2714 iImplementor.MvpcSetCropRegionL(pckg().iCropRectangle); |
|
2715 return ETrue; |
|
2716 } |
|
2717 |
|
2718 TBool CMMFVideoPlayControllerCustomCommandParser::DoGetCropRegionL(TMMFMessage& aMessage) |
|
2719 { |
|
2720 TPckgBuf<TMMFVideoConfig> pckg; |
|
2721 iImplementor.MvpcGetCropRegionL(pckg().iCropRectangle); |
|
2722 aMessage.WriteDataToClientL(pckg); |
|
2723 return ETrue; |
|
2724 } |
|
2725 |
|
2726 // -------------------------------------------------------------------------------- |
|
2727 EXPORT_C CMMFVideoRecordControllerCustomCommandParser* CMMFVideoRecordControllerCustomCommandParser::NewL(MMMFVideoRecordControllerCustomCommandImplementor& aImplementor) |
|
2728 { |
|
2729 return new(ELeave) CMMFVideoRecordControllerCustomCommandParser(aImplementor); |
|
2730 } |
|
2731 |
|
2732 EXPORT_C CMMFVideoRecordControllerCustomCommandParser::~CMMFVideoRecordControllerCustomCommandParser() |
|
2733 { |
|
2734 delete iDataCopyBuffer; |
|
2735 } |
|
2736 |
|
2737 CMMFVideoRecordControllerCustomCommandParser::CMMFVideoRecordControllerCustomCommandParser(MMMFVideoRecordControllerCustomCommandImplementor& aImplementor) : |
|
2738 CMMFCustomCommandParserBase(KUidInterfaceMMFVideoRecordController), |
|
2739 iImplementor(aImplementor) |
|
2740 { |
|
2741 } |
|
2742 |
|
2743 void CMMFVideoRecordControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
2744 { |
|
2745 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoRecordController) |
|
2746 { |
|
2747 TRAPD(error, DoHandleRequestL(aMessage)); |
|
2748 if (error) |
|
2749 aMessage.Complete(error); |
|
2750 } |
|
2751 else |
|
2752 { |
|
2753 aMessage.Complete(KErrNotSupported); |
|
2754 } |
|
2755 } |
|
2756 |
|
2757 void CMMFVideoRecordControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
2758 { |
|
2759 TBool complete = ETrue; |
|
2760 switch (aMessage.Function()) |
|
2761 { |
|
2762 case EMMFVideoRecordControllerSetVideoFormat: |
|
2763 complete = DoSetVideoFormatL(aMessage); |
|
2764 break; |
|
2765 case EMMFVideoRecordControllerSetAudioBitRate: |
|
2766 complete = DoSetAudioBitRateL(aMessage); |
|
2767 break; |
|
2768 case EMMFVideoRecordControllerSetVideoBitRate: |
|
2769 complete = DoSetVideoBitRateL(aMessage); |
|
2770 break; |
|
2771 case EMMFVideoRecordControllerSetAudioCodec: |
|
2772 complete = DoSetAudioCodecL(aMessage); |
|
2773 break; |
|
2774 case EMMFVideoRecordControllerSetVideoCodec: |
|
2775 complete = DoSetVideoCodecL(aMessage); |
|
2776 break; |
|
2777 case EMMFVideoRecordControllerAddMetaDataEntry: |
|
2778 complete = DoAddMetaDataEntryL(aMessage); |
|
2779 break; |
|
2780 case EMMFVideoRecordControllerRemoveMetaDataEntry: |
|
2781 complete = DoRemoveMetaDataEntryL(aMessage); |
|
2782 break; |
|
2783 case EMMFVideoRecordControllerReplaceMetaDataEntry: |
|
2784 complete = DoReplaceMetaDataEntryL(aMessage); |
|
2785 break; |
|
2786 case EMMFVideoRecordControllerSetMaxFileSize: |
|
2787 complete = DoSetMaxFileSizeL(aMessage); |
|
2788 break; |
|
2789 case EMMFVideoRecordControllerSetVideoFrameSize: |
|
2790 complete = DoSetVideoFrameSizeL(aMessage); |
|
2791 break; |
|
2792 case EMMFVideoRecordControllerSetAudioEnabled: |
|
2793 complete = DoSetAudioEnabledL(aMessage); |
|
2794 break; |
|
2795 case EMMFVideoRecordControllerPrepare: |
|
2796 complete = DoPrepareL(aMessage); |
|
2797 break; |
|
2798 case EMMFVideoRecordControllerSetCameraHandle: |
|
2799 complete = DoSetCameraHandleL(aMessage); |
|
2800 break; |
|
2801 case EMMFVideoRecordControllerGetRecordTimeAvailable: |
|
2802 complete = DoGetRecordTimeAvailableL(aMessage); |
|
2803 break; |
|
2804 case EMMFVideoRecordControllerGetSupportedSinkAudioTypes: |
|
2805 complete = DoGetSupportedSinkAudioTypesL(aMessage); |
|
2806 break; |
|
2807 case EMMFVideoRecordControllerGetSupportedSinkVideoTypes: |
|
2808 complete = DoGetSupportedSinkVideoTypesL(aMessage); |
|
2809 break; |
|
2810 case EMMFVideoRecordControllerCopyDescriptorArrayData: |
|
2811 complete = DoCopyCDesC8ArrayDataL(aMessage); |
|
2812 break; |
|
2813 case EMMFVideoRecordControllerCopyFourCCArrayData: |
|
2814 complete = DoCopyFourCCArrayDataL(aMessage); |
|
2815 break; |
|
2816 case EMMFVideoRecordControllerGetAudioEnabled: //INC23777 |
|
2817 complete = DoGetAudioEnabledL(aMessage); |
|
2818 break; |
|
2819 default: |
|
2820 User::Leave(KErrNotSupported); |
|
2821 break; |
|
2822 } |
|
2823 if (complete) |
|
2824 aMessage.Complete(KErrNone); |
|
2825 } |
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoBitRateL(TMMFMessage& aMessage) |
|
2832 { |
|
2833 TPckgBuf<TMMFVideoConfig> pckg; |
|
2834 aMessage.ReadData1FromClientL(pckg); |
|
2835 iImplementor.MvrcSetVideoBitRateL(pckg().iVideoBitRate); |
|
2836 return ETrue; |
|
2837 } |
|
2838 |
|
2839 TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioBitRateL(TMMFMessage& aMessage) |
|
2840 { |
|
2841 TPckgBuf<TMMFVideoConfig> pckg; |
|
2842 aMessage.ReadData1FromClientL(pckg); |
|
2843 iImplementor.MvrcSetAudioBitRateL(pckg().iAudioBitRate); |
|
2844 return ETrue; |
|
2845 } |
|
2846 |
|
2847 |
|
2848 TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoCodecL(TMMFMessage& aMessage) |
|
2849 { |
|
2850 TBuf8<KMaxMimeTypeLength> buf; |
|
2851 aMessage.ReadData1FromClientL(buf); |
|
2852 iImplementor.MvrcSetVideoCodecL(buf); |
|
2853 return ETrue; |
|
2854 } |
|
2855 |
|
2856 TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioCodecL(TMMFMessage& aMessage) |
|
2857 { |
|
2858 TPckgBuf<TMMFVideoConfig> pckg; |
|
2859 aMessage.ReadData1FromClientL(pckg); |
|
2860 iImplementor.MvrcSetAudioCodecL(pckg().iAudioCodec); |
|
2861 return ETrue; |
|
2862 } |
|
2863 |
|
2864 |
|
2865 TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoFormatL(TMMFMessage& aMessage) |
|
2866 { |
|
2867 TPckgBuf<TMMFVideoConfig> pckg; |
|
2868 aMessage.ReadData1FromClientL(pckg); |
|
2869 iImplementor.MvrcSetVideoFormatL(pckg().iFormatUid); |
|
2870 return ETrue; |
|
2871 } |
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 TBool CMMFVideoRecordControllerCustomCommandParser::DoAddMetaDataEntryL(TMMFMessage& aMessage) |
|
2877 { |
|
2878 TInt bufSize = aMessage.SizeOfData1FromClient(); |
|
2879 // Leaving here in order to prevent a panic in the NewLC if the value is negative |
|
2880 User::LeaveIfError(bufSize); |
|
2881 HBufC8* buf = HBufC8::NewLC(bufSize); |
|
2882 TPtr8 ptr = buf->Des(); |
|
2883 aMessage.ReadData1FromClientL(ptr); |
|
2884 RDesReadStream stream; |
|
2885 stream.Open(ptr); |
|
2886 CleanupClosePushL(stream); |
|
2887 CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL(); |
|
2888 CleanupStack::PushL(metaData); |
|
2889 metaData->InternalizeL(stream); |
|
2890 iImplementor.MvrcAddMetaDataEntryL(*metaData); |
|
2891 CleanupStack::PopAndDestroy(3);//metaData, stream, buf |
|
2892 return ETrue; |
|
2893 } |
|
2894 |
|
2895 TBool CMMFVideoRecordControllerCustomCommandParser::DoRemoveMetaDataEntryL(TMMFMessage& aMessage) |
|
2896 { |
|
2897 TPckgBuf<TInt> pckg; |
|
2898 aMessage.ReadData1FromClientL(pckg); |
|
2899 iImplementor.MvrcRemoveMetaDataEntryL(pckg()); |
|
2900 return ETrue; |
|
2901 } |
|
2902 |
|
2903 TBool CMMFVideoRecordControllerCustomCommandParser::DoReplaceMetaDataEntryL(TMMFMessage& aMessage) |
|
2904 { |
|
2905 // Get new meta data |
|
2906 TInt bufSize = aMessage.SizeOfData1FromClient(); |
|
2907 // Leaving here in order to prevent a panic in the NewLC if the value is negative |
|
2908 User::LeaveIfError(bufSize); |
|
2909 HBufC8* buf = HBufC8::NewLC(bufSize); |
|
2910 TPtr8 ptr = buf->Des(); |
|
2911 aMessage.ReadData1FromClientL(ptr); |
|
2912 RDesReadStream stream; |
|
2913 stream.Open(ptr); |
|
2914 CleanupClosePushL(stream); |
|
2915 CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL(); |
|
2916 CleanupStack::PushL(metaData); |
|
2917 metaData->InternalizeL(stream); |
|
2918 |
|
2919 // Get index to replace |
|
2920 TPckgBuf<TInt> indexPckg; |
|
2921 aMessage.ReadData2FromClientL(indexPckg); |
|
2922 |
|
2923 iImplementor.MvrcReplaceMetaDataEntryL(indexPckg(), *metaData); |
|
2924 |
|
2925 CleanupStack::PopAndDestroy(3);//metaData, stream, buf |
|
2926 return ETrue; |
|
2927 } |
|
2928 |
|
2929 TBool CMMFVideoRecordControllerCustomCommandParser::DoSetMaxFileSizeL(TMMFMessage& aMessage) |
|
2930 { |
|
2931 TPckgBuf<TMMFVideoConfig> pckg; |
|
2932 aMessage.ReadData1FromClientL(pckg); |
|
2933 iImplementor.MvrcSetMaxFileSizeL(pckg().iMaxFileSize); |
|
2934 return ETrue; |
|
2935 } |
|
2936 |
|
2937 TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoFrameSizeL(TMMFMessage& aMessage) |
|
2938 { |
|
2939 TPckgBuf<TMMFVideoConfig> pckg; |
|
2940 aMessage.ReadData1FromClientL(pckg); |
|
2941 iImplementor.MvrcSetVideoFrameSizeL(pckg().iVideoFrameSize); |
|
2942 return ETrue; |
|
2943 } |
|
2944 |
|
2945 TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioEnabledL(TMMFMessage& aMessage) |
|
2946 { |
|
2947 TPckgBuf<TMMFVideoConfig> pckg; |
|
2948 aMessage.ReadData1FromClientL(pckg); |
|
2949 iImplementor.MvrcSetAudioEnabledL(pckg().iAudioEnabled); |
|
2950 return ETrue; |
|
2951 } |
|
2952 |
|
2953 TBool CMMFVideoRecordControllerCustomCommandParser::DoPrepareL(TMMFMessage& /*aMessage*/) |
|
2954 { |
|
2955 iImplementor.MvrcPrepareL(); |
|
2956 return ETrue; |
|
2957 } |
|
2958 |
|
2959 TBool CMMFVideoRecordControllerCustomCommandParser::DoSetCameraHandleL(TMMFMessage& aMessage) |
|
2960 { |
|
2961 TPckgBuf<TMMFVideoConfig> pckg; |
|
2962 aMessage.ReadData1FromClientL(pckg); |
|
2963 iImplementor.MvrcSetCameraHandleL(pckg().iCameraHandle); |
|
2964 return ETrue; |
|
2965 } |
|
2966 |
|
2967 TBool CMMFVideoRecordControllerCustomCommandParser::DoGetRecordTimeAvailableL(TMMFMessage& aMessage) |
|
2968 { |
|
2969 TTimeIntervalMicroSeconds time; |
|
2970 iImplementor.MvrcGetRecordTimeAvailableL(time); |
|
2971 TPckgBuf<TMMFVideoConfig> pckg; |
|
2972 pckg().iRecordTimeAvailable = time; |
|
2973 aMessage.WriteDataToClientL(pckg); |
|
2974 return ETrue; |
|
2975 } |
|
2976 |
|
2977 TBool CMMFVideoRecordControllerCustomCommandParser::DoCopyFourCCArrayDataL(TMMFMessage& aMessage) |
|
2978 { |
|
2979 if (!iDataCopyBuffer) |
|
2980 User::Leave(KErrNotReady); |
|
2981 aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0)); |
|
2982 return ETrue; |
|
2983 } |
|
2984 |
|
2985 //INC23777 |
|
2986 TBool CMMFVideoRecordControllerCustomCommandParser::DoGetAudioEnabledL(TMMFMessage& aMessage) |
|
2987 { |
|
2988 TBool enabled; |
|
2989 iImplementor.MvrcGetAudioEnabledL(enabled); |
|
2990 TPckgBuf<TMMFVideoConfig> pckg; |
|
2991 pckg().iAudioEnabled = enabled; |
|
2992 aMessage.WriteDataToClientL(pckg); |
|
2993 return ETrue; |
|
2994 } |
|
2995 |
|
2996 //-------------------------------------------------------------------------------------- |
|
2997 EXPORT_C CMMFVideoDRMExtCustomCommandParser* CMMFVideoDRMExtCustomCommandParser::NewL(MMMFVideoDRMExtCustomCommandImplementor& aImplementor) |
|
2998 { |
|
2999 return new(ELeave) CMMFVideoDRMExtCustomCommandParser(aImplementor); |
|
3000 } |
|
3001 |
|
3002 EXPORT_C CMMFVideoDRMExtCustomCommandParser::~CMMFVideoDRMExtCustomCommandParser() |
|
3003 { |
|
3004 delete iVideoFrameMessage; |
|
3005 } |
|
3006 |
|
3007 CMMFVideoDRMExtCustomCommandParser::CMMFVideoDRMExtCustomCommandParser(MMMFVideoDRMExtCustomCommandImplementor& aImplementor) : |
|
3008 CMMFCustomCommandParserBase(KUidInterfaceMMFVideoDRMExt), |
|
3009 iImplementor(aImplementor) |
|
3010 { |
|
3011 } |
|
3012 |
|
3013 void CMMFVideoDRMExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
3014 { |
|
3015 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoDRMExt) |
|
3016 { |
|
3017 switch (aMessage.Function()) |
|
3018 { |
|
3019 case EMMFVideoDRMExtGetFrame: |
|
3020 TRAPD(err, DoGetFrameL(aMessage)); |
|
3021 if (err!=KErrNone) // asynchronous, so only complete message if error occurred |
|
3022 aMessage.Complete(err); |
|
3023 break; |
|
3024 default: |
|
3025 aMessage.Complete(KErrNotSupported); |
|
3026 break; |
|
3027 } |
|
3028 } |
|
3029 else |
|
3030 { |
|
3031 aMessage.Complete(KErrNotSupported); |
|
3032 } |
|
3033 } |
|
3034 |
|
3035 void CMMFVideoDRMExtCustomCommandParser::DoGetFrameL(TMMFMessage& aMessage) |
|
3036 { |
|
3037 delete iVideoFrameMessage; |
|
3038 iVideoFrameMessage = NULL; |
|
3039 |
|
3040 iVideoFrameMessage = CMMFVideoFrameMessage::NewL(aMessage); |
|
3041 TPckgBuf<ContentAccess::TIntent> intentPckg; |
|
3042 aMessage.ReadData2FromClientL(intentPckg); |
|
3043 iImplementor.MvdeGetFrameL(*iVideoFrameMessage, intentPckg()); |
|
3044 } |
|
3045 |
|
3046 EXPORT_C RMMFVideoDRMExtCustomCommands::RMMFVideoDRMExtCustomCommands(RMMFController& aController) : |
|
3047 RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoDRMExt) |
|
3048 { |
|
3049 } |
|
3050 |
|
3051 EXPORT_C void RMMFVideoDRMExtCustomCommands::GetFrame(CFbsBitmap& aBitmap, ContentAccess::TIntent aIntent, TRequestStatus& aStatus) |
|
3052 { |
|
3053 iConfigPackage().iFrameBitmapServerHandle = aBitmap.Handle(); |
|
3054 iIntentPackage() = aIntent; |
|
3055 iController.CustomCommandAsync(iDestinationPckg, |
|
3056 EMMFVideoDRMExtGetFrame, |
|
3057 iConfigPackage, |
|
3058 iIntentPackage, |
|
3059 aStatus); |
|
3060 } |
|
3061 |
|
3062 //------------------------------------------------------------------------------ |
|
3063 EXPORT_C RMMFResourceNotificationCustomCommands::RMMFResourceNotificationCustomCommands(RMMFController& aController) : |
|
3064 RMMFCustomCommandsBase(aController,KMMFEventCategoryAudioResourceAvailable) |
|
3065 { |
|
3066 } |
|
3067 |
|
3068 EXPORT_C TInt RMMFResourceNotificationCustomCommands::RegisterAsClient(TUid aEventType,const TDesC8& aNotificationRegistrationData) |
|
3069 { |
|
3070 TPckgBuf<TMMFAudioConfig> configPackage; |
|
3071 configPackage().iEventType = aEventType; |
|
3072 configPackage().iNotificationRegistrationData = aNotificationRegistrationData; |
|
3073 return iController.CustomCommandSync(iDestinationPckg, |
|
3074 EMMFAudioResourceRegisterNotification, |
|
3075 configPackage, |
|
3076 KNullDesC8); |
|
3077 } |
|
3078 |
|
3079 EXPORT_C TInt RMMFResourceNotificationCustomCommands::CancelRegisterAsClient(TUid aEventType) |
|
3080 { |
|
3081 TPckgBuf<TMMFAudioConfig> configPackage; |
|
3082 configPackage().iEventType = aEventType; |
|
3083 return iController.CustomCommandSync(iDestinationPckg, |
|
3084 EMMFAudioResourceCancelRegisterNotification, |
|
3085 configPackage, |
|
3086 KNullDesC8); |
|
3087 |
|
3088 } |
|
3089 |
|
3090 EXPORT_C TInt RMMFResourceNotificationCustomCommands::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData) |
|
3091 { |
|
3092 TPckgBuf<TMMFAudioConfig> configPackage; |
|
3093 configPackage().iEventType = aEventType; |
|
3094 return iController.CustomCommandSync(iDestinationPckg, |
|
3095 EMMFAudioResourceGetNotificationData, |
|
3096 configPackage, |
|
3097 KNullDesC8, |
|
3098 aNotificationData); |
|
3099 } |
|
3100 |
|
3101 EXPORT_C TInt RMMFResourceNotificationCustomCommands::WillResumePlay() |
|
3102 { |
|
3103 return iController.CustomCommandSync(iDestinationPckg, |
|
3104 EMMFAudioResourceWillResumePlay, |
|
3105 KNullDesC8, |
|
3106 KNullDesC8); |
|
3107 } |
|
3108 |
|
3109 EXPORT_C CMMFResourceNotificationCustomCommandParser* CMMFResourceNotificationCustomCommandParser::NewL(MMMFResourceNotificationCustomCommandImplementor& aImplementor) |
|
3110 { |
|
3111 return new(ELeave) CMMFResourceNotificationCustomCommandParser(aImplementor); |
|
3112 } |
|
3113 |
|
3114 EXPORT_C CMMFResourceNotificationCustomCommandParser::~CMMFResourceNotificationCustomCommandParser() |
|
3115 { |
|
3116 } |
|
3117 |
|
3118 CMMFResourceNotificationCustomCommandParser::CMMFResourceNotificationCustomCommandParser( MMMFResourceNotificationCustomCommandImplementor& aImplementor) : |
|
3119 CMMFCustomCommandParserBase(KMMFEventCategoryAudioResourceAvailable), |
|
3120 iImplementor(aImplementor) |
|
3121 { |
|
3122 } |
|
3123 |
|
3124 void CMMFResourceNotificationCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
3125 { |
|
3126 if (aMessage.Destination().InterfaceId() == KMMFEventCategoryAudioResourceAvailable) |
|
3127 { |
|
3128 TRAPD(error, DoHandleRequestL(aMessage)); |
|
3129 if (error) |
|
3130 { |
|
3131 aMessage.Complete(error); |
|
3132 } |
|
3133 } |
|
3134 else |
|
3135 { |
|
3136 aMessage.Complete(KErrNotSupported); |
|
3137 } |
|
3138 } |
|
3139 |
|
3140 void CMMFResourceNotificationCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
3141 { |
|
3142 TBool complete = ETrue; |
|
3143 switch (aMessage.Function()) |
|
3144 { |
|
3145 case EMMFAudioResourceRegisterNotification: |
|
3146 complete = DoRegisterAsClientL(aMessage); |
|
3147 break; |
|
3148 case EMMFAudioResourceCancelRegisterNotification: |
|
3149 complete = DoCancelRegisterAsClientL(aMessage); |
|
3150 break; |
|
3151 case EMMFAudioResourceGetNotificationData: |
|
3152 complete = DoGetResourceNotificationDataL(aMessage); |
|
3153 break; |
|
3154 case EMMFAudioResourceWillResumePlay: |
|
3155 complete = DoWillResumePlayL(aMessage); |
|
3156 break; |
|
3157 default: |
|
3158 User::Leave(KErrNotSupported); |
|
3159 break; |
|
3160 } |
|
3161 if (complete) |
|
3162 { |
|
3163 aMessage.Complete(KErrNone); |
|
3164 } |
|
3165 } |
|
3166 |
|
3167 EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoRegisterAsClientL(TMMFMessage& aMessage) |
|
3168 { |
|
3169 TPckgBuf<TMMFAudioConfig> pckg; |
|
3170 aMessage.ReadData1FromClientL(pckg); |
|
3171 iImplementor.MarnRegisterAsClientL(pckg().iEventType, pckg().iNotificationRegistrationData); |
|
3172 return ETrue; |
|
3173 } |
|
3174 |
|
3175 EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoCancelRegisterAsClientL(TMMFMessage& aMessage) |
|
3176 { |
|
3177 TPckgBuf<TMMFAudioConfig> pckg; |
|
3178 aMessage.ReadData1FromClientL(pckg); |
|
3179 iImplementor.MarnCancelRegisterAsClientL(pckg().iEventType); |
|
3180 return ETrue; |
|
3181 } |
|
3182 |
|
3183 EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoGetResourceNotificationDataL(TMMFMessage& aMessage) |
|
3184 { |
|
3185 TPckgBuf<TMMFAudioConfig> pckg; |
|
3186 aMessage.ReadData1FromClientL(pckg); |
|
3187 iImplementor.MarnGetResourceNotificationDataL(pckg().iEventType, pckg().iNotificationData); |
|
3188 TPtrC8 tmp(pckg().iNotificationData); |
|
3189 aMessage.WriteDataToClientL(pckg().iNotificationData); |
|
3190 return ETrue; |
|
3191 } |
|
3192 |
|
3193 EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoWillResumePlayL(TMMFMessage& aMessage) |
|
3194 { |
|
3195 iImplementor.MarnWillResumePlayL(); |
|
3196 aMessage.Complete(KErrNone); |
|
3197 return EFalse; |
|
3198 } |
|
3199 |
|
3200 EXPORT_C RMMFVideoSetInitScreenCustomCommands::RMMFVideoSetInitScreenCustomCommands(RMMFController& aController) : |
|
3201 RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoSetInitScreen) |
|
3202 { |
|
3203 } |
|
3204 |
|
3205 EXPORT_C TInt RMMFVideoSetInitScreenCustomCommands::SetInitScreenNumber(TInt aScreenNumber) |
|
3206 { |
|
3207 TPckgBuf<TInt> configPackage; |
|
3208 configPackage() = aScreenNumber; |
|
3209 return iController.CustomCommandSync(iDestinationPckg, |
|
3210 EMMFVideoSetInitScreenNumber, |
|
3211 configPackage, |
|
3212 KNullDesC8); |
|
3213 } |
|
3214 |
|
3215 EXPORT_C CMMFVideoSetInitScreenCustomCommandParser* CMMFVideoSetInitScreenCustomCommandParser::NewL(MMMFVideoSetInitScreenCustomCommandImplementor& aImplementor) |
|
3216 { |
|
3217 return new(ELeave) CMMFVideoSetInitScreenCustomCommandParser(aImplementor); |
|
3218 } |
|
3219 |
|
3220 EXPORT_C CMMFVideoSetInitScreenCustomCommandParser::~CMMFVideoSetInitScreenCustomCommandParser() |
|
3221 { |
|
3222 } |
|
3223 |
|
3224 CMMFVideoSetInitScreenCustomCommandParser::CMMFVideoSetInitScreenCustomCommandParser(MMMFVideoSetInitScreenCustomCommandImplementor& aImplementor) : |
|
3225 CMMFCustomCommandParserBase(KUidInterfaceMMFVideoSetInitScreen), |
|
3226 iImplementor(aImplementor) |
|
3227 { |
|
3228 } |
|
3229 |
|
3230 void CMMFVideoSetInitScreenCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
3231 { |
|
3232 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoSetInitScreen) |
|
3233 { |
|
3234 TRAPD(error, DoHandleRequestL(aMessage)); |
|
3235 if (error) |
|
3236 { |
|
3237 aMessage.Complete(error); |
|
3238 } |
|
3239 } |
|
3240 else |
|
3241 { |
|
3242 aMessage.Complete(KErrNotSupported); |
|
3243 } |
|
3244 } |
|
3245 |
|
3246 void CMMFVideoSetInitScreenCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
3247 { |
|
3248 TBool complete = ETrue; |
|
3249 switch (aMessage.Function()) |
|
3250 { |
|
3251 case EMMFVideoSetInitScreenNumber: |
|
3252 complete = DoSetInitScreenNumberL(aMessage); |
|
3253 break; |
|
3254 default: |
|
3255 User::Leave(KErrNotSupported); |
|
3256 break; |
|
3257 } |
|
3258 if (complete) |
|
3259 { |
|
3260 aMessage.Complete(KErrNone); |
|
3261 } |
|
3262 } |
|
3263 |
|
3264 TBool CMMFVideoSetInitScreenCustomCommandParser::DoSetInitScreenNumberL(TMMFMessage& aMessage) |
|
3265 { |
|
3266 TPckgBuf<TInt> pckg; |
|
3267 aMessage.ReadData1FromClientL(pckg); |
|
3268 iImplementor.MvsdSetInitScreenNumber(pckg()); |
|
3269 return ETrue; |
|
3270 } |
|
3271 |
|
3272 _LIT(KMMFStandardCustomCommandsPanicCategory, "MMFStandardCustomCommands"); |
|
3273 GLDEF_C void Panic(TMmfSCCPanic aError) |
|
3274 { |
|
3275 User::Panic(KMMFStandardCustomCommandsPanicCategory, aError); |
|
3276 } |
|
3277 |
|
3278 |
|
3279 EXPORT_C RMMFVideoPixelAspectRatioCustomCommands::RMMFVideoPixelAspectRatioCustomCommands(RMMFController& aController) : |
|
3280 RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPixelAspectRatio) |
|
3281 { |
|
3282 } |
|
3283 |
|
3284 EXPORT_C TInt RMMFVideoPixelAspectRatioCustomCommands::SetPixelAspectRatio(const TVideoAspectRatio& aAspectRatio) |
|
3285 { |
|
3286 TPckgBuf<TVideoAspectRatio> configPackage; |
|
3287 configPackage() = aAspectRatio; |
|
3288 return iController.CustomCommandSync(iDestinationPckg, |
|
3289 EMMFVideoSetPixelAspectRatio, |
|
3290 configPackage, |
|
3291 KNullDesC8); |
|
3292 } |
|
3293 |
|
3294 EXPORT_C TInt RMMFVideoPixelAspectRatioCustomCommands::GetPixelAspectRatio(TVideoAspectRatio& aAspectRatio) const |
|
3295 { |
|
3296 TPckgBuf<TVideoAspectRatio> configPackage; |
|
3297 |
|
3298 TInt err = iController.CustomCommandSync(iDestinationPckg, |
|
3299 EMMFVideoGetPixelAspectRatio, |
|
3300 KNullDesC8, |
|
3301 KNullDesC8, |
|
3302 configPackage); |
|
3303 |
|
3304 if (!err) |
|
3305 { |
|
3306 aAspectRatio = configPackage(); |
|
3307 } |
|
3308 return err; |
|
3309 } |
|
3310 |
|
3311 EXPORT_C void RMMFVideoPixelAspectRatioCustomCommands::GetSupportedPixelAspectRatiosL(RArray<TVideoAspectRatio>& aAspectRatios) const |
|
3312 { |
|
3313 DoGetVideoPixelAspectRatioArrayL(aAspectRatios, EMMFVideoGetSupportedPixelAspectRatios); |
|
3314 } |
|
3315 |
|
3316 void RMMFVideoPixelAspectRatioCustomCommands::DoGetVideoPixelAspectRatioArrayL(RArray<TVideoAspectRatio>& aArray, TMMFVideoPixelAspectRatioMessages aIpc) const |
|
3317 { |
|
3318 aArray.Reset(); |
|
3319 |
|
3320 TPckgBuf<TInt> numberOfElementsPckg; |
|
3321 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
3322 aIpc, |
|
3323 KNullDesC8, |
|
3324 KNullDesC8, |
|
3325 numberOfElementsPckg)); |
|
3326 |
|
3327 HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TVideoAspectRatio)); |
|
3328 TPtr8 ptr = buf->Des(); |
|
3329 |
|
3330 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
3331 EMMFVideoPixelAspectRatioCopyArrayData, |
|
3332 KNullDesC8, |
|
3333 KNullDesC8, |
|
3334 ptr)); |
|
3335 RDesReadStream stream(ptr); |
|
3336 stream.Open(ptr); |
|
3337 CleanupClosePushL(stream); |
|
3338 |
|
3339 for (TInt i=0; i<numberOfElementsPckg(); i++) |
|
3340 { |
|
3341 User::LeaveIfError(aArray.Append(TVideoAspectRatio(stream.ReadInt32L(), stream.ReadInt32L()))); |
|
3342 } |
|
3343 |
|
3344 CleanupStack::PopAndDestroy(2, buf);//stream, buf |
|
3345 } |
|
3346 |
|
3347 EXPORT_C CMMFVideoPixelAspectRatioCustomCommandParser* CMMFVideoPixelAspectRatioCustomCommandParser::NewL(MMMFVideoPixelAspectRatioCustomCommandImplementor& aImplementor) |
|
3348 { |
|
3349 return new(ELeave) CMMFVideoPixelAspectRatioCustomCommandParser(aImplementor); |
|
3350 } |
|
3351 |
|
3352 EXPORT_C CMMFVideoPixelAspectRatioCustomCommandParser::~CMMFVideoPixelAspectRatioCustomCommandParser() |
|
3353 { |
|
3354 if(iDataCopyBuffer) |
|
3355 { |
|
3356 delete iDataCopyBuffer; |
|
3357 } |
|
3358 } |
|
3359 |
|
3360 CMMFVideoPixelAspectRatioCustomCommandParser::CMMFVideoPixelAspectRatioCustomCommandParser(MMMFVideoPixelAspectRatioCustomCommandImplementor& aImplementor) : |
|
3361 CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPixelAspectRatio), |
|
3362 iImplementor(aImplementor) |
|
3363 { |
|
3364 } |
|
3365 |
|
3366 void CMMFVideoPixelAspectRatioCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
3367 { |
|
3368 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPixelAspectRatio) |
|
3369 { |
|
3370 TRAPD(error, DoHandleRequestL(aMessage)); |
|
3371 if (error) |
|
3372 { |
|
3373 aMessage.Complete(error); |
|
3374 } |
|
3375 } |
|
3376 else |
|
3377 { |
|
3378 aMessage.Complete(KErrNotSupported); |
|
3379 } |
|
3380 } |
|
3381 |
|
3382 void CMMFVideoPixelAspectRatioCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
3383 { |
|
3384 TBool complete = ETrue; |
|
3385 switch (aMessage.Function()) |
|
3386 { |
|
3387 case EMMFVideoSetPixelAspectRatio: |
|
3388 complete = DoSetPixelAspectRatioL(aMessage); |
|
3389 break; |
|
3390 case EMMFVideoGetPixelAspectRatio: |
|
3391 complete = DoGetPixelAspectRatioL(aMessage); |
|
3392 break; |
|
3393 case EMMFVideoGetSupportedPixelAspectRatios: |
|
3394 complete = DoGetSupportedPixelAspectRatiosL(aMessage); |
|
3395 break; |
|
3396 case EMMFVideoPixelAspectRatioCopyArrayData: |
|
3397 complete = DoCopyArrayDataL(aMessage); |
|
3398 break; |
|
3399 default: |
|
3400 User::Leave(KErrNotSupported); |
|
3401 break; |
|
3402 } |
|
3403 if (complete) |
|
3404 { |
|
3405 aMessage.Complete(KErrNone); |
|
3406 } |
|
3407 } |
|
3408 |
|
3409 TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoSetPixelAspectRatioL(TMMFMessage& aMessage) |
|
3410 { |
|
3411 TPckgBuf<TVideoAspectRatio> pckg; |
|
3412 aMessage.ReadData1FromClientL(pckg); |
|
3413 iImplementor.MvparSetPixelAspectRatioL(pckg()); |
|
3414 return ETrue; |
|
3415 } |
|
3416 |
|
3417 TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoGetPixelAspectRatioL(TMMFMessage& aMessage) |
|
3418 { |
|
3419 TVideoAspectRatio aspectRatio; |
|
3420 iImplementor.MvparGetPixelAspectRatioL(aspectRatio); |
|
3421 TPckgBuf<TVideoAspectRatio> pckg; |
|
3422 pckg() = aspectRatio; |
|
3423 aMessage.WriteDataToClientL(pckg); |
|
3424 return ETrue; |
|
3425 } |
|
3426 |
|
3427 TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoGetSupportedPixelAspectRatiosL(TMMFMessage& aMessage) |
|
3428 { |
|
3429 RArray<TVideoAspectRatio> array; |
|
3430 CleanupClosePushL(array); |
|
3431 iImplementor.MvparGetSupportedPixelAspectRatiosL(array); |
|
3432 |
|
3433 DoCreateBufFromVideoAspectRatioArrayL(array); |
|
3434 |
|
3435 TPckgBuf<TInt> pckg; |
|
3436 pckg() = array.Count(); |
|
3437 aMessage.WriteDataToClientL(pckg); |
|
3438 |
|
3439 CleanupStack::PopAndDestroy(&array); |
|
3440 return ETrue; |
|
3441 } |
|
3442 |
|
3443 void CMMFVideoPixelAspectRatioCustomCommandParser::DoCreateBufFromVideoAspectRatioArrayL(RArray<TVideoAspectRatio>& aArray) |
|
3444 { |
|
3445 delete iDataCopyBuffer; |
|
3446 iDataCopyBuffer = NULL; |
|
3447 |
|
3448 iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8); |
|
3449 RBufWriteStream stream; |
|
3450 stream.Open(*iDataCopyBuffer); |
|
3451 CleanupClosePushL(stream); |
|
3452 for (TInt i=0;i<aArray.Count();i++) |
|
3453 { |
|
3454 stream.WriteInt32L(aArray[i].iNumerator); |
|
3455 stream.WriteInt32L(aArray[i].iDenominator); |
|
3456 } |
|
3457 CleanupStack::PopAndDestroy(&stream); |
|
3458 } |
|
3459 |
|
3460 TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage) |
|
3461 { |
|
3462 if (!iDataCopyBuffer) |
|
3463 { |
|
3464 User::Leave(KErrNotReady); |
|
3465 } |
|
3466 aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0)); |
|
3467 return ETrue; |
|
3468 } |
|
3469 |
|
3470 EXPORT_C RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands(RMMFController& aController) : |
|
3471 RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig) |
|
3472 { |
|
3473 } |
|
3474 |
|
3475 EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::SetAudioChannels(const TUint aNumChannels) |
|
3476 { |
|
3477 TPckgBuf<TUint> configPackage; |
|
3478 configPackage() = aNumChannels; |
|
3479 return iController.CustomCommandSync(iDestinationPckg, |
|
3480 EMMFVideoSetAudioChannels, |
|
3481 configPackage, |
|
3482 KNullDesC8); |
|
3483 } |
|
3484 |
|
3485 EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetAudioChannels(TUint& aAudioChannels) const |
|
3486 { |
|
3487 TPckgBuf<TUint> configPackage; |
|
3488 |
|
3489 TInt err = iController.CustomCommandSync(iDestinationPckg, |
|
3490 EMMFVideoGetAudioChannels, |
|
3491 KNullDesC8, |
|
3492 KNullDesC8, |
|
3493 configPackage); |
|
3494 |
|
3495 if (!err) |
|
3496 { |
|
3497 aAudioChannels = configPackage(); |
|
3498 } |
|
3499 return err; |
|
3500 } |
|
3501 |
|
3502 EXPORT_C void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetSupportedAudioChannelsL(RArray<TUint>& aChannels) const |
|
3503 { |
|
3504 DoGetUintArrayL(aChannels, EMMFVideoGetSupportedAudioChannels); |
|
3505 } |
|
3506 |
|
3507 EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::SetAudioSampleRate(const TUint aSampleRate) |
|
3508 { |
|
3509 TPckgBuf<TUint> configPackage; |
|
3510 configPackage() = aSampleRate; |
|
3511 return iController.CustomCommandSync(iDestinationPckg, |
|
3512 EMMFVideoSetAudioSampleRate, |
|
3513 configPackage, |
|
3514 KNullDesC8); |
|
3515 } |
|
3516 |
|
3517 EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetAudioSampleRate(TUint& aSampleRate) const |
|
3518 { |
|
3519 TPckgBuf<TUint> configPackage; |
|
3520 |
|
3521 TInt err = iController.CustomCommandSync(iDestinationPckg, |
|
3522 EMMFVideoGetAudioSampleRate, |
|
3523 KNullDesC8, |
|
3524 KNullDesC8, |
|
3525 configPackage); |
|
3526 |
|
3527 if (!err) |
|
3528 { |
|
3529 aSampleRate = configPackage(); |
|
3530 } |
|
3531 return err; |
|
3532 } |
|
3533 |
|
3534 EXPORT_C void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetSupportedAudioSampleRatesL(RArray<TUint>& aSampleRates) const |
|
3535 { |
|
3536 DoGetUintArrayL(aSampleRates, EMMFVideoGetSupportedAudioSampleRates); |
|
3537 } |
|
3538 |
|
3539 void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::DoGetUintArrayL(RArray<TUint>& aArray, TMMFVideoAudioSamplingRateAndChannelConfigMessages aIpc) const |
|
3540 { |
|
3541 aArray.Reset(); |
|
3542 |
|
3543 TPckgBuf<TInt> numberOfElementsPckg; |
|
3544 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
3545 aIpc, |
|
3546 KNullDesC8, |
|
3547 KNullDesC8, |
|
3548 numberOfElementsPckg)); |
|
3549 |
|
3550 HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TUint)); |
|
3551 TPtr8 ptr = buf->Des(); |
|
3552 |
|
3553 User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, |
|
3554 EMMFVideoAudioSamplingRateAndChannelConfigCopyArrayData, |
|
3555 KNullDesC8, |
|
3556 KNullDesC8, |
|
3557 ptr)); |
|
3558 RDesReadStream stream(ptr); |
|
3559 stream.Open(ptr); |
|
3560 CleanupClosePushL(stream); |
|
3561 |
|
3562 for (TInt i=0; i<numberOfElementsPckg(); i++) |
|
3563 { |
|
3564 User::LeaveIfError(aArray.Append(stream.ReadUint32L())); |
|
3565 } |
|
3566 |
|
3567 CleanupStack::PopAndDestroy(2, buf);//stream, buf |
|
3568 } |
|
3569 |
|
3570 |
|
3571 EXPORT_C CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser* CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::NewL(MMMFVideoAudioSamplingRateAndChannelConfigCustomCommandImplementor& aImplementor) |
|
3572 { |
|
3573 return new(ELeave) CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser(aImplementor); |
|
3574 } |
|
3575 |
|
3576 EXPORT_C CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::~CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser() |
|
3577 { |
|
3578 if(iDataCopyBuffer) |
|
3579 { |
|
3580 delete iDataCopyBuffer; |
|
3581 } |
|
3582 } |
|
3583 |
|
3584 CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser(MMMFVideoAudioSamplingRateAndChannelConfigCustomCommandImplementor& aImplementor) : |
|
3585 CMMFCustomCommandParserBase(KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig), |
|
3586 iImplementor(aImplementor) |
|
3587 { |
|
3588 } |
|
3589 |
|
3590 void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
3591 { |
|
3592 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig) |
|
3593 { |
|
3594 TRAPD(error, DoHandleRequestL(aMessage)); |
|
3595 if (error) |
|
3596 { |
|
3597 aMessage.Complete(error); |
|
3598 } |
|
3599 } |
|
3600 else |
|
3601 { |
|
3602 aMessage.Complete(KErrNotSupported); |
|
3603 } |
|
3604 } |
|
3605 |
|
3606 void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
3607 { |
|
3608 TBool complete = ETrue; |
|
3609 switch (aMessage.Function()) |
|
3610 { |
|
3611 case EMMFVideoSetAudioChannels: |
|
3612 complete = DoSetAudioChannelsL(aMessage); |
|
3613 break; |
|
3614 case EMMFVideoGetAudioChannels: |
|
3615 complete = DoGetAudioChannelsL(aMessage); |
|
3616 break; |
|
3617 case EMMFVideoGetSupportedAudioChannels: |
|
3618 complete = DoGetSupportedAudioChannelsL(aMessage); |
|
3619 break; |
|
3620 case EMMFVideoSetAudioSampleRate: |
|
3621 complete = DoSetAudioSampleRateL(aMessage); |
|
3622 break; |
|
3623 case EMMFVideoGetAudioSampleRate: |
|
3624 complete = DoGetAudioSampleRateL(aMessage); |
|
3625 break; |
|
3626 case EMMFVideoGetSupportedAudioSampleRates: |
|
3627 complete = DoGetSupportedAudioSampleRatesL(aMessage); |
|
3628 break; |
|
3629 case EMMFVideoAudioSamplingRateAndChannelConfigCopyArrayData: |
|
3630 complete = DoCopyArrayDataL(aMessage); |
|
3631 break; |
|
3632 default: |
|
3633 User::Leave(KErrNotSupported); |
|
3634 break; |
|
3635 } |
|
3636 if (complete) |
|
3637 { |
|
3638 aMessage.Complete(KErrNone); |
|
3639 } |
|
3640 } |
|
3641 |
|
3642 |
|
3643 TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoSetAudioChannelsL(TMMFMessage& aMessage) |
|
3644 { |
|
3645 TPckgBuf<TUint> pckg; |
|
3646 aMessage.ReadData1FromClientL(pckg); |
|
3647 iImplementor.MvasrccSetAudioChannelsL(pckg()); |
|
3648 return ETrue; |
|
3649 } |
|
3650 |
|
3651 TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetAudioChannelsL(TMMFMessage& aMessage) |
|
3652 { |
|
3653 TUint channels = 0; |
|
3654 iImplementor.MvasrccGetAudioChannelsL(channels); |
|
3655 TPckgBuf<TUint> pckg; |
|
3656 pckg() = channels; |
|
3657 aMessage.WriteDataToClientL(pckg); |
|
3658 return ETrue; |
|
3659 } |
|
3660 |
|
3661 TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetSupportedAudioChannelsL(TMMFMessage& aMessage) |
|
3662 { |
|
3663 RArray<TUint> audioChannels; |
|
3664 CleanupClosePushL(audioChannels); |
|
3665 iImplementor.MvasrccGetSupportedAudioChannelsL(audioChannels); |
|
3666 |
|
3667 DoCreateBufFromUintArrayL(audioChannels); |
|
3668 |
|
3669 TPckgBuf<TInt> pckg; |
|
3670 pckg() = audioChannels.Count(); |
|
3671 aMessage.WriteDataToClientL(pckg); |
|
3672 |
|
3673 CleanupStack::PopAndDestroy(&audioChannels); |
|
3674 return ETrue; |
|
3675 } |
|
3676 |
|
3677 TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoSetAudioSampleRateL(TMMFMessage& aMessage) |
|
3678 { |
|
3679 TPckgBuf<TUint> pckg; |
|
3680 aMessage.ReadData1FromClientL(pckg); |
|
3681 iImplementor.MvasrccSetAudioSampleRateL(pckg()); |
|
3682 return ETrue; |
|
3683 } |
|
3684 |
|
3685 TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetAudioSampleRateL(TMMFMessage& aMessage) |
|
3686 { |
|
3687 TUint sampleRate = 0; |
|
3688 iImplementor.MvasrccGetAudioSampleRateL(sampleRate); |
|
3689 TPckgBuf<TUint> pckg; |
|
3690 pckg() = sampleRate; |
|
3691 aMessage.WriteDataToClientL(pckg); |
|
3692 return ETrue; |
|
3693 } |
|
3694 |
|
3695 TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetSupportedAudioSampleRatesL(TMMFMessage& aMessage) |
|
3696 { |
|
3697 RArray<TUint> sampleRates; |
|
3698 CleanupClosePushL(sampleRates); |
|
3699 iImplementor.MvasrccGetSupportedAudioSampleRatesL(sampleRates); |
|
3700 |
|
3701 DoCreateBufFromUintArrayL(sampleRates); |
|
3702 |
|
3703 TPckgBuf<TInt> pckg; |
|
3704 pckg() = sampleRates.Count(); |
|
3705 aMessage.WriteDataToClientL(pckg); |
|
3706 |
|
3707 CleanupStack::PopAndDestroy(&sampleRates); |
|
3708 return ETrue; |
|
3709 } |
|
3710 |
|
3711 void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoCreateBufFromUintArrayL(RArray<TUint>& aArray) |
|
3712 { |
|
3713 delete iDataCopyBuffer; |
|
3714 iDataCopyBuffer = NULL; |
|
3715 |
|
3716 iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8); |
|
3717 RBufWriteStream stream; |
|
3718 stream.Open(*iDataCopyBuffer); |
|
3719 CleanupClosePushL(stream); |
|
3720 for (TInt i=0;i<aArray.Count();i++) |
|
3721 { |
|
3722 stream.WriteUint32L(aArray[i]); |
|
3723 } |
|
3724 CleanupStack::PopAndDestroy(&stream); |
|
3725 } |
|
3726 |
|
3727 TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage) |
|
3728 { |
|
3729 if (!iDataCopyBuffer) |
|
3730 { |
|
3731 User::Leave(KErrNotReady); |
|
3732 } |
|
3733 aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0)); |
|
3734 return ETrue; |
|
3735 } |
|
3736 |
|
3737 |
|
3738 EXPORT_C CMMFVideoPlayControllerExtCustomCommandParser* CMMFVideoPlayControllerExtCustomCommandParser::NewL(MMMFVideoPlayControllerExtCustomCommandImplementor& aImplementor) |
|
3739 { |
|
3740 return new(ELeave) CMMFVideoPlayControllerExtCustomCommandParser(aImplementor); |
|
3741 } |
|
3742 |
|
3743 EXPORT_C CMMFVideoPlayControllerExtCustomCommandParser::~CMMFVideoPlayControllerExtCustomCommandParser() |
|
3744 { |
|
3745 } |
|
3746 |
|
3747 CMMFVideoPlayControllerExtCustomCommandParser::CMMFVideoPlayControllerExtCustomCommandParser(MMMFVideoPlayControllerExtCustomCommandImplementor& aImplementor) : |
|
3748 CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPlayExt), |
|
3749 iImplementor(aImplementor) |
|
3750 { |
|
3751 } |
|
3752 |
|
3753 void CMMFVideoPlayControllerExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
3754 { |
|
3755 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPlayExt) |
|
3756 { |
|
3757 TRAPD(error, DoHandleRequestL(aMessage)); |
|
3758 if (error) |
|
3759 { |
|
3760 aMessage.Complete(error); |
|
3761 } |
|
3762 } |
|
3763 else |
|
3764 { |
|
3765 aMessage.Complete(KErrNotSupported); |
|
3766 } |
|
3767 } |
|
3768 |
|
3769 void CMMFVideoPlayControllerExtCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
3770 { |
|
3771 TBool complete = ETrue; |
|
3772 |
|
3773 switch (aMessage.Function()) |
|
3774 { |
|
3775 case EMMFVideoPlayControllerSetPlayVelocity: |
|
3776 complete = DoSetPlayVelocityL(aMessage); |
|
3777 break; |
|
3778 case EMMFVideoPlayControllerPlayVelocity: |
|
3779 complete = DoPlayVelocityL(aMessage); |
|
3780 break; |
|
3781 case EMMFVideoPlayControllerStepFrame: |
|
3782 complete = DoStepFrameL(aMessage); |
|
3783 break; |
|
3784 case EMMFVideoPlayControllerGetPlayRateCapabilities: |
|
3785 complete = DoGetPlayRateCapabilitiesL(aMessage); |
|
3786 break; |
|
3787 case EMMFVideoPlayControllerSetVideoEnabled: |
|
3788 complete = DoSetVideoEnabledL(aMessage); |
|
3789 break; |
|
3790 case EMMFVideoPlayControllerVideoEnabled: |
|
3791 complete = DoVideoEnabledL(aMessage); |
|
3792 break; |
|
3793 case EMMFVideoPlayControllerSetAudioEnabled: |
|
3794 complete = DoSetAudioEnabledL(aMessage); |
|
3795 break; |
|
3796 case EMMFVideoPlayControllerSetAutoScale: |
|
3797 complete = DoSetAutoScaleL(aMessage); |
|
3798 break; |
|
3799 default: |
|
3800 User::Leave(KErrNotSupported); |
|
3801 break; |
|
3802 } |
|
3803 |
|
3804 if (complete) |
|
3805 { |
|
3806 aMessage.Complete(KErrNone); |
|
3807 } |
|
3808 } |
|
3809 |
|
3810 TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetPlayVelocityL(TMMFMessage& aMessage) |
|
3811 { |
|
3812 TPckgBuf<TInt> pckg; |
|
3813 aMessage.ReadData1FromClientL(pckg); |
|
3814 iImplementor.MvpecSetPlayVelocityL(pckg()); |
|
3815 |
|
3816 return ETrue; |
|
3817 } |
|
3818 |
|
3819 TBool CMMFVideoPlayControllerExtCustomCommandParser::DoPlayVelocityL(TMMFMessage& aMessage) |
|
3820 { |
|
3821 TPckgBuf<TInt> pckg; |
|
3822 |
|
3823 pckg() = iImplementor.MvpecPlayVelocityL(); |
|
3824 |
|
3825 aMessage.WriteDataToClientL(pckg); |
|
3826 |
|
3827 return ETrue; |
|
3828 } |
|
3829 |
|
3830 TBool CMMFVideoPlayControllerExtCustomCommandParser::DoStepFrameL(TMMFMessage& aMessage) |
|
3831 { |
|
3832 TPckgBuf<TInt> pckg; |
|
3833 aMessage.ReadData1FromClientL(pckg); |
|
3834 iImplementor.MvpecStepFrameL(pckg()); |
|
3835 |
|
3836 return ETrue; |
|
3837 } |
|
3838 |
|
3839 TBool CMMFVideoPlayControllerExtCustomCommandParser::DoGetPlayRateCapabilitiesL(TMMFMessage& aMessage) |
|
3840 { |
|
3841 TPckgBuf<TVideoPlayRateCapabilities> pckg; |
|
3842 |
|
3843 iImplementor.MvpecGetPlayRateCapabilitiesL(pckg()); |
|
3844 |
|
3845 aMessage.WriteDataToClientL(pckg); |
|
3846 |
|
3847 return ETrue; |
|
3848 } |
|
3849 |
|
3850 TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetVideoEnabledL(TMMFMessage& aMessage) |
|
3851 { |
|
3852 TPckgBuf<TBool> pckg; |
|
3853 aMessage.ReadData1FromClientL(pckg); |
|
3854 iImplementor.MvpecSetVideoEnabledL(pckg()); |
|
3855 |
|
3856 return ETrue; |
|
3857 } |
|
3858 |
|
3859 TBool CMMFVideoPlayControllerExtCustomCommandParser::DoVideoEnabledL(TMMFMessage& aMessage) |
|
3860 { |
|
3861 TPckgBuf<TBool> pckg; |
|
3862 |
|
3863 pckg() = iImplementor.MvpecVideoEnabledL(); |
|
3864 |
|
3865 aMessage.WriteDataToClientL(pckg); |
|
3866 return ETrue; |
|
3867 } |
|
3868 |
|
3869 TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetAudioEnabledL(TMMFMessage& aMessage) |
|
3870 { |
|
3871 TPckgBuf<TBool> pckg; |
|
3872 aMessage.ReadData1FromClientL(pckg); |
|
3873 iImplementor.MvpecSetAudioEnabledL(pckg()); |
|
3874 |
|
3875 return ETrue; |
|
3876 } |
|
3877 |
|
3878 TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetAutoScaleL(TMMFMessage& aMessage) |
|
3879 { |
|
3880 TPckgBuf<TMMFVideoPlayAutoScaleParams> pckg; |
|
3881 aMessage.ReadData1FromClientL(pckg); |
|
3882 iImplementor.MvpecSetAutoScaleL(pckg().iScaleType,pckg().iHorizPos , pckg().iVertPos ); |
|
3883 |
|
3884 return ETrue; |
|
3885 } |
|
3886 |
|
3887 EXPORT_C RMMFVideoPlayControllerExtCustomCommands::RMMFVideoPlayControllerExtCustomCommands(RMMFController& aController) : |
|
3888 RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPlayExt) |
|
3889 { |
|
3890 } |
|
3891 |
|
3892 EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetPlayVelocity(TInt aVelocity) |
|
3893 { |
|
3894 TPckgBuf<TInt> pckg(aVelocity); |
|
3895 return iController.CustomCommandSync(iDestinationPckg, |
|
3896 EMMFVideoPlayControllerSetPlayVelocity, |
|
3897 pckg, |
|
3898 KNullDesC8); |
|
3899 } |
|
3900 |
|
3901 EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::PlayVelocity(TInt &aVelocity) const |
|
3902 { |
|
3903 TPckgBuf<TInt> pckg; |
|
3904 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
3905 EMMFVideoPlayControllerPlayVelocity, |
|
3906 KNullDesC8, |
|
3907 KNullDesC8, |
|
3908 pckg); |
|
3909 if (error == KErrNone) |
|
3910 { |
|
3911 aVelocity = pckg(); |
|
3912 } |
|
3913 return error; |
|
3914 } |
|
3915 |
|
3916 EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::StepFrame(TInt aStep) |
|
3917 { |
|
3918 TPckgBuf<TInt> pckg(aStep); |
|
3919 return iController.CustomCommandSync(iDestinationPckg, |
|
3920 EMMFVideoPlayControllerStepFrame, |
|
3921 pckg, |
|
3922 KNullDesC8); |
|
3923 } |
|
3924 |
|
3925 EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::GetPlayRateCapabilities(TVideoPlayRateCapabilities& aCapabilities) const |
|
3926 { |
|
3927 TPckgBuf<TVideoPlayRateCapabilities> pckg; |
|
3928 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
3929 EMMFVideoPlayControllerGetPlayRateCapabilities, |
|
3930 KNullDesC8, |
|
3931 KNullDesC8, |
|
3932 pckg); |
|
3933 if (!error) |
|
3934 { |
|
3935 aCapabilities = pckg(); |
|
3936 } |
|
3937 return error; |
|
3938 } |
|
3939 |
|
3940 EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetVideoEnabled(TBool aVideoEnabled) |
|
3941 { |
|
3942 TPckgBuf<TBool> pckg(aVideoEnabled); |
|
3943 return iController.CustomCommandSync(iDestinationPckg, |
|
3944 EMMFVideoPlayControllerSetVideoEnabled, |
|
3945 pckg, |
|
3946 KNullDesC8); |
|
3947 } |
|
3948 |
|
3949 EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::VideoEnabled(TBool &aVideoEnabled) const |
|
3950 { |
|
3951 TPckgBuf<TBool> pckg; |
|
3952 TInt error = iController.CustomCommandSync(iDestinationPckg, |
|
3953 EMMFVideoPlayControllerVideoEnabled, |
|
3954 KNullDesC8, |
|
3955 KNullDesC8, |
|
3956 pckg); |
|
3957 if (error == KErrNone) |
|
3958 { |
|
3959 aVideoEnabled = pckg(); |
|
3960 } |
|
3961 return error; |
|
3962 } |
|
3963 |
|
3964 EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetAudioEnabled(TBool aAudioEnabled) |
|
3965 { |
|
3966 TPckgBuf<TBool> pckg(aAudioEnabled); |
|
3967 return iController.CustomCommandSync(iDestinationPckg, |
|
3968 EMMFVideoPlayControllerSetAudioEnabled, |
|
3969 pckg, |
|
3970 KNullDesC8); |
|
3971 } |
|
3972 |
|
3973 EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetAutoScale(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos) |
|
3974 { |
|
3975 TPckgBuf<TMMFVideoPlayAutoScaleParams> pckg; |
|
3976 |
|
3977 pckg().iScaleType = aScaleType; |
|
3978 pckg().iHorizPos = aHorizPos; |
|
3979 pckg().iVertPos = aVertPos; |
|
3980 |
|
3981 return iController.CustomCommandSync(iDestinationPckg, |
|
3982 EMMFVideoPlayControllerSetAutoScale, |
|
3983 pckg, |
|
3984 KNullDesC8); |
|
3985 } |
|
3986 |
|
3987 |
|
3988 EXPORT_C CMMFVideoRecordControllerExtCustomCommandParser* CMMFVideoRecordControllerExtCustomCommandParser::NewL(MMMFVideoRecordControllerExtCustomCommandImplementor& aImplementor) |
|
3989 { |
|
3990 return new(ELeave) CMMFVideoRecordControllerExtCustomCommandParser(aImplementor); |
|
3991 } |
|
3992 |
|
3993 EXPORT_C CMMFVideoRecordControllerExtCustomCommandParser::~CMMFVideoRecordControllerExtCustomCommandParser() |
|
3994 { |
|
3995 } |
|
3996 |
|
3997 CMMFVideoRecordControllerExtCustomCommandParser::CMMFVideoRecordControllerExtCustomCommandParser(MMMFVideoRecordControllerExtCustomCommandImplementor& aImplementor) : |
|
3998 CMMFCustomCommandParserBase(KUidInterfaceMMFVideoRecorderExt), |
|
3999 iImplementor(aImplementor) |
|
4000 { |
|
4001 } |
|
4002 |
|
4003 void CMMFVideoRecordControllerExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
4004 { |
|
4005 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoRecorderExt) |
|
4006 { |
|
4007 TRAPD(error, DoHandleRequestL(aMessage)); |
|
4008 if (error) |
|
4009 { |
|
4010 aMessage.Complete(error); |
|
4011 } |
|
4012 } |
|
4013 else |
|
4014 { |
|
4015 aMessage.Complete(KErrNotSupported); |
|
4016 } |
|
4017 } |
|
4018 |
|
4019 void CMMFVideoRecordControllerExtCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
4020 { |
|
4021 TBool complete = ETrue; |
|
4022 switch (aMessage.Function()) |
|
4023 { |
|
4024 case EMMFVideoRecordControllerSetVideoEnabled: |
|
4025 complete = DoSetVideoEnabledL(aMessage); |
|
4026 break; |
|
4027 case EMMFVideoRecordControllerVideoEnabled: |
|
4028 complete = DoVideoEnabledL(aMessage); |
|
4029 break; |
|
4030 case EMMFVideoRecordControllerSetVideoQuality: |
|
4031 complete = DoSetVideoQualityL(aMessage); |
|
4032 break; |
|
4033 case EMMFVideoRecordControllerVideoQuality: |
|
4034 complete = DoVideoQualityL(aMessage); |
|
4035 break; |
|
4036 case EMMFVideoRecordControllerSetVideoFrameRateFixed: |
|
4037 complete = DoSetVideoFrameRateFixedL(aMessage); |
|
4038 break; |
|
4039 case EMMFVideoRecordControllerVideoFrameRateFixed: |
|
4040 complete = DoVideoFrameRateFixedL(aMessage); |
|
4041 break; |
|
4042 default: |
|
4043 User::Leave(KErrNotSupported); |
|
4044 break; |
|
4045 } |
|
4046 if (complete) |
|
4047 { |
|
4048 aMessage.Complete(KErrNone); |
|
4049 } |
|
4050 } |
|
4051 |
|
4052 TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoEnabledL(TMMFMessage& aMessage) |
|
4053 { |
|
4054 TPckgBuf<TBool> pckg; |
|
4055 aMessage.ReadData1FromClientL(pckg); |
|
4056 iImplementor.MvrecSetVideoEnabledL(pckg()); |
|
4057 |
|
4058 return ETrue; |
|
4059 } |
|
4060 |
|
4061 TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoEnabledL(TMMFMessage& aMessage) |
|
4062 { |
|
4063 TPckgBuf<TInt> pckg; |
|
4064 |
|
4065 pckg() = iImplementor.MvrecVideoEnabledL(); |
|
4066 |
|
4067 aMessage.WriteDataToClientL(pckg); |
|
4068 |
|
4069 return ETrue; |
|
4070 } |
|
4071 |
|
4072 TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoQualityL(TMMFMessage& aMessage) |
|
4073 { |
|
4074 TPckgBuf<TInt> pckg; |
|
4075 aMessage.ReadData1FromClientL(pckg); |
|
4076 iImplementor.MvrecSetVideoQualityL(pckg()); |
|
4077 |
|
4078 return ETrue; |
|
4079 } |
|
4080 |
|
4081 TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoQualityL(TMMFMessage& aMessage) |
|
4082 { |
|
4083 TPckgBuf<TInt> pckg; |
|
4084 |
|
4085 pckg() = iImplementor.MvrecVideoQualityL(); |
|
4086 |
|
4087 aMessage.WriteDataToClientL(pckg); |
|
4088 |
|
4089 return ETrue; |
|
4090 } |
|
4091 |
|
4092 TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoFrameRateFixedL(TMMFMessage& aMessage) |
|
4093 { |
|
4094 TPckgBuf<TBool> pckg; |
|
4095 aMessage.ReadData1FromClientL(pckg); |
|
4096 iImplementor.MvrecSetVideoFrameRateFixedL(pckg()); |
|
4097 |
|
4098 return ETrue; |
|
4099 } |
|
4100 |
|
4101 TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoFrameRateFixedL(TMMFMessage& aMessage) |
|
4102 { |
|
4103 TPckgBuf<TBool> pckg; |
|
4104 |
|
4105 pckg() = iImplementor.MvrecVideoFrameRateFixedL(); |
|
4106 |
|
4107 aMessage.WriteDataToClientL(pckg); |
|
4108 return ETrue; |
|
4109 } |
|
4110 |
|
4111 |
|
4112 EXPORT_C RMMFVideoRecordControllerExtCustomCommands::RMMFVideoRecordControllerExtCustomCommands(RMMFController& aController) : |
|
4113 RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoRecorderExt) |
|
4114 { |
|
4115 } |
|
4116 |
|
4117 EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoEnabled(TBool aEnabled) |
|
4118 { |
|
4119 TPckgBuf<TBool> pckg(aEnabled); |
|
4120 return iController.CustomCommandSync(iDestinationPckg, |
|
4121 EMMFVideoRecordControllerSetVideoEnabled, |
|
4122 pckg, |
|
4123 KNullDesC8); |
|
4124 } |
|
4125 |
|
4126 EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoEnabled(TBool &aEnabled) const |
|
4127 { |
|
4128 TPckgBuf<TBool> pckg(EFalse); |
|
4129 TInt error; |
|
4130 |
|
4131 error = iController.CustomCommandSync(iDestinationPckg, |
|
4132 EMMFVideoRecordControllerVideoEnabled, |
|
4133 KNullDesC8, |
|
4134 KNullDesC8, |
|
4135 pckg); |
|
4136 if (error == KErrNone) |
|
4137 { |
|
4138 aEnabled = pckg(); |
|
4139 } |
|
4140 return error; |
|
4141 } |
|
4142 |
|
4143 EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoQuality(TInt aQuality) |
|
4144 { |
|
4145 TPckgBuf<TInt> pckg(aQuality); |
|
4146 return iController.CustomCommandSync(iDestinationPckg, |
|
4147 EMMFVideoRecordControllerSetVideoQuality, |
|
4148 pckg, |
|
4149 KNullDesC8); |
|
4150 } |
|
4151 |
|
4152 EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoQuality(TInt &aQuality) const |
|
4153 { |
|
4154 TPckgBuf<TInt> pckg; |
|
4155 TInt error; |
|
4156 |
|
4157 error = iController.CustomCommandSync(iDestinationPckg, |
|
4158 EMMFVideoRecordControllerVideoQuality, |
|
4159 KNullDesC8, |
|
4160 KNullDesC8, |
|
4161 pckg); |
|
4162 if (error == KErrNone) |
|
4163 { |
|
4164 aQuality = pckg(); |
|
4165 } |
|
4166 return error; |
|
4167 } |
|
4168 |
|
4169 EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoFrameRateFixed(TBool aFixedFrameRate) |
|
4170 { |
|
4171 TPckgBuf<TBool> pckg(aFixedFrameRate); |
|
4172 return iController.CustomCommandSync(iDestinationPckg, |
|
4173 EMMFVideoRecordControllerSetVideoFrameRateFixed, |
|
4174 pckg, |
|
4175 KNullDesC8); |
|
4176 } |
|
4177 |
|
4178 EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoFrameRateFixed(TBool &aFixedFrameRate) const |
|
4179 { |
|
4180 TPckgBuf<TBool> pckg; |
|
4181 TInt error; |
|
4182 |
|
4183 error = iController.CustomCommandSync(iDestinationPckg, |
|
4184 EMMFVideoRecordControllerVideoFrameRateFixed, |
|
4185 KNullDesC8, |
|
4186 KNullDesC8, |
|
4187 pckg); |
|
4188 if (error == KErrNone) |
|
4189 { |
|
4190 aFixedFrameRate = pckg(); |
|
4191 } |
|
4192 return error; |
|
4193 } |
|
4194 |
|
4195 EXPORT_C TMMFAudioSetRepeatsConfig::TMMFAudioSetRepeatsConfig() |
|
4196 :iRepeatNumberOfTimes(0), iTrailingSilence(0), iReserved1(0) |
|
4197 { |
|
4198 } |
|
4199 |
|
4200 EXPORT_C RMMFAudioPlayControllerSetRepeatsCustomCommands::RMMFAudioPlayControllerSetRepeatsCustomCommands(RMMFController& aController) : |
|
4201 RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlaySetRepeatsController) |
|
4202 { |
|
4203 } |
|
4204 |
|
4205 EXPORT_C TInt RMMFAudioPlayControllerSetRepeatsCustomCommands::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence) |
|
4206 { |
|
4207 TPckgBuf<TMMFAudioSetRepeatsConfig> configPackage; |
|
4208 configPackage().iRepeatNumberOfTimes = aRepeatNumberOfTimes; |
|
4209 configPackage().iTrailingSilence = aTrailingSilence; |
|
4210 |
|
4211 return iController.CustomCommandSync(iDestinationPckg, |
|
4212 EMMFAudioPlayControllerSetRepeats, |
|
4213 configPackage, |
|
4214 KNullDesC8); |
|
4215 } |
|
4216 |
|
4217 EXPORT_C CMMFAudioPlayControllerSetRepeatsCustomCommandParser* CMMFAudioPlayControllerSetRepeatsCustomCommandParser::NewL(MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor& aImplementor) |
|
4218 { |
|
4219 return new(ELeave) CMMFAudioPlayControllerSetRepeatsCustomCommandParser(aImplementor); |
|
4220 } |
|
4221 |
|
4222 CMMFAudioPlayControllerSetRepeatsCustomCommandParser::CMMFAudioPlayControllerSetRepeatsCustomCommandParser(MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor& aImplementor) : |
|
4223 CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlaySetRepeatsController), iImplementor(aImplementor) |
|
4224 { |
|
4225 } |
|
4226 |
|
4227 EXPORT_C CMMFAudioPlayControllerSetRepeatsCustomCommandParser::~CMMFAudioPlayControllerSetRepeatsCustomCommandParser() |
|
4228 { |
|
4229 } |
|
4230 |
|
4231 void CMMFAudioPlayControllerSetRepeatsCustomCommandParser::HandleRequest(TMMFMessage& aMessage) |
|
4232 { |
|
4233 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlaySetRepeatsController) |
|
4234 { |
|
4235 TRAPD(error, DoHandleRequestL(aMessage)); |
|
4236 if (error) |
|
4237 { |
|
4238 aMessage.Complete(error); |
|
4239 } |
|
4240 } |
|
4241 else |
|
4242 { |
|
4243 aMessage.Complete(KErrNotSupported); |
|
4244 } |
|
4245 } |
|
4246 |
|
4247 void CMMFAudioPlayControllerSetRepeatsCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage) |
|
4248 { |
|
4249 TBool complete = ETrue; |
|
4250 switch (aMessage.Function()) |
|
4251 { |
|
4252 case EMMFAudioPlayControllerSetRepeats: |
|
4253 complete = DoSetRepeatsL(aMessage); |
|
4254 break; |
|
4255 default: |
|
4256 User::Leave(KErrNotSupported); |
|
4257 break; |
|
4258 } |
|
4259 if (complete) |
|
4260 { |
|
4261 aMessage.Complete(KErrNone); |
|
4262 } |
|
4263 } |
|
4264 |
|
4265 TBool CMMFAudioPlayControllerSetRepeatsCustomCommandParser::DoSetRepeatsL(TMMFMessage& aMessage) |
|
4266 { |
|
4267 TPckgBuf<TMMFAudioSetRepeatsConfig> pckg; |
|
4268 aMessage.ReadData1FromClientL(pckg); |
|
4269 User::LeaveIfError(iImplementor.MapcSetRepeats(pckg().iRepeatNumberOfTimes, pckg().iTrailingSilence)); |
|
4270 return ETrue; |
|
4271 } |