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