265 MPX_FUNC("CMPXMetadataExtractor::SetMediaPropertiesL()"); |
262 MPX_FUNC("CMPXMetadataExtractor::SetMediaPropertiesL()"); |
266 |
263 |
267 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
264 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
268 HBufC8* mimeType8 = HBufC8::NewLC( mimeType.Length() ); |
265 HBufC8* mimeType8 = HBufC8::NewLC( mimeType.Length() ); |
269 mimeType8->Des().Append( mimeType ); |
266 mimeType8->Des().Append( mimeType ); |
270 |
267 |
271 // Continue to extract metadata even if fail. |
268 // Continue to extract metadata even if fail. |
272 MPX_TRAPD( metadataerror, iMetadataUtility->OpenFileL( iFile, *mimeType8 ) ); |
269 MPX_TRAPD( metadataerror, iMetadataUtility->OpenFileL( iFile, *mimeType8 ) ); |
273 CleanupStack::PopAndDestroy( mimeType8 ); |
270 CleanupStack::PopAndDestroy( mimeType8 ); |
274 |
271 |
275 // Get MetadataUtility Container |
272 // Get MetadataUtility Container |
276 const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); |
273 const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); |
277 |
274 |
278 // Get DRM data |
275 // Get DRM data |
279 // Need the protected flag from metadataUtility Container |
276 // Need the protected flag from metadataUtility Container |
280 MPX_TRAPD( drmerror, SetDrmMediaPropertiesL( metaCont ) ); |
277 MPX_TRAPD( drmerror, SetDrmMediaPropertiesL( metaCont ) ); |
281 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, result=%d getting drm data", |
278 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, result=%d getting drm data", |
282 drmerror ); |
279 drmerror ); |
283 |
280 |
284 // Get metadata fields |
281 // Get metadata fields |
285 TInt count( metaCont.Count() ); |
282 TInt count( metaCont.Count() ); |
286 for( TInt i=0; i<count; ++i ) |
283 for( TInt i=0; i<count; ++i ) |
287 { |
284 { |
288 TMetaDataFieldId fieldType; |
285 TMetaDataFieldId fieldType; |
289 |
286 |
290 HBufC* value = NULL; |
287 HBufC* value = NULL; |
291 metaCont.FieldIdAt( i, fieldType ); // get the field type |
288 metaCont.FieldIdAt( i, fieldType ); // get the field type |
292 |
289 |
293 // get the value, except for album art |
290 // get the value, except for album art |
294 if ( fieldType != EMetaDataJpeg ) |
291 if ( fieldType != EMetaDataJpeg ) |
295 { |
292 { |
296 MPX_TRAPD( err, value = metaCont.At( i, fieldType ).AllocL() ); |
293 MPX_TRAPD( err, value = metaCont.At( i, fieldType ).AllocL() ); |
297 if ( KErrNone != err ) |
294 if ( KErrNone != err ) |
298 { |
295 { |
299 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL - error = %i", err); |
296 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL - error = %i", err); |
300 continue; |
297 continue; |
301 } |
298 } |
302 CleanupStack::PushL( value ); |
299 CleanupStack::PushL( value ); |
303 } |
300 } |
304 |
301 |
305 switch( fieldType ) |
302 switch( fieldType ) |
306 { |
303 { |
307 case EMetaDataSongTitle: |
304 case EMetaDataSongTitle: |
308 { |
305 { |
309 TPtr valptr = value->Des(); |
306 TPtr valptr = value->Des(); |
407 { |
404 { |
408 iMedia->SetTextValueL( KMPXMediaGeneralCopyright, |
405 iMedia->SetTextValueL( KMPXMediaGeneralCopyright, |
409 *value ); |
406 *value ); |
410 break; |
407 break; |
411 } |
408 } |
412 case EMetaDataDuration: |
409 case EMetaDataDuration: |
413 { |
410 { |
414 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
411 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
415 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
412 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
416 |
413 |
417 // Verify if WMA, get the duration |
414 // Verify if WMA, get the duration |
418 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
415 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
419 { |
416 { |
420 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
417 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
421 |
418 |
422 // Perform the duration conversion |
419 // Perform the duration conversion |
423 TLex lexer( *value ); |
420 TLex lexer( *value ); |
424 TInt32 duration ( 0 ); |
421 TInt32 duration ( 0 ); |
425 lexer.Val( duration ); // [second] |
422 lexer.Val( duration ); // [second] |
426 duration *= 1000; // [msec] |
423 duration *= 1000; // [msec] |
427 |
424 |
428 iMedia->SetTObjectValueL<TInt32>( KMPXMediaGeneralDuration, |
425 iMedia->SetTObjectValueL<TInt32>( KMPXMediaGeneralDuration, |
429 duration ); |
426 duration ); |
430 |
427 |
431 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", duration); |
428 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", duration); |
432 } |
429 } |
433 break; |
430 break; |
434 } |
431 } |
435 case EMetaDataSampleRate: |
432 case EMetaDataSampleRate: |
436 { |
433 { |
437 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
434 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
438 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
435 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
439 |
436 |
440 // Verify if WMA, get the sample rate |
437 // Verify if WMA, get the sample rate |
441 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
438 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
442 { |
439 { |
443 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
440 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
444 |
441 |
445 // Perform the sample rate conversion |
442 // Perform the sample rate conversion |
446 TLex lexer( *value ); |
443 TLex lexer( *value ); |
447 TInt32 sampleRate ( 0 ); |
444 TInt32 sampleRate ( 0 ); |
448 lexer.Val( sampleRate ); |
445 lexer.Val( sampleRate ); |
449 |
446 |
450 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioSamplerate, |
447 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioSamplerate, |
451 sampleRate ); |
448 sampleRate ); |
452 |
449 |
453 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- sample rate = %i", sampleRate); |
450 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- sample rate = %i", sampleRate); |
454 } |
451 } |
455 break; |
452 break; |
456 } |
453 } |
457 case EMetaDataBitRate: |
454 case EMetaDataBitRate: |
458 { |
455 { |
459 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
456 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
460 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
457 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); |
461 |
458 |
462 // Verify if WMA, get the duration |
459 // Verify if WMA, get the duration |
463 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
460 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
464 { |
461 { |
465 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
462 MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL- WMA"); |
466 |
463 |
467 // Perform the duration conversion |
464 // Perform the duration conversion |
468 TLex lexer( *value ); |
465 TLex lexer( *value ); |
469 TInt32 bitRate ( 0 ); |
466 TInt32 bitRate ( 0 ); |
470 lexer.Val( bitRate ); |
467 lexer.Val( bitRate ); |
471 |
468 |
472 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate, |
469 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate, |
473 bitRate ); |
470 bitRate ); |
474 |
471 |
475 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", bitRate); |
472 MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", bitRate); |
476 } |
473 } |
477 break; |
474 break; |
478 } |
475 } |
479 case EMetaDataOriginalArtist: // fall through |
476 case EMetaDataOriginalArtist: // fall through |
480 case EMetaDataVendor: // fall through |
477 case EMetaDataVendor: // fall through |
511 // |
508 // |
512 TInt size( 0 ); |
509 TInt size( 0 ); |
513 if( iFileOpenError == KErrNone ) |
510 if( iFileOpenError == KErrNone ) |
514 { |
511 { |
515 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
512 const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
516 MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, mimeType = %S", &mimeType); |
513 MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, mimeType = %S", &mimeType); |
517 iFile.Size( size ); |
514 iFile.Size( size ); |
518 iMedia->SetTObjectValueL<TInt>( KMPXMediaGeneralSize, size ); |
515 iMedia->SetTObjectValueL<TInt>( KMPXMediaGeneralSize, size ); |
519 |
516 |
520 // Verify if WMA, skip getting info from MMF |
517 // Verify if WMA, skip getting info from MMF |
521 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
518 if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) |
522 { |
519 { |
523 // No need to get MMF support |
520 // No need to get MMF support |
524 MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL, skip MMF "); |
521 MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL, skip MMF "); |
525 } |
522 } |
526 else |
523 else |
527 { |
524 { |
528 MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL, get MMF controller"); |
525 MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL, get MMF controller"); |
529 // Duration, bitrate, samplerate, etc |
526 // Duration, bitrate, samplerate, etc |
530 // |
527 // |
531 if( !iMetadataOnly ) |
528 if( !iMetadataOnly ) |
532 { |
529 { |
533 MPX_TRAPD(err2, iFileInfoUtil->OpenFileL( |
530 MPX_TRAPD(err2, iFileInfoUtil->OpenFileL( |
534 iFile, |
531 iFile, |
535 iMedia->ValueText(KMPXMediaGeneralMimeType))); |
532 iMedia->ValueText(KMPXMediaGeneralMimeType))); |
536 MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, file info util error %i", err2); |
533 MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, file info util error %i", err2); |
537 if( KErrNone == err2 ) |
534 if( KErrNone == err2 ) |
538 { |
535 { |
539 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate, |
536 iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate, |
580 |
577 |
581 // --------------------------------------------------------------------------- |
578 // --------------------------------------------------------------------------- |
582 // CMPXMetadataExtractor::ThumbnailPreviewReady |
579 // CMPXMetadataExtractor::ThumbnailPreviewReady |
583 // Callback but not used here |
580 // Callback but not used here |
584 // --------------------------------------------------------------------------- |
581 // --------------------------------------------------------------------------- |
585 void CMPXMetadataExtractor::ThumbnailPreviewReady( |
582 void CMPXMetadataExtractor::ThumbnailPreviewReady( |
586 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) |
583 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) |
587 { |
584 { |
588 MPX_FUNC("CMPXMetadataExtractor::ThumbnailPreviewReady()"); |
585 MPX_FUNC("CMPXMetadataExtractor::ThumbnailPreviewReady()"); |
589 } |
586 } |
590 |
587 |
591 |
588 |
592 // --------------------------------------------------------------------------- |
589 // --------------------------------------------------------------------------- |
593 // CMPXMetadataExtractor::ThumbnailReady |
590 // CMPXMetadataExtractor::ThumbnailReady |
594 // Callback but not used here |
591 // Callback but not used here |
595 // --------------------------------------------------------------------------- |
592 // --------------------------------------------------------------------------- |
596 void CMPXMetadataExtractor::ThumbnailReady( TInt /*aError*/, |
593 void CMPXMetadataExtractor::ThumbnailReady( TInt /*aError*/, |
597 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId aId ) |
594 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId aId ) |
598 { |
595 { |
599 MPX_FUNC("CMPXMetadataExtractor::ThumbnailReady()"); |
596 MPX_FUNC("CMPXMetadataExtractor::ThumbnailReady()"); |
600 |
597 |
601 // Remove thumbnail id from array. |
598 // Remove thumbnail id from array. |
602 TInt index = iArrayTNRequestId.Find( aId ); |
599 TInt index = iArrayTNRequestId.Find( aId ); |
603 if ( index >= 0 ) |
600 if ( index >= 0 ) |
604 { |
601 { |
605 iArrayTNRequestId.Remove( index ); |
602 iArrayTNRequestId.Remove( index ); |
634 void CMPXMetadataExtractor::StopWaitLoop() |
631 void CMPXMetadataExtractor::StopWaitLoop() |
635 { |
632 { |
636 MPX_FUNC("CMPXMetadataExtractor::StopWaitLoop()"); |
633 MPX_FUNC("CMPXMetadataExtractor::StopWaitLoop()"); |
637 // Cancel timer |
634 // Cancel timer |
638 CancelTimeoutTimer(); |
635 CancelTimeoutTimer(); |
639 |
636 |
640 // Stop wait loop to unblock. |
637 // Stop wait loop to unblock. |
641 if ( iTNSyncWait->IsStarted() ) |
638 if ( iTNSyncWait->IsStarted() ) |
642 { |
639 { |
643 MPX_DEBUG1("CMPXMetadataExtractor::StopWaitLoop(): Stopping the wait loop."); |
640 MPX_DEBUG1("CMPXMetadataExtractor::StopWaitLoop(): Stopping the wait loop."); |
644 iTNSyncWait->AsyncStop(); |
641 iTNSyncWait->AsyncStop(); |
645 } |
642 } |
646 } |
643 } |
647 |
644 |
648 // ---------------------------------------------------------------------------- |
645 // ---------------------------------------------------------------------------- |
649 // Cancel timer. |
646 // Cancel timer. |
650 // ---------------------------------------------------------------------------- |
647 // ---------------------------------------------------------------------------- |
651 void CMPXMetadataExtractor::CancelTimeoutTimer() |
648 void CMPXMetadataExtractor::CancelTimeoutTimer() |
652 { |
649 { |
653 MPX_FUNC("CMPXMetadataExtractor::CancelTimeoutTimer()"); |
650 MPX_FUNC("CMPXMetadataExtractor::CancelTimeoutTimer()"); |
654 |
651 |
655 // Cancel timer. |
652 // Cancel timer. |
656 if ( iTimer && iTimer->IsActive() ) |
653 if ( iTimer && iTimer->IsActive() ) |
657 { |
654 { |
658 MPX_DEBUG1("CMPXMetadataExtractor::CancelTimeoutTimer(): Timer active, cancelling"); |
655 MPX_DEBUG1("CMPXMetadataExtractor::CancelTimeoutTimer(): Timer active, cancelling"); |
659 iTimer->Cancel(); |
656 iTimer->Cancel(); |
693 TBuf<20> mimeType(KImageFileType); |
690 TBuf<20> mimeType(KImageFileType); |
694 TInt sampleData = aMedia->ValueTObjectL<TInt>(KMPXMediaMTPSampleData); |
691 TInt sampleData = aMedia->ValueTObjectL<TInt>(KMPXMediaMTPSampleData); |
695 HBufC8* value8 = ((HBufC8*)sampleData)->Des().AllocLC(); // make a local copy of sampleData |
692 HBufC8* value8 = ((HBufC8*)sampleData)->Des().AllocLC(); // make a local copy of sampleData |
696 source = CThumbnailObjectSource::NewLC( |
693 source = CThumbnailObjectSource::NewLC( |
697 value8, mimeType, path ); // give up ownership of value8 |
694 value8, mimeType, path ); // give up ownership of value8 |
698 |
695 |
699 MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from buffer"); |
696 MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from buffer"); |
700 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
697 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
701 iArrayTNRequestId.Append( tnId ); |
698 iArrayTNRequestId.Append( tnId ); |
702 CleanupStack::PopAndDestroy( source ); |
699 CleanupStack::PopAndDestroy( source ); |
703 CleanupStack::Pop( value8 ); |
700 CleanupStack::Pop( value8 ); |
704 } |
701 } |
705 else |
702 else |
706 { |
703 { |
707 source = CThumbnailObjectSource::NewLC( |
704 source = CThumbnailObjectSource::NewLC( |
708 path, KImageFileType ); |
705 path, KImageFileType ); |
709 |
706 |
710 MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from path"); |
707 MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from path"); |
711 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
708 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
712 iArrayTNRequestId.Append( tnId ); |
709 iArrayTNRequestId.Append( tnId ); |
713 CleanupStack::PopAndDestroy( source ); |
710 CleanupStack::PopAndDestroy( source ); |
714 } |
711 } |
754 } |
751 } |
755 |
752 |
756 // ---------------------------------------------------------------------------- |
753 // ---------------------------------------------------------------------------- |
757 // Add album art to media object. |
754 // Add album art to media object. |
758 // ---------------------------------------------------------------------------- |
755 // ---------------------------------------------------------------------------- |
759 void CMPXMetadataExtractor::AddMediaAlbumArtL( CMPXMedia& aMedia, |
756 void CMPXMetadataExtractor::AddMediaAlbumArtL( CMPXMedia& aMedia, |
760 const TDesC& aFile ) |
757 const TDesC& aFile ) |
761 { |
758 { |
762 MPX_FUNC("CMPXMetadataExtractor::AddMediaAlbumArtL()"); |
759 MPX_FUNC("CMPXMetadataExtractor::AddMediaAlbumArtL()"); |
763 |
760 |
764 // get metadata container. |
761 // get metadata container. |
765 const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); |
762 const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); |
766 TPtrC8 data8 = metaCont.Field8( EMetaDataJpeg ); |
763 TPtrC8 data8 = metaCont.Field8( EMetaDataJpeg ); |
767 |
764 |
768 if ( data8.Length() ) |
765 if ( data8.Length() ) |
769 { |
766 { |
770 MPX_DEBUG1("CMPXMetadataExtractor::GetMediaAlbumArtL(): Album art exist."); |
767 MPX_DEBUG1("CMPXMetadataExtractor::GetMediaAlbumArtL(): Album art exist."); |
771 #ifdef RD_MPX_TNM_INTEGRATION |
768 #ifdef RD_MPX_TNM_INTEGRATION |
772 HBufC8* value8 = NULL; |
769 HBufC8* value8 = NULL; |
773 MPX_TRAPD( err, value8 = data8.AllocL() ); |
770 MPX_TRAPD( err, value8 = data8.AllocL() ); |
774 if ( KErrNone != err ) |
771 if ( KErrNone != err ) |
775 { |
772 { |
776 MPX_DEBUG2("CMPXMetadataExtractor::GetMediaAlbumArtL - error jpeg = %i", err); |
773 MPX_DEBUG2("CMPXMetadataExtractor::GetMediaAlbumArtL - error jpeg = %i", err); |
777 return; |
774 return; |
778 } |
775 } |
779 CleanupStack::PushL( value8 ); |
776 CleanupStack::PushL( value8 ); |
780 |
777 |
781 TBuf<256> mimeType; |
778 TBuf<256> mimeType; |
782 mimeType.Copy( KImageFileType ); |
779 mimeType.Copy( KImageFileType ); |
783 CThumbnailObjectSource* source = CThumbnailObjectSource::NewL( |
780 CThumbnailObjectSource* source = CThumbnailObjectSource::NewL( |
784 value8, mimeType, aFile ); |
781 value8, mimeType, aFile ); |
785 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
782 TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); |
786 iArrayTNRequestId.Append( tnId ); // add thumbnail id to array |
783 iArrayTNRequestId.Append( tnId ); // add thumbnail id to array |
787 CleanupStack::Pop( value8 ); |
784 CleanupStack::Pop( value8 ); |
788 delete source; |
785 delete source; |
789 |
786 |
790 aMedia.SetTextValueL( KMPXMediaMusicOriginalAlbumArtFileName, aFile ); |
787 aMedia.SetTextValueL( KMPXMediaMusicOriginalAlbumArtFileName, aFile ); |
791 #endif // RD_MPX_TNM_INTEGRATION |
788 #endif // RD_MPX_TNM_INTEGRATION |
792 aMedia.SetTextValueL( KMPXMediaMusicAlbumArtFileName, aFile ); |
789 aMedia.SetTextValueL( KMPXMediaMusicAlbumArtFileName, aFile ); |
793 } |
790 } |
794 } |
791 } |
795 |
792 |
796 // ---------------------------------------------------------------------------- |
793 // ---------------------------------------------------------------------------- |
979 if ( iArrayTasks.Count() ) |
976 if ( iArrayTasks.Count() ) |
980 { |
977 { |
981 MPX_DEBUG1("CMPXMetadataExtractor::CreateMediaAsyncL Request ongoing. Abort!" ); |
978 MPX_DEBUG1("CMPXMetadataExtractor::CreateMediaAsyncL Request ongoing. Abort!" ); |
982 User::Leave( KErrAbort ); |
979 User::Leave( KErrAbort ); |
983 } |
980 } |
984 |
981 |
985 iCancelled = EFalse; |
982 iCancelled = EFalse; |
986 iFileOpenError = KErrNone; |
983 iFileOpenError = KErrNone; |
987 iFileName = aFile; |
984 iFileName = aFile; |
988 iObs = aObs; |
985 iObs = aObs; |
989 iMetadataOnly = aMetadataOnly; |
986 iMetadataOnly = aMetadataOnly; |
990 |
987 |
991 // populate the task array |
988 // populate the task array |
992 AddTasksL(); |
989 AddTasksL(); |
993 |
990 |
994 // Start task timer to execute task |
991 // Start task timer to execute task |
995 if ( iArrayTasks.Count() ) |
992 if ( iArrayTasks.Count() ) |
996 { |
993 { |
997 if ( iTaskTimer->IsActive() ) |
994 if ( iTaskTimer->IsActive() ) |
998 { |
995 { |
999 iTaskTimer->Cancel(); |
996 iTaskTimer->Cancel(); |
1000 } |
997 } |
1001 iTaskTimer->Start( 0, 0, TCallBack(TaskTimerCallback, this )); |
998 iTaskTimer->Start( 0, 0, TCallBack(TaskTimerCallback, this )); |
1002 } |
999 } |
1003 } |
1000 } |
1004 |
1001 |
1005 // --------------------------------------------------------------------------- |
1002 // --------------------------------------------------------------------------- |
1133 // DB Flags to set |
1130 // DB Flags to set |
1134 TUint dbFlags(KMPXMediaGeneralFlagsSetOrUnsetBit); |
1131 TUint dbFlags(KMPXMediaGeneralFlagsSetOrUnsetBit); |
1135 // Validate the objects to be used |
1132 // Validate the objects to be used |
1136 MPX_ASSERT(iMedia); |
1133 MPX_ASSERT(iMedia); |
1137 MPX_ASSERT(iDrmMediaUtility); |
1134 MPX_ASSERT(iDrmMediaUtility); |
1138 |
1135 |
1139 // File Path |
1136 // File Path |
1140 TParsePtrC parse( iFileName ); |
1137 TParsePtrC parse( iFileName ); |
1141 iMedia->SetTextValueL( KMPXMediaGeneralUri, iFileName ); |
1138 iMedia->SetTextValueL( KMPXMediaGeneralUri, iFileName ); |
1142 iMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1139 iMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1143 MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL - Filename=%S", &iFileName); |
1140 MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL - Filename=%S", &iFileName); |
1144 |
1141 |
1145 // get the protected flag from MetadataUtility Container |
1142 // get the protected flag from MetadataUtility Container |
1146 TPtrC ptr = aMetaCont.Field( EMetaDataProtected ); |
1143 TPtrC ptr = aMetaCont.Field( EMetaDataProtected ); |
1147 MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL -- status=%S", &ptr); |
1144 MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL -- status=%S", &ptr); |
1148 _LIT( KNonProtected, "0" ); |
1145 _LIT( KNonProtected, "0" ); |
1149 if ( ptr.Compare( KNonProtected ) == 0 ) |
1146 if ( ptr.Compare( KNonProtected ) == 0 ) |
1150 { |
1147 { |
1151 // this is non-protected file |
1148 // this is non-protected file |
1152 // prot = EFalse |
1149 // prot = EFalse |
1153 MPX_DEBUG1("CMPXMetadataExtractor::SetDrmMediaPropertiesL - non protected"); |
1150 MPX_DEBUG1("CMPXMetadataExtractor::SetDrmMediaPropertiesL - non protected"); |
1154 iMedia->SetTObjectValueL<TBool>( KMPXMediaDrmProtected, prot ); |
1151 iMedia->SetTObjectValueL<TBool>( KMPXMediaDrmProtected, prot ); |
1155 iMedia->SetTObjectValueL<TUint16>( KMPXMediaMTPDrmStatus, (TUint16)prot ); |
1152 iMedia->SetTObjectValueL<TUint16>( KMPXMediaMTPDrmStatus, (TUint16)prot ); |
1156 } |
1153 } |
1157 else |
1154 else |
1158 { // DRM file |
1155 { // DRM file |
1159 |
1156 |
1160 // DRM Rights |
1157 // DRM Rights |
1161 // |
1158 // |
1162 CMPXMedia* drm = NULL; |
1159 CMPXMedia* drm = NULL; |
1204 User::LeaveIfError( drmError ); |
1201 User::LeaveIfError( drmError ); |
1205 } |
1202 } |
1206 |
1203 |
1207 iMedia->SetTObjectValueL<TBool>( KMPXMediaDrmProtected, prot ); |
1204 iMedia->SetTObjectValueL<TBool>( KMPXMediaDrmProtected, prot ); |
1208 iMedia->SetTObjectValueL<TUint16>( KMPXMediaMTPDrmStatus, (TUint16)prot ); |
1205 iMedia->SetTObjectValueL<TUint16>( KMPXMediaMTPDrmStatus, (TUint16)prot ); |
1209 |
1206 |
1210 iDrmMediaUtility->Close(); |
1207 iDrmMediaUtility->Close(); |
1211 |
1208 |
1212 } // DRM file |
1209 } // DRM file |
1213 |
1210 |
1214 |
1211 |
1215 // verify the file open status |
1212 // verify the file open status |
1216 if( iFileOpenError == KErrNotFound || iFileOpenError == KErrPathNotFound ) |
1213 if( iFileOpenError == KErrNotFound || iFileOpenError == KErrPathNotFound ) |
1217 { |
1214 { |
1218 dbFlags |= KMPXMediaGeneralFlagsIsInvalid; |
1215 dbFlags |= KMPXMediaGeneralFlagsIsInvalid; |
1219 } |
1216 } |
1220 |
1217 |
1221 // Finally set the db flag |
1218 // Finally set the db flag |
1222 // |
1219 // |
1223 iMedia->SetTObjectValueL( KMPXMediaGeneralFlags, dbFlags ); |
1220 iMedia->SetTObjectValueL( KMPXMediaGeneralFlags, dbFlags ); |
1224 |
1221 |
1225 } |
1222 } |