os/mm/devsoundextensions/mmextfw/customcommandutility/src/CustomCommandUtility.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:    Custom command utility implementation
    15 *
    16 */
    17 
    18 
    19 
    20 #include <mdaaudiosampleplayer.h>
    21 #include <mdaaudiosampleeditor.h>
    22 #include <midiclientutility.h>
    23 #include <DrmAudioSamplePlayer.h>
    24 #include <CustomCommandUtility.h>
    25 #include <videoplayer.h>
    26 #include <videorecorder.h>
    27 
    28 class CConvertCustomCommandUtility : public CCustomCommandUtility
    29 	{
    30 public:
    31 	CConvertCustomCommandUtility(CMdaAudioConvertUtility& aUtility) :
    32 		iUtility(aUtility)
    33 		{
    34 		}
    35 
    36 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
    37 	                                     TInt                         aFunction,
    38 	                               const TDesC8&                      aDataTo1,
    39 	                               const TDesC8&                      aDataTo2,
    40 	                                     TDes8&                       aDataFrom)
    41 		{
    42 		return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
    43 		}
    44 
    45 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
    46 	                                     TInt                         aFunction,
    47 	                               const TDesC8&                      aDataTo1,
    48 	                               const TDesC8&                      aDataTo2)
    49 		{
    50 		return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
    51 		}
    52 
    53 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
    54 	                                      TInt                        aFunction,
    55 	                                const TDesC8&                     aDataTo1,
    56 	                                const TDesC8&                     aDataTo2,
    57 	                                      TDes8&                      aDataFrom,
    58 	                                      TRequestStatus&             aStatus)
    59 		{
    60 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
    61 		}
    62 
    63 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
    64 	                                      TInt                        aFunction,
    65 	                                const TDesC8&                     aDataTo1,
    66 	                                const TDesC8&                     aDataTo2,
    67 	                                      TRequestStatus&             aStatus)
    68 		{
    69 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
    70 		}
    71 
    72 private:
    73 	CMdaAudioConvertUtility& iUtility;
    74 
    75 	};
    76 
    77 class CPlayerCustomCommandUtility : public CCustomCommandUtility
    78 	{
    79 public:
    80 	CPlayerCustomCommandUtility(CMdaAudioPlayerUtility& aUtility) :
    81 		iUtility(aUtility)
    82 		{
    83 		}
    84 
    85 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
    86 	                                     TInt                         aFunction,
    87 	                               const TDesC8&                      aDataTo1,
    88 	                               const TDesC8&                      aDataTo2,
    89 	                                     TDes8&                       aDataFrom)
    90 		{
    91 		return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
    92 		}
    93 
    94 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
    95 	                                     TInt                         aFunction,
    96 	                               const TDesC8&                      aDataTo1,
    97 	                               const TDesC8&                      aDataTo2)
    98 		{
    99 		return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
   100 		}
   101 
   102 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   103 	                                      TInt                        aFunction,
   104 	                                const TDesC8&                     aDataTo1,
   105 	                                const TDesC8&                     aDataTo2,
   106 	                                      TDes8&                      aDataFrom,
   107 	                                      TRequestStatus&             aStatus)
   108 		{
   109 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
   110 		}
   111 
   112 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   113 	                                      TInt                        aFunction,
   114 	                                const TDesC8&                     aDataTo1,
   115 	                                const TDesC8&                     aDataTo2,
   116 	                                      TRequestStatus&             aStatus)
   117 		{
   118 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
   119 		}
   120 
   121 private:
   122 	CMdaAudioPlayerUtility& iUtility;
   123 
   124 	};
   125 
   126 class CRecorderCustomCommandUtility : public CCustomCommandUtility
   127 	{
   128 public:
   129 	CRecorderCustomCommandUtility(CMdaAudioRecorderUtility& aUtility) :
   130 		iUtility(aUtility)
   131 		{
   132 		}
   133 
   134 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   135 	                                     TInt                         aFunction,
   136 	                               const TDesC8&                      aDataTo1,
   137 	                               const TDesC8&                      aDataTo2,
   138 	                                     TDes8&                       aDataFrom)
   139 		{
   140 		return iUtility.RecordControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
   141 		}
   142 
   143 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   144 	                                     TInt                         aFunction,
   145 	                               const TDesC8&                      aDataTo1,
   146 	                               const TDesC8&                      aDataTo2)
   147 		{
   148 		return iUtility.RecordControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
   149 		}
   150 
   151 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   152 	                                      TInt                        aFunction,
   153 	                                const TDesC8&                     aDataTo1,
   154 	                                const TDesC8&                     aDataTo2,
   155 	                                      TDes8&                      aDataFrom,
   156 	                                      TRequestStatus&             aStatus)
   157 		{
   158 		iUtility.RecordControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
   159 		}
   160 
   161 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   162 	                                      TInt                        aFunction,
   163 	                                const TDesC8&                     aDataTo1,
   164 	                                const TDesC8&                     aDataTo2,
   165 	                                      TRequestStatus&             aStatus)
   166 		{
   167 		iUtility.RecordControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
   168 		}
   169 
   170 private:
   171 	CMdaAudioRecorderUtility& iUtility;
   172 
   173 	};
   174 
   175 class CRecorderPlayCustomCommandUtility : public CCustomCommandUtility
   176 	{
   177 public:
   178 	CRecorderPlayCustomCommandUtility(CMdaAudioRecorderUtility& aUtility) :
   179 		iUtility(aUtility)
   180 		{
   181 		}
   182 
   183 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   184 	                                     TInt                         aFunction,
   185 	                               const TDesC8&                      aDataTo1,
   186 	                               const TDesC8&                      aDataTo2,
   187 	                                     TDes8&                       aDataFrom)
   188 		{
   189 		return iUtility.PlayControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
   190 		}
   191 
   192 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   193 	                                     TInt                         aFunction,
   194 	                               const TDesC8&                      aDataTo1,
   195 	                               const TDesC8&                      aDataTo2)
   196 		{
   197 		return iUtility.PlayControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
   198 		}
   199 
   200 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   201 	                                      TInt                        aFunction,
   202 	                                const TDesC8&                     aDataTo1,
   203 	                                const TDesC8&                     aDataTo2,
   204 	                                      TDes8&                      aDataFrom,
   205 	                                      TRequestStatus&             aStatus)
   206 		{
   207 		iUtility.PlayControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
   208 		}
   209 
   210 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   211 	                                      TInt                        aFunction,
   212 	                                const TDesC8&                     aDataTo1,
   213 	                                const TDesC8&                     aDataTo2,
   214 	                                      TRequestStatus&             aStatus)
   215 		{
   216 		iUtility.PlayControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
   217 		}
   218 
   219 private:
   220 	CMdaAudioRecorderUtility& iUtility;
   221 
   222 	};
   223 
   224 class CMidiCustomCommandUtility : public CCustomCommandUtility
   225 	{
   226 public:
   227 	CMidiCustomCommandUtility(CMidiClientUtility& aUtility) :
   228 		iUtility(aUtility)
   229 		{
   230 		}
   231 
   232 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   233 	                                     TInt                         aFunction,
   234 	                               const TDesC8&                      aDataTo1,
   235 	                               const TDesC8&                      aDataTo2,
   236 	                                     TDes8&                       aDataFrom)
   237 		{
   238 		iUtility.CustomCommandSyncL(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
   239 		return KErrNone;
   240 		}
   241 
   242 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   243 	                                     TInt                         aFunction,
   244 	                               const TDesC8&                      aDataTo1,
   245 	                               const TDesC8&                      aDataTo2)
   246 		{
   247 		iUtility.CustomCommandSyncL(aDestination, aFunction, aDataTo1, aDataTo2);
   248 		return KErrNone;
   249 		}
   250 
   251 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   252 	                                      TInt                        aFunction,
   253 	                                const TDesC8&                     aDataTo1,
   254 	                                const TDesC8&                     aDataTo2,
   255 	                                      TDes8&                      aDataFrom,
   256 	                                      TRequestStatus&             aStatus)
   257 		{
   258 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
   259 		}
   260 
   261 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   262 	                                      TInt                        aFunction,
   263 	                                const TDesC8&                     aDataTo1,
   264 	                                const TDesC8&                     aDataTo2,
   265 	                                      TRequestStatus&             aStatus)
   266 		{
   267 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
   268 		}
   269 
   270 private:
   271 	CMidiClientUtility& iUtility;
   272 	};
   273 
   274 class CDrmCustomCommandUtility : public CCustomCommandUtility
   275 	{
   276 public:
   277 	CDrmCustomCommandUtility(CDrmPlayerUtility& aUtility) :
   278 		iUtility(aUtility)
   279 		{
   280 		}
   281 
   282     virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   283 	                                     TInt                         aFunction,
   284 	                               const TDesC8&                      aDataTo1,
   285 	                               const TDesC8&                      aDataTo2,
   286 	                                     TDes8&                       aDataFrom)
   287 		{
   288 		iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
   289 		return KErrNone;
   290 		}
   291 
   292 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   293 	                                     TInt                         aFunction,
   294 	                               const TDesC8&                      aDataTo1,
   295 	                               const TDesC8&                      aDataTo2)
   296 		{
   297 		iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
   298 		return KErrNone;
   299 		}
   300 
   301 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   302 	                                      TInt                        aFunction,
   303 	                                const TDesC8&                     aDataTo1,
   304 	                                const TDesC8&                     aDataTo2,
   305 	                                      TDes8&                      aDataFrom,
   306 	                                      TRequestStatus&             aStatus)
   307 		{
   308 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
   309 		}
   310 
   311 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   312 	                                      TInt                        aFunction,
   313 	                                const TDesC8&                     aDataTo1,
   314 	                                const TDesC8&                     aDataTo2,
   315 	                                      TRequestStatus&             aStatus)
   316 		{
   317 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
   318 		}
   319 
   320 private:
   321 	CDrmPlayerUtility& iUtility;
   322 	};
   323 
   324 class CVideoRecorderCustomCommandUtility : public CCustomCommandUtility
   325 	{
   326 public:
   327 	CVideoRecorderCustomCommandUtility(CVideoRecorderUtility& aUtility) :
   328 		iUtility(aUtility)
   329 		{
   330 		}
   331 
   332     virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   333 	                                     TInt                         aFunction,
   334 	                               const TDesC8&                      aDataTo1,
   335 	                               const TDesC8&                      aDataTo2,
   336 	                                     TDes8&                       aDataFrom)
   337 		{
   338 		iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
   339 		return KErrNone;
   340 		}
   341 
   342 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   343 	                                     TInt                         aFunction,
   344 	                               const TDesC8&                      aDataTo1,
   345 	                               const TDesC8&                      aDataTo2)
   346 		{
   347 		iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
   348 		return KErrNone;
   349 		}
   350 
   351 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   352 	                                      TInt                        aFunction,
   353 	                                const TDesC8&                     aDataTo1,
   354 	                                const TDesC8&                     aDataTo2,
   355 	                                      TDes8&                      aDataFrom,
   356 	                                      TRequestStatus&             aStatus)
   357 		{
   358 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
   359 		}
   360 
   361 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   362 	                                      TInt                        aFunction,
   363 	                                const TDesC8&                     aDataTo1,
   364 	                                const TDesC8&                     aDataTo2,
   365 	                                      TRequestStatus&             aStatus)
   366 		{
   367 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
   368 		}
   369 
   370 private:
   371 	CVideoRecorderUtility& iUtility;
   372 	};
   373 
   374 class CVideoPlayerCustomCommandUtility : public CCustomCommandUtility
   375 	{
   376 public:
   377 	CVideoPlayerCustomCommandUtility(CVideoPlayerUtility& aUtility) :
   378 		iUtility(aUtility)
   379 		{
   380 		}
   381 
   382     virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   383 	                                     TInt                         aFunction,
   384 	                               const TDesC8&                      aDataTo1,
   385 	                               const TDesC8&                      aDataTo2,
   386 	                                     TDes8&                       aDataFrom)
   387 		{
   388 		iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
   389 		return KErrNone;
   390 		}
   391 
   392 	virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg&  aDestination,
   393 	                                     TInt                         aFunction,
   394 	                               const TDesC8&                      aDataTo1,
   395 	                               const TDesC8&                      aDataTo2)
   396 		{
   397 		iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
   398 		return KErrNone;
   399 		}
   400 
   401 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   402 	                                      TInt                        aFunction,
   403 	                                const TDesC8&                     aDataTo1,
   404 	                                const TDesC8&                     aDataTo2,
   405 	                                      TDes8&                      aDataFrom,
   406 	                                      TRequestStatus&             aStatus)
   407 		{
   408 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
   409 		}
   410 
   411 	virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
   412 	                                      TInt                        aFunction,
   413 	                                const TDesC8&                     aDataTo1,
   414 	                                const TDesC8&                     aDataTo2,
   415 	                                      TRequestStatus&             aStatus)
   416 		{
   417 		iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
   418 		}
   419 
   420 private:
   421 	CVideoPlayerUtility& iUtility;
   422 	};
   423 
   424 
   425 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMdaAudioConvertUtility& aUtility)
   426 	{
   427 	CCustomCommandUtility* customCommand;
   428 
   429 	customCommand = new(ELeave) CConvertCustomCommandUtility(aUtility);
   430 
   431 	return customCommand;
   432 	}
   433 
   434 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMdaAudioPlayerUtility& aUtility)
   435 	{
   436 	CCustomCommandUtility* customCommand;
   437 
   438 	customCommand = new(ELeave) CPlayerCustomCommandUtility(aUtility);
   439 
   440 	return customCommand;
   441 	}
   442 
   443 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMdaAudioRecorderUtility& aUtility,
   444                                                             TBool       aRecordStream)
   445 	{
   446 	CCustomCommandUtility* customCommand;
   447 
   448 	if( !aRecordStream ) //Playing
   449 		{
   450 		customCommand = new(ELeave) CRecorderPlayCustomCommandUtility(aUtility);
   451 		}
   452 	else //Recording
   453 		{
   454 		customCommand = new(ELeave) CRecorderCustomCommandUtility(aUtility);
   455 		}
   456 
   457 	return customCommand;
   458 	}
   459 
   460 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMidiClientUtility& aUtility)
   461 	{
   462 	CCustomCommandUtility* customCommand;
   463 
   464 	customCommand = new(ELeave) CMidiCustomCommandUtility(aUtility);
   465 
   466 	return customCommand;
   467 	}
   468 
   469 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CDrmPlayerUtility& aUtility)
   470 	{
   471 	CCustomCommandUtility* customCommand;
   472 
   473 	customCommand = new(ELeave) CDrmCustomCommandUtility(aUtility);
   474 
   475 	return customCommand;
   476 	}
   477 
   478 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CVideoPlayerUtility& aUtility)
   479 	{
   480 	CCustomCommandUtility* customCommand;
   481 
   482 	customCommand = new(ELeave) CVideoPlayerCustomCommandUtility(aUtility);
   483 
   484 	return customCommand;
   485 	}
   486 
   487 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CVideoRecorderUtility& aUtility)
   488 	{
   489 	CCustomCommandUtility* customCommand;
   490 
   491 	customCommand = new(ELeave) CVideoRecorderCustomCommandUtility(aUtility);
   492 
   493 	return customCommand;
   494 	}	
   495 // ========================== OTHER EXPORTED FUNCTIONS =========================
   496 
   497 
   498 
   499 // End of File