5
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-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 the License "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 provides the core functionality to Media Management
|
|
15 |
* SAPI Interafce
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#include <mclfitemlistmodel.h>
|
|
22 |
#include <mclfcontentlistingengine.h>
|
|
23 |
#include <contentlistingfactory.h>
|
|
24 |
#include <mclfsortingstyle.h>
|
|
25 |
|
|
26 |
|
|
27 |
#include "mgservice.h"
|
|
28 |
#include "mgpostfilter.h"
|
|
29 |
#include "mgoperationobserver.h"
|
|
30 |
#include "mgclfoperationobserver.h"
|
|
31 |
#include "mgconsts.h"
|
|
32 |
|
|
33 |
// Inclusion for thumbnail generation
|
|
34 |
|
|
35 |
#include"mgthumbnailgeneration.h"
|
|
36 |
#include"mgthumbobserver.h"
|
|
37 |
|
|
38 |
//Media types.
|
|
39 |
_LIT8( KMgMusic ,"Music" );
|
|
40 |
_LIT8( KMgSound ,"Sound" );
|
|
41 |
_LIT8( KMgImage ,"Image" );
|
|
42 |
_LIT8( KMgVideo ,"Video" );
|
|
43 |
_LIT8( KMgStreamingURL ,"StreamingURL" );
|
|
44 |
|
|
45 |
|
|
46 |
//SortingOrder
|
|
47 |
_LIT8( KMgDescending, "Descending" );
|
|
48 |
//_LIT8( KMgAscending, "Ascending" );
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
// -----------------------------------------------------------------------------
|
|
53 |
// CMgService::NewLC
|
|
54 |
// Returns the instance of CMgService class.
|
|
55 |
// -----------------------------------------------------------------------------
|
|
56 |
EXPORT_C CMgService* CMgService::NewL()
|
|
57 |
{
|
|
58 |
CMgService* self = new ( ELeave )CMgService();
|
|
59 |
CleanupStack::PushL( self );
|
|
60 |
self->ConstructL();
|
|
61 |
CleanupStack::Pop( self );
|
|
62 |
return self;
|
|
63 |
}
|
|
64 |
// -----------------------------------------------------------------------------
|
|
65 |
// CMgService::~CMgService
|
|
66 |
// Destructor
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
|
|
69 |
CMgService::~CMgService()
|
|
70 |
{
|
|
71 |
|
|
72 |
//release filter class
|
|
73 |
if(iFilter)
|
|
74 |
{
|
|
75 |
delete iFilter;
|
|
76 |
}
|
|
77 |
|
|
78 |
// release sorting style
|
|
79 |
if(iSortingStyle)
|
|
80 |
{
|
|
81 |
delete iSortingStyle;
|
|
82 |
}
|
|
83 |
|
|
84 |
// release clf observer class
|
|
85 |
if(iClfObserver)
|
|
86 |
{
|
|
87 |
delete iClfObserver;
|
|
88 |
}
|
|
89 |
|
|
90 |
//release iEngine;
|
|
91 |
if(iEngine)
|
|
92 |
{
|
|
93 |
delete iEngine;
|
|
94 |
}
|
|
95 |
|
|
96 |
// releasing iTumbnailGeneration
|
|
97 |
if(iTumbnailGeneration)
|
|
98 |
{
|
|
99 |
delete iTumbnailGeneration;
|
|
100 |
}
|
|
101 |
|
|
102 |
}
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
// -----------------------------------------------------------------------------
|
|
108 |
// CMgService::GetFiles
|
|
109 |
// This function extracts all media item that match the given arguments
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
|
|
112 |
EXPORT_C void CMgService::GetListL(const TMgServiceRequest& aInParameters,
|
|
113 |
MMgOperationObserver* aServiceObserver)
|
|
114 |
{
|
|
115 |
|
|
116 |
//Check if the class is busy or waiting for asynchronous request
|
|
117 |
//This has already been verified by SAPI interface class ,still this condition
|
|
118 |
//is checked keeping in mind that this class may be called directly by a
|
|
119 |
//Series60 application in future
|
|
120 |
if( EMgFree == iState )
|
|
121 |
{
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
if( NULL != aServiceObserver )//Asynchronous request
|
|
126 |
{
|
|
127 |
// create the instance of CLF list Model for the current request
|
|
128 |
MCLFItemListModel* listModel = iEngine->
|
|
129 |
CreateListModelLC( *iClfObserver );
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
SendRequestToClfL( aInParameters.iFileType,
|
|
135 |
aInParameters.iFilterField,
|
|
136 |
aInParameters.iStartVal,
|
|
137 |
aInParameters.iEndVal,
|
|
138 |
aInParameters.iSortField,
|
|
139 |
aInParameters.iOrder,
|
|
140 |
listModel );
|
|
141 |
|
|
142 |
CleanupStack::Pop();
|
|
143 |
|
|
144 |
iTransactionID = aInParameters.iTransactionID;
|
|
145 |
iClfObserver->SetMemberVar( aInParameters.iTransactionID,
|
|
146 |
aServiceObserver,
|
|
147 |
listModel,
|
|
148 |
this );
|
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
}
|
|
153 |
else
|
|
154 |
{
|
|
155 |
//Synchronous request handling is currently not supported
|
|
156 |
User::Leave( KErrNotSupported );
|
|
157 |
}
|
|
158 |
|
|
159 |
}//SAPI State
|
|
160 |
else
|
|
161 |
{
|
|
162 |
User::Leave( KErrServerBusy ); // busy in previous request
|
|
163 |
}
|
|
164 |
|
|
165 |
}
|
|
166 |
|
|
167 |
|
|
168 |
// -----------------------------------------------------------------------------
|
|
169 |
// CMgService::Cancel
|
|
170 |
// Cancel the pending asynchronous request
|
|
171 |
// -----------------------------------------------------------------------------
|
|
172 |
EXPORT_C TInt CMgService::CancelL( TUint aTransactionID)
|
|
173 |
{
|
|
174 |
// call cancel of CLF
|
|
175 |
// Right now we are not supporting aTransactionID
|
|
176 |
// but in future we have to find the iClfObserver
|
|
177 |
// coresponding to this Transaction ID and Call cancel
|
|
178 |
// on that observer
|
|
179 |
if( EMgBusy == iState )
|
|
180 |
{
|
|
181 |
if( aTransactionID == iTransactionID )
|
|
182 |
{
|
|
183 |
iClfObserver->CancelL( );
|
|
184 |
Clear();
|
|
185 |
return KErrNone;
|
|
186 |
}
|
|
187 |
}
|
|
188 |
|
|
189 |
// Calling cancel of thumbnail
|
|
190 |
|
|
191 |
if(aTransactionID != iTransactionID)
|
|
192 |
{
|
|
193 |
return CancelThumbnailReq(aTransactionID);
|
|
194 |
}
|
|
195 |
|
|
196 |
return KErrArgument;
|
|
197 |
|
|
198 |
}
|
|
199 |
// -----------------------------------------------------------------------------
|
|
200 |
// CMgService::CancelThumbnailReq
|
|
201 |
// Cancel the pending asynchronous request for thumbnail generation
|
|
202 |
// -----------------------------------------------------------------------------
|
|
203 |
TInt CMgService::CancelThumbnailReq( TUint aTransactionID )
|
|
204 |
{
|
|
205 |
return iTumbnailGeneration->Cancel(aTransactionID);
|
|
206 |
}
|
|
207 |
// -----------------------------------------------------------------------------
|
|
208 |
// CMgService::Clear
|
|
209 |
// It will clear the set filter metadata field ,registered callback
|
|
210 |
// function and sorting fields
|
|
211 |
// -----------------------------------------------------------------------------
|
|
212 |
|
|
213 |
void CMgService::Clear()
|
|
214 |
{
|
|
215 |
iFilter->Clear();
|
|
216 |
iState = EMgFree;
|
|
217 |
iTransactionID = 0;
|
|
218 |
}
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
// -----------------------------------------------------------------------------
|
|
224 |
// CMgService::State
|
|
225 |
// It will return the state of service class.
|
|
226 |
// return EMgFree if it is free and ready to accept
|
|
227 |
// the another request else EMgBusy
|
|
228 |
// -----------------------------------------------------------------------------
|
|
229 |
EXPORT_C const TMgState& CMgService::State() const
|
|
230 |
{
|
|
231 |
return iState;
|
|
232 |
}
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
|
237 |
// -----------------------------------------------------------------------------
|
|
238 |
// CMgService::SetSortingField
|
|
239 |
// It will set the metadata field on which the result
|
|
240 |
// should be sorted.
|
|
241 |
// Leave with KErrArgument if aSortField is not valid.
|
|
242 |
// -----------------------------------------------------------------------------
|
|
243 |
|
|
244 |
void CMgService::SetSortingFieldL(const TDesC8& aSortField ,
|
|
245 |
const TDesC8& aOrder ,
|
|
246 |
const RArray<TInt>& aMediaTypes,
|
|
247 |
MCLFItemListModel* alistModel )
|
|
248 |
{
|
|
249 |
|
|
250 |
// Default sorting as per file name
|
|
251 |
TCLFDefaultFieldId metaDataId = ECLFFieldIdFileName;
|
|
252 |
TCLFItemDataType metaDataType = ECLFItemDataTypeDesC;
|
|
253 |
|
|
254 |
//Check If the aSortField is not NULL Descriptor i.e.
|
|
255 |
// sorting metadata is specified
|
|
256 |
|
|
257 |
if( 0 != aSortField.CompareF( KNullDesC8 ) )
|
|
258 |
{
|
|
259 |
|
|
260 |
GetMetaDataIdAndType( aSortField,
|
|
261 |
metaDataId,
|
|
262 |
metaDataType,
|
|
263 |
aMediaTypes );
|
|
264 |
|
|
265 |
if( ECLFFieldIdNull == metaDataId ) // check the return type
|
|
266 |
{
|
|
267 |
// The given Sort Field is not supported by Media Management SAPI
|
|
268 |
User::Leave( KErrArgument );
|
|
269 |
}
|
|
270 |
}
|
|
271 |
|
|
272 |
iSortingStyle->ResetL();
|
|
273 |
|
|
274 |
|
|
275 |
//Set the field on which sorting has to perform
|
|
276 |
iSortingStyle->AddFieldL( metaDataId );
|
|
277 |
|
|
278 |
// Set the sorting field data type
|
|
279 |
iSortingStyle->SetSortingDataType( metaDataType );
|
|
280 |
|
|
281 |
if( 0 == aOrder.CompareF( KMgDescending ) )
|
|
282 |
{
|
|
283 |
iSortingStyle->SetOrdering( ECLFOrderingDescending );
|
|
284 |
}
|
|
285 |
else if( 0 == aOrder.CompareF( KMgAscending) )
|
|
286 |
{
|
|
287 |
iSortingStyle->SetOrdering( ECLFOrderingAscending );
|
|
288 |
}
|
|
289 |
else
|
|
290 |
{
|
|
291 |
User::Leave( KErrArgument );
|
|
292 |
}
|
|
293 |
|
|
294 |
//Items with undefined fields are placed after items with defined fields
|
|
295 |
iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
|
|
296 |
|
|
297 |
// set sorting style in CLF.
|
|
298 |
alistModel->SetSortingStyle( iSortingStyle );
|
|
299 |
|
|
300 |
|
|
301 |
}
|
|
302 |
|
|
303 |
|
|
304 |
// -----------------------------------------------------------------------------
|
|
305 |
// CPostFilter::SetFilterMetaData
|
|
306 |
// Method to set the filter metadata
|
|
307 |
// -----------------------------------------------------------------------------
|
|
308 |
void CMgService::SetFilterMetaDataL( const TDesC8& aFilterField,
|
|
309 |
const TDesC& aStartVal,
|
|
310 |
const TDesC& aEndVal,
|
|
311 |
const RArray<TInt>& aMediaTypes,
|
|
312 |
MCLFItemListModel* alistModel )
|
|
313 |
{
|
|
314 |
TCLFDefaultFieldId metaDataId;
|
|
315 |
TCLFItemDataType metaDataType;
|
|
316 |
|
|
317 |
|
|
318 |
|
|
319 |
//Check If the Filter Meta Data is NULL Descriptor, if so
|
|
320 |
// no filtration will be performed
|
|
321 |
if( 0 == aFilterField.CompareF( KNullDesC8 ) )
|
|
322 |
{
|
|
323 |
metaDataId = ECLFFieldIdNull;
|
|
324 |
metaDataType = ECLFItemDataTypeDesC; // Blank Descriptor
|
|
325 |
iFilter->SetFilterMetaData( metaDataId, metaDataType );
|
|
326 |
}
|
|
327 |
else
|
|
328 |
{
|
|
329 |
GetMetaDataIdAndType( aFilterField,
|
|
330 |
metaDataId,
|
|
331 |
metaDataType,
|
|
332 |
aMediaTypes);
|
|
333 |
|
|
334 |
if( ECLFFieldIdNull == metaDataId )
|
|
335 |
{
|
|
336 |
// The given metaData is not supported by Media Management SAPI
|
|
337 |
User::Leave( KErrArgument );
|
|
338 |
}
|
|
339 |
|
|
340 |
|
|
341 |
iFilter->SetFilterMetaData( metaDataId, metaDataType );
|
|
342 |
|
|
343 |
// set filter value of CLF
|
|
344 |
iFilter->SetFilterValueL( aStartVal,aEndVal );
|
|
345 |
|
|
346 |
// Set Post Filter in CLF
|
|
347 |
alistModel->SetPostFilter( iFilter );
|
|
348 |
|
|
349 |
}
|
|
350 |
|
|
351 |
}
|
|
352 |
|
|
353 |
|
|
354 |
// -----------------------------------------------------------------------------
|
|
355 |
// CMgService::ConstuctL
|
|
356 |
// It will intialize the underlying CLF(Content Listing Framework)
|
|
357 |
// framework classes and CPostFilter class.
|
|
358 |
// -----------------------------------------------------------------------------
|
|
359 |
void CMgService::ConstructL()
|
|
360 |
{
|
|
361 |
// create the instance of CLF engine and store it in member data.
|
|
362 |
iEngine = ContentListingFactory::NewContentListingEngineLC();
|
|
363 |
CleanupStack::Pop();
|
|
364 |
|
|
365 |
|
|
366 |
// create the instance of CPostFilter and store it in member data
|
|
367 |
iFilter = CPostFilter::NewL();
|
|
368 |
|
|
369 |
// Get the sorting style from CLF
|
|
370 |
iSortingStyle = ContentListingFactory::NewSortingStyleLC();
|
|
371 |
CleanupStack::Pop();
|
|
372 |
|
|
373 |
//create the instance of clf observer
|
|
374 |
iClfObserver = CClfOperationObserver::NewL();
|
|
375 |
|
|
376 |
// creates instance for async requestmanager for thumbnail
|
|
377 |
iTumbnailGeneration = CThumbnailGeneration::NewL();
|
|
378 |
|
|
379 |
}
|
|
380 |
|
|
381 |
|
|
382 |
|
|
383 |
|
|
384 |
// -----------------------------------------------------------------------------
|
|
385 |
// CMgService::CMgService
|
|
386 |
// Constructor
|
|
387 |
// -----------------------------------------------------------------------------
|
|
388 |
CMgService::CMgService()
|
|
389 |
: iState( EMgFree ),
|
|
390 |
iEngine( NULL ),
|
|
391 |
iFilter( NULL ),
|
|
392 |
iSortingStyle( NULL ),
|
|
393 |
iClfObserver( NULL ),
|
|
394 |
iTransactionID( 0 ),
|
|
395 |
iTumbnailGeneration(NULL)
|
|
396 |
{
|
|
397 |
|
|
398 |
}
|
|
399 |
|
|
400 |
|
|
401 |
|
|
402 |
// -----------------------------------------------------------------------------
|
|
403 |
// CMgService::SetMediaTypeL
|
|
404 |
// It will convert the aFiletype string into
|
|
405 |
// equivalent Mediatype ID and Fill the Media Type Array
|
|
406 |
// if it is not valid then return KErrNotSupported
|
|
407 |
// -----------------------------------------------------------------------------
|
|
408 |
void CMgService::SetMediaTypeL (const TDesC8& aFileType,
|
|
409 |
RArray<TInt>& aMediaType)
|
|
410 |
{
|
|
411 |
|
|
412 |
if( 0 == aFileType.CompareF( KMgMusic ) )
|
|
413 |
{
|
|
414 |
aMediaType.AppendL( ECLFMediaTypeMusic );
|
|
415 |
}
|
|
416 |
else if( 0 == aFileType.CompareF( KMgSound ) )
|
|
417 |
{
|
|
418 |
aMediaType.AppendL( ECLFMediaTypeSound );
|
|
419 |
}
|
|
420 |
|
|
421 |
else if( 0 == aFileType.CompareF( KMgImage ) )
|
|
422 |
{
|
|
423 |
aMediaType.AppendL( ECLFMediaTypeImage );
|
|
424 |
}
|
|
425 |
|
|
426 |
else if( 0 == aFileType.CompareF( KMgVideo ) )
|
|
427 |
{
|
|
428 |
aMediaType.AppendL( ECLFMediaTypeVideo );
|
|
429 |
}
|
|
430 |
|
|
431 |
else if( 0 == aFileType.CompareF( KMgStreamingURL ) )
|
|
432 |
{
|
|
433 |
aMediaType.AppendL( ECLFMediaTypeStreamingURL );
|
|
434 |
}
|
|
435 |
else
|
|
436 |
{
|
|
437 |
User::Leave ( KErrArgument ); // Media Type Not suuported
|
|
438 |
}
|
|
439 |
|
|
440 |
}
|
|
441 |
|
|
442 |
|
|
443 |
|
|
444 |
|
|
445 |
|
|
446 |
// -----------------------------------------------------------------------------
|
|
447 |
// CMgService::SendRequestToCLF
|
|
448 |
// This Function will pass the request to CLF frame work for required media type.
|
|
449 |
// return KErrArgument if the FilterMetaData is not Supported
|
|
450 |
// return KErrArgument if the Start Value is not Supported
|
|
451 |
// return KErrArgument if the End Value is mot supported
|
|
452 |
// return KErrNone if sucessful
|
|
453 |
// -----------------------------------------------------------------------------
|
|
454 |
|
|
455 |
void CMgService::SendRequestToClfL( const TDesC8& aFileType,
|
|
456 |
const TDesC8& aFilterField,
|
|
457 |
const TDesC& aStartVal,
|
|
458 |
const TDesC& aEndVal,
|
|
459 |
const TDesC8& aSortField,
|
|
460 |
const TDesC8& aOrder,
|
|
461 |
MCLFItemListModel* alistModel )
|
|
462 |
{
|
|
463 |
|
|
464 |
|
|
465 |
|
|
466 |
RArray<TInt> mediaTypes;
|
|
467 |
CleanupClosePushL( mediaTypes );
|
|
468 |
|
|
469 |
//check if it is a valid file type or not
|
|
470 |
SetMediaTypeL( aFileType,mediaTypes );
|
|
471 |
|
|
472 |
|
|
473 |
//set wanted media type in CLF
|
|
474 |
alistModel->SetWantedMediaTypesL( mediaTypes.Array() );
|
|
475 |
|
|
476 |
|
|
477 |
// Set Filter Meta Data and Value
|
|
478 |
SetFilterMetaDataL( aFilterField,aStartVal,aEndVal,mediaTypes,alistModel);
|
|
479 |
|
|
480 |
|
|
481 |
|
|
482 |
// call set sorting field of CLF
|
|
483 |
SetSortingFieldL( aSortField,aOrder,mediaTypes,alistModel );
|
|
484 |
|
|
485 |
// set the state = Busy
|
|
486 |
// till this request is complete
|
|
487 |
//which indicates no further request will be taken
|
|
488 |
iState = EMgBusy;
|
|
489 |
|
|
490 |
//asynchronous call to CLF ECLFRefreshAll
|
|
491 |
alistModel->RefreshL();
|
|
492 |
|
|
493 |
|
|
494 |
CleanupStack::PopAndDestroy( &mediaTypes );
|
|
495 |
|
|
496 |
|
|
497 |
}
|
|
498 |
|
|
499 |
|
|
500 |
|
|
501 |
// -----------------------------------------------------------------------------
|
|
502 |
// CMgService::GetMetaDataIdAndType
|
|
503 |
// It will convert the aFilterData string into equivalent Metadata ID and Type
|
|
504 |
// which is recognized by underlying framework.(i.e CLF)
|
|
505 |
// -----------------------------------------------------------------------------
|
|
506 |
void CMgService::GetMetaDataIdAndType(const TDesC8& aMetaData,
|
|
507 |
TCLFDefaultFieldId& aMetaDataId,
|
|
508 |
TCLFItemDataType& aMetaDataType,
|
|
509 |
const RArray<TInt> &aMediaTypes)
|
|
510 |
{
|
|
511 |
//File name field
|
|
512 |
if( 0 == aMetaData.CompareF( KMgFileName ))
|
|
513 |
{
|
|
514 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
515 |
aMetaDataId = ECLFFieldIdFileName;
|
|
516 |
}
|
|
517 |
|
|
518 |
|
|
519 |
|
|
520 |
// File Extension
|
|
521 |
else if( 0 == aMetaData.CompareF( KMgFileExtension ))
|
|
522 |
{
|
|
523 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
524 |
aMetaDataId = ECLFFieldIdFileExtension;
|
|
525 |
}
|
|
526 |
|
|
527 |
|
|
528 |
// File path field
|
|
529 |
else if( 0 == aMetaData.CompareF( KMgPath ))
|
|
530 |
{
|
|
531 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
532 |
aMetaDataId = ECLFFieldIdPath;
|
|
533 |
}
|
|
534 |
|
|
535 |
|
|
536 |
// File drive field
|
|
537 |
else if( 0 == aMetaData.CompareF( KMgDrive ))
|
|
538 |
{
|
|
539 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
540 |
aMetaDataId = ECLFFieldIdDrive;
|
|
541 |
}
|
|
542 |
|
|
543 |
|
|
544 |
// File size field
|
|
545 |
else if( 0 == aMetaData.CompareF( KMgFileSize ))
|
|
546 |
{
|
|
547 |
aMetaDataType = ECLFItemDataTypeTInt32;
|
|
548 |
aMetaDataId = ECLFFieldIdFileSize;
|
|
549 |
}
|
|
550 |
|
|
551 |
|
|
552 |
|
|
553 |
// File date field
|
|
554 |
else if( 0 == aMetaData.CompareF( KMgFileDate ))
|
|
555 |
{
|
|
556 |
aMetaDataType = ECLFItemDataTypeTTime;
|
|
557 |
aMetaDataId = ECLFFieldIdFileDate;
|
|
558 |
}
|
|
559 |
|
|
560 |
|
|
561 |
|
|
562 |
// Mime type field
|
|
563 |
else if( 0 == aMetaData.CompareF( KMgMimeType ))
|
|
564 |
{
|
|
565 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
566 |
aMetaDataId = ECLFFieldIdMimeType;
|
|
567 |
}
|
|
568 |
|
|
569 |
|
|
570 |
// Full name and path of the file
|
|
571 |
else if( 0 == aMetaData.CompareF( KMgFileNameAndPath ))
|
|
572 |
{
|
|
573 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
574 |
aMetaDataId = ECLFFieldIdFileNameAndPath;
|
|
575 |
}
|
|
576 |
|
|
577 |
// Music file song name: and also check If the File type is Music File
|
|
578 |
else if( (0 == aMetaData.CompareF( KMgSongName )) &&( KErrNotFound != aMediaTypes.Find( ECLFMediaTypeMusic )) )
|
|
579 |
{
|
|
580 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
581 |
aMetaDataId = ECLFFieldIdSongName;
|
|
582 |
|
|
583 |
}
|
|
584 |
// Music file artist
|
|
585 |
else if( (0 == aMetaData.CompareF( KMgArtist )) &&( KErrNotFound != aMediaTypes.Find( ECLFMediaTypeMusic )) )
|
|
586 |
|
|
587 |
{
|
|
588 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
589 |
aMetaDataId = ECLFFieldIdArtist;
|
|
590 |
}
|
|
591 |
|
|
592 |
|
|
593 |
// Music file album
|
|
594 |
else if((0 == aMetaData.CompareF( KMgAlbum )) &&
|
|
595 |
( KErrNotFound != aMediaTypes.Find( ECLFMediaTypeMusic ) ) )
|
|
596 |
{
|
|
597 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
598 |
aMetaDataId = ECLFFieldIdAlbum;
|
|
599 |
}
|
|
600 |
|
|
601 |
|
|
602 |
|
|
603 |
// Music file genre
|
|
604 |
else if((0==aMetaData.CompareF( KMgGenre))&&
|
|
605 |
( KErrNotFound != aMediaTypes.Find(ECLFMediaTypeMusic) ) )
|
|
606 |
{
|
|
607 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
608 |
aMetaDataId = ECLFFieldIdGenre;
|
|
609 |
}
|
|
610 |
|
|
611 |
|
|
612 |
|
|
613 |
// Music file track number
|
|
614 |
else if((0 == aMetaData.CompareF( KMgTrackNumber ))&&
|
|
615 |
( KErrNotFound != aMediaTypes.Find( ECLFMediaTypeMusic ) ) )
|
|
616 |
{
|
|
617 |
aMetaDataType = ECLFItemDataTypeTInt32;
|
|
618 |
aMetaDataId = ECLFFieldIdTrackNumber;
|
|
619 |
}
|
|
620 |
|
|
621 |
|
|
622 |
|
|
623 |
// Music file composer
|
|
624 |
else if( (0 == aMetaData.CompareF( KMgComposer )) &&
|
|
625 |
( KErrNotFound != aMediaTypes.Find( ECLFMediaTypeMusic ) ) )
|
|
626 |
{
|
|
627 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
628 |
aMetaDataId = ECLFFieldIdComposer;
|
|
629 |
}
|
|
630 |
|
|
631 |
// Ram link first URL
|
|
632 |
else if( (0 == aMetaData.CompareF( KMgLinkFirstURL )) &&
|
|
633 |
( KErrNotFound != aMediaTypes.Find( ECLFMediaTypeStreamingURL ) ) )
|
|
634 |
{
|
|
635 |
aMetaDataType = ECLFItemDataTypeDesC;
|
|
636 |
aMetaDataId = ECLFFieldIdRamLinkFirstURL;
|
|
637 |
}
|
|
638 |
|
|
639 |
else
|
|
640 |
{
|
|
641 |
aMetaDataType = ECLFItemDataTypeTInt32;
|
|
642 |
aMetaDataId = ECLFFieldIdNull;
|
|
643 |
}
|
|
644 |
|
|
645 |
|
|
646 |
}
|
|
647 |
// -----------------------------------------------------------------------------
|
|
648 |
// CMgService::GetThumbnailL
|
|
649 |
// It generates the thumbnail for media type (image and video )
|
|
650 |
// -----------------------------------------------------------------------------
|
|
651 |
|
|
652 |
EXPORT_C void CMgService::GetThumbnailL(MThumbnailObserver* aThumbnailObserver, TDesC & aUrl, TInt32 aTransactionID,
|
|
653 |
TInt aHeight, TInt aWidth)
|
|
654 |
{
|
|
655 |
// Calling getThumbnail Api
|
|
656 |
iTumbnailGeneration->GetThumbnailL(aThumbnailObserver,aTransactionID,aUrl,aHeight,aWidth );
|
|
657 |
|
|
658 |
}
|