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