sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: sl@0: #ifndef __MMFCONTROLLER_H__ sl@0: #define __MMFCONTROLLER_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Error category denoting a general controller error. sl@0: sl@0: @see TMMFEvent sl@0: @since 7.0s sl@0: */ sl@0: const TUid KMMFErrorCategoryControllerGeneralError = {0x101F76D3}; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Error category denoting playback complete i.e. due to EOF or error condition sl@0: sl@0: @see TMMFEvent sl@0: @since 7.0s sl@0: */ sl@0: const TUid KMMFEventCategoryPlaybackComplete = {0x101f7ea0}; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Client representation of a controller plugin for the Multimedia Framework. sl@0: sl@0: This class allows a client to load a controller plugin into a new thread and access the sl@0: functionality provided by that plugin. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class RMMFController sl@0: { sl@0: public: sl@0: sl@0: IMPORT_C RMMFController(); sl@0: sl@0: IMPORT_C TInt Open(TUid aControllerUid, const TMMFPrioritySettings& aPrioritySettings); sl@0: sl@0: IMPORT_C TInt Open(const CMMFControllerImplementationInformation& aControllerInfo, const TMMFPrioritySettings& aPrioritySettings); sl@0: sl@0: IMPORT_C TInt Open(TUid aControllerUid, const TMMFPrioritySettings& aPrioritySettings, TBool aUseSharedHeap ); sl@0: sl@0: IMPORT_C TInt Open(const CMMFControllerImplementationInformation& aControllerInfo, const TMMFPrioritySettings& aPrioritySettings, TBool aUseSharedHeap ); sl@0: sl@0: IMPORT_C TInt OpenInSecureDRMProcess(TUid aControllerUid, const TMMFPrioritySettings& aPrioritySettings); sl@0: sl@0: IMPORT_C TInt OpenInSecureDRMProcess(const CMMFControllerImplementationInformation& aControllerInfo, const TMMFPrioritySettings& aPrioritySettings); sl@0: sl@0: IMPORT_C TInt OpenInSecureDRMProcess(TUid aControllerUid, const TMMFPrioritySettings& aPrioritySettings, TBool aUseSharedHeap ); sl@0: sl@0: IMPORT_C TInt OpenInSecureDRMProcess(const CMMFControllerImplementationInformation& aControllerInfo, const TMMFPrioritySettings& aPrioritySettings, TBool aUseSharedHeap ); sl@0: sl@0: IMPORT_C void Close(); sl@0: sl@0: IMPORT_C TInt SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) const; sl@0: sl@0: IMPORT_C TInt AddDataSource(TUid aSourceUid, const TDesC8& aSourceInitData); sl@0: sl@0: IMPORT_C TInt AddDataSink(TUid aSinkUid, const TDesC8& aSinkInitData); sl@0: sl@0: IMPORT_C TInt AddDataSource(TUid aSourceUid, const TDesC8& aSourceInitData, TMMFMessageDestination& aHandleInfo); sl@0: sl@0: IMPORT_C TInt AddDataSink(TUid aSinkUid, const TDesC8& aSinkInitData, TMMFMessageDestination& aHandleInfo); sl@0: sl@0: IMPORT_C void AddDataSource(const TMMFUidPckg& aSourceUid, const TDesC8& aSourceInitData, TMMFMessageDestinationPckg& aHandleInfoPckg, TRequestStatus& aStatus); sl@0: IMPORT_C void AddFileHandleDataSource(const RFile& aFile, const TDesC8& aSourceInitData, TMMFMessageDestinationPckg& aHandleInfoPckg, TRequestStatus& aStatus); sl@0: IMPORT_C void AddFileHandleDataSource(const RFile& aFile, TMMFMessageDestinationPckg& aHandleInfoPckg, TRequestStatus& aStatus); sl@0: sl@0: IMPORT_C void CancelAddDataSource(); sl@0: sl@0: IMPORT_C void AddDataSink(const TMMFUidPckg& aSinkUid, const TDesC8& aSinkInitData, TMMFMessageDestinationPckg& aHandleInfoPckg, TRequestStatus& aStatus); sl@0: IMPORT_C void AddFileHandleDataSink(const RFile& aFile, const TDesC8& aSinkInitData, TMMFMessageDestinationPckg& aHandleInfoPckg, TRequestStatus& aStatus); sl@0: IMPORT_C void AddFileHandleDataSink(const RFile& aFile, TMMFMessageDestinationPckg& aHandleInfoPckg, TRequestStatus& aStatus); sl@0: sl@0: IMPORT_C void CancelAddDataSink(); sl@0: sl@0: IMPORT_C TInt RemoveDataSource(const TMMFMessageDestination& aSourceHandleInfo); sl@0: sl@0: IMPORT_C TInt RemoveDataSink(const TMMFMessageDestination& aSinkHandleInfo); sl@0: sl@0: IMPORT_C TInt Reset(); sl@0: sl@0: IMPORT_C TInt Prime(); sl@0: sl@0: IMPORT_C TInt Play(); sl@0: sl@0: IMPORT_C TInt Pause(); sl@0: sl@0: IMPORT_C TInt Stop(); sl@0: sl@0: IMPORT_C TInt GetPosition(TTimeIntervalMicroSeconds& aPosition) const; sl@0: sl@0: IMPORT_C TInt SetPosition(const TTimeIntervalMicroSeconds& aPosition) const; sl@0: sl@0: IMPORT_C TInt GetDuration(TTimeIntervalMicroSeconds& aDuration) const; sl@0: sl@0: IMPORT_C TInt GetNumberOfMetaDataEntries(TInt& aNumberOfEntries) const; sl@0: sl@0: IMPORT_C CMMFMetaDataEntry* GetMetaDataEntryL(TInt aIndex) const; sl@0: sl@0: IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); sl@0: sl@0: IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); sl@0: sl@0: IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); sl@0: sl@0: IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); sl@0: sl@0: IMPORT_C void ReceiveEvents(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus); sl@0: sl@0: IMPORT_C TInt CancelReceiveEvents(); sl@0: sl@0: IMPORT_C TInt SetThreadPriority(const TThreadPriority& aPriority) const; sl@0: sl@0: private: sl@0: /** sl@0: The controller proxy. Used to pass messages to the controller thread. sl@0: */ sl@0: RMMFControllerProxy iControllerProxy; sl@0: sl@0: /** sl@0: Used to hold the destination information for messages for the standard controller plugin interface. sl@0: */ sl@0: TMMFMessageDestinationPckg iDestinationPckg; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines an object to which a client may have a direct handle. sl@0: sl@0: This class provides a way of identifying objects within the controller framework, and a means sl@0: of passing commands to those objects. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class CMMFObject : public CBase sl@0: { sl@0: friend class CMMFObjectContainer;//to set the handle sl@0: public: sl@0: IMPORT_C ~CMMFObject(); sl@0: sl@0: IMPORT_C CMMFObject(TUid aInterfaceId); sl@0: sl@0: IMPORT_C const TMMFMessageDestination& Handle(); sl@0: sl@0: IMPORT_C TBool operator==(const CMMFObject& aOther); sl@0: sl@0: /** sl@0: Passes a message to the object to handle. sl@0: sl@0: This is a pure virtual method to be implemented by concrete classes derived from this class. sl@0: sl@0: The message passed in MUST be completed by the object; however, it can be copied to be sl@0: completed at a later time, should some other asynchronous action need to occur first. sl@0: sl@0: @param aMessage sl@0: The message to be handled. This MUST be completed by the object. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void HandleRequest(TMMFMessage& aMessage) = 0; sl@0: private: sl@0: void SetHandle(const TMMFMessageDestination& aNewHandle); sl@0: private: sl@0: TMMFMessageDestination iHandle; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Container class to hold the CMMFObject-derived objects in the controller framework. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class CMMFObjectContainer : public CBase sl@0: { sl@0: public: sl@0: sl@0: IMPORT_C CMMFObjectContainer(); sl@0: sl@0: IMPORT_C ~CMMFObjectContainer(); sl@0: sl@0: IMPORT_C TInt AddMMFObject(CMMFObject& aObject); sl@0: sl@0: IMPORT_C void RemoveAndDestroyMMFObject(CMMFObject& aObject); sl@0: sl@0: IMPORT_C TInt FindMMFObject(const TMMFMessageDestination& aObjectHandle, CMMFObject*& aObjectFound); sl@0: sl@0: IMPORT_C void DeleteAllObjects(); sl@0: sl@0: const RPointerArray& MMFObjects(); sl@0: sl@0: private: sl@0: /** sl@0: Internal method to find an object in the array. sl@0: */ sl@0: TInt FindMMFObject(const CMMFObject& aObject, TInt& aPositionInArray); sl@0: sl@0: /** sl@0: Internal method used to generate the object handle for a newly added object. sl@0: */ sl@0: TInt GenerateObjectHandle(); sl@0: private: sl@0: /** sl@0: The array of objects. sl@0: */ sl@0: RPointerArray iObjects; sl@0: sl@0: /** sl@0: The next available object handle. sl@0: */ sl@0: TInt iNextObjectHandle; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: CMMFObject-derived class to wrap a Data Source. sl@0: sl@0: Allows a handle to be attributed to a data source, so it can be removed from the controller and sl@0: the client can send messages directly to it. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class CMMFDataSourceHolder : public CMMFObject sl@0: { sl@0: public: sl@0: sl@0: IMPORT_C CMMFDataSourceHolder(MDataSource& aDataSource); sl@0: sl@0: IMPORT_C ~CMMFDataSourceHolder(); sl@0: sl@0: IMPORT_C MDataSource& DataSource(); sl@0: sl@0: //from CMMFObject sl@0: IMPORT_C void HandleRequest(TMMFMessage& aMessage); sl@0: private: sl@0: /** sl@0: Pointer to the data source owned by this object. sl@0: */ sl@0: MDataSource* iDataSource; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: CMMFObject-derived class to wrap a Data Sink. sl@0: sl@0: Allows a handle to be attributed to a data sink, so it can be removed from the controller and sl@0: the client can send messages directly to it. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class CMMFDataSinkHolder : public CMMFObject sl@0: { sl@0: public: sl@0: IMPORT_C CMMFDataSinkHolder(MDataSink& aDataSink); sl@0: sl@0: IMPORT_C ~CMMFDataSinkHolder(); sl@0: sl@0: IMPORT_C MDataSink& DataSink(); sl@0: sl@0: //from CMMFObject sl@0: IMPORT_C void HandleRequest(TMMFMessage& aMessage); sl@0: sl@0: private: sl@0: /** sl@0: Pointer to the data sink owned by this object. sl@0: */ sl@0: MDataSink* iDataSink; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Base class for client-side custom command classes. sl@0: sl@0: In order facilitate the use of the more common custom commands, it is desirable to write sl@0: a concrete API class for the client to use. This API class can then be use to wrap all the code sl@0: involved to formulate the custom command messages. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class RMMFCustomCommandsBase sl@0: { sl@0: public: sl@0: sl@0: IMPORT_C RMMFCustomCommandsBase(RMMFController& aController, TUid aInterfaceId); sl@0: protected: sl@0: /** sl@0: The controller. sl@0: sl@0: Derived classes should use iController.CustomCommandSync() and sl@0: iController.CustomCommandAsync() to send the custom commands to the controller sl@0: plugin. sl@0: */ sl@0: RMMFController& iController; sl@0: sl@0: /** sl@0: The destination package. sl@0: sl@0: Derived classes must pass this into iController.CustomCommandSync() and sl@0: iController.CustomCommandAsync() as the destination argument. sl@0: */ sl@0: TMMFMessageDestinationPckg iDestinationPckg; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Base class to define the interface of a custom command parser. sl@0: sl@0: In order to facilitate the support of common custom commands by controller plugins, a sl@0: custom command parser object can be used. A set of custom command parsers are created sl@0: by the controller plugin (one for each interface supported), and added to the custom command sl@0: parser manager in the controller framework. The controller plugin must also derive from a set of sl@0: concrete interfaces (provided in the form of mixin classes). Then, a custom command supported by sl@0: one of the custom command parsers will appear to the controller as a concrete API call, rather than sl@0: a call to its own custom command API. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class CMMFCustomCommandParserBase : public CBase sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Pure virtual method to be implemented by derived classes. sl@0: sl@0: Derived classes must implement the code to decode the message from the client. sl@0: sl@0: @param aMessage sl@0: The message to be serviced. This message must be completed by the derived class. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void HandleRequest(TMMFMessage& aMessage) = 0; sl@0: sl@0: /** sl@0: Returns the UID of the custom command interface provided by this parser. sl@0: sl@0: @return The interface UID. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TUid InterfaceId(); sl@0: sl@0: /** sl@0: Destructor. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C ~CMMFCustomCommandParserBase(); sl@0: protected: sl@0: sl@0: /** sl@0: Constructor. sl@0: sl@0: @param aInterfaceId sl@0: The uid of the custom command interface provided by this parser. sl@0: This must be the same as the interface id of the corresponding client sl@0: API class. See RMMFCustomCommandsBase. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C CMMFCustomCommandParserBase(TUid aInterfaceId); sl@0: sl@0: private: sl@0: sl@0: /** sl@0: The uid of the custom command interface provided by this parser. sl@0: */ sl@0: TUid iInterfaceId; sl@0: }; sl@0: sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #include sl@0: #endif sl@0: sl@0: sl@0: class CMMFControllerExtendedData; sl@0: class CMMFCustomCommandParserManager; sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Base class for controller plugins. sl@0: sl@0: A controller plugin for the multimedia framework must derive from this class and implement sl@0: all the pure virtual functions. sl@0: sl@0: Controller plugins control the flow of multimedia data from one or more sources to one or sl@0: more sinks. For example, an audio controller plugin might take data from a file source and sl@0: output it to a speaker sink, or take data from a microphone source and save it to a file sl@0: sink. A controller plugin typically supports one or more multimedia formats, for example sl@0: WAV or MPEG4. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class CMMFController : public CBase sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Allocates and constructs a new controller plugin. sl@0: sl@0: Uses ECOM to instantiate a new controller plugin. Can leave with any of the system-wide error codes. sl@0: sl@0: @param aControllerUid sl@0: The unique ID of the controller to be instantiated from ECOM. sl@0: @param aEventHandler sl@0: A reference to an event handling object that can be used by the sl@0: controller to send events back to the client. sl@0: @param aClientTid sl@0: The thread Id of the client thread sl@0: sl@0: @return A pointer to the new controller plugin. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: static CMMFController* NewL(TUid aControllerUid, MAsyncEventHandler& aEventHandler, TThreadId aClientTid); sl@0: sl@0: /** sl@0: Handles a message from the client. sl@0: sl@0: Decodes the message and calls one of the private DoXxx methods to unpackaged the parameters. sl@0: sl@0: @param aMessage sl@0: The message to be handled. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C virtual void HandleRequestL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Default destructor. sl@0: */ sl@0: IMPORT_C virtual ~CMMFController(); sl@0: protected: sl@0: sl@0: /** sl@0: Constructor. sl@0: */ sl@0: CMMFController() {}; sl@0: sl@0: // virtual functions to be implemented by controller plugin sl@0: sl@0: /** sl@0: Add a data source to the controller plugin. sl@0: sl@0: NOTE: The data source is owned by the controller framework, NOT by the controller plugin. sl@0: Under no circumstances should the controller plugin delete the data source. sl@0: sl@0: @param aDataSource sl@0: A reference to the data source to be added. The controller plugin sl@0: may call aDataSource.DataSourceType() to find out sl@0: exactly what type of source it is. sl@0: sl@0: @leave KErrNotSupported sl@0: If the controller plugin does not support the data source, it should leave with this. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void AddDataSourceL(MDataSource& aDataSource) = 0; sl@0: sl@0: /** sl@0: Adds a data sink to the controller plugin. sl@0: sl@0: NOTE: The data sink is owned by the controller framework, NOT by the controller plugin. sl@0: Under no circumstances should the controller plugin delete the data sink. sl@0: sl@0: @param aDataSink sl@0: A reference to the data sink to be added. The controller plugin sl@0: may call aDatasink.DatasinkType() to find out sl@0: exactly what type of sink it is. sl@0: sl@0: @leave KErrNotSupported sl@0: If the controller plugin does not support the data sink, it should leave with this. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void AddDataSinkL(MDataSink& aDataSink) = 0; sl@0: sl@0: /** sl@0: Removes a data source from the controller plugin. sl@0: sl@0: Note: sl@0: The data source is owned by the controller framework, NOT by the controller plugin. sl@0: Under no circumstances should the controller plugin delete the data source. sl@0: sl@0: @param aDataSource sl@0: A reference to the data source to be removed. sl@0: sl@0: @leave KErrNotSupported sl@0: The controller plugin may leave during this method. If the controller plugin does sl@0: not support the removal of data sources, it should leave with sl@0: KErrNotSupported. If the controller plugin leaves, the data source will sl@0: not be destroyed by the controller framework. If it does not leave, the data source sl@0: will be destroyed. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void RemoveDataSourceL(MDataSource& aDataSource) = 0; sl@0: sl@0: /** sl@0: Removes a data sink from the controller plugin. sl@0: sl@0: Note: sl@0: The data sink is owned by the controller framework, NOT by the controller plugin. sl@0: Under no circumstances should the controller plugin delete the data sink. sl@0: sl@0: @param aDataSink sl@0: A reference to the data sink to be removed. sl@0: sl@0: @leave KErrNotSupported sl@0: The controller plugin may leave during this method. If the controller plugin does sl@0: not support the removal of data sinks, it should leave with sl@0: KErrNotSupported. If the controller plugin leaves, the data sink will sl@0: not be destroyed by the controller framework. If it does not leave, the data sink sl@0: will be destroyed. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void RemoveDataSinkL(MDataSink& aDataSink) = 0; sl@0: sl@0: /** sl@0: Resets the controller plugin. sl@0: sl@0: The controller should revert back to its newly constructed state. If the Reset is successful sl@0: (i.e. it doesn't leave), the controller framework will delete all objects added to the sl@0: MMFObjectManager including any sources and sinks. sl@0: sl@0: @leave KErrNotSupported sl@0: If the controller plugin does not support being reset, it should leave with KErrNotSupported. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void ResetL() = 0; sl@0: sl@0: /** sl@0: Primes the controller plugin. sl@0: sl@0: The controller must prepare to start playing, by initialising its sources, sinks and buffers. sl@0: This moves the controller from the STOPPED to the PRIMED state. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void PrimeL() = 0; sl@0: sl@0: /** sl@0: A partner to the PrimeL() method that is overridable to allow Asynchronous sl@0: completion in the controller whilst maintaining a Synchronous client API. sl@0: sl@0: The default implementation of this is to call PrimeL() and complete the message with KErrNone. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C virtual void PrimeL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Commences playback. sl@0: sl@0: The controller must now begin transferring data from its source(s) to its sink(s). sl@0: This moves the controller from the PRIMED to the PLAYING state. sl@0: sl@0: Note: sl@0: This method must return once playing has commenced, and not wait until playing is complete. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void PlayL()= 0; sl@0: sl@0: /** sl@0: A partner to the PlayL() method that is overridable to allow Asynchronous sl@0: completion in the controller whilst maintaining a Synchronous client API. sl@0: sl@0: The default implementation of this is to call PlayL() and complete the message with KErrNone. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C virtual void PlayL(TMMFMessage& aMessage); sl@0: sl@0: sl@0: /** sl@0: Pauses the controller plugin. sl@0: sl@0: The controller must now cease transferring data from its source(s) to its sink(s). sl@0: This moves the controller from the PLAYING back to the PRIMED state. sl@0: sl@0: A subsequent call to Play() will cause the controller plugin to resume playback sl@0: from the point it was paused (unless there has been a call to SetPosition() in sl@0: the meantime. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void PauseL()= 0; sl@0: sl@0: /** sl@0: A partner to the PauseL() method that is overridable to allow Asynchronous sl@0: completion in the controller whilst maintaining a Synchronous client API. sl@0: sl@0: The default implementation of this is to call PauseL() and complete the message with KErrNone. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C virtual void PauseL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Stops the controller plugin. sl@0: sl@0: The controller must now undo anything that occurred during the call to Prime(). sl@0: This moves the controller from the PRIMED back to the STOPPED state. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void StopL()= 0; sl@0: sl@0: /** sl@0: A partner to the StopL() method that is overridable to allow Asynchronous sl@0: completion in the controller whilst maintaining a Synchronous client API. sl@0: sl@0: The default implementation of this is to call StopL() and complete the message with KErrNone. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C virtual void StopL(TMMFMessage& aMessage); sl@0: sl@0: /** sl@0: Gets the current position. sl@0: sl@0: The controller plugin should calculate the current position in microseconds. sl@0: sl@0: @return The current position in microseconds. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual TTimeIntervalMicroSeconds PositionL() const = 0; sl@0: sl@0: /** sl@0: Sets the current position. sl@0: sl@0: The controller plugin should reposition itself to the position provided. sl@0: sl@0: @param aPosition sl@0: The desired position in microseconds. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void SetPositionL(const TTimeIntervalMicroSeconds& aPosition) = 0; sl@0: sl@0: /** sl@0: Gets the duration of the clip. sl@0: sl@0: The controller plugin should calculate the clip duration in microseconds. sl@0: sl@0: @return The clips duration in microseconds. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual TTimeIntervalMicroSeconds DurationL() const = 0; sl@0: sl@0: /** sl@0: Sets the priority settings. sl@0: sl@0: The new priority settings must be applied to any resource being used by the controller sl@0: plugin that requires priority settings (for example the sound device). sl@0: sl@0: @param aPrioritySettings sl@0: The new priority settings sl@0: sl@0: @since 7.0s sl@0: sl@0: */ sl@0: virtual void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) = 0; sl@0: sl@0: /** sl@0: Handles a custom command. sl@0: sl@0: Custom commands allow a controller plugin to define its own API. If the controller framework sl@0: does not understand a message from the client, it is assumed this is a custom command for the sl@0: plugin and passed into this interface. sl@0: sl@0: The more common custom commands can be handled by Custom Command Parsers on behalf of the sl@0: controller plugin. This allows the controller plugin to implement a concrete interface sl@0: (defined by mixin classes) rather than having to decode the command itself. For more sl@0: information, see CMMFCustomCommandParserBase. sl@0: sl@0: The controller plugin must always complete the message passed into this method, sl@0: even if it does not support the interface required by the message. sl@0: sl@0: @param aMessage sl@0: The message to be handled by the controller plugin. sl@0: sl@0: @see CMMFCustomCommandParserBase. sl@0: @since 7.0s sl@0: */ sl@0: virtual void CustomCommand(TMMFMessage& aMessage) sl@0: {aMessage.Complete(KErrNotSupported);};//default implementation sl@0: sl@0: /** sl@0: RetrieveS the number of meta data entries in the clip. sl@0: sl@0: @param aNumberOfEntries sl@0: The controller plugin must set this to the number of meta data entries sl@0: in the clip. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void GetNumberOfMetaDataEntriesL(TInt& aNumberOfEntries) = 0; sl@0: sl@0: /** sl@0: Retrieves a meta data entry from the clip. sl@0: sl@0: @param aIndex sl@0: The index of the meta data entry to retrieve. sl@0: sl@0: @return A pointer to a newly created CMMFMetaDataEntry object containing the meta information. sl@0: The controller framework will take ownership of the object when this method returns. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual CMMFMetaDataEntry* GetMetaDataEntryL(TInt aIndex) = 0; sl@0: sl@0: // Utility functions to be used by controller plugins sl@0: sl@0: /** sl@0: Sends an event to the client. sl@0: sl@0: The controller plugin can use this method to send an event to the client. sl@0: sl@0: @param aEvent sl@0: The event to be sent to the client. sl@0: @return One of the system-wide error codes. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C TInt DoSendEventToClient(const TMMFEvent& aEvent); sl@0: sl@0: /** sl@0: Gets a reference to the multimedia framework object container. sl@0: sl@0: The controller plugin may add CMMFObject-derived objects to the container to allow them sl@0: to receive messages directly from the client. sl@0: sl@0: @return A reference to the MMFObjectContainer. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C CMMFObjectContainer& MMFObjectContainerL(); sl@0: sl@0: /** sl@0: Adds a custom command parser to the controller framework. sl@0: sl@0: If the controller framework receives a request it does not understand, it will sl@0: search through its list of custom command parsers before passing the request sl@0: on to the controller plugin as a custom command. sl@0: sl@0: By using the custom command parsers, the controller plugin can implement a concrete sl@0: API rather than having to decode the common custom commands itself. sl@0: sl@0: @param aParser sl@0: The parser to be added to the controller framework. The controller framework sl@0: takes ownership of the parser if the call does not leave. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void AddCustomCommandParserL(CMMFCustomCommandParserBase& aParser); sl@0: sl@0: /** sl@0: Retrieves the client thread Id of this controller. sl@0: sl@0: @return Thread Id of the controller's client sl@0: */ sl@0: IMPORT_C TThreadId ClientThreadIdL(); sl@0: sl@0: /** sl@0: Check the Secure DRM Mode of current controller object sl@0: sl@0: @return ETrue if the controller is running under Secure DRM mode; otherwise EFalse. sl@0: */ sl@0: IMPORT_C TBool IsSecureDrmModeL(); sl@0: sl@0: private: sl@0: /** sl@0: This is internal and not intended for use. sl@0: */ sl@0: void ConstructL(MAsyncEventHandler& aEventHandler, TThreadId aClientTid); sl@0: // IPC decode functions sl@0: TBool DoAddDataSourceL(TMMFMessage& aMessage); sl@0: TBool DoAddDataSinkL(TMMFMessage& aMessage); sl@0: TBool DoAddFileHandleDataSourceL(TMMFMessage& aMessage); sl@0: TBool DoAddFileHandleDataSinkL(TMMFMessage& aMessage); sl@0: TBool DoRemoveDataSourceL(TMMFMessage& aMessage); sl@0: TBool DoRemoveDataSinkL(TMMFMessage& aMessage); sl@0: TBool DoResetL(TMMFMessage& aMessage); sl@0: TBool DoPrimeL(TMMFMessage& aMessage); sl@0: TBool DoPlayL(TMMFMessage& aMessage); sl@0: TBool DoPauseL(TMMFMessage& aMessage); sl@0: TBool DoStopL(TMMFMessage& aMessage); sl@0: TBool DoGetPositionL(TMMFMessage& aMessage); sl@0: TBool DoSetPositionL(TMMFMessage& aMessage); sl@0: TBool DoGetDurationL(TMMFMessage& aMessage); sl@0: TBool DoSetPrioritySettingsL(TMMFMessage& aMessage); sl@0: void DoCustomCommand(TMMFMessage& aMessage); sl@0: TBool DoGetNumberOfMetaDataEntriesL(TMMFMessage& aMessage); sl@0: TBool DoGetSizeOfMetaDataEntryL(TMMFMessage& aMessage); sl@0: TBool DoGetMetaDataEntryL(TMMFMessage& aMessage); sl@0: TBool DoPreloadSourceSinkInitDataL(TMMFMessage& aMessage); sl@0: TBool DoAddFileHandleDataSourceWithInitDataL(TMMFMessage& aMessage); sl@0: TBool DoAddFileHandleDataSinkWithInitDataL(TMMFMessage& aMessage); sl@0: void ReplaceFileHandleInInitDataL(RFile* aFile, TDes8& aInitData); sl@0: // Ownership of aSource is taken into this function sl@0: void AddMDataSourceAndRepondClientL(MDataSource* aSource, TMMFMessage& aMessage); sl@0: // Ownership of aSink is taken into this function sl@0: void AddMDataSinkAndRepondClientL(MDataSink* aSink, TMMFMessage& aMessage); sl@0: CMMFControllerExtendedData* GetExtendedDataL(); sl@0: static CMMFControllerExtendedData* CreateExtendedDataL(TThreadId aClientTid); sl@0: sl@0: private: sl@0: /** sl@0: Buffer to assist copy of meta data over the thread boundary. sl@0: */ sl@0: CBufFlat* iMetaDataBuffer; sl@0: sl@0: /** sl@0: Required by ECOM. sl@0: */ sl@0: TUid iDtor_ID_Key; sl@0: sl@0: /** sl@0: The event handler for the controller plugin. sl@0: */ sl@0: MAsyncEventHandler* iAsyncEventHandler; sl@0: sl@0: /** sl@0: The MMF object container. sl@0: */ sl@0: CMMFObjectContainer* iMMFObjectContainer; sl@0: sl@0: /** sl@0: The custom command parser manager. sl@0: */ sl@0: CMMFCustomCommandParserManager* iCustomCommandParserManager; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Mixin class that the user of the class CMMFControllerEventMonitor must derive from. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class MMMFControllerEventMonitorObserver sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Handles an event that has been generated. sl@0: sl@0: @param aEvent sl@0: The event to be handled. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void HandleEvent(const TMMFEvent& aEvent) = 0; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Active object utility class that can be used to monitor a controller plugin for events. sl@0: If an event occurs, the client will be notified via the MMMFControllerEventMonitorObserver interface. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class CMMFControllerEventMonitor : public CActive sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Constructs a controller event monitor object. sl@0: sl@0: @param aObserver sl@0: A reference to the observer of the active object. The observer will be sl@0: notified when an event occurs. sl@0: @param aMMFController sl@0: A reference to the client controller interface class. sl@0: sl@0: @return A pointer to the new event monitor. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C static CMMFControllerEventMonitor* NewL(MMMFControllerEventMonitorObserver& aObserver, sl@0: RMMFController& aMMFController); sl@0: /** sl@0: Destructor. sl@0: */ sl@0: ~CMMFControllerEventMonitor(); sl@0: sl@0: /** sl@0: Tells the controller event monitor to start listening for events. sl@0: sl@0: The controller plugin must have been opened before this method is called. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: IMPORT_C void Start(); sl@0: sl@0: private: sl@0: /** sl@0: Calls HandleEvent on iObserver. sl@0: sl@0: This will not leave. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: void RunL(); sl@0: sl@0: /** sl@0: Cancels the outstanding request on iMMFController. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: void DoCancel(); sl@0: sl@0: /** sl@0: Constructs a controller event monitor object. sl@0: sl@0: @param aObserver sl@0: A reference to the observer of the active object. The observer will be sl@0: notified when an event occurs. sl@0: @param aMMFController sl@0: A reference to the client controller interface class. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: CMMFControllerEventMonitor(MMMFControllerEventMonitorObserver& aObserver, sl@0: RMMFController& aMMFController); sl@0: private: sl@0: MMMFControllerEventMonitorObserver& iObserver; sl@0: RMMFController& iMMFController; sl@0: TMMFEventPckg iEventPckg; sl@0: }; sl@0: sl@0: /** sl@0: Mixin class that the user of the class CMMFAddDataSourceSinkAsync must derive from. sl@0: @since 8.0 sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class MMMFAddDataSourceSinkAsyncObserver sl@0: { sl@0: public: sl@0: /** sl@0: The request to add a data source or sink has completed. sl@0: @param "aError" "The error resulting from adding the source/sink." sl@0: @param "aHandleInfo" "This object identifies the data source/sink inside the controller sl@0: framework. This allows the client to send custom commands directly to sl@0: the data source/sink, and to also remove the data sink from the controller. sl@0: Note that not all data sinks support custom commands, and not all sl@0: controller plugins support the removal of a data sink." sl@0: */ sl@0: virtual void MadssaoAddDataSourceSinkAsyncComplete(TInt aError, const TMMFMessageDestination& aHandle) = 0; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Active object utility class that can be used to add a data source or data sink to a controller sl@0: plugin asynchronously. Once the command has been completed, the caller will be notified via the sl@0: MMMFAddDataSourceSinkAsyncObserver interface. sl@0: @since 8.0 sl@0: @publishedAll sl@0: @released sl@0: sl@0: */ sl@0: class CMMFAddDataSourceSinkAsync : public CActive sl@0: { sl@0: public: sl@0: sl@0: IMPORT_C static CMMFAddDataSourceSinkAsync* NewL(MMMFAddDataSourceSinkAsyncObserver& aObs); sl@0: IMPORT_C void AddDataSource(RMMFController& aController, TUid aSourceUid, const TDesC8& aSourceInitData); sl@0: IMPORT_C void AddFileHandleDataSource(RMMFController& aController, const RFile& aFile); sl@0: IMPORT_C void AddFileHandleDataSource(RMMFController& aController, const RFile& aFile, const TDesC8& aSourceInitData); sl@0: IMPORT_C void AddDataSink(RMMFController& aController, TUid aSinkUid, const TDesC8& aSinkInitData); sl@0: IMPORT_C void AddFileHandleDataSink(RMMFController& aController, const RFile& aFile); sl@0: IMPORT_C void AddFileHandleDataSink(RMMFController& aController, const RFile& aFile, const TDesC8& aSinkInitData); sl@0: sl@0: ~CMMFAddDataSourceSinkAsync(); sl@0: sl@0: private: sl@0: void RunL(); sl@0: void DoCancel(); sl@0: CMMFAddDataSourceSinkAsync(MMMFAddDataSourceSinkAsyncObserver& aObserver); sl@0: private: sl@0: enum TCurrentAction {EIdle, EAddingDataSource, EAddingDataSink}; sl@0: private: sl@0: MMMFAddDataSourceSinkAsyncObserver& iObserver; sl@0: TMMFMessageDestinationPckg iHandleInfoPckg; sl@0: TCurrentAction iCurrentAction; sl@0: RMMFController* iMMFController; sl@0: HBufC8* iSourceSinkInitData; sl@0: TMMFUidPckg iSourceSinkUidPckg; sl@0: }; sl@0: sl@0: #endif