os/mm/devsoundextensions/mmextfw/customcommandutility/src/CustomCommandUtility.cpp
First public contribution.
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Custom command utility implementation
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>
28 class CConvertCustomCommandUtility : public CCustomCommandUtility
31 CConvertCustomCommandUtility(CMdaAudioConvertUtility& aUtility) :
36 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
38 const TDesC8& aDataTo1,
39 const TDesC8& aDataTo2,
42 return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
45 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
47 const TDesC8& aDataTo1,
48 const TDesC8& aDataTo2)
50 return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
53 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
55 const TDesC8& aDataTo1,
56 const TDesC8& aDataTo2,
58 TRequestStatus& aStatus)
60 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
63 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
65 const TDesC8& aDataTo1,
66 const TDesC8& aDataTo2,
67 TRequestStatus& aStatus)
69 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
73 CMdaAudioConvertUtility& iUtility;
77 class CPlayerCustomCommandUtility : public CCustomCommandUtility
80 CPlayerCustomCommandUtility(CMdaAudioPlayerUtility& aUtility) :
85 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
87 const TDesC8& aDataTo1,
88 const TDesC8& aDataTo2,
91 return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
94 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
96 const TDesC8& aDataTo1,
97 const TDesC8& aDataTo2)
99 return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
102 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
104 const TDesC8& aDataTo1,
105 const TDesC8& aDataTo2,
107 TRequestStatus& aStatus)
109 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
112 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
114 const TDesC8& aDataTo1,
115 const TDesC8& aDataTo2,
116 TRequestStatus& aStatus)
118 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
122 CMdaAudioPlayerUtility& iUtility;
126 class CRecorderCustomCommandUtility : public CCustomCommandUtility
129 CRecorderCustomCommandUtility(CMdaAudioRecorderUtility& aUtility) :
134 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
136 const TDesC8& aDataTo1,
137 const TDesC8& aDataTo2,
140 return iUtility.RecordControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
143 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
145 const TDesC8& aDataTo1,
146 const TDesC8& aDataTo2)
148 return iUtility.RecordControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
151 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
153 const TDesC8& aDataTo1,
154 const TDesC8& aDataTo2,
156 TRequestStatus& aStatus)
158 iUtility.RecordControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
161 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
163 const TDesC8& aDataTo1,
164 const TDesC8& aDataTo2,
165 TRequestStatus& aStatus)
167 iUtility.RecordControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
171 CMdaAudioRecorderUtility& iUtility;
175 class CRecorderPlayCustomCommandUtility : public CCustomCommandUtility
178 CRecorderPlayCustomCommandUtility(CMdaAudioRecorderUtility& aUtility) :
183 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
185 const TDesC8& aDataTo1,
186 const TDesC8& aDataTo2,
189 return iUtility.PlayControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
192 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
194 const TDesC8& aDataTo1,
195 const TDesC8& aDataTo2)
197 return iUtility.PlayControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
200 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
202 const TDesC8& aDataTo1,
203 const TDesC8& aDataTo2,
205 TRequestStatus& aStatus)
207 iUtility.PlayControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
210 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
212 const TDesC8& aDataTo1,
213 const TDesC8& aDataTo2,
214 TRequestStatus& aStatus)
216 iUtility.PlayControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
220 CMdaAudioRecorderUtility& iUtility;
224 class CMidiCustomCommandUtility : public CCustomCommandUtility
227 CMidiCustomCommandUtility(CMidiClientUtility& aUtility) :
232 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
234 const TDesC8& aDataTo1,
235 const TDesC8& aDataTo2,
238 iUtility.CustomCommandSyncL(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
242 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
244 const TDesC8& aDataTo1,
245 const TDesC8& aDataTo2)
247 iUtility.CustomCommandSyncL(aDestination, aFunction, aDataTo1, aDataTo2);
251 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
253 const TDesC8& aDataTo1,
254 const TDesC8& aDataTo2,
256 TRequestStatus& aStatus)
258 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
261 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
263 const TDesC8& aDataTo1,
264 const TDesC8& aDataTo2,
265 TRequestStatus& aStatus)
267 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
271 CMidiClientUtility& iUtility;
274 class CDrmCustomCommandUtility : public CCustomCommandUtility
277 CDrmCustomCommandUtility(CDrmPlayerUtility& aUtility) :
282 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
284 const TDesC8& aDataTo1,
285 const TDesC8& aDataTo2,
288 iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
292 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
294 const TDesC8& aDataTo1,
295 const TDesC8& aDataTo2)
297 iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
301 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
303 const TDesC8& aDataTo1,
304 const TDesC8& aDataTo2,
306 TRequestStatus& aStatus)
308 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
311 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
313 const TDesC8& aDataTo1,
314 const TDesC8& aDataTo2,
315 TRequestStatus& aStatus)
317 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
321 CDrmPlayerUtility& iUtility;
324 class CVideoRecorderCustomCommandUtility : public CCustomCommandUtility
327 CVideoRecorderCustomCommandUtility(CVideoRecorderUtility& aUtility) :
332 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
334 const TDesC8& aDataTo1,
335 const TDesC8& aDataTo2,
338 iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
342 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
344 const TDesC8& aDataTo1,
345 const TDesC8& aDataTo2)
347 iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
351 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
353 const TDesC8& aDataTo1,
354 const TDesC8& aDataTo2,
356 TRequestStatus& aStatus)
358 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
361 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
363 const TDesC8& aDataTo1,
364 const TDesC8& aDataTo2,
365 TRequestStatus& aStatus)
367 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
371 CVideoRecorderUtility& iUtility;
374 class CVideoPlayerCustomCommandUtility : public CCustomCommandUtility
377 CVideoPlayerCustomCommandUtility(CVideoPlayerUtility& aUtility) :
382 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
384 const TDesC8& aDataTo1,
385 const TDesC8& aDataTo2,
388 iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
392 virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
394 const TDesC8& aDataTo1,
395 const TDesC8& aDataTo2)
397 iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
401 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
403 const TDesC8& aDataTo1,
404 const TDesC8& aDataTo2,
406 TRequestStatus& aStatus)
408 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
411 virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination,
413 const TDesC8& aDataTo1,
414 const TDesC8& aDataTo2,
415 TRequestStatus& aStatus)
417 iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
421 CVideoPlayerUtility& iUtility;
425 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMdaAudioConvertUtility& aUtility)
427 CCustomCommandUtility* customCommand;
429 customCommand = new(ELeave) CConvertCustomCommandUtility(aUtility);
431 return customCommand;
434 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMdaAudioPlayerUtility& aUtility)
436 CCustomCommandUtility* customCommand;
438 customCommand = new(ELeave) CPlayerCustomCommandUtility(aUtility);
440 return customCommand;
443 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMdaAudioRecorderUtility& aUtility,
446 CCustomCommandUtility* customCommand;
448 if( !aRecordStream ) //Playing
450 customCommand = new(ELeave) CRecorderPlayCustomCommandUtility(aUtility);
454 customCommand = new(ELeave) CRecorderCustomCommandUtility(aUtility);
457 return customCommand;
460 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMidiClientUtility& aUtility)
462 CCustomCommandUtility* customCommand;
464 customCommand = new(ELeave) CMidiCustomCommandUtility(aUtility);
466 return customCommand;
469 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CDrmPlayerUtility& aUtility)
471 CCustomCommandUtility* customCommand;
473 customCommand = new(ELeave) CDrmCustomCommandUtility(aUtility);
475 return customCommand;
478 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CVideoPlayerUtility& aUtility)
480 CCustomCommandUtility* customCommand;
482 customCommand = new(ELeave) CVideoPlayerCustomCommandUtility(aUtility);
484 return customCommand;
487 EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CVideoRecorderUtility& aUtility)
489 CCustomCommandUtility* customCommand;
491 customCommand = new(ELeave) CVideoRecorderCustomCommandUtility(aUtility);
493 return customCommand;
495 // ========================== OTHER EXPORTED FUNCTIONS =========================