harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
branchRCL_3
changeset 10 ab88d4a85041
parent 9 82c0024438c8
child 12 9f21bab39f42
equal deleted inserted replaced
9:82c0024438c8 10:ab88d4a85041
   176 	TLinearOrder< THarvestingHandling > cmp( THarvestingHandling::CompareFunction );
   176 	TLinearOrder< THarvestingHandling > cmp( THarvestingHandling::CompareFunction );
   177 
   177 
   178 	// MPEG4
   178 	// MPEG4
   179 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   179 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   180     		KExtensionMp4(), KNullDesC(), 
   180     		KExtensionMp4(), KNullDesC(), 
   181     		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
   181     		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
   182     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   182     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   183     		cmp ) );
   183     		cmp ) );
   184 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   184 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   185     		KExtensionMpg4(), KNullDesC(), 
   185     		KExtensionMpg4(), KNullDesC(), 
   186     		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
   186     		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
   187     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   187     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   188     		cmp ) );
   188     		cmp ) );
   189 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   189 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   190     		KExtensionMpeg4(), KNullDesC(), 
   190     		KExtensionMpeg4(), KNullDesC(), 
   191     		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
   191     		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
   192     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   192     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   193     		cmp ) );
   193     		cmp ) );
   194 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   194 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   195     		KExtensionM4v(), KMimeTypeVideoMp4(), 
   195     		KExtensionM4v(), KMimeTypeVideoMp4(), 
   196     		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KVideo(),
   196     		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
   197     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   197     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   198     		cmp ) );
   198     		cmp ) );
   199 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   199 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   200     		KExtensionM4a(), KMimeTypeAudioMp4(), 
   200     		KExtensionM4a(), KMimeTypeAudioMp4(), 
   201     		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KAudio(),
   201     		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KAudio(),
   202     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   202     				KMimeTypeVideoMp4(), KMimeTypeAudioMp4() ) ), 
   203     		cmp ) );
   203     		cmp ) );
   204 
   204 
   205 	// 3GP
   205 	// 3GP
   206 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   206 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   207     		KExtension3gp(), KNullDesC(), 
   207     		KExtension3gp(), KNullDesC(), 
   208     		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
   208     		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
   209     				KMimeTypeVideo3gpp(), KMimeTypeAudio3gpp() ) ), 
   209     				KMimeTypeVideo3gpp(), KMimeTypeAudio3gpp() ) ), 
   210     		cmp ) );
   210     		cmp ) );
   211 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   211 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   212     		KExtension3gpp(), KNullDesC(), 
   212     		KExtension3gpp(), KNullDesC(), 
   213     		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
   213     		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
   214     				KMimeTypeVideo3gpp(), KMimeTypeAudio3gpp() ) ), 
   214     				KMimeTypeVideo3gpp(), KMimeTypeAudio3gpp() ) ), 
   215     		cmp ) );
   215     		cmp ) );
   216 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   216 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   217     		KExtension3g2(), KNullDesC(), 
   217     		KExtension3g2(), KNullDesC(), 
   218     		TVideoMetadataHandling( TVideoMetadataHandling::EMp4LibHandling, KNullDesC(),
   218     		TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KNullDesC(),
   219     				KMimeTypeVideo3gpp(), KMimeTypeAudio3gpp() ) ), 
   219     				KMimeTypeVideo3gpp(), KMimeTypeAudio3gpp() ) ), 
   220     		cmp ) );
   220     		cmp ) );
   221 
   221 
   222 	// RealMedia
   222 	// RealMedia
   223 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   223 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   835             CleanupStack::PopAndDestroy( 2 ); // content, data
   835             CleanupStack::PopAndDestroy( 2 ); // content, data
   836             }
   836             }
   837         }
   837         }
   838     else if( mapping->iHandler.iLibrary == TVideoMetadataHandling::EMp4LibHandling )
   838     else if( mapping->iHandler.iLibrary == TVideoMetadataHandling::EMp4LibHandling )
   839         {
   839         {
       
   840 #ifdef MDS_MP4LIB_USAGE
   840         MP4Handle handle( 0 );
   841         MP4Handle handle( 0 );
   841         MP4Err mp4err = MP4_OK;
   842         MP4Err mp4err = MP4_OK;
   842         
   843         
   843         WRITELOG( "CHarvesterVideoPlugin - Before open file handle to parse" );
   844         WRITELOG( "CHarvesterVideoPlugin - Before open file handle to parse" );
   844         
   845         
   924         WRITELOG( "CHarvesterVideoPlugin - GatherDataL - MP4ParseClose - ready" );            
   925         WRITELOG( "CHarvesterVideoPlugin - GatherDataL - MP4ParseClose - ready" );            
   925         if ( mp4err != MP4_OK )
   926         if ( mp4err != MP4_OK )
   926             {
   927             {
   927             WRITELOG( "CHarvesterVideoPlugin - Error closing file handle" );
   928             WRITELOG( "CHarvesterVideoPlugin - Error closing file handle" );
   928             }
   929             }
       
   930 #endif
   929         }
   931         }
   930     WRITELOG( "CHarvesterVideoPlugin - Closing file" );        
   932     WRITELOG( "CHarvesterVideoPlugin - Closing file" );        
   931     CleanupStack::PopAndDestroy( &file );        
   933     CleanupStack::PopAndDestroy( &file );        
   932 
   934 
   933     WRITELOG( "CHarvesterVideoPlugin - Start adding data to object" );
   935     WRITELOG( "CHarvesterVideoPlugin - Start adding data to object" );
  1047     	        {
  1049     	        {
  1048     		    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iAudioBitrate, aIsAdd );
  1050     		    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iAudioBitrate, aIsAdd );
  1049     	        }
  1051     	        }
  1050     		}
  1052     		}
  1051     	}
  1053     	}
  1052     
  1054 
  1053     // Copyright
  1055     // Copyright
  1054     if( aVHD.iCopyright && aVHD.iCopyright->Length() < iMaxTextLength )
  1056     if( aVHD.iCopyright && aVHD.iCopyright->Length() < iMaxTextLength )
  1055     	{
  1057     	{
  1056     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aVHD.iCopyright, aIsAdd );
  1058     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aVHD.iCopyright, aIsAdd );
  1057     	}
  1059     	}
  1097         {
  1099         {
  1098         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDrmPropertyDef, &aVHD.iDrmProtected, aIsAdd );
  1100         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDrmPropertyDef, &aVHD.iDrmProtected, aIsAdd );
  1099         }
  1101         }
  1100     }
  1102     }
  1101 
  1103 
       
  1104 #ifdef MDS_MP4LIB_USAGE 
  1102 void CHarvesterVideoPlugin::GetMp4Type( RFile64& aFile, TDes& aType )
  1105 void CHarvesterVideoPlugin::GetMp4Type( RFile64& aFile, TDes& aType )
  1103 	{
  1106     {
  1104     WRITELOG( "CHarvesterVideoPlugin::GetMp4Mime - MP4ParseOpenFileHandle - start" );
  1107     WRITELOG( "CHarvesterVideoPlugin::GetMp4Mime - MP4ParseOpenFileHandle - start" );
  1105     MP4Handle handle;
  1108     MP4Handle handle;
  1106 
  1109 
  1107     MP4Err mp4err = MP4ParseOpenFileHandle64( &handle, &aFile );
  1110     MP4Err mp4err = MP4ParseOpenFileHandle64( &handle, &aFile );
  1108     
  1111     
  1137     	aType.Copy( KVideo() );
  1140     	aType.Copy( KVideo() );
  1138     	}
  1141     	}
  1139 
  1142 
  1140     MP4ParseClose( handle );
  1143     MP4ParseClose( handle );
  1141 	}
  1144 	}
       
  1145 #else
       
  1146 void CHarvesterVideoPlugin::GetMp4Type( RFile64& /*aFile*/, TDes& /*aType*/ )
       
  1147     {
       
  1148     }
       
  1149 #endif
  1142 
  1150 
  1143 void CHarvesterVideoPlugin::GetRmTypeL( RFile64& aFile, TDes& aType )
  1151 void CHarvesterVideoPlugin::GetRmTypeL( RFile64& aFile, TDes& aType )
  1144 	{
  1152 	{
  1145 	TBool possibleVideo = EFalse;
  1153 	TBool possibleVideo = EFalse;
  1146 
  1154