williamr@2: /* williamr@2: * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: DRM Audio player williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: #ifndef DRMAUDIOSAMPLEPLAYER_H williamr@2: #define DRMAUDIOSAMPLEPLAYER_H williamr@2: williamr@2: williamr@2: williamr@2: #include williamr@4: #include williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@4: class CDrmAudioPlayerAdaptation; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Interface class for DRM Player callbacks williamr@2: * williamr@2: * williamr@2: * @lib DRMAudioPlayer.lib williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: williamr@2: class MDrmAudioPlayerCallback williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Called by CDrmPlayerUtility when initialization is complete. williamr@2: * @since Series 60 3.0 williamr@2: * @param aError The status of the audio sample after initialisation. williamr@2: The following values have the same specific meaning williamr@2: across all EPOC platforms: KErrNone the williamr@2: sample is ready to play. KErrNotSupported williamr@2: the audio format or particular encoding type is not williamr@2: recognised or not supported. KErrNotFound williamr@2: the audio sample cannot be found. williamr@2: KErrNoMemory there is insufficient memory williamr@2: to play this audio sample. Other values are possible williamr@2: indicating a problem opening the audio sample. These williamr@2: values are dependent on the EPOC platform. williamr@2: * @param aDuration The duration of the audio sample. williamr@2: */ williamr@2: williamr@2: virtual void MdapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) = 0; williamr@2: williamr@2: /** williamr@2: * Called by CDrmPlayerUtility when playing is complete. williamr@2: * @since Series 60 3.0 williamr@2: * @param aError williamr@2: The status of playback. The following values have the williamr@2: same specific meaning across all EPOC platforms: williamr@2: KErrNone playing of the audio sample is williamr@2: complete. KErrCorrupt the sample data is williamr@2: corrupt. KErrInUse the sound device is in williamr@2: use by another higher priority client. This can happen williamr@2: during playback. KErrNoMemory there is williamr@2: insufficient memory to play this audio sample Other williamr@2: values are possible indicating a problem opening the williamr@2: audio sample. These values are dependent on the EPOC williamr@2: platform. williamr@2: */ williamr@2: virtual void MdapcPlayComplete(TInt aError) = 0; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: * Used by third party developers to play sampled audio data. williamr@2: The class offers a simple interface to open, play and obtain williamr@2: information from, sampled audio data. The audio data can be supplied williamr@2: either in a file (file-based), as a descriptor williamr@2: (descriptor-based) or as a URL reference. williamr@2: * williamr@2: * @lib DRMAudioPlayer.lib williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: class CDrmPlayerUtility : public CBase williamr@2: { williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: */ williamr@2: IMPORT_C static CDrmPlayerUtility* NewL(MDrmAudioPlayerCallback& aCallback,TInt aPriority, williamr@2: TMdaPriorityPreference aPref); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: */ williamr@2: IMPORT_C static CDrmPlayerUtility* NewFilePlayerL(const TDesC& aFileName,MDrmAudioPlayerCallback& aCallback, williamr@2: TInt aPriority, williamr@2: TMdaPriorityPreference aPref); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: */ williamr@2: IMPORT_C static CDrmPlayerUtility* NewDesPlayerL(const TDesC8& aData, williamr@2: MDrmAudioPlayerCallback& aCallback, williamr@2: TInt aPriority, williamr@2: TMdaPriorityPreference aPref williamr@2: ); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: */ williamr@2: IMPORT_C static CDrmPlayerUtility* NewDesPlayerReadOnlyL(const TDesC8& aData, williamr@2: MDrmAudioPlayerCallback& aCallback, williamr@2: TInt aPriority, williamr@2: TMdaPriorityPreference aPref williamr@2: ); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C ~CDrmPlayerUtility(); williamr@2: williamr@2: /** williamr@2: * Begins playback of the initialised audio sample at the current volume and priority levels. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: IMPORT_C void Play(); williamr@2: williamr@2: /** williamr@2: * Stops playback of the audio sample as soon as is possible. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: IMPORT_C void Stop(); williamr@2: williamr@2: /** williamr@2: * Pauses playback of the audio clip williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt Pause(); williamr@2: williamr@2: /** williamr@2: * Changes the current playback volume to a specified value. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aVolume Any value between 0 (mute) and the maximum volume williamr@2: */ williamr@2: IMPORT_C void SetVolume(TInt aVolume williamr@2: ); williamr@2: williamr@2: /** williamr@2: * Sets the number of times the audio sample should be repeated during the playback operation williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: williamr@2: * @param aRepeatNumberOfTimes williamr@2: The number of times to repeat the sample. Use 0 for no repeat, williamr@2: KMdaRepeatForever for continuous, any other value for number of times. williamr@2: * @param aTrailingSilence williamr@2: The duration of silence after the sample has played in microseconds. williamr@2: */ williamr@2: IMPORT_C void SetRepeats(TInt aRepeatNumberOfTimes, williamr@2: const TTimeIntervalMicroSeconds& aTrailingSilence williamr@2: ); williamr@2: williamr@2: /** williamr@2: * Changes the current playback volume to a specified value. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aVolume Any value between 0 (mute) and the maximum volume returned by williamr@2: */ williamr@2: IMPORT_C void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); williamr@2: williamr@2: williamr@2: /** williamr@2: * Returns the duration of the audio sample in microseconds. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @return The duration of the sample in microseconds williamr@2: */ williamr@2: IMPORT_C const TTimeIntervalMicroSeconds& Duration(); williamr@2: williamr@2: /** williamr@2: * Returns an integer representing the maximum volume that the audio clip can support. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @return The maximum permissible volume setting williamr@2: */ williamr@2: IMPORT_C TInt MaxVolume(); williamr@2: williamr@2: /** williamr@2: * Opens an audio clip from a file. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aFileName The file containing the audio clip williamr@2: */ williamr@2: IMPORT_C void OpenFileL(const TDesC& aFileName); williamr@2: williamr@2: /** williamr@2: * Opens an audio clip from a file. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aFile The file handle of the file containing the clip williamr@2: */ williamr@2: IMPORT_C void OpenFileL(const RFile& aFile); williamr@2: williamr@2: /** williamr@2: * Opens an audio clip from a file. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aSource The source of the file containing the clip williamr@2: */ williamr@2: IMPORT_C void OpenFileL(const TMMSource& aSource); williamr@2: williamr@2: /** williamr@2: * Opens an audio clip from a descriptor. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aDescriptor The descriptor containing the audio clip williamr@2: */ williamr@2: IMPORT_C void OpenDesL(const TDesC8& aDescriptor); williamr@2: williamr@2: /** williamr@2: * Opens an audio clip from a URL. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aUrl The URL of the audio clip. williamr@2: * @param aMimeType The mime type associated with the specified URL/audio clip williamr@2: */ williamr@2: IMPORT_C void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8); williamr@2: williamr@2: /** williamr@2: * Closes the current audio clip. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: */ williamr@2: IMPORT_C void Close(); williamr@2: williamr@2: /** williamr@2: * Returns the current playback position in microseconds from the start of the clip. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aPosition The number of microseconds from the start of the clip to the current play position williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt GetPosition(TTimeIntervalMicroSeconds& aPosition); williamr@2: williamr@2: /** williamr@2: * Returns the current playback position in microseconds from the start of the clip. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aPosition The number of microseconds from the start of the clip to the current play position williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C void SetPosition(const TTimeIntervalMicroSeconds& aPosition); williamr@2: williamr@2: /** williamr@2: * Set the priority for playback. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aPriority williamr@2: The priority level to apply, EMdaPriorityMin client can be interrupted by any other client, williamr@2: EMdaPriorityNormal client can only be interrupted by a client with a higher priority or williamr@2: EMdaPriorityMax client cannot be interrupted by other clients. williamr@2: * @param aPref The time and quality preferences to apply. williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref); williamr@2: williamr@2: /** williamr@2: * Returns the current playback volume. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aVolume A value between 0 (mute) and the maximum volume setting williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt GetVolume(TInt& aVolume); williamr@2: williamr@2: /** williamr@2: * Gets the number of meta data entries in the current audio clip. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aNumEntries On return, contains the number of meta data entries williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt GetNumberOfMetaDataEntries(TInt& aNumEntries); williamr@2: williamr@2: /** williamr@2: * Returns a specified meta data entry from the audio clip. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aMetaDataIndex The index of the meta data entry to return williamr@2: * @return The returned meta data entry williamr@2: */ williamr@2: IMPORT_C CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex); williamr@2: williamr@2: /** williamr@2: * Defines the size of the current playback window. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aStart williamr@2: The position defining the start of the window, measured in microseconds. williamr@2: If this value is less than zero, it is set to zero. If this value is williamr@2: greater than aEnd, then it is swapped with aEnd. williamr@2: * @param aEnd williamr@2: The position defining the end of the window, measured in microseconds. williamr@2: If this value is greater than the value returned by Duration(), it is williamr@2: set to the value of Duration(). If this value is less than aStart, then williamr@2: it is swapped with aStart. williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, williamr@2: const TTimeIntervalMicroSeconds& aEnd); williamr@2: williamr@2: /** williamr@2: * Clears the current playback window. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt ClearPlayWindow(); williamr@2: williamr@2: /** williamr@2: * Sets the current playback balance. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aBalance The balance value to set williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt SetBalance(TInt aBalance = KMMFBalanceCenter); williamr@2: williamr@2: /** williamr@2: * Returns the current playback balance. williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aBalance On return, contains the current balance setting williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt GetBalance(TInt& aBalance); williamr@2: williamr@2: /** williamr@2: * Returns the current bit rate williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aBitRate On return, contains the current bit rate williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt GetBitRate(TUint& aBitRate); williamr@2: williamr@2: /** williamr@2: * Allows user to register for audio loading callback williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aCallback Reference to the client to be notified williamr@2: */ williamr@2: IMPORT_C void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback); williamr@2: williamr@2: /** williamr@2: * Gets the progress of audio loading williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aPercentageProgress Upon return, contains the percentage progress williamr@2: */ williamr@2: IMPORT_C void GetAudioLoadingProgressL(TInt& aPercentageProgress); williamr@2: williamr@2: /** williamr@2: * Returns controller implementation parameters williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @return The controller information williamr@2: */ williamr@2: IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); williamr@2: williamr@2: /** williamr@2: * Sends a custom command synchronously to the controller plugin williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aDestination williamr@2: The destination of the custom command, consisting of the unique ID of the williamr@2: interface of this custom command and a special handle id KMMFObjectHandleController williamr@2: to indicate that the custom command is to be handled by the controller plugin williamr@2: * @param aFunction The function number to indicate which function is to be called williamr@2: on the controller's custom command interface. williamr@2: * @param aDataTo1 A reference to data to be copied to the controller plugin. The exact williamr@2: contents of the data are dependent on the custom command interface of the controller. Can be NULL. williamr@2: * @param aDataTo2 williamr@2: A reference to data to be copied to the controller plugin. The exact contents of the data williamr@2: are dependent on the custom command interface of the controller. Can be NULL williamr@2: * @param aDataFrom williamr@2: A reference to an area of memory to which the controller plugin will write any data williamr@2: to be passed back to the client. Cannot be NULL williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); williamr@2: williamr@2: /** williamr@2: * Sends a custom command synchronously to the controller plugin williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aDestination williamr@2: The destination of the custom command, consisting of the unique ID of the williamr@2: interface of this custom command and a special handle id KMMFObjectHandleController williamr@2: to indicate that the custom command is to be handled by the controller plugin williamr@2: * @param aFunction The function number to indicate which function is to be called williamr@2: on the controller's custom command interface. williamr@2: * @param aDataTo1 A reference to data to be copied to the controller plugin. The exact williamr@2: contents of the data are dependent on the custom command interface of the controller. Can be NULL. williamr@2: * @param aDataTo2 williamr@2: A reference to data to be copied to the controller plugin. The exact contents of the data williamr@2: are dependent on the custom command interface of the controller. Can be NULL williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); williamr@2: williamr@2: /** williamr@2: * Sends a custom command asynchronously to the controller plugin williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aDestination williamr@2: The destination of the custom command, consisting of the unique ID of the williamr@2: interface of this custom command and a special handle id KMMFObjectHandleController williamr@2: to indicate that the custom command is to be handled by the controller plugin williamr@2: * @param aFunction The function number to indicate which function is to be called williamr@2: on the controller's custom command interface. williamr@2: * @param aDataTo1 A reference to data to be copied to the controller plugin. The exact williamr@2: contents of the data are dependent on the custom command interface of the controller. Can be NULL. williamr@2: * @param aDataTo2 williamr@2: A reference to data to be copied to the controller plugin. The exact contents of the data williamr@2: are dependent on the custom command interface of the controller. Can be NULL williamr@2: * @param aDataFrom williamr@2: A reference to an area of memory to which the controller plugin will write any data williamr@2: to be passed back to the client. Cannot be NULL williamr@2: * @param aDataFrom williamr@2: The TRequestStatus of an active object. This will contain the result of the custom williamr@2: command on completion. The exact range of result values is dependent on the custom williamr@2: command interface williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); williamr@2: williamr@2: /** williamr@2: * Sends a custom command asynchronously to the controller plugin williamr@2: * williamr@2: * @since Series 60 3.0 williamr@2: * @param aDestination williamr@2: The destination of the custom command, consisting of the unique ID of the williamr@2: interface of this custom command and a special handle id KMMFObjectHandleController williamr@2: to indicate that the custom command is to be handled by the controller plugin williamr@2: * @param aFunction The function number to indicate which function is to be called williamr@2: on the controller's custom command interface. williamr@2: * @param aDataTo1 A reference to data to be copied to the controller plugin. The exact williamr@2: contents of the data are dependent on the custom command interface of the controller. Can be NULL. williamr@2: * @param aDataTo2 williamr@2: A reference to data to be copied to the controller plugin. The exact contents of the data williamr@2: are dependent on the custom command interface of the controller. Can be NULL williamr@2: * @param aDataFrom williamr@2: A reference to an area of memory to which the controller plugin will write any data williamr@2: to be passed back to the client. Cannot be NULL williamr@2: * @return KErrNone on success, otherwise another of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); williamr@2: williamr@2: protected: williamr@2: /** williamr@2: This member is internal and not intended for use. williamr@2: */ williamr@4: CDrmAudioPlayerAdaptation* iProperties; williamr@2: williamr@2: }; williamr@2: williamr@2: #endif