98 return fn; |
98 return fn; |
99 } |
99 } |
100 |
100 |
101 void CMMAMMFResolver::ResolveContentTypeL() |
101 void CMMAMMFResolver::ResolveContentTypeL() |
102 { |
102 { |
103 LOG( EJavaMMAPI, EInfo, "+ CMMAMMFResolver::ResolveContentTypeL()"); |
103 LOG(EJavaMMAPI, EInfo, "+ CMMAMMFResolver::ResolveContentTypeL()"); |
104 CMMFFormatSelectionParameters* fSelect = iRequiredPlayFormatSupport; |
104 CMMFFormatSelectionParameters* fSelect = iRequiredPlayFormatSupport; |
105 if (!fSelect) |
105 if (!fSelect) |
106 { |
106 { |
107 fSelect = iRequiredRecordFormatSupport; |
107 fSelect = iRequiredRecordFormatSupport; |
108 } |
108 } |
121 HBufC8* contentType = NULL; |
121 HBufC8* contentType = NULL; |
122 TInt formatsCount = formats->Count(); |
122 TInt formatsCount = formats->Count(); |
123 |
123 |
124 if (type == CMMFFormatSelectionParameters::EMatchMimeType) |
124 if (type == CMMFFormatSelectionParameters::EMatchMimeType) |
125 { |
125 { |
126 LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - EMatchMimeType"); |
126 LOG(EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - EMatchMimeType"); |
127 // The match was based on a mime type. |
127 // The match was based on a mime type. |
128 contentType = fSelect->MatchData().AllocLC(); |
128 contentType = fSelect->MatchData().AllocLC(); |
129 } |
129 } |
130 else if (type == CMMFFormatSelectionParameters::EMatchFileExtension) |
130 else if (type == CMMFFormatSelectionParameters::EMatchFileExtension) |
131 { |
131 { |
132 LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - EMatchFileExtension"); |
132 LOG(EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - EMatchFileExtension"); |
133 // The match was based on a file extension. |
133 // The match was based on a file extension. |
134 RApaLsSession ls; |
134 RApaLsSession ls; |
135 TInt error; |
135 TInt error; |
136 error = ls.Connect(); |
136 error = ls.Connect(); |
137 TDataRecognitionResult result; |
137 TDataRecognitionResult result; |
147 { |
147 { |
148 contentType = KMimetypeRM().AllocLC(); |
148 contentType = KMimetypeRM().AllocLC(); |
149 } |
149 } |
150 else if (!error && (result.iConfidence >= CApaDataRecognizerType::EProbable)) |
150 else if (!error && (result.iConfidence >= CApaDataRecognizerType::EProbable)) |
151 { |
151 { |
152 LOG1( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - Confidence : %d", result.iConfidence); |
152 LOG1(EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - Confidence : %d", result.iConfidence); |
153 contentType = result.iDataType.Des8().AllocLC(); |
153 contentType = result.iDataType.Des8().AllocLC(); |
154 } |
154 } |
155 |
155 |
156 |
156 |
157 else |
157 else |
171 } |
171 } |
172 } |
172 } |
173 } |
173 } |
174 else if (type == CMMFFormatSelectionParameters::EMatchHeaderData) |
174 else if (type == CMMFFormatSelectionParameters::EMatchHeaderData) |
175 { |
175 { |
176 LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - EMatchHeaderData"); |
176 LOG(EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - EMatchHeaderData"); |
177 // The match was on a header data. |
177 // The match was on a header data. |
178 RApaLsSession ls; |
178 RApaLsSession ls; |
179 TInt error; |
179 TInt error; |
180 error = ls.Connect(); |
180 error = ls.Connect(); |
181 TDataRecognitionResult result; |
181 TDataRecognitionResult result; |
202 } |
202 } |
203 } |
203 } |
204 } |
204 } |
205 else |
205 else |
206 { |
206 { |
207 LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - KErrNotSupported"); |
207 LOG(EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - KErrNotSupported"); |
208 // EMatchAny is not supported |
208 // EMatchAny is not supported |
209 User::Leave(KErrNotSupported); |
209 User::Leave(KErrNotSupported); |
210 } |
210 } |
211 |
211 |
212 // iContentType remains NULL if content type was not found. |
212 // iContentType remains NULL if content type was not found. |
213 if (contentType) |
213 if (contentType) |
214 { |
214 { |
215 LOG1( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - contentType : %s", contentType->Des().PtrZ()); |
215 LOG1(EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - contentType : %s", contentType->Des().PtrZ()); |
216 |
216 |
217 HBufC* ct = HBufC::NewL(contentType->Length()); |
217 HBufC* ct = HBufC::NewL(contentType->Length()); |
218 (ct->Des()).Copy(*contentType); |
218 (ct->Des()).Copy(*contentType); |
219 CleanupStack::PopAndDestroy(contentType); |
219 CleanupStack::PopAndDestroy(contentType); |
220 delete iContentType; |
220 delete iContentType; |
221 iContentType = ct; |
221 iContentType = ct; |
222 } |
222 } |
223 else |
223 else |
224 { |
224 { |
225 //This situation should never occur |
225 //This situation should never occur |
226 LOG( EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - contentType = NULL"); |
226 LOG(EJavaMMAPI, EInfo, "CMMAMMFResolver::ResolveContentTypeL - contentType = NULL"); |
227 User::Leave(KErrUnknown); |
227 User::Leave(KErrUnknown); |
228 } |
228 } |
229 LOG( EJavaMMAPI, EInfo, "- CMMAMMFResolver::ResolveContentTypeL()"); |
229 LOG(EJavaMMAPI, EInfo, "- CMMAMMFResolver::ResolveContentTypeL()"); |
230 } |
230 } |
231 |
231 |
232 |
232 |
233 TBool CMMAMMFResolver::IsRealVideoTypeL(const TDesC& aFileName) |
233 TBool CMMAMMFResolver::IsRealVideoTypeL(const TDesC& aFileName) |
234 { |
234 { |
236 |
236 |
237 CHXMetaDataUtility *putil; |
237 CHXMetaDataUtility *putil; |
238 putil = CHXMetaDataUtility::NewL(); |
238 putil = CHXMetaDataUtility::NewL(); |
239 CleanupStack::PushL(putil); |
239 CleanupStack::PushL(putil); |
240 TRAPD(err, putil->OpenFileL(aFileName)); |
240 TRAPD(err, putil->OpenFileL(aFileName)); |
241 ELOG1( EJavaMMAPI, "MMA:CMMAMMFResolver::IsRealVideoTypeL, err = %d", err); |
241 ELOG1(EJavaMMAPI, "MMA:CMMAMMFResolver::IsRealVideoTypeL, err = %d", err); |
242 |
242 |
243 if (err != KErrNone) |
243 if (err != KErrNone) |
244 { |
244 { |
245 CleanupStack::Pop(putil); |
245 CleanupStack::Pop(putil); |
246 putil->ResetL(); |
246 putil->ResetL(); |