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