changeset 4 | d45095c2f4f3 |
parent 0 | a2952bb97e68 |
child 14 | 05b0d2323768 |
child 20 | b1fb57be53fe |
3:b425f12f328d | 4:d45095c2f4f3 |
---|---|
1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Meta data Video access |
14 * Description: Meta data Video access |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <ContentListingFactory.h> |
18 #include <ContentListingFactory.h> |
19 #include <MCLFContentListingEngine.h> |
19 #include <MCLFContentListingEngine.h> |
20 #include <driveinfo.h> |
20 #include <driveinfo.h> |
21 #include <pathinfo.h> |
21 #include <pathinfo.h> |
60 const TInt KMaxQueryLength = 512; |
60 const TInt KMaxQueryLength = 512; |
61 const TInt KMtpCompactInterval = 50; // Compact every .... |
61 const TInt KMtpCompactInterval = 50; // Compact every .... |
62 |
62 |
63 CMmMtpDpMetadataVideoAccess* CMmMtpDpMetadataVideoAccess::NewL( RFs& aRfs ) |
63 CMmMtpDpMetadataVideoAccess* CMmMtpDpMetadataVideoAccess::NewL( RFs& aRfs ) |
64 { |
64 { |
65 CMmMtpDpMetadataVideoAccess* me = new(ELeave) CMmMtpDpMetadataVideoAccess( aRfs ); |
65 CMmMtpDpMetadataVideoAccess* me = new( ELeave ) CMmMtpDpMetadataVideoAccess( aRfs ); |
66 CleanupStack::PushL(me); |
66 CleanupStack::PushL( me ); |
67 me->ConstructL(); |
67 me->ConstructL(); |
68 CleanupStack::Pop(me); |
68 CleanupStack::Pop( me ); |
69 |
69 |
70 return me; |
70 return me; |
71 } |
71 } |
72 |
72 |
73 CMmMtpDpMetadataVideoAccess::CMmMtpDpMetadataVideoAccess( RFs& aRfs ) : iRfs(aRfs), |
73 CMmMtpDpMetadataVideoAccess::CMmMtpDpMetadataVideoAccess( RFs& aRfs ) : |
74 iDbState(ENoRecord), |
74 iRfs( aRfs ), |
75 iDbOpened(EFalse) |
75 iDbState( ENoRecord ), |
76 { |
76 iDbOpened( EFalse ) |
77 |
77 { |
78 } |
78 // Do nothing |
79 |
79 } |
80 // --------------------------------------------------------------------------- |
80 |
81 // CMmMtpDpMetadataMpxAccess::ConstructL |
81 // --------------------------------------------------------------------------- |
82 // CMmMtpDpMetadataVideoAccess::ConstructL |
|
82 // Second-phase |
83 // Second-phase |
83 // --------------------------------------------------------------------------- |
84 // --------------------------------------------------------------------------- |
84 // |
85 // |
85 void CMmMtpDpMetadataVideoAccess::ConstructL() |
86 void CMmMtpDpMetadataVideoAccess::ConstructL() |
86 { |
87 { |
87 iQueryText = HBufC::NewL( KMaxQueryLength ); |
88 iQueryText = HBufC::NewL( KMaxQueryLength ); |
88 |
89 |
89 User::LeaveIfError( iDbsSession.Connect() ); |
90 User::LeaveIfError( iDbsSession.Connect() ); |
90 |
91 |
91 TInt err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, |
92 TInt err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, iStoreNum ); |
92 iStoreNum ); |
|
93 |
93 |
94 err = OpenDatabase(); |
94 err = OpenDatabase(); |
95 |
95 |
96 if ( KErrNone != err ) |
96 if ( KErrNone != err ) |
97 { |
97 { |
98 PRINT1( _L( "CMmMtpDpMetadataVideoAccess::ConstructL OpenDatabase err = %d" ), err ); |
98 PRINT1( _L( "CMmMtpDpMetadataVideoAccess::ConstructL OpenDatabase err = %d" ), err ); |
99 } |
99 } |
100 } |
100 } |
101 |
101 |
102 // --------------------------------------------------------------------------- |
102 // --------------------------------------------------------------------------- |
103 // CMmMtpDpMetadataMpxAccess::OpenDatabase |
103 // CMmMtpDpMetadataVideoAccess::OpenDatabase |
104 // Open data base |
104 // Open data base |
105 // --------------------------------------------------------------------------- |
105 // --------------------------------------------------------------------------- |
106 // |
106 // |
107 TInt CMmMtpDpMetadataVideoAccess::OpenDatabase() |
107 TInt CMmMtpDpMetadataVideoAccess::OpenDatabase() |
108 { |
108 { |
166 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::OpenDatabase" ) ); |
166 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::OpenDatabase" ) ); |
167 return err; |
167 return err; |
168 } |
168 } |
169 |
169 |
170 // --------------------------------------------------------------------------- |
170 // --------------------------------------------------------------------------- |
171 // CMmMtpDpMetadataMpxAccess::OpenDatabaseL |
171 // CMmMtpDpMetadataVideoAccess::OpenDatabaseL |
172 // Open data base |
172 // Open data base |
173 // --------------------------------------------------------------------------- |
173 // --------------------------------------------------------------------------- |
174 // |
174 // |
175 void CMmMtpDpMetadataVideoAccess::OpenDatabaseL() |
175 void CMmMtpDpMetadataVideoAccess::OpenDatabaseL() |
176 { |
176 { |
179 User::Leave( KErrGeneral ); |
179 User::Leave( KErrGeneral ); |
180 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::OpenDatabaseL" ) ); |
180 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::OpenDatabaseL" ) ); |
181 } |
181 } |
182 |
182 |
183 // --------------------------------------------------------------------------- |
183 // --------------------------------------------------------------------------- |
184 // CMmMtpDpMetadataMpxAccess::~CMmMtpDpMetadataVideoAccess |
184 // CMmMtpDpMetadataVideoAccess::~CMmMtpDpMetadataVideoAccess |
185 // Destructor |
185 // Destructor |
186 // --------------------------------------------------------------------------- |
186 // --------------------------------------------------------------------------- |
187 // |
187 // |
188 CMmMtpDpMetadataVideoAccess::~CMmMtpDpMetadataVideoAccess() |
188 CMmMtpDpMetadataVideoAccess::~CMmMtpDpMetadataVideoAccess() |
189 { |
189 { |
194 iDbsSession.Close(); |
194 iDbsSession.Close(); |
195 delete iFileStore; |
195 delete iFileStore; |
196 } |
196 } |
197 |
197 |
198 // --------------------------------------------------------------------------- |
198 // --------------------------------------------------------------------------- |
199 // CMmMtpDpMetadataMpxAccess::CreateDatabaseTablesL |
199 // CMmMtpDpMetadataVideoAccess::CreateDatabaseTablesL |
200 // Case where a new memory card is used and the player has not been opened |
200 // Case where a new memory card is used and the player has not been opened |
201 // --------------------------------------------------------------------------- |
201 // --------------------------------------------------------------------------- |
202 // |
202 // |
203 void CMmMtpDpMetadataVideoAccess::CreateDatabaseTablesL() |
203 void CMmMtpDpMetadataVideoAccess::CreateDatabaseTablesL() |
204 { |
204 { |
339 User::LeaveIfError( iDatabase.Compact() ); |
339 User::LeaveIfError( iDatabase.Compact() ); |
340 } |
340 } |
341 } |
341 } |
342 |
342 |
343 // --------------------------------------------------------------------------- |
343 // --------------------------------------------------------------------------- |
344 // CMmMtpDpMetadataMpxAccess::CleanupDbIfNecessaryL |
344 // CMmMtpDpMetadataVideoAccess::CleanupDbIfNecessaryL |
345 // Cleanup Database |
345 // Cleanup Database |
346 // --------------------------------------------------------------------------- |
346 // --------------------------------------------------------------------------- |
347 // |
347 // |
348 void CMmMtpDpMetadataVideoAccess::CleanupDbIfNecessaryL() |
348 void CMmMtpDpMetadataVideoAccess::CleanupDbIfNecessaryL() |
349 { |
349 { |
367 iRecordSet.Close(); |
367 iRecordSet.Close(); |
368 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::CleanupDbIfNecessaryL" ) ); |
368 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::CleanupDbIfNecessaryL" ) ); |
369 } |
369 } |
370 |
370 |
371 // --------------------------------------------------------------------------- |
371 // --------------------------------------------------------------------------- |
372 // CMmMtpDpMetadataMpxAccess::IdentifyDeletedFilesL |
372 // CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL |
373 // Identify deleted files |
373 // Identify deleted files |
374 // --------------------------------------------------------------------------- |
374 // --------------------------------------------------------------------------- |
375 // |
375 // |
376 void CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL() |
376 void CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL() |
377 { |
377 { |
378 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL" ) ); |
378 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL" ) ); |
379 |
379 |
380 ExecuteQueryL( KAllColumns, KMtpVideoTable, KMtpVideoLocation, KNullDesC, ETrue ); |
380 ExecuteQueryL( KAllColumns, KMtpVideoTable, KMtpVideoLocation, KNullDesC, ETrue ); |
381 PRINT1( _L( "MM MTP <> CleanupDbIfNecessaryL Database total count = %d" ), iRecordSet.CountL() ); |
381 PRINT1( _L( "MM MTP <> CleanupDbIfNecessaryL Database total count = %d" ), iRecordSet.CountL() ); |
382 |
382 |
383 for ( iRecordSet.FirstL(); iRecordSet.AtRow(); iRecordSet.NextL( )) |
383 for ( iRecordSet.FirstL(); iRecordSet.AtRow(); iRecordSet.NextL() ) |
384 { |
384 { |
385 HBufC* data = ReadLongTextL( KMtpVideoLocation ); |
385 HBufC* data = ReadLongTextL( KMtpVideoLocation ); |
386 CleanupStack::PushL( data ); |
386 CleanupStack::PushL( data ); |
387 |
387 |
388 if ( !FileExists( *data ) ) |
388 if ( !FileExists( *data ) ) |
405 |
405 |
406 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL" ) ); |
406 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL" ) ); |
407 } |
407 } |
408 |
408 |
409 // --------------------------------------------------------------------------- |
409 // --------------------------------------------------------------------------- |
410 // CMmMtpDpMetadataMpxAccess::ReadLongTextL |
410 // CMmMtpDpMetadataVideoAccess::ReadLongTextL |
411 // Read from Data base |
411 // Read from Data base |
412 // --------------------------------------------------------------------------- |
412 // --------------------------------------------------------------------------- |
413 // |
413 // |
414 HBufC* CMmMtpDpMetadataVideoAccess::ReadLongTextL( const TDesC& aColumn ) |
414 HBufC* CMmMtpDpMetadataVideoAccess::ReadLongTextL( const TDesC& aColumn ) |
415 { |
415 { |
441 PRINT2( _L( "MM MTP <> ReadLongTextL Metadata value for %S is \"%S\"" ), &aColumn, buf ); |
441 PRINT2( _L( "MM MTP <> ReadLongTextL Metadata value for %S is \"%S\"" ), &aColumn, buf ); |
442 return buf; |
442 return buf; |
443 } |
443 } |
444 |
444 |
445 // --------------------------------------------------------------------------- |
445 // --------------------------------------------------------------------------- |
446 // CMmMtpDpMetadataMpxAccess::WriteLongTextL |
446 // CMmMtpDpMetadataVideoAccess::WriteLongTextL |
447 // Utility to write to the database |
447 // Utility to write to the database |
448 // --------------------------------------------------------------------------- |
448 // --------------------------------------------------------------------------- |
449 // |
449 // |
450 void CMmMtpDpMetadataVideoAccess::WriteLongTextL( const TDesC& aColumn, const TDesC& aValue ) |
450 void CMmMtpDpMetadataVideoAccess::WriteLongTextL( const TDesC& aColumn, |
451 const TDesC& aValue ) |
|
451 { |
452 { |
452 PRINT2( _L( "MM MTP <> WriteLongTextL Metadata value for %S is \"%S\"" ), &aColumn, &aValue ); |
453 PRINT2( _L( "MM MTP <> WriteLongTextL Metadata value for %S is \"%S\"" ), &aColumn, &aValue ); |
453 TDbColNo num = iColSet->ColNo( aColumn ); |
454 TDbColNo num = iColSet->ColNo( aColumn ); |
454 RDbColWriteStream strm; |
455 RDbColWriteStream strm; |
455 strm.OpenLC( iRecordSet, num ); |
456 strm.OpenLC( iRecordSet, num ); |
457 strm.Close(); |
458 strm.Close(); |
458 CleanupStack::PopAndDestroy( &strm ); |
459 CleanupStack::PopAndDestroy( &strm ); |
459 } |
460 } |
460 |
461 |
461 // --------------------------------------------------------------------------- |
462 // --------------------------------------------------------------------------- |
462 // CMmMtpDpMetadataMpxAccess::ExecuteQueryL |
463 // CMmMtpDpMetadataVideoAccess::ExecuteQueryL |
463 // Executes a query on the database and sets the cursor at the start of the recordset |
464 // Executes a query on the database and sets the cursor at the start of the recordset |
464 // --------------------------------------------------------------------------- |
465 // --------------------------------------------------------------------------- |
465 // |
466 // |
466 void CMmMtpDpMetadataVideoAccess::ExecuteQueryL( const TDesC& aSelectThese, const TDesC& aFromTable, |
467 void CMmMtpDpMetadataVideoAccess::ExecuteQueryL( const TDesC& aSelectThese, |
467 const TDesC& aColumnToMatch, const TDesC& aMatchCriteria, |
468 const TDesC& aFromTable, |
468 const TBool aIfNot, const TBool aNeedQuotes ) |
469 const TDesC& aColumnToMatch, |
470 const TDesC& aMatchCriteria, |
|
471 const TBool aIfNot, |
|
472 const TBool aNeedQuotes ) |
|
469 { |
473 { |
470 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::ExecuteQueryL" ) ); |
474 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::ExecuteQueryL" ) ); |
471 |
475 |
472 delete iColSet; |
476 delete iColSet; |
473 iColSet = NULL; |
477 iColSet = NULL; |
529 |
533 |
530 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::ExecuteQueryL" ) ); |
534 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::ExecuteQueryL" ) ); |
531 } |
535 } |
532 |
536 |
533 // --------------------------------------------------------------------------- |
537 // --------------------------------------------------------------------------- |
534 // CMmMtpDpMetadataMpxAccess::OpenSessionL |
538 // CMmMtpDpMetadataVideoAccess::OpenSessionL |
535 // Called when the MTP session is initialised |
539 // Called when the MTP session is initialised |
536 // --------------------------------------------------------------------------- |
540 // --------------------------------------------------------------------------- |
537 // |
541 // |
538 void CMmMtpDpMetadataVideoAccess::OpenSessionL() |
542 void CMmMtpDpMetadataVideoAccess::OpenSessionL() |
539 { |
543 { |
540 |
544 // Do nothing |
541 } |
545 } |
542 |
546 |
543 // --------------------------------------------------------------------------- |
547 // --------------------------------------------------------------------------- |
544 // CMmMtpDpMetadataMpxAccess::CloseSessionL |
548 // CMmMtpDpMetadataVideoAccess::CloseSessionL |
545 // Called when the MTP session is closed |
549 // Called when the MTP session is closed |
546 // --------------------------------------------------------------------------- |
550 // --------------------------------------------------------------------------- |
547 // |
551 // |
548 void CMmMtpDpMetadataVideoAccess::CloseSessionL() |
552 void CMmMtpDpMetadataVideoAccess::CloseSessionL() |
549 { |
553 { |
560 |
564 |
561 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::CloseSessionL" ) ) |
565 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::CloseSessionL" ) ) |
562 } |
566 } |
563 |
567 |
564 // --------------------------------------------------------------------------- |
568 // --------------------------------------------------------------------------- |
565 // CMmMtpDpMetadataMpxAccess::AddVideoL |
569 // CMmMtpDpMetadataVideoAccess::AddVideoL |
566 // Adds video info to the database |
570 // Adds video info to the database |
567 // --------------------------------------------------------------------------- |
571 // --------------------------------------------------------------------------- |
568 // |
572 // |
569 void CMmMtpDpMetadataVideoAccess::AddVideoL( const TDesC& aFullFileName ) |
573 void CMmMtpDpMetadataVideoAccess::AddVideoL( const TDesC& aFullFileName ) |
570 { |
574 { |
591 // Defaults |
595 // Defaults |
592 num = iColSet->ColNo( KMtpVideoLocation ); |
596 num = iColSet->ColNo( KMtpVideoLocation ); |
593 iRecordSet.SetColL( num, aFullFileName ); |
597 iRecordSet.SetColL( num, aFullFileName ); |
594 |
598 |
595 num = iColSet->ColNo( KMtpVideoName ); |
599 num = iColSet->ColNo( KMtpVideoName ); |
596 iRecordSet.SetColL( num, aFullFileName ); // Default name is the filename. |
600 TParsePtrC parser( aFullFileName ); |
601 iRecordSet.SetColL( num, parser.Name() ); // Default name is the filename. |
|
597 |
602 |
598 num = iColSet->ColNo( KMtpVideoArtist ); |
603 num = iColSet->ColNo( KMtpVideoArtist ); |
599 iRecordSet.SetColL( num, KNullDesC ); |
604 iRecordSet.SetColL( num, KNullDesC ); |
600 |
605 |
601 num = iColSet->ColNo( KMtpVideoTrack ); |
606 num = iColSet->ColNo( KMtpVideoTrack ); |
620 iRecordSet.SetColL( num, 0 ); |
625 iRecordSet.SetColL( num, 0 ); |
621 |
626 |
622 num = iColSet->ColNo( KMtpVideoHeight ); |
627 num = iColSet->ColNo( KMtpVideoHeight ); |
623 iRecordSet.SetColL( num, 0 ); |
628 iRecordSet.SetColL( num, 0 ); |
624 |
629 |
625 num = iColSet->ColNo(KMtpVideoDuration); |
630 num = iColSet->ColNo( KMtpVideoDuration ); |
626 iRecordSet.SetColL(num, 0); |
631 iRecordSet.SetColL( num, 0 ); |
627 |
632 |
628 num = iColSet->ColNo( KMtpVideoSampleRate ); |
633 num = iColSet->ColNo( KMtpVideoSampleRate ); |
629 iRecordSet.SetColL( num, 0 ); |
634 iRecordSet.SetColL( num, 0 ); |
630 |
635 |
631 num = iColSet->ColNo( KMtpVideoNumberOfChannels ); |
636 num = iColSet->ColNo( KMtpVideoNumberOfChannels ); |
641 iRecordSet.SetColL( num, 0 ); |
646 iRecordSet.SetColL( num, 0 ); |
642 |
647 |
643 num = iColSet->ColNo( KMtpVideoVideoBitrate ); |
648 num = iColSet->ColNo( KMtpVideoVideoBitrate ); |
644 iRecordSet.SetColL( num, 0 ); |
649 iRecordSet.SetColL( num, 0 ); |
645 |
650 |
646 num = iColSet->ColNo(KMtpVideoFramesPer1000Sec); |
651 num = iColSet->ColNo( KMtpVideoFramesPer1000Sec ); |
647 iRecordSet.SetColL(num, 0); |
652 iRecordSet.SetColL( num, 0 ); |
648 |
653 |
649 num = iColSet->ColNo( KMtpVideoKeyFrameDistance ); |
654 num = iColSet->ColNo( KMtpVideoKeyFrameDistance ); |
650 iRecordSet.SetColL( num, 0 ); |
655 iRecordSet.SetColL( num, 0 ); |
651 |
656 |
652 num = iColSet->ColNo( KMtpVideoScanType ); |
657 num = iColSet->ColNo( KMtpVideoScanType ); |
692 CompactDbIfNecessaryL(); |
697 CompactDbIfNecessaryL(); |
693 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::AddVideoL" ) ); |
698 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::AddVideoL" ) ); |
694 } |
699 } |
695 |
700 |
696 // --------------------------------------------------------------------------- |
701 // --------------------------------------------------------------------------- |
697 // CMmMtpDpMetadataMpxAccess::GetObjectMetadataValueL |
702 // CMmMtpDpMetadataVideoAccess::GetObjectMetadataValueL |
698 // Gets a piece of metadata from the collection |
703 // Gets a piece of metadata from the collection |
699 // --------------------------------------------------------------------------- |
704 // --------------------------------------------------------------------------- |
700 // |
705 // |
701 void CMmMtpDpMetadataVideoAccess::GetObjectMetadataValueL( const TUint16 aPropCode, |
706 void CMmMtpDpMetadataVideoAccess::GetObjectMetadataValueL( const TUint16 aPropCode, |
702 MMTPType& aNewData, |
707 MMTPType& aNewData, |
703 const CMTPObjectMetaData& aObjectMetaData ) |
708 const CMTPObjectMetaData& aObjectMetaData ) |
704 { |
709 { |
705 PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::GetObjectMetadataValue aPropCode = 0x%x" ), aPropCode ); |
710 PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::GetObjectMetadataValue aPropCode = 0x%x" ), aPropCode ); |
706 |
711 |
707 //open database if not opened |
712 //open database if not opened |
708 if ( !IsDatabaseOpened() ) |
713 if ( !IsDatabaseOpened() ) |
716 HBufC* data = NULL; |
721 HBufC* data = NULL; |
717 TDbColNo num; |
722 TDbColNo num; |
718 TUint32 uInt32 = 0; |
723 TUint32 uInt32 = 0; |
719 TUint16 uInt16 = 0; |
724 TUint16 uInt16 = 0; |
720 |
725 |
721 switch (aPropCode) |
726 switch ( aPropCode ) |
722 { |
727 { |
723 case EMTPObjectPropCodeName: |
728 case EMTPObjectPropCodeName: |
724 { |
729 { |
725 PRINT( _L( "MM MTP <> EMTPObjectPropCodeName-MD" ) ); |
730 PRINT( _L( "MM MTP <> EMTPObjectPropCodeName-MD" ) ); |
726 data = ReadLongTextL( KMtpVideoName ); |
731 data = ReadLongTextL( KMtpVideoName ); |
781 case EMTPObjectPropCodeDescription: |
786 case EMTPObjectPropCodeDescription: |
782 { |
787 { |
783 PRINT( _L( "MM MTP <> EMTPObjectPropCodeDescription-MD" ) ); |
788 PRINT( _L( "MM MTP <> EMTPObjectPropCodeDescription-MD" ) ); |
784 data = ReadLongTextL( KMtpVideoComment ); |
789 data = ReadLongTextL( KMtpVideoComment ); |
785 |
790 |
786 if ( data->Length() != 0 ) |
791 TInt len = data->Length(); |
787 ( ( CMTPTypeString& ) aNewData ).SetL( *data ) ; |
792 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValue len = %d" ),len ); |
788 else |
793 if ( len != 0 ) |
789 ( ( TMTPTypeUint32 & ) aNewData ).Set( 0 ); // return zero if description is empty |
794 { |
795 for ( TInt i = 0; i < len; i++ ) |
|
796 ( ( CMTPTypeArray& ) aNewData ).AppendUintL( ( *data )[i] ); |
|
797 } |
|
790 |
798 |
791 delete data; |
799 delete data; |
792 data = NULL; |
800 data = NULL; |
793 } |
801 } |
794 break; |
802 break; |
861 { |
869 { |
862 PRINT( _L( "MM MTP <> EMTPObjectPropCodeNumberOfChannels-MD" ) ); |
870 PRINT( _L( "MM MTP <> EMTPObjectPropCodeNumberOfChannels-MD" ) ); |
863 num = iColSet->ColNo( KMtpVideoNumberOfChannels ); |
871 num = iColSet->ColNo( KMtpVideoNumberOfChannels ); |
864 uInt16 = iRecordSet.ColUint16( num ); |
872 uInt16 = iRecordSet.ColUint16( num ); |
865 if ( EMTPTypeUINT16 == aNewData.Type() ) |
873 if ( EMTPTypeUINT16 == aNewData.Type() ) |
866 { |
874 { |
867 ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); |
875 ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); |
868 } |
876 } |
869 else |
877 else |
870 { |
878 { |
871 User::Leave( KErrArgument ); |
879 User::Leave( KErrArgument ); |
872 } |
880 } |
873 } |
881 } |
874 break; |
882 break; |
875 |
883 |
876 case EMTPObjectPropCodeAudioWAVECodec: |
884 case EMTPObjectPropCodeAudioWAVECodec: |
877 { |
885 { |
973 { |
981 { |
974 PRINT( _L( "MM MTP <> EMTPObjectPropCodeScanType-MD" ) ); |
982 PRINT( _L( "MM MTP <> EMTPObjectPropCodeScanType-MD" ) ); |
975 num = iColSet->ColNo( KMtpVideoScanType ); |
983 num = iColSet->ColNo( KMtpVideoScanType ); |
976 uInt16 = iRecordSet.ColUint16( num ); |
984 uInt16 = iRecordSet.ColUint16( num ); |
977 if ( EMTPTypeUINT16 == aNewData.Type() ) |
985 if ( EMTPTypeUINT16 == aNewData.Type() ) |
978 { |
986 { |
979 ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); |
987 ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); |
980 } |
988 } |
981 else |
989 else |
982 { |
990 { |
983 User::Leave( KErrArgument ); |
991 User::Leave( KErrArgument ); |
984 } |
992 } |
985 } |
993 } |
986 break; |
994 break; |
987 |
995 |
988 case EMTPObjectPropCodeEncodingProfile: |
996 case EMTPObjectPropCodeEncodingProfile: |
989 { |
997 { |
1019 { |
1027 { |
1020 PRINT( _L( "MM MTP <> EMTPObjectPropCodeDRMStatus-MD" ) ); |
1028 PRINT( _L( "MM MTP <> EMTPObjectPropCodeDRMStatus-MD" ) ); |
1021 num = iColSet->ColNo( KMtpVideoDRM ); |
1029 num = iColSet->ColNo( KMtpVideoDRM ); |
1022 uInt16 = iRecordSet.ColUint16( num ); |
1030 uInt16 = iRecordSet.ColUint16( num ); |
1023 if ( EMTPTypeUINT16 == aNewData.Type() ) |
1031 if ( EMTPTypeUINT16 == aNewData.Type() ) |
1024 { |
1032 { |
1025 ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); |
1033 ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); |
1026 } |
1034 } |
1027 else |
1035 else |
1028 { |
1036 { |
1029 User::Leave( KErrArgument ); |
1037 User::Leave( KErrArgument ); |
1030 } |
1038 } |
1031 } |
1039 } |
1032 break; |
1040 break; |
1033 |
1041 |
1034 default: |
1042 default: |
1035 { |
1043 { |
1037 } |
1045 } |
1038 break; |
1046 break; |
1039 } |
1047 } |
1040 |
1048 |
1041 // Pack the info to aNewData |
1049 // Pack the info to aNewData |
1042 if (data) |
1050 if ( data ) |
1043 { |
1051 { |
1044 #ifdef _DEBUG |
1052 #ifdef _DEBUG |
1045 if ( data->Length() > KMtpMaxStringDescLength ) // Have to concatenate for MTP |
1053 if ( data->Length() > KMtpMaxStringDescLength ) // Have to concatenate for MTP |
1046 { |
1054 { |
1047 PRINT1( _L( "MM MTP <> Descriptor will be concatenated from length %d to KMtpMaxStringLength" ), data->Length() ); |
1055 PRINT1( _L( "MM MTP <> Descriptor will be concatenated from length %d to KMtpMaxStringLength" ), data->Length() ); |
1062 |
1070 |
1063 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::GetObjectMetadataValue" ) ); |
1071 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::GetObjectMetadataValue" ) ); |
1064 } |
1072 } |
1065 |
1073 |
1066 // --------------------------------------------------------------------------- |
1074 // --------------------------------------------------------------------------- |
1067 // CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL |
1075 // CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL |
1068 // Sets a piece of metadata in the collection |
1076 // Sets a piece of metadata in the collection |
1069 // --------------------------------------------------------------------------- |
1077 // --------------------------------------------------------------------------- |
1070 // |
1078 // |
1071 void CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL( const TUint16 aPropCode, |
1079 void CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL( const TUint16 aPropCode, |
1072 const MMTPType& aNewData, |
1080 const MMTPType& aNewData, |
1094 |
1102 |
1095 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL" ) ); |
1103 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL" ) ); |
1096 } |
1104 } |
1097 |
1105 |
1098 // --------------------------------------------------------------------------- |
1106 // --------------------------------------------------------------------------- |
1099 // CMmMtpDpMetadataMpxAccess::SetMetadataL |
1107 // CMmMtpDpMetadataVideoAccess::SetMetadataL |
1100 // Set meta data. |
1108 // Set meta data. |
1101 // --------------------------------------------------------------------------- |
1109 // --------------------------------------------------------------------------- |
1102 // |
1110 // |
1103 void CMmMtpDpMetadataVideoAccess::SetMetadataL( const TUint16 aObjPropCode, |
1111 void CMmMtpDpMetadataVideoAccess::SetMetadataL( const TUint16 aObjPropCode, |
1104 const MMTPType& aNewData ) |
1112 const MMTPType& aNewData ) |
1121 case EMTPObjectPropCodeComposer: |
1129 case EMTPObjectPropCodeComposer: |
1122 case EMTPObjectPropCodeOriginalReleaseDate: |
1130 case EMTPObjectPropCodeOriginalReleaseDate: |
1123 case EMTPObjectPropCodeEncodingProfile: |
1131 case EMTPObjectPropCodeEncodingProfile: |
1124 case EMTPObjectPropCodeParentalRating: |
1132 case EMTPObjectPropCodeParentalRating: |
1125 { |
1133 { |
1126 if( EMTPTypeString != aNewData.Type()) |
1134 if ( EMTPTypeString != aNewData.Type() ) |
1127 { |
1135 { |
1128 User::Leave( KErrArgument ); |
1136 User::Leave( KErrArgument ); |
1129 } |
1137 } |
1130 TPtrC string( ( ( CMTPTypeString& ) aNewData ).StringChars() ); |
1138 TPtrC string( ( ( CMTPTypeString& ) aNewData ).StringChars() ); |
1131 WriteLongTextL( colName, string ); |
1139 WriteLongTextL( colName, string ); |
1135 |
1143 |
1136 case EMTPObjectPropCodeDescription: |
1144 case EMTPObjectPropCodeDescription: |
1137 { |
1145 { |
1138 PRINT( _L( "MM MTP <> EMTPObjectPropCodeDescription-MD" ) ); |
1146 PRINT( _L( "MM MTP <> EMTPObjectPropCodeDescription-MD" ) ); |
1139 #ifdef __MUSIC_ID_SUPPORT |
1147 #ifdef __MUSIC_ID_SUPPORT |
1140 //WriteMusicIdsL(*longString); |
1148 // WriteMusicIdsL(*longString); |
1141 #else |
1149 #else |
1142 desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData |
1150 desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData |
1143 MMTPType::CopyL( aNewData, *desData ); |
1151 MMTPType::CopyL( aNewData, *desData ); |
1144 TUint length = desData->NumElements(); |
1152 TUint length = desData->NumElements(); |
1145 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL length = %d" ), length ); |
1153 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataVideoAccess::SetMetadataL length = %d" ), length ); |
1146 if ( length != 0 ) |
1154 if ( length != 0 ) |
1147 { |
1155 { |
1148 TBuf<KMtpMaxDescriptionLength> text; |
1156 TBuf<KMtpMaxDescriptionLength> text; |
1149 text.Zero(); |
1157 text.Zero(); |
1150 for ( TUint i = 0; i < length; i++ ) |
1158 for ( TUint i = 0; i < length; i++ ) |
1151 { |
1159 { |
1152 text.Append( desData->ElementUint( i ) ); |
1160 text.Append( desData->ElementUint( i ) ); |
1153 } |
1161 } |
1154 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL text = %S" ), |
1162 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataVideoAccess::SetMetadataL text = %S" ), |
1155 &text ); |
1163 &text ); |
1156 WriteLongTextL( KMtpVideoComment, text ); |
1164 WriteLongTextL( KMtpVideoComment, text ); |
1157 } |
1165 } |
1158 else |
1166 else |
1159 { |
1167 { |
1208 |
1216 |
1209 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetMetadataL" ) ); |
1217 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetMetadataL" ) ); |
1210 } |
1218 } |
1211 |
1219 |
1212 // --------------------------------------------------------------------------- |
1220 // --------------------------------------------------------------------------- |
1213 // CMmMtpDpMetadataMpxAccess::RenameRecordL |
1221 // CMmMtpDpMetadataVideoAccess::RenameRecordL |
1214 // Renames the file part of a record in the collection database. |
1222 // Renames the file part of a record in the collection database. |
1215 // --------------------------------------------------------------------------- |
1223 // --------------------------------------------------------------------------- |
1216 // |
1224 // |
1217 void CMmMtpDpMetadataVideoAccess::RenameRecordL(const TDesC& aOldFileName, const TDesC& aNewFileName) |
1225 void CMmMtpDpMetadataVideoAccess::RenameRecordL( const TDesC& aOldFileName, |
1226 const TDesC& aNewFileName ) |
|
1218 { |
1227 { |
1219 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::RenameRecordL()" ) ); |
1228 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::RenameRecordL()" ) ); |
1220 |
1229 |
1221 //open database if not opened |
1230 //open database if not opened |
1222 if ( !IsDatabaseOpened() ) |
1231 if ( !IsDatabaseOpened() ) |
1228 |
1237 |
1229 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::RenameRecordL()" ) ); |
1238 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::RenameRecordL()" ) ); |
1230 } |
1239 } |
1231 |
1240 |
1232 // --------------------------------------------------------------------------- |
1241 // --------------------------------------------------------------------------- |
1233 // CMmMtpDpMetadataMpxAccess::DeleteRecordL |
1242 // CMmMtpDpMetadataVideoAccess::DeleteRecordL |
1234 // Deletes metadata information associated with the object |
1243 // Deletes metadata information associated with the object |
1235 // --------------------------------------------------------------------------- |
1244 // --------------------------------------------------------------------------- |
1236 // |
1245 // |
1237 void CMmMtpDpMetadataVideoAccess::DeleteRecordL( const TDesC& aFullFileName ) |
1246 void CMmMtpDpMetadataVideoAccess::DeleteRecordL( const TDesC& aFullFileName ) |
1238 { |
1247 { |
1265 } |
1274 } |
1266 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::DeleteRecordL" ) ); |
1275 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::DeleteRecordL" ) ); |
1267 } |
1276 } |
1268 |
1277 |
1269 // --------------------------------------------------------------------------- |
1278 // --------------------------------------------------------------------------- |
1270 // CMmMtpDpMetadataMpxAccess::DeleteAllRecordsL |
1279 // CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL |
1271 // Empties the database - used by the FormatStore command |
1280 // Empties the database - used by the FormatStore command |
1272 // --------------------------------------------------------------------------- |
1281 // --------------------------------------------------------------------------- |
1273 // |
1282 // |
1274 void CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL() |
1283 void CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL() |
1275 { |
1284 { |
1276 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL()" ) ); |
1285 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL()" ) ); |
1277 |
1286 |
1278 //open database if not opened |
1287 //open database if not opened |
1279 if (!IsDatabaseOpened()) |
1288 if ( !IsDatabaseOpened() ) |
1280 OpenDatabaseL(); |
1289 OpenDatabaseL(); |
1281 |
1290 |
1282 SetRecordL( KNullDesC, ENoRecord ); // Commit any other changes to the DB |
1291 SetRecordL( KNullDesC, ENoRecord ); // Commit any other changes to the DB |
1283 |
1292 |
1284 PRINT( _L( "MM MTP <> Deleting music files" ) ); |
1293 PRINT( _L( "MM MTP <> Deleting music files" ) ); |
1296 iDatabase.Compact(); |
1305 iDatabase.Compact(); |
1297 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL()" ) ); |
1306 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL()" ) ); |
1298 } |
1307 } |
1299 |
1308 |
1300 // --------------------------------------------------------------------------- |
1309 // --------------------------------------------------------------------------- |
1301 // CMmMtpDpMetadataMpxAccess::SetRecordL |
1310 // CMmMtpDpMetadataVideoAccess::SetRecordL |
1302 // Set Record |
1311 // Set Record |
1303 // --------------------------------------------------------------------------- |
1312 // --------------------------------------------------------------------------- |
1304 // |
1313 // |
1305 void CMmMtpDpMetadataVideoAccess::SetRecordL( const TDesC& aFullFileName, TMtpDbState aState ) |
1314 void CMmMtpDpMetadataVideoAccess::SetRecordL( const TDesC& aFullFileName, |
1315 TMtpDbState aState ) |
|
1306 { |
1316 { |
1307 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetRecordL()" ) ); |
1317 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetRecordL()" ) ); |
1308 |
1318 |
1309 if ( ( aState == iDbState ) |
1319 if ( ( aState == iDbState ) |
1310 && ( 0 == aFullFileName.Compare( iCurrentFileName ) ) ) // Already have it |
1320 && ( 0 == aFullFileName.Compare( iCurrentFileName ) ) ) // Already have it |
1311 { |
1321 { |
1312 if (iDbState == ERecordRead) |
1322 if ( iDbState == ERecordRead ) |
1313 iRecordSet.GetL(); |
1323 iRecordSet.GetL(); |
1314 |
1324 |
1315 PRINT1( _L( "MM MTP <> Cached recordset, filename is '%S'" ), &iCurrentFileName ); |
1325 PRINT1( _L( "MM MTP <> Cached recordset, filename is '%S'" ), &iCurrentFileName ); |
1316 return; |
1326 return; |
1317 } |
1327 } |
1330 case ERecordWrite: // intentionally fallthrough |
1340 case ERecordWrite: // intentionally fallthrough |
1331 // We wrote some stuff to the db, now needs comitting |
1341 // We wrote some stuff to the db, now needs comitting |
1332 PRINT( _L( "MM MTP <> SetRecordL ERecordWrite" ) ); |
1342 PRINT( _L( "MM MTP <> SetRecordL ERecordWrite" ) ); |
1333 TRAPD( err, iRecordSet.PutL() ); |
1343 TRAPD( err, iRecordSet.PutL() ); |
1334 |
1344 |
1335 if (KErrNone != err) |
1345 if ( KErrNone != err ) |
1336 { |
1346 { |
1337 iRecordSet.Cancel(); |
1347 iRecordSet.Cancel(); |
1338 User::Leave( err ); |
1348 User::Leave( err ); |
1339 } |
1349 } |
1340 //lint -fallthrough |
1350 //lint -fallthrough |
1341 case ENoRecord: // intentionally fallthrough |
1351 case ENoRecord: // intentionally fallthrough |
1342 // We need to just close the open record |
1352 // We need to just close the open record |
1343 PRINT( _L( "MM MTP <> SetRecordL ENoRecord" ) ); |
1353 PRINT( _L( "MM MTP <> SetRecordL ENoRecord" ) ); |
1344 //lint -fallthrough |
1354 //lint -fallthrough |
1345 case ERecordRead: // intentionally fallthrough |
1355 case ERecordRead: // intentionally fallthrough |
1346 // We need to open a row for reading |
1356 // We need to open a row for reading |
1347 PRINT( _L( "MM MTP <> SetRecordL ERecordRead" ) ); |
1357 PRINT( _L( "MM MTP <> SetRecordL ERecordRead" ) ); |
1348 //lint -fallthrough |
1358 //lint -fallthrough |
1349 default: // intentionally fallthrough |
1359 default: // intentionally fallthrough |
1350 PRINT( _L( "MM MTP <> SetRecordL Closing recordset" ) ); |
1360 PRINT( _L( "MM MTP <> SetRecordL Closing recordset" ) ); |
1351 delete iColSet; |
1361 delete iColSet; |
1352 iColSet = NULL; |
1362 iColSet = NULL; |
1353 iRecordSet.Close(); |
1363 iRecordSet.Close(); |
1354 iDbState = ENoRecord; |
1364 iDbState = ENoRecord; |
1355 break; |
1365 break; |
1356 } |
1366 } |
1357 |
1367 |
1358 if ( aState == ENoRecord ) // We are closing the session if this is the case |
1368 if ( aState == ENoRecord ) // We are closing the session if this is the case |
1359 { |
1369 { |
1360 PRINT( _L( "MM MTP <> SetRecordL Record closed, no request to open" ) ); |
1370 PRINT( _L( "MM MTP <> SetRecordL Record closed, no request to open" ) ); |
1361 return; |
1371 return; |
1362 } |
1372 } |
1363 |
1373 |
1364 // if we have a music format, we can open the database... |
1374 // if we have a music format, we can open the database... |
1365 TUint16 format = MmMtpDpUtility::FormatFromFilename( iCurrentFileName ); |
1375 TUint16 format = MmMtpDpUtility::FormatFromFilename( iCurrentFileName ); |
1366 PRINT1( _L( "MM MTP <> SetRecordL format = 0x%x" ), format ); |
1376 PRINT1( _L( "MM MTP <> SetRecordL format = 0x%x" ), format ); |
1367 |
|
1368 |
1377 |
1369 if ( MmMtpDpUtility::HasMetadata( format ) ) |
1378 if ( MmMtpDpUtility::HasMetadata( format ) ) |
1370 { |
1379 { |
1371 // Get the record |
1380 // Get the record |
1372 ExecuteQueryL( KAllColumns, KMtpVideoTable, KMtpVideoLocation, aFullFileName ); |
1381 ExecuteQueryL( KAllColumns, KMtpVideoTable, KMtpVideoLocation, aFullFileName ); |
1407 |
1416 |
1408 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetRecordL()" ) ); |
1417 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetRecordL()" ) ); |
1409 } |
1418 } |
1410 |
1419 |
1411 // --------------------------------------------------------------------------- |
1420 // --------------------------------------------------------------------------- |
1412 // CMmMtpDpMetadataMpxAccess::SetImageObjPropL |
1421 // CMmMtpDpMetadataVideoAccess::SetImageObjPropL |
1413 // set image specific properties specific to videos |
1422 // set image specific properties specific to videos |
1414 // --------------------------------------------------------------------------- |
1423 // --------------------------------------------------------------------------- |
1415 // |
1424 // |
1416 void CMmMtpDpMetadataVideoAccess::SetImageObjPropL( const TDesC& aFullFileName, |
1425 void CMmMtpDpMetadataVideoAccess::SetImageObjPropL( const TDesC& aFullFileName, |
1417 const TUint32 aWidth, |
1426 const TUint32 aWidth, |
1428 SetRecordL( aFullFileName, ERecordWrite ); |
1437 SetRecordL( aFullFileName, ERecordWrite ); |
1429 num = iColSet->ColNo( KMtpVideoWidth ); |
1438 num = iColSet->ColNo( KMtpVideoWidth ); |
1430 TRAP( err, iRecordSet.SetColL( num, aWidth ) ); |
1439 TRAP( err, iRecordSet.SetColL( num, aWidth ) ); |
1431 |
1440 |
1432 if ( err != KErrNone ) |
1441 if ( err != KErrNone ) |
1433 { |
1442 { |
1434 SetRecordL( aFullFileName, EFailedWrite ); |
1443 SetRecordL( aFullFileName, EFailedWrite ); |
1435 User::Leave( err ); |
1444 User::Leave( err ); |
1436 } |
1445 } |
1437 |
1446 |
1438 num = iColSet->ColNo( KMtpVideoHeight ); |
1447 num = iColSet->ColNo( KMtpVideoHeight ); |
1439 TRAP( err, iRecordSet.SetColL( num, aHeight ) ); |
1448 TRAP( err, iRecordSet.SetColL( num, aHeight ) ); |
1440 |
1449 |
1441 if ( err != KErrNone ) |
1450 if ( err != KErrNone ) |
1442 { |
1451 { |
1443 SetRecordL( aFullFileName, EFailedWrite ); |
1452 SetRecordL( aFullFileName, EFailedWrite ); |
1444 User::Leave( err ); |
1453 User::Leave( err ); |
1445 } |
1454 } |
1446 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetImageObjPropL()" ) ); |
1455 PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetImageObjPropL()" ) ); |
1447 } |
1456 } |
1448 |
1457 |
1449 // --------------------------------------------------------------------------- |
1458 // --------------------------------------------------------------------------- |
1450 // CMmMtpDpMetadataMpxAccess::GetImageObjPropL |
1459 // CMmMtpDpMetadataVideoAccess::GetImageObjPropL |
1451 // Get image specific properties specific to videos |
1460 // Get image specific properties specific to videos |
1452 // --------------------------------------------------------------------------- |
1461 // --------------------------------------------------------------------------- |
1453 // |
1462 // |
1454 void CMmMtpDpMetadataVideoAccess::GetImageObjPropL( const TDesC& aFullFileName, |
1463 void CMmMtpDpMetadataVideoAccess::GetImageObjPropL( const TDesC& aFullFileName, |
1455 TUint32& aWidth, |
1464 TUint32& aWidth, |
1474 } |
1483 } |
1475 |
1484 |
1476 const TDesC& CMmMtpDpMetadataVideoAccess::ColumnNameFromPropCodeL( const TUint16 aPropCode ) |
1485 const TDesC& CMmMtpDpMetadataVideoAccess::ColumnNameFromPropCodeL( const TUint16 aPropCode ) |
1477 { |
1486 { |
1478 const TColumnNameTable KColumnTable[] = |
1487 const TColumnNameTable KColumnTable[] = |
1479 { |
1488 { |
1480 { EMTPObjectPropCodeName, KMtpVideoName }, |
1489 { EMTPObjectPropCodeName, KMtpVideoName }, |
1481 { EMTPObjectPropCodeArtist, KMtpVideoArtist }, |
1490 { EMTPObjectPropCodeArtist, KMtpVideoArtist }, |
1482 { EMTPObjectPropCodeTrack, KMtpVideoTrack }, |
1491 { EMTPObjectPropCodeTrack, KMtpVideoTrack }, |
1483 { EMTPObjectPropCodeGenre, KMtpVideoGenre }, |
1492 { EMTPObjectPropCodeGenre, KMtpVideoGenre }, |
1484 { EMTPObjectPropCodeAlbumName, KMtpVideoAlbumName }, |
1493 { EMTPObjectPropCodeAlbumName, KMtpVideoAlbumName }, |
1485 { EMTPObjectPropCodeComposer, KMtpVideoComposer }, |
1494 { EMTPObjectPropCodeComposer, KMtpVideoComposer }, |
1486 { EMTPObjectPropCodeOriginalReleaseDate, KMtpVideoOrigReleaseDate }, |
1495 { EMTPObjectPropCodeOriginalReleaseDate, KMtpVideoOrigReleaseDate }, |
1487 { EMTPObjectPropCodeDescription, KMtpVideoComment }, |
1496 { EMTPObjectPropCodeDescription, KMtpVideoComment }, |
1488 { EMTPObjectPropCodeWidth, KMtpVideoWidth }, |
1497 { EMTPObjectPropCodeWidth, KMtpVideoWidth }, |
1489 { EMTPObjectPropCodeHeight, KMtpVideoHeight }, |
1498 { EMTPObjectPropCodeHeight, KMtpVideoHeight }, |
1490 { EMTPObjectPropCodeDuration, KMtpVideoDuration }, |
1499 { EMTPObjectPropCodeDuration, KMtpVideoDuration }, |
1491 { EMTPObjectPropCodeSampleRate, KMtpVideoSampleRate }, |
1500 { EMTPObjectPropCodeSampleRate, KMtpVideoSampleRate }, |
1492 { EMTPObjectPropCodeNumberOfChannels, KMtpVideoNumberOfChannels }, |
1501 { EMTPObjectPropCodeNumberOfChannels, KMtpVideoNumberOfChannels }, |
1493 { EMTPObjectPropCodeAudioBitRate, KMtpVideoAudioBitrate }, |
1502 { EMTPObjectPropCodeAudioBitRate, KMtpVideoAudioBitrate }, |
1494 { EMTPObjectPropCodeVideoFourCCCodec, KMtpVideoVideoCodec }, |
1503 { EMTPObjectPropCodeVideoFourCCCodec, KMtpVideoVideoCodec }, |
1495 { EMTPObjectPropCodeVideoBitRate, KMtpVideoVideoBitrate }, |
1504 { EMTPObjectPropCodeVideoBitRate, KMtpVideoVideoBitrate }, |
1496 { EMTPObjectPropCodeFramesPerThousandSeconds,KMtpVideoFramesPer1000Sec }, |
1505 { EMTPObjectPropCodeFramesPerThousandSeconds,KMtpVideoFramesPer1000Sec }, |
1497 { EMTPObjectPropCodeKeyFrameDistance, KMtpVideoKeyFrameDistance }, |
1506 { EMTPObjectPropCodeKeyFrameDistance, KMtpVideoKeyFrameDistance }, |
1498 { EMTPObjectPropCodeScanType, KMtpVideoScanType }, |
1507 { EMTPObjectPropCodeScanType, KMtpVideoScanType }, |
1499 { EMTPObjectPropCodeEncodingProfile, KMtpVideoEncodingProfile }, |
1508 { EMTPObjectPropCodeEncodingProfile, KMtpVideoEncodingProfile }, |
1500 { EMTPObjectPropCodeParentalRating, KMtpVideoParentalRating }, |
1509 { EMTPObjectPropCodeParentalRating, KMtpVideoParentalRating }, |
1501 { EMTPObjectPropCodeUseCount, KMtpVideoUseCount }, |
1510 { EMTPObjectPropCodeUseCount, KMtpVideoUseCount }, |
1502 { EMTPObjectPropCodeAudioWAVECodec, KMtpVideoAudioCodec }, |
1511 { EMTPObjectPropCodeAudioWAVECodec, KMtpVideoAudioCodec }, |
1503 { EMTPObjectPropCodeDRMStatus, KMtpVideoDRM }, |
1512 { EMTPObjectPropCodeDRMStatus, KMtpVideoDRM }, |
1504 }; |
1513 }; |
1505 |
1514 |
1506 TInt i = 0; |
1515 TInt i = 0; |
1507 TInt count = sizeof ( KColumnTable ) / sizeof ( KColumnTable[0] ); |
1516 TInt count = sizeof( KColumnTable ) / sizeof( KColumnTable[0] ); |
1508 while ( ( KColumnTable[i].iPropCode != aPropCode ) && ( i < count ) ) |
1517 while ( ( KColumnTable[i].iPropCode != aPropCode ) && ( i < count ) ) |
1509 { |
1518 { |
1510 i++; |
1519 i++; |
1511 } |
1520 } |
1512 |
1521 |
1513 if ( i == count ) |
1522 if ( i == count ) |
1514 { |
1523 { |
1515 // Not supported by MPX, shouldn't call this function |
1524 // Not supported by MPX, shouldn't call this function |
1516 PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::MpxAttribFromPropL NOT SUPPORTED ATTRIBUTE" ) ); |
1525 PRINT( _L( "MM MTP <> CMmMtpDpMetadataVideoAccess::ColumnNameFromPropCodeL NOT SUPPORTED ATTRIBUTE" ) ); |
1517 User::Leave( KErrNotSupported ); |
1526 User::Leave( KErrNotSupported ); |
1518 } |
1527 } |
1519 return KColumnTable[i].iDbColumnName; |
1528 return KColumnTable[i].iDbColumnName; |
1520 } |
1529 } |
1521 |
1530 |
1522 void CMmMtpDpMetadataVideoAccess::SetStorageRootL( const TDesC& aStorageRoot ) |
1531 void CMmMtpDpMetadataVideoAccess::SetStorageRootL( const TDesC& aStorageRoot ) |
1523 { |
1532 { |
1524 PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetStorageRoot aStoreRoot = %S" ), &aStorageRoot ); |
1533 PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetStorageRoot aStoreRoot = %S" ), &aStorageRoot ); |
1525 |
1534 |
1526 // get the drive number |
1535 // get the drive number |
1527 TParse pathParser; |
1536 TParse pathParser; |
1528 User::LeaveIfError( pathParser.Set( aStorageRoot, NULL, NULL ) ); |
1537 User::LeaveIfError( pathParser.Set( aStorageRoot, NULL, NULL ) ); |
1529 TChar driveChar( pathParser.Drive()[0] ); |
1538 TChar driveChar( pathParser.Drive()[0] ); |
1530 |
1539 |
1531 User::LeaveIfError( RFs::CharToDrive( driveChar, iStoreNum ) ); |
1540 User::LeaveIfError( RFs::CharToDrive( driveChar, iStoreNum ) ); |
1532 PRINT1( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetStorageRoot drive number = %d" ), iStoreNum ); |
1541 PRINT1( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetStorageRoot drive number = %d" ), iStoreNum ); |
1533 } |
1542 } |
1534 |
1543 |
1535 void CMmMtpDpMetadataVideoAccess::CleanupDatabaseL() |
1544 void CMmMtpDpMetadataVideoAccess::CleanupDatabaseL() |
1536 { |
1545 { |
1537 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::CleanupDatabaseL" ) ); |
1546 PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::CleanupDatabaseL" ) ); |