os/mm/mmlibs/mmfw/inc/MdaAudioSamplePlayer.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef __MDAAUDIOSAMPLEPLAYER_H
sl@0
    17
#define __MDAAUDIOSAMPLEPLAYER_H
sl@0
    18
sl@0
    19
#include <e32std.h>
sl@0
    20
#include <f32file.h>
sl@0
    21
#include <mmf/common/mmfaudio.h>
sl@0
    22
#include <mmf/common/mmfbase.h>
sl@0
    23
#include <mmf/common/mmfcontrollerframeworkbase.h>
sl@0
    24
#include <mmf/common/mmfstandardcustomcommands.h>
sl@0
    25
#include <mmf/common/mmfdrmcustomcommands.h>
sl@0
    26
#include <mmfclntutility.h>
sl@0
    27
#include <mmf/common/mmfdurationinfocustomcommands.h>
sl@0
    28
sl@0
    29
class CMdaServer;
sl@0
    30
sl@0
    31
/**
sl@0
    32
@publishedAll
sl@0
    33
@released
sl@0
    34
sl@0
    35
An interface to a set of audio player callback functions.
sl@0
    36
sl@0
    37
The class is a mixin and is intended to be inherited by the client
sl@0
    38
class which is observing the audio playing operation. The functions
sl@0
    39
encapsulated by this class are called when specific events occur in
sl@0
    40
the process of initialising and playing an audio sample. A reference to
sl@0
    41
this object is passed as a parameter when constructing an audio player
sl@0
    42
utility object.
sl@0
    43
sl@0
    44
@since  5.0
sl@0
    45
*/
sl@0
    46
class MMdaAudioPlayerCallback
sl@0
    47
	{
sl@0
    48
public:
sl@0
    49
sl@0
    50
	/**
sl@0
    51
	Defines required client behaviour when an attempt to open and
sl@0
    52
	initialise an audio sample has completed, successfully or otherwise.
sl@0
    53
sl@0
    54
	@param  aError
sl@0
    55
	        The status of the audio sample after initialisation.
sl@0
    56
	        The following values have the same specific meaning
sl@0
    57
	        across all EPOC platforms: KErrNone the
sl@0
    58
	        sample is ready to play. KErrNotSupported
sl@0
    59
	        the audio format or particular encoding type is not
sl@0
    60
	        recognised or not supported. KErrNotFound
sl@0
    61
	        the audio sample cannot be found.
sl@0
    62
	        KErrNoMemory there is insufficient memory
sl@0
    63
	        to play this audio sample. Other values are possible
sl@0
    64
	        indicating a problem opening the audio sample. These
sl@0
    65
	        values are dependent on the EPOC platform.
sl@0
    66
	@param  aDuration
sl@0
    67
	        The duration of the audio sample.
sl@0
    68
	*/
sl@0
    69
	virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) = 0;
sl@0
    70
sl@0
    71
	/**
sl@0
    72
	Defines required client behaviour when an attempt to playback an audio
sl@0
    73
	sample has completed, successfully or otherwise.
sl@0
    74
sl@0
    75
	@param   aError
sl@0
    76
	         The status of playback. The following values have the
sl@0
    77
	         same specific meaning across all EPOC platforms:
sl@0
    78
	         KErrNone playing of the audio sample is
sl@0
    79
	         complete. KErrCorrupt the sample data is
sl@0
    80
	         corrupt. KErrInUse the sound device is in
sl@0
    81
	         use by another higher priority client. This can happen
sl@0
    82
	         during playback. KErrNoMemory there is
sl@0
    83
	         insufficient memory to play this audio sample Other
sl@0
    84
	         values are possible indicating a problem opening the
sl@0
    85
	         audio sample. These values are dependent on the EPOC
sl@0
    86
	         platform.
sl@0
    87
	*/
sl@0
    88
	virtual void MapcPlayComplete(TInt aError) = 0;
sl@0
    89
	};
sl@0
    90
sl@0
    91
sl@0
    92
class CMMFMdaAudioPlayerUtility;
sl@0
    93
sl@0
    94
/**
sl@0
    95
@publishedAll
sl@0
    96
@released
sl@0
    97
sl@0
    98
Plays sampled audio data.
sl@0
    99
sl@0
   100
The class offers a simple interface to open, play and obtain
sl@0
   101
information from, sampled audio data. The audio data can be supplied
sl@0
   102
either in a file (file-based), as a descriptor
sl@0
   103
(descriptor-based) or as a URL reference (since version 7.0s).
sl@0
   104
sl@0
   105
While this class is abstract, the three static functions construct, initialise
sl@0
   106
and return pointers to instances of concrete classes derived from this
sl@0
   107
abstract class. 
sl@0
   108
sl@0
   109
@since  5.0
sl@0
   110
*/
sl@0
   111
class CMdaAudioPlayerUtility : public CBase, 
sl@0
   112
							   public MMMFClientUtility
sl@0
   113
	{
sl@0
   114
public:
sl@0
   115
	IMPORT_C static CMdaAudioPlayerUtility* NewFilePlayerL(const TDesC& aFileName,
sl@0
   116
								MMdaAudioPlayerCallback& aCallback,
sl@0
   117
								TInt aPriority = EMdaPriorityNormal,
sl@0
   118
								TInt aPref = EMdaPriorityPreferenceTimeAndQuality,
sl@0
   119
								CMdaServer* aServer = NULL);
sl@0
   120
	IMPORT_C static CMdaAudioPlayerUtility* NewDesPlayerL(const TDesC8& aData,
sl@0
   121
								MMdaAudioPlayerCallback& aCallback,
sl@0
   122
								TInt aPriority = EMdaPriorityNormal,
sl@0
   123
								TInt aPref = EMdaPriorityPreferenceTimeAndQuality,
sl@0
   124
								CMdaServer* aServer = NULL);
sl@0
   125
	IMPORT_C static CMdaAudioPlayerUtility* NewDesPlayerReadOnlyL(const TDesC8& aData,
sl@0
   126
								MMdaAudioPlayerCallback& aCallback,
sl@0
   127
								TInt aPriority = EMdaPriorityNormal,
sl@0
   128
								TInt aPref = EMdaPriorityPreferenceTimeAndQuality,
sl@0
   129
								CMdaServer* aServer = NULL);
sl@0
   130
sl@0
   131
	// new export from version 7.0
sl@0
   132
	IMPORT_C static CMdaAudioPlayerUtility* NewL(MMdaAudioPlayerCallback& aCallback,
sl@0
   133
								TInt aPriority = EMdaPriorityNormal,
sl@0
   134
								TInt aPref = EMdaPriorityPreferenceTimeAndQuality);
sl@0
   135
sl@0
   136
	IMPORT_C void UseSharedHeap();
sl@0
   137
sl@0
   138
	~CMdaAudioPlayerUtility();
sl@0
   139
sl@0
   140
	virtual void Play();
sl@0
   141
sl@0
   142
	virtual void Stop();
sl@0
   143
sl@0
   144
	virtual TInt SetVolume(TInt aVolume);
sl@0
   145
sl@0
   146
	virtual void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
sl@0
   147
sl@0
   148
	virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
sl@0
   149
sl@0
   150
	virtual const TTimeIntervalMicroSeconds& Duration();
sl@0
   151
	IMPORT_C TMMFDurationInfo Duration(TTimeIntervalMicroSeconds& aDuration);
sl@0
   152
sl@0
   153
	virtual TInt MaxVolume();
sl@0
   154
sl@0
   155
	IMPORT_C void OpenFileL(const TDesC& aFileName);
sl@0
   156
	IMPORT_C void OpenFileL(const RFile& aFile);
sl@0
   157
sl@0
   158
	IMPORT_C void OpenFileL(const TMMSource& aSource);
sl@0
   159
sl@0
   160
	IMPORT_C void OpenDesL(const TDesC8& aDescriptor);
sl@0
   161
sl@0
   162
	IMPORT_C void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8);
sl@0
   163
sl@0
   164
	IMPORT_C TInt Pause();
sl@0
   165
sl@0
   166
	IMPORT_C void Close();
sl@0
   167
sl@0
   168
	IMPORT_C TInt GetPosition(TTimeIntervalMicroSeconds& aPosition);
sl@0
   169
sl@0
   170
	IMPORT_C void SetPosition(const TTimeIntervalMicroSeconds& aPosition);
sl@0
   171
sl@0
   172
	IMPORT_C TInt SetPriority(TInt aPriority, TInt aPref);
sl@0
   173
sl@0
   174
	IMPORT_C TInt GetVolume(TInt& aVolume);
sl@0
   175
sl@0
   176
	IMPORT_C TInt GetNumberOfMetaDataEntries(TInt& aNumEntries);
sl@0
   177
sl@0
   178
	IMPORT_C CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex);
sl@0
   179
sl@0
   180
	IMPORT_C TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart,
sl@0
   181
								const TTimeIntervalMicroSeconds& aEnd);
sl@0
   182
sl@0
   183
	IMPORT_C TInt ClearPlayWindow();
sl@0
   184
sl@0
   185
	IMPORT_C TInt SetBalance(TInt aBalance = KMMFBalanceCenter);
sl@0
   186
sl@0
   187
	IMPORT_C TInt GetBalance(TInt& aBalance);
sl@0
   188
sl@0
   189
	IMPORT_C void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback);
sl@0
   190
sl@0
   191
	IMPORT_C void GetAudioLoadingProgressL(TInt& aPercentageComplete);
sl@0
   192
sl@0
   193
	IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
sl@0
   194
sl@0
   195
	IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
sl@0
   196
sl@0
   197
	IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
sl@0
   198
sl@0
   199
	IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
sl@0
   200
sl@0
   201
	IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
sl@0
   202
	
sl@0
   203
	IMPORT_C TInt GetBitRate(TUint& aBitRate);
sl@0
   204
sl@0
   205
	IMPORT_C MMMFDRMCustomCommand* GetDRMCustomCommand();
sl@0
   206
sl@0
   207
	IMPORT_C TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback,TUid aNotificationEventUid,const TDesC8& aNotificationRegistrationData = KNullDesC8);
sl@0
   208
sl@0
   209
	IMPORT_C TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId);
sl@0
   210
    
sl@0
   211
	IMPORT_C TInt WillResumePlay();
sl@0
   212
sl@0
   213
	IMPORT_C TInt SetThreadPriority(const TThreadPriority& aThreadPriority) const;	
sl@0
   214
	
sl@0
   215
private:
sl@0
   216
	CMdaAudioPlayerUtility();
sl@0
   217
	
sl@0
   218
protected:
sl@0
   219
	/**
sl@0
   220
	This member is internal and not intended for use.
sl@0
   221
	*/
sl@0
   222
	CMMFMdaAudioPlayerUtility* iProperties;
sl@0
   223
	}; 
sl@0
   224
sl@0
   225
sl@0
   226
#endif