os/mm/mmlibs/mmfw/inc/MdaAudioSamplePlayer.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/inc/MdaAudioSamplePlayer.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,226 @@
     1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __MDAAUDIOSAMPLEPLAYER_H
    1.20 +#define __MDAAUDIOSAMPLEPLAYER_H
    1.21 +
    1.22 +#include <e32std.h>
    1.23 +#include <f32file.h>
    1.24 +#include <mmf/common/mmfaudio.h>
    1.25 +#include <mmf/common/mmfbase.h>
    1.26 +#include <mmf/common/mmfcontrollerframeworkbase.h>
    1.27 +#include <mmf/common/mmfstandardcustomcommands.h>
    1.28 +#include <mmf/common/mmfdrmcustomcommands.h>
    1.29 +#include <mmfclntutility.h>
    1.30 +#include <mmf/common/mmfdurationinfocustomcommands.h>
    1.31 +
    1.32 +class CMdaServer;
    1.33 +
    1.34 +/**
    1.35 +@publishedAll
    1.36 +@released
    1.37 +
    1.38 +An interface to a set of audio player callback functions.
    1.39 +
    1.40 +The class is a mixin and is intended to be inherited by the client
    1.41 +class which is observing the audio playing operation. The functions
    1.42 +encapsulated by this class are called when specific events occur in
    1.43 +the process of initialising and playing an audio sample. A reference to
    1.44 +this object is passed as a parameter when constructing an audio player
    1.45 +utility object.
    1.46 +
    1.47 +@since  5.0
    1.48 +*/
    1.49 +class MMdaAudioPlayerCallback
    1.50 +	{
    1.51 +public:
    1.52 +
    1.53 +	/**
    1.54 +	Defines required client behaviour when an attempt to open and
    1.55 +	initialise an audio sample has completed, successfully or otherwise.
    1.56 +
    1.57 +	@param  aError
    1.58 +	        The status of the audio sample after initialisation.
    1.59 +	        The following values have the same specific meaning
    1.60 +	        across all EPOC platforms: KErrNone the
    1.61 +	        sample is ready to play. KErrNotSupported
    1.62 +	        the audio format or particular encoding type is not
    1.63 +	        recognised or not supported. KErrNotFound
    1.64 +	        the audio sample cannot be found.
    1.65 +	        KErrNoMemory there is insufficient memory
    1.66 +	        to play this audio sample. Other values are possible
    1.67 +	        indicating a problem opening the audio sample. These
    1.68 +	        values are dependent on the EPOC platform.
    1.69 +	@param  aDuration
    1.70 +	        The duration of the audio sample.
    1.71 +	*/
    1.72 +	virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) = 0;
    1.73 +
    1.74 +	/**
    1.75 +	Defines required client behaviour when an attempt to playback an audio
    1.76 +	sample has completed, successfully or otherwise.
    1.77 +
    1.78 +	@param   aError
    1.79 +	         The status of playback. The following values have the
    1.80 +	         same specific meaning across all EPOC platforms:
    1.81 +	         KErrNone playing of the audio sample is
    1.82 +	         complete. KErrCorrupt the sample data is
    1.83 +	         corrupt. KErrInUse the sound device is in
    1.84 +	         use by another higher priority client. This can happen
    1.85 +	         during playback. KErrNoMemory there is
    1.86 +	         insufficient memory to play this audio sample Other
    1.87 +	         values are possible indicating a problem opening the
    1.88 +	         audio sample. These values are dependent on the EPOC
    1.89 +	         platform.
    1.90 +	*/
    1.91 +	virtual void MapcPlayComplete(TInt aError) = 0;
    1.92 +	};
    1.93 +
    1.94 +
    1.95 +class CMMFMdaAudioPlayerUtility;
    1.96 +
    1.97 +/**
    1.98 +@publishedAll
    1.99 +@released
   1.100 +
   1.101 +Plays sampled audio data.
   1.102 +
   1.103 +The class offers a simple interface to open, play and obtain
   1.104 +information from, sampled audio data. The audio data can be supplied
   1.105 +either in a file (file-based), as a descriptor
   1.106 +(descriptor-based) or as a URL reference (since version 7.0s).
   1.107 +
   1.108 +While this class is abstract, the three static functions construct, initialise
   1.109 +and return pointers to instances of concrete classes derived from this
   1.110 +abstract class. 
   1.111 +
   1.112 +@since  5.0
   1.113 +*/
   1.114 +class CMdaAudioPlayerUtility : public CBase, 
   1.115 +							   public MMMFClientUtility
   1.116 +	{
   1.117 +public:
   1.118 +	IMPORT_C static CMdaAudioPlayerUtility* NewFilePlayerL(const TDesC& aFileName,
   1.119 +								MMdaAudioPlayerCallback& aCallback,
   1.120 +								TInt aPriority = EMdaPriorityNormal,
   1.121 +								TInt aPref = EMdaPriorityPreferenceTimeAndQuality,
   1.122 +								CMdaServer* aServer = NULL);
   1.123 +	IMPORT_C static CMdaAudioPlayerUtility* NewDesPlayerL(const TDesC8& aData,
   1.124 +								MMdaAudioPlayerCallback& aCallback,
   1.125 +								TInt aPriority = EMdaPriorityNormal,
   1.126 +								TInt aPref = EMdaPriorityPreferenceTimeAndQuality,
   1.127 +								CMdaServer* aServer = NULL);
   1.128 +	IMPORT_C static CMdaAudioPlayerUtility* NewDesPlayerReadOnlyL(const TDesC8& aData,
   1.129 +								MMdaAudioPlayerCallback& aCallback,
   1.130 +								TInt aPriority = EMdaPriorityNormal,
   1.131 +								TInt aPref = EMdaPriorityPreferenceTimeAndQuality,
   1.132 +								CMdaServer* aServer = NULL);
   1.133 +
   1.134 +	// new export from version 7.0
   1.135 +	IMPORT_C static CMdaAudioPlayerUtility* NewL(MMdaAudioPlayerCallback& aCallback,
   1.136 +								TInt aPriority = EMdaPriorityNormal,
   1.137 +								TInt aPref = EMdaPriorityPreferenceTimeAndQuality);
   1.138 +
   1.139 +	IMPORT_C void UseSharedHeap();
   1.140 +
   1.141 +	~CMdaAudioPlayerUtility();
   1.142 +
   1.143 +	virtual void Play();
   1.144 +
   1.145 +	virtual void Stop();
   1.146 +
   1.147 +	virtual TInt SetVolume(TInt aVolume);
   1.148 +
   1.149 +	virtual void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
   1.150 +
   1.151 +	virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
   1.152 +
   1.153 +	virtual const TTimeIntervalMicroSeconds& Duration();
   1.154 +	IMPORT_C TMMFDurationInfo Duration(TTimeIntervalMicroSeconds& aDuration);
   1.155 +
   1.156 +	virtual TInt MaxVolume();
   1.157 +
   1.158 +	IMPORT_C void OpenFileL(const TDesC& aFileName);
   1.159 +	IMPORT_C void OpenFileL(const RFile& aFile);
   1.160 +
   1.161 +	IMPORT_C void OpenFileL(const TMMSource& aSource);
   1.162 +
   1.163 +	IMPORT_C void OpenDesL(const TDesC8& aDescriptor);
   1.164 +
   1.165 +	IMPORT_C void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8);
   1.166 +
   1.167 +	IMPORT_C TInt Pause();
   1.168 +
   1.169 +	IMPORT_C void Close();
   1.170 +
   1.171 +	IMPORT_C TInt GetPosition(TTimeIntervalMicroSeconds& aPosition);
   1.172 +
   1.173 +	IMPORT_C void SetPosition(const TTimeIntervalMicroSeconds& aPosition);
   1.174 +
   1.175 +	IMPORT_C TInt SetPriority(TInt aPriority, TInt aPref);
   1.176 +
   1.177 +	IMPORT_C TInt GetVolume(TInt& aVolume);
   1.178 +
   1.179 +	IMPORT_C TInt GetNumberOfMetaDataEntries(TInt& aNumEntries);
   1.180 +
   1.181 +	IMPORT_C CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex);
   1.182 +
   1.183 +	IMPORT_C TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart,
   1.184 +								const TTimeIntervalMicroSeconds& aEnd);
   1.185 +
   1.186 +	IMPORT_C TInt ClearPlayWindow();
   1.187 +
   1.188 +	IMPORT_C TInt SetBalance(TInt aBalance = KMMFBalanceCenter);
   1.189 +
   1.190 +	IMPORT_C TInt GetBalance(TInt& aBalance);
   1.191 +
   1.192 +	IMPORT_C void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback);
   1.193 +
   1.194 +	IMPORT_C void GetAudioLoadingProgressL(TInt& aPercentageComplete);
   1.195 +
   1.196 +	IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
   1.197 +
   1.198 +	IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
   1.199 +
   1.200 +	IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
   1.201 +
   1.202 +	IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
   1.203 +
   1.204 +	IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
   1.205 +	
   1.206 +	IMPORT_C TInt GetBitRate(TUint& aBitRate);
   1.207 +
   1.208 +	IMPORT_C MMMFDRMCustomCommand* GetDRMCustomCommand();
   1.209 +
   1.210 +	IMPORT_C TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback,TUid aNotificationEventUid,const TDesC8& aNotificationRegistrationData = KNullDesC8);
   1.211 +
   1.212 +	IMPORT_C TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId);
   1.213 +    
   1.214 +	IMPORT_C TInt WillResumePlay();
   1.215 +
   1.216 +	IMPORT_C TInt SetThreadPriority(const TThreadPriority& aThreadPriority) const;	
   1.217 +	
   1.218 +private:
   1.219 +	CMdaAudioPlayerUtility();
   1.220 +	
   1.221 +protected:
   1.222 +	/**
   1.223 +	This member is internal and not intended for use.
   1.224 +	*/
   1.225 +	CMMFMdaAudioPlayerUtility* iProperties;
   1.226 +	}; 
   1.227 +
   1.228 +
   1.229 +#endif