1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/src/Client/Audio/mmfclientaudioconverter.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,205 @@
1.4 +// Copyright (c) 2002-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 __MMFCLIENTAUDIOCONVERTER_H
1.20 +#define __MMFCLIENTAUDIOCONVERTER_H
1.21 +
1.22 +#include <e32std.h>
1.23 +#include <e32base.h>
1.24 +#include <mdaaudiosampleeditor.h>
1.25 +#include <mmf/server/mmffile.h>
1.26 +#include <mmf/server/mmfdes.h>
1.27 +#include <mmf/server/mmfurl.h>
1.28 +#include <mmf/common/mmfcontroller.h>
1.29 +#include "mmfclientutility.h"
1.30 +
1.31 +/**
1.32 +Concrete implementation of the CMdaAudioConvertUtility API.
1.33 +@see CMdaAudioConvertUtility
1.34 +*/
1.35 +class CMMFMdaAudioConvertUtility;
1.36 +NONSHARABLE_CLASS( CMMFMdaAudioConvertUtility ): public CBase,
1.37 + public MMMFControllerEventMonitorObserver,
1.38 + public MMMFFindAndOpenControllerObserver
1.39 + {
1.40 +friend class CMdaAudioConvertUtility;
1.41 +// for testing only
1.42 +friend class CTestStepUnitMMFAudClient;
1.43 +
1.44 +public:
1.45 + ~CMMFMdaAudioConvertUtility();
1.46 +
1.47 + void OpenL(const TDesC& aPrimaryFile, const TDesC& aSecondaryFile);
1.48 + // Open existing file and new/existing secondary
1.49 + void OpenL(const TDesC& aPrimaryFile,
1.50 + TMdaClipLocation* aLocation, // Normally file or descriptor
1.51 + TMdaClipFormat* aFormat, // Data format
1.52 + TMdaPackage* aArg1 = NULL, // Normally codec to use
1.53 + TMdaPackage* aArg2 = NULL); // Normally audio settings
1.54 +
1.55 + void OpenL(TMdaClipLocation* aPriLocation,
1.56 + TMdaClipLocation* aSecLocation,
1.57 + TMdaClipFormat* aPriFormat,
1.58 + TMdaClipFormat* aSecFormat,
1.59 + TMdaPackage* aPriArg1 = NULL, // Normally source codec to use
1.60 + TMdaPackage* aPriArg2 = NULL, // Normally source audio settings
1.61 + TMdaPackage* aSecArg1 = NULL, // Normally sink codec to use
1.62 + TMdaPackage* aSecArg2 = NULL);// Normally sink audio settings
1.63 +
1.64 + // new controller based open
1.65 + void OpenL(TMdaClipLocation* aPriLocation,
1.66 + TMdaClipLocation* aSecLocation,
1.67 + TUid aControllerUid, // the controller to use
1.68 + TUid aDestFormatUid,
1.69 + TFourCC aDestDataType);
1.70 + //from MMMFControllerEventMonitorObserver
1.71 + void HandleEvent(const TMMFEvent& aEvent);
1.72 +
1.73 + // from MMMFFindAndOpenControllerObserver
1.74 + virtual void MfaocComplete(
1.75 + TInt& aError,
1.76 + RMMFController* aController,
1.77 + TUid aControllerUid,
1.78 + TMMFMessageDestination* aSourceHandle,
1.79 + TMMFMessageDestination* aSinkHandle);
1.80 +
1.81 + void UseSharedHeap();
1.82 +
1.83 +protected:
1.84 + CMMFMdaAudioConvertUtility(CMdaAudioConvertUtility* aParent, MMdaObjectStateChangeObserver& aCallback);
1.85 + void ConstructL(TInt aPriority, TInt aPref);
1.86 +private:
1.87 +
1.88 + CMdaAudioClipUtility::TState State();
1.89 + void Close();
1.90 + void PlayL(); // N.B. ConvertL should be used in preference to PlayL
1.91 + void RecordL(); // N.B. ConvertL should be used in preference to RecordL
1.92 + void ConvertL();
1.93 + void Stop();
1.94 + void CropL(TBool aCropToEnd = ETrue);
1.95 + void SetPosition(const TTimeIntervalMicroSeconds& aPosition);
1.96 + const TTimeIntervalMicroSeconds& Position();
1.97 + const TTimeIntervalMicroSeconds& RecordTimeAvailable();
1.98 + const TTimeIntervalMicroSeconds& Duration();
1.99 + void SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd);
1.100 + void ClearPlayWindow();
1.101 + void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
1.102 + void SetMaxWriteLength(TInt aMaxWriteLength /*= KMdaClipLocationMaxWriteLengthNone*/);
1.103 + void SetPriority(TInt aPriority, TInt aPref);
1.104 + void CropL(const TTimeIntervalMicroSeconds & aCropBegin,
1.105 + const TTimeIntervalMicroSeconds & aCropEnd);
1.106 +
1.107 + // Codec support
1.108 + void GetSupportedDestinationDataTypesL(RArray<TFourCC>& aSupportedDestinationDataTypes);
1.109 + void SetSourceDataTypeL(TFourCC aDataType) ;
1.110 + void SetDestinationDataTypeL(TFourCC aCodec);
1.111 + TFourCC DestinationDataTypeL();
1.112 + TFourCC SourceDataTypeL();
1.113 +
1.114 + // Bit rate support
1.115 + void SetDestinationBitRateL(TUint aBitRate);
1.116 + TUint DestinationBitRateL();
1.117 + void GetSupportedConversionBitRatesL(RArray<TUint>& aSupportedBitRates);
1.118 + TUint SourceBitRateL();
1.119 +
1.120 + // Sample rate support
1.121 + void SetSourceSampleRateL(TUint aSampleRate);
1.122 + void SetDestinationSampleRateL(TUint aSampleRate);
1.123 + TUint DestinationSampleRateL();
1.124 + void GetSupportedConversionSampleRatesL(RArray<TUint>& aSupportedSampleRates);
1.125 + TUint SourceSampleRateL();
1.126 +
1.127 + // Format support
1.128 + void SetSourceFormatL(TUid aRecordFormat);
1.129 + void SetDestinationFormatL(TUid aFormatUid);
1.130 + TUid DestinationFormatL();
1.131 + TUid SourceFormatL();
1.132 +
1.133 + // Number of channels
1.134 + void SetSourceNumberOfChannelsL(TUint aNumberOfChannels);
1.135 + void SetDestinationNumberOfChannelsL(TUint aNumberOfChannels);
1.136 + TUint DestinationNumberOfChannelsL();
1.137 + void GetSupportedConversionNumberOfChannelsL(RArray<TUint>& aSupportedNumChannels);
1.138 + TUint SourceNumberOfChannelsL();
1.139 +
1.140 + const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
1.141 + TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
1.142 + TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
1.143 + void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
1.144 + void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
1.145 +
1.146 + CMdaAudioConvertUtility* Parent() const;
1.147 +
1.148 + void Reset();
1.149 + TInt ControllerOpen();
1.150 + void ConfigureSourceSinkL(TMdaClipLocation* aPriLocation, TMdaClipLocation* aSecLocation);
1.151 +
1.152 + TInt SetThreadPriority(const TThreadPriority& aThreadPriority) const;
1.153 +private:
1.154 + MMdaObjectStateChangeObserver& iCallback;
1.155 + CMMFMdaObjectStateChangeObserverCallback* iAsyncCallback;
1.156 +
1.157 + RMMFController iController;
1.158 + CMMFControllerEventMonitor* iControllerEventMonitor;
1.159 +
1.160 + // Source and sink handle info
1.161 + TMMFMessageDestination iSourceHandle;
1.162 + TMMFMessageDestination iSinkHandle;
1.163 + // Custom commands
1.164 + RMMFAudioControllerCustomCommands iAudioControllerCustomCommands;
1.165 + RMMFAudioPlayControllerCustomCommands iAudioPlayControllerCustomCommands;
1.166 + RMMFAudioRecordControllerCustomCommands iAudioRecordControllerCustomCommands;
1.167 +
1.168 + TMMFPrioritySettings iPrioritySettings;
1.169 +
1.170 + TTimeIntervalMicroSeconds iPosition;
1.171 + TTimeIntervalMicroSeconds iPositionTemp;
1.172 + TTimeIntervalMicroSeconds iDuration;
1.173 + TTimeIntervalMicroSeconds iRecordTimeAvailable;
1.174 +
1.175 + CMdaAudioClipUtility::TState iState;
1.176 +
1.177 + // Convert window start and end times and whether it has been set
1.178 + TTimeIntervalMicroSeconds iConvertStart;
1.179 + TTimeIntervalMicroSeconds iConvertEnd;
1.180 + TBool iConvertWindowSet;
1.181 +
1.182 + // parent class for callback
1.183 + CMdaAudioConvertUtility* iParent;
1.184 + RArray<TUid> iMediaIds;
1.185 +
1.186 + // keeping track of cropped clip duration
1.187 + TBool iHasCropped;
1.188 + TTimeIntervalMicroSeconds iCroppedDuration;
1.189 + CMMFControllerImplementationInformation* iControllerImplementationInformation;
1.190 + TUid iControllerUid;
1.191 +
1.192 + // utility class to find and open a suitable controller asynchronously
1.193 + CMMFFindAndOpenController* iFindAndOpenController;
1.194 +
1.195 + TUid iSourceFormatUid; // for SetSourceFormat()
1.196 + TUid iSinkFormatUid; // for SetSinkFormat()
1.197 +
1.198 + TFourCC iSourceDataType; // for SetSourceDataType()
1.199 + TFourCC iSinkDataType; // for SetSinkDataType()
1.200 +
1.201 + TInt iSourceSampleRate; // for SetSourceSampleRateL()
1.202 + TInt iSinkSampleRate; // for SetDestinationSampleRateL()
1.203 +
1.204 + TInt iSourceChannels; // for SetSourceNumberOfChannelsL()
1.205 + TInt iSinkChannels; // for SetDestinationNumberOfChannelsL()
1.206 + };
1.207 +
1.208 +#endif