|
1 /* |
|
2 * Copyright (c) 2004 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: This class implements an ID3v1 and v1.1 parser as specified in |
|
15 * www.id3.org. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CMetaDataParserWMA_H |
|
22 #define CMetaDataParserWMA_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include "MetaDataParser.h" |
|
27 #include "MetaDataSource.h" |
|
28 #include "MetaDataFieldContainer.h" |
|
29 #include "MetaDataField.h" |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * This class implements a WMA metadata parser. |
|
37 * |
|
38 * @lib MetaDataUtility.lib |
|
39 * @since 3.0 |
|
40 */ |
|
41 class CMetaDataParserWMA : public CMetaDataParser |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 * @param aSource Reference to a metadata source |
|
48 * @return A pointer to a new instance of this class |
|
49 */ |
|
50 static CMetaDataParserWMA* NewL( CMetaDataSource& aSource ); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 virtual ~CMetaDataParserWMA(); |
|
56 |
|
57 public: // Functions from base classes |
|
58 |
|
59 /** |
|
60 * From CMetaDataParser |
|
61 * Parses the source and if metadata is found, the metadata fields are |
|
62 * inserted into the container. |
|
63 * @since 3.0 |
|
64 * @param aWantedFields An array of TMetaDataFieldId's. Empty array is interpreted as all fields. |
|
65 * @param aContainer On return, metadata found in aSource is stored here |
|
66 * @return void |
|
67 */ |
|
68 void ParseL( const RArray<TMetaDataFieldId>& aWantedFields, CMetaDataFieldContainer& aContainer ); |
|
69 |
|
70 private: |
|
71 |
|
72 /** |
|
73 * C++ default constructor. |
|
74 */ |
|
75 CMetaDataParserWMA( CMetaDataSource& aSource ); |
|
76 |
|
77 /** |
|
78 * By default Symbian 2nd phase constructor is private. |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 /** |
|
83 * Validates whether there is ID3v1 tag in the source or not. |
|
84 */ |
|
85 TBool ValidateL(); |
|
86 |
|
87 /** |
|
88 * Append title to the container, if found. |
|
89 * @return void |
|
90 */ |
|
91 void GetTitleL(); |
|
92 |
|
93 /** |
|
94 * Append artist to the container, if found. |
|
95 * @return void |
|
96 */ |
|
97 void GetAuthorL(); |
|
98 |
|
99 /** |
|
100 * Append Copyright to the container, if found. |
|
101 * @return void |
|
102 */ |
|
103 void GetCopyrightL(); |
|
104 |
|
105 /** |
|
106 * Append Comment to the container, if found. |
|
107 * @return void |
|
108 */ |
|
109 void GetCommentL(); |
|
110 |
|
111 /** |
|
112 * Append jpeg picture to the container, if found. |
|
113 * @return void |
|
114 */ |
|
115 void GetJpegL(); |
|
116 |
|
117 /** |
|
118 * Append duration to the container, if found. |
|
119 * @return void |
|
120 */ |
|
121 void GetDurationL(); |
|
122 |
|
123 /** |
|
124 * Parses all entries in Content Description Object |
|
125 * @return void |
|
126 */ |
|
127 void ParseContentDescriptionObject(); |
|
128 |
|
129 /** |
|
130 * Parses all entries in Extended Content Description Object |
|
131 * @return void |
|
132 */ |
|
133 void ParseExtendedContentDescriptionObjectL(); |
|
134 |
|
135 /** |
|
136 * Gets a Extended Content Description Object Entry |
|
137 * @param aFieldId the field to parse |
|
138 * @param aOffset offset at which to find the field |
|
139 * @return void |
|
140 */ |
|
141 TBool GetExtContDesEntryL(TMetaDataFieldId aFieldId, TInt aOffset); |
|
142 |
|
143 /** |
|
144 * Converts to unicode. |
|
145 * @param aDesc Source to be converted to unicode. |
|
146 * @param aUnicode Contains the converted unicode on return. |
|
147 * @return KErrNone if successful, otherwise one of the system errors. |
|
148 */ |
|
149 TInt ConvertToUnicodeL( const TDesC8& aDesc, TDes16& aUnicode ); |
|
150 |
|
151 /** |
|
152 * Formats Global UID |
|
153 * @return void |
|
154 */ |
|
155 void FormatGUID(TDes8 &aGUID); |
|
156 |
|
157 /** |
|
158 * Descriptor to 64 bit integer conversion |
|
159 * @return void |
|
160 */ |
|
161 TInt64 ConvertToInt64(TDesC8& aDes); |
|
162 |
|
163 /** |
|
164 * Descriptor to 32 bit integer conversion |
|
165 * @return void |
|
166 */ |
|
167 TInt ConvertToInt32(TDesC8& aDes); |
|
168 |
|
169 /** |
|
170 * Descriptor to 16 bit integer conversion |
|
171 * @return void |
|
172 */ |
|
173 TInt ConvertToInt16(TDesC8& aDes); |
|
174 |
|
175 /** |
|
176 * 8 bit Descriptor to 16 bit Descriptor conversion |
|
177 * @return void |
|
178 */ |
|
179 void ConvertDes8toDes16(const TDesC8& aDes8,TDes16& aDes16); |
|
180 |
|
181 /** |
|
182 * Parses all entries in Header Extension Object |
|
183 * @return void |
|
184 */ |
|
185 void ParseHeaderExtensionObjectL(); |
|
186 |
|
187 /** |
|
188 * Parses all entries in Metadata Library Object |
|
189 * @return void |
|
190 */ |
|
191 void ParseMetadataLibraryObjectL(); |
|
192 private: // Data |
|
193 |
|
194 // Metadata source |
|
195 CMetaDataSource& iSource; |
|
196 // Header data |
|
197 HBufC8* iHeaderData; |
|
198 // Character Set Id used during Unicode conversion |
|
199 TUint iCharacterSetId; |
|
200 |
|
201 // offset of Content Description Object |
|
202 TInt iContentDescriptionOffset; |
|
203 // offset of File Properties Object |
|
204 TInt iFilePropertiesOffset; |
|
205 // offset of Extended Content Description Object |
|
206 TInt iExtendedContentDescriptionOffset; |
|
207 // offset of Header Extension Object |
|
208 TInt iHeaderExtensionOffset; |
|
209 TInt64 iHeaderExtensionObjectSize; |
|
210 // offset of Metadata Library Object |
|
211 TInt iMetadataLibraryOffset; |
|
212 TInt64 iMetadataLibraryObjectSize; |
|
213 TInt iMetadataLibraryDescriptionCount; |
|
214 TInt iExtendedContentDescriptionCount; |
|
215 TInt iAlbumTitleOffset; |
|
216 TInt iPictureOffset; |
|
217 TInt iTextOffset; |
|
218 TInt iComposerOffset; |
|
219 TInt iGenreOffset; |
|
220 TInt iYearOffset; |
|
221 TInt iOriginalArtistOffset; |
|
222 TInt iTrackNumberOffset; |
|
223 TInt iUniqueFileIdentifierOffset; |
|
224 TInt iAudioFileURLOffset; |
|
225 TInt iSharedUserRatingOffset; |
|
226 TInt iDateOffset; |
|
227 TInt iLyricsOffset; |
|
228 #ifdef __WINDOWS_MEDIA |
|
229 TInt iProviderOffset; |
|
230 #endif |
|
231 |
|
232 TInt iTitleLength; |
|
233 TInt iAuthorLength; |
|
234 TInt iCopyrightLength; |
|
235 TInt iDescriptionLength; |
|
236 TInt iRatingLength; |
|
237 TBool iContentDescriptionObjectExists; |
|
238 TBool iFilePropertiesObjectExists; |
|
239 TBool iExtendedContentDescriptionObjectExists; |
|
240 TBool iHeaderExtensionObjectExists; |
|
241 TBool iMetadataLibraryObjectExists; |
|
242 TBool iMetadatLibraryObjectJpegExists; |
|
243 }; |
|
244 |
|
245 #endif // CMetaDataParserWMA_H |
|
246 |
|
247 // End of File |