epoc32/include/mmf/common/mmfutilities.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // include\mmf\common\mmfutilities.h
    15 // 
    16 //
    17 
    18 #ifndef __MMF_COMMON_UTILITIES_H__
    19 #define __MMF_COMMON_UTILITIES_H__
    20 
    21 #include <e32base.h>
    22 #include <mmf/server/mmfdatabuffer.h>
    23 #include <mmf/common/mmffourcc.h>
    24 
    25 
    26 /** 
    27 @publishedAll
    28 @released
    29 
    30 Identifies the particular stream of the given media type.
    31 */
    32 class TMediaId
    33 	{
    34 public:
    35 
    36 	/**
    37 	Constructs the class with the supplied arguments.
    38 
    39 	This constructor is used when there are multiple streams of the same media type on the same
    40 	MDataSource.
    41 
    42 	@param  aMediaType
    43 	        The media type (video, audio etc.).
    44 	@param  aStreamId
    45 	        Identifies a specific stream when there are multiple streams of the same media type on 
    46 	        the same MDataSource.
    47 	*/
    48 	TMediaId(TUid aMediaType, TUint aStreamId);
    49 
    50 	/**
    51     Constructs the class with the supplied argument.
    52 
    53 	This constructor is used when there is a single stream of the same media type on the same
    54 	MDataSource.
    55 
    56 	@param  aMediaType
    57 	        The media type (video, audio etc.).
    58 	*/
    59 	TMediaId(TUid aMediaType);
    60 
    61 	/**
    62 	Default constructor.
    63 	*/
    64 	TMediaId();
    65 public:
    66 	/**
    67 	The media type (KUidMediaTypeAudio, KUidMediaTypeVideo, etc).
    68 	*/
    69 	TUid iMediaType;
    70 
    71 	/**
    72 	Identifies a particular media stream used in case where multiple streams
    73 	of the same media type are present on the same MDataSource.
    74 	*/
    75 	TUint iStreamId;
    76 private:
    77 	/**
    78 	This member is internal and not intended for use.
    79 	*/
    80 	TInt iReserved1;
    81 	TInt iReserved2;
    82 	TInt iReserved3;
    83 	};
    84 
    85 /**
    86 @publishedAll
    87 @released
    88 
    89 The FourCC code that represents NULL.
    90 */
    91 const TInt KFourCCNULL = KMMFFourCCCodeNULL;
    92 
    93 /**
    94 @publishedAll
    95 @released
    96 
    97 A class that holds a four character code, representing supported data encodings for the
    98 conversion destination. The four character codes are packed into a single TUint32.
    99 
   100 FourCC codes are a representation of the datatypes used to identify codecs. FourCC codes are used in 
   101 codec .rss files as a match string used by ECOM to correctly load the required DLL.
   102 */
   103 class TFourCC
   104 {
   105 public:
   106 
   107 	/**
   108 	Default constructor initialises the class to KMMFFourCCCodeNULL.
   109 	*/
   110 	TFourCC() {iFourCC = KMMFFourCCCodeNULL;} //'NULL'
   111 
   112 	/**
   113 	Packs the four arguments into a single TUint32.
   114 
   115 	The four arguments are packed in little-endian format.
   116 
   117 	@param  aChar1
   118 	        A character that represents part of the FourCC code. This character will be the least 
   119 	        significant byte of the code.
   120 	@param  aChar2
   121             A character that represents part of the FourCC code.
   122 	@param  aChar3
   123             A character that represents part of the FourCC code.
   124 	@param  aChar4
   125 	        A character that represents part of the FourCC code. This character will be the most 
   126 	        significant byte of the code.
   127 	*/
   128 	TFourCC(TUint8 aChar1, TUint8 aChar2, TUint8 aChar3, TUint8 aChar4) {iFourCC =(aChar4<<24)+(aChar3<<16)+(aChar2<<8)+aChar1;}
   129 
   130 	/**
   131 	Constructs a FourCC code with the given 8 bit desciptor where the descriptor contains the
   132 	characters that make up the FourCC code.
   133 
   134 	@param  aDes
   135 	        The descriptor containing the characters from which to make the FourCC code.
   136 	*/
   137 	TFourCC(const TDesC8& aDes) {iFourCC =(aDes[3]<<24)+(aDes[2]<<16)+(aDes[1]<<8)+aDes[0];}
   138 
   139 	/**
   140     Constructor with a TInt32 in little-endian format.
   141 
   142 	@param  aFourCC
   143             The FourCC code.
   144 	*/
   145 	TFourCC(TInt32 aFourCC) {iFourCC = aFourCC;}
   146 
   147 	/**
   148     Returns the FourCC code in little-endian format.
   149 
   150 	@return The FourCC code in little-endian format.
   151 	*/
   152 	TUint32 FourCC() {return iFourCC;}
   153 	inline void FourCC( TPtr8* aDes ) const ;
   154 
   155 	/**
   156     Sets the FourCC code equal to the value in the supplied argument.
   157 
   158 	@param  aFourCC
   159 	        The required TFourCC containting the FourCC code.
   160 	*/
   161 	void Set(TFourCC aFourCC) {iFourCC = aFourCC.iFourCC;}
   162 
   163 	/**
   164     Sets the FourCC code equal to the supplied argument.
   165 
   166 	@param  aFourCC
   167 	        The required FourCC code.
   168 	*/
   169 	void Set(TUint32 aFourCC) {iFourCC = aFourCC;}
   170 
   171 	/**
   172 	Equality operator.
   173 
   174 	@param  aA
   175 	        The TFourCC code that *this will be tested against.
   176 
   177 	@return A boolean indicating if the two values are equal. ETrue if the two values are equal, 
   178 	        otherwise false.
   179 	*/
   180 	TBool operator==(const TFourCC& aA) const {return (iFourCC == aA.iFourCC);}
   181 
   182 	/**
   183     Equality operator.
   184 
   185 	@param  aUint
   186 	        The FourCC code that *this will be tested against.
   187 
   188 	@return A boolean indicating if the two values are equal. ETrue if the two values are equal, 
   189 	        otherwise false.
   190 	*/
   191 	TBool operator==(const TUint32& aUint) const {return (iFourCC == aUint);}
   192 
   193 	/**
   194     Inequality operator.
   195 
   196 	@param  aA
   197 	        The TFourCC code that *this will be tested against.
   198 	
   199 	@return A boolean indicating if the two values are not equal. ETrue if the two values are 
   200 	        unequal, otherwise false.
   201 	*/
   202 	TBool operator!=(const TFourCC& aA) const {return (iFourCC != aA.iFourCC);}
   203 
   204 	/**
   205     Inequality operator.
   206 
   207 	@param  aUint
   208 	        The FourCC code that *this will be tested against.
   209 	*/
   210 	TBool operator!=(const TUint32& aUint) const {return (iFourCC != aUint);}
   211 
   212 private:
   213 	TUint32 iFourCC;
   214 };
   215 
   216 
   217 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
   218 #include <mmf/common/mmfhelper.h>
   219 #endif
   220 
   221 
   222 #include <mmf/common/mmfutilities.inl>
   223 
   224 #endif
   225