|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef RESOURCEDATA_H |
|
20 #define RESOURCEDATA_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <barsread.h> |
|
25 #include <mmf/server/mmfhwdevice.h> |
|
26 #include "audiocodec.h" |
|
27 |
|
28 _LIT16(KDrive,"z:"); |
|
29 _LIT16(KFileNameFormat,"HwDev0x%x.rsc"); |
|
30 const TInt8 KResFileNameLength = 20; |
|
31 const TInt8 KResFileNameAndPathLength = 50; |
|
32 // CLASS DECLARATION |
|
33 |
|
34 ///// |
|
35 // Class is used to read capabilities and initilaization data from codec |
|
36 // resource data files. |
|
37 /// |
|
38 NONSHARABLE_CLASS (CResourceData) : public CBase |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 ///// |
|
43 // Two-phased constructor. |
|
44 // |
|
45 // @param aResourceUid UID of the resource whose data to read. |
|
46 // @return CResourceData* Pointer to a newly constructed object. |
|
47 /// |
|
48 static CResourceData* NewL(TUid aResourceUid); |
|
49 |
|
50 ///// |
|
51 // Destructor. |
|
52 /// |
|
53 ~CResourceData(); |
|
54 |
|
55 public: |
|
56 |
|
57 ///// |
|
58 // Reads the capabilities data. |
|
59 // |
|
60 // @param aMode Mode of the resource. |
|
61 // @param aConf On return from a succesful call, contains the capabilities data. |
|
62 // @return error code |
|
63 /// |
|
64 TInt GetSSampleRates(TMode aMode, RArray<TInt>& aSampleRate); |
|
65 TInt GetSModes(TMode aMode, RArray<TUid>& aModeConfig); |
|
66 |
|
67 private: |
|
68 |
|
69 |
|
70 //Constructor. |
|
71 |
|
72 CResourceData(); |
|
73 |
|
74 |
|
75 //2nd phase constructor is private. |
|
76 //The param is the UID of the resource whose data to read. |
|
77 |
|
78 void ConstructL(TUid aResourceUid); |
|
79 |
|
80 |
|
81 //Utility method for seeking resource to the correct mode. Leaves with |
|
82 //KErrNotFound if mode is not found in the opened resource. |
|
83 |
|
84 //aMode is the codec mode. |
|
85 |
|
86 TInt SeekToMode(TMode aMode); |
|
87 |
|
88 private: // Data |
|
89 |
|
90 // Resource UID. |
|
91 TUid iResourceUid; |
|
92 |
|
93 // Resource file data. |
|
94 HBufC8* iResourceData; |
|
95 |
|
96 // Resource file reader. |
|
97 TResourceReader iResourceReader; |
|
98 |
|
99 // Resource data end pointer (for safety checks). |
|
100 const TUint8* iResourceDataEnd; |
|
101 }; |
|
102 |
|
103 #endif // RESOURCEDATA_H |
|
104 |
|
105 // End of File |