mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatavideoaccess.cpp
changeset 25 d881023c13eb
parent 20 b1fb57be53fe
child 50 762d760dcfdf
--- a/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatavideoaccess.cpp	Fri Apr 16 15:28:14 2010 +0300
+++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatavideoaccess.cpp	Mon May 03 12:58:40 2010 +0300
@@ -1,19 +1,19 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Meta data Video access
-*
-*/
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Meta data Video access
+ *
+ */
 
 #include <ContentListingFactory.h>
 #include <MCLFContentListingEngine.h>
@@ -38,9 +38,8 @@
 #include "mmmtpdputility.h"
 #include "tmmmtpdppanic.h"
 #include "mmmtpvideodbdefs.h"
+#include "tobjectdescription.h"
 
-static const TInt KMtpMaxStringLength = 255;
-static const TInt KMtpMaxDescriptionLength = 0x200;
 const TInt KStorageRootMaxLength = 10;
 
 #ifdef _DEBUG
@@ -62,23 +61,24 @@
 
 CMmMtpDpMetadataVideoAccess* CMmMtpDpMetadataVideoAccess::NewL( RFs& aRfs )
     {
-    CMmMtpDpMetadataVideoAccess* me = new(ELeave) CMmMtpDpMetadataVideoAccess( aRfs );
-    CleanupStack::PushL(me);
+    CMmMtpDpMetadataVideoAccess* me = new( ELeave ) CMmMtpDpMetadataVideoAccess( aRfs );
+    CleanupStack::PushL( me );
     me->ConstructL();
-    CleanupStack::Pop(me);
+    CleanupStack::Pop( me );
 
     return me;
     }
 
-CMmMtpDpMetadataVideoAccess::CMmMtpDpMetadataVideoAccess( RFs& aRfs ) : iRfs(aRfs),
-                                                    iDbState(ENoRecord),
-                                                    iDbOpened(EFalse)
+CMmMtpDpMetadataVideoAccess::CMmMtpDpMetadataVideoAccess( RFs& aRfs ) :
+    iRfs( aRfs ),
+    iDbState( ENoRecord ),
+    iDbOpened( EFalse )
     {
-    
+    // Do nothing
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::ConstructL
+// CMmMtpDpMetadataVideoAccess::ConstructL
 // Second-phase
 // ---------------------------------------------------------------------------
 //
@@ -88,8 +88,7 @@
 
     User::LeaveIfError( iDbsSession.Connect() );
 
-    TInt err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory,
-        iStoreNum );
+    TInt err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, iStoreNum );
 
     err = OpenDatabase();
 
@@ -100,7 +99,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::OpenDatabase
+// CMmMtpDpMetadataVideoAccess::OpenDatabase
 // Open data base
 // ---------------------------------------------------------------------------
 //
@@ -168,7 +167,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::OpenDatabaseL
+// CMmMtpDpMetadataVideoAccess::OpenDatabaseL
 // Open data base
 // ---------------------------------------------------------------------------
 //
@@ -181,7 +180,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::~CMmMtpDpMetadataVideoAccess
+// CMmMtpDpMetadataVideoAccess::~CMmMtpDpMetadataVideoAccess
 // Destructor
 // ---------------------------------------------------------------------------
 //
@@ -196,7 +195,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::CreateDatabaseTablesL
+// CMmMtpDpMetadataVideoAccess::CreateDatabaseTablesL
 // Case where a new memory card is used and the player has not been opened
 // ---------------------------------------------------------------------------
 //
@@ -304,10 +303,6 @@
     formatBuf.Append( KMtpVideoParentalRatingType );
     formatBuf.Append( KMtpVideoCommaSign );
 
-    formatBuf.Append( KMtpVideoUseCount );
-    formatBuf.Append( KMtpVideoUseCountType );
-    formatBuf.Append( KMtpVideoCommaSign );
-
     formatBuf.Append( KMtpVideoDRM );
     formatBuf.Append( KMtpVideoDRMType );
     formatBuf.Append( KMtpVideoCommaSign );
@@ -341,7 +336,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::CleanupDbIfNecessaryL
+// CMmMtpDpMetadataVideoAccess::CleanupDbIfNecessaryL
 // Cleanup Database
 // ---------------------------------------------------------------------------
 //
@@ -369,7 +364,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::IdentifyDeletedFilesL
+// CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL
 // Identify deleted files
 // ---------------------------------------------------------------------------
 //
@@ -380,7 +375,7 @@
     ExecuteQueryL( KAllColumns, KMtpVideoTable, KMtpVideoLocation, KNullDesC, ETrue );
     PRINT1( _L( "MM MTP <> CleanupDbIfNecessaryL Database total count = %d" ), iRecordSet.CountL() );
 
-    for ( iRecordSet.FirstL(); iRecordSet.AtRow(); iRecordSet.NextL( ))
+    for ( iRecordSet.FirstL(); iRecordSet.AtRow(); iRecordSet.NextL() )
         {
         HBufC* data = ReadLongTextL( KMtpVideoLocation );
         CleanupStack::PushL( data );
@@ -407,7 +402,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::ReadLongTextL
+// CMmMtpDpMetadataVideoAccess::ReadLongTextL
 // Read from Data base
 // ---------------------------------------------------------------------------
 //
@@ -443,11 +438,12 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::WriteLongTextL
+// CMmMtpDpMetadataVideoAccess::WriteLongTextL
 // Utility to write to the database
 // ---------------------------------------------------------------------------
 //
-void CMmMtpDpMetadataVideoAccess::WriteLongTextL( const TDesC& aColumn, const TDesC& aValue )
+void CMmMtpDpMetadataVideoAccess::WriteLongTextL( const TDesC& aColumn,
+    const TDesC& aValue )
     {
     PRINT2( _L( "MM MTP <> WriteLongTextL Metadata value for %S is \"%S\"" ), &aColumn, &aValue );
     TDbColNo num = iColSet->ColNo( aColumn );
@@ -459,13 +455,16 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::ExecuteQueryL
+// CMmMtpDpMetadataVideoAccess::ExecuteQueryL
 // Executes a query on the database and sets the cursor at the start of the recordset
 // ---------------------------------------------------------------------------
 //
-void CMmMtpDpMetadataVideoAccess::ExecuteQueryL( const TDesC& aSelectThese, const TDesC& aFromTable,
-                                       const TDesC& aColumnToMatch, const TDesC& aMatchCriteria,
-                                       const TBool aIfNot, const TBool aNeedQuotes )
+void CMmMtpDpMetadataVideoAccess::ExecuteQueryL( const TDesC& aSelectThese,
+    const TDesC& aFromTable,
+    const TDesC& aColumnToMatch,
+    const TDesC& aMatchCriteria,
+    const TBool aIfNot,
+    const TBool aNeedQuotes )
     {
     PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::ExecuteQueryL" ) );
 
@@ -531,17 +530,17 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::OpenSessionL
+// CMmMtpDpMetadataVideoAccess::OpenSessionL
 // Called when the MTP session is initialised
 // ---------------------------------------------------------------------------
 //
 void CMmMtpDpMetadataVideoAccess::OpenSessionL()
     {
-
+    // Do nothing
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::CloseSessionL
+// CMmMtpDpMetadataVideoAccess::CloseSessionL
 // Called when the MTP session is closed
 // ---------------------------------------------------------------------------
 //
@@ -562,7 +561,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::AddVideoL
+// CMmMtpDpMetadataVideoAccess::AddVideoL
 // Adds video info to the database
 // ---------------------------------------------------------------------------
 //
@@ -593,7 +592,8 @@
         iRecordSet.SetColL( num, aFullFileName );
 
         num = iColSet->ColNo( KMtpVideoName );
-        iRecordSet.SetColL( num, aFullFileName );     // Default name is the filename.
+        TParsePtrC parser( aFullFileName );
+        iRecordSet.SetColL( num, parser.Name() ); // Default name is the filename.
 
         num = iColSet->ColNo( KMtpVideoArtist );
         iRecordSet.SetColL( num, KNullDesC );
@@ -622,8 +622,8 @@
         num = iColSet->ColNo( KMtpVideoHeight );
         iRecordSet.SetColL( num, 0 );
 
-        num = iColSet->ColNo(KMtpVideoDuration);
-        iRecordSet.SetColL(num, 0);
+        num = iColSet->ColNo( KMtpVideoDuration );
+        iRecordSet.SetColL( num, 0 );
 
         num = iColSet->ColNo( KMtpVideoSampleRate );
         iRecordSet.SetColL( num, 0 );
@@ -643,8 +643,8 @@
         num = iColSet->ColNo( KMtpVideoVideoBitrate );
         iRecordSet.SetColL( num, 0 );
 
-        num = iColSet->ColNo(KMtpVideoFramesPer1000Sec);
-        iRecordSet.SetColL(num, 0);
+        num = iColSet->ColNo( KMtpVideoFramesPer1000Sec );
+        iRecordSet.SetColL( num, 0 );
 
         num = iColSet->ColNo( KMtpVideoKeyFrameDistance );
         iRecordSet.SetColL( num, 0 );
@@ -658,9 +658,6 @@
         num = iColSet->ColNo( KMtpVideoParentalRating );
         iRecordSet.SetColL( num, KNullDesC );
 
-        num = iColSet->ColNo( KMtpVideoUseCount );
-        iRecordSet.SetColL( num, 0 );
-
         num = iColSet->ColNo( KMtpVideoDRM );
         iRecordSet.SetColL( num, 0 );
         }
@@ -694,13 +691,13 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::GetObjectMetadataValueL
+// CMmMtpDpMetadataVideoAccess::GetObjectMetadataValueL
 //  Gets a piece of metadata from the collection
 // ---------------------------------------------------------------------------
 //
 void CMmMtpDpMetadataVideoAccess::GetObjectMetadataValueL( const TUint16 aPropCode,
-        MMTPType& aNewData,
-        const CMTPObjectMetaData& aObjectMetaData )
+    MMTPType& aNewData,
+    const CMTPObjectMetaData& aObjectMetaData )
     {
     PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::GetObjectMetadataValue aPropCode = 0x%x" ), aPropCode );
 
@@ -718,7 +715,7 @@
     TUint32 uInt32 = 0;
     TUint16 uInt16 = 0;
 
-    switch (aPropCode)
+    switch ( aPropCode )
         {
         case EMTPObjectPropCodeName:
             {
@@ -783,10 +780,13 @@
             PRINT( _L( "MM MTP <> EMTPObjectPropCodeDescription-MD" ) );
             data = ReadLongTextL( KMtpVideoComment );
 
-            if ( data->Length() != 0 )
-                ( ( CMTPTypeString& ) aNewData ).SetL( *data ) ;
-            else
-                ( ( TMTPTypeUint32 & ) aNewData ).Set( 0 );  // return zero if description is empty
+            TInt len = data->Length();
+            PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValue len = %d" ),len );
+            if ( len != 0 )
+                {
+                for ( TInt i = 0; i < len; i++ )
+                    ( ( CMTPTypeArray& ) aNewData ).AppendUintL( ( *data )[i] );
+                }
 
             delete data;
             data = NULL;
@@ -863,13 +863,13 @@
             num = iColSet->ColNo( KMtpVideoNumberOfChannels );
             uInt16 = iRecordSet.ColUint16( num );
             if ( EMTPTypeUINT16 == aNewData.Type() )
-                 {
-                 ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 );
-                 }
-             else
-                 {
-                 User::Leave( KErrArgument );
-                 }
+                {
+                ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }
             }
             break;
 
@@ -975,13 +975,13 @@
             num = iColSet->ColNo( KMtpVideoScanType );
             uInt16 = iRecordSet.ColUint16( num );
             if ( EMTPTypeUINT16 == aNewData.Type() )
-                 {
-                 ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 );
-                 }
-             else
-                 {
-                 User::Leave( KErrArgument );
-                 }
+                {
+                ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }
             }
             break;
 
@@ -999,35 +999,19 @@
             }
             break;
 
-        case EMTPObjectPropCodeUseCount:
-            {
-            PRINT( _L( "MM MTP <> EMTPObjectPropCodeUseCount-MD" ) );
-            num = iColSet->ColNo( KMtpVideoUseCount );
-            uInt32 = iRecordSet.ColUint32( num );
-            if ( EMTPTypeUINT32 == aNewData.Type() )
-                {
-                ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 );
-                }
-            else
-                {
-                User::Leave( KErrArgument );
-                }
-            }
-            break;
-
         case EMTPObjectPropCodeDRMStatus:
             {
             PRINT( _L( "MM MTP <> EMTPObjectPropCodeDRMStatus-MD" ) );
             num = iColSet->ColNo( KMtpVideoDRM );
             uInt16 = iRecordSet.ColUint16( num );
             if ( EMTPTypeUINT16 == aNewData.Type() )
-                 {
-                 ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 );
-                 }
-             else
-                 {
-                 User::Leave( KErrArgument );
-                 }
+                {
+                ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }
             }
             break;
 
@@ -1039,7 +1023,7 @@
         }
 
     // Pack the info to aNewData
-    if (data)
+    if ( data )
         {
 #ifdef _DEBUG
         if ( data->Length() > KMtpMaxStringDescLength )   // Have to concatenate for MTP
@@ -1064,7 +1048,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL
+// CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL
 // Sets a piece of metadata in the collection
 // ---------------------------------------------------------------------------
 //
@@ -1079,24 +1063,14 @@
 
     // Get file path
     TPtrC suid( aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ) );
-    TParsePtrC parse( suid );
     SetRecordL( suid, ERecordWrite );
-    TRAPD( err, SetMetadataL( aPropCode, aNewData ) );
-
-    if ( err < KErrNone ) // EPOC error condition
-        {
-        PRINT1( _L( "MM MTP <> Metadata write failed, with error %d" ), err );
-        SetRecordL( suid, EFailedWrite );
-        }
-
-    if ( err != KErrNone )
-        User::Leave( err );
+    SetMetadataL( aPropCode, aNewData );
 
     PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL" ) );
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::SetMetadataL
+// CMmMtpDpMetadataVideoAccess::SetMetadataL
 // Set meta data.
 // ---------------------------------------------------------------------------
 //
@@ -1123,7 +1097,7 @@
         case EMTPObjectPropCodeEncodingProfile:
         case EMTPObjectPropCodeParentalRating:
             {
-            if( EMTPTypeString != aNewData.Type())
+            if ( EMTPTypeString != aNewData.Type() )
                 {
                 User::Leave( KErrArgument );
                 }
@@ -1137,23 +1111,26 @@
             {
             PRINT( _L( "MM MTP <> EMTPObjectPropCodeDescription-MD" ) );
 #ifdef __MUSIC_ID_SUPPORT
-            //WriteMusicIdsL(*longString);
+            // WriteMusicIdsL(*longString);
 #else
             desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData
             MMTPType::CopyL( aNewData, *desData );
             TUint length = desData->NumElements();
-            PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL length = %d" ), length );
+            PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL length = %d" ),
+                length );
             if ( length != 0 )
                 {
-                TBuf<KMtpMaxDescriptionLength> text;
-                text.Zero();
+                length = ( length < KMTPMaxDescriptionLen ) ? length : KMTPMaxDescriptionLen;
+                HBufC* text = HBufC::NewLC( length );    // + text
+                TPtr ptr = text->Des();
+
                 for ( TUint i = 0; i < length; i++ )
-                    {
-                    text.Append( desData->ElementUint( i ) );
-                    }
+                    ptr.Append( desData->ElementUint( i ) );
                 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL text = %S" ),
-                    &text );
-                WriteLongTextL( KMtpVideoComment, text );
+                    text );
+
+                WriteLongTextL( KMtpVideoComment, *text );
+                CleanupStack::PopAndDestroy( text );    // - text
                 }
             else
                 {
@@ -1174,7 +1151,6 @@
         case EMTPObjectPropCodeVideoBitRate:
         case EMTPObjectPropCodeFramesPerThousandSeconds:
         case EMTPObjectPropCodeKeyFrameDistance:
-        case EMTPObjectPropCodeUseCount:
             {
             if ( EMTPTypeUINT32 != aNewData.Type() )
                 {
@@ -1210,11 +1186,12 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::RenameRecordL
+// CMmMtpDpMetadataVideoAccess::RenameRecordL
 // Renames the file part of a record in the collection database.
 // ---------------------------------------------------------------------------
 //
-void CMmMtpDpMetadataVideoAccess::RenameRecordL(const TDesC& aOldFileName, const TDesC& aNewFileName)
+void CMmMtpDpMetadataVideoAccess::RenameRecordL( const TDesC& aOldFileName,
+    const TDesC& aNewFileName )
     {
     PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::RenameRecordL()" ) );
 
@@ -1230,7 +1207,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::DeleteRecordL
+// CMmMtpDpMetadataVideoAccess::DeleteRecordL
 // Deletes metadata information associated with the object
 // ---------------------------------------------------------------------------
 //
@@ -1267,7 +1244,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::DeleteAllRecordsL
+// CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL
 // Empties the database - used by the FormatStore command
 // ---------------------------------------------------------------------------
 //
@@ -1276,7 +1253,7 @@
     PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL()" ) );
 
     //open database if not opened
-    if (!IsDatabaseOpened())
+    if ( !IsDatabaseOpened() )
         OpenDatabaseL();
 
     SetRecordL( KNullDesC, ENoRecord );   // Commit any other changes to the DB
@@ -1298,18 +1275,19 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::SetRecordL
+// CMmMtpDpMetadataVideoAccess::SetRecordL
 // Set Record
 // ---------------------------------------------------------------------------
 //
-void CMmMtpDpMetadataVideoAccess::SetRecordL( const TDesC& aFullFileName, TMtpDbState aState )
+void CMmMtpDpMetadataVideoAccess::SetRecordL( const TDesC& aFullFileName,
+    TMtpDbState aState )
     {
     PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetRecordL()" ) );
 
     if ( ( aState == iDbState )
-            && ( 0 == aFullFileName.Compare( iCurrentFileName ) ) )    // Already have it
+        && ( 0 == aFullFileName.Compare( iCurrentFileName ) ) )    // Already have it
         {
-        if (iDbState == ERecordRead)
+        if ( iDbState == ERecordRead )
             iRecordSet.GetL();
 
         PRINT1( _L( "MM MTP <> Cached recordset, filename is '%S'" ), &iCurrentFileName );
@@ -1332,20 +1310,20 @@
             PRINT( _L( "MM MTP <> SetRecordL ERecordWrite" ) );
             TRAPD( err, iRecordSet.PutL() );
 
-            if (KErrNone != err)
+            if ( KErrNone != err )
                 {
                 iRecordSet.Cancel();
                 User::Leave( err );
                 }
-        //lint -fallthrough
+            //lint -fallthrough
         case ENoRecord:                 // intentionally fallthrough
             // We need to just close the open record
             PRINT( _L( "MM MTP <> SetRecordL ENoRecord" ) );
-        //lint -fallthrough
+            //lint -fallthrough
         case ERecordRead:               // intentionally fallthrough
             // We need to open a row for reading
             PRINT( _L( "MM MTP <> SetRecordL ERecordRead" ) );
-        //lint -fallthrough
+            //lint -fallthrough
         default:                        // intentionally fallthrough
             PRINT( _L( "MM MTP <> SetRecordL Closing recordset" ) );
             delete iColSet;
@@ -1355,7 +1333,7 @@
             break;
         }
 
-    if ( aState == ENoRecord )    // We are closing the session if this is the case
+    if ( aState == ENoRecord ) // We are closing the session if this is the case
         {
         PRINT( _L( "MM MTP <> SetRecordL Record closed, no request to open" ) );
         return;
@@ -1365,7 +1343,6 @@
     TUint16 format = MmMtpDpUtility::FormatFromFilename( iCurrentFileName );
     PRINT1( _L( "MM MTP <> SetRecordL format = 0x%x" ), format );
 
-
     if ( MmMtpDpUtility::HasMetadata( format ) )
         {
         // Get the record
@@ -1409,7 +1386,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::SetImageObjPropL
+// CMmMtpDpMetadataVideoAccess::SetImageObjPropL
 // set image specific properties specific to videos
 // ---------------------------------------------------------------------------
 //
@@ -1430,24 +1407,24 @@
     TRAP( err, iRecordSet.SetColL( num, aWidth ) );
 
     if ( err != KErrNone )
-       {
-       SetRecordL( aFullFileName, EFailedWrite );
-       User::Leave( err );
-       }
+        {
+        SetRecordL( aFullFileName, EFailedWrite );
+        User::Leave( err );
+        }
 
     num = iColSet->ColNo( KMtpVideoHeight );
     TRAP( err, iRecordSet.SetColL( num, aHeight ) );
 
     if ( err != KErrNone )
-       {
-       SetRecordL( aFullFileName, EFailedWrite );
-       User::Leave( err );
-       }
+        {
+        SetRecordL( aFullFileName, EFailedWrite );
+        User::Leave( err );
+        }
     PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetImageObjPropL()" ) );
     }
 
 // ---------------------------------------------------------------------------
-// CMmMtpDpMetadataMpxAccess::GetImageObjPropL
+// CMmMtpDpMetadataVideoAccess::GetImageObjPropL
 // Get image specific properties specific to videos
 // ---------------------------------------------------------------------------
 //
@@ -1476,35 +1453,34 @@
 const TDesC& CMmMtpDpMetadataVideoAccess::ColumnNameFromPropCodeL( const TUint16 aPropCode )
     {
     const TColumnNameTable KColumnTable[] =
-    {
-        { EMTPObjectPropCodeName,                    KMtpVideoName },
-        { EMTPObjectPropCodeArtist,                  KMtpVideoArtist },
-        { EMTPObjectPropCodeTrack,                   KMtpVideoTrack },
-        { EMTPObjectPropCodeGenre,                   KMtpVideoGenre },
-        { EMTPObjectPropCodeAlbumName,               KMtpVideoAlbumName },
-        { EMTPObjectPropCodeComposer,                KMtpVideoComposer },
-        { EMTPObjectPropCodeOriginalReleaseDate,     KMtpVideoOrigReleaseDate },
-        { EMTPObjectPropCodeDescription,             KMtpVideoComment },
-        { EMTPObjectPropCodeWidth,                   KMtpVideoWidth },
-        { EMTPObjectPropCodeHeight,                  KMtpVideoHeight },
-        { EMTPObjectPropCodeDuration,                KMtpVideoDuration },
-        { EMTPObjectPropCodeSampleRate,              KMtpVideoSampleRate },
-        { EMTPObjectPropCodeNumberOfChannels,        KMtpVideoNumberOfChannels },
-        { EMTPObjectPropCodeAudioBitRate,            KMtpVideoAudioBitrate },
-        { EMTPObjectPropCodeVideoFourCCCodec,        KMtpVideoVideoCodec },
-        { EMTPObjectPropCodeVideoBitRate,            KMtpVideoVideoBitrate },
-        { EMTPObjectPropCodeFramesPerThousandSeconds,KMtpVideoFramesPer1000Sec },
-        { EMTPObjectPropCodeKeyFrameDistance,        KMtpVideoKeyFrameDistance },
-        { EMTPObjectPropCodeScanType,                KMtpVideoScanType },
-        { EMTPObjectPropCodeEncodingProfile,         KMtpVideoEncodingProfile },
-        { EMTPObjectPropCodeParentalRating,          KMtpVideoParentalRating },
-        { EMTPObjectPropCodeUseCount,                KMtpVideoUseCount },
-        { EMTPObjectPropCodeAudioWAVECodec,          KMtpVideoAudioCodec },
-        { EMTPObjectPropCodeDRMStatus,               KMtpVideoDRM },
-    };
+        {
+            { EMTPObjectPropCodeName,                    KMtpVideoName },
+            { EMTPObjectPropCodeArtist,                  KMtpVideoArtist },
+            { EMTPObjectPropCodeTrack,                   KMtpVideoTrack },
+            { EMTPObjectPropCodeGenre,                   KMtpVideoGenre },
+            { EMTPObjectPropCodeAlbumName,               KMtpVideoAlbumName },
+            { EMTPObjectPropCodeComposer,                KMtpVideoComposer },
+            { EMTPObjectPropCodeOriginalReleaseDate,     KMtpVideoOrigReleaseDate },
+            { EMTPObjectPropCodeDescription,             KMtpVideoComment },
+            { EMTPObjectPropCodeWidth,                   KMtpVideoWidth },
+            { EMTPObjectPropCodeHeight,                  KMtpVideoHeight },
+            { EMTPObjectPropCodeDuration,                KMtpVideoDuration },
+            { EMTPObjectPropCodeSampleRate,              KMtpVideoSampleRate },
+            { EMTPObjectPropCodeNumberOfChannels,        KMtpVideoNumberOfChannels },
+            { EMTPObjectPropCodeAudioBitRate,            KMtpVideoAudioBitrate },
+            { EMTPObjectPropCodeVideoFourCCCodec,        KMtpVideoVideoCodec },
+            { EMTPObjectPropCodeVideoBitRate,            KMtpVideoVideoBitrate },
+            { EMTPObjectPropCodeFramesPerThousandSeconds,KMtpVideoFramesPer1000Sec },
+            { EMTPObjectPropCodeKeyFrameDistance,        KMtpVideoKeyFrameDistance },
+            { EMTPObjectPropCodeScanType,                KMtpVideoScanType },
+            { EMTPObjectPropCodeEncodingProfile,         KMtpVideoEncodingProfile },
+            { EMTPObjectPropCodeParentalRating,          KMtpVideoParentalRating },
+            { EMTPObjectPropCodeAudioWAVECodec,          KMtpVideoAudioCodec },
+            { EMTPObjectPropCodeDRMStatus,               KMtpVideoDRM },
+        };
 
     TInt i = 0;
-    TInt count = sizeof ( KColumnTable ) / sizeof ( KColumnTable[0] );
+    TInt count = sizeof( KColumnTable ) / sizeof( KColumnTable[0] );
     while ( ( KColumnTable[i].iPropCode != aPropCode ) && ( i < count ) )
         {
         i++;
@@ -1513,7 +1489,7 @@
     if ( i == count )
         {
         // Not supported by MPX, shouldn't call this function
-        PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::MpxAttribFromPropL NOT SUPPORTED ATTRIBUTE" ) );
+        PRINT( _L( "MM MTP <> CMmMtpDpMetadataVideoAccess::ColumnNameFromPropCodeL NOT SUPPORTED ATTRIBUTE" ) );
         User::Leave( KErrNotSupported );
         }
     return KColumnTable[i].iDbColumnName;
@@ -1521,15 +1497,14 @@
 
 void CMmMtpDpMetadataVideoAccess::SetStorageRootL( const TDesC& aStorageRoot )
     {
-    PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetStorageRoot aStoreRoot = %S" ), &aStorageRoot );
+    PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetStorageRoot aStoreRoot = %S" ), &aStorageRoot );
 
     // get the drive number
-    TParse pathParser;
-    User::LeaveIfError( pathParser.Set( aStorageRoot, NULL, NULL ) );
+    TParsePtrC pathParser( aStorageRoot );
     TChar driveChar( pathParser.Drive()[0] );
 
     User::LeaveIfError( RFs::CharToDrive( driveChar, iStoreNum ) );
-    PRINT1( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetStorageRoot drive number = %d" ), iStoreNum );
+    PRINT1( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetStorageRoot drive number = %d" ), iStoreNum );
     }
 
 void CMmMtpDpMetadataVideoAccess::CleanupDatabaseL()