sl@0: // Copyright (c) 1997-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: // Mda\Common\Resource.h
sl@0: // 
sl@0: //
sl@0: 
sl@0: #ifndef __MDA_COMMON_RESOURCE_H__
sl@0: #define __MDA_COMMON_RESOURCE_H__
sl@0: 
sl@0: // Standard EPOC32 includes
sl@0: #include <e32base.h>
sl@0: 
sl@0: // Public Media Server includes
sl@0: #include <mda/common/base.h>
sl@0: #include <mda/common/port.h>
sl@0: #include <mda/common/controller.h>
sl@0: #include <mda/common/resource.hrh>
sl@0: 
sl@0: // Uids
sl@0: MDA_UID(KUidMdaClipLocation) // Resource Clip Location/Format type Uids
sl@0: MDA_UID(KUidMdaClipFormat) 
sl@0: MDA_UID(KUidMdaStreamDevice) // Resource Stream Device Uid
sl@0: MDA_UID(KUidMdaFileResLoc) // Clip Location Uids
sl@0: MDA_UID(KUidMdaDesResLoc) 
sl@0: MDA_UID(KUidMdaUrlResLoc) 
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @deprecated
sl@0: */
sl@0: const TInt KMdaRepeatForever = -2;
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @deprecated
sl@0: 
sl@0: Abstract base class for providing the location of audio clip data.
sl@0: 
sl@0: The location could be a filename or the address of a descriptor. An object of the derived class 
sl@0: is passed as a parameter to CMdaAudioRecorderUtility::OpenL() (to record a clip) or 
sl@0: CMdaAudioConvertUtility::OpenL() (to convert a clip to another format). This class could be
sl@0: derived from to create new types of clip location.
sl@0: 
sl@0: @see TMdaFileClipLocation
sl@0: @see TMdaDesClipLocation
sl@0: */
sl@0: class TMdaClipLocation : public TMdaPackage
sl@0: 	{
sl@0: protected:
sl@0: 	inline TMdaClipLocation(TUid aUid, TInt aDerivedSize);
sl@0: public:
sl@0: 
sl@0: 	/**
sl@0: 	The size of the whole audio clip in bytes.
sl@0: 	*/
sl@0: 	TInt iSize; // In bytes
sl@0: 
sl@0: 	/**
sl@0: 	The size of the part of the clip in bytes currently accessible. For example, a clip whose
sl@0: 	location is a URL might be larger than the amount currently available to the client.
sl@0: 	*/
sl@0: 	TInt iVisible; // In bytes
sl@0: 	};
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @deprecated
sl@0: 
sl@0: The base class for audio clip sound formats.
sl@0: 
sl@0: This class is a package designed to wrap up the UID (and possibly other data) of an audio clip format.
sl@0: 
sl@0: A clip format object (for instance TMdaWavClipFormat, TMdaAuClipFormat or TMdaRawAudioClipFormat) is passed
sl@0: as a parameter to CMdaAudioRecorderUtility::OpenL(), and to CMdaAudioConvertUtility::OpenL().
sl@0: */
sl@0: class TMdaClipFormat : public TMdaPackage
sl@0: 	{
sl@0: public:
sl@0: 	inline TMdaClipFormat();
sl@0: protected:
sl@0: 	inline TMdaClipFormat(TUid aUid, TInt aDerivedSize);
sl@0: 	};
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @deprecated
sl@0: 
sl@0: Not used by MMF
sl@0: */
sl@0: class TMdaStreamDevice : public TMdaPackage
sl@0: 	{
sl@0: protected:
sl@0: 	inline TMdaStreamDevice(TUid aUid, TInt aDerivedSize);
sl@0: 	};
sl@0: 
sl@0: // Clip Locations
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @deprecated
sl@0: 
sl@0: A package containing the name of a file that stores audio clip data.
sl@0: 
sl@0: An object of this class can be passed to CMdaAudioRecorderUtility::OpenL(), or to CMdaAudioConvertUtility::OpenL().
sl@0: */
sl@0: class TMdaFileClipLocation : public TMdaClipLocation
sl@0: 	{
sl@0: public:
sl@0: 	inline TMdaFileClipLocation();
sl@0: 	inline TMdaFileClipLocation(const TDesC& aName);
sl@0: public:
sl@0: 	/**
sl@0: 	The name of the file that contains the audio clip data.
sl@0: 	*/
sl@0: 	TBuf<256> iName;
sl@0: 	};
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @deprecated
sl@0: 
sl@0: A package containing a non-modifiable 8 bit descriptor that stores binary audio clip data.
sl@0: 
sl@0: An object of this class can be passed to CMdaAudioRecorderUtility::OpenL(), or to CMdaAudioConvertUtility::OpenL().
sl@0: */
sl@0: class TMdaDesClipLocation : public TMdaClipLocation
sl@0: 	{
sl@0: public:
sl@0: 	inline TMdaDesClipLocation();
sl@0: 	inline TMdaDesClipLocation(TDes8& aWriteableDes);
sl@0: 	inline TMdaDesClipLocation(const TDesC8& aReadOnlyDes);
sl@0: public:
sl@0: 	/**
sl@0: 	The ID of the current thread.
sl@0: 	*/
sl@0: 	TThreadId iThreadId;
sl@0: 	/**
sl@0: 	The descriptor that contains the binary audio clip data.
sl@0: 	*/
sl@0: 	TDesC8* iDes;
sl@0: 	};
sl@0: 
sl@0: /**
sl@0: @publishedAll
sl@0: @deprecated
sl@0: 
sl@0: Not used in MMF
sl@0: */
sl@0: class TMdaUrlClipLocation : public TMdaClipLocation
sl@0: 	{
sl@0: public:
sl@0: 	inline TMdaUrlClipLocation();
sl@0: 	inline TMdaUrlClipLocation(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType = KNullDesC8);
sl@0: public:
sl@0: 	TBuf<256> iUrl;
sl@0: 	TBuf8<256> iMimeType;
sl@0: 	TInt iIapId;
sl@0: 	};
sl@0: 
sl@0: 
sl@0: // Inline functions
sl@0: 	
sl@0: /**
sl@0: Protected constructor. This can be called from a derived class, with a UID 
sl@0: identifying the type of clip location and the size of the derived class.
sl@0: 
sl@0: @param  aUid
sl@0:         A UID that identifies the type of package.
sl@0: @param  aDerivedSize 
sl@0:         The size of the derived class.
sl@0: */
sl@0: inline TMdaClipLocation::TMdaClipLocation(TUid aUid, TInt aDerivedSize) :
sl@0: TMdaPackage(KUidMdaClipLocation,aUid,aDerivedSize) {}
sl@0: 
sl@0: /**
sl@0: The default constructor initialises the object so that it can be identified by the media server.
sl@0: */
sl@0: inline TMdaClipFormat::TMdaClipFormat(TUid aUid, TInt aDerivedSize) :
sl@0: TMdaPackage(KUidMdaClipFormat,aUid,aDerivedSize) {}
sl@0: 
sl@0: inline TMdaClipFormat::TMdaClipFormat() : 
sl@0: TMdaPackage(KUidMdaClipFormat,KNullUid,sizeof(TMdaClipFormat)) {}
sl@0: 
sl@0: inline TMdaStreamDevice::TMdaStreamDevice(TUid aUid, TInt aDerivedSize) :
sl@0: TMdaPackage(KUidMdaStreamDevice,aUid,aDerivedSize) {}
sl@0: 
sl@0: /**
sl@0: Default constructor. Initialises the package attributes so that it can be sent to the server. The filename is not initialised.
sl@0: */
sl@0: inline TMdaFileClipLocation::TMdaFileClipLocation() :
sl@0: TMdaClipLocation(KUidMdaFileResLoc,sizeof(TMdaFileClipLocation)) {}
sl@0: 
sl@0: /**
sl@0: Constructor with a filename.
sl@0: 
sl@0: @param  aName
sl@0:         The name of the file that contains the audio clip data.
sl@0: */
sl@0: inline TMdaFileClipLocation::TMdaFileClipLocation(const TDesC& aName) :
sl@0: TMdaClipLocation(KUidMdaFileResLoc,sizeof(TMdaFileClipLocation)),
sl@0: iName(aName) {}
sl@0: 
sl@0: inline TMdaUrlClipLocation::TMdaUrlClipLocation() :
sl@0: TMdaClipLocation(KUidMdaUrlResLoc,sizeof(TMdaUrlClipLocation)) {}
sl@0: 
sl@0: inline TMdaUrlClipLocation::TMdaUrlClipLocation(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType) :
sl@0: TMdaClipLocation(KUidMdaUrlResLoc,sizeof(TMdaUrlClipLocation)),
sl@0: iUrl(aUrl),iMimeType(aMimeType), iIapId(aIapId) {}
sl@0: 
sl@0: 
sl@0: /**
sl@0: Default constructor. Initialises the package attributes so that it can be sent to the server. The
sl@0: thread ID is initialised, but the descriptor is not.
sl@0: */
sl@0: inline TMdaDesClipLocation::TMdaDesClipLocation() :
sl@0: TMdaClipLocation(KUidMdaDesResLoc,sizeof(TMdaDesClipLocation)),
sl@0: iThreadId(RThread().Id()) {}
sl@0: 
sl@0: /**
sl@0: Constructor with a non-modifiable descriptor. Initialises the thread ID and the descriptor.
sl@0: 
sl@0: @param  aReadOnlyDes 
sl@0:         A non-modifiable descriptor which contains the sound data.
sl@0: */
sl@0: inline TMdaDesClipLocation::TMdaDesClipLocation(const TDesC8& aReadOnlyDes) :
sl@0: TMdaClipLocation(KUidMdaDesResLoc,sizeof(TMdaDesClipLocation)),
sl@0: iThreadId(RThread().Id()),
sl@0: iDes(&(TDesC8&)aReadOnlyDes) {}
sl@0: 
sl@0: /**
sl@0: Constructor with a modifiable descriptor. Initialises the thread ID and the descriptor.
sl@0: 
sl@0: @param  aWriteableDes
sl@0:         A modifiable descriptor which contains the sound data.
sl@0: */
sl@0: inline TMdaDesClipLocation::TMdaDesClipLocation(TDes8& aWriteableDes) :
sl@0: TMdaClipLocation(KUidMdaDesResLoc,sizeof(TMdaDesClipLocation)),
sl@0: iThreadId(RThread().Id()),
sl@0: iDes(&aWriteableDes) {}
sl@0: 
sl@0: #endif