os/mm/mmlibs/mmfw/inc/mmf/common/MmfUtilities.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/inc/mmf/common/MmfUtilities.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,225 @@
     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 +// include\mmf\common\mmfutilities.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __MMF_COMMON_UTILITIES_H__
    1.22 +#define __MMF_COMMON_UTILITIES_H__
    1.23 +
    1.24 +#include <e32base.h>
    1.25 +#include <mmf/server/mmfdatabuffer.h>
    1.26 +#include <mmf/common/mmffourcc.h>
    1.27 +
    1.28 +
    1.29 +/** 
    1.30 +@publishedAll
    1.31 +@released
    1.32 +
    1.33 +Identifies the particular stream of the given media type.
    1.34 +*/
    1.35 +class TMediaId
    1.36 +	{
    1.37 +public:
    1.38 +
    1.39 +	/**
    1.40 +	Constructs the class with the supplied arguments.
    1.41 +
    1.42 +	This constructor is used when there are multiple streams of the same media type on the same
    1.43 +	MDataSource.
    1.44 +
    1.45 +	@param  aMediaType
    1.46 +	        The media type (video, audio etc.).
    1.47 +	@param  aStreamId
    1.48 +	        Identifies a specific stream when there are multiple streams of the same media type on 
    1.49 +	        the same MDataSource.
    1.50 +	*/
    1.51 +	TMediaId(TUid aMediaType, TUint aStreamId);
    1.52 +
    1.53 +	/**
    1.54 +    Constructs the class with the supplied argument.
    1.55 +
    1.56 +	This constructor is used when there is a single stream of the same media type on the same
    1.57 +	MDataSource.
    1.58 +
    1.59 +	@param  aMediaType
    1.60 +	        The media type (video, audio etc.).
    1.61 +	*/
    1.62 +	TMediaId(TUid aMediaType);
    1.63 +
    1.64 +	/**
    1.65 +	Default constructor.
    1.66 +	*/
    1.67 +	TMediaId();
    1.68 +public:
    1.69 +	/**
    1.70 +	The media type (KUidMediaTypeAudio, KUidMediaTypeVideo, etc).
    1.71 +	*/
    1.72 +	TUid iMediaType;
    1.73 +
    1.74 +	/**
    1.75 +	Identifies a particular media stream used in case where multiple streams
    1.76 +	of the same media type are present on the same MDataSource.
    1.77 +	*/
    1.78 +	TUint iStreamId;
    1.79 +private:
    1.80 +	/**
    1.81 +	This member is internal and not intended for use.
    1.82 +	*/
    1.83 +	TInt iReserved1;
    1.84 +	TInt iReserved2;
    1.85 +	TInt iReserved3;
    1.86 +	};
    1.87 +
    1.88 +/**
    1.89 +@publishedAll
    1.90 +@released
    1.91 +
    1.92 +The FourCC code that represents NULL.
    1.93 +*/
    1.94 +const TInt KFourCCNULL = KMMFFourCCCodeNULL;
    1.95 +
    1.96 +/**
    1.97 +@publishedAll
    1.98 +@released
    1.99 +
   1.100 +A class that holds a four character code, representing supported data encodings for the
   1.101 +conversion destination. The four character codes are packed into a single TUint32.
   1.102 +
   1.103 +FourCC codes are a representation of the datatypes used to identify codecs. FourCC codes are used in 
   1.104 +codec .rss files as a match string used by ECOM to correctly load the required DLL.
   1.105 +*/
   1.106 +class TFourCC
   1.107 +{
   1.108 +public:
   1.109 +
   1.110 +	/**
   1.111 +	Default constructor initialises the class to KMMFFourCCCodeNULL.
   1.112 +	*/
   1.113 +	TFourCC() {iFourCC = KMMFFourCCCodeNULL;} //'NULL'
   1.114 +
   1.115 +	/**
   1.116 +	Packs the four arguments into a single TUint32.
   1.117 +
   1.118 +	The four arguments are packed in little-endian format.
   1.119 +
   1.120 +	@param  aChar1
   1.121 +	        A character that represents part of the FourCC code. This character will be the least 
   1.122 +	        significant byte of the code.
   1.123 +	@param  aChar2
   1.124 +            A character that represents part of the FourCC code.
   1.125 +	@param  aChar3
   1.126 +            A character that represents part of the FourCC code.
   1.127 +	@param  aChar4
   1.128 +	        A character that represents part of the FourCC code. This character will be the most 
   1.129 +	        significant byte of the code.
   1.130 +	*/
   1.131 +	TFourCC(TUint8 aChar1, TUint8 aChar2, TUint8 aChar3, TUint8 aChar4) {iFourCC =(aChar4<<24)+(aChar3<<16)+(aChar2<<8)+aChar1;}
   1.132 +
   1.133 +	/**
   1.134 +	Constructs a FourCC code with the given 8 bit desciptor where the descriptor contains the
   1.135 +	characters that make up the FourCC code.
   1.136 +
   1.137 +	@param  aDes
   1.138 +	        The descriptor containing the characters from which to make the FourCC code.
   1.139 +	*/
   1.140 +	TFourCC(const TDesC8& aDes) {iFourCC =(aDes[3]<<24)+(aDes[2]<<16)+(aDes[1]<<8)+aDes[0];}
   1.141 +
   1.142 +	/**
   1.143 +    Constructor with a TInt32 in little-endian format.
   1.144 +
   1.145 +	@param  aFourCC
   1.146 +            The FourCC code.
   1.147 +	*/
   1.148 +	TFourCC(TInt32 aFourCC) {iFourCC = aFourCC;}
   1.149 +
   1.150 +	/**
   1.151 +    Returns the FourCC code in little-endian format.
   1.152 +
   1.153 +	@return The FourCC code in little-endian format.
   1.154 +	*/
   1.155 +	TUint32 FourCC() {return iFourCC;}
   1.156 +	inline void FourCC( TPtr8* aDes ) const ;
   1.157 +
   1.158 +	/**
   1.159 +    Sets the FourCC code equal to the value in the supplied argument.
   1.160 +
   1.161 +	@param  aFourCC
   1.162 +	        The required TFourCC containting the FourCC code.
   1.163 +	*/
   1.164 +	void Set(TFourCC aFourCC) {iFourCC = aFourCC.iFourCC;}
   1.165 +
   1.166 +	/**
   1.167 +    Sets the FourCC code equal to the supplied argument.
   1.168 +
   1.169 +	@param  aFourCC
   1.170 +	        The required FourCC code.
   1.171 +	*/
   1.172 +	void Set(TUint32 aFourCC) {iFourCC = aFourCC;}
   1.173 +
   1.174 +	/**
   1.175 +	Equality operator.
   1.176 +
   1.177 +	@param  aA
   1.178 +	        The TFourCC code that *this will be tested against.
   1.179 +
   1.180 +	@return A boolean indicating if the two values are equal. ETrue if the two values are equal, 
   1.181 +	        otherwise false.
   1.182 +	*/
   1.183 +	TBool operator==(const TFourCC& aA) const {return (iFourCC == aA.iFourCC);}
   1.184 +
   1.185 +	/**
   1.186 +    Equality operator.
   1.187 +
   1.188 +	@param  aUint
   1.189 +	        The FourCC code that *this will be tested against.
   1.190 +
   1.191 +	@return A boolean indicating if the two values are equal. ETrue if the two values are equal, 
   1.192 +	        otherwise false.
   1.193 +	*/
   1.194 +	TBool operator==(const TUint32& aUint) const {return (iFourCC == aUint);}
   1.195 +
   1.196 +	/**
   1.197 +    Inequality operator.
   1.198 +
   1.199 +	@param  aA
   1.200 +	        The TFourCC code that *this will be tested against.
   1.201 +	
   1.202 +	@return A boolean indicating if the two values are not equal. ETrue if the two values are 
   1.203 +	        unequal, otherwise false.
   1.204 +	*/
   1.205 +	TBool operator!=(const TFourCC& aA) const {return (iFourCC != aA.iFourCC);}
   1.206 +
   1.207 +	/**
   1.208 +    Inequality operator.
   1.209 +
   1.210 +	@param  aUint
   1.211 +	        The FourCC code that *this will be tested against.
   1.212 +	*/
   1.213 +	TBool operator!=(const TUint32& aUint) const {return (iFourCC != aUint);}
   1.214 +
   1.215 +private:
   1.216 +	TUint32 iFourCC;
   1.217 +};
   1.218 +
   1.219 +
   1.220 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
   1.221 +#include <mmf/common/mmfhelper.h>
   1.222 +#endif
   1.223 +
   1.224 +
   1.225 +#include <mmf/common/mmfutilities.inl>
   1.226 +
   1.227 +#endif
   1.228 +