53
|
1 |
/*
|
|
2 |
* ==============================================================================
|
|
3 |
* Name : 3GPExtParser.h
|
|
4 |
* Part of : 3GPExtParser
|
|
5 |
* Interface : ?Interface_category, ?Interface_name
|
|
6 |
* Description : This class implements an 3GPExt metadata parser
|
|
7 |
* Version : 6
|
|
8 |
*
|
|
9 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
10 |
* All rights reserved.
|
|
11 |
* This component and the accompanying materials are made available
|
|
12 |
* under the terms of "Eclipse Public License v1.0"
|
|
13 |
* which accompanies this distribution, and is available
|
|
14 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
15 |
*
|
|
16 |
* Initial Contributors:
|
|
17 |
* Nokia Corporation - initial contribution.
|
|
18 |
* ==============================================================================
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
#ifndef C3GPEXTPARSER_H
|
|
23 |
#define C3GPEXTPARSER_H
|
|
24 |
|
|
25 |
// INCLUDES
|
|
26 |
#include <e32base.h>
|
|
27 |
#include <mp4lib.h>
|
|
28 |
|
|
29 |
#include "MetaDataFieldContainer.h"
|
|
30 |
#include "MetaDataField.hrh"
|
|
31 |
|
|
32 |
// CONSTANTS
|
|
33 |
|
|
34 |
_LIT8 (K3GPExtMetaTitleFormat, "%cnam");
|
|
35 |
_LIT8 (K3GPExtMetaArtistFormat, "%cART");
|
|
36 |
_LIT8 (K3GPExtMetaComposerFormat, "%cwrt");
|
|
37 |
_LIT8 (K3GPExtMetaAlbumFormat, "%calb");
|
|
38 |
_LIT8 (K3GPExtMetaCommentFormat, "%ccmt");
|
|
39 |
_LIT8 (K3GPExtMetaCustomGenreFormat, "%cgen"); // mapped to rating
|
|
40 |
_LIT8 (K3GPExtMetaYearFormat, "%cday");
|
|
41 |
_LIT8 (K3GPExtMetaGenre, "gnre");
|
|
42 |
_LIT8 (K3GPExtMetaTrack, "trkn");
|
|
43 |
_LIT8 (K3GPExtMetaJpeg, "covr");
|
|
44 |
|
|
45 |
|
|
46 |
// CLASS DECLARATION
|
|
47 |
|
|
48 |
/**
|
|
49 |
* This class implements an 3GPExt metadata parser.
|
|
50 |
*
|
|
51 |
* @lib 3GPExtParser.lib
|
|
52 |
* @since 3.0
|
|
53 |
*/
|
|
54 |
class C3GPExtParser : public CBase
|
|
55 |
{
|
|
56 |
public: // Constructors and destructor
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Two-phased constructor.
|
|
60 |
* @return A pointer to a new instance of parser; NULL if parser is not created.
|
|
61 |
*/
|
|
62 |
IMPORT_C static C3GPExtParser* NewL(MP4Handle& aMP4Handle);
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Destructor.
|
|
66 |
*/
|
|
67 |
IMPORT_C virtual ~C3GPExtParser();
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Extract meta data boxes from ilst
|
|
71 |
* @since 3.0
|
|
72 |
* @param aBox wanted metadata box
|
|
73 |
* @param aFieldId metadata field in 3GPExtParser
|
|
74 |
* @return void
|
|
75 |
*/
|
|
76 |
IMPORT_C void GetilstBoxesL(const TDesC8& aBox, TMetaDataFieldId aFieldId, HBufC** aBuf);
|
|
77 |
/**
|
|
78 |
* Extract meta data boxes from ilst
|
|
79 |
* 8-bit version to support international languages in string metadata
|
|
80 |
* @since 3.1
|
|
81 |
* @param aBox wanted metadata box
|
|
82 |
* @param aFieldId metadata field in 3GPExtParser
|
|
83 |
* @return void
|
|
84 |
*/
|
|
85 |
IMPORT_C void GetilstBoxesL(const TDesC8& aBox, TMetaDataFieldId aFieldId, HBufC8** aBuf);
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Checks if file has 3GPExt metadata
|
|
89 |
*/
|
|
90 |
IMPORT_C TBool Is3GPExtMetadataL();
|
|
91 |
|
|
92 |
private:
|
|
93 |
|
|
94 |
/**
|
|
95 |
* C++ default constructor.
|
|
96 |
*/
|
|
97 |
C3GPExtParser(MP4Handle& aMP4Handle);
|
|
98 |
|
|
99 |
/**
|
|
100 |
* By default Symbian 2nd phase constructor is private.
|
|
101 |
*/
|
|
102 |
void ConstructL();
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Maps ID3v1 genre integer to string
|
|
106 |
* @param aNum genre integer code
|
|
107 |
* @param aGenrePtr string genre value returned
|
|
108 |
* @since 3.0
|
|
109 |
* @return void
|
|
110 |
*/
|
|
111 |
void MapID3GenreToString(TInt aNum, TDes& aGenrePtr);
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Translates error code from MP4 library to one of System Errors.
|
|
115 |
* @since 3.0
|
|
116 |
* @param aError error code from MP4 library
|
|
117 |
* @return System error
|
|
118 |
*/
|
|
119 |
TInt TranslateMP4Err( MP4Err aError );
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Parses iList Boxes
|
|
123 |
* @since 3.0
|
|
124 |
* @param none
|
|
125 |
* @return void
|
|
126 |
*/
|
|
127 |
void ParseIlstBoxesL();
|
|
128 |
|
|
129 |
private:
|
|
130 |
|
|
131 |
// MP4 Handle
|
|
132 |
MP4Handle& iMP4Handle;
|
|
133 |
// ilst box
|
|
134 |
TPtrC8 ilst;
|
|
135 |
// 3GPExt metadata exists
|
|
136 |
TBool iExists;
|
|
137 |
// local chunk
|
|
138 |
RChunk iChunk;
|
|
139 |
// chuck status
|
|
140 |
TInt iChunkStatus;
|
|
141 |
|
|
142 |
|
|
143 |
TUint32 iTitleOffset;
|
|
144 |
TUint32 iTitleSize;
|
|
145 |
TUint32 iArtistOffset;
|
|
146 |
TUint32 iArtistSize;
|
|
147 |
TUint32 iComposerOffset;
|
|
148 |
TUint32 iComposerSize;
|
|
149 |
TUint32 iAlbumOffset;
|
|
150 |
TUint32 iAlbumSize;
|
|
151 |
TUint32 iCommentOffset;
|
|
152 |
TUint32 iCommentSize;
|
|
153 |
TUint32 iCustomGenreOffset;
|
|
154 |
TUint32 iCustomGenreSize;
|
|
155 |
TUint32 iYearOffset;
|
|
156 |
TUint32 iYearSize;
|
|
157 |
TUint32 iGenreOffset;
|
|
158 |
TUint32 iGenreSize;
|
|
159 |
TUint32 iTrackNumberOffset;
|
|
160 |
TUint32 iTrackNumberSize;
|
|
161 |
TUint32 iCoverOffset;
|
|
162 |
TUint32 iCoverSize;
|
|
163 |
|
|
164 |
public:
|
|
165 |
// constants
|
|
166 |
TBuf8<4> K3GPExtMetaTitle;
|
|
167 |
TBuf8<4> K3GPExtMetaArtist;
|
|
168 |
TBuf8<4> K3GPExtMetaComposer;
|
|
169 |
TBuf8<4> K3GPExtMetaAlbum;
|
|
170 |
TBuf8<4> K3GPExtMetaComment;
|
|
171 |
TBuf8<4> K3GPExtMetaCustomGenre;
|
|
172 |
TBuf8<4> K3GPExtMetaYear;
|
|
173 |
};
|
|
174 |
|
|
175 |
#endif // C3GPEXTPARSER_H
|
|
176 |
|
|
177 |
// End of File
|