|
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 MP4 metadata parser |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CMETADATAPARSERMP4_H |
|
21 #define CMETADATAPARSERMP4_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <mp4lib.h> |
|
26 |
|
27 #include "MetaDataParser.h" |
|
28 #include "MetaDataFieldContainer.h" |
|
29 #include "MetaDataField.h" |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 const TInt K3gpMetaLength = 256; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * This class implements an MP4 metadata parser. |
|
39 * |
|
40 * @lib MetaDataUtility.lib |
|
41 * @since 3.0 |
|
42 */ |
|
43 class CMetaDataParserMP4 : public CMetaDataParser |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 |
|
47 /** |
|
48 * C++ default constructor. |
|
49 */ |
|
50 CMetaDataParserMP4(); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 virtual ~CMetaDataParserMP4(); |
|
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 virtual void ParseL( const RArray<TMetaDataFieldId>& aWantedFields, CMetaDataFieldContainer& aContainer ) = 0; |
|
69 |
|
70 public: // New functions |
|
71 |
|
72 /** |
|
73 * Initializes the parser with the specified file. |
|
74 * @since 3.0 |
|
75 * @param aFileName The name of the file |
|
76 * @return void |
|
77 */ |
|
78 void InitializeFileL( ContentAccess::CData *aData); |
|
79 |
|
80 /** |
|
81 * Initializes the parser with the specified descriptor. |
|
82 * @since 3.0 |
|
83 * @param aDes Source descriptor |
|
84 * @return void |
|
85 */ |
|
86 void InitializeDesL( const TDesC8& aDes ); |
|
87 |
|
88 /** |
|
89 * Validates whether this is valid MP4 source or not. |
|
90 * @since 3.0 |
|
91 * @return ETrue if valid, EFalse otherwise. |
|
92 */ |
|
93 virtual TBool ValidateL() = 0; |
|
94 |
|
95 /** |
|
96 * Translates error code from MP4 library to one of System Errors. |
|
97 * @since 3.0 |
|
98 * @param aError error code from MP4 library |
|
99 * @return System error |
|
100 */ |
|
101 TInt TranslateMP4Err( MP4Err aError ); |
|
102 |
|
103 /** |
|
104 * Reads the duration from the source and appends it to the container. |
|
105 * @since 3.0 |
|
106 * @param aSize Size of the data. |
|
107 * @return void |
|
108 */ |
|
109 void GetDurationL(TMetaDataFieldId aFieldId ); |
|
110 |
|
111 /** |
|
112 * Converts to unicode. |
|
113 * @param aDesc Source to be converted to unicode. |
|
114 * @param aUnicode Contains the converted unicode on return. |
|
115 * @return The number of unconverted characters left at the end of the input descriptor |
|
116 * (e.g. because the output descriptor is not long enough to hold all the text), |
|
117 * or one of the error values defined in TError. |
|
118 */ |
|
119 TInt ConvertToUnicodeL( const TDesC8& aDesc, TDes16& aUnicode ); |
|
120 |
|
121 |
|
122 protected: // Data |
|
123 |
|
124 // MP4 library handle |
|
125 MP4Handle iMP4Handle; |
|
126 }; |
|
127 |
|
128 #endif // CMETADATAPARSERMP4_H |
|
129 |
|
130 // End of File |