266 MPX_FUNC("CMPXMetadataExtractor::SetMediaPropertiesL()"); |
265 MPX_FUNC("CMPXMetadataExtractor::SetMediaPropertiesL()"); |
267 |
266 |
268 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
267 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
269 HBufC8* mimeType8 = HBufC8::NewLC( mimeType.Length() ); |
268 HBufC8* mimeType8 = HBufC8::NewLC( mimeType.Length() ); |
270 mimeType8->Des().Append( mimeType ); |
269 mimeType8->Des().Append( mimeType ); |
271 |
270 |
272 // Continue to extract metadata even if fail. |
271 // Continue to extract metadata even if fail. |
273 MPX_TRAPD( metadataerror, iMetadataUtility->OpenFileL( iFile, *mimeType8 ) ); |
272 MPX_TRAPD( metadataerror, iMetadataUtility->OpenFileL( iFile, *mimeType8 ) ); |
274 CleanupStack::PopAndDestroy( mimeType8 ); |
273 CleanupStack::PopAndDestroy( mimeType8 ); |
275 |
274 |
276 // Get MetadataUtility Container |
275 // Get MetadataUtility Container |
277 const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); |
276 const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); |
278 |
277 |
279 // Get DRM data |
278 // Get DRM data |
280 // Need the protected flag from metadataUtility Container |
279 // Need the protected flag from metadataUtility Container |
281 MPX_TRAPD( drmerror, SetDrmMediaPropertiesL( metaCont ) ); |
280 MPX_TRAPD( drmerror, SetDrmMediaPropertiesL( metaCont ) ); |
282 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, result=%d getting drm data", |
281 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, result=%d getting drm data", |
283 drmerror ); |
282 drmerror ); |
284 |
283 |
285 // Get metadata fields |
284 // Get metadata fields |
286 TInt count( metaCont.Count() ); |
285 TInt count( metaCont.Count() ); |
287 for( TInt i=0; i<count; ++i ) |
286 for( TInt i=0; i<count; ++i ) |
288 { |
287 { |
289 TMetaDataFieldId fieldType; |
288 TMetaDataFieldId fieldType; |
290 |
289 |
291 HBufC* value = NULL; |
290 HBufC* value = NULL; |
292 metaCont.FieldIdAt( i, fieldType ); // get the field type |
291 metaCont.FieldIdAt( i, fieldType ); // get the field type |
293 |
292 |
294 // get the value, except for album art |
293 // get the value, except for album art |
295 if ( fieldType != EMetaDataJpeg ) |
294 if ( fieldType != EMetaDataJpeg ) |
296 { |
295 { |
297 MPX_TRAPD( err, value = metaCont.At( i, fieldType ).AllocL() ); |
296 MPX_TRAPD( err, value = metaCont.At( i, fieldType ).AllocL() ); |
298 if ( KErrNone != err ) |
297 if ( KErrNone != err ) |
299 { |
298 { |
300 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL - error = %i", err); |
299 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL - error = %i", err); |
301 continue; |
300 continue; |
302 } |
301 } |
303 CleanupStack::PushL( value ); |
302 CleanupStack::PushL( value ); |
304 } |
303 } |
305 |
304 |
306 switch( fieldType ) |
305 switch( fieldType ) |
307 { |
306 { |
308 case EMetaDataSongTitle: |
307 case EMetaDataSongTitle: |
309 { |
308 { |
310 TPtr valptr = value->Des(); |
309 TPtr valptr = value->Des(); |
408 { |
407 { |
409 iMedia->SetTextValueL( KMPXMediaGeneralCopyright, |
408 iMedia->SetTextValueL( KMPXMediaGeneralCopyright, |
410 *value ); |
409 *value ); |
411 break; |
410 break; |
412 } |
411 } |
413 case EMetaDataDuration: |
412 case EMetaDataDuration: |
414 { |
413 { |
415 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
414 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
416 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
415 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
417 |
416 |
418 // Verify if WMA, get the duration |
417 // Verify if WMA, get the duration |
419 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
418 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
420 { |
419 { |
421 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
420 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
422 |
421 |
423 // Perform the duration conversion |
422 // Perform the duration conversion |
424 TLex lexer( *value ); |
423 TLex lexer( *value ); |
425 TInt32 duration ( 0 ); |
424 TInt32 duration ( 0 ); |
426 lexer.Val( duration ); // [second] |
425 lexer.Val( duration ); // [second] |
427 duration *= 1000; // [msec] |
426 duration *= 1000; // [msec] |
428 |
427 |
429 iMedia->SetTObjectValueL<TInt32>( KMPXMediaGeneralDuration, |
428 iMedia->SetTObjectValueL<TInt32>( KMPXMediaGeneralDuration, |
430 duration ); |
429 duration ); |
431 |
430 |
432 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", duration); |
431 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", duration); |
433 } |
432 } |
434 break; |
433 break; |
435 } |
434 } |
436 case EMetaDataSampleRate: |
435 case EMetaDataSampleRate: |
437 { |
436 { |
438 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
437 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
439 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
438 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
440 |
439 |
441 // Verify if WMA, get the sample rate |
440 // Verify if WMA, get the sample rate |
442 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
441 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
443 { |
442 { |
444 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
443 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
445 |
444 |
446 // Perform the sample rate conversion |
445 // Perform the sample rate conversion |
447 TLex lexer( *value ); |
446 TLex lexer( *value ); |
448 TInt32 sampleRate ( 0 ); |
447 TInt32 sampleRate ( 0 ); |
449 lexer.Val( sampleRate ); |
448 lexer.Val( sampleRate ); |
450 |
449 |
451 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioSamplerate, |
450 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioSamplerate, |
452 sampleRate ); |
451 sampleRate ); |
453 |
452 |
454 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- sample rate = %i", sampleRate); |
453 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- sample rate = %i", sampleRate); |
455 } |
454 } |
456 break; |
455 break; |
457 } |
456 } |
458 case EMetaDataBitRate: |
457 case EMetaDataBitRate: |
459 { |
458 { |
460 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
459 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
461 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
460 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
462 |
461 |
463 // Verify if WMA, get the duration |
462 // Verify if WMA, get the duration |
464 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
463 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
465 { |
464 { |
466 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
465 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
467 |
466 |
468 // Perform the duration conversion |
467 // Perform the duration conversion |
469 TLex lexer( *value ); |
468 TLex lexer( *value ); |
470 TInt32 bitRate ( 0 ); |
469 TInt32 bitRate ( 0 ); |
471 lexer.Val( bitRate ); |
470 lexer.Val( bitRate ); |
472 |
471 |
473 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate, |
472 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate, |
474 bitRate ); |
473 bitRate ); |
475 |
474 |
476 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", bitRate); |
475 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", bitRate); |
477 } |
|
478 break; |
|
479 } |
|
480 case EMetaDataAlbumArtist: |
|
481 { |
|
482 TPtr valptr = value->Des(); |
|
483 valptr.Trim(); |
|
484 TInt vallen = value->Length(); |
|
485 if (vallen>0) |
|
486 { |
|
487 FindAndReplaceForbiddenChars(valptr, vallen); |
|
488 iMedia->SetTextValueL(KMPXMediaMusicAlbumArtist, *value); |
|
489 } |
476 } |
490 break; |
477 break; |
491 } |
478 } |
492 case EMetaDataOriginalArtist: // fall through |
479 case EMetaDataOriginalArtist: // fall through |
493 case EMetaDataVendor: // fall through |
480 case EMetaDataVendor: // fall through |
524 // |
511 // |
525 TInt size( 0 ); |
512 TInt size( 0 ); |
526 if( iFileOpenError == KErrNone ) |
513 if( iFileOpenError == KErrNone ) |
527 { |
514 { |
528 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
515 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
529 MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, mimeType = %S", &mimeType); |
516 MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, mimeType = %S", &mimeType); |
530 iFile.Size( size ); |
517 iFile.Size( size ); |
531 iMedia->SetTObjectValueL<TInt>( KMPXMediaGeneralSize, size ); |
518 iMedia->SetTObjectValueL<TInt>( KMPXMediaGeneralSize, size ); |
532 |
519 |
533 // Verify if WMA, skip getting info from MMF |
520 // Verify if WMA, skip getting info from MMF |
534 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
521 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
535 { |
522 { |
536 // No need to get MMF support |
523 // No need to get MMF support |
537 MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL, skip MMF "); |
524 MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL, skip MMF "); |
538 } |
525 } |
539 else |
526 else |
540 { |
527 { |
541 MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL, get MMF controller"); |
528 MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL, get MMF controller"); |
542 // Duration, bitrate, samplerate, etc |
529 // Duration, bitrate, samplerate, etc |
543 // |
530 // |
544 if( !iMetadataOnly ) |
531 if( !iMetadataOnly ) |
545 { |
532 { |
546 MPX_TRAPD(err2, iFileInfoUtil->OpenFileL( |
533 MPX_TRAPD(err2, iFileInfoUtil->OpenFileL( |
547 iFile, |
534 iFile, |
548 iMedia->ValueText(KMPXMediaGeneralMimeType))); |
535 iMedia->ValueText(KMPXMediaGeneralMimeType))); |
549 MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, file info util error %i", err2); |
536 MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, file info util error %i", err2); |
550 if( KErrNone == err2 ) |
537 if( KErrNone == err2 ) |
551 { |
538 { |
552 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate, |
539 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate, |
593 |
580 |
594 // --------------------------------------------------------------------------- |
581 // --------------------------------------------------------------------------- |
595 // CMPXMetadataExtractor::ThumbnailPreviewReady |
582 // CMPXMetadataExtractor::ThumbnailPreviewReady |
596 // Callback but not used here |
583 // Callback but not used here |
597 // --------------------------------------------------------------------------- |
584 // --------------------------------------------------------------------------- |
598 void CMPXMetadataExtractor::ThumbnailPreviewReady( |
585 void CMPXMetadataExtractor::ThumbnailPreviewReady( |
599 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) |
586 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) |
600 { |
587 { |
601 MPX_FUNC("CMPXMetadataExtractor::ThumbnailPreviewReady()"); |
588 MPX_FUNC("CMPXMetadataExtractor::ThumbnailPreviewReady()"); |
602 } |
589 } |
603 |
590 |
604 |
591 |
605 // --------------------------------------------------------------------------- |
592 // --------------------------------------------------------------------------- |
606 // CMPXMetadataExtractor::ThumbnailReady |
593 // CMPXMetadataExtractor::ThumbnailReady |
607 // Callback but not used here |
594 // Callback but not used here |
608 // --------------------------------------------------------------------------- |
595 // --------------------------------------------------------------------------- |
609 void CMPXMetadataExtractor::ThumbnailReady( TInt /*aError*/, |
596 void CMPXMetadataExtractor::ThumbnailReady( TInt /*aError*/, |
610 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId aId ) |
597 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId aId ) |
611 { |
598 { |
612 MPX_FUNC("CMPXMetadataExtractor::ThumbnailReady()"); |
599 MPX_FUNC("CMPXMetadataExtractor::ThumbnailReady()"); |
613 |
600 |
614 // Remove thumbnail id from array. |
601 // Remove thumbnail id from array. |
615 TInt index = iArrayTNRequestId.Find( aId ); |
602 TInt index = iArrayTNRequestId.Find( aId ); |
616 if ( index >= 0 ) |
603 if ( index >= 0 ) |
617 { |
604 { |
618 iArrayTNRequestId.Remove( index ); |
605 iArrayTNRequestId.Remove( index ); |
647 void CMPXMetadataExtractor::StopWaitLoop() |
634 void CMPXMetadataExtractor::StopWaitLoop() |
648 { |
635 { |
649 MPX_FUNC("CMPXMetadataExtractor::StopWaitLoop()"); |
636 MPX_FUNC("CMPXMetadataExtractor::StopWaitLoop()"); |
650 // Cancel timer |
637 // Cancel timer |
651 CancelTimeoutTimer(); |
638 CancelTimeoutTimer(); |
652 |
639 |
653 // Stop wait loop to unblock. |
640 // Stop wait loop to unblock. |
654 if ( iTNSyncWait->IsStarted() ) |
641 if ( iTNSyncWait->IsStarted() ) |
655 { |
642 { |
656 MPX_DEBUG1("CMPXMetadataExtractor::StopWaitLoop(): Stopping the wait loop."); |
643 MPX_DEBUG1("CMPXMetadataExtractor::StopWaitLoop(): Stopping the wait loop."); |
657 iTNSyncWait->AsyncStop(); |
644 iTNSyncWait->AsyncStop(); |
658 } |
645 } |
659 } |
646 } |
660 |
647 |
661 // ---------------------------------------------------------------------------- |
648 // ---------------------------------------------------------------------------- |
662 // Cancel timer. |
649 // Cancel timer. |
663 // ---------------------------------------------------------------------------- |
650 // ---------------------------------------------------------------------------- |
664 void CMPXMetadataExtractor::CancelTimeoutTimer() |
651 void CMPXMetadataExtractor::CancelTimeoutTimer() |
665 { |
652 { |
666 MPX_FUNC("CMPXMetadataExtractor::CancelTimeoutTimer()"); |
653 MPX_FUNC("CMPXMetadataExtractor::CancelTimeoutTimer()"); |
667 |
654 |
668 // Cancel timer. |
655 // Cancel timer. |
669 if ( iTimer && iTimer->IsActive() ) |
656 if ( iTimer && iTimer->IsActive() ) |
670 { |
657 { |
671 MPX_DEBUG1("CMPXMetadataExtractor::CancelTimeoutTimer(): Timer active, cancelling"); |
658 MPX_DEBUG1("CMPXMetadataExtractor::CancelTimeoutTimer(): Timer active, cancelling"); |
672 iTimer->Cancel(); |
659 iTimer->Cancel(); |
706 TBuf<20> mimeType(KImageFileType); |
693 TBuf<20> mimeType(KImageFileType); |
707 TInt sampleData = aMedia->ValueTObjectL<TInt>(KMPXMediaMTPSampleData); |
694 TInt sampleData = aMedia->ValueTObjectL<TInt>(KMPXMediaMTPSampleData); |
708 HBufC8* value8 = ((HBufC8*)sampleData)->Des().AllocLC(); // make a local copy of sampleData |
695 HBufC8* value8 = ((HBufC8*)sampleData)->Des().AllocLC(); // make a local copy of sampleData |
709 source = CThumbnailObjectSource::NewLC( |
696 source = CThumbnailObjectSource::NewLC( |
710 value8, mimeType, path ); // give up ownership of value8 |
697 value8, mimeType, path ); // give up ownership of value8 |
711 |
698 |
712 MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from buffer"); |
699 MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from buffer"); |
713 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
700 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
714 iArrayTNRequestId.Append( tnId ); |
701 iArrayTNRequestId.Append( tnId ); |
715 CleanupStack::PopAndDestroy( source ); |
702 CleanupStack::PopAndDestroy( source ); |
716 CleanupStack::Pop( value8 ); |
703 CleanupStack::Pop( value8 ); |
717 } |
704 } |
718 else |
705 else |
719 { |
706 { |
720 source = CThumbnailObjectSource::NewLC( |
707 source = CThumbnailObjectSource::NewLC( |
721 path, KImageFileType ); |
708 path, KImageFileType ); |
722 |
709 |
723 MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from path"); |
710 MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from path"); |
724 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
711 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
725 iArrayTNRequestId.Append( tnId ); |
712 iArrayTNRequestId.Append( tnId ); |
726 CleanupStack::PopAndDestroy( source ); |
713 CleanupStack::PopAndDestroy( source ); |
727 } |
714 } |
767 } |
754 } |
768 |
755 |
769 // ---------------------------------------------------------------------------- |
756 // ---------------------------------------------------------------------------- |
770 // Add album art to media object. |
757 // Add album art to media object. |
771 // ---------------------------------------------------------------------------- |
758 // ---------------------------------------------------------------------------- |
772 void CMPXMetadataExtractor::AddMediaAlbumArtL( CMPXMedia& aMedia, |
759 void CMPXMetadataExtractor::AddMediaAlbumArtL( CMPXMedia& aMedia, |
773 const TDesC& aFile ) |
760 const TDesC& aFile ) |
774 { |
761 { |
775 MPX_FUNC("CMPXMetadataExtractor::AddMediaAlbumArtL()"); |
762 MPX_FUNC("CMPXMetadataExtractor::AddMediaAlbumArtL()"); |
776 |
763 |
777 // get metadata container. |
764 // get metadata container. |
778 const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); |
765 const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); |
779 TPtrC8 data8 = metaCont.Field8( EMetaDataJpeg ); |
766 TPtrC8 data8 = metaCont.Field8( EMetaDataJpeg ); |
780 |
767 |
781 if ( data8.Length() ) |
768 if ( data8.Length() ) |
782 { |
769 { |
783 MPX_DEBUG1("CMPXMetadataExtractor::GetMediaAlbumArtL(): Album art exist."); |
770 MPX_DEBUG1("CMPXMetadataExtractor::GetMediaAlbumArtL(): Album art exist."); |
784 #ifdef RD_MPX_TNM_INTEGRATION |
771 #ifdef RD_MPX_TNM_INTEGRATION |
785 HBufC8* value8 = NULL; |
772 HBufC8* value8 = NULL; |
786 MPX_TRAPD( err, value8 = data8.AllocL() ); |
773 MPX_TRAPD( err, value8 = data8.AllocL() ); |
787 if ( KErrNone != err ) |
774 if ( KErrNone != err ) |
788 { |
775 { |
789 MPX_DEBUG2("CMPXMetadataExtractor::GetMediaAlbumArtL - error jpeg = %i", err); |
776 MPX_DEBUG2("CMPXMetadataExtractor::GetMediaAlbumArtL - error jpeg = %i", err); |
790 return; |
777 return; |
791 } |
778 } |
792 CleanupStack::PushL( value8 ); |
779 CleanupStack::PushL( value8 ); |
793 |
780 |
794 TBuf<256> mimeType; |
781 TBuf<256> mimeType; |
795 mimeType.Copy( KImageFileType ); |
782 mimeType.Copy( KImageFileType ); |
796 CThumbnailObjectSource* source = CThumbnailObjectSource::NewL( |
783 CThumbnailObjectSource* source = CThumbnailObjectSource::NewL( |
797 value8, mimeType, aFile ); |
784 value8, mimeType, aFile ); |
798 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
785 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
799 iArrayTNRequestId.Append( tnId ); // add thumbnail id to array |
786 iArrayTNRequestId.Append( tnId ); // add thumbnail id to array |
800 CleanupStack::Pop( value8 ); |
787 CleanupStack::Pop( value8 ); |
801 delete source; |
788 delete source; |
802 |
789 |
803 aMedia.SetTextValueL( KMPXMediaMusicOriginalAlbumArtFileName, aFile ); |
790 aMedia.SetTextValueL( KMPXMediaMusicOriginalAlbumArtFileName, aFile ); |
804 #endif // RD_MPX_TNM_INTEGRATION |
791 #endif // RD_MPX_TNM_INTEGRATION |
805 aMedia.SetTextValueL( KMPXMediaMusicAlbumArtFileName, aFile ); |
792 aMedia.SetTextValueL( KMPXMediaMusicAlbumArtFileName, aFile ); |
806 } |
793 } |
807 } |
794 } |
808 |
795 |
809 // ---------------------------------------------------------------------------- |
796 // ---------------------------------------------------------------------------- |
937 } |
924 } |
938 else // other case use apparc to fetch and set mimetype |
925 else // other case use apparc to fetch and set mimetype |
939 { |
926 { |
940 TDataType dataType; |
927 TDataType dataType; |
941 TUid dummyUid(KNullUid); |
928 TUid dummyUid(KNullUid); |
942 // File handle based mime type recogniton required , because AppArc does |
929 iAppArc.AppForDocument(iFileName, dummyUid, dataType); |
943 // not have All Files capa required for files in private folders |
|
944 TDataRecognitionResult result; |
|
945 RFs fs; |
|
946 RFile rFile; |
|
947 User::LeaveIfError(fs.Connect()); |
|
948 CleanupClosePushL(fs); |
|
949 User::LeaveIfError(fs.ShareProtected()); |
|
950 User::LeaveIfError(rFile.Open(fs, iFileName, EFileShareReadersOrWriters)); |
|
951 CleanupClosePushL(rFile); |
|
952 User::LeaveIfError(iAppArc.RecognizeData(rFile, result)); |
|
953 CleanupStack::PopAndDestroy(&rFile); |
|
954 CleanupStack::PopAndDestroy(&fs); |
|
955 dataType = result.iDataType; |
|
956 iMedia->SetTextValueL( KMPXMediaGeneralMimeType,dataType.Des() ); |
930 iMedia->SetTextValueL( KMPXMediaGeneralMimeType,dataType.Des() ); |
957 } |
931 } |
958 |
932 |
959 // Initially set default tags. |
933 // Initially set default tags. |
960 SetDefaultL( *iMedia ); |
934 SetDefaultL( *iMedia ); |
961 } |
935 } |
962 |
936 |
963 // ---------------------------------------------------------------------------- |
937 // ---------------------------------------------------------------------------- |
1005 if ( iArrayTasks.Count() ) |
979 if ( iArrayTasks.Count() ) |
1006 { |
980 { |
1007 MPX_DEBUG1("CMPXMetadataExtractor::CreateMediaAsyncL Request ongoing. Abort!" ); |
981 MPX_DEBUG1("CMPXMetadataExtractor::CreateMediaAsyncL Request ongoing. Abort!" ); |
1008 User::Leave( KErrAbort ); |
982 User::Leave( KErrAbort ); |
1009 } |
983 } |
1010 |
984 |
1011 iCancelled = EFalse; |
985 iCancelled = EFalse; |
1012 iFileOpenError = KErrNone; |
986 iFileOpenError = KErrNone; |
1013 iFileName = aFile; |
987 iFileName = aFile; |
1014 iObs = aObs; |
988 iObs = aObs; |
1015 iMetadataOnly = aMetadataOnly; |
989 iMetadataOnly = aMetadataOnly; |
1016 |
990 |
1017 // populate the task array |
991 // populate the task array |
1018 AddTasksL(); |
992 AddTasksL(); |
1019 |
993 |
1020 // Start task timer to execute task |
994 // Start task timer to execute task |
1021 if ( iArrayTasks.Count() ) |
995 if ( iArrayTasks.Count() ) |
1022 { |
996 { |
1023 if ( iTaskTimer->IsActive() ) |
997 if ( iTaskTimer->IsActive() ) |
1024 { |
998 { |
1025 iTaskTimer->Cancel(); |
999 iTaskTimer->Cancel(); |
1026 } |
1000 } |
1027 iTaskTimer->Start( 0, 0, TCallBack(TaskTimerCallback, this )); |
1001 iTaskTimer->Start( 0, 0, TCallBack(TaskTimerCallback, this )); |
1028 } |
1002 } |
1029 } |
1003 } |
1030 |
1004 |
1031 // --------------------------------------------------------------------------- |
1005 // --------------------------------------------------------------------------- |
1159 // DB Flags to set |
1133 // DB Flags to set |
1160 TUint dbFlags(KMPXMediaGeneralFlagsSetOrUnsetBit); |
1134 TUint dbFlags(KMPXMediaGeneralFlagsSetOrUnsetBit); |
1161 // Validate the objects to be used |
1135 // Validate the objects to be used |
1162 MPX_ASSERT(iMedia); |
1136 MPX_ASSERT(iMedia); |
1163 MPX_ASSERT(iDrmMediaUtility); |
1137 MPX_ASSERT(iDrmMediaUtility); |
1164 |
1138 |
1165 // File Path |
1139 // File Path |
1166 TParsePtrC parse( iFileName ); |
1140 TParsePtrC parse( iFileName ); |
1167 iMedia->SetTextValueL( KMPXMediaGeneralUri, iFileName ); |
1141 iMedia->SetTextValueL( KMPXMediaGeneralUri, iFileName ); |
1168 iMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1142 iMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1169 MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL - Filename=%S", &iFileName); |
1143 MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL - Filename=%S", &iFileName); |
1170 |
1144 |
1171 // get the protected flag from MetadataUtility Container |
1145 // get the protected flag from MetadataUtility Container |
1172 TPtrC ptr = aMetaCont.Field( EMetaDataProtected ); |
1146 TPtrC ptr = aMetaCont.Field( EMetaDataProtected ); |
1173 MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL -- status=%S", &ptr); |
1147 MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL -- status=%S", &ptr); |
1174 _LIT( KNonProtected, "0" ); |
1148 _LIT( KNonProtected, "0" ); |
1175 if ( ptr.Compare( KNonProtected ) == 0 ) |
1149 if ( ptr.Compare( KNonProtected ) == 0 ) |
1176 { |
1150 { |
1177 // this is non-protected file |
1151 // this is non-protected file |
1178 // prot = EFalse |
1152 // prot = EFalse |
1179 MPX_DEBUG1("CMPXMetadataExtractor::SetDrmMediaPropertiesL - non protected"); |
1153 MPX_DEBUG1("CMPXMetadataExtractor::SetDrmMediaPropertiesL - non protected"); |
1180 iMedia->SetTObjectValueL<TBool>( KMPXMediaDrmProtected, prot ); |
1154 iMedia->SetTObjectValueL<TBool>( KMPXMediaDrmProtected, prot ); |
1181 iMedia->SetTObjectValueL<TUint16>( KMPXMediaMTPDrmStatus, (TUint16)prot ); |
1155 iMedia->SetTObjectValueL<TUint16>( KMPXMediaMTPDrmStatus, (TUint16)prot ); |
1182 } |
1156 } |
1183 else |
1157 else |
1184 { // DRM file |
1158 { // DRM file |
1185 |
1159 |
1186 // DRM Rights |
1160 // DRM Rights |
1187 // |
1161 // |
1188 CMPXMedia* drm = NULL; |
1162 CMPXMedia* drm = NULL; |