Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "mmfcontroller.h"
17 #include "mmfcontrollerpluginresolver.h"
19 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
20 #include <mmf/common/mmfcontrollerextendeddata.h>
21 #include <mmf/common/mmfcustomcommandparsermanager.h>
29 EXPORT_C RMMFController::RMMFController() :
30 iDestinationPckg(TMMFMessageDestination(KUidInterfaceMMFController, KMMFObjectHandleController))
35 Loads a controller plugin by specifying the UID of the plugin to load.
37 Creates a new thread and loads the specified controller into the new thread. Use the classes
38 CMMFControllerPluginSelectionParameters and CMMFFormatSelectionParamters
39 to find the uid of the controller to load.
42 The UID of the controller plugin to be loaded.
43 @param aPrioritySettings
44 The priority settings for this plugin, used by the policy
45 component to arbitrate between different controllers that are
46 attempting to use the same hardware resource simultaneously.
48 If this value is EFalse each controller is created with its own heap. The alternative,
49 if the value is ETrue, is that controllers share a special heap with other controllers
50 created the same way. Each heap uses a chunk, so this avoids situations where the
51 number of chunks per process is limited. The default behaviour is generally to be
52 preferred, and should give lower overall memory usage. However, if many controllers are
53 to be created for a particular thread, then ETrue should be provided to prevent running
54 out of heaps or chunks.
56 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
57 another of the system-wide error codes.
59 @see CMMFControllerPluginSelectionParamters
63 EXPORT_C TInt RMMFController::Open(TUid aControllerUid, const TMMFPrioritySettings& aPrioritySettings, TBool aUseSharedHeap)
66 TInt err = iControllerProxy.LoadController(aControllerUid, aUseSharedHeap);
69 err = SetPrioritySettings(aPrioritySettings);
75 Loads a controller plugin by specifying a CMMFControllerImplementationInformation object.
77 CMMFControllerImplementationInformation is passed as a parameter to allow
78 the controller thread's heap size to be determined without a further query to ECOM.
80 The function creates a new thread and loads the specified controller into the new thread. The classes
81 CMMFControllerPluginSelectionParameters and CMMFFormatSelectionParamters are used
82 to find the UID of the controller to load.
84 @param aControllerInfo
85 A reference to a CMMFControllerImplementationInformation object
86 used for determining the controller's UID & heap size
87 @param aPrioritySettings
88 The priority settings for this plugin, used by the policy
89 component to arbitrate between different controllers that are
90 attempting to use the same hardware resource simultaneously.
92 If this value is EFalse each controller is created with its own heap. The alternative,
93 if the value is ETrue, is that controllers share a special heap with other controllers
94 created the same way. Each heap uses a chunk, so this avoids situations where the
95 number of chunks per process is limited. The default behaviour is generally to be
96 preferred, and should give lower overall memory usage. However, if many controllers are
97 to be created for a particular thread, then ETrue should be provided to prevent running
98 out of heaps or chunks.
100 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
101 another of the system-wide error codes.
103 @see CMMFControllerPluginSelectionParamters
107 EXPORT_C TInt RMMFController::Open(
108 const CMMFControllerImplementationInformation& aControllerInfo,
109 const TMMFPrioritySettings& aPrioritySettings,
110 TBool aUseSharedHeap)
113 TInt err = iControllerProxy.LoadController(aControllerInfo, aUseSharedHeap);
115 err = SetPrioritySettings(aPrioritySettings);
120 Loads a controller plugin by specifying the UID of the plugin to load.
122 Creates a new thread and loads the specified controller into the new thread. Use the classes
123 CMMFControllerPluginSelectionParameters and CMMFFormatSelectionParamters
124 to find the uid of the controller to load.
125 This version of Open() will give each controller its own heap which will consume one chunk. Use the
126 overloaded version of Open() to create controllers that share a single heap.
128 @param aControllerUid
129 The UID of the controller plugin to be loaded.
130 @param aPrioritySettings
131 The priority settings for this plugin, used by the policy
132 component to arbitrate between different controllers that are
133 attempting to use the same hardware resource simultaneously.
135 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
136 another of the system-wide error codes.
138 @see CMMFControllerPluginSelectionParamters
142 EXPORT_C TInt RMMFController::Open(TUid aControllerUid, const TMMFPrioritySettings& aPrioritySettings)
145 return Open( aControllerUid, aPrioritySettings, EFalse ); // give controllers their own heaps
149 Loads a controller plugin by specifying a CMMFControllerImplementationInformation object.
151 CMMFControllerImplementationInformation is passed as a parameter to allow
152 the controller thread's heap size to be determined without a further query to ECOM.
154 The function creates a new thread and loads the specified controller into the new thread. The classes
155 CMMFControllerPluginSelectionParameters and CMMFFormatSelectionParamters are used
156 to find the UID of the controller to load.
157 This version of Open() will give each controller its own heap which will consume one chunk. Use the
158 overloaded version of Open() to create controllers that share a single heap.
160 @param aControllerInfo
161 A reference to a CMMFControllerImplementationInformation object
162 used for determining the controller's UID & heap size
163 @param aPrioritySettings
164 The priority settings for this plugin, used by the policy
165 component to arbitrate between different controllers that are
166 attempting to use the same hardware resource simultaneously.
168 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
169 another of the system-wide error codes.
171 @see CMMFControllerPluginSelectionParamters
175 EXPORT_C TInt RMMFController::Open(
176 const CMMFControllerImplementationInformation& aControllerInfo,
177 const TMMFPrioritySettings& aPrioritySettings)
180 return Open( aControllerInfo, aPrioritySettings, EFalse ); // give controllers their own heaps
184 Same as RMMFController::Open(TUid, const TMMFPrioritySettings&) which loads a controller plugin by
185 specifying the UID of the plugin to load, except that this is expected to be called by user thread
186 without DRM Capability.
188 Creates a new thread through DRM Plugin Server and loads the specified controller into the new thread.
189 Use the classes CMMFControllerPluginSelectionParameters and CMMFFormatSelectionParamters
190 to find the uid of the controller to load.
191 This version of Open() will give each controller its own heap which will consume one chunk. Use the
192 overloaded version of Open() to create controllers that share a single heap.
194 @param aControllerUid
195 The UID of the controller plugin to be loaded.
196 @param aPrioritySettings
197 The priority settings for this plugin, used by the policy
198 component to arbitrate between different controllers that are
199 attempting to use the same hardware resource simultaneously.
201 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
202 another of the system-wide error codes.
204 @see CMMFControllerPluginSelectionParamters
207 EXPORT_C TInt RMMFController::OpenInSecureDRMProcess(TUid aControllerUid, const TMMFPrioritySettings& aPrioritySettings)
209 return OpenInSecureDRMProcess(aControllerUid, aPrioritySettings, EFalse);
213 Same as Open(const CMMFControllerImplementationInformation&, const TMMFPrioritySettings&) which loads a
214 controller plugin by specifying a CMMFControllerImplementationInformation object.
216 CMMFControllerImplementationInformation is passed as a parameter to allow
217 the controller thread's heap size to be determined without a further query to ECOM.
219 The function creates a new thread through DRM Plugin server and loads the specified controller into
220 the new thread. The classes CMMFControllerPluginSelectionParameters and CMMFFormatSelectionParamters are used
221 to find the UID of the controller to load.
222 This version of Open() will give each controller its own heap which will consume one chunk. Use the
223 overloaded version of Open() to create controllers that share a single heap.
225 @param aControllerInfo
226 A reference to a CMMFControllerImplementationInformation object
227 used for determining the controller's UID & heap size
228 @param aPrioritySettings
229 The priority settings for this plugin, used by the policy
230 component to arbitrate between different controllers that are
231 attempting to use the same hardware resource simultaneously.
233 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
234 another of the system-wide error codes.
236 @see CMMFControllerPluginSelectionParamters
239 EXPORT_C TInt RMMFController::OpenInSecureDRMProcess(const CMMFControllerImplementationInformation& aControllerInfo, const TMMFPrioritySettings& aPrioritySettings)
241 return OpenInSecureDRMProcess(aControllerInfo, aPrioritySettings, EFalse);
245 Same as RMMFController::Open(TUid, const TMMFPrioritySettings&, TBool) which loads a controller
246 plugin by specifying the UID of the plugin to load, except that this is expected to be called by user thread
247 without DRM Capability.
249 Creates a new thread through DRM Plugin server and loads the specified controller into the new thread.
250 Use the classes CMMFControllerPluginSelectionParameters and CMMFFormatSelectionParamters
251 to find the uid of the controller to load.
253 @param aControllerUid
254 The UID of the controller plugin to be loaded.
255 @param aPrioritySettings
256 The priority settings for this plugin, used by the policy
257 component to arbitrate between different controllers that are
258 attempting to use the same hardware resource simultaneously.
259 @param aUseSharedHeap
260 If this value is EFalse each controller is created with its own heap. The alternative,
261 if the value is ETrue, is that controllers share a special heap with other controllers
262 created the same way. Each heap uses a chunk, so this avoids situations where the
263 number of chunks per process is limited. The default behaviour is generally to be
264 preferred, and should give lower overall memory usage. However, if many controllers are
265 to be created for a particular thread, then ETrue should be provided to prevent running
266 out of heaps or chunks.
268 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
269 another of the system-wide error codes.
271 @see CMMFControllerPluginSelectionParamters
274 EXPORT_C TInt RMMFController::OpenInSecureDRMProcess(TUid aControllerUid, const TMMFPrioritySettings& aPrioritySettings, TBool aUseSharedHeap )
277 TInt err = iControllerProxy.LoadControllerInSecureDRMProcess(aControllerUid, aUseSharedHeap);
280 err = SetPrioritySettings(aPrioritySettings);
286 Same as Open(const CMMFControllerImplementationInformation&, const TMMFPrioritySettings&, TBool) which
287 loads a controller plugin by specifying a CMMFControllerImplementationInformation object.
289 CMMFControllerImplementationInformation is passed as a parameter to allow
290 the controller thread's heap size to be determined without a further query to ECOM.
292 The function creates a new thread through DRM Plugin Server and loads the specified controller into
293 the new thread. The classes CMMFControllerPluginSelectionParameters and CMMFFormatSelectionParamters are used
294 to find the UID of the controller to load.
296 @param aControllerInfo
297 A reference to a CMMFControllerImplementationInformation object
298 used for determining the controller's UID & heap size
299 @param aPrioritySettings
300 The priority settings for this plugin, used by the policy
301 component to arbitrate between different controllers that are
302 attempting to use the same hardware resource simultaneously.
303 @param aUseSharedHeap
304 If this value is EFalse each controller is created with its own heap. The alternative,
305 if the value is ETrue, is that controllers share a special heap with other controllers
306 created the same way. Each heap uses a chunk, so this avoids situations where the
307 number of chunks per process is limited. The default behaviour is generally to be
308 preferred, and should give lower overall memory usage. However, if many controllers are
309 to be created for a particular thread, then ETrue should be provided to prevent running
310 out of heaps or chunks.
312 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
313 another of the system-wide error codes.
315 @see CMMFControllerPluginSelectionParamters
318 EXPORT_C TInt RMMFController::OpenInSecureDRMProcess(const CMMFControllerImplementationInformation& aControllerInfo, const TMMFPrioritySettings& aPrioritySettings, TBool aUseSharedHeap )
321 TInt err = iControllerProxy.LoadControllerInSecureDRMProcess(aControllerInfo, aUseSharedHeap);
323 err = SetPrioritySettings(aPrioritySettings);
329 Closes the controller plugin.
331 Calling this method will unload the controller plugin and close down the controller thread.
335 EXPORT_C void RMMFController::Close()
337 iControllerProxy.Close();
341 Sets the priority settings for this controller.
343 @param aPrioritySettings
344 The priority settings for this plugin, used by the policy
345 component to arbitrate between different controllers that are
346 attempting to use the same hardware resource simultaneously.
348 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
349 another of the system-wide error codes.
353 EXPORT_C TInt RMMFController::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) const
355 TMMFPrioritySettingsPckg pckg(aPrioritySettings);
356 return iControllerProxy.SendSync(iDestinationPckg,
357 EMMFControllerSetPrioritySettings,
363 Adds a data source to the controller.
365 A typical data source would be a file, descriptor, audio input (microphone) or camera.
366 A controller plugin may require multiple data sources to be added (for example a video
367 recorder controller would require two); the exact number is plugin-specific.
368 Data sources are plugins themselves, and are loaded by the controller framework
369 inside the controller thread.
372 The uid of the data source to be added. For more information,
373 see the documentation for the data source you wish to add.
374 @param aSourceInitData
375 The data used to initialise the data source. The exact contents
376 of this data are dependent on the type of data source. For more
377 information, see the documentation for the data source you wish
380 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
381 another of the system-wide error codes.
384 EXPORT_C TInt RMMFController::AddDataSource(TUid aSourceUid, const TDesC8& aSourceInitData)
386 TMMFMessageDestination handleInfo;
387 return AddDataSource(aSourceUid, aSourceInitData, handleInfo);
391 Adds a data sink to the controller.
393 A typical data sink would be a file, descriptor, audio output (speaker) or display.
394 A controller plugin may require multiple data sinks to be added (for example a video
395 playing controller would require two); the exact number is plugin-specific.
396 Data sinks are plugins themselves, and are loaded by the controller framework
397 inside the controller thread.
400 The UID of the data sink to be added. For more information,
401 see the documentation for the data sink you wish to add.
403 The data used to initialise the data sink. The exact contents
404 of this data are dependent on the type of data sink. For more
405 information, see the documentation for the data sink you wish
408 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
409 another of the system-wide error codes.
412 EXPORT_C TInt RMMFController::AddDataSink(TUid aSinkUid, const TDesC8& aSinkInitData)
414 TMMFMessageDestination handleInfo;
415 return AddDataSink(aSinkUid, aSinkInitData, handleInfo);
419 Adds a data source to the controller, and receive a handle to allow removal and direct
420 communication with that data source.
422 A typical data source would be a file, descriptor, audio input (microphone) or camera.
423 A controller plugin may require multiple data sources to be added (for example a video
424 recorder controller would require two); the exact number is plugin-specific.
425 Data sources are plugins themselves, and are loaded by the controller framework
426 inside the controller thread.
429 The uid of the data source to be added. For more information,
430 see the documentation for the data source you wish to add.
431 @param aSourceInitData
432 Data used to initialise the data source. The exact contents
433 of this data is dependent on the type of data source. For more
434 information, see the documentation for the data source you wish
437 This object is filled in by the controller framework, and identifies
438 the data source inside the controller framework. This allows
439 the caller to send custom commands directly to the data source, and
440 to also remove the data source from the controller. Note that
441 not all data sources support custom commands, and not all
442 controller plugins support the removal of a data source.
444 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
445 another of the system-wide error codes.
448 EXPORT_C TInt RMMFController::AddDataSource(TUid aSourceUid, const TDesC8& aSourceInitData,
449 TMMFMessageDestination& aHandleInfo)
451 TMMFMessageDestinationPckg pckg;
452 TMMFUidPckg uidPckg(aSourceUid);
453 TInt error = iControllerProxy.SendSync(iDestinationPckg,
454 EMMFControllerAddDataSource,
460 aHandleInfo = pckg();
466 Add a file handle data source, together with its source info, to the controller asynchronously,
467 and receive a handle to allow removal and directcommunication with that data source.
469 Note: only one call to this method can be outstanding at any time.
471 The data source would be a file for this API.
472 A controller plugin may require multiple data sources to be added (for example a video
473 recorder controller would require two); the exact number is plugin-specific.
474 Data sources are plugins themselves, and are loaded by the controller framework
475 inside the controller thread.
477 @param "aFile" "The shared session file handle source to be added."
478 @param "aSourceInitData" "Data used to initialise the data source. The reference must remain valid
479 until the command has been completed or cancelled. The exact contents
480 of this data is dependent on the type of data source. For more
481 information, see the documentation for the data source you wish
483 @param "aHandleInfoPckg" "This object is filled in by the controller framework, and identifies
484 the data source inside the controller framework. This allows
485 the caller to send custom commands directly to the data source, and
486 to also remove the data source from the controller. Note that
487 not all data sources support custom commands, and not all
488 controller plugins support the removal of a data source."
489 @param "aStatus" "TRequestStatus of the active object to be signalled on completion
492 @return An error code indicating if the function call was successful.
493 KErrBadHandle if the file handle is not shared through the call RFs::ShareProtected().
494 KErrNone on success, otherwise another of the system-wide error codes.
496 EXPORT_C void RMMFController::AddFileHandleDataSource(const RFile& aFile, const TDesC8& aSourceInitData,
497 TMMFMessageDestinationPckg& aHandleInfoPckg,
498 TRequestStatus& aStatus)
500 TInt error = iControllerProxy.SendSync(iDestinationPckg,
501 EMMFControllerSourceSinkInitDataPreload,
504 TIpcArgs ipcArgs(&iDestinationPckg, NULL, NULL, &aHandleInfoPckg);
505 if (error == KErrNone)
507 error = aFile.TransferToServer(ipcArgs, 1, 2);
510 if (error == KErrNone)
512 iControllerProxy.SendAsync(EMMFControllerAddFileHandleDataSourceWithInitData,
518 TRequestStatus* status = &aStatus;
519 User::RequestComplete(status, error);
524 Add a file handle data source to the controller asynchronously, and receive a handle to allow
525 removal and directcommunication with that data source.
527 Note: only one call to this method can be outstanding at any time.
529 The data source would be a file for this API.
530 A controller plugin may require multiple data sources to be added (for example a video
531 recorder controller would require two); the exact number is plugin-specific.
532 Data sources are plugins themselves, and are loaded by the controller framework
533 inside the controller thread.
535 @param "aFile" "The shared session file handle source to be added."
536 @param "aHandleInfoPckg" "This object is filled in by the controller framework, and identifies
537 the data source inside the controller framework. This allows
538 the caller to send custom commands directly to the data source, and
539 to also remove the data source from the controller. Note that
540 not all data sources support custom commands, and not all
541 controller plugins support the removal of a data source."
542 @param "aStatus" "TRequestStatus of the active object to be signalled on completion
545 @return An error code indicating if the function call was successful.
546 KErrBadHandle if the file handle is not shared through the call RFs::ShareProtected().
547 KErrNone on success, otherwise another of the system-wide error codes.
549 EXPORT_C void RMMFController::AddFileHandleDataSource(const RFile& aFile,
550 TMMFMessageDestinationPckg& aHandleInfo, TRequestStatus& aStatus)
552 TIpcArgs ipcArgs(&iDestinationPckg, NULL, NULL, &aHandleInfo);
553 TInt error = aFile.TransferToServer(ipcArgs, 1, 2);
557 iControllerProxy.SendAsync(EMMFControllerAddFileHandleDataSource,
563 TRequestStatus* status = &aStatus;
564 User::RequestComplete(status, error);
570 Adds a file handle data sink, together with its source info, to the controller, and receives
571 a handle to allow removal and direct communication with that data sink.
573 Note: only one call to this method can be outstanding at any time.
575 The data sink would be a file for this API.
576 A controller plugin may require multiple data sinks to be added (for example a video
577 playing controller would require two); the exact number is plugin-specific.
578 Data sinks are plugins themselves, and are loaded by the controller framework
579 inside the controller thread.
582 The shared session file handle sink to be added.
584 Data used to initialise the data sink. The exact contents
585 of this data are dependent on the type of data sink. For more
586 information, see the documentation for the data sink you wish
589 This object is filled in by the controller framework, and identifies
590 the data sink inside the controller framework. This allows
591 the caller to send custom commands directly to the data sink, and
592 to also remove the data sink from the controller. Note that
593 not all data sinks support custom commands, and not all
594 controller plugins support the removal of a data sink.
596 TRequestStatus of the active object to be signalled on completion
599 @return An error code indicating if the function call was successful.
600 KErrBadHandle if the file handle is not shared through the call RFs::ShareProtected().
601 KErrNone on success, otherwise another of the system-wide error codes.
603 EXPORT_C void RMMFController::AddFileHandleDataSink(const RFile& aFile, const TDesC8& aSinkInitData,
604 TMMFMessageDestinationPckg& aHandleInfoPckg,
605 TRequestStatus& aStatus)
607 TInt error = iControllerProxy.SendSync(iDestinationPckg,
608 EMMFControllerSourceSinkInitDataPreload,
611 TIpcArgs ipcArgs(&iDestinationPckg, NULL, NULL, &aHandleInfoPckg);
614 error = aFile.TransferToServer(ipcArgs, 1, 2);
619 iControllerProxy.SendAsync(EMMFControllerAddFileHandleDataSinkWithInitData,
625 TRequestStatus* status = &aStatus;
626 User::RequestComplete(status, error);
631 Adds a file handle data sink, together with its source info, to the controller, and receives
632 a handle to allow removal and direct communication with that data sink.
634 Note: only one call to this method can be outstanding at any time.
636 The data sink would be a file for this API.
637 A controller plugin may require multiple data sinks to be added (for example a video
638 playing controller would require two); the exact number is plugin-specific.
639 Data sinks are plugins themselves, and are loaded by the controller framework
640 inside the controller thread.
643 The shared session file handle sink to be added.
645 This object is filled in by the controller framework, and identifies
646 the data sink inside the controller framework. This allows
647 the caller to send custom commands directly to the data sink, and
648 to also remove the data sink from the controller. Note that
649 not all data sinks support custom commands, and not all
650 controller plugins support the removal of a data sink.
652 TRequestStatus of the active object to be signalled on completion
655 @return An error code indicating if the function call was successful.
656 KErrBadHandle if the file handle is not shared through the call RFs::ShareProtected().
657 KErrNone on success, otherwise another of the system-wide error codes.
659 EXPORT_C void RMMFController::AddFileHandleDataSink(const RFile& aFile,
660 TMMFMessageDestinationPckg& aHandleInfo, TRequestStatus& aStatus)
662 TIpcArgs ipcArgs(&iDestinationPckg, NULL, NULL, &aHandleInfo);
663 TInt error = aFile.TransferToServer(ipcArgs, 1, 2);
667 iControllerProxy.SendAsync(EMMFControllerAddFileHandleDataSink,
673 TRequestStatus* status = &aStatus;
674 User::RequestComplete(status, error);
681 Adds a data sink to the controller, and receives a handle to allow removal and direct
682 communication with that data sink.
684 A typical data sink would be a file, descriptor, audio output (speaker) or display.
685 A controller plugin may require multiple data sinks to be added (for example a video
686 playing controller would require two); the exact number is plugin-specific.
687 Data sinks are plugins themselves, and are loaded by the controller framework
688 inside the controller thread.
691 The UID of the data sink to be added. For more information,
692 see the documentation for the data sink you wish to add.
694 Data used to initialise the data sink. The exact contents
695 of this data are dependent on the type of data sink. For more
696 information, see the documentation for the data sink you wish
699 This object is filled in by the controller framework, and identifies
700 the data sink inside the controller framework. This allows
701 the caller to send custom commands directly to the data sink, and
702 to also remove the data sink from the controller. Note that
703 not all data sinks support custom commands, and not all
704 controller plugins support the removal of a data sink.
706 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
707 another of the system-wide error codes.
710 EXPORT_C TInt RMMFController::AddDataSink(TUid aSinkUid, const TDesC8& aSinkInitData,
711 TMMFMessageDestination& aHandleInfo)
713 TMMFMessageDestinationPckg pckg;
714 TMMFUidPckg uidPckg(aSinkUid);
715 TInt error = iControllerProxy.SendSync(iDestinationPckg,
716 EMMFControllerAddDataSink,
722 aHandleInfo = pckg();
729 Add a data source to the controller asynchronously, and receive a handle to allow removal and direct
730 communication with that data source.
732 Note: only one call to this method can be outstanding at any time.
734 A typical data source would be a file, descriptor, audio input (microphone) or camera.
735 A controller plugin may require multiple data sources to be added (for example a video
736 recorder controller would require two); the exact number is plugin-specific.
737 Data sources are plugins themselves, and are loaded by the controller framework
738 inside the controller thread.
740 @param "aSourceUid" "The uid of the data source to be added, packaged for async data transfer.
741 The reference must remain valid until the command has been completed or
743 @param "aSourceInitData" "Data used to initialise the data source. The reference must remain valid
744 until the command has been completed or cancelled. The exact contents
745 of this data is dependent on the type of data source. For more
746 information, see the documentation for the data source you wish
748 @param "aHandleInfoPckg" "This object is filled in by the controller framework, and identifies
749 the data source inside the controller framework. This allows
750 the caller to send custom commands directly to the data source, and
751 to also remove the data source from the controller. Note that
752 not all data sources support custom commands, and not all
753 controller plugins support the removal of a data source."
754 @param "aStatus" "TRequestStatus of the active object to be signalled on completion
758 EXPORT_C void RMMFController::AddDataSource(const TMMFUidPckg& aSourceUid, const TDesC8& aSourceInitData,
759 TMMFMessageDestinationPckg& aHandleInfoPckg,
760 TRequestStatus& aStatus)
762 iControllerProxy.SendAsync(iDestinationPckg,
763 EMMFControllerAddDataSource,
771 Cancels an outstanding call to the asynchronous version of AddDataSource().
774 EXPORT_C void RMMFController::CancelAddDataSource()
776 iControllerProxy.SendSync(iDestinationPckg,
777 EMMFControllerCancelAddDataSource,
783 Add a data sink to the controller asynchronously, and receive a handle to allow removal and direct
784 communication with that data sink.
786 A typical data sink would be a file, descriptor, audio output (speaker) or display.
787 A controller plugin may require multiple data sinks to be added (for example a video
788 playing controller would require two); the exact number is plugin-specific.
789 Data sinks are plugins themselves, and are loaded by the controller framework
790 inside the controller thread.
792 @param "aSinkUid" "The uid of the data sink to be added, packaged for async data transfer.
793 The reference must remain valid until the command has been completed or
795 @param "aSinkInitData" "Data used to initialise the data sink. The reference must remain valid
796 until the command has been completed or cancelled. The exact contents
797 of this data are dependent on the type of data sink. For more
798 information, see the documentation for the data sink you wish
800 @param "aHandleInfoPckg" "This object is filled in by the controller framework, and identifies
801 the data sink inside the controller framework. This allows
802 the caller to send custom commands directly to the data sink, and
803 to also remove the data sink from the controller. Note that
804 not all data sinks support custom commands, and not all
805 controller plugins support the removal of a data sink."
806 @param "aStatus" "TRequestStatus of the active object to be signalled on completion
810 EXPORT_C void RMMFController::AddDataSink(const TMMFUidPckg& aSinkUid, const TDesC8& aSinkInitData,
811 TMMFMessageDestinationPckg& aHandleInfoPckg,
812 TRequestStatus& aStatus)
814 iControllerProxy.SendAsync(iDestinationPckg,
815 EMMFControllerAddDataSink,
824 Cancels an outstanding call to the asynchronous version of AddDataSink().
827 EXPORT_C void RMMFController::CancelAddDataSink()
829 iControllerProxy.SendSync(iDestinationPckg,
830 EMMFControllerCancelAddDataSink,
836 Removes a data source from the controller.
838 In certain situations, it may be necessary to remove a data source from a controller, for
839 example when you need to play a different file of the same format as the current one.
841 It should be noted that not all controller plugins will support the removal of a data source.
844 The handle object returned by the controller framework when the
845 data source was added.
847 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
848 another of the system-wide error codes.
851 EXPORT_C TInt RMMFController::RemoveDataSource(const TMMFMessageDestination& aHandleInfo)
853 TMMFMessageDestinationPckg pckg(aHandleInfo);
854 TInt error = iControllerProxy.SendSync(iDestinationPckg,
855 EMMFControllerRemoveDataSource,
862 Removes a data sink from the controller.
864 In certain situations, it may be necessary to remove a data sink from a controller, for
865 example when you need change output devices on the fly.
867 It should be noted that not all controller plugins will support the removal of a data sink.
870 The handle object returned by the controller framework when the
873 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
874 another of the system-wide error codes.
877 EXPORT_C TInt RMMFController::RemoveDataSink(const TMMFMessageDestination& aHandleInfo)
879 TMMFMessageDestinationPckg pckg(aHandleInfo);
880 TInt error = iControllerProxy.SendSync(iDestinationPckg,
881 EMMFControllerRemoveDataSink,
888 Reverts the controller plugin back to the state it was in just after it had been Opened.
890 Note: All sources and sinks will be removed from the controller.
892 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
893 another of the system-wide error codes.
896 EXPORT_C TInt RMMFController::Reset()
898 return iControllerProxy.SendSync(iDestinationPckg,
905 Prepares the controller to start playing.
907 The controller should initialise its sources, sinks and buffers. This moves the controller
908 from the STOPPED to the PRIMED state.
910 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
911 another of the system-wide error codes.
914 EXPORT_C TInt RMMFController::Prime()
916 return iControllerProxy.SendSync(iDestinationPckg,
923 Starts the controller playing.
924 The controller will begin transferring data from its data source(s) to its data sink(s).
926 This moves the controller from the PRIMED to the PLAYING state.
928 Play() means "Start Playing" - i.e. this method will return as soon as
931 If the data transfer comes to an end due to an internal event (e.g. source runs out of data),
932 the caller will be notified via the ReceiveEvents() interface.
935 Prime() must have been called prior to calling Play().
937 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
938 another of the system-wide error codes.
941 EXPORT_C TInt RMMFController::Play()
943 return iControllerProxy.SendSync(iDestinationPckg,
950 Pauses the controller.
952 The controller will cease transferring data from its data source(s) to its data sink(s).
953 A subsequent call to Play() will result in the data transfer resuming from the
954 same place as when the Pause() was called.
956 This moves the controller from the PLAYING back to the PRIMED state.
959 Play() must have been called prior to calling Pause().
961 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
962 another of the system-wide error codes.
965 EXPORT_C TInt RMMFController::Pause()
967 return iControllerProxy.SendSync(iDestinationPckg,
974 Stops the controller.
976 The controller will cease transferring data from its data source(s) to its data sink(s), reset
977 its position and delete any allocated buffers.
978 In effect, calling Stop() undoes any actions performed by the controller
979 during the call to Prime().
981 This moves the controller from the PRIMED back to the STOPPED state.
983 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
984 another of the system-wide error codes.
987 EXPORT_C TInt RMMFController::Stop()
989 return iControllerProxy.SendSync(iDestinationPckg,
996 Gets the current position microseconds.
998 Note: The controller must be in the PRIMED or PLAYING state before this can be called.
1001 The current position in microseconds, filled in by the controller framework.
1003 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
1004 another of the system-wide error codes.
1007 EXPORT_C TInt RMMFController::GetPosition(TTimeIntervalMicroSeconds& aPosition) const
1009 TMMFTimeIntervalMicroSecondsPckg pckg;
1010 TInt err = iControllerProxy.SendSync(iDestinationPckg,
1011 EMMFControllerGetPosition,
1021 Sets the current position microseconds.
1023 Note: The controller must be in the PRIMED or PLAYING state before this can be called.
1026 The new transfer position in microseconds.
1028 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
1029 another of the system-wide error codes.
1032 EXPORT_C TInt RMMFController::SetPosition(const TTimeIntervalMicroSeconds& aPosition) const
1034 TMMFTimeIntervalMicroSecondsPckg pckg(aPosition);
1035 return iControllerProxy.SendSync(iDestinationPckg,
1036 EMMFControllerSetPosition,
1042 Gets the duration of the clip in microseconds.
1044 Note: The controller must be in the PRIMED or PLAYING state before this can be called.
1047 The duration of the clip in microseconds, filled in by the
1048 controller framework.
1050 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
1051 another of the system-wide error codes.
1054 EXPORT_C TInt RMMFController::GetDuration(TTimeIntervalMicroSeconds& aDuration) const
1056 TMMFTimeIntervalMicroSecondsPckg pckg;
1057 TInt err = iControllerProxy.SendSync(iDestinationPckg,
1058 EMMFControllerGetDuration,
1068 Sends a custom command synchronously to the controller plugin.
1070 Custom commands allow controller plugins to extend the standard API.
1072 Note: This method will not return until the controller plugin has serviced the command.
1075 The destination of the custom command, consisting of the UID of
1076 the interface of this custom command and a special handle ID,
1077 KMMFObjectHandleController to indicate that the custom
1078 command is to be handled by the controller plugin.
1080 The function number to indicate which function is to be called
1081 on the controller's custom command interface.
1083 A reference to data to be copied to the controller plugin. The exact
1084 contents of the data are dependent on the custom command interface
1085 of the controller. Use a value of KNullDesC8 if you have no data to send.
1087 A reference to data to be copied to the controller plugin. The exact
1088 contents of the data are dependent on the custom command interface
1089 of the controller. Use a value of KNullDesC8 if you have no data to send.
1091 A reference to an area of memory to which the controller plugin will
1092 write any data to be passed back to the client.
1094 @return The result of the custom command. Exact range of values is dependent on the custom command interface.
1097 EXPORT_C TInt RMMFController::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
1099 return iControllerProxy.SendSync(aDestination,
1107 Sends a custom command synchronously to the controller plugin.
1109 Custom commands allow controller plugins to extend the standard API.
1111 Note: This method will not return until the controller plugin has serviced the command.
1114 The destination of the custom command, consisting of the UID of
1115 the interface of this custom command and a special handle ID,
1116 KMMFObjectHandleController to indicate that the custom
1117 command is to be handled by the controller plugin.
1119 The function number to indicate which function is to be called
1120 on the controller's custom command interface.
1122 A reference to data to be copied to the controller plugin. The exact
1123 contents of the data are dependent on the custom command interface
1124 of the controller. Use a value of KNullDesC8 if you have no data to send.
1126 A reference to data to be copied to the controller plugin. The exact
1127 contents of the data are dependent on the custom command interface
1128 of the controller. Use a value of KNullDesC8 if you have no data to send.
1130 @return The result of the custom command. Exact range of values is dependent on the custom command interface.
1133 EXPORT_C TInt RMMFController::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
1135 return iControllerProxy.SendSync(aDestination,
1142 Sends a custom command asynchronously to the controller plugin.
1144 Custom commands allow controller plugins to extend the standard API.
1146 Note: This method will return immediately. The RunL of the active object owning the aStatus
1147 parameter will be called when the command is completed by the controller plugin.
1150 The destination of the custom command, consisting of the UID of
1151 the interface of this custom command and a special handle ID,
1152 KMMFObjectHandleController to indicate that the custom
1153 command is to be handled by the controller plugin.
1155 The function number to indicate which function is to be called
1156 on the controller's custom command interface.
1158 A reference to data to be copied to the controller plugin. The exact
1159 contents of the data are dependent on the custom command interface
1160 of the controller. Use a value of KNullDesC8 if you have no data to send.
1162 A reference to data to be copied to the controller plugin. The exact
1163 contents of the data are dependent on the custom command interface
1164 of the controller. Use a value of KNullDesC8 if you have no data to send.
1166 A reference to an area of memory to which the controller plugin will
1167 write any data to be passed back to the client.
1169 The TRequestStatus of an active object. This will contain the
1170 result of the custom command on completion. The exact range of
1171 result values is dependent on the custom command interface.
1175 EXPORT_C void RMMFController::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
1177 iControllerProxy.SendAsync(aDestination,
1186 Sends a custom command asynchronously to the controller plugin.
1188 Custom commands allow controller plugins to extend the standard API.
1190 Note: This method will return immediately. The RunL() of the active object owning the aStatus
1191 parameter will be called when the command is completed by the controller plugin.
1194 The destination of the custom command, consisting of the UID of
1195 the interface of this custom command and a special handle ID,
1196 KMMFObjectHandleController to indicate that the custom
1197 command is to be handled by the controller plugin.
1199 The function number to indicate which function is to be called
1200 on the controller's custom command interface.
1202 A reference to data to be copied to the controller plugin. The exact
1203 contents of the data are dependent on the custom command interface
1204 of the controller. Use a value of KNullDesC8 if you have no data to send.
1206 A reference to data to be copied to the controller plugin. The exact
1207 contents of the data are dependent on the custom command interface
1208 of the controller. Use a value of KNullDesC8 if you have no data to send.
1210 The TRequestStatus of an active object. This will contain the
1211 result of the custom command on completion. The exact range of
1212 result values is dependent on the custom command interface.
1216 EXPORT_C void RMMFController::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
1218 iControllerProxy.SendAsync(aDestination,
1226 Registers to receive events from the controller plugin.
1228 Events can be generated at any time, and are generally associated with things that occur
1229 due to something happening internally within the controller. For example, an event will
1230 be generated if the controller stops playing due to reaching the end of a file.
1233 A reference to a TMMFEventPckg object that must be member data
1234 of the active object calling this method. The details of the event
1235 will be copied into this object when an event occurs.
1237 The TRequestStatus of the active object calling this method.
1240 @see CMMFControllerEventMonitor
1243 EXPORT_C void RMMFController::ReceiveEvents(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus)
1245 iControllerProxy.ReceiveEvents(aEventPckg, aStatus);
1249 Cancels a previous registration to receive events from the controller plugin.
1251 This must be called from the DoCancel() method of the active object using the
1252 ReceiveEvents() API function.
1254 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
1255 another of the system-wide error codes.
1259 EXPORT_C TInt RMMFController::CancelReceiveEvents()
1261 return iControllerProxy.CancelReceiveEvents();
1265 Gets the number a meta data entries in the clip.
1267 A clip may contain zero or more entries of meta data, e.g Author, Copyright etc.
1269 @param aNumberOfEntries
1270 The number of meta data entries in the clip, filled in by the controller framework.
1272 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
1273 another of the system-wide error codes.
1276 EXPORT_C TInt RMMFController::GetNumberOfMetaDataEntries(TInt& aNumberOfEntries) const
1278 TPckgBuf<TInt> pckg;
1279 TInt error = iControllerProxy.SendSync(iDestinationPckg,
1280 EMMFControllerGetNumberOfMetaDataEntries,
1285 aNumberOfEntries = pckg();
1290 Returns a particular meta data entry from the clip.
1292 All meta data entries can be retrieved by multiple calls to this method, iterating
1293 aIndex from 0 to the value returned by GetNumberOfMetaDataEntries().
1296 The index of the meta data entry to retrieve.
1298 @return The meta data entry retrieved from the controller plugin. Ownership of the entry is
1299 passed to the caller.
1301 @see CMMFMetaDataEntry
1304 EXPORT_C CMMFMetaDataEntry* RMMFController::GetMetaDataEntryL(TInt aIndex) const
1306 // Get the size of the entry
1307 TPckgBuf<TInt> indexPckg(aIndex);
1308 TPckgBuf<TInt> sizePckg;
1309 User::LeaveIfError(iControllerProxy.SendSync(iDestinationPckg,
1310 EMMFControllerGetSizeOfMetaDataEntry,
1314 // Create a buffer of appropriate size and get the entry data
1315 HBufC8* buf = HBufC8::NewLC(sizePckg());
1316 TPtr8 ptr = buf->Des();
1317 User::LeaveIfError(iControllerProxy.SendSync(iDestinationPckg,
1318 EMMFControllerGetMetaDataEntry,
1322 // Create the entry and internalize the data
1323 CMMFMetaDataEntry* entry = CMMFMetaDataEntry::NewL();
1324 CleanupStack::PushL(entry);
1325 RDesReadStream stream(ptr);
1326 CleanupClosePushL(stream);
1328 entry->InternalizeL(stream);
1330 CleanupStack::PopAndDestroy();//stream
1331 CleanupStack::Pop(entry);//entry
1332 CleanupStack::PopAndDestroy(buf);//buf
1338 Set the priority of the controller's sub thread.
1340 This can be used to increase the responsiveness of the audio plugin to minimise
1341 any lag in processing. This function should be used with care as it may have knock-on
1342 effects elsewhere in the system.
1345 The TThreadPriority that the thread should run under. The default is EPriorityNormal.
1347 A standard error code: KErrNone if successful, KErrNotReady if the thread does not have a
1350 EXPORT_C TInt RMMFController::SetThreadPriority(const TThreadPriority& aPriority) const
1352 return iControllerProxy.SetThreadPriority(aPriority);
1356 Create a new Controller Event Monitor.
1358 @param aObserver "The observer to notify whenever an event is received.
1359 @param aMMFController "A reference to the controller that is to be monitored for events.
1360 @return "A pointer to the object created."
1362 EXPORT_C CMMFControllerEventMonitor* CMMFControllerEventMonitor::NewL(MMMFControllerEventMonitorObserver& aObserver,
1363 RMMFController& aMMFController)
1365 return (new(ELeave) CMMFControllerEventMonitor(aObserver, aMMFController));
1368 CMMFControllerEventMonitor::CMMFControllerEventMonitor(MMMFControllerEventMonitorObserver& aObserver,
1369 RMMFController& aMMFController) :
1370 CActive(EPriorityStandard),
1371 iObserver(aObserver),
1372 iMMFController(aMMFController)
1374 CActiveScheduler::Add(this);
1377 CMMFControllerEventMonitor::~CMMFControllerEventMonitor()
1384 Start receiving events from the controller.
1385 This can only be called once the controller is open.
1387 EXPORT_C void CMMFControllerEventMonitor::Start()
1389 iMMFController.ReceiveEvents(iEventPckg, iStatus);
1393 void CMMFControllerEventMonitor::RunL()
1395 if (iStatus.Int() == KErrNone)
1397 // Save the package buf as calling Start() will overwrite the contents of iEventPckg
1398 TMMFEventPckg packageBuf = iEventPckg;
1400 iObserver.HandleEvent(packageBuf());
1404 //something's gone wrong with trying to receive events (e.g. server died etc)
1405 TMMFEvent event(KMMFErrorCategoryControllerGeneralError, iStatus.Int());
1406 iObserver.HandleEvent(event);
1407 //we don't want to receive events again here...
1411 void CMMFControllerEventMonitor::DoCancel()
1413 iMMFController.CancelReceiveEvents();
1417 Constructs a CMMFAddDataSourceSinkAsync object.
1419 @param aObs A reference to the observer of the active object. The observer will be
1420 notified when the AddDataSource/Sink command is complete.
1421 @return A pointer to the new object.
1422 @leave This method can leave with one of the standard system-wide error codes.
1425 EXPORT_C CMMFAddDataSourceSinkAsync* CMMFAddDataSourceSinkAsync::NewL(MMMFAddDataSourceSinkAsyncObserver& aObs)
1427 return new(ELeave) CMMFAddDataSourceSinkAsync(aObs);
1430 CMMFAddDataSourceSinkAsync::CMMFAddDataSourceSinkAsync(MMMFAddDataSourceSinkAsyncObserver& aObserver) :
1431 CActive(EPriorityNormal),
1432 iObserver(aObserver)
1434 CActiveScheduler::Add(this);
1435 iCurrentAction = EIdle;
1440 CMMFAddDataSourceSinkAsync::~CMMFAddDataSourceSinkAsync()
1443 delete iSourceSinkInitData;
1446 Add a data source to the controller. The caller will be signalled on completion via the
1447 MMMFAddDataSourceSinkAsyncObserver interface.
1449 Only one method call may be outstanding on this object at any one time.
1451 @param aMMFController A reference to the client controller interface class.
1452 @param aSourceUid The uid of the data source to be added. For more information,
1453 see the documentation for the data source you wish to add.
1454 @param aSourceInitData Data used to initialise the data source. The exact contents
1455 of this data are dependent on the type of data source. For more
1456 information, see the documentation for the data source you wish
1460 EXPORT_C void CMMFAddDataSourceSinkAsync::AddDataSource(RMMFController& aMMFController, TUid aSourceUid, const TDesC8& aSourceInitData)
1462 ASSERT(iCurrentAction == EIdle);
1464 iMMFController = &aMMFController;
1465 iSourceSinkUidPckg() = aSourceUid;
1466 delete iSourceSinkInitData;
1467 iSourceSinkInitData = NULL;
1468 iSourceSinkInitData = aSourceInitData.Alloc();
1469 if (!iSourceSinkInitData)
1471 iObserver.MadssaoAddDataSourceSinkAsyncComplete(KErrNoMemory, iHandleInfoPckg());
1475 iMMFController->AddDataSource(iSourceSinkUidPckg, *iSourceSinkInitData, iHandleInfoPckg, iStatus);
1477 iCurrentAction = EAddingDataSource;
1482 Add a data sink to the controller. The caller will be signalled on completion via the
1483 MMMFAddDataSourceSinkAsyncObserver interface.
1485 Only one method call may be outstanding on this object at any one time.
1487 @param aMMFController A reference to the client controller interface class.
1488 @param aSinkUid The uid of the data sink to be added. For more information,
1489 see the documentation for the data sink you wish to add.
1490 @param aSinkInitData Data used to initialise the data sink. The exact contents
1491 of this data are dependent on the type of data sink. For more
1492 information, see the documentation for the data sink you wish
1496 EXPORT_C void CMMFAddDataSourceSinkAsync::AddDataSink(RMMFController& aMMFController, TUid aSinkUid, const TDesC8& aSinkInitData)
1498 ASSERT(iCurrentAction == EIdle);
1500 iMMFController = &aMMFController;
1501 iSourceSinkUidPckg() = aSinkUid;
1502 delete iSourceSinkInitData;
1503 iSourceSinkInitData = NULL;
1504 iSourceSinkInitData = aSinkInitData.Alloc();
1505 if (!iSourceSinkInitData)
1507 iObserver.MadssaoAddDataSourceSinkAsyncComplete(KErrNoMemory, iHandleInfoPckg());
1511 iMMFController->AddDataSink(iSourceSinkUidPckg, *iSourceSinkInitData, iHandleInfoPckg, iStatus);
1513 iCurrentAction = EAddingDataSink;
1518 void CMMFAddDataSourceSinkAsync::RunL()
1520 iCurrentAction = EIdle;
1521 iMMFController = NULL;
1522 delete iSourceSinkInitData;
1523 iSourceSinkInitData = NULL;
1525 iObserver.MadssaoAddDataSourceSinkAsyncComplete(iStatus.Int(), iHandleInfoPckg());
1528 void CMMFAddDataSourceSinkAsync::DoCancel()
1530 // although the server does nothing with the cancel message,
1531 // by calling it we can at least be assured that by the time it completes,
1532 // the async AddSource/Sink message will have been completed too
1533 // so we don't get any stray events.
1534 if (iCurrentAction == EAddingDataSource)
1535 iMMFController->CancelAddDataSource();
1536 else if (iCurrentAction == EAddingDataSink)
1537 iMMFController->CancelAddDataSink();
1539 iCurrentAction = EIdle;
1540 iMMFController = NULL;
1541 delete iSourceSinkInitData;
1542 iSourceSinkInitData = NULL;
1546 EXPORT_C void CMMFAddDataSourceSinkAsync::AddFileHandleDataSource(RMMFController& aMMFController, const RFile& aFile)
1548 ASSERT(iCurrentAction == EIdle);
1550 iMMFController = &aMMFController;
1551 iMMFController->AddFileHandleDataSource(aFile,iHandleInfoPckg, iStatus);
1553 iCurrentAction = EAddingDataSource;
1556 EXPORT_C void CMMFAddDataSourceSinkAsync::AddFileHandleDataSource(RMMFController& aController, const RFile& aFile,
1557 const TDesC8& aSourceInitData)
1559 if (aSourceInitData.Length() == 0)
1561 AddFileHandleDataSource(aController, aFile);
1565 ASSERT(iCurrentAction == EIdle);
1567 iMMFController = &aController;
1568 delete iSourceSinkInitData;
1569 iSourceSinkInitData = NULL;
1570 iSourceSinkInitData = aSourceInitData.Alloc();
1571 if (!iSourceSinkInitData)
1573 iObserver.MadssaoAddDataSourceSinkAsyncComplete(KErrNoMemory, iHandleInfoPckg());
1577 iMMFController->AddFileHandleDataSource(aFile, *iSourceSinkInitData, iHandleInfoPckg, iStatus);
1579 iCurrentAction = EAddingDataSource;
1584 EXPORT_C void CMMFAddDataSourceSinkAsync::AddFileHandleDataSink(RMMFController& aMMFController, const RFile& aFile)
1586 ASSERT(iCurrentAction == EIdle);
1588 iMMFController = &aMMFController;
1589 iMMFController->AddFileHandleDataSink(aFile,iHandleInfoPckg, iStatus);
1591 iCurrentAction = EAddingDataSink;
1594 EXPORT_C void CMMFAddDataSourceSinkAsync::AddFileHandleDataSink(RMMFController& aController, const RFile& aFile,
1595 const TDesC8& aSinkInitData)
1597 if (aSinkInitData.Length() == 0)
1599 AddFileHandleDataSink(aController, aFile);
1603 ASSERT(iCurrentAction == EIdle);
1605 iMMFController = &aController;
1606 delete iSourceSinkInitData;
1607 iSourceSinkInitData = NULL;
1608 iSourceSinkInitData = aSinkInitData.Alloc();
1609 if (!iSourceSinkInitData)
1611 iObserver.MadssaoAddDataSourceSinkAsyncComplete(KErrNoMemory, iHandleInfoPckg());
1615 iMMFController->AddFileHandleDataSink(aFile, *iSourceSinkInitData, iHandleInfoPckg, iStatus);
1617 iCurrentAction = EAddingDataSink;