1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/src/ControllerFramework/MMFStandardCustomCommands.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,4271 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <mmf/common/mmfaudio.h>
1.20 +#include "mmfstandardcustomcommands.h"
1.21 +#include "MMFVideoFrameMessage.h"
1.22 +#include "MMFSCCPanicCodes.h"
1.23 +#include <badesca.h>
1.24 +
1.25 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
1.26 +#include <mmf/common/mmfstandardcustomcommandsenums.h>
1.27 +#include <mmf/common/mmfstandardcustomcommandsimpl.h>
1.28 +#include <mmf/common/mmfvideoenums.h>
1.29 +#endif
1.30 +
1.31 +
1.32 +const TInt KBufExpandSize8 = 8;//two TInts!
1.33 +const TInt KBufExpandSize32 = 32;
1.34 +
1.35 +const TInt KBufMimeTypeGranularity = 4;
1.36 +const TInt KMaxMimeTypeLength = 256;
1.37 +
1.38 +class TMimeTypeBufferInfo
1.39 + {
1.40 +public:
1.41 + TInt32 count;
1.42 + TInt32 bufferLen;
1.43 + };
1.44 +
1.45 +EXPORT_C RMMFAudioPlayDeviceCustomCommands::RMMFAudioPlayDeviceCustomCommands(RMMFController& aController) :
1.46 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlayDevice)
1.47 + {
1.48 + }
1.49 +
1.50 +EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetVolume(TInt aVolume) const
1.51 + {
1.52 + TPckgBuf<TMMFAudioConfig> configPackage;
1.53 + configPackage().iVolume = aVolume;
1.54 + return iController.CustomCommandSync(iDestinationPckg,
1.55 + EMMFAudioPlayDeviceSetVolume,
1.56 + configPackage,
1.57 + KNullDesC8);
1.58 + }
1.59 +
1.60 +
1.61 +EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetMaxVolume(TInt& aMaxVolume) const
1.62 + {
1.63 + TPckgBuf<TMMFAudioConfig> configPackage;
1.64 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.65 + EMMFAudioPlayDeviceGetMaxVolume,
1.66 + KNullDesC8,
1.67 + KNullDesC8,
1.68 + configPackage);
1.69 + if (!error)
1.70 + aMaxVolume = configPackage().iMaxVolume;
1.71 + return error;
1.72 + }
1.73 +
1.74 +EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetVolume(TInt& aVolume) const
1.75 + {
1.76 + TPckgBuf<TMMFAudioConfig> configPackage;
1.77 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.78 + EMMFAudioPlayDeviceGetVolume,
1.79 + KNullDesC8,
1.80 + KNullDesC8,
1.81 + configPackage);
1.82 + if (!error)
1.83 + aVolume = configPackage().iVolume;
1.84 + return error;
1.85 + }
1.86 +
1.87 +EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) const
1.88 + {
1.89 + TPckgBuf<TMMFAudioConfig> configPackage;
1.90 + configPackage().iRampDuration = aRampDuration;
1.91 + return iController.CustomCommandSync(iDestinationPckg,
1.92 + EMMFAudioPlayDeviceSetVolumeRamp,
1.93 + configPackage,
1.94 + KNullDesC8);
1.95 + }
1.96 +
1.97 +EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetBalance(TInt aBalance) const
1.98 + {
1.99 + TPckgBuf<TMMFAudioConfig> configPackage;
1.100 + configPackage().iBalance = aBalance;
1.101 + return iController.CustomCommandSync(iDestinationPckg,
1.102 + EMMFAudioPlayDeviceSetBalance,
1.103 + configPackage,
1.104 + KNullDesC8);
1.105 + }
1.106 +
1.107 +EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetBalance(TInt& aBalance) const
1.108 + {
1.109 + TPckgBuf<TMMFAudioConfig> configPackage;
1.110 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.111 + EMMFAudioPlayDeviceGetBalance,
1.112 + KNullDesC8,
1.113 + KNullDesC8,
1.114 + configPackage);
1.115 + if (!error)
1.116 + aBalance = configPackage().iBalance;
1.117 + return error;
1.118 + }
1.119 +
1.120 +EXPORT_C CMMFAudioPlayDeviceCustomCommandParser* CMMFAudioPlayDeviceCustomCommandParser::NewL(MMMFAudioPlayDeviceCustomCommandImplementor& aImplementor)
1.121 + {
1.122 + return new(ELeave) CMMFAudioPlayDeviceCustomCommandParser(aImplementor);
1.123 + }
1.124 +
1.125 +EXPORT_C CMMFAudioPlayDeviceCustomCommandParser::~CMMFAudioPlayDeviceCustomCommandParser()
1.126 + {
1.127 + }
1.128 +
1.129 +CMMFAudioPlayDeviceCustomCommandParser::CMMFAudioPlayDeviceCustomCommandParser(MMMFAudioPlayDeviceCustomCommandImplementor& aImplementor) :
1.130 + CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlayDevice),
1.131 + iImplementor(aImplementor)
1.132 + {
1.133 + }
1.134 +
1.135 +
1.136 +void CMMFAudioPlayDeviceCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.137 + {
1.138 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlayDevice)
1.139 + {
1.140 + TRAPD(error, DoHandleRequestL(aMessage));
1.141 + if (error)
1.142 + aMessage.Complete(error);
1.143 + }
1.144 + else
1.145 + {
1.146 + aMessage.Complete(KErrNotSupported);
1.147 + }
1.148 + }
1.149 +
1.150 +void CMMFAudioPlayDeviceCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.151 + {
1.152 + TBool complete = ETrue;
1.153 + switch (aMessage.Function())
1.154 + {
1.155 + case EMMFAudioPlayDeviceSetVolume:
1.156 + complete = DoSetVolumeL(aMessage);
1.157 + break;
1.158 + case EMMFAudioPlayDeviceGetMaxVolume:
1.159 + complete = DoGetMaxVolumeL(aMessage);
1.160 + break;
1.161 + case EMMFAudioPlayDeviceGetVolume:
1.162 + complete = DoGetVolumeL(aMessage);
1.163 + break;
1.164 + case EMMFAudioPlayDeviceSetVolumeRamp:
1.165 + complete = DoSetVolumeRampL(aMessage);
1.166 + break;
1.167 + case EMMFAudioPlayDeviceSetBalance:
1.168 + complete = DoSetBalanceL(aMessage);
1.169 + break;
1.170 + case EMMFAudioPlayDeviceGetBalance:
1.171 + complete = DoGetBalanceL(aMessage);
1.172 + break;
1.173 + default:
1.174 + User::Leave(KErrNotSupported);
1.175 + break;
1.176 + }
1.177 + if (complete)
1.178 + aMessage.Complete(KErrNone);
1.179 + }
1.180 +
1.181 +
1.182 +TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetVolumeL(TMMFMessage& aMessage)
1.183 + {
1.184 + TPckgBuf<TMMFAudioConfig> pckg;
1.185 + aMessage.ReadData1FromClientL(pckg);
1.186 + iImplementor.MapdSetVolumeL(pckg().iVolume);
1.187 + return ETrue;
1.188 + }
1.189 +
1.190 +TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetMaxVolumeL(TMMFMessage& aMessage)
1.191 + {
1.192 + TInt maxVol = 0;
1.193 + iImplementor.MapdGetMaxVolumeL(maxVol);
1.194 + TPckgBuf<TMMFAudioConfig> pckg;
1.195 + pckg().iMaxVolume = maxVol;
1.196 + aMessage.WriteDataToClientL(pckg);
1.197 + return ETrue;
1.198 + }
1.199 +
1.200 +TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetVolumeL(TMMFMessage& aMessage)
1.201 + {
1.202 + TInt vol = 0;
1.203 + iImplementor.MapdGetVolumeL(vol);
1.204 + TPckgBuf<TMMFAudioConfig> pckg;
1.205 + pckg().iVolume = vol;
1.206 + aMessage.WriteDataToClientL(pckg);
1.207 + return ETrue;
1.208 + }
1.209 +
1.210 +TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetVolumeRampL(TMMFMessage& aMessage)
1.211 + {
1.212 + TPckgBuf<TMMFAudioConfig> pckg;
1.213 + aMessage.ReadData1FromClientL(pckg);
1.214 + iImplementor.MapdSetVolumeRampL(pckg().iRampDuration);
1.215 + return ETrue;
1.216 + }
1.217 +
1.218 +TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetBalanceL(TMMFMessage& aMessage)
1.219 + {
1.220 + TPckgBuf<TMMFAudioConfig> pckg;
1.221 + aMessage.ReadData1FromClientL(pckg);
1.222 + iImplementor.MapdSetBalanceL(pckg().iBalance);
1.223 + return ETrue;
1.224 + }
1.225 +
1.226 +TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetBalanceL(TMMFMessage& aMessage)
1.227 + {
1.228 + TInt bal = 0;
1.229 + iImplementor.MapdGetBalanceL(bal);
1.230 + TPckgBuf<TMMFAudioConfig> pckg;
1.231 + pckg().iBalance = bal;
1.232 + aMessage.WriteDataToClientL(pckg);
1.233 + return ETrue;
1.234 + }
1.235 +
1.236 +
1.237 +
1.238 +
1.239 +
1.240 +
1.241 +
1.242 +
1.243 +
1.244 +
1.245 +
1.246 +
1.247 +
1.248 +
1.249 +
1.250 +
1.251 +
1.252 +
1.253 +
1.254 +
1.255 +
1.256 +
1.257 +
1.258 +EXPORT_C RMMFAudioRecordDeviceCustomCommands::RMMFAudioRecordDeviceCustomCommands(RMMFController& aController) :
1.259 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioRecordDevice)
1.260 + {
1.261 + }
1.262 +
1.263 +EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::SetGain(TInt aGain) const
1.264 + {
1.265 + TPckgBuf<TMMFAudioConfig> configPackage;
1.266 + configPackage().iGain = aGain;
1.267 + return iController.CustomCommandSync(iDestinationPckg,
1.268 + EMMFAudioRecordDeviceSetGain,
1.269 + configPackage,
1.270 + KNullDesC8);
1.271 + }
1.272 +
1.273 +EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetMaxGain(TInt& aMaxGain) const
1.274 + {
1.275 + TPckgBuf<TMMFAudioConfig> configPackage;
1.276 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.277 + EMMFAudioRecordDeviceGetMaxGain,
1.278 + KNullDesC8,
1.279 + KNullDesC8,
1.280 + configPackage);
1.281 + if (!error)
1.282 + aMaxGain = configPackage().iMaxGain;
1.283 + return error;
1.284 + }
1.285 +
1.286 +EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetGain(TInt& aGain) const
1.287 + {
1.288 + TPckgBuf<TMMFAudioConfig> configPackage;
1.289 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.290 + EMMFAudioRecordDeviceGetGain,
1.291 + KNullDesC8,
1.292 + KNullDesC8,
1.293 + configPackage);
1.294 + if (!error)
1.295 + aGain = configPackage().iGain;
1.296 + return error;
1.297 + }
1.298 +
1.299 +EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::SetBalance(TInt aBalance) const
1.300 + {
1.301 + TPckgBuf<TMMFAudioConfig> configPackage;
1.302 + configPackage().iBalance = aBalance;
1.303 + return iController.CustomCommandSync(iDestinationPckg,
1.304 + EMMFAudioRecordDeviceSetBalance,
1.305 + configPackage,
1.306 + KNullDesC8);
1.307 + }
1.308 +
1.309 +EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetBalance(TInt& aBalance) const
1.310 + {
1.311 + TPckgBuf<TMMFAudioConfig> configPackage;
1.312 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.313 + EMMFAudioRecordDeviceGetBalance,
1.314 + KNullDesC8,
1.315 + KNullDesC8,
1.316 + configPackage);
1.317 + if (!error)
1.318 + aBalance = configPackage().iBalance;
1.319 + return error;
1.320 + }
1.321 +
1.322 +EXPORT_C CMMFAudioRecordDeviceCustomCommandParser* CMMFAudioRecordDeviceCustomCommandParser::NewL(MMMFAudioRecordDeviceCustomCommandImplementor& aImplementor)
1.323 + {
1.324 + return new(ELeave) CMMFAudioRecordDeviceCustomCommandParser(aImplementor);
1.325 + }
1.326 +
1.327 +CMMFAudioRecordDeviceCustomCommandParser::CMMFAudioRecordDeviceCustomCommandParser(MMMFAudioRecordDeviceCustomCommandImplementor& aImplementor) :
1.328 + CMMFCustomCommandParserBase(KUidInterfaceMMFAudioRecordDevice),
1.329 + iImplementor(aImplementor)
1.330 + {
1.331 + }
1.332 +
1.333 +EXPORT_C CMMFAudioRecordDeviceCustomCommandParser::~CMMFAudioRecordDeviceCustomCommandParser()
1.334 + {
1.335 + }
1.336 +
1.337 +void CMMFAudioRecordDeviceCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.338 + {
1.339 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioRecordDevice)
1.340 + {
1.341 + TRAPD(error, DoHandleRequestL(aMessage));
1.342 + if (error)
1.343 + aMessage.Complete(error);
1.344 + }
1.345 + else
1.346 + {
1.347 + aMessage.Complete(KErrNotSupported);
1.348 + }
1.349 + }
1.350 +
1.351 +void CMMFAudioRecordDeviceCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.352 + {
1.353 + TBool complete = ETrue;
1.354 + switch (aMessage.Function())
1.355 + {
1.356 + case EMMFAudioRecordDeviceSetGain:
1.357 + complete = DoSetGainL(aMessage);
1.358 + break;
1.359 + case EMMFAudioRecordDeviceGetMaxGain:
1.360 + complete = DoGetMaxGainL(aMessage);
1.361 + break;
1.362 + case EMMFAudioRecordDeviceGetGain:
1.363 + complete = DoGetGainL(aMessage);
1.364 + break;
1.365 + case EMMFAudioRecordDeviceSetBalance:
1.366 + complete = DoSetBalanceL(aMessage);
1.367 + break;
1.368 + case EMMFAudioRecordDeviceGetBalance:
1.369 + complete = DoGetBalanceL(aMessage);
1.370 + break;
1.371 + default:
1.372 + User::Leave(KErrNotSupported);
1.373 + break;
1.374 + }
1.375 + if (complete)
1.376 + aMessage.Complete(KErrNone);
1.377 + }
1.378 +
1.379 +TBool CMMFAudioRecordDeviceCustomCommandParser::DoSetGainL(TMMFMessage& aMessage)
1.380 + {
1.381 + TPckgBuf<TMMFAudioConfig> pckg;
1.382 + aMessage.ReadData1FromClientL(pckg);
1.383 + iImplementor.MardSetGainL(pckg().iGain);
1.384 + return ETrue;
1.385 + }
1.386 +
1.387 +TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetMaxGainL(TMMFMessage& aMessage)
1.388 + {
1.389 + TInt maxGain = 0;
1.390 + iImplementor.MardGetMaxGainL(maxGain);
1.391 + TPckgBuf<TMMFAudioConfig> pckg;
1.392 + pckg().iMaxGain = maxGain;
1.393 + aMessage.WriteDataToClientL(pckg);
1.394 + return ETrue;
1.395 + }
1.396 +
1.397 +TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetGainL(TMMFMessage& aMessage)
1.398 + {
1.399 + TInt gain = 0;
1.400 + iImplementor.MardGetGainL(gain);
1.401 + TPckgBuf<TMMFAudioConfig> pckg;
1.402 + pckg().iGain = gain;
1.403 + aMessage.WriteDataToClientL(pckg);
1.404 + return ETrue;
1.405 + }
1.406 +
1.407 +TBool CMMFAudioRecordDeviceCustomCommandParser::DoSetBalanceL(TMMFMessage& aMessage)
1.408 + {
1.409 + TPckgBuf<TMMFAudioConfig> pckg;
1.410 + aMessage.ReadData1FromClientL(pckg);
1.411 + iImplementor.MardSetBalanceL(pckg().iBalance);
1.412 + return ETrue;
1.413 + }
1.414 +
1.415 +TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetBalanceL(TMMFMessage& aMessage)
1.416 + {
1.417 + TInt balance = 0;
1.418 + iImplementor.MardGetBalanceL(balance);
1.419 + TPckgBuf<TMMFAudioConfig> pckg;
1.420 + pckg().iBalance = balance;
1.421 + aMessage.WriteDataToClientL(pckg);
1.422 + return ETrue;
1.423 + }
1.424 +
1.425 +
1.426 +
1.427 +
1.428 +
1.429 +
1.430 +
1.431 +
1.432 +
1.433 +
1.434 +
1.435 +
1.436 +
1.437 +
1.438 +
1.439 +
1.440 +
1.441 +
1.442 +
1.443 +
1.444 +
1.445 +EXPORT_C RMMFAudioPlayControllerCustomCommands::RMMFAudioPlayControllerCustomCommands(RMMFController& aController) :
1.446 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlayController)
1.447 + {
1.448 + }
1.449 +
1.450 +EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::SetPlaybackWindow(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd) const
1.451 + {
1.452 + TPckgBuf<TMMFAudioConfig> configPackage;
1.453 + configPackage().iStartPosition = aStart;
1.454 + configPackage().iEndPosition = aEnd;
1.455 + return iController.CustomCommandSync(iDestinationPckg,
1.456 + EMMFAudioPlayControllerSetPlaybackWindow,
1.457 + configPackage,
1.458 + KNullDesC8);
1.459 + }
1.460 +
1.461 +
1.462 +EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::DeletePlaybackWindow()
1.463 + {
1.464 + return iController.CustomCommandSync(iDestinationPckg,
1.465 + EMMFAudioPlayControllerDeletePlaybackWindow,
1.466 + KNullDesC8,
1.467 + KNullDesC8);
1.468 + }
1.469 +
1.470 +EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::GetLoadingProgress(TInt& aPercentageComplete) const
1.471 + {
1.472 + TPckgBuf<TMMFAudioConfig> configPackage;
1.473 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.474 + EMMFAudioPlayControllerGetLoadingProgress,
1.475 + KNullDesC8,
1.476 + KNullDesC8,
1.477 + configPackage);
1.478 + if (!error)
1.479 + aPercentageComplete = configPackage().iLoadingCompletePercentage;
1.480 + return error;
1.481 + }
1.482 +
1.483 +
1.484 +
1.485 +EXPORT_C CMMFAudioPlayControllerCustomCommandParser* CMMFAudioPlayControllerCustomCommandParser::NewL(MMMFAudioPlayControllerCustomCommandImplementor& aImplementor)
1.486 + {
1.487 + return new(ELeave) CMMFAudioPlayControllerCustomCommandParser(aImplementor);
1.488 + }
1.489 +
1.490 +CMMFAudioPlayControllerCustomCommandParser::CMMFAudioPlayControllerCustomCommandParser(MMMFAudioPlayControllerCustomCommandImplementor& aImplementor) :
1.491 + CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlayController),
1.492 + iImplementor(aImplementor)
1.493 + {
1.494 + }
1.495 +
1.496 +EXPORT_C CMMFAudioPlayControllerCustomCommandParser::~CMMFAudioPlayControllerCustomCommandParser()
1.497 + {
1.498 + }
1.499 +
1.500 +void CMMFAudioPlayControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.501 + {
1.502 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlayController)
1.503 + {
1.504 + TRAPD(error, DoHandleRequestL(aMessage));
1.505 + if (error)
1.506 + aMessage.Complete(error);
1.507 + }
1.508 + else
1.509 + {
1.510 + aMessage.Complete(KErrNotSupported);
1.511 + }
1.512 + }
1.513 +
1.514 +void CMMFAudioPlayControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.515 + {
1.516 + TBool complete = ETrue;
1.517 + switch (aMessage.Function())
1.518 + {
1.519 + case EMMFAudioPlayControllerSetPlaybackWindow:
1.520 + complete = DoSetPlaybackWindowL(aMessage);
1.521 + break;
1.522 + case EMMFAudioPlayControllerDeletePlaybackWindow:
1.523 + complete = DoDeletePlaybackWindowL(aMessage);
1.524 + break;
1.525 + case EMMFAudioPlayControllerGetLoadingProgress:
1.526 + complete = DoGetLoadingProgressL(aMessage);
1.527 + break;
1.528 + default:
1.529 + User::Leave(KErrNotSupported);
1.530 + break;
1.531 + }
1.532 + if (complete)
1.533 + aMessage.Complete(KErrNone);
1.534 + }
1.535 +
1.536 +TBool CMMFAudioPlayControllerCustomCommandParser::DoSetPlaybackWindowL(TMMFMessage& aMessage)
1.537 + {
1.538 + TPckgBuf<TMMFAudioConfig> pckg;
1.539 + aMessage.ReadData1FromClientL(pckg);
1.540 + iImplementor.MapcSetPlaybackWindowL(pckg().iStartPosition, pckg().iEndPosition);
1.541 + return ETrue;
1.542 + }
1.543 +
1.544 +TBool CMMFAudioPlayControllerCustomCommandParser::DoDeletePlaybackWindowL(TMMFMessage& /*aMessage*/)
1.545 + {
1.546 + iImplementor.MapcDeletePlaybackWindowL();
1.547 + return ETrue;
1.548 + }
1.549 +
1.550 +TBool CMMFAudioPlayControllerCustomCommandParser::DoGetLoadingProgressL(TMMFMessage& aMessage)
1.551 + {
1.552 + TInt progress;
1.553 + iImplementor.MapcGetLoadingProgressL(progress);
1.554 + TPckgBuf<TMMFAudioConfig> pckg;
1.555 + pckg().iLoadingCompletePercentage = progress;
1.556 + aMessage.WriteDataToClientL(pckg);
1.557 + return ETrue;
1.558 + }
1.559 +
1.560 +
1.561 +
1.562 +
1.563 +
1.564 +
1.565 +
1.566 +
1.567 +
1.568 +
1.569 +
1.570 +EXPORT_C RMMFAudioRecordControllerCustomCommands::RMMFAudioRecordControllerCustomCommands(RMMFController& aController) :
1.571 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioRecordController)
1.572 + {
1.573 + }
1.574 +
1.575 +EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::GetRecordTimeAvailable(TTimeIntervalMicroSeconds& aTime) const
1.576 + {
1.577 + TPckgBuf<TMMFAudioConfig> configPackage;
1.578 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.579 + EMMFAudioRecordControllerGetRecordTimeAvailable,
1.580 + KNullDesC8,
1.581 + KNullDesC8,
1.582 + configPackage);
1.583 + if (!error)
1.584 + aTime = configPackage().iRecordTimeAvailable;
1.585 + return error;
1.586 + }
1.587 +
1.588 +EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::SetMaxDuration(const TTimeIntervalMicroSeconds& aMaxDuration) const
1.589 + {
1.590 + TPckgBuf<TMMFAudioConfig> configPackage;
1.591 + configPackage().iMaxDuration = aMaxDuration;
1.592 + return iController.CustomCommandSync(iDestinationPckg,
1.593 + EMMFAudioRecordControllerSetMaxDuration,
1.594 + configPackage,
1.595 + KNullDesC8);
1.596 + }
1.597 +
1.598 +EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::SetMaxFileSize(TInt aMaxSize) const
1.599 + {
1.600 + TPckgBuf<TMMFAudioConfig> configPackage;
1.601 + configPackage().iMaxFileSize = aMaxSize;
1.602 + return iController.CustomCommandSync(iDestinationPckg,
1.603 + EMMFAudioRecordControllerSetMaxFileSize,
1.604 + configPackage,
1.605 + KNullDesC8);
1.606 + }
1.607 +
1.608 +EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::Crop(TBool aToEnd)
1.609 + {
1.610 + TPckgBuf<TMMFAudioConfig> configPackage;
1.611 + configPackage().iCropToEnd = aToEnd;
1.612 + return iController.CustomCommandSync(iDestinationPckg,
1.613 + EMMFAudioRecordControllerCrop,
1.614 + configPackage,
1.615 + KNullDesC8);
1.616 + }
1.617 +
1.618 +EXPORT_C void RMMFAudioRecordControllerCustomCommands::AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry)
1.619 + {
1.620 + CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
1.621 + CleanupStack::PushL(buf);
1.622 + RBufWriteStream s;
1.623 + s.Open(*buf);
1.624 + CleanupClosePushL(s);
1.625 + aNewEntry.ExternalizeL(s);
1.626 + TPtr8 bufData = buf->Ptr(0);
1.627 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.628 + EMMFAudioRecordControllerAddMetaDataEntry,
1.629 + bufData,
1.630 + KNullDesC8));
1.631 + CleanupStack::PopAndDestroy(2);//s, buf
1.632 + }
1.633 +
1.634 +EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::RemoveMetaDataEntry(TInt aIndex)
1.635 + {
1.636 + TPckgBuf<TInt> pckg(aIndex);
1.637 + return iController.CustomCommandSync(iDestinationPckg,
1.638 + EMMFAudioRecordControllerRemoveMetaDataEntry,
1.639 + pckg,
1.640 + KNullDesC8);
1.641 + }
1.642 +
1.643 +EXPORT_C void RMMFAudioRecordControllerCustomCommands::ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry)
1.644 + {
1.645 + TPckgBuf<TInt> indexPckg(aIndex);
1.646 + CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
1.647 + CleanupStack::PushL(buf);
1.648 + RBufWriteStream s;
1.649 + s.Open(*buf);
1.650 + CleanupClosePushL(s);
1.651 + aNewEntry.ExternalizeL(s);
1.652 + TPtr8 bufData = buf->Ptr(0);
1.653 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.654 + EMMFAudioRecordControllerReplaceMetaDataEntry,
1.655 + bufData,
1.656 + indexPckg));
1.657 + CleanupStack::PopAndDestroy(2);//s, buf
1.658 + }
1.659 +
1.660 +EXPORT_C CMMFAudioRecordControllerCustomCommandParser* CMMFAudioRecordControllerCustomCommandParser::NewL(MMMFAudioRecordControllerCustomCommandImplementor& aImplementor)
1.661 + {
1.662 + return new(ELeave) CMMFAudioRecordControllerCustomCommandParser(aImplementor);
1.663 + }
1.664 +
1.665 +CMMFAudioRecordControllerCustomCommandParser::CMMFAudioRecordControllerCustomCommandParser(MMMFAudioRecordControllerCustomCommandImplementor& aImplementor) :
1.666 + CMMFCustomCommandParserBase(KUidInterfaceMMFAudioRecordController),
1.667 + iImplementor(aImplementor)
1.668 + {
1.669 + }
1.670 +
1.671 +EXPORT_C CMMFAudioRecordControllerCustomCommandParser::~CMMFAudioRecordControllerCustomCommandParser()
1.672 + {
1.673 + }
1.674 +
1.675 +void CMMFAudioRecordControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.676 + {
1.677 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioRecordController)
1.678 + {
1.679 + TRAPD(error, DoHandleRequestL(aMessage));
1.680 + if (error)
1.681 + aMessage.Complete(error);
1.682 + }
1.683 + else
1.684 + {
1.685 + aMessage.Complete(KErrNotSupported);
1.686 + }
1.687 + }
1.688 +
1.689 +void CMMFAudioRecordControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.690 + {
1.691 + TBool complete = ETrue;
1.692 + switch (aMessage.Function())
1.693 + {
1.694 + case EMMFAudioRecordControllerGetRecordTimeAvailable:
1.695 + complete = DoGetRecordTimeAvailableL(aMessage);
1.696 + break;
1.697 + case EMMFAudioRecordControllerSetMaxDuration:
1.698 + complete = DoSetMaxDurationL(aMessage);
1.699 + break;
1.700 + case EMMFAudioRecordControllerSetMaxFileSize:
1.701 + complete = DoSetMaxFileSizeL(aMessage);
1.702 + break;
1.703 + case EMMFAudioRecordControllerCrop:
1.704 + complete = DoCropL(aMessage);
1.705 + break;
1.706 + case EMMFAudioRecordControllerAddMetaDataEntry:
1.707 + complete = DoAddMetaDataEntryL(aMessage);
1.708 + break;
1.709 + case EMMFAudioRecordControllerRemoveMetaDataEntry:
1.710 + complete = DoRemoveMetaDataEntryL(aMessage);
1.711 + break;
1.712 + case EMMFAudioRecordControllerReplaceMetaDataEntry:
1.713 + complete = DoReplaceMetaDataEntryL(aMessage);
1.714 + break;
1.715 + default:
1.716 + User::Leave(KErrNotSupported);
1.717 + break;
1.718 + }
1.719 + if (complete)
1.720 + aMessage.Complete(KErrNone);
1.721 + }
1.722 +
1.723 +TBool CMMFAudioRecordControllerCustomCommandParser::DoGetRecordTimeAvailableL(TMMFMessage& aMessage)
1.724 + {
1.725 + TTimeIntervalMicroSeconds time;
1.726 + iImplementor.MarcGetRecordTimeAvailableL(time);
1.727 + TPckgBuf<TMMFAudioConfig> pckg;
1.728 + pckg().iRecordTimeAvailable = time;
1.729 + aMessage.WriteDataToClientL(pckg);
1.730 + return ETrue;
1.731 + }
1.732 +
1.733 +TBool CMMFAudioRecordControllerCustomCommandParser::DoSetMaxDurationL(TMMFMessage& aMessage)
1.734 + {
1.735 + TPckgBuf<TMMFAudioConfig> pckg;
1.736 + aMessage.ReadData1FromClientL(pckg);
1.737 + iImplementor.MarcSetMaxDurationL(pckg().iMaxDuration);
1.738 + return ETrue;
1.739 + }
1.740 +
1.741 +TBool CMMFAudioRecordControllerCustomCommandParser::DoSetMaxFileSizeL(TMMFMessage& aMessage)
1.742 + {
1.743 + TPckgBuf<TMMFAudioConfig> pckg;
1.744 + aMessage.ReadData1FromClientL(pckg);
1.745 + iImplementor.MarcSetMaxFileSizeL(pckg().iMaxFileSize);
1.746 + return ETrue;
1.747 + }
1.748 +
1.749 +TBool CMMFAudioRecordControllerCustomCommandParser::DoCropL(TMMFMessage& aMessage)
1.750 + {
1.751 + TPckgBuf<TMMFAudioConfig> pckg;
1.752 + aMessage.ReadData1FromClientL(pckg);
1.753 + iImplementor.MarcCropL(pckg().iCropToEnd);
1.754 + return ETrue;
1.755 + }
1.756 +
1.757 +TBool CMMFAudioRecordControllerCustomCommandParser::DoAddMetaDataEntryL(TMMFMessage& aMessage)
1.758 + {
1.759 + TInt bufSize = aMessage.SizeOfData1FromClient();
1.760 + // Leaving here in order to prevent a panic in the NewLC if the value is negative
1.761 + User::LeaveIfError(bufSize);
1.762 + HBufC8* buf = HBufC8::NewLC(bufSize);
1.763 + TPtr8 ptr = buf->Des();
1.764 + aMessage.ReadData1FromClientL(ptr);
1.765 + RDesReadStream stream;
1.766 + stream.Open(ptr);
1.767 + CleanupClosePushL(stream);
1.768 + CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
1.769 + CleanupStack::PushL(metaData);
1.770 + metaData->InternalizeL(stream);
1.771 + iImplementor.MarcAddMetaDataEntryL(*metaData);
1.772 + CleanupStack::PopAndDestroy(3);//metaData, stream, buf
1.773 + return ETrue;
1.774 + }
1.775 +
1.776 +TBool CMMFAudioRecordControllerCustomCommandParser::DoRemoveMetaDataEntryL(TMMFMessage& aMessage)
1.777 + {
1.778 + TPckgBuf<TInt> pckg;
1.779 + aMessage.ReadData1FromClientL(pckg);
1.780 + iImplementor.MarcRemoveMetaDataEntryL(pckg());
1.781 + return ETrue;
1.782 + }
1.783 +
1.784 +TBool CMMFAudioRecordControllerCustomCommandParser::DoReplaceMetaDataEntryL(TMMFMessage& aMessage)
1.785 + {
1.786 + // Get new meta data
1.787 + TInt bufSize = aMessage.SizeOfData1FromClient();
1.788 + // Leaving here in order to prevent a panic in the NewLC if the value is negative
1.789 + User::LeaveIfError(bufSize);
1.790 + HBufC8* buf = HBufC8::NewLC(bufSize);
1.791 + TPtr8 ptr = buf->Des();
1.792 + aMessage.ReadData1FromClientL(ptr);
1.793 + RDesReadStream stream;
1.794 + stream.Open(ptr);
1.795 + CleanupClosePushL(stream);
1.796 + CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
1.797 + CleanupStack::PushL(metaData);
1.798 + metaData->InternalizeL(stream);
1.799 +
1.800 +
1.801 + // Get index to replace
1.802 + TPckgBuf<TInt> indexPckg;
1.803 + aMessage.ReadData2FromClientL(indexPckg);
1.804 +
1.805 + iImplementor.MarcReplaceMetaDataEntryL(indexPckg(), *metaData);
1.806 +
1.807 + CleanupStack::PopAndDestroy(3);//metaData, stream, buf
1.808 + return ETrue;
1.809 + }
1.810 +
1.811 +
1.812 +
1.813 +
1.814 +
1.815 +
1.816 +
1.817 +
1.818 +
1.819 +
1.820 +
1.821 +
1.822 +
1.823 +
1.824 +
1.825 +
1.826 +
1.827 +EXPORT_C RMMFAudioControllerCustomCommands::RMMFAudioControllerCustomCommands(RMMFController& aController) :
1.828 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioController)
1.829 + {
1.830 + }
1.831 +
1.832 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceSampleRate(TUint aSampleRate) const
1.833 + {
1.834 + TPckgBuf<TMMFAudioConfig> configPackage;
1.835 + configPackage().iSampleRate = aSampleRate;
1.836 + return iController.CustomCommandSync(iDestinationPckg,
1.837 + EMMFAudioControllerSetSourceSampleRate,
1.838 + configPackage,
1.839 + KNullDesC8);
1.840 + }
1.841 +
1.842 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceNumChannels(TUint aNumChannels) const
1.843 + {
1.844 + TPckgBuf<TMMFAudioConfig> configPackage;
1.845 + configPackage().iChannels = aNumChannels;
1.846 + return iController.CustomCommandSync(iDestinationPckg,
1.847 + EMMFAudioControllerSetSourceNumChannels,
1.848 + configPackage,
1.849 + KNullDesC8);
1.850 + }
1.851 +
1.852 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceFormat(TUid aFormatUid) const
1.853 + {
1.854 + TPckgBuf<TMMFAudioConfig> configPackage;
1.855 + configPackage().iFormatUid = aFormatUid;
1.856 + return iController.CustomCommandSync(iDestinationPckg,
1.857 + EMMFAudioControllerSetSourceFormat,
1.858 + configPackage,
1.859 + KNullDesC8);
1.860 + }
1.861 +
1.862 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkSampleRate(TUint aSampleRate) const
1.863 + {
1.864 + TPckgBuf<TMMFAudioConfig> configPackage;
1.865 + configPackage().iSampleRate = aSampleRate;
1.866 + return iController.CustomCommandSync(iDestinationPckg,
1.867 + EMMFAudioControllerSetSinkSampleRate,
1.868 + configPackage,
1.869 + KNullDesC8);
1.870 + }
1.871 +
1.872 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkNumChannels(TUint aNumChannels) const
1.873 + {
1.874 + TPckgBuf<TMMFAudioConfig> configPackage;
1.875 + configPackage().iChannels = aNumChannels;
1.876 + return iController.CustomCommandSync(iDestinationPckg,
1.877 + EMMFAudioControllerSetSinkNumChannels,
1.878 + configPackage,
1.879 + KNullDesC8);
1.880 + }
1.881 +
1.882 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkFormat(TUid aFormatUid) const
1.883 + {
1.884 + TPckgBuf<TMMFAudioConfig> configPackage;
1.885 + configPackage().iFormatUid = aFormatUid;
1.886 + return iController.CustomCommandSync(iDestinationPckg,
1.887 + EMMFAudioControllerSetSinkFormat,
1.888 + configPackage,
1.889 + KNullDesC8);
1.890 + }
1.891 +
1.892 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetCodec(TFourCC aSourceDataType, TFourCC aSinkDataType) const
1.893 + {
1.894 + TPckgBuf<TMMFAudioConfig> configPackage;
1.895 + configPackage().iSourceDataTypeCode = aSourceDataType;
1.896 + configPackage().iSinkDataTypeCode = aSinkDataType;
1.897 + return iController.CustomCommandSync(iDestinationPckg,
1.898 + EMMFAudioControllerSetCodec,
1.899 + configPackage,
1.900 + KNullDesC8);
1.901 + }
1.902 +
1.903 +
1.904 +
1.905 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceBitRate(TUint aRate) const
1.906 + {
1.907 + TPckgBuf<TMMFAudioConfig> configPackage;
1.908 + configPackage().iSampleRate = aRate;
1.909 + return iController.CustomCommandSync(iDestinationPckg,
1.910 + EMMFAudioControllerSetSourceBitRate,
1.911 + configPackage,
1.912 + KNullDesC8);
1.913 + }
1.914 +
1.915 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceDataType(TFourCC aDataType) const
1.916 + {
1.917 + TPckgBuf<TMMFAudioConfig> configPackage;
1.918 + configPackage().iSourceDataTypeCode = aDataType;
1.919 + return iController.CustomCommandSync(iDestinationPckg,
1.920 + EMMFAudioControllerSetSourceDataType,
1.921 + configPackage,
1.922 + KNullDesC8);
1.923 + }
1.924 +
1.925 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkBitRate(TUint aRate) const
1.926 + {
1.927 + TPckgBuf<TMMFAudioConfig> configPackage;
1.928 + configPackage().iSampleRate = aRate;
1.929 + return iController.CustomCommandSync(iDestinationPckg,
1.930 + EMMFAudioControllerSetSinkBitRate,
1.931 + configPackage,
1.932 + KNullDesC8);
1.933 + }
1.934 +
1.935 +EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkDataType(TFourCC aDataType) const
1.936 + {
1.937 + TPckgBuf<TMMFAudioConfig> configPackage;
1.938 + configPackage().iSinkDataTypeCode = aDataType;
1.939 + return iController.CustomCommandSync(iDestinationPckg,
1.940 + EMMFAudioControllerSetSinkDataType,
1.941 + configPackage,
1.942 + KNullDesC8);
1.943 + }
1.944 +
1.945 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceSampleRate(TUint& aRate) const
1.946 + {
1.947 + TPckgBuf<TMMFAudioConfig> configPackage;
1.948 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.949 + EMMFAudioControllerGetSourceSampleRate,
1.950 + KNullDesC8,
1.951 + KNullDesC8,
1.952 + configPackage);
1.953 + if (!error)
1.954 + aRate = configPackage().iSampleRate;
1.955 + return error;
1.956 + }
1.957 +
1.958 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceBitRate(TUint& aRate) const
1.959 + {
1.960 + TPckgBuf<TMMFAudioConfig> configPackage;
1.961 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.962 + EMMFAudioControllerGetSourceBitRate,
1.963 + KNullDesC8,
1.964 + KNullDesC8,
1.965 + configPackage);
1.966 + if (!error)
1.967 + aRate = configPackage().iSampleRate;
1.968 + return error;
1.969 + }
1.970 +
1.971 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceNumChannels(TUint& aNumChannels) const
1.972 + {
1.973 + TPckgBuf<TMMFAudioConfig> configPackage;
1.974 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.975 + EMMFAudioControllerGetSourceNumChannels,
1.976 + KNullDesC8,
1.977 + KNullDesC8,
1.978 + configPackage);
1.979 + if (!error)
1.980 + aNumChannels = configPackage().iChannels;
1.981 + return error;
1.982 + }
1.983 +
1.984 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceFormat(TUid& aFormat) const
1.985 + {
1.986 + TPckgBuf<TMMFAudioConfig> configPackage;
1.987 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.988 + EMMFAudioControllerGetSourceFormat,
1.989 + KNullDesC8,
1.990 + KNullDesC8,
1.991 + configPackage);
1.992 + if (!error)
1.993 + aFormat = configPackage().iFormatUid;
1.994 + return error;
1.995 + }
1.996 +
1.997 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceDataType(TFourCC& aDataType) const
1.998 + {
1.999 + TPckgBuf<TMMFAudioConfig> configPackage;
1.1000 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1001 + EMMFAudioControllerGetSourceDataType,
1.1002 + KNullDesC8,
1.1003 + KNullDesC8,
1.1004 + configPackage);
1.1005 + if (!error)
1.1006 + aDataType = configPackage().iSourceDataTypeCode;
1.1007 + return error;
1.1008 + }
1.1009 +
1.1010 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkSampleRate(TUint& aRate) const
1.1011 + {
1.1012 + TPckgBuf<TMMFAudioConfig> configPackage;
1.1013 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1014 + EMMFAudioControllerGetSinkSampleRate,
1.1015 + KNullDesC8,
1.1016 + KNullDesC8,
1.1017 + configPackage);
1.1018 + if (!error)
1.1019 + aRate = configPackage().iSampleRate;
1.1020 + return error;
1.1021 + }
1.1022 +
1.1023 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkBitRate(TUint& aRate) const
1.1024 + {
1.1025 + TPckgBuf<TMMFAudioConfig> configPackage;
1.1026 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1027 + EMMFAudioControllerGetSinkBitRate,
1.1028 + KNullDesC8,
1.1029 + KNullDesC8,
1.1030 + configPackage);
1.1031 + if (!error)
1.1032 + aRate = configPackage().iSampleRate;
1.1033 + return error;
1.1034 + }
1.1035 +
1.1036 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkNumChannels(TUint& aNumChannels) const
1.1037 + {
1.1038 + TPckgBuf<TMMFAudioConfig> configPackage;
1.1039 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1040 + EMMFAudioControllerGetSinkNumChannels,
1.1041 + KNullDesC8,
1.1042 + KNullDesC8,
1.1043 + configPackage);
1.1044 + if (!error)
1.1045 + aNumChannels = configPackage().iChannels;
1.1046 + return error;
1.1047 + }
1.1048 +
1.1049 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkFormat(TUid& aFormat) const
1.1050 + {
1.1051 + TPckgBuf<TMMFAudioConfig> configPackage;
1.1052 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1053 + EMMFAudioControllerGetSinkFormat,
1.1054 + KNullDesC8,
1.1055 + KNullDesC8,
1.1056 + configPackage);
1.1057 + if (!error)
1.1058 + aFormat = configPackage().iFormatUid;
1.1059 + return error;
1.1060 + }
1.1061 +
1.1062 +EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkDataType(TFourCC& aDataType) const
1.1063 + {
1.1064 + TPckgBuf<TMMFAudioConfig> configPackage;
1.1065 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1066 + EMMFAudioControllerGetSinkDataType,
1.1067 + KNullDesC8,
1.1068 + KNullDesC8,
1.1069 + configPackage);
1.1070 + if (!error)
1.1071 + aDataType = configPackage().iSinkDataTypeCode;
1.1072 + return error;
1.1073 + }
1.1074 +
1.1075 +EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceSampleRatesL(RArray<TUint>& aSupportedRates) const
1.1076 + {
1.1077 + DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSourceSampleRates);
1.1078 + }
1.1079 +
1.1080 +EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceBitRatesL(RArray<TUint>& aSupportedRates) const
1.1081 + {
1.1082 + DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSourceBitRates);
1.1083 + }
1.1084 +
1.1085 +EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceNumChannelsL(RArray<TUint>& aSupportedChannels) const
1.1086 + {
1.1087 + DoGetUintArrayL(aSupportedChannels, EMMFAudioControllerGetSupportedSourceNumChannels);
1.1088 + }
1.1089 +
1.1090 +EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const
1.1091 + {
1.1092 + DoGetFourCCArrayL(aSupportedDataTypes, EMMFAudioControllerGetSupportedSourceDataTypes);
1.1093 + }
1.1094 +
1.1095 +EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkSampleRatesL(RArray<TUint>& aSupportedRates) const
1.1096 + {
1.1097 + DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSinkSampleRates);
1.1098 + }
1.1099 +
1.1100 +EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkBitRatesL(RArray<TUint>& aSupportedRates) const
1.1101 + {
1.1102 + DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSinkBitRates);
1.1103 + }
1.1104 +
1.1105 +EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkNumChannelsL(RArray<TUint>& aSupportedChannels) const
1.1106 + {
1.1107 + DoGetUintArrayL(aSupportedChannels, EMMFAudioControllerGetSupportedSinkNumChannels);
1.1108 + }
1.1109 +
1.1110 +EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const
1.1111 + {
1.1112 + DoGetFourCCArrayL(aSupportedDataTypes, EMMFAudioControllerGetSupportedSinkDataTypes);
1.1113 + }
1.1114 +
1.1115 +
1.1116 +
1.1117 +void RMMFAudioControllerCustomCommands::DoGetUintArrayL(RArray<TUint>& aArray, TMMFAudioControllerMessages aIpc) const
1.1118 + {
1.1119 + aArray.Reset();
1.1120 +
1.1121 + TPckgBuf<TInt> numberOfElementsPckg;
1.1122 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.1123 + aIpc,
1.1124 + KNullDesC8,
1.1125 + KNullDesC8,
1.1126 + numberOfElementsPckg));
1.1127 +
1.1128 + HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TUint));
1.1129 + TPtr8 ptr = buf->Des();
1.1130 +
1.1131 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.1132 + EMMFAudioControllerCopyArrayData,
1.1133 + KNullDesC8,
1.1134 + KNullDesC8,
1.1135 + ptr));
1.1136 + RDesReadStream stream(ptr);
1.1137 + CleanupClosePushL(stream);
1.1138 +
1.1139 + for (TInt i=0; i<numberOfElementsPckg(); i++)
1.1140 + {
1.1141 + User::LeaveIfError(aArray.Append(stream.ReadUint32L()));
1.1142 + }
1.1143 +
1.1144 + CleanupStack::PopAndDestroy(2);//stream, buf
1.1145 + }
1.1146 +
1.1147 +void RMMFAudioControllerCustomCommands::DoGetFourCCArrayL(RArray<TFourCC>& aArray, TMMFAudioControllerMessages aIpc) const
1.1148 + {
1.1149 + aArray.Reset();
1.1150 +
1.1151 + TPckgBuf<TInt> numberOfElementsPckg;
1.1152 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.1153 + aIpc,
1.1154 + KNullDesC8,
1.1155 + KNullDesC8,
1.1156 + numberOfElementsPckg));
1.1157 +
1.1158 + HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
1.1159 + TPtr8 ptr = buf->Des();
1.1160 +
1.1161 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.1162 + EMMFAudioControllerCopyArrayData,
1.1163 + KNullDesC8,
1.1164 + KNullDesC8,
1.1165 + ptr));
1.1166 + RDesReadStream stream(ptr);
1.1167 + CleanupClosePushL(stream);
1.1168 +
1.1169 + for (TInt i=0; i<numberOfElementsPckg(); i++)
1.1170 + {
1.1171 + User::LeaveIfError(aArray.Append(stream.ReadInt32L()));
1.1172 + }
1.1173 +
1.1174 + CleanupStack::PopAndDestroy(2);//stream, buf
1.1175 + }
1.1176 +
1.1177 +
1.1178 +
1.1179 +
1.1180 +
1.1181 +
1.1182 +
1.1183 +
1.1184 +
1.1185 +
1.1186 +
1.1187 +
1.1188 +
1.1189 +
1.1190 +EXPORT_C CMMFAudioControllerCustomCommandParser* CMMFAudioControllerCustomCommandParser::NewL(MMMFAudioControllerCustomCommandImplementor& aImplementor)
1.1191 + {
1.1192 + return new(ELeave) CMMFAudioControllerCustomCommandParser(aImplementor);
1.1193 + }
1.1194 +
1.1195 +CMMFAudioControllerCustomCommandParser::CMMFAudioControllerCustomCommandParser(MMMFAudioControllerCustomCommandImplementor& aImplementor) :
1.1196 + CMMFCustomCommandParserBase(KUidInterfaceMMFAudioController),
1.1197 + iImplementor(aImplementor)
1.1198 + {
1.1199 + }
1.1200 +
1.1201 +EXPORT_C CMMFAudioControllerCustomCommandParser::~CMMFAudioControllerCustomCommandParser()
1.1202 + {
1.1203 + delete iDataCopyBuffer;
1.1204 + }
1.1205 +
1.1206 +void CMMFAudioControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.1207 + {
1.1208 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioController)
1.1209 + {
1.1210 + TRAPD(error, DoHandleRequestL(aMessage));
1.1211 + if (error)
1.1212 + aMessage.Complete(error);
1.1213 + }
1.1214 + else
1.1215 + {
1.1216 + aMessage.Complete(KErrNotSupported);
1.1217 + }
1.1218 + }
1.1219 +
1.1220 +
1.1221 +void CMMFAudioControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.1222 + {
1.1223 + TBool complete = ETrue;
1.1224 + switch (aMessage.Function())
1.1225 + {
1.1226 + case EMMFAudioControllerSetSourceSampleRate:
1.1227 + complete = DoSetSourceSampleRateL(aMessage);
1.1228 + break;
1.1229 + case EMMFAudioControllerSetSourceBitRate:
1.1230 + complete = DoSetSourceBitRateL(aMessage);
1.1231 + break;
1.1232 + case EMMFAudioControllerSetSourceNumChannels:
1.1233 + complete = DoSetSourceNumChannelsL(aMessage);
1.1234 + break;
1.1235 + case EMMFAudioControllerSetSourceFormat:
1.1236 + complete = DoSetSourceFormatL(aMessage);
1.1237 + break;
1.1238 + case EMMFAudioControllerSetSourceDataType:
1.1239 + complete = DoSetSourceDataTypeL(aMessage);
1.1240 + break;
1.1241 + case EMMFAudioControllerSetSinkSampleRate:
1.1242 + complete = DoSetSinkSampleRateL(aMessage);
1.1243 + break;
1.1244 + case EMMFAudioControllerSetSinkBitRate:
1.1245 + complete = DoSetSinkBitRateL(aMessage);
1.1246 + break;
1.1247 + case EMMFAudioControllerSetSinkNumChannels:
1.1248 + complete = DoSetSinkNumChannelsL(aMessage);
1.1249 + break;
1.1250 + case EMMFAudioControllerSetSinkFormat:
1.1251 + complete = DoSetSinkFormatL(aMessage);
1.1252 + break;
1.1253 + case EMMFAudioControllerSetSinkDataType:
1.1254 + complete = DoSetSinkDataTypeL(aMessage);
1.1255 + break;
1.1256 + case EMMFAudioControllerSetCodec:
1.1257 + complete = DoSetCodecL(aMessage);
1.1258 + break;
1.1259 + case EMMFAudioControllerGetSourceSampleRate:
1.1260 + complete = DoGetSourceSampleRateL(aMessage);
1.1261 + break;
1.1262 + case EMMFAudioControllerGetSourceBitRate:
1.1263 + complete = DoGetSourceBitRateL(aMessage);
1.1264 + break;
1.1265 + case EMMFAudioControllerGetSourceNumChannels:
1.1266 + complete = DoGetSourceNumChannelsL(aMessage);
1.1267 + break;
1.1268 + case EMMFAudioControllerGetSourceFormat:
1.1269 + complete = DoGetSourceFormatL(aMessage);
1.1270 + break;
1.1271 + case EMMFAudioControllerGetSourceDataType:
1.1272 + complete = DoGetSourceDataTypeL(aMessage);
1.1273 + break;
1.1274 + case EMMFAudioControllerGetSinkSampleRate:
1.1275 + complete = DoGetSinkSampleRateL(aMessage);
1.1276 + break;
1.1277 + case EMMFAudioControllerGetSinkBitRate:
1.1278 + complete = DoGetSinkBitRateL(aMessage);
1.1279 + break;
1.1280 + case EMMFAudioControllerGetSinkNumChannels:
1.1281 + complete = DoGetSinkNumChannelsL(aMessage);
1.1282 + break;
1.1283 + case EMMFAudioControllerGetSinkFormat:
1.1284 + complete = DoGetSinkFormatL(aMessage);
1.1285 + break;
1.1286 + case EMMFAudioControllerGetSinkDataType:
1.1287 + complete = DoGetSinkDataTypeL(aMessage);
1.1288 + break;
1.1289 + case EMMFAudioControllerGetSupportedSourceSampleRates:
1.1290 + complete = DoGetSupportedSourceSampleRatesL(aMessage);
1.1291 + break;
1.1292 + case EMMFAudioControllerGetSupportedSourceBitRates:
1.1293 + complete = DoGetSupportedSourceBitRatesL(aMessage);
1.1294 + break;
1.1295 + case EMMFAudioControllerGetSupportedSourceNumChannels:
1.1296 + complete = DoGetSupportedSourceNumChannelsL(aMessage);
1.1297 + break;
1.1298 + case EMMFAudioControllerGetSupportedSourceDataTypes:
1.1299 + complete = DoGetSupportedSourceDataTypesL(aMessage);
1.1300 + break;
1.1301 + case EMMFAudioControllerGetSupportedSinkSampleRates:
1.1302 + complete = DoGetSupportedSinkSampleRatesL(aMessage);
1.1303 + break;
1.1304 + case EMMFAudioControllerGetSupportedSinkBitRates:
1.1305 + complete = DoGetSupportedSinkBitRatesL(aMessage);
1.1306 + break;
1.1307 + case EMMFAudioControllerGetSupportedSinkNumChannels:
1.1308 + complete = DoGetSupportedSinkNumChannelsL(aMessage);
1.1309 + break;
1.1310 + case EMMFAudioControllerGetSupportedSinkDataTypes:
1.1311 + complete = DoGetSupportedSinkDataTypesL(aMessage);
1.1312 + break;
1.1313 + case EMMFAudioControllerCopyArrayData:
1.1314 + complete = DoCopyArrayDataL(aMessage);
1.1315 + break;
1.1316 + default:
1.1317 + User::Leave(KErrNotSupported);
1.1318 + break;
1.1319 + }
1.1320 + if (complete)
1.1321 + aMessage.Complete(KErrNone);
1.1322 + }
1.1323 +
1.1324 +TBool CMMFAudioControllerCustomCommandParser::DoSetSourceSampleRateL(TMMFMessage& aMessage)
1.1325 + {
1.1326 + TPckgBuf<TMMFAudioConfig> pckg;
1.1327 + aMessage.ReadData1FromClientL(pckg);
1.1328 + iImplementor.MacSetSourceSampleRateL(pckg().iSampleRate);
1.1329 + return ETrue;
1.1330 + }
1.1331 +
1.1332 +TBool CMMFAudioControllerCustomCommandParser::DoSetSourceNumChannelsL(TMMFMessage& aMessage)
1.1333 + {
1.1334 + TPckgBuf<TMMFAudioConfig> pckg;
1.1335 + aMessage.ReadData1FromClientL(pckg);
1.1336 + iImplementor.MacSetSourceNumChannelsL(pckg().iChannels);
1.1337 + return ETrue;
1.1338 + }
1.1339 +
1.1340 +TBool CMMFAudioControllerCustomCommandParser::DoSetSourceFormatL(TMMFMessage& aMessage)
1.1341 + {
1.1342 + TPckgBuf<TMMFAudioConfig> pckg;
1.1343 + aMessage.ReadData1FromClientL(pckg);
1.1344 + iImplementor.MacSetSourceFormatL(pckg().iFormatUid);
1.1345 + return ETrue;
1.1346 + }
1.1347 +
1.1348 +TBool CMMFAudioControllerCustomCommandParser::DoSetSinkSampleRateL(TMMFMessage& aMessage)
1.1349 + {
1.1350 + TPckgBuf<TMMFAudioConfig> pckg;
1.1351 + aMessage.ReadData1FromClientL(pckg);
1.1352 + iImplementor.MacSetSinkSampleRateL(pckg().iSampleRate);
1.1353 + return ETrue;
1.1354 + }
1.1355 +
1.1356 +TBool CMMFAudioControllerCustomCommandParser::DoSetSinkNumChannelsL(TMMFMessage& aMessage)
1.1357 + {
1.1358 + TPckgBuf<TMMFAudioConfig> pckg;
1.1359 + aMessage.ReadData1FromClientL(pckg);
1.1360 + iImplementor.MacSetSinkNumChannelsL(pckg().iChannels);
1.1361 + return ETrue;
1.1362 + }
1.1363 +
1.1364 +TBool CMMFAudioControllerCustomCommandParser::DoSetSinkFormatL(TMMFMessage& aMessage)
1.1365 + {
1.1366 + TPckgBuf<TMMFAudioConfig> pckg;
1.1367 + aMessage.ReadData1FromClientL(pckg);
1.1368 + iImplementor.MacSetSinkFormatL(pckg().iFormatUid);
1.1369 + return ETrue;
1.1370 + }
1.1371 +
1.1372 +TBool CMMFAudioControllerCustomCommandParser::DoSetCodecL(TMMFMessage& aMessage)
1.1373 + {
1.1374 + TPckgBuf<TMMFAudioConfig> pckg;
1.1375 + aMessage.ReadData1FromClientL(pckg);
1.1376 + iImplementor.MacSetCodecL(pckg().iSourceDataTypeCode, pckg().iSinkDataTypeCode);
1.1377 + return ETrue;
1.1378 + }
1.1379 +
1.1380 +
1.1381 +TBool CMMFAudioControllerCustomCommandParser::DoSetSourceBitRateL(TMMFMessage& aMessage)
1.1382 + {
1.1383 + TPckgBuf<TMMFAudioConfig> pckg;
1.1384 + aMessage.ReadData1FromClientL(pckg);
1.1385 + iImplementor.MacSetSourceBitRateL(pckg().iSampleRate);
1.1386 + return ETrue;
1.1387 + }
1.1388 +
1.1389 +TBool CMMFAudioControllerCustomCommandParser::DoSetSourceDataTypeL(TMMFMessage& aMessage)
1.1390 + {
1.1391 + TPckgBuf<TMMFAudioConfig> pckg;
1.1392 + aMessage.ReadData1FromClientL(pckg);
1.1393 + iImplementor.MacSetSourceDataTypeL(pckg().iSourceDataTypeCode);
1.1394 + return ETrue;
1.1395 + }
1.1396 +
1.1397 +TBool CMMFAudioControllerCustomCommandParser::DoSetSinkBitRateL(TMMFMessage& aMessage)
1.1398 + {
1.1399 + TPckgBuf<TMMFAudioConfig> pckg;
1.1400 + aMessage.ReadData1FromClientL(pckg);
1.1401 + iImplementor.MacSetSinkBitRateL(pckg().iSampleRate);
1.1402 + return ETrue;
1.1403 + }
1.1404 +
1.1405 +TBool CMMFAudioControllerCustomCommandParser::DoSetSinkDataTypeL(TMMFMessage& aMessage)
1.1406 + {
1.1407 + TPckgBuf<TMMFAudioConfig> pckg;
1.1408 + aMessage.ReadData1FromClientL(pckg);
1.1409 + iImplementor.MacSetSinkDataTypeL(pckg().iSinkDataTypeCode);
1.1410 + return ETrue;
1.1411 + }
1.1412 +
1.1413 +TBool CMMFAudioControllerCustomCommandParser::DoGetSourceSampleRateL(TMMFMessage& aMessage)
1.1414 + {
1.1415 + TUint rate = 0;
1.1416 + iImplementor.MacGetSourceSampleRateL(rate);
1.1417 + TPckgBuf<TMMFAudioConfig> pckg;
1.1418 + pckg().iSampleRate = rate;
1.1419 + aMessage.WriteDataToClientL(pckg);
1.1420 + return ETrue;
1.1421 + }
1.1422 +
1.1423 +TBool CMMFAudioControllerCustomCommandParser::DoGetSourceBitRateL(TMMFMessage& aMessage)
1.1424 + {
1.1425 + TUint rate = 0;
1.1426 + iImplementor.MacGetSourceBitRateL(rate);
1.1427 + TPckgBuf<TMMFAudioConfig> pckg;
1.1428 + pckg().iSampleRate = rate;
1.1429 + aMessage.WriteDataToClientL(pckg);
1.1430 + return ETrue;
1.1431 + }
1.1432 +
1.1433 +TBool CMMFAudioControllerCustomCommandParser::DoGetSourceNumChannelsL(TMMFMessage& aMessage)
1.1434 + {
1.1435 + TUint channels = 0;
1.1436 + iImplementor.MacGetSourceNumChannelsL(channels);
1.1437 + TPckgBuf<TMMFAudioConfig> pckg;
1.1438 + pckg().iChannels = channels;
1.1439 + aMessage.WriteDataToClientL(pckg);
1.1440 + return ETrue;
1.1441 + }
1.1442 +
1.1443 +TBool CMMFAudioControllerCustomCommandParser::DoGetSourceFormatL(TMMFMessage& aMessage)
1.1444 + {
1.1445 + TUid format;
1.1446 + iImplementor.MacGetSourceFormatL(format);
1.1447 + TPckgBuf<TMMFAudioConfig> pckg;
1.1448 + pckg().iFormatUid = format;
1.1449 + aMessage.WriteDataToClientL(pckg);
1.1450 + return ETrue;
1.1451 + }
1.1452 +
1.1453 +TBool CMMFAudioControllerCustomCommandParser::DoGetSourceDataTypeL(TMMFMessage& aMessage)
1.1454 + {
1.1455 + TFourCC fourCC;
1.1456 + iImplementor.MacGetSourceDataTypeL(fourCC);
1.1457 + TPckgBuf<TMMFAudioConfig> pckg;
1.1458 + pckg().iSourceDataTypeCode = fourCC;
1.1459 + aMessage.WriteDataToClientL(pckg);
1.1460 + return ETrue;
1.1461 + }
1.1462 +
1.1463 +TBool CMMFAudioControllerCustomCommandParser::DoGetSinkSampleRateL(TMMFMessage& aMessage)
1.1464 + {
1.1465 + TUint rate = 0;
1.1466 + iImplementor.MacGetSinkSampleRateL(rate);
1.1467 + TPckgBuf<TMMFAudioConfig> pckg;
1.1468 + pckg().iSampleRate = rate;
1.1469 + aMessage.WriteDataToClientL(pckg);
1.1470 + return ETrue;
1.1471 + }
1.1472 +
1.1473 +TBool CMMFAudioControllerCustomCommandParser::DoGetSinkBitRateL(TMMFMessage& aMessage)
1.1474 + {
1.1475 + TUint rate = 0;
1.1476 + iImplementor.MacGetSinkBitRateL(rate);
1.1477 + TPckgBuf<TMMFAudioConfig> pckg;
1.1478 + pckg().iSampleRate = rate;
1.1479 + aMessage.WriteDataToClientL(pckg);
1.1480 + return ETrue;
1.1481 + }
1.1482 +
1.1483 +TBool CMMFAudioControllerCustomCommandParser::DoGetSinkNumChannelsL(TMMFMessage& aMessage)
1.1484 + {
1.1485 + TUint channels = 0;
1.1486 + iImplementor.MacGetSinkNumChannelsL(channels);
1.1487 + TPckgBuf<TMMFAudioConfig> pckg;
1.1488 + pckg().iChannels = channels;
1.1489 + aMessage.WriteDataToClientL(pckg);
1.1490 + return ETrue;
1.1491 + }
1.1492 +
1.1493 +TBool CMMFAudioControllerCustomCommandParser::DoGetSinkFormatL(TMMFMessage& aMessage)
1.1494 + {
1.1495 + TUid format;
1.1496 + iImplementor.MacGetSinkFormatL(format);
1.1497 + TPckgBuf<TMMFAudioConfig> pckg;
1.1498 + pckg().iFormatUid = format;
1.1499 + aMessage.WriteDataToClientL(pckg);
1.1500 + return ETrue;
1.1501 + }
1.1502 +
1.1503 +TBool CMMFAudioControllerCustomCommandParser::DoGetSinkDataTypeL(TMMFMessage& aMessage)
1.1504 + {
1.1505 + TFourCC fourCC;
1.1506 + iImplementor.MacGetSinkDataTypeL(fourCC);
1.1507 + TPckgBuf<TMMFAudioConfig> pckg;
1.1508 + pckg().iSinkDataTypeCode = fourCC;
1.1509 + aMessage.WriteDataToClientL(pckg);
1.1510 + return ETrue;
1.1511 + }
1.1512 +
1.1513 +TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceSampleRatesL(TMMFMessage& aMessage)
1.1514 + {
1.1515 + RArray<TUint> rates;
1.1516 + CleanupClosePushL(rates);
1.1517 + iImplementor.MacGetSupportedSourceSampleRatesL(rates);
1.1518 +
1.1519 + DoCreateBufFromUintArrayL(rates);
1.1520 +
1.1521 + TPckgBuf<TInt> pckg;
1.1522 + pckg() = rates.Count();
1.1523 + aMessage.WriteDataToClientL(pckg);
1.1524 +
1.1525 + CleanupStack::PopAndDestroy();//rates
1.1526 + return ETrue;
1.1527 + }
1.1528 +
1.1529 +void CMMFAudioControllerCustomCommandParser::DoCreateBufFromUintArrayL(RArray<TUint>& aArray)
1.1530 + {
1.1531 + delete iDataCopyBuffer;
1.1532 + iDataCopyBuffer = NULL;
1.1533 +
1.1534 + iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
1.1535 + RBufWriteStream stream;
1.1536 + stream.Open(*iDataCopyBuffer);
1.1537 + CleanupClosePushL(stream);
1.1538 + for (TInt i=0;i<aArray.Count();i++)
1.1539 + stream.WriteUint32L(aArray[i]);
1.1540 + CleanupStack::PopAndDestroy();//stream
1.1541 + }
1.1542 +
1.1543 +void CMMFAudioControllerCustomCommandParser::DoCreateBufFromFourCCArrayL(RArray<TFourCC>& aArray)
1.1544 + {
1.1545 + delete iDataCopyBuffer;
1.1546 + iDataCopyBuffer = NULL;
1.1547 +
1.1548 + iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
1.1549 + RBufWriteStream stream;
1.1550 + stream.Open(*iDataCopyBuffer);
1.1551 + CleanupClosePushL(stream);
1.1552 + for (TInt i=0;i<aArray.Count();i++)
1.1553 + {
1.1554 + stream.WriteInt32L(aArray[i].FourCC());
1.1555 + }
1.1556 + CleanupStack::PopAndDestroy();//stream
1.1557 + }
1.1558 +
1.1559 +TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceBitRatesL(TMMFMessage& aMessage)
1.1560 + {
1.1561 + RArray<TUint> rates;
1.1562 + CleanupClosePushL(rates);
1.1563 + iImplementor.MacGetSupportedSourceBitRatesL(rates);
1.1564 +
1.1565 + DoCreateBufFromUintArrayL(rates);
1.1566 +
1.1567 + TPckgBuf<TInt> pckg;
1.1568 + pckg() = rates.Count();
1.1569 + aMessage.WriteDataToClientL(pckg);
1.1570 +
1.1571 + CleanupStack::PopAndDestroy();//rates
1.1572 + return ETrue;
1.1573 + }
1.1574 +
1.1575 +TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceNumChannelsL(TMMFMessage& aMessage)
1.1576 + {
1.1577 + RArray<TUint> array;
1.1578 + CleanupClosePushL(array);
1.1579 + iImplementor.MacGetSupportedSourceNumChannelsL(array);
1.1580 +
1.1581 + DoCreateBufFromUintArrayL(array);
1.1582 +
1.1583 + TPckgBuf<TInt> pckg;
1.1584 + pckg() = array.Count();
1.1585 + aMessage.WriteDataToClientL(pckg);
1.1586 +
1.1587 + CleanupStack::PopAndDestroy();//array
1.1588 + return ETrue;
1.1589 + }
1.1590 +
1.1591 +TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceDataTypesL(TMMFMessage& aMessage)
1.1592 + {
1.1593 + RArray<TFourCC> array;
1.1594 + CleanupClosePushL(array);
1.1595 + iImplementor.MacGetSupportedSourceDataTypesL(array);
1.1596 +
1.1597 + DoCreateBufFromFourCCArrayL(array);
1.1598 +
1.1599 + TPckgBuf<TInt> pckg;
1.1600 + pckg() = array.Count();
1.1601 + aMessage.WriteDataToClientL(pckg);
1.1602 +
1.1603 + CleanupStack::PopAndDestroy();//array
1.1604 + return ETrue;
1.1605 + }
1.1606 +
1.1607 +TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkSampleRatesL(TMMFMessage& aMessage)
1.1608 + {
1.1609 + RArray<TUint> array;
1.1610 + CleanupClosePushL(array);
1.1611 + iImplementor.MacGetSupportedSinkSampleRatesL(array);
1.1612 +
1.1613 + DoCreateBufFromUintArrayL(array);
1.1614 +
1.1615 + TPckgBuf<TInt> pckg;
1.1616 + pckg() = array.Count();
1.1617 + aMessage.WriteDataToClientL(pckg);
1.1618 +
1.1619 + CleanupStack::PopAndDestroy();//array
1.1620 + return ETrue;
1.1621 + }
1.1622 +
1.1623 +TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkBitRatesL(TMMFMessage& aMessage)
1.1624 + {
1.1625 + RArray<TUint> array;
1.1626 + CleanupClosePushL(array);
1.1627 + iImplementor.MacGetSupportedSinkBitRatesL(array);
1.1628 +
1.1629 + DoCreateBufFromUintArrayL(array);
1.1630 +
1.1631 + TPckgBuf<TInt> pckg;
1.1632 + pckg() = array.Count();
1.1633 + aMessage.WriteDataToClientL(pckg);
1.1634 +
1.1635 + CleanupStack::PopAndDestroy();//array
1.1636 + return ETrue;
1.1637 + }
1.1638 +
1.1639 +TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkNumChannelsL(TMMFMessage& aMessage)
1.1640 + {
1.1641 + RArray<TUint> array;
1.1642 + CleanupClosePushL(array);
1.1643 + iImplementor.MacGetSupportedSinkNumChannelsL(array);
1.1644 +
1.1645 + DoCreateBufFromUintArrayL(array);
1.1646 +
1.1647 + TPckgBuf<TInt> pckg;
1.1648 + pckg() = array.Count();
1.1649 + aMessage.WriteDataToClientL(pckg);
1.1650 +
1.1651 + CleanupStack::PopAndDestroy();//array
1.1652 + return ETrue;
1.1653 + }
1.1654 +
1.1655 +TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkDataTypesL(TMMFMessage& aMessage)
1.1656 + {
1.1657 + RArray<TFourCC> array;
1.1658 + CleanupClosePushL(array);
1.1659 + iImplementor.MacGetSupportedSinkDataTypesL(array);
1.1660 +
1.1661 + DoCreateBufFromFourCCArrayL(array);
1.1662 +
1.1663 + TPckgBuf<TInt> pckg;
1.1664 + pckg() = array.Count();
1.1665 + aMessage.WriteDataToClientL(pckg);
1.1666 +
1.1667 + CleanupStack::PopAndDestroy();//array
1.1668 + return ETrue;
1.1669 + }
1.1670 +
1.1671 +TBool CMMFAudioControllerCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage)
1.1672 + {
1.1673 + if (!iDataCopyBuffer)
1.1674 + User::Leave(KErrNotReady);
1.1675 + aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
1.1676 + return ETrue;
1.1677 + }
1.1678 +
1.1679 +
1.1680 +
1.1681 +
1.1682 +TBool CMMFVideoRecordControllerCustomCommandParser::DoCopyCDesC8ArrayDataL(TMMFMessage& aMessage)
1.1683 + {
1.1684 + if (!iDataCopyBuffer)
1.1685 + User::Leave(KErrNotReady);
1.1686 + aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
1.1687 + return ETrue;
1.1688 + }
1.1689 +
1.1690 +
1.1691 +
1.1692 +
1.1693 +
1.1694 +
1.1695 +
1.1696 +
1.1697 +
1.1698 +
1.1699 +
1.1700 +
1.1701 +
1.1702 +
1.1703 +
1.1704 +
1.1705 +
1.1706 +
1.1707 +
1.1708 +
1.1709 +
1.1710 +
1.1711 +
1.1712 +
1.1713 +EXPORT_C RMMFVideoControllerCustomCommands::RMMFVideoControllerCustomCommands(RMMFController& aController) :
1.1714 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoController)
1.1715 + {
1.1716 + }
1.1717 +
1.1718 +EXPORT_C TInt RMMFVideoControllerCustomCommands::GetFrameRate(TReal32& aFramesPerSecond) const
1.1719 + {
1.1720 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1721 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1722 + EMMFVideoControllerGetFrameRate,
1.1723 + KNullDesC8,
1.1724 + KNullDesC8,
1.1725 + configPackage);
1.1726 + if (!error)
1.1727 + aFramesPerSecond = configPackage().iFramesPerSecond;
1.1728 + return error;
1.1729 + }
1.1730 +
1.1731 +EXPORT_C TInt RMMFVideoControllerCustomCommands::SetFrameRate(TReal32 aFramesPerSecond) const
1.1732 + {
1.1733 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1734 + configPackage().iFramesPerSecond = aFramesPerSecond;
1.1735 + return iController.CustomCommandSync(iDestinationPckg,
1.1736 + EMMFVideoControllerSetFrameRate,
1.1737 + configPackage,
1.1738 + KNullDesC8);
1.1739 + }
1.1740 +
1.1741 +
1.1742 +EXPORT_C void RMMFVideoPlayControllerCustomCommands::GetFrame(CFbsBitmap& aBitmap,TRequestStatus& aStatus)
1.1743 + {
1.1744 + TInt handle = aBitmap.Handle();
1.1745 +
1.1746 + iConfigPackage().iFrameBitmapServerHandle = handle;
1.1747 + iController.CustomCommandAsync(iDestinationPckg,
1.1748 + EMMFVideoPlayControllerGetFrame,
1.1749 + iConfigPackage,
1.1750 + KNullDesC8,
1.1751 + aStatus);
1.1752 + }
1.1753 +
1.1754 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::UpdateDisplayRegion(const TRegion& aRegion) const
1.1755 + {
1.1756 + TPckgBuf<TInt> numberOfRectsPckg;
1.1757 + numberOfRectsPckg() = aRegion.Count();
1.1758 + const TRect* rects = aRegion.RectangleList();
1.1759 + TPtrC8 rectMemory(REINTERPRET_CAST(TUint8*,(void*) rects), numberOfRectsPckg() * sizeof(TRect));
1.1760 +
1.1761 + return iController.CustomCommandSync(iDestinationPckg,
1.1762 + EMMFVideoPlayControllerUpdateDisplayRegion,
1.1763 + numberOfRectsPckg,
1.1764 + rectMemory);
1.1765 + }
1.1766 +
1.1767 +
1.1768 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::DirectScreenAccessEvent(const TMMFDSAEvent aDSAEvent) const
1.1769 + {
1.1770 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1771 + configPackage().iDSAEvent = (TInt)aDSAEvent;
1.1772 + return iController.CustomCommandSync(iDestinationPckg,
1.1773 + EMMFVideoPlayControllerDSAEvent,
1.1774 + configPackage,
1.1775 + KNullDesC8);
1.1776 + }
1.1777 +
1.1778 +
1.1779 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::Play(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd) const
1.1780 + {
1.1781 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1782 + configPackage().iStartPosition = aStart;
1.1783 + configPackage().iEndPosition = aEnd;
1.1784 + return iController.CustomCommandSync(iDestinationPckg,
1.1785 + EMMFVideoPlayControllerPlay,
1.1786 + configPackage,
1.1787 + KNullDesC8);
1.1788 + }
1.1789 +
1.1790 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::RefreshFrame() const
1.1791 + {
1.1792 + return iController.CustomCommandSync(iDestinationPckg,
1.1793 + EMMFVideoPlayControllerRefreshFrame,
1.1794 + KNullDesC8,
1.1795 + KNullDesC8);
1.1796 + }
1.1797 +
1.1798 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetLoadingProgress(TInt& aPercentageComplete) const
1.1799 + {
1.1800 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1801 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1802 + EMMFVideoPlayControllerGetLoadingProgress,
1.1803 + KNullDesC8,
1.1804 + KNullDesC8,
1.1805 + configPackage);
1.1806 + if (!error)
1.1807 + aPercentageComplete = configPackage().iLoadingCompletePercentage;
1.1808 + return error;
1.1809 + }
1.1810 +
1.1811 +
1.1812 +
1.1813 +
1.1814 +EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoFrameSize(TSize& aVideoFrameSize) const
1.1815 + {
1.1816 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1817 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1818 + EMMFVideoControllerGetVideoFrameSize,
1.1819 + KNullDesC8,
1.1820 + KNullDesC8,
1.1821 + configPackage);
1.1822 + if (!error)
1.1823 + aVideoFrameSize = configPackage().iVideoFrameSize;
1.1824 + return error;
1.1825 + }
1.1826 +
1.1827 +EXPORT_C TInt RMMFVideoControllerCustomCommands::GetAudioBitRate(TInt& aBitRate) const
1.1828 + {
1.1829 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1830 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1831 + EMMFVideoControllerGetAudioBitRate,
1.1832 + KNullDesC8,
1.1833 + KNullDesC8,
1.1834 + configPackage);
1.1835 + if (!error)
1.1836 + aBitRate = configPackage().iAudioBitRate;
1.1837 + return error;
1.1838 + }
1.1839 +
1.1840 +EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoBitRate(TInt& aBitRate) const
1.1841 + {
1.1842 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1843 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1844 + EMMFVideoControllerGetVideoBitRate,
1.1845 + KNullDesC8,
1.1846 + KNullDesC8,
1.1847 + configPackage);
1.1848 + if (!error)
1.1849 + aBitRate = configPackage().iVideoBitRate;
1.1850 + return error;
1.1851 + }
1.1852 +EXPORT_C TInt RMMFVideoControllerCustomCommands::GetAudioCodec(TFourCC& aCodec) const
1.1853 + {
1.1854 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1855 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.1856 + EMMFVideoControllerGetAudioCodec,
1.1857 + KNullDesC8,
1.1858 + KNullDesC8,
1.1859 + configPackage);
1.1860 + if (!error)
1.1861 + aCodec = configPackage().iAudioCodec;
1.1862 + return error;
1.1863 + }
1.1864 +
1.1865 +
1.1866 +EXPORT_C void Reserved1( void )
1.1867 + {
1.1868 + // dummy reserved function to replace GetVideoCodec() which was removed.
1.1869 + // this should never be called so generate a panic
1.1870 + Panic( ENoGetVideoCodec );
1.1871 + }
1.1872 +
1.1873 +EXPORT_C void Reserved2( void )
1.1874 + {
1.1875 + // dummy reserved function to replace GetSupportedSourceVideoTypes() which was removed.
1.1876 + // this should never be called so generate a panic
1.1877 + Panic( ENoGetSourceVideoTypes );
1.1878 + }
1.1879 +
1.1880 +EXPORT_C void Reserved3( void )
1.1881 + {
1.1882 + // dummy reserved function to replace GetSupportedSourceAudioTypes() which was removed.
1.1883 + // this should never be called so generate a panic
1.1884 + Panic( ENoGetSourceAudioTypes );
1.1885 + }
1.1886 +
1.1887 +
1.1888 +EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoMimeType(TDes8& aMimeType) const
1.1889 + {
1.1890 + TInt err = iController.CustomCommandSync(iDestinationPckg,
1.1891 + EMMFVideoControllerGetVideoMimeType,
1.1892 + KNullDesC8,
1.1893 + KNullDesC8,
1.1894 + aMimeType);
1.1895 + return err;
1.1896 + }
1.1897 +
1.1898 +
1.1899 +void RMMFVideoRecordControllerCustomCommands::DoGetFourCCArrayL(RArray<TFourCC>& aArray) const
1.1900 + {
1.1901 + aArray.Reset();
1.1902 +
1.1903 + TPckgBuf<TInt> numberOfElementsPckg;
1.1904 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.1905 + EMMFVideoRecordControllerGetSupportedSinkAudioTypes,
1.1906 + KNullDesC8,
1.1907 + KNullDesC8,
1.1908 + numberOfElementsPckg));
1.1909 +
1.1910 + HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
1.1911 + TPtr8 ptr = buf->Des();
1.1912 +
1.1913 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.1914 + EMMFVideoRecordControllerCopyFourCCArrayData,
1.1915 + KNullDesC8,
1.1916 + KNullDesC8,
1.1917 + ptr));
1.1918 + RDesReadStream stream(ptr);
1.1919 + CleanupClosePushL(stream);
1.1920 +
1.1921 + for (TInt i=0; i<numberOfElementsPckg(); i++)
1.1922 + {
1.1923 + User::LeaveIfError(aArray.Append(stream.ReadInt32L()));
1.1924 + }
1.1925 +
1.1926 + CleanupStack::PopAndDestroy(2);//stream, buf
1.1927 + }
1.1928 +
1.1929 +
1.1930 +void RMMFVideoRecordControllerCustomCommands::DoGetCDesC8ArrayL(CDesC8Array& aArray, TMMFVideoRecordControllerMessages aIpc) const
1.1931 + {
1.1932 + aArray.Reset();
1.1933 +
1.1934 + TPckgBuf<TMimeTypeBufferInfo> bufferInfoPckg;
1.1935 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.1936 + aIpc,
1.1937 + KNullDesC8,
1.1938 + KNullDesC8,
1.1939 + bufferInfoPckg));
1.1940 +
1.1941 + // allocate a buffer of size dictated by server side
1.1942 + HBufC8* buf = HBufC8::NewLC(bufferInfoPckg().bufferLen);
1.1943 + TPtr8 ptr = buf->Des();
1.1944 +
1.1945 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.1946 + EMMFVideoRecordControllerCopyDescriptorArrayData,
1.1947 + KNullDesC8,
1.1948 + KNullDesC8,
1.1949 + ptr));
1.1950 + RDesReadStream stream(ptr);
1.1951 + CleanupClosePushL(stream);
1.1952 +
1.1953 + TInt32 len;
1.1954 +
1.1955 + for (TInt i=0; i < bufferInfoPckg().count; i++)
1.1956 + {
1.1957 + User::LeaveIfError(len = stream.ReadInt32L());
1.1958 +
1.1959 + HBufC8* tempDesc = HBufC8::NewLC(len);
1.1960 + TPtr8 tempPtr = tempDesc->Des();
1.1961 +
1.1962 + stream.ReadL(tempPtr, len);
1.1963 + aArray.AppendL(tempPtr);
1.1964 +
1.1965 + CleanupStack::PopAndDestroy(tempDesc);
1.1966 + }
1.1967 +
1.1968 + CleanupStack::PopAndDestroy(2);//stream, buf
1.1969 +
1.1970 + }
1.1971 +
1.1972 +
1.1973 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetDisplayWindow(const TRect& aWindowRect,
1.1974 + const TRect& aClipRect) const
1.1975 + {
1.1976 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1977 + configPackage().iWindowRect = aWindowRect;
1.1978 + configPackage().iClipRect = aClipRect;
1.1979 +
1.1980 + return iController.CustomCommandSync(iDestinationPckg,
1.1981 + EMMFVideoPlayControllerSetDisplayWindow,
1.1982 + configPackage,
1.1983 + KNullDesC8);
1.1984 + }
1.1985 +
1.1986 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetAudioEnabled(TBool& aEnabled) const
1.1987 + {
1.1988 + TPckgBuf<TMMFVideoConfig> configPackage;
1.1989 +
1.1990 + TInt err = iController.CustomCommandSync(iDestinationPckg,
1.1991 + EMMFVideoPlayControllerGetAudioEnabled,
1.1992 + KNullDesC8,
1.1993 + KNullDesC8,
1.1994 + configPackage);
1.1995 +
1.1996 + if (!err)
1.1997 + aEnabled = configPackage().iAudioEnabled;
1.1998 + return err;
1.1999 + }
1.2000 +
1.2001 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::Prepare()
1.2002 + {
1.2003 + return iController.CustomCommandSync(iDestinationPckg,
1.2004 + EMMFVideoPlayControllerPrepare,
1.2005 + KNullDesC8,
1.2006 + KNullDesC8);
1.2007 + }
1.2008 +
1.2009 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetRotation(TVideoRotation aRotation) const
1.2010 + {
1.2011 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2012 + configPackage().iVideoRotation = aRotation;
1.2013 +
1.2014 + return iController.CustomCommandSync(iDestinationPckg,
1.2015 + EMMFVideoPlayControllerSetRotation,
1.2016 + configPackage,
1.2017 + KNullDesC8);
1.2018 + }
1.2019 +
1.2020 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetRotation(TVideoRotation& aRotation) const
1.2021 + {
1.2022 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2023 +
1.2024 + TInt err = iController.CustomCommandSync(iDestinationPckg,
1.2025 + EMMFVideoPlayControllerGetRotation,
1.2026 + KNullDesC8,
1.2027 + KNullDesC8,
1.2028 + configPackage);
1.2029 +
1.2030 + if (!err)
1.2031 + aRotation = configPackage().iVideoRotation;
1.2032 + return err;
1.2033 + }
1.2034 +
1.2035 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetScaleFactor(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering) const
1.2036 + {
1.2037 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2038 + configPackage().iWidthScalePercentage = aWidthPercentage;
1.2039 + configPackage().iHeightScalePercentage = aHeightPercentage;
1.2040 + configPackage().iAntiAliasFiltering = aAntiAliasFiltering;
1.2041 +
1.2042 + return iController.CustomCommandSync(iDestinationPckg,
1.2043 + EMMFVideoPlayControllerSetScaleFactor,
1.2044 + configPackage,
1.2045 + KNullDesC8);
1.2046 + }
1.2047 +
1.2048 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetScaleFactor(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const
1.2049 + {
1.2050 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2051 +
1.2052 + TInt err = iController.CustomCommandSync(iDestinationPckg,
1.2053 + EMMFVideoPlayControllerGetScaleFactor,
1.2054 + KNullDesC8,
1.2055 + KNullDesC8,
1.2056 + configPackage);
1.2057 +
1.2058 + if (!err)
1.2059 + {
1.2060 + aWidthPercentage = configPackage().iWidthScalePercentage;
1.2061 + aHeightPercentage = configPackage().iHeightScalePercentage;
1.2062 + aAntiAliasFiltering = configPackage().iAntiAliasFiltering;
1.2063 + }
1.2064 + return err;
1.2065 + }
1.2066 +
1.2067 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetCropRegion(const TRect& aCropRegion) const
1.2068 + {
1.2069 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2070 + configPackage().iCropRectangle = aCropRegion;
1.2071 +
1.2072 + return iController.CustomCommandSync(iDestinationPckg,
1.2073 + EMMFVideoPlayControllerSetCropRegion,
1.2074 + configPackage,
1.2075 + KNullDesC8);
1.2076 + }
1.2077 +
1.2078 +EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetCropRegion(TRect& aCropRegion) const
1.2079 + {
1.2080 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2081 +
1.2082 + TInt err = iController.CustomCommandSync(iDestinationPckg,
1.2083 + EMMFVideoPlayControllerGetCropRegion,
1.2084 + KNullDesC8,
1.2085 + KNullDesC8,
1.2086 + configPackage);
1.2087 +
1.2088 + if (!err)
1.2089 + {
1.2090 + aCropRegion = configPackage().iCropRectangle;
1.2091 + }
1.2092 + return err;
1.2093 + }
1.2094 +
1.2095 +EXPORT_C RMMFVideoRecordControllerCustomCommands::RMMFVideoRecordControllerCustomCommands(RMMFController& aController) :
1.2096 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoRecordController)
1.2097 + {
1.2098 + }
1.2099 +
1.2100 +
1.2101 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoFormat(TUid aFormatUid) const
1.2102 + {
1.2103 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2104 + configPackage().iFormatUid = aFormatUid;
1.2105 + return iController.CustomCommandSync(iDestinationPckg,
1.2106 + EMMFVideoRecordControllerSetVideoFormat,
1.2107 + configPackage,
1.2108 + KNullDesC8);
1.2109 + }
1.2110 +
1.2111 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoCodec(const TDesC8& aVideoCodec) const
1.2112 + {
1.2113 + return iController.CustomCommandSync(iDestinationPckg,
1.2114 + EMMFVideoRecordControllerSetVideoCodec,
1.2115 + aVideoCodec,
1.2116 + KNullDesC8);
1.2117 + }
1.2118 +
1.2119 +
1.2120 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioCodec(TFourCC aAudioCodec) const
1.2121 + {
1.2122 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2123 + configPackage().iAudioCodec = aAudioCodec;
1.2124 + return iController.CustomCommandSync(iDestinationPckg,
1.2125 + EMMFVideoRecordControllerSetAudioCodec,
1.2126 + configPackage,
1.2127 + KNullDesC8);
1.2128 + }
1.2129 +
1.2130 +
1.2131 +EXPORT_C void RMMFVideoRecordControllerCustomCommands::AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry) const
1.2132 + {
1.2133 + CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
1.2134 + CleanupStack::PushL(buf);
1.2135 + RBufWriteStream s;
1.2136 + s.Open(*buf);
1.2137 + CleanupClosePushL(s);
1.2138 + aNewEntry.ExternalizeL(s);
1.2139 + TPtr8 bufData = buf->Ptr(0);
1.2140 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.2141 + EMMFVideoRecordControllerAddMetaDataEntry,
1.2142 + bufData,
1.2143 + KNullDesC8));
1.2144 + CleanupStack::PopAndDestroy(2);//s, buf
1.2145 + }
1.2146 +
1.2147 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::RemoveMetaDataEntry(TInt aIndex) const
1.2148 + {
1.2149 + TPckgBuf<TInt> pckg(aIndex);
1.2150 + return iController.CustomCommandSync(iDestinationPckg,
1.2151 + EMMFVideoRecordControllerRemoveMetaDataEntry,
1.2152 + pckg,
1.2153 + KNullDesC8);
1.2154 + }
1.2155 +
1.2156 +EXPORT_C void RMMFVideoRecordControllerCustomCommands::ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry) const
1.2157 + {
1.2158 + TPckgBuf<TInt> indexPckg(aIndex);
1.2159 + CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
1.2160 + CleanupStack::PushL(buf);
1.2161 + RBufWriteStream s;
1.2162 + s.Open(*buf);
1.2163 + CleanupClosePushL(s);
1.2164 + aNewEntry.ExternalizeL(s);
1.2165 + TPtr8 bufData = buf->Ptr(0);
1.2166 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.2167 + EMMFVideoRecordControllerReplaceMetaDataEntry,
1.2168 + bufData,
1.2169 + indexPckg));
1.2170 + CleanupStack::PopAndDestroy(2);//s, buf
1.2171 + }
1.2172 +
1.2173 +
1.2174 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetMaxFileSize(TInt aMaxSize) const
1.2175 + {
1.2176 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2177 + configPackage().iMaxFileSize = aMaxSize;
1.2178 + return iController.CustomCommandSync(iDestinationPckg,
1.2179 + EMMFVideoRecordControllerSetMaxFileSize,
1.2180 + configPackage,
1.2181 + KNullDesC8);
1.2182 + }
1.2183 +
1.2184 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoBitRate(TInt aRate) const
1.2185 + {
1.2186 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2187 + configPackage().iVideoBitRate = aRate;
1.2188 +
1.2189 + return iController.CustomCommandSync(iDestinationPckg,
1.2190 + EMMFVideoRecordControllerSetVideoBitRate,
1.2191 + configPackage,
1.2192 + KNullDesC8);
1.2193 +
1.2194 + }
1.2195 +
1.2196 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioBitRate(TInt aRate) const
1.2197 + {
1.2198 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2199 + configPackage().iAudioBitRate = aRate;
1.2200 +
1.2201 + return iController.CustomCommandSync(iDestinationPckg,
1.2202 + EMMFVideoRecordControllerSetAudioBitRate,
1.2203 + configPackage,
1.2204 + KNullDesC8);
1.2205 + }
1.2206 +
1.2207 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoFrameSize(TSize aSize) const
1.2208 + {
1.2209 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2210 + configPackage().iVideoFrameSize = aSize;
1.2211 +
1.2212 + return iController.CustomCommandSync(iDestinationPckg,
1.2213 + EMMFVideoRecordControllerSetVideoFrameSize,
1.2214 + configPackage,
1.2215 + KNullDesC8);
1.2216 + }
1.2217 +
1.2218 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioEnabled(TBool aEnabled) const
1.2219 + {
1.2220 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2221 + configPackage().iAudioEnabled = aEnabled;
1.2222 +
1.2223 + return iController.CustomCommandSync(iDestinationPckg,
1.2224 + EMMFVideoRecordControllerSetAudioEnabled,
1.2225 + configPackage,
1.2226 + KNullDesC8);
1.2227 + }
1.2228 +
1.2229 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::Prepare() const
1.2230 + {
1.2231 +
1.2232 + return iController.CustomCommandSync(iDestinationPckg,
1.2233 + EMMFVideoRecordControllerPrepare,
1.2234 + KNullDesC8,
1.2235 + KNullDesC8);
1.2236 + }
1.2237 +
1.2238 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetCameraHandle(TInt aCameraHandle) const
1.2239 + {
1.2240 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2241 + configPackage().iCameraHandle = aCameraHandle;
1.2242 +
1.2243 + return iController.CustomCommandSync(iDestinationPckg,
1.2244 + EMMFVideoRecordControllerSetCameraHandle,
1.2245 + configPackage,
1.2246 + KNullDesC8);
1.2247 + }
1.2248 +
1.2249 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetRecordTimeAvailable(TTimeIntervalMicroSeconds& aTime) const
1.2250 + {
1.2251 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2252 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.2253 + EMMFVideoRecordControllerGetRecordTimeAvailable,
1.2254 + KNullDesC8,
1.2255 + KNullDesC8,
1.2256 + configPackage);
1.2257 + if (!error)
1.2258 + aTime = configPackage().iRecordTimeAvailable;
1.2259 + return error;
1.2260 + }
1.2261 +
1.2262 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetSupportedSinkVideoTypes(CDesC8Array& aSupportedDataTypes) const
1.2263 + {
1.2264 + TInt err;
1.2265 + TRAP(err, DoGetCDesC8ArrayL(aSupportedDataTypes, EMMFVideoRecordControllerGetSupportedSinkVideoTypes));
1.2266 + return err;
1.2267 + }
1.2268 +
1.2269 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetSupportedSinkAudioTypes(RArray<TFourCC>& aSupportedDataTypes) const
1.2270 + {
1.2271 + TInt err;
1.2272 + TRAP(err, DoGetFourCCArrayL(aSupportedDataTypes));
1.2273 + return err;
1.2274 + }
1.2275 +
1.2276 +
1.2277 +// New method as part of INC23777.
1.2278 +EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetAudioEnabled(TBool& aEnabled) const
1.2279 + {
1.2280 + TPckgBuf<TMMFVideoConfig> configPackage;
1.2281 +
1.2282 + TInt err = iController.CustomCommandSync(iDestinationPckg,
1.2283 + EMMFVideoRecordControllerGetAudioEnabled,
1.2284 + KNullDesC8,
1.2285 + KNullDesC8,
1.2286 + configPackage);
1.2287 +
1.2288 + if (!err)
1.2289 + aEnabled = configPackage().iAudioEnabled;
1.2290 + return err;
1.2291 + }
1.2292 +
1.2293 +EXPORT_C CMMFVideoControllerCustomCommandParser* CMMFVideoControllerCustomCommandParser::NewL(MMMFVideoControllerCustomCommandImplementor& aImplementor)
1.2294 + {
1.2295 + return new(ELeave) CMMFVideoControllerCustomCommandParser(aImplementor);
1.2296 + }
1.2297 +
1.2298 +EXPORT_C CMMFVideoControllerCustomCommandParser::~CMMFVideoControllerCustomCommandParser()
1.2299 + {
1.2300 + }
1.2301 +
1.2302 +CMMFVideoControllerCustomCommandParser::CMMFVideoControllerCustomCommandParser(MMMFVideoControllerCustomCommandImplementor& aImplementor) :
1.2303 + CMMFCustomCommandParserBase(KUidInterfaceMMFVideoController),
1.2304 + iImplementor(aImplementor)
1.2305 + {
1.2306 + }
1.2307 +
1.2308 +void CMMFVideoControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.2309 + {
1.2310 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoController)
1.2311 + {
1.2312 + TRAPD(error, DoHandleRequestL(aMessage));
1.2313 + if (error)
1.2314 + aMessage.Complete(error);
1.2315 + }
1.2316 + else
1.2317 + {
1.2318 + aMessage.Complete(KErrNotSupported);
1.2319 + }
1.2320 + }
1.2321 +
1.2322 +void CMMFVideoControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.2323 + {
1.2324 + TBool complete = ETrue;
1.2325 + switch (aMessage.Function())
1.2326 + {
1.2327 + case EMMFVideoControllerGetAudioBitRate:
1.2328 + complete = DoGetAudioBitRateL(aMessage);
1.2329 + break;
1.2330 + case EMMFVideoControllerGetVideoBitRate:
1.2331 + complete = DoGetVideoBitRateL(aMessage);
1.2332 + break;
1.2333 + case EMMFVideoControllerGetAudioCodec:
1.2334 + complete = DoGetAudioCodecL(aMessage);
1.2335 + break;
1.2336 + case EMMFVideoControllerGetVideoFrameSize:
1.2337 + complete = DoGetVideoFrameSizeL(aMessage);
1.2338 + break;
1.2339 + case EMMFVideoControllerSetFrameRate:
1.2340 + complete = DoSetFrameRateL(aMessage);
1.2341 + break;
1.2342 + case EMMFVideoControllerGetFrameRate:
1.2343 + complete = DoGetFrameRateL(aMessage);
1.2344 + break;
1.2345 + case EMMFVideoControllerGetVideoMimeType:
1.2346 + complete = DoGetVideoMimeTypeL(aMessage);
1.2347 + break;
1.2348 + default:
1.2349 + User::Leave(KErrNotSupported);
1.2350 + break;
1.2351 + }
1.2352 + if (complete)
1.2353 + aMessage.Complete(KErrNone);
1.2354 + }
1.2355 +
1.2356 +TBool CMMFVideoControllerCustomCommandParser::DoGetVideoFrameSizeL(TMMFMessage& aMessage)
1.2357 + {
1.2358 + TSize size;
1.2359 + iImplementor.MvcGetVideoFrameSizeL(size);
1.2360 + TPckgBuf<TMMFVideoConfig> pckg;
1.2361 + pckg().iVideoFrameSize = size;
1.2362 + aMessage.WriteDataToClientL(pckg);
1.2363 + return ETrue;
1.2364 + }
1.2365 +
1.2366 +TBool CMMFVideoControllerCustomCommandParser::DoGetAudioCodecL(TMMFMessage& aMessage)
1.2367 + {
1.2368 + TFourCC audioCodec;
1.2369 + iImplementor.MvcGetAudioCodecL(audioCodec);
1.2370 + TPckgBuf<TMMFVideoConfig> pckg;
1.2371 + pckg().iAudioCodec = audioCodec;
1.2372 + aMessage.WriteDataToClientL(pckg);
1.2373 + return ETrue;
1.2374 + }
1.2375 +
1.2376 +TBool CMMFVideoControllerCustomCommandParser::DoGetVideoBitRateL(TMMFMessage& aMessage)
1.2377 + {
1.2378 + TInt videoBitRate;
1.2379 + iImplementor.MvcGetVideoBitRateL(videoBitRate);
1.2380 + TPckgBuf<TMMFVideoConfig> pckg;
1.2381 + pckg().iVideoBitRate = videoBitRate;
1.2382 + aMessage.WriteDataToClientL(pckg);
1.2383 + return ETrue;
1.2384 + }
1.2385 +
1.2386 +TBool CMMFVideoControllerCustomCommandParser::DoGetAudioBitRateL(TMMFMessage& aMessage)
1.2387 + {
1.2388 + TInt audioBitRate;
1.2389 + iImplementor.MvcGetAudioBitRateL(audioBitRate);
1.2390 + TPckgBuf<TMMFVideoConfig> pckg;
1.2391 + pckg().iAudioBitRate = audioBitRate;
1.2392 + aMessage.WriteDataToClientL(pckg);
1.2393 + return ETrue;
1.2394 + }
1.2395 +
1.2396 +TBool CMMFVideoControllerCustomCommandParser::DoSetFrameRateL(TMMFMessage& aMessage)
1.2397 + {
1.2398 + TPckgBuf<TMMFVideoConfig> pckg;
1.2399 + aMessage.ReadData1FromClientL(pckg);
1.2400 + iImplementor.MvcSetFrameRateL(pckg().iFramesPerSecond);
1.2401 + return ETrue;
1.2402 + }
1.2403 +
1.2404 +TBool CMMFVideoControllerCustomCommandParser::DoGetFrameRateL(TMMFMessage& aMessage)
1.2405 + {
1.2406 + TReal32 frameRate = 0;
1.2407 + iImplementor.MvcGetFrameRateL(frameRate);
1.2408 + TPckgBuf<TMMFVideoConfig> pckg;
1.2409 + pckg().iFramesPerSecond = frameRate;
1.2410 + aMessage.WriteDataToClientL(pckg);
1.2411 + return ETrue;
1.2412 + }
1.2413 +
1.2414 +TBool CMMFVideoControllerCustomCommandParser::DoGetVideoMimeTypeL(TMMFMessage& aMessage)
1.2415 + {
1.2416 + TBuf8<KMaxMimeTypeLength> mimeType;
1.2417 + iImplementor.MvcGetVideoMimeTypeL(mimeType);
1.2418 +
1.2419 + aMessage.WriteDataToClientL(mimeType);
1.2420 + return ETrue;
1.2421 + }
1.2422 +
1.2423 +
1.2424 +TBool CMMFVideoRecordControllerCustomCommandParser::DoGetSupportedSinkAudioTypesL(TMMFMessage& aMessage)
1.2425 + {
1.2426 + RArray<TFourCC> array;
1.2427 + CleanupClosePushL(array);
1.2428 + iImplementor.MvrcGetSupportedSinkAudioTypesL(array);
1.2429 +
1.2430 + DoCreateBufFromFourCCArrayL(array);
1.2431 +
1.2432 + TPckgBuf<TInt> pckg;
1.2433 + pckg() = array.Count();
1.2434 + aMessage.WriteDataToClientL(pckg);
1.2435 +
1.2436 + CleanupStack::PopAndDestroy();//array
1.2437 + return ETrue;
1.2438 + }
1.2439 +
1.2440 +
1.2441 +TBool CMMFVideoRecordControllerCustomCommandParser::DoGetSupportedSinkVideoTypesL(TMMFMessage& aMessage)
1.2442 + {
1.2443 + CDesC8ArrayFlat* array = new (ELeave) CDesC8ArrayFlat(KBufMimeTypeGranularity);
1.2444 + CleanupStack::PushL(array);
1.2445 +
1.2446 + iImplementor.MvrcGetSupportedSinkVideoTypesL(*array);
1.2447 +
1.2448 + TInt32 len = DoCreateBufFromCDesC8ArrayL(*array);
1.2449 +
1.2450 + TPckgBuf<TMimeTypeBufferInfo> pckg;
1.2451 + pckg().count = array->Count();
1.2452 + pckg().bufferLen = len;
1.2453 +
1.2454 + aMessage.WriteDataToClientL(pckg);
1.2455 +
1.2456 + CleanupStack::PopAndDestroy();//array
1.2457 + return ETrue;
1.2458 + }
1.2459 +
1.2460 +void CMMFVideoRecordControllerCustomCommandParser::DoCreateBufFromFourCCArrayL(RArray<TFourCC>& aArray)
1.2461 + {
1.2462 + delete iDataCopyBuffer;
1.2463 + iDataCopyBuffer = NULL;
1.2464 +
1.2465 + iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
1.2466 + RBufWriteStream stream;
1.2467 + stream.Open(*iDataCopyBuffer);
1.2468 + CleanupClosePushL(stream);
1.2469 + for (TInt i=0;i<aArray.Count();i++)
1.2470 + {
1.2471 + stream.WriteInt32L(aArray[i].FourCC());
1.2472 + }
1.2473 + CleanupStack::PopAndDestroy();//stream
1.2474 + }
1.2475 +
1.2476 +TInt32 CMMFVideoRecordControllerCustomCommandParser::DoCreateBufFromCDesC8ArrayL(CDesC8Array& aArray)
1.2477 + {
1.2478 + TInt32 bufferLen = 0;
1.2479 + TInt32 len = 0;
1.2480 +
1.2481 + delete iDataCopyBuffer;
1.2482 + iDataCopyBuffer = NULL;
1.2483 +
1.2484 + iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
1.2485 + RBufWriteStream stream;
1.2486 + stream.Open(*iDataCopyBuffer);
1.2487 + CleanupClosePushL(stream);
1.2488 + for (TInt i = 0; i < aArray.Count(); i++)
1.2489 + {
1.2490 + len = aArray[i].Length();
1.2491 + stream.WriteInt32L(len);
1.2492 + stream.WriteL(aArray[i]);
1.2493 +
1.2494 + bufferLen += (len + sizeof(TInt32));; // get a cumulative total buffer size
1.2495 + }
1.2496 + CleanupStack::PopAndDestroy();//stream
1.2497 +
1.2498 + return bufferLen;
1.2499 + }
1.2500 +
1.2501 +
1.2502 +// --------------------------------------------------------------------------------
1.2503 +EXPORT_C RMMFVideoPlayControllerCustomCommands::RMMFVideoPlayControllerCustomCommands(RMMFController& aController) :
1.2504 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPlayController)
1.2505 + {
1.2506 + }
1.2507 +
1.2508 +EXPORT_C CMMFVideoPlayControllerCustomCommandParser* CMMFVideoPlayControllerCustomCommandParser::NewL(MMMFVideoPlayControllerCustomCommandImplementor& aImplementor)
1.2509 + {
1.2510 + return new(ELeave) CMMFVideoPlayControllerCustomCommandParser(aImplementor);
1.2511 + }
1.2512 +
1.2513 +EXPORT_C CMMFVideoPlayControllerCustomCommandParser::~CMMFVideoPlayControllerCustomCommandParser()
1.2514 + {
1.2515 + delete iVideoFrameMessage;
1.2516 + }
1.2517 +
1.2518 +CMMFVideoPlayControllerCustomCommandParser::CMMFVideoPlayControllerCustomCommandParser(MMMFVideoPlayControllerCustomCommandImplementor& aImplementor) :
1.2519 + CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPlayController),
1.2520 + iImplementor(aImplementor)
1.2521 + {
1.2522 + }
1.2523 +
1.2524 +void CMMFVideoPlayControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.2525 + {
1.2526 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPlayController)
1.2527 + {
1.2528 + TRAPD(error, DoHandleRequestL(aMessage));
1.2529 + if (error)
1.2530 + aMessage.Complete(error);
1.2531 + }
1.2532 + else
1.2533 + {
1.2534 + aMessage.Complete(KErrNotSupported);
1.2535 + }
1.2536 + }
1.2537 +
1.2538 +void CMMFVideoPlayControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.2539 + {
1.2540 + TBool complete = ETrue;
1.2541 + switch (aMessage.Function())
1.2542 + {
1.2543 + case EMMFVideoPlayControllerGetFrame:
1.2544 + complete = DoGetFrameL(aMessage);
1.2545 + break;
1.2546 + case EMMFVideoPlayControllerSetDisplayWindow:
1.2547 + complete = DoSetDisplayWindowL(aMessage);
1.2548 + break;
1.2549 + case EMMFVideoPlayControllerGetAudioEnabled:
1.2550 + complete = DoGetAudioEnabledL(aMessage);
1.2551 + break;
1.2552 + case EMMFVideoPlayControllerUpdateDisplayRegion:
1.2553 + complete = DoUpdateDisplayRegionL(aMessage);
1.2554 + break;
1.2555 + case EMMFVideoPlayControllerDSAEvent:
1.2556 + complete = DoDirectScreenAccessEventL(aMessage);
1.2557 + break;
1.2558 + case EMMFVideoPlayControllerPlay:
1.2559 + complete = DoPlayL(aMessage);
1.2560 + break;
1.2561 + case EMMFVideoPlayControllerRefreshFrame:
1.2562 + complete = DoRefreshFrameL(aMessage);
1.2563 + break;
1.2564 + case EMMFVideoPlayControllerGetLoadingProgress:
1.2565 + complete = DoGetLoadingProgressL(aMessage);
1.2566 + break;
1.2567 + case EMMFVideoPlayControllerPrepare:
1.2568 + complete = DoPrepareL(aMessage);
1.2569 + break;
1.2570 + case EMMFVideoPlayControllerSetRotation:
1.2571 + complete = DoSetRotationL(aMessage);
1.2572 + break;
1.2573 + case EMMFVideoPlayControllerGetRotation:
1.2574 + complete = DoGetRotationL(aMessage);
1.2575 + break;
1.2576 + case EMMFVideoPlayControllerSetScaleFactor:
1.2577 + complete = DoSetScaleFactorL(aMessage);
1.2578 + break;
1.2579 + case EMMFVideoPlayControllerGetScaleFactor:
1.2580 + complete = DoGetScaleFactorL(aMessage);
1.2581 + break;
1.2582 + case EMMFVideoPlayControllerSetCropRegion:
1.2583 + complete = DoSetCropRegionL(aMessage);
1.2584 + break;
1.2585 + case EMMFVideoPlayControllerGetCropRegion:
1.2586 + complete = DoGetCropRegionL(aMessage);
1.2587 + break;
1.2588 +
1.2589 + default:
1.2590 + User::Leave(KErrNotSupported);
1.2591 + break;
1.2592 + }
1.2593 + if (complete)
1.2594 + aMessage.Complete(KErrNone);
1.2595 + }
1.2596 +
1.2597 +TBool CMMFVideoPlayControllerCustomCommandParser::DoUpdateDisplayRegionL(TMMFMessage& aMessage)
1.2598 + {
1.2599 + TPckgBuf<TInt> numberOfRectsPckg;
1.2600 + aMessage.ReadData1FromClientL(numberOfRectsPckg);
1.2601 + TUint rectSize = numberOfRectsPckg() * sizeof(TRect);
1.2602 + TUint8* rectMemory = STATIC_CAST(TUint8*, User::AllocLC(rectSize));
1.2603 + TPtr8 rectMemoryPtr(rectMemory,rectSize);
1.2604 + aMessage.ReadData2FromClientL(rectMemoryPtr);
1.2605 + TRect* rects = REINTERPRET_CAST(TRect*, rectMemory);
1.2606 + RRegion region(numberOfRectsPckg(), rects);
1.2607 + CleanupStack::Pop(rectMemory); // rectMemory now owned by region
1.2608 + CleanupClosePushL(region);
1.2609 + iImplementor.MvpcUpdateDisplayRegionL(region);
1.2610 + CleanupStack::PopAndDestroy();//region
1.2611 +
1.2612 + return ETrue;
1.2613 + }
1.2614 +
1.2615 +TBool CMMFVideoPlayControllerCustomCommandParser::DoGetFrameL(TMMFMessage& aMessage)
1.2616 + {
1.2617 + delete iVideoFrameMessage;
1.2618 + iVideoFrameMessage = NULL;
1.2619 +
1.2620 + iVideoFrameMessage = CMMFVideoFrameMessage::NewL(aMessage);
1.2621 + iImplementor.MvpcGetFrameL(*iVideoFrameMessage);
1.2622 + return EFalse;
1.2623 + }
1.2624 +
1.2625 +TBool CMMFVideoPlayControllerCustomCommandParser::DoSetDisplayWindowL(TMMFMessage& aMessage)
1.2626 + {
1.2627 + TPckgBuf<TMMFVideoConfig> pckg;
1.2628 + aMessage.ReadData1FromClientL(pckg);
1.2629 + iImplementor.MvpcSetDisplayWindowL(pckg().iWindowRect, pckg().iClipRect);
1.2630 + return ETrue;
1.2631 + }
1.2632 +
1.2633 +TBool CMMFVideoPlayControllerCustomCommandParser::DoGetAudioEnabledL(TMMFMessage& aMessage)
1.2634 + {
1.2635 + TBool enabled;
1.2636 + iImplementor.MvpcGetAudioEnabledL(enabled);
1.2637 + TPckgBuf<TMMFVideoConfig> pckg;
1.2638 + pckg().iAudioEnabled = enabled;
1.2639 + aMessage.WriteDataToClientL(pckg);
1.2640 + return ETrue;
1.2641 + }
1.2642 +
1.2643 +TBool CMMFVideoPlayControllerCustomCommandParser::DoDirectScreenAccessEventL(TMMFMessage& aMessage)
1.2644 + {
1.2645 + TPckgBuf<TMMFVideoConfig> pckg;
1.2646 + aMessage.ReadData1FromClientL(pckg);
1.2647 + iImplementor.MvpcDirectScreenAccessEventL((TMMFDSAEvent)pckg().iDSAEvent);
1.2648 + return ETrue;
1.2649 + }
1.2650 +
1.2651 +TBool CMMFVideoPlayControllerCustomCommandParser::DoPlayL(TMMFMessage& aMessage)
1.2652 + {
1.2653 + TPckgBuf<TMMFVideoConfig> pckg;
1.2654 + aMessage.ReadData1FromClientL(pckg);
1.2655 + iImplementor.MvpcPlayL(pckg().iStartPosition, pckg().iEndPosition);
1.2656 + return ETrue;
1.2657 + }
1.2658 +
1.2659 +TBool CMMFVideoPlayControllerCustomCommandParser::DoRefreshFrameL(TMMFMessage& /*aMessage*/)
1.2660 + {
1.2661 + iImplementor.MvpcRefreshFrameL();
1.2662 + return ETrue;
1.2663 + }
1.2664 +
1.2665 +TBool CMMFVideoPlayControllerCustomCommandParser::DoGetLoadingProgressL(TMMFMessage& aMessage)
1.2666 + {
1.2667 + TInt progress;
1.2668 + iImplementor.MvpcGetLoadingProgressL(progress);
1.2669 + TPckgBuf<TMMFVideoConfig> pckg;
1.2670 + pckg().iLoadingCompletePercentage = progress;
1.2671 + aMessage.WriteDataToClientL(pckg);
1.2672 + return ETrue;
1.2673 + }
1.2674 +
1.2675 +TBool CMMFVideoPlayControllerCustomCommandParser::DoPrepareL(TMMFMessage& /*aMessage*/)
1.2676 + {
1.2677 + iImplementor.MvpcPrepare();
1.2678 + return ETrue;
1.2679 + }
1.2680 +
1.2681 +TBool CMMFVideoPlayControllerCustomCommandParser::DoSetRotationL(TMMFMessage& aMessage)
1.2682 + {
1.2683 + TPckgBuf<TMMFVideoConfig> pckg;
1.2684 + aMessage.ReadData1FromClientL(pckg);
1.2685 + iImplementor.MvpcSetRotationL(pckg().iVideoRotation);
1.2686 + return ETrue;
1.2687 + }
1.2688 +
1.2689 +TBool CMMFVideoPlayControllerCustomCommandParser::DoGetRotationL(TMMFMessage& aMessage)
1.2690 + {
1.2691 + TPckgBuf<TMMFVideoConfig> pckg;
1.2692 + iImplementor.MvpcGetRotationL(pckg().iVideoRotation);
1.2693 + aMessage.WriteDataToClientL(pckg);
1.2694 + return ETrue;
1.2695 + }
1.2696 +
1.2697 +TBool CMMFVideoPlayControllerCustomCommandParser::DoSetScaleFactorL(TMMFMessage& aMessage)
1.2698 + {
1.2699 + TPckgBuf<TMMFVideoConfig> pckg;
1.2700 + aMessage.ReadData1FromClientL(pckg);
1.2701 + iImplementor.MvpcSetScaleFactorL(pckg().iWidthScalePercentage, pckg().iHeightScalePercentage, pckg().iAntiAliasFiltering);
1.2702 + return ETrue;
1.2703 + }
1.2704 +
1.2705 +TBool CMMFVideoPlayControllerCustomCommandParser::DoGetScaleFactorL(TMMFMessage& aMessage)
1.2706 + {
1.2707 + TPckgBuf<TMMFVideoConfig> pckg;
1.2708 + iImplementor.MvpcGetScaleFactorL(pckg().iWidthScalePercentage, pckg().iHeightScalePercentage, pckg().iAntiAliasFiltering);
1.2709 + aMessage.WriteDataToClientL(pckg);
1.2710 + return ETrue;
1.2711 + }
1.2712 +
1.2713 +TBool CMMFVideoPlayControllerCustomCommandParser::DoSetCropRegionL(TMMFMessage& aMessage)
1.2714 + {
1.2715 + TPckgBuf<TMMFVideoConfig> pckg;
1.2716 + aMessage.ReadData1FromClientL(pckg);
1.2717 + iImplementor.MvpcSetCropRegionL(pckg().iCropRectangle);
1.2718 + return ETrue;
1.2719 + }
1.2720 +
1.2721 +TBool CMMFVideoPlayControllerCustomCommandParser::DoGetCropRegionL(TMMFMessage& aMessage)
1.2722 + {
1.2723 + TPckgBuf<TMMFVideoConfig> pckg;
1.2724 + iImplementor.MvpcGetCropRegionL(pckg().iCropRectangle);
1.2725 + aMessage.WriteDataToClientL(pckg);
1.2726 + return ETrue;
1.2727 + }
1.2728 +
1.2729 +// --------------------------------------------------------------------------------
1.2730 +EXPORT_C CMMFVideoRecordControllerCustomCommandParser* CMMFVideoRecordControllerCustomCommandParser::NewL(MMMFVideoRecordControllerCustomCommandImplementor& aImplementor)
1.2731 + {
1.2732 + return new(ELeave) CMMFVideoRecordControllerCustomCommandParser(aImplementor);
1.2733 + }
1.2734 +
1.2735 +EXPORT_C CMMFVideoRecordControllerCustomCommandParser::~CMMFVideoRecordControllerCustomCommandParser()
1.2736 + {
1.2737 + delete iDataCopyBuffer;
1.2738 + }
1.2739 +
1.2740 +CMMFVideoRecordControllerCustomCommandParser::CMMFVideoRecordControllerCustomCommandParser(MMMFVideoRecordControllerCustomCommandImplementor& aImplementor) :
1.2741 + CMMFCustomCommandParserBase(KUidInterfaceMMFVideoRecordController),
1.2742 + iImplementor(aImplementor)
1.2743 + {
1.2744 + }
1.2745 +
1.2746 +void CMMFVideoRecordControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.2747 + {
1.2748 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoRecordController)
1.2749 + {
1.2750 + TRAPD(error, DoHandleRequestL(aMessage));
1.2751 + if (error)
1.2752 + aMessage.Complete(error);
1.2753 + }
1.2754 + else
1.2755 + {
1.2756 + aMessage.Complete(KErrNotSupported);
1.2757 + }
1.2758 + }
1.2759 +
1.2760 +void CMMFVideoRecordControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.2761 + {
1.2762 + TBool complete = ETrue;
1.2763 + switch (aMessage.Function())
1.2764 + {
1.2765 + case EMMFVideoRecordControllerSetVideoFormat:
1.2766 + complete = DoSetVideoFormatL(aMessage);
1.2767 + break;
1.2768 + case EMMFVideoRecordControllerSetAudioBitRate:
1.2769 + complete = DoSetAudioBitRateL(aMessage);
1.2770 + break;
1.2771 + case EMMFVideoRecordControllerSetVideoBitRate:
1.2772 + complete = DoSetVideoBitRateL(aMessage);
1.2773 + break;
1.2774 + case EMMFVideoRecordControllerSetAudioCodec:
1.2775 + complete = DoSetAudioCodecL(aMessage);
1.2776 + break;
1.2777 + case EMMFVideoRecordControllerSetVideoCodec:
1.2778 + complete = DoSetVideoCodecL(aMessage);
1.2779 + break;
1.2780 + case EMMFVideoRecordControllerAddMetaDataEntry:
1.2781 + complete = DoAddMetaDataEntryL(aMessage);
1.2782 + break;
1.2783 + case EMMFVideoRecordControllerRemoveMetaDataEntry:
1.2784 + complete = DoRemoveMetaDataEntryL(aMessage);
1.2785 + break;
1.2786 + case EMMFVideoRecordControllerReplaceMetaDataEntry:
1.2787 + complete = DoReplaceMetaDataEntryL(aMessage);
1.2788 + break;
1.2789 + case EMMFVideoRecordControllerSetMaxFileSize:
1.2790 + complete = DoSetMaxFileSizeL(aMessage);
1.2791 + break;
1.2792 + case EMMFVideoRecordControllerSetVideoFrameSize:
1.2793 + complete = DoSetVideoFrameSizeL(aMessage);
1.2794 + break;
1.2795 + case EMMFVideoRecordControllerSetAudioEnabled:
1.2796 + complete = DoSetAudioEnabledL(aMessage);
1.2797 + break;
1.2798 + case EMMFVideoRecordControllerPrepare:
1.2799 + complete = DoPrepareL(aMessage);
1.2800 + break;
1.2801 + case EMMFVideoRecordControllerSetCameraHandle:
1.2802 + complete = DoSetCameraHandleL(aMessage);
1.2803 + break;
1.2804 + case EMMFVideoRecordControllerGetRecordTimeAvailable:
1.2805 + complete = DoGetRecordTimeAvailableL(aMessage);
1.2806 + break;
1.2807 + case EMMFVideoRecordControllerGetSupportedSinkAudioTypes:
1.2808 + complete = DoGetSupportedSinkAudioTypesL(aMessage);
1.2809 + break;
1.2810 + case EMMFVideoRecordControllerGetSupportedSinkVideoTypes:
1.2811 + complete = DoGetSupportedSinkVideoTypesL(aMessage);
1.2812 + break;
1.2813 + case EMMFVideoRecordControllerCopyDescriptorArrayData:
1.2814 + complete = DoCopyCDesC8ArrayDataL(aMessage);
1.2815 + break;
1.2816 + case EMMFVideoRecordControllerCopyFourCCArrayData:
1.2817 + complete = DoCopyFourCCArrayDataL(aMessage);
1.2818 + break;
1.2819 + case EMMFVideoRecordControllerGetAudioEnabled: //INC23777
1.2820 + complete = DoGetAudioEnabledL(aMessage);
1.2821 + break;
1.2822 + default:
1.2823 + User::Leave(KErrNotSupported);
1.2824 + break;
1.2825 + }
1.2826 + if (complete)
1.2827 + aMessage.Complete(KErrNone);
1.2828 + }
1.2829 +
1.2830 +
1.2831 +
1.2832 +
1.2833 +
1.2834 +TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoBitRateL(TMMFMessage& aMessage)
1.2835 + {
1.2836 + TPckgBuf<TMMFVideoConfig> pckg;
1.2837 + aMessage.ReadData1FromClientL(pckg);
1.2838 + iImplementor.MvrcSetVideoBitRateL(pckg().iVideoBitRate);
1.2839 + return ETrue;
1.2840 + }
1.2841 +
1.2842 +TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioBitRateL(TMMFMessage& aMessage)
1.2843 + {
1.2844 + TPckgBuf<TMMFVideoConfig> pckg;
1.2845 + aMessage.ReadData1FromClientL(pckg);
1.2846 + iImplementor.MvrcSetAudioBitRateL(pckg().iAudioBitRate);
1.2847 + return ETrue;
1.2848 + }
1.2849 +
1.2850 +
1.2851 +TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoCodecL(TMMFMessage& aMessage)
1.2852 + {
1.2853 + TBuf8<KMaxMimeTypeLength> buf;
1.2854 + aMessage.ReadData1FromClientL(buf);
1.2855 + iImplementor.MvrcSetVideoCodecL(buf);
1.2856 + return ETrue;
1.2857 + }
1.2858 +
1.2859 +TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioCodecL(TMMFMessage& aMessage)
1.2860 + {
1.2861 + TPckgBuf<TMMFVideoConfig> pckg;
1.2862 + aMessage.ReadData1FromClientL(pckg);
1.2863 + iImplementor.MvrcSetAudioCodecL(pckg().iAudioCodec);
1.2864 + return ETrue;
1.2865 + }
1.2866 +
1.2867 +
1.2868 +TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoFormatL(TMMFMessage& aMessage)
1.2869 + {
1.2870 + TPckgBuf<TMMFVideoConfig> pckg;
1.2871 + aMessage.ReadData1FromClientL(pckg);
1.2872 + iImplementor.MvrcSetVideoFormatL(pckg().iFormatUid);
1.2873 + return ETrue;
1.2874 + }
1.2875 +
1.2876 +
1.2877 +
1.2878 +
1.2879 +TBool CMMFVideoRecordControllerCustomCommandParser::DoAddMetaDataEntryL(TMMFMessage& aMessage)
1.2880 + {
1.2881 + TInt bufSize = aMessage.SizeOfData1FromClient();
1.2882 + // Leaving here in order to prevent a panic in the NewLC if the value is negative
1.2883 + User::LeaveIfError(bufSize);
1.2884 + HBufC8* buf = HBufC8::NewLC(bufSize);
1.2885 + TPtr8 ptr = buf->Des();
1.2886 + aMessage.ReadData1FromClientL(ptr);
1.2887 + RDesReadStream stream;
1.2888 + stream.Open(ptr);
1.2889 + CleanupClosePushL(stream);
1.2890 + CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
1.2891 + CleanupStack::PushL(metaData);
1.2892 + metaData->InternalizeL(stream);
1.2893 + iImplementor.MvrcAddMetaDataEntryL(*metaData);
1.2894 + CleanupStack::PopAndDestroy(3);//metaData, stream, buf
1.2895 + return ETrue;
1.2896 + }
1.2897 +
1.2898 +TBool CMMFVideoRecordControllerCustomCommandParser::DoRemoveMetaDataEntryL(TMMFMessage& aMessage)
1.2899 + {
1.2900 + TPckgBuf<TInt> pckg;
1.2901 + aMessage.ReadData1FromClientL(pckg);
1.2902 + iImplementor.MvrcRemoveMetaDataEntryL(pckg());
1.2903 + return ETrue;
1.2904 + }
1.2905 +
1.2906 +TBool CMMFVideoRecordControllerCustomCommandParser::DoReplaceMetaDataEntryL(TMMFMessage& aMessage)
1.2907 + {
1.2908 + // Get new meta data
1.2909 + TInt bufSize = aMessage.SizeOfData1FromClient();
1.2910 + // Leaving here in order to prevent a panic in the NewLC if the value is negative
1.2911 + User::LeaveIfError(bufSize);
1.2912 + HBufC8* buf = HBufC8::NewLC(bufSize);
1.2913 + TPtr8 ptr = buf->Des();
1.2914 + aMessage.ReadData1FromClientL(ptr);
1.2915 + RDesReadStream stream;
1.2916 + stream.Open(ptr);
1.2917 + CleanupClosePushL(stream);
1.2918 + CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
1.2919 + CleanupStack::PushL(metaData);
1.2920 + metaData->InternalizeL(stream);
1.2921 +
1.2922 + // Get index to replace
1.2923 + TPckgBuf<TInt> indexPckg;
1.2924 + aMessage.ReadData2FromClientL(indexPckg);
1.2925 +
1.2926 + iImplementor.MvrcReplaceMetaDataEntryL(indexPckg(), *metaData);
1.2927 +
1.2928 + CleanupStack::PopAndDestroy(3);//metaData, stream, buf
1.2929 + return ETrue;
1.2930 + }
1.2931 +
1.2932 +TBool CMMFVideoRecordControllerCustomCommandParser::DoSetMaxFileSizeL(TMMFMessage& aMessage)
1.2933 + {
1.2934 + TPckgBuf<TMMFVideoConfig> pckg;
1.2935 + aMessage.ReadData1FromClientL(pckg);
1.2936 + iImplementor.MvrcSetMaxFileSizeL(pckg().iMaxFileSize);
1.2937 + return ETrue;
1.2938 + }
1.2939 +
1.2940 +TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoFrameSizeL(TMMFMessage& aMessage)
1.2941 + {
1.2942 + TPckgBuf<TMMFVideoConfig> pckg;
1.2943 + aMessage.ReadData1FromClientL(pckg);
1.2944 + iImplementor.MvrcSetVideoFrameSizeL(pckg().iVideoFrameSize);
1.2945 + return ETrue;
1.2946 + }
1.2947 +
1.2948 +TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioEnabledL(TMMFMessage& aMessage)
1.2949 + {
1.2950 + TPckgBuf<TMMFVideoConfig> pckg;
1.2951 + aMessage.ReadData1FromClientL(pckg);
1.2952 + iImplementor.MvrcSetAudioEnabledL(pckg().iAudioEnabled);
1.2953 + return ETrue;
1.2954 + }
1.2955 +
1.2956 +TBool CMMFVideoRecordControllerCustomCommandParser::DoPrepareL(TMMFMessage& /*aMessage*/)
1.2957 + {
1.2958 + iImplementor.MvrcPrepareL();
1.2959 + return ETrue;
1.2960 + }
1.2961 +
1.2962 +TBool CMMFVideoRecordControllerCustomCommandParser::DoSetCameraHandleL(TMMFMessage& aMessage)
1.2963 + {
1.2964 + TPckgBuf<TMMFVideoConfig> pckg;
1.2965 + aMessage.ReadData1FromClientL(pckg);
1.2966 + iImplementor.MvrcSetCameraHandleL(pckg().iCameraHandle);
1.2967 + return ETrue;
1.2968 + }
1.2969 +
1.2970 +TBool CMMFVideoRecordControllerCustomCommandParser::DoGetRecordTimeAvailableL(TMMFMessage& aMessage)
1.2971 + {
1.2972 + TTimeIntervalMicroSeconds time;
1.2973 + iImplementor.MvrcGetRecordTimeAvailableL(time);
1.2974 + TPckgBuf<TMMFVideoConfig> pckg;
1.2975 + pckg().iRecordTimeAvailable = time;
1.2976 + aMessage.WriteDataToClientL(pckg);
1.2977 + return ETrue;
1.2978 + }
1.2979 +
1.2980 +TBool CMMFVideoRecordControllerCustomCommandParser::DoCopyFourCCArrayDataL(TMMFMessage& aMessage)
1.2981 + {
1.2982 + if (!iDataCopyBuffer)
1.2983 + User::Leave(KErrNotReady);
1.2984 + aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
1.2985 + return ETrue;
1.2986 + }
1.2987 +
1.2988 +//INC23777
1.2989 +TBool CMMFVideoRecordControllerCustomCommandParser::DoGetAudioEnabledL(TMMFMessage& aMessage)
1.2990 + {
1.2991 + TBool enabled;
1.2992 + iImplementor.MvrcGetAudioEnabledL(enabled);
1.2993 + TPckgBuf<TMMFVideoConfig> pckg;
1.2994 + pckg().iAudioEnabled = enabled;
1.2995 + aMessage.WriteDataToClientL(pckg);
1.2996 + return ETrue;
1.2997 + }
1.2998 +
1.2999 +//--------------------------------------------------------------------------------------
1.3000 +EXPORT_C CMMFVideoDRMExtCustomCommandParser* CMMFVideoDRMExtCustomCommandParser::NewL(MMMFVideoDRMExtCustomCommandImplementor& aImplementor)
1.3001 + {
1.3002 + return new(ELeave) CMMFVideoDRMExtCustomCommandParser(aImplementor);
1.3003 + }
1.3004 +
1.3005 +EXPORT_C CMMFVideoDRMExtCustomCommandParser::~CMMFVideoDRMExtCustomCommandParser()
1.3006 + {
1.3007 + delete iVideoFrameMessage;
1.3008 + }
1.3009 +
1.3010 +CMMFVideoDRMExtCustomCommandParser::CMMFVideoDRMExtCustomCommandParser(MMMFVideoDRMExtCustomCommandImplementor& aImplementor) :
1.3011 + CMMFCustomCommandParserBase(KUidInterfaceMMFVideoDRMExt),
1.3012 + iImplementor(aImplementor)
1.3013 + {
1.3014 + }
1.3015 +
1.3016 +void CMMFVideoDRMExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.3017 + {
1.3018 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoDRMExt)
1.3019 + {
1.3020 + switch (aMessage.Function())
1.3021 + {
1.3022 + case EMMFVideoDRMExtGetFrame:
1.3023 + TRAPD(err, DoGetFrameL(aMessage));
1.3024 + if (err!=KErrNone) // asynchronous, so only complete message if error occurred
1.3025 + aMessage.Complete(err);
1.3026 + break;
1.3027 + default:
1.3028 + aMessage.Complete(KErrNotSupported);
1.3029 + break;
1.3030 + }
1.3031 + }
1.3032 + else
1.3033 + {
1.3034 + aMessage.Complete(KErrNotSupported);
1.3035 + }
1.3036 + }
1.3037 +
1.3038 +void CMMFVideoDRMExtCustomCommandParser::DoGetFrameL(TMMFMessage& aMessage)
1.3039 + {
1.3040 + delete iVideoFrameMessage;
1.3041 + iVideoFrameMessage = NULL;
1.3042 +
1.3043 + iVideoFrameMessage = CMMFVideoFrameMessage::NewL(aMessage);
1.3044 + TPckgBuf<ContentAccess::TIntent> intentPckg;
1.3045 + aMessage.ReadData2FromClientL(intentPckg);
1.3046 + iImplementor.MvdeGetFrameL(*iVideoFrameMessage, intentPckg());
1.3047 + }
1.3048 +
1.3049 +EXPORT_C RMMFVideoDRMExtCustomCommands::RMMFVideoDRMExtCustomCommands(RMMFController& aController) :
1.3050 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoDRMExt)
1.3051 + {
1.3052 + }
1.3053 +
1.3054 +EXPORT_C void RMMFVideoDRMExtCustomCommands::GetFrame(CFbsBitmap& aBitmap, ContentAccess::TIntent aIntent, TRequestStatus& aStatus)
1.3055 + {
1.3056 + iConfigPackage().iFrameBitmapServerHandle = aBitmap.Handle();
1.3057 + iIntentPackage() = aIntent;
1.3058 + iController.CustomCommandAsync(iDestinationPckg,
1.3059 + EMMFVideoDRMExtGetFrame,
1.3060 + iConfigPackage,
1.3061 + iIntentPackage,
1.3062 + aStatus);
1.3063 + }
1.3064 +
1.3065 +//------------------------------------------------------------------------------
1.3066 +EXPORT_C RMMFResourceNotificationCustomCommands::RMMFResourceNotificationCustomCommands(RMMFController& aController) :
1.3067 +RMMFCustomCommandsBase(aController,KMMFEventCategoryAudioResourceAvailable)
1.3068 + {
1.3069 + }
1.3070 +
1.3071 +EXPORT_C TInt RMMFResourceNotificationCustomCommands::RegisterAsClient(TUid aEventType,const TDesC8& aNotificationRegistrationData)
1.3072 + {
1.3073 + TPckgBuf<TMMFAudioConfig> configPackage;
1.3074 + configPackage().iEventType = aEventType;
1.3075 + configPackage().iNotificationRegistrationData = aNotificationRegistrationData;
1.3076 + return iController.CustomCommandSync(iDestinationPckg,
1.3077 + EMMFAudioResourceRegisterNotification,
1.3078 + configPackage,
1.3079 + KNullDesC8);
1.3080 + }
1.3081 +
1.3082 +EXPORT_C TInt RMMFResourceNotificationCustomCommands::CancelRegisterAsClient(TUid aEventType)
1.3083 + {
1.3084 + TPckgBuf<TMMFAudioConfig> configPackage;
1.3085 + configPackage().iEventType = aEventType;
1.3086 + return iController.CustomCommandSync(iDestinationPckg,
1.3087 + EMMFAudioResourceCancelRegisterNotification,
1.3088 + configPackage,
1.3089 + KNullDesC8);
1.3090 +
1.3091 + }
1.3092 +
1.3093 +EXPORT_C TInt RMMFResourceNotificationCustomCommands::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData)
1.3094 + {
1.3095 + TPckgBuf<TMMFAudioConfig> configPackage;
1.3096 + configPackage().iEventType = aEventType;
1.3097 + return iController.CustomCommandSync(iDestinationPckg,
1.3098 + EMMFAudioResourceGetNotificationData,
1.3099 + configPackage,
1.3100 + KNullDesC8,
1.3101 + aNotificationData);
1.3102 + }
1.3103 +
1.3104 +EXPORT_C TInt RMMFResourceNotificationCustomCommands::WillResumePlay()
1.3105 + {
1.3106 + return iController.CustomCommandSync(iDestinationPckg,
1.3107 + EMMFAudioResourceWillResumePlay,
1.3108 + KNullDesC8,
1.3109 + KNullDesC8);
1.3110 + }
1.3111 +
1.3112 +EXPORT_C CMMFResourceNotificationCustomCommandParser* CMMFResourceNotificationCustomCommandParser::NewL(MMMFResourceNotificationCustomCommandImplementor& aImplementor)
1.3113 + {
1.3114 + return new(ELeave) CMMFResourceNotificationCustomCommandParser(aImplementor);
1.3115 + }
1.3116 +
1.3117 +EXPORT_C CMMFResourceNotificationCustomCommandParser::~CMMFResourceNotificationCustomCommandParser()
1.3118 + {
1.3119 + }
1.3120 +
1.3121 +CMMFResourceNotificationCustomCommandParser::CMMFResourceNotificationCustomCommandParser( MMMFResourceNotificationCustomCommandImplementor& aImplementor) :
1.3122 + CMMFCustomCommandParserBase(KMMFEventCategoryAudioResourceAvailable),
1.3123 + iImplementor(aImplementor)
1.3124 + {
1.3125 + }
1.3126 +
1.3127 +void CMMFResourceNotificationCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.3128 + {
1.3129 + if (aMessage.Destination().InterfaceId() == KMMFEventCategoryAudioResourceAvailable)
1.3130 + {
1.3131 + TRAPD(error, DoHandleRequestL(aMessage));
1.3132 + if (error)
1.3133 + {
1.3134 + aMessage.Complete(error);
1.3135 + }
1.3136 + }
1.3137 + else
1.3138 + {
1.3139 + aMessage.Complete(KErrNotSupported);
1.3140 + }
1.3141 + }
1.3142 +
1.3143 +void CMMFResourceNotificationCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.3144 + {
1.3145 + TBool complete = ETrue;
1.3146 + switch (aMessage.Function())
1.3147 + {
1.3148 + case EMMFAudioResourceRegisterNotification:
1.3149 + complete = DoRegisterAsClientL(aMessage);
1.3150 + break;
1.3151 + case EMMFAudioResourceCancelRegisterNotification:
1.3152 + complete = DoCancelRegisterAsClientL(aMessage);
1.3153 + break;
1.3154 + case EMMFAudioResourceGetNotificationData:
1.3155 + complete = DoGetResourceNotificationDataL(aMessage);
1.3156 + break;
1.3157 + case EMMFAudioResourceWillResumePlay:
1.3158 + complete = DoWillResumePlayL(aMessage);
1.3159 + break;
1.3160 + default:
1.3161 + User::Leave(KErrNotSupported);
1.3162 + break;
1.3163 + }
1.3164 + if (complete)
1.3165 + {
1.3166 + aMessage.Complete(KErrNone);
1.3167 + }
1.3168 + }
1.3169 +
1.3170 +EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoRegisterAsClientL(TMMFMessage& aMessage)
1.3171 + {
1.3172 + TPckgBuf<TMMFAudioConfig> pckg;
1.3173 + aMessage.ReadData1FromClientL(pckg);
1.3174 + iImplementor.MarnRegisterAsClientL(pckg().iEventType, pckg().iNotificationRegistrationData);
1.3175 + return ETrue;
1.3176 + }
1.3177 +
1.3178 +EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoCancelRegisterAsClientL(TMMFMessage& aMessage)
1.3179 + {
1.3180 + TPckgBuf<TMMFAudioConfig> pckg;
1.3181 + aMessage.ReadData1FromClientL(pckg);
1.3182 + iImplementor.MarnCancelRegisterAsClientL(pckg().iEventType);
1.3183 + return ETrue;
1.3184 + }
1.3185 +
1.3186 +EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoGetResourceNotificationDataL(TMMFMessage& aMessage)
1.3187 + {
1.3188 + TPckgBuf<TMMFAudioConfig> pckg;
1.3189 + aMessage.ReadData1FromClientL(pckg);
1.3190 + iImplementor.MarnGetResourceNotificationDataL(pckg().iEventType, pckg().iNotificationData);
1.3191 + TPtrC8 tmp(pckg().iNotificationData);
1.3192 + aMessage.WriteDataToClientL(pckg().iNotificationData);
1.3193 + return ETrue;
1.3194 + }
1.3195 +
1.3196 +EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoWillResumePlayL(TMMFMessage& aMessage)
1.3197 + {
1.3198 + iImplementor.MarnWillResumePlayL();
1.3199 + aMessage.Complete(KErrNone);
1.3200 + return EFalse;
1.3201 + }
1.3202 +
1.3203 +EXPORT_C RMMFVideoSetInitScreenCustomCommands::RMMFVideoSetInitScreenCustomCommands(RMMFController& aController) :
1.3204 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoSetInitScreen)
1.3205 + {
1.3206 + }
1.3207 +
1.3208 +EXPORT_C TInt RMMFVideoSetInitScreenCustomCommands::SetInitScreenNumber(TInt aScreenNumber)
1.3209 + {
1.3210 + TPckgBuf<TInt> configPackage;
1.3211 + configPackage() = aScreenNumber;
1.3212 + return iController.CustomCommandSync(iDestinationPckg,
1.3213 + EMMFVideoSetInitScreenNumber,
1.3214 + configPackage,
1.3215 + KNullDesC8);
1.3216 + }
1.3217 +
1.3218 +EXPORT_C CMMFVideoSetInitScreenCustomCommandParser* CMMFVideoSetInitScreenCustomCommandParser::NewL(MMMFVideoSetInitScreenCustomCommandImplementor& aImplementor)
1.3219 + {
1.3220 + return new(ELeave) CMMFVideoSetInitScreenCustomCommandParser(aImplementor);
1.3221 + }
1.3222 +
1.3223 +EXPORT_C CMMFVideoSetInitScreenCustomCommandParser::~CMMFVideoSetInitScreenCustomCommandParser()
1.3224 + {
1.3225 + }
1.3226 +
1.3227 +CMMFVideoSetInitScreenCustomCommandParser::CMMFVideoSetInitScreenCustomCommandParser(MMMFVideoSetInitScreenCustomCommandImplementor& aImplementor) :
1.3228 + CMMFCustomCommandParserBase(KUidInterfaceMMFVideoSetInitScreen),
1.3229 + iImplementor(aImplementor)
1.3230 + {
1.3231 + }
1.3232 +
1.3233 +void CMMFVideoSetInitScreenCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.3234 + {
1.3235 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoSetInitScreen)
1.3236 + {
1.3237 + TRAPD(error, DoHandleRequestL(aMessage));
1.3238 + if (error)
1.3239 + {
1.3240 + aMessage.Complete(error);
1.3241 + }
1.3242 + }
1.3243 + else
1.3244 + {
1.3245 + aMessage.Complete(KErrNotSupported);
1.3246 + }
1.3247 + }
1.3248 +
1.3249 +void CMMFVideoSetInitScreenCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.3250 + {
1.3251 + TBool complete = ETrue;
1.3252 + switch (aMessage.Function())
1.3253 + {
1.3254 + case EMMFVideoSetInitScreenNumber:
1.3255 + complete = DoSetInitScreenNumberL(aMessage);
1.3256 + break;
1.3257 + default:
1.3258 + User::Leave(KErrNotSupported);
1.3259 + break;
1.3260 + }
1.3261 + if (complete)
1.3262 + {
1.3263 + aMessage.Complete(KErrNone);
1.3264 + }
1.3265 + }
1.3266 +
1.3267 +TBool CMMFVideoSetInitScreenCustomCommandParser::DoSetInitScreenNumberL(TMMFMessage& aMessage)
1.3268 + {
1.3269 + TPckgBuf<TInt> pckg;
1.3270 + aMessage.ReadData1FromClientL(pckg);
1.3271 + iImplementor.MvsdSetInitScreenNumber(pckg());
1.3272 + return ETrue;
1.3273 + }
1.3274 +
1.3275 +_LIT(KMMFStandardCustomCommandsPanicCategory, "MMFStandardCustomCommands");
1.3276 +GLDEF_C void Panic(TMmfSCCPanic aError)
1.3277 + {
1.3278 + User::Panic(KMMFStandardCustomCommandsPanicCategory, aError);
1.3279 + }
1.3280 +
1.3281 +
1.3282 +EXPORT_C RMMFVideoPixelAspectRatioCustomCommands::RMMFVideoPixelAspectRatioCustomCommands(RMMFController& aController) :
1.3283 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPixelAspectRatio)
1.3284 + {
1.3285 + }
1.3286 +
1.3287 +EXPORT_C TInt RMMFVideoPixelAspectRatioCustomCommands::SetPixelAspectRatio(const TVideoAspectRatio& aAspectRatio)
1.3288 + {
1.3289 + TPckgBuf<TVideoAspectRatio> configPackage;
1.3290 + configPackage() = aAspectRatio;
1.3291 + return iController.CustomCommandSync(iDestinationPckg,
1.3292 + EMMFVideoSetPixelAspectRatio,
1.3293 + configPackage,
1.3294 + KNullDesC8);
1.3295 + }
1.3296 +
1.3297 +EXPORT_C TInt RMMFVideoPixelAspectRatioCustomCommands::GetPixelAspectRatio(TVideoAspectRatio& aAspectRatio) const
1.3298 + {
1.3299 + TPckgBuf<TVideoAspectRatio> configPackage;
1.3300 +
1.3301 + TInt err = iController.CustomCommandSync(iDestinationPckg,
1.3302 + EMMFVideoGetPixelAspectRatio,
1.3303 + KNullDesC8,
1.3304 + KNullDesC8,
1.3305 + configPackage);
1.3306 +
1.3307 + if (!err)
1.3308 + {
1.3309 + aAspectRatio = configPackage();
1.3310 + }
1.3311 + return err;
1.3312 + }
1.3313 +
1.3314 +EXPORT_C void RMMFVideoPixelAspectRatioCustomCommands::GetSupportedPixelAspectRatiosL(RArray<TVideoAspectRatio>& aAspectRatios) const
1.3315 + {
1.3316 + DoGetVideoPixelAspectRatioArrayL(aAspectRatios, EMMFVideoGetSupportedPixelAspectRatios);
1.3317 + }
1.3318 +
1.3319 +void RMMFVideoPixelAspectRatioCustomCommands::DoGetVideoPixelAspectRatioArrayL(RArray<TVideoAspectRatio>& aArray, TMMFVideoPixelAspectRatioMessages aIpc) const
1.3320 + {
1.3321 + aArray.Reset();
1.3322 +
1.3323 + TPckgBuf<TInt> numberOfElementsPckg;
1.3324 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.3325 + aIpc,
1.3326 + KNullDesC8,
1.3327 + KNullDesC8,
1.3328 + numberOfElementsPckg));
1.3329 +
1.3330 + HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TVideoAspectRatio));
1.3331 + TPtr8 ptr = buf->Des();
1.3332 +
1.3333 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.3334 + EMMFVideoPixelAspectRatioCopyArrayData,
1.3335 + KNullDesC8,
1.3336 + KNullDesC8,
1.3337 + ptr));
1.3338 + RDesReadStream stream(ptr);
1.3339 + stream.Open(ptr);
1.3340 + CleanupClosePushL(stream);
1.3341 +
1.3342 + for (TInt i=0; i<numberOfElementsPckg(); i++)
1.3343 + {
1.3344 + User::LeaveIfError(aArray.Append(TVideoAspectRatio(stream.ReadInt32L(), stream.ReadInt32L())));
1.3345 + }
1.3346 +
1.3347 + CleanupStack::PopAndDestroy(2, buf);//stream, buf
1.3348 + }
1.3349 +
1.3350 +EXPORT_C CMMFVideoPixelAspectRatioCustomCommandParser* CMMFVideoPixelAspectRatioCustomCommandParser::NewL(MMMFVideoPixelAspectRatioCustomCommandImplementor& aImplementor)
1.3351 + {
1.3352 + return new(ELeave) CMMFVideoPixelAspectRatioCustomCommandParser(aImplementor);
1.3353 + }
1.3354 +
1.3355 +EXPORT_C CMMFVideoPixelAspectRatioCustomCommandParser::~CMMFVideoPixelAspectRatioCustomCommandParser()
1.3356 + {
1.3357 + if(iDataCopyBuffer)
1.3358 + {
1.3359 + delete iDataCopyBuffer;
1.3360 + }
1.3361 + }
1.3362 +
1.3363 +CMMFVideoPixelAspectRatioCustomCommandParser::CMMFVideoPixelAspectRatioCustomCommandParser(MMMFVideoPixelAspectRatioCustomCommandImplementor& aImplementor) :
1.3364 + CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPixelAspectRatio),
1.3365 + iImplementor(aImplementor)
1.3366 + {
1.3367 + }
1.3368 +
1.3369 +void CMMFVideoPixelAspectRatioCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.3370 + {
1.3371 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPixelAspectRatio)
1.3372 + {
1.3373 + TRAPD(error, DoHandleRequestL(aMessage));
1.3374 + if (error)
1.3375 + {
1.3376 + aMessage.Complete(error);
1.3377 + }
1.3378 + }
1.3379 + else
1.3380 + {
1.3381 + aMessage.Complete(KErrNotSupported);
1.3382 + }
1.3383 + }
1.3384 +
1.3385 +void CMMFVideoPixelAspectRatioCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.3386 + {
1.3387 + TBool complete = ETrue;
1.3388 + switch (aMessage.Function())
1.3389 + {
1.3390 + case EMMFVideoSetPixelAspectRatio:
1.3391 + complete = DoSetPixelAspectRatioL(aMessage);
1.3392 + break;
1.3393 + case EMMFVideoGetPixelAspectRatio:
1.3394 + complete = DoGetPixelAspectRatioL(aMessage);
1.3395 + break;
1.3396 + case EMMFVideoGetSupportedPixelAspectRatios:
1.3397 + complete = DoGetSupportedPixelAspectRatiosL(aMessage);
1.3398 + break;
1.3399 + case EMMFVideoPixelAspectRatioCopyArrayData:
1.3400 + complete = DoCopyArrayDataL(aMessage);
1.3401 + break;
1.3402 + default:
1.3403 + User::Leave(KErrNotSupported);
1.3404 + break;
1.3405 + }
1.3406 + if (complete)
1.3407 + {
1.3408 + aMessage.Complete(KErrNone);
1.3409 + }
1.3410 + }
1.3411 +
1.3412 +TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoSetPixelAspectRatioL(TMMFMessage& aMessage)
1.3413 + {
1.3414 + TPckgBuf<TVideoAspectRatio> pckg;
1.3415 + aMessage.ReadData1FromClientL(pckg);
1.3416 + iImplementor.MvparSetPixelAspectRatioL(pckg());
1.3417 + return ETrue;
1.3418 + }
1.3419 +
1.3420 +TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoGetPixelAspectRatioL(TMMFMessage& aMessage)
1.3421 + {
1.3422 + TVideoAspectRatio aspectRatio;
1.3423 + iImplementor.MvparGetPixelAspectRatioL(aspectRatio);
1.3424 + TPckgBuf<TVideoAspectRatio> pckg;
1.3425 + pckg() = aspectRatio;
1.3426 + aMessage.WriteDataToClientL(pckg);
1.3427 + return ETrue;
1.3428 + }
1.3429 +
1.3430 +TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoGetSupportedPixelAspectRatiosL(TMMFMessage& aMessage)
1.3431 + {
1.3432 + RArray<TVideoAspectRatio> array;
1.3433 + CleanupClosePushL(array);
1.3434 + iImplementor.MvparGetSupportedPixelAspectRatiosL(array);
1.3435 +
1.3436 + DoCreateBufFromVideoAspectRatioArrayL(array);
1.3437 +
1.3438 + TPckgBuf<TInt> pckg;
1.3439 + pckg() = array.Count();
1.3440 + aMessage.WriteDataToClientL(pckg);
1.3441 +
1.3442 + CleanupStack::PopAndDestroy(&array);
1.3443 + return ETrue;
1.3444 + }
1.3445 +
1.3446 +void CMMFVideoPixelAspectRatioCustomCommandParser::DoCreateBufFromVideoAspectRatioArrayL(RArray<TVideoAspectRatio>& aArray)
1.3447 + {
1.3448 + delete iDataCopyBuffer;
1.3449 + iDataCopyBuffer = NULL;
1.3450 +
1.3451 + iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
1.3452 + RBufWriteStream stream;
1.3453 + stream.Open(*iDataCopyBuffer);
1.3454 + CleanupClosePushL(stream);
1.3455 + for (TInt i=0;i<aArray.Count();i++)
1.3456 + {
1.3457 + stream.WriteInt32L(aArray[i].iNumerator);
1.3458 + stream.WriteInt32L(aArray[i].iDenominator);
1.3459 + }
1.3460 + CleanupStack::PopAndDestroy(&stream);
1.3461 + }
1.3462 +
1.3463 +TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage)
1.3464 + {
1.3465 + if (!iDataCopyBuffer)
1.3466 + {
1.3467 + User::Leave(KErrNotReady);
1.3468 + }
1.3469 + aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
1.3470 + return ETrue;
1.3471 + }
1.3472 +
1.3473 +EXPORT_C RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands(RMMFController& aController) :
1.3474 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig)
1.3475 + {
1.3476 + }
1.3477 +
1.3478 +EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::SetAudioChannels(const TUint aNumChannels)
1.3479 + {
1.3480 + TPckgBuf<TUint> configPackage;
1.3481 + configPackage() = aNumChannels;
1.3482 + return iController.CustomCommandSync(iDestinationPckg,
1.3483 + EMMFVideoSetAudioChannels,
1.3484 + configPackage,
1.3485 + KNullDesC8);
1.3486 + }
1.3487 +
1.3488 +EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetAudioChannels(TUint& aAudioChannels) const
1.3489 + {
1.3490 + TPckgBuf<TUint> configPackage;
1.3491 +
1.3492 + TInt err = iController.CustomCommandSync(iDestinationPckg,
1.3493 + EMMFVideoGetAudioChannels,
1.3494 + KNullDesC8,
1.3495 + KNullDesC8,
1.3496 + configPackage);
1.3497 +
1.3498 + if (!err)
1.3499 + {
1.3500 + aAudioChannels = configPackage();
1.3501 + }
1.3502 + return err;
1.3503 + }
1.3504 +
1.3505 +EXPORT_C void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetSupportedAudioChannelsL(RArray<TUint>& aChannels) const
1.3506 + {
1.3507 + DoGetUintArrayL(aChannels, EMMFVideoGetSupportedAudioChannels);
1.3508 + }
1.3509 +
1.3510 +EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::SetAudioSampleRate(const TUint aSampleRate)
1.3511 + {
1.3512 + TPckgBuf<TUint> configPackage;
1.3513 + configPackage() = aSampleRate;
1.3514 + return iController.CustomCommandSync(iDestinationPckg,
1.3515 + EMMFVideoSetAudioSampleRate,
1.3516 + configPackage,
1.3517 + KNullDesC8);
1.3518 + }
1.3519 +
1.3520 +EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetAudioSampleRate(TUint& aSampleRate) const
1.3521 + {
1.3522 + TPckgBuf<TUint> configPackage;
1.3523 +
1.3524 + TInt err = iController.CustomCommandSync(iDestinationPckg,
1.3525 + EMMFVideoGetAudioSampleRate,
1.3526 + KNullDesC8,
1.3527 + KNullDesC8,
1.3528 + configPackage);
1.3529 +
1.3530 + if (!err)
1.3531 + {
1.3532 + aSampleRate = configPackage();
1.3533 + }
1.3534 + return err;
1.3535 + }
1.3536 +
1.3537 +EXPORT_C void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetSupportedAudioSampleRatesL(RArray<TUint>& aSampleRates) const
1.3538 + {
1.3539 + DoGetUintArrayL(aSampleRates, EMMFVideoGetSupportedAudioSampleRates);
1.3540 + }
1.3541 +
1.3542 +void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::DoGetUintArrayL(RArray<TUint>& aArray, TMMFVideoAudioSamplingRateAndChannelConfigMessages aIpc) const
1.3543 + {
1.3544 + aArray.Reset();
1.3545 +
1.3546 + TPckgBuf<TInt> numberOfElementsPckg;
1.3547 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.3548 + aIpc,
1.3549 + KNullDesC8,
1.3550 + KNullDesC8,
1.3551 + numberOfElementsPckg));
1.3552 +
1.3553 + HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TUint));
1.3554 + TPtr8 ptr = buf->Des();
1.3555 +
1.3556 + User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
1.3557 + EMMFVideoAudioSamplingRateAndChannelConfigCopyArrayData,
1.3558 + KNullDesC8,
1.3559 + KNullDesC8,
1.3560 + ptr));
1.3561 + RDesReadStream stream(ptr);
1.3562 + stream.Open(ptr);
1.3563 + CleanupClosePushL(stream);
1.3564 +
1.3565 + for (TInt i=0; i<numberOfElementsPckg(); i++)
1.3566 + {
1.3567 + User::LeaveIfError(aArray.Append(stream.ReadUint32L()));
1.3568 + }
1.3569 +
1.3570 + CleanupStack::PopAndDestroy(2, buf);//stream, buf
1.3571 + }
1.3572 +
1.3573 +
1.3574 +EXPORT_C CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser* CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::NewL(MMMFVideoAudioSamplingRateAndChannelConfigCustomCommandImplementor& aImplementor)
1.3575 + {
1.3576 + return new(ELeave) CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser(aImplementor);
1.3577 + }
1.3578 +
1.3579 +EXPORT_C CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::~CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser()
1.3580 + {
1.3581 + if(iDataCopyBuffer)
1.3582 + {
1.3583 + delete iDataCopyBuffer;
1.3584 + }
1.3585 + }
1.3586 +
1.3587 +CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser(MMMFVideoAudioSamplingRateAndChannelConfigCustomCommandImplementor& aImplementor) :
1.3588 + CMMFCustomCommandParserBase(KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig),
1.3589 + iImplementor(aImplementor)
1.3590 + {
1.3591 + }
1.3592 +
1.3593 +void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.3594 + {
1.3595 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig)
1.3596 + {
1.3597 + TRAPD(error, DoHandleRequestL(aMessage));
1.3598 + if (error)
1.3599 + {
1.3600 + aMessage.Complete(error);
1.3601 + }
1.3602 + }
1.3603 + else
1.3604 + {
1.3605 + aMessage.Complete(KErrNotSupported);
1.3606 + }
1.3607 + }
1.3608 +
1.3609 +void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.3610 + {
1.3611 + TBool complete = ETrue;
1.3612 + switch (aMessage.Function())
1.3613 + {
1.3614 + case EMMFVideoSetAudioChannels:
1.3615 + complete = DoSetAudioChannelsL(aMessage);
1.3616 + break;
1.3617 + case EMMFVideoGetAudioChannels:
1.3618 + complete = DoGetAudioChannelsL(aMessage);
1.3619 + break;
1.3620 + case EMMFVideoGetSupportedAudioChannels:
1.3621 + complete = DoGetSupportedAudioChannelsL(aMessage);
1.3622 + break;
1.3623 + case EMMFVideoSetAudioSampleRate:
1.3624 + complete = DoSetAudioSampleRateL(aMessage);
1.3625 + break;
1.3626 + case EMMFVideoGetAudioSampleRate:
1.3627 + complete = DoGetAudioSampleRateL(aMessage);
1.3628 + break;
1.3629 + case EMMFVideoGetSupportedAudioSampleRates:
1.3630 + complete = DoGetSupportedAudioSampleRatesL(aMessage);
1.3631 + break;
1.3632 + case EMMFVideoAudioSamplingRateAndChannelConfigCopyArrayData:
1.3633 + complete = DoCopyArrayDataL(aMessage);
1.3634 + break;
1.3635 + default:
1.3636 + User::Leave(KErrNotSupported);
1.3637 + break;
1.3638 + }
1.3639 + if (complete)
1.3640 + {
1.3641 + aMessage.Complete(KErrNone);
1.3642 + }
1.3643 + }
1.3644 +
1.3645 +
1.3646 +TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoSetAudioChannelsL(TMMFMessage& aMessage)
1.3647 + {
1.3648 + TPckgBuf<TUint> pckg;
1.3649 + aMessage.ReadData1FromClientL(pckg);
1.3650 + iImplementor.MvasrccSetAudioChannelsL(pckg());
1.3651 + return ETrue;
1.3652 + }
1.3653 +
1.3654 +TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetAudioChannelsL(TMMFMessage& aMessage)
1.3655 + {
1.3656 + TUint channels = 0;
1.3657 + iImplementor.MvasrccGetAudioChannelsL(channels);
1.3658 + TPckgBuf<TUint> pckg;
1.3659 + pckg() = channels;
1.3660 + aMessage.WriteDataToClientL(pckg);
1.3661 + return ETrue;
1.3662 + }
1.3663 +
1.3664 +TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetSupportedAudioChannelsL(TMMFMessage& aMessage)
1.3665 + {
1.3666 + RArray<TUint> audioChannels;
1.3667 + CleanupClosePushL(audioChannels);
1.3668 + iImplementor.MvasrccGetSupportedAudioChannelsL(audioChannels);
1.3669 +
1.3670 + DoCreateBufFromUintArrayL(audioChannels);
1.3671 +
1.3672 + TPckgBuf<TInt> pckg;
1.3673 + pckg() = audioChannels.Count();
1.3674 + aMessage.WriteDataToClientL(pckg);
1.3675 +
1.3676 + CleanupStack::PopAndDestroy(&audioChannels);
1.3677 + return ETrue;
1.3678 + }
1.3679 +
1.3680 +TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoSetAudioSampleRateL(TMMFMessage& aMessage)
1.3681 + {
1.3682 + TPckgBuf<TUint> pckg;
1.3683 + aMessage.ReadData1FromClientL(pckg);
1.3684 + iImplementor.MvasrccSetAudioSampleRateL(pckg());
1.3685 + return ETrue;
1.3686 + }
1.3687 +
1.3688 +TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetAudioSampleRateL(TMMFMessage& aMessage)
1.3689 + {
1.3690 + TUint sampleRate = 0;
1.3691 + iImplementor.MvasrccGetAudioSampleRateL(sampleRate);
1.3692 + TPckgBuf<TUint> pckg;
1.3693 + pckg() = sampleRate;
1.3694 + aMessage.WriteDataToClientL(pckg);
1.3695 + return ETrue;
1.3696 + }
1.3697 +
1.3698 +TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetSupportedAudioSampleRatesL(TMMFMessage& aMessage)
1.3699 + {
1.3700 + RArray<TUint> sampleRates;
1.3701 + CleanupClosePushL(sampleRates);
1.3702 + iImplementor.MvasrccGetSupportedAudioSampleRatesL(sampleRates);
1.3703 +
1.3704 + DoCreateBufFromUintArrayL(sampleRates);
1.3705 +
1.3706 + TPckgBuf<TInt> pckg;
1.3707 + pckg() = sampleRates.Count();
1.3708 + aMessage.WriteDataToClientL(pckg);
1.3709 +
1.3710 + CleanupStack::PopAndDestroy(&sampleRates);
1.3711 + return ETrue;
1.3712 + }
1.3713 +
1.3714 +void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoCreateBufFromUintArrayL(RArray<TUint>& aArray)
1.3715 + {
1.3716 + delete iDataCopyBuffer;
1.3717 + iDataCopyBuffer = NULL;
1.3718 +
1.3719 + iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
1.3720 + RBufWriteStream stream;
1.3721 + stream.Open(*iDataCopyBuffer);
1.3722 + CleanupClosePushL(stream);
1.3723 + for (TInt i=0;i<aArray.Count();i++)
1.3724 + {
1.3725 + stream.WriteUint32L(aArray[i]);
1.3726 + }
1.3727 + CleanupStack::PopAndDestroy(&stream);
1.3728 + }
1.3729 +
1.3730 +TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage)
1.3731 + {
1.3732 + if (!iDataCopyBuffer)
1.3733 + {
1.3734 + User::Leave(KErrNotReady);
1.3735 + }
1.3736 + aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
1.3737 + return ETrue;
1.3738 + }
1.3739 +
1.3740 +
1.3741 +EXPORT_C CMMFVideoPlayControllerExtCustomCommandParser* CMMFVideoPlayControllerExtCustomCommandParser::NewL(MMMFVideoPlayControllerExtCustomCommandImplementor& aImplementor)
1.3742 + {
1.3743 + return new(ELeave) CMMFVideoPlayControllerExtCustomCommandParser(aImplementor);
1.3744 + }
1.3745 +
1.3746 +EXPORT_C CMMFVideoPlayControllerExtCustomCommandParser::~CMMFVideoPlayControllerExtCustomCommandParser()
1.3747 + {
1.3748 + }
1.3749 +
1.3750 +CMMFVideoPlayControllerExtCustomCommandParser::CMMFVideoPlayControllerExtCustomCommandParser(MMMFVideoPlayControllerExtCustomCommandImplementor& aImplementor) :
1.3751 + CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPlayExt),
1.3752 + iImplementor(aImplementor)
1.3753 + {
1.3754 + }
1.3755 +
1.3756 +void CMMFVideoPlayControllerExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.3757 + {
1.3758 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPlayExt)
1.3759 + {
1.3760 + TRAPD(error, DoHandleRequestL(aMessage));
1.3761 + if (error)
1.3762 + {
1.3763 + aMessage.Complete(error);
1.3764 + }
1.3765 + }
1.3766 + else
1.3767 + {
1.3768 + aMessage.Complete(KErrNotSupported);
1.3769 + }
1.3770 + }
1.3771 +
1.3772 +void CMMFVideoPlayControllerExtCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.3773 + {
1.3774 + TBool complete = ETrue;
1.3775 +
1.3776 + switch (aMessage.Function())
1.3777 + {
1.3778 + case EMMFVideoPlayControllerSetPlayVelocity:
1.3779 + complete = DoSetPlayVelocityL(aMessage);
1.3780 + break;
1.3781 + case EMMFVideoPlayControllerPlayVelocity:
1.3782 + complete = DoPlayVelocityL(aMessage);
1.3783 + break;
1.3784 + case EMMFVideoPlayControllerStepFrame:
1.3785 + complete = DoStepFrameL(aMessage);
1.3786 + break;
1.3787 + case EMMFVideoPlayControllerGetPlayRateCapabilities:
1.3788 + complete = DoGetPlayRateCapabilitiesL(aMessage);
1.3789 + break;
1.3790 + case EMMFVideoPlayControllerSetVideoEnabled:
1.3791 + complete = DoSetVideoEnabledL(aMessage);
1.3792 + break;
1.3793 + case EMMFVideoPlayControllerVideoEnabled:
1.3794 + complete = DoVideoEnabledL(aMessage);
1.3795 + break;
1.3796 + case EMMFVideoPlayControllerSetAudioEnabled:
1.3797 + complete = DoSetAudioEnabledL(aMessage);
1.3798 + break;
1.3799 + case EMMFVideoPlayControllerSetAutoScale:
1.3800 + complete = DoSetAutoScaleL(aMessage);
1.3801 + break;
1.3802 + default:
1.3803 + User::Leave(KErrNotSupported);
1.3804 + break;
1.3805 + }
1.3806 +
1.3807 + if (complete)
1.3808 + {
1.3809 + aMessage.Complete(KErrNone);
1.3810 + }
1.3811 + }
1.3812 +
1.3813 +TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetPlayVelocityL(TMMFMessage& aMessage)
1.3814 + {
1.3815 + TPckgBuf<TInt> pckg;
1.3816 + aMessage.ReadData1FromClientL(pckg);
1.3817 + iImplementor.MvpecSetPlayVelocityL(pckg());
1.3818 +
1.3819 + return ETrue;
1.3820 + }
1.3821 +
1.3822 +TBool CMMFVideoPlayControllerExtCustomCommandParser::DoPlayVelocityL(TMMFMessage& aMessage)
1.3823 + {
1.3824 + TPckgBuf<TInt> pckg;
1.3825 +
1.3826 + pckg() = iImplementor.MvpecPlayVelocityL();
1.3827 +
1.3828 + aMessage.WriteDataToClientL(pckg);
1.3829 +
1.3830 + return ETrue;
1.3831 + }
1.3832 +
1.3833 +TBool CMMFVideoPlayControllerExtCustomCommandParser::DoStepFrameL(TMMFMessage& aMessage)
1.3834 + {
1.3835 + TPckgBuf<TInt> pckg;
1.3836 + aMessage.ReadData1FromClientL(pckg);
1.3837 + iImplementor.MvpecStepFrameL(pckg());
1.3838 +
1.3839 + return ETrue;
1.3840 + }
1.3841 +
1.3842 +TBool CMMFVideoPlayControllerExtCustomCommandParser::DoGetPlayRateCapabilitiesL(TMMFMessage& aMessage)
1.3843 + {
1.3844 + TPckgBuf<TVideoPlayRateCapabilities> pckg;
1.3845 +
1.3846 + iImplementor.MvpecGetPlayRateCapabilitiesL(pckg());
1.3847 +
1.3848 + aMessage.WriteDataToClientL(pckg);
1.3849 +
1.3850 + return ETrue;
1.3851 + }
1.3852 +
1.3853 +TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetVideoEnabledL(TMMFMessage& aMessage)
1.3854 + {
1.3855 + TPckgBuf<TBool> pckg;
1.3856 + aMessage.ReadData1FromClientL(pckg);
1.3857 + iImplementor.MvpecSetVideoEnabledL(pckg());
1.3858 +
1.3859 + return ETrue;
1.3860 + }
1.3861 +
1.3862 +TBool CMMFVideoPlayControllerExtCustomCommandParser::DoVideoEnabledL(TMMFMessage& aMessage)
1.3863 + {
1.3864 + TPckgBuf<TBool> pckg;
1.3865 +
1.3866 + pckg() = iImplementor.MvpecVideoEnabledL();
1.3867 +
1.3868 + aMessage.WriteDataToClientL(pckg);
1.3869 + return ETrue;
1.3870 + }
1.3871 +
1.3872 +TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetAudioEnabledL(TMMFMessage& aMessage)
1.3873 + {
1.3874 + TPckgBuf<TBool> pckg;
1.3875 + aMessage.ReadData1FromClientL(pckg);
1.3876 + iImplementor.MvpecSetAudioEnabledL(pckg());
1.3877 +
1.3878 + return ETrue;
1.3879 + }
1.3880 +
1.3881 +TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetAutoScaleL(TMMFMessage& aMessage)
1.3882 + {
1.3883 + TPckgBuf<TMMFVideoPlayAutoScaleParams> pckg;
1.3884 + aMessage.ReadData1FromClientL(pckg);
1.3885 + iImplementor.MvpecSetAutoScaleL(pckg().iScaleType,pckg().iHorizPos , pckg().iVertPos );
1.3886 +
1.3887 + return ETrue;
1.3888 + }
1.3889 +
1.3890 +EXPORT_C RMMFVideoPlayControllerExtCustomCommands::RMMFVideoPlayControllerExtCustomCommands(RMMFController& aController) :
1.3891 +RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPlayExt)
1.3892 + {
1.3893 + }
1.3894 +
1.3895 +EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetPlayVelocity(TInt aVelocity)
1.3896 + {
1.3897 + TPckgBuf<TInt> pckg(aVelocity);
1.3898 + return iController.CustomCommandSync(iDestinationPckg,
1.3899 + EMMFVideoPlayControllerSetPlayVelocity,
1.3900 + pckg,
1.3901 + KNullDesC8);
1.3902 + }
1.3903 +
1.3904 +EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::PlayVelocity(TInt &aVelocity) const
1.3905 + {
1.3906 + TPckgBuf<TInt> pckg;
1.3907 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.3908 + EMMFVideoPlayControllerPlayVelocity,
1.3909 + KNullDesC8,
1.3910 + KNullDesC8,
1.3911 + pckg);
1.3912 + if (error == KErrNone)
1.3913 + {
1.3914 + aVelocity = pckg();
1.3915 + }
1.3916 + return error;
1.3917 + }
1.3918 +
1.3919 +EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::StepFrame(TInt aStep)
1.3920 + {
1.3921 + TPckgBuf<TInt> pckg(aStep);
1.3922 + return iController.CustomCommandSync(iDestinationPckg,
1.3923 + EMMFVideoPlayControllerStepFrame,
1.3924 + pckg,
1.3925 + KNullDesC8);
1.3926 + }
1.3927 +
1.3928 +EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::GetPlayRateCapabilities(TVideoPlayRateCapabilities& aCapabilities) const
1.3929 + {
1.3930 + TPckgBuf<TVideoPlayRateCapabilities> pckg;
1.3931 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.3932 + EMMFVideoPlayControllerGetPlayRateCapabilities,
1.3933 + KNullDesC8,
1.3934 + KNullDesC8,
1.3935 + pckg);
1.3936 + if (!error)
1.3937 + {
1.3938 + aCapabilities = pckg();
1.3939 + }
1.3940 + return error;
1.3941 + }
1.3942 +
1.3943 +EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetVideoEnabled(TBool aVideoEnabled)
1.3944 + {
1.3945 + TPckgBuf<TBool> pckg(aVideoEnabled);
1.3946 + return iController.CustomCommandSync(iDestinationPckg,
1.3947 + EMMFVideoPlayControllerSetVideoEnabled,
1.3948 + pckg,
1.3949 + KNullDesC8);
1.3950 + }
1.3951 +
1.3952 +EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::VideoEnabled(TBool &aVideoEnabled) const
1.3953 + {
1.3954 + TPckgBuf<TBool> pckg;
1.3955 + TInt error = iController.CustomCommandSync(iDestinationPckg,
1.3956 + EMMFVideoPlayControllerVideoEnabled,
1.3957 + KNullDesC8,
1.3958 + KNullDesC8,
1.3959 + pckg);
1.3960 + if (error == KErrNone)
1.3961 + {
1.3962 + aVideoEnabled = pckg();
1.3963 + }
1.3964 + return error;
1.3965 + }
1.3966 +
1.3967 +EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetAudioEnabled(TBool aAudioEnabled)
1.3968 + {
1.3969 + TPckgBuf<TBool> pckg(aAudioEnabled);
1.3970 + return iController.CustomCommandSync(iDestinationPckg,
1.3971 + EMMFVideoPlayControllerSetAudioEnabled,
1.3972 + pckg,
1.3973 + KNullDesC8);
1.3974 + }
1.3975 +
1.3976 +EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetAutoScale(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
1.3977 + {
1.3978 + TPckgBuf<TMMFVideoPlayAutoScaleParams> pckg;
1.3979 +
1.3980 + pckg().iScaleType = aScaleType;
1.3981 + pckg().iHorizPos = aHorizPos;
1.3982 + pckg().iVertPos = aVertPos;
1.3983 +
1.3984 + return iController.CustomCommandSync(iDestinationPckg,
1.3985 + EMMFVideoPlayControllerSetAutoScale,
1.3986 + pckg,
1.3987 + KNullDesC8);
1.3988 + }
1.3989 +
1.3990 +
1.3991 +EXPORT_C CMMFVideoRecordControllerExtCustomCommandParser* CMMFVideoRecordControllerExtCustomCommandParser::NewL(MMMFVideoRecordControllerExtCustomCommandImplementor& aImplementor)
1.3992 + {
1.3993 + return new(ELeave) CMMFVideoRecordControllerExtCustomCommandParser(aImplementor);
1.3994 + }
1.3995 +
1.3996 +EXPORT_C CMMFVideoRecordControllerExtCustomCommandParser::~CMMFVideoRecordControllerExtCustomCommandParser()
1.3997 + {
1.3998 + }
1.3999 +
1.4000 +CMMFVideoRecordControllerExtCustomCommandParser::CMMFVideoRecordControllerExtCustomCommandParser(MMMFVideoRecordControllerExtCustomCommandImplementor& aImplementor) :
1.4001 + CMMFCustomCommandParserBase(KUidInterfaceMMFVideoRecorderExt),
1.4002 + iImplementor(aImplementor)
1.4003 + {
1.4004 + }
1.4005 +
1.4006 +void CMMFVideoRecordControllerExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.4007 + {
1.4008 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoRecorderExt)
1.4009 + {
1.4010 + TRAPD(error, DoHandleRequestL(aMessage));
1.4011 + if (error)
1.4012 + {
1.4013 + aMessage.Complete(error);
1.4014 + }
1.4015 + }
1.4016 + else
1.4017 + {
1.4018 + aMessage.Complete(KErrNotSupported);
1.4019 + }
1.4020 + }
1.4021 +
1.4022 +void CMMFVideoRecordControllerExtCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.4023 + {
1.4024 + TBool complete = ETrue;
1.4025 + switch (aMessage.Function())
1.4026 + {
1.4027 + case EMMFVideoRecordControllerSetVideoEnabled:
1.4028 + complete = DoSetVideoEnabledL(aMessage);
1.4029 + break;
1.4030 + case EMMFVideoRecordControllerVideoEnabled:
1.4031 + complete = DoVideoEnabledL(aMessage);
1.4032 + break;
1.4033 + case EMMFVideoRecordControllerSetVideoQuality:
1.4034 + complete = DoSetVideoQualityL(aMessage);
1.4035 + break;
1.4036 + case EMMFVideoRecordControllerVideoQuality:
1.4037 + complete = DoVideoQualityL(aMessage);
1.4038 + break;
1.4039 + case EMMFVideoRecordControllerSetVideoFrameRateFixed:
1.4040 + complete = DoSetVideoFrameRateFixedL(aMessage);
1.4041 + break;
1.4042 + case EMMFVideoRecordControllerVideoFrameRateFixed:
1.4043 + complete = DoVideoFrameRateFixedL(aMessage);
1.4044 + break;
1.4045 + default:
1.4046 + User::Leave(KErrNotSupported);
1.4047 + break;
1.4048 + }
1.4049 + if (complete)
1.4050 + {
1.4051 + aMessage.Complete(KErrNone);
1.4052 + }
1.4053 + }
1.4054 +
1.4055 +TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoEnabledL(TMMFMessage& aMessage)
1.4056 + {
1.4057 + TPckgBuf<TBool> pckg;
1.4058 + aMessage.ReadData1FromClientL(pckg);
1.4059 + iImplementor.MvrecSetVideoEnabledL(pckg());
1.4060 +
1.4061 + return ETrue;
1.4062 + }
1.4063 +
1.4064 +TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoEnabledL(TMMFMessage& aMessage)
1.4065 + {
1.4066 + TPckgBuf<TInt> pckg;
1.4067 +
1.4068 + pckg() = iImplementor.MvrecVideoEnabledL();
1.4069 +
1.4070 + aMessage.WriteDataToClientL(pckg);
1.4071 +
1.4072 + return ETrue;
1.4073 + }
1.4074 +
1.4075 +TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoQualityL(TMMFMessage& aMessage)
1.4076 + {
1.4077 + TPckgBuf<TInt> pckg;
1.4078 + aMessage.ReadData1FromClientL(pckg);
1.4079 + iImplementor.MvrecSetVideoQualityL(pckg());
1.4080 +
1.4081 + return ETrue;
1.4082 + }
1.4083 +
1.4084 +TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoQualityL(TMMFMessage& aMessage)
1.4085 + {
1.4086 + TPckgBuf<TInt> pckg;
1.4087 +
1.4088 + pckg() = iImplementor.MvrecVideoQualityL();
1.4089 +
1.4090 + aMessage.WriteDataToClientL(pckg);
1.4091 +
1.4092 + return ETrue;
1.4093 + }
1.4094 +
1.4095 +TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoFrameRateFixedL(TMMFMessage& aMessage)
1.4096 + {
1.4097 + TPckgBuf<TBool> pckg;
1.4098 + aMessage.ReadData1FromClientL(pckg);
1.4099 + iImplementor.MvrecSetVideoFrameRateFixedL(pckg());
1.4100 +
1.4101 + return ETrue;
1.4102 + }
1.4103 +
1.4104 +TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoFrameRateFixedL(TMMFMessage& aMessage)
1.4105 + {
1.4106 + TPckgBuf<TBool> pckg;
1.4107 +
1.4108 + pckg() = iImplementor.MvrecVideoFrameRateFixedL();
1.4109 +
1.4110 + aMessage.WriteDataToClientL(pckg);
1.4111 + return ETrue;
1.4112 + }
1.4113 +
1.4114 +
1.4115 +EXPORT_C RMMFVideoRecordControllerExtCustomCommands::RMMFVideoRecordControllerExtCustomCommands(RMMFController& aController) :
1.4116 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoRecorderExt)
1.4117 + {
1.4118 + }
1.4119 +
1.4120 +EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoEnabled(TBool aEnabled)
1.4121 + {
1.4122 + TPckgBuf<TBool> pckg(aEnabled);
1.4123 + return iController.CustomCommandSync(iDestinationPckg,
1.4124 + EMMFVideoRecordControllerSetVideoEnabled,
1.4125 + pckg,
1.4126 + KNullDesC8);
1.4127 + }
1.4128 +
1.4129 +EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoEnabled(TBool &aEnabled) const
1.4130 + {
1.4131 + TPckgBuf<TBool> pckg(EFalse);
1.4132 + TInt error;
1.4133 +
1.4134 + error = iController.CustomCommandSync(iDestinationPckg,
1.4135 + EMMFVideoRecordControllerVideoEnabled,
1.4136 + KNullDesC8,
1.4137 + KNullDesC8,
1.4138 + pckg);
1.4139 + if (error == KErrNone)
1.4140 + {
1.4141 + aEnabled = pckg();
1.4142 + }
1.4143 + return error;
1.4144 + }
1.4145 +
1.4146 +EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoQuality(TInt aQuality)
1.4147 + {
1.4148 + TPckgBuf<TInt> pckg(aQuality);
1.4149 + return iController.CustomCommandSync(iDestinationPckg,
1.4150 + EMMFVideoRecordControllerSetVideoQuality,
1.4151 + pckg,
1.4152 + KNullDesC8);
1.4153 + }
1.4154 +
1.4155 +EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoQuality(TInt &aQuality) const
1.4156 + {
1.4157 + TPckgBuf<TInt> pckg;
1.4158 + TInt error;
1.4159 +
1.4160 + error = iController.CustomCommandSync(iDestinationPckg,
1.4161 + EMMFVideoRecordControllerVideoQuality,
1.4162 + KNullDesC8,
1.4163 + KNullDesC8,
1.4164 + pckg);
1.4165 + if (error == KErrNone)
1.4166 + {
1.4167 + aQuality = pckg();
1.4168 + }
1.4169 + return error;
1.4170 + }
1.4171 +
1.4172 +EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoFrameRateFixed(TBool aFixedFrameRate)
1.4173 + {
1.4174 + TPckgBuf<TBool> pckg(aFixedFrameRate);
1.4175 + return iController.CustomCommandSync(iDestinationPckg,
1.4176 + EMMFVideoRecordControllerSetVideoFrameRateFixed,
1.4177 + pckg,
1.4178 + KNullDesC8);
1.4179 + }
1.4180 +
1.4181 +EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoFrameRateFixed(TBool &aFixedFrameRate) const
1.4182 + {
1.4183 + TPckgBuf<TBool> pckg;
1.4184 + TInt error;
1.4185 +
1.4186 + error = iController.CustomCommandSync(iDestinationPckg,
1.4187 + EMMFVideoRecordControllerVideoFrameRateFixed,
1.4188 + KNullDesC8,
1.4189 + KNullDesC8,
1.4190 + pckg);
1.4191 + if (error == KErrNone)
1.4192 + {
1.4193 + aFixedFrameRate = pckg();
1.4194 + }
1.4195 + return error;
1.4196 + }
1.4197 +
1.4198 +EXPORT_C TMMFAudioSetRepeatsConfig::TMMFAudioSetRepeatsConfig()
1.4199 + :iRepeatNumberOfTimes(0), iTrailingSilence(0), iReserved1(0)
1.4200 + {
1.4201 + }
1.4202 +
1.4203 +EXPORT_C RMMFAudioPlayControllerSetRepeatsCustomCommands::RMMFAudioPlayControllerSetRepeatsCustomCommands(RMMFController& aController) :
1.4204 + RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlaySetRepeatsController)
1.4205 + {
1.4206 + }
1.4207 +
1.4208 +EXPORT_C TInt RMMFAudioPlayControllerSetRepeatsCustomCommands::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
1.4209 + {
1.4210 + TPckgBuf<TMMFAudioSetRepeatsConfig> configPackage;
1.4211 + configPackage().iRepeatNumberOfTimes = aRepeatNumberOfTimes;
1.4212 + configPackage().iTrailingSilence = aTrailingSilence;
1.4213 +
1.4214 + return iController.CustomCommandSync(iDestinationPckg,
1.4215 + EMMFAudioPlayControllerSetRepeats,
1.4216 + configPackage,
1.4217 + KNullDesC8);
1.4218 + }
1.4219 +
1.4220 +EXPORT_C CMMFAudioPlayControllerSetRepeatsCustomCommandParser* CMMFAudioPlayControllerSetRepeatsCustomCommandParser::NewL(MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor& aImplementor)
1.4221 + {
1.4222 + return new(ELeave) CMMFAudioPlayControllerSetRepeatsCustomCommandParser(aImplementor);
1.4223 + }
1.4224 +
1.4225 +CMMFAudioPlayControllerSetRepeatsCustomCommandParser::CMMFAudioPlayControllerSetRepeatsCustomCommandParser(MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor& aImplementor) :
1.4226 + CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlaySetRepeatsController), iImplementor(aImplementor)
1.4227 + {
1.4228 + }
1.4229 +
1.4230 +EXPORT_C CMMFAudioPlayControllerSetRepeatsCustomCommandParser::~CMMFAudioPlayControllerSetRepeatsCustomCommandParser()
1.4231 + {
1.4232 + }
1.4233 +
1.4234 +void CMMFAudioPlayControllerSetRepeatsCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
1.4235 + {
1.4236 + if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlaySetRepeatsController)
1.4237 + {
1.4238 + TRAPD(error, DoHandleRequestL(aMessage));
1.4239 + if (error)
1.4240 + {
1.4241 + aMessage.Complete(error);
1.4242 + }
1.4243 + }
1.4244 + else
1.4245 + {
1.4246 + aMessage.Complete(KErrNotSupported);
1.4247 + }
1.4248 + }
1.4249 +
1.4250 +void CMMFAudioPlayControllerSetRepeatsCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
1.4251 + {
1.4252 + TBool complete = ETrue;
1.4253 + switch (aMessage.Function())
1.4254 + {
1.4255 + case EMMFAudioPlayControllerSetRepeats:
1.4256 + complete = DoSetRepeatsL(aMessage);
1.4257 + break;
1.4258 + default:
1.4259 + User::Leave(KErrNotSupported);
1.4260 + break;
1.4261 + }
1.4262 + if (complete)
1.4263 + {
1.4264 + aMessage.Complete(KErrNone);
1.4265 + }
1.4266 + }
1.4267 +
1.4268 +TBool CMMFAudioPlayControllerSetRepeatsCustomCommandParser::DoSetRepeatsL(TMMFMessage& aMessage)
1.4269 + {
1.4270 + TPckgBuf<TMMFAudioSetRepeatsConfig> pckg;
1.4271 + aMessage.ReadData1FromClientL(pckg);
1.4272 + User::LeaveIfError(iImplementor.MapcSetRepeats(pckg().iRepeatNumberOfTimes, pckg().iTrailingSilence));
1.4273 + return ETrue;
1.4274 + }