harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
branchRCL_3
changeset 19 82c0024438c8
parent 17 50de4d668bb6
child 22 ab88d4a85041
equal deleted inserted replaced
17:50de4d668bb6 19:82c0024438c8
   159 */
   159 */
   160 CHarvesterVideoPlugin::~CHarvesterVideoPlugin()
   160 CHarvesterVideoPlugin::~CHarvesterVideoPlugin()
   161 	{
   161 	{
   162 	delete iPropDefs;
   162 	delete iPropDefs;
   163 	iMimeTypeMappings.Close();
   163 	iMimeTypeMappings.Close();
       
   164     RMediaIdUtil::ReleaseInstance();
   164 
   165 
   165 	WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()");
   166 	WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()");
   166 	}
   167 	}
   167 
   168 
   168 /**
   169 /**
   266             KExtensionWmv(), KMimeTypeWmv(), 
   267             KExtensionWmv(), KMimeTypeWmv(), 
   267             TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
   268             TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
   268                     KMimeTypeWmv(), KMimeTypeWmv() ) ), 
   269                     KMimeTypeWmv(), KMimeTypeWmv() ) ), 
   269             cmp ) );
   270             cmp ) );
   270     
   271     
       
   272     iMediaIdUtil = &RMediaIdUtil::GetInstanceL();
   271     }
   273     }
   272 
   274 
   273 
   275 
   274 // ---------------------------------------------------------------------------
   276 // ---------------------------------------------------------------------------
   275 // GetObjectType
   277 // GetObjectType
   946 
   948 
   947     if( !iPropDefs )
   949     if( !iPropDefs )
   948     	{
   950     	{
   949     	CMdEObjectDef& objectDef = mdeObject.Def();
   951     	CMdEObjectDef& objectDef = mdeObject.Def();
   950     	iPropDefs = CHarvesterVideoPluginPropertyDefs::NewL( objectDef );
   952     	iPropDefs = CHarvesterVideoPluginPropertyDefs::NewL( objectDef );
       
   953     	// Prefetch max text lengt for validity checking
       
   954     	iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
   951     	}
   955     	}
   952 
   956 
   953     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   957     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   954     TTime localModifiedDate = aVHD.iModified + timeOffsetSeconds;
   958     TTime localModifiedDate = aVHD.iModified + timeOffsetSeconds;
   955 
   959 
  1043     	        {
  1047     	        {
  1044     		    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iAudioBitrate, aIsAdd );
  1048     		    CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iAudioBitrate, aIsAdd );
  1045     	        }
  1049     	        }
  1046     		}
  1050     		}
  1047     	}
  1051     	}
  1048 
  1052     
  1049     // Copyright
  1053     // Copyright
  1050     if( aVHD.iCopyright )
  1054     if( aVHD.iCopyright && aVHD.iCopyright->Length() < iMaxTextLength )
  1051     	{
  1055     	{
  1052     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aVHD.iCopyright, aIsAdd );
  1056     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aVHD.iCopyright, aIsAdd );
  1053     	}
  1057     	}
  1054 
  1058 
  1055     // Author
  1059     // Author
  1056     if( aVHD.iAuthor )
  1060     if( aVHD.iAuthor && aVHD.iAuthor->Length() < iMaxTextLength )
  1057     	{
  1061     	{
  1058     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iAuthorPropertyDef, aVHD.iAuthor, aIsAdd );
  1062     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iAuthorPropertyDef, aVHD.iAuthor, aIsAdd );
  1059     	}
  1063     	}
  1060 
  1064 
  1061     // Genre
  1065     // Genre
  1062     if( aVHD.iGenre )
  1066     if( aVHD.iGenre && aVHD.iGenre->Length() < iMaxTextLength )
  1063     	{
  1067     	{
  1064     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iGenrePropertyDef, aVHD.iGenre, aIsAdd );
  1068     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iGenrePropertyDef, aVHD.iGenre, aIsAdd );
  1065     	}
  1069     	}
  1066 
  1070 
  1067     // Artist
  1071     // Artist
  1068     if( aVHD.iPerformer )
  1072     if( aVHD.iPerformer && aVHD.iPerformer->Length() < iMaxTextLength )
  1069     	{
  1073     	{
  1070     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iArtistPropertyDef, aVHD.iPerformer, aIsAdd );
  1074     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iArtistPropertyDef, aVHD.iPerformer, aIsAdd );
  1071     	}
  1075     	}
  1072 
  1076 
  1073     // Description
  1077     // Description
  1074     if( aVHD.iDescription )
  1078     if( aVHD.iDescription && aVHD.iDescription->Length() < iMaxTextLength )
  1075     	{
  1079     	{
  1076     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, aVHD.iDescription, aIsAdd );
  1080     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, aVHD.iDescription, aIsAdd );
  1077     	}
  1081     	}
  1078     
  1082     
  1079     // Codec
  1083     // Codec
  1081         {
  1085         {
  1082         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iAudioFourCCDef, &aVHD.iCodec, aIsAdd );
  1086         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iAudioFourCCDef, &aVHD.iCodec, aIsAdd );
  1083         }
  1087         }
  1084     
  1088     
  1085     // Title
  1089     // Title
  1086     if( aVHD.iTitle )
  1090     if( aVHD.iTitle && aVHD.iTitle->Length() < iMaxTextLength )
  1087         {
  1091         {
  1088         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTitlePropertyDef, aVHD.iTitle, EFalse );
  1092         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTitlePropertyDef, aVHD.iTitle, EFalse );
  1089         }
  1093         }
  1090     
  1094     
  1091     // DRM protection
  1095     // DRM protection
  1141 	TBool possibleVideo = EFalse;
  1145 	TBool possibleVideo = EFalse;
  1142 
  1146 
  1143 	CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
  1147 	CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
  1144 	CleanupStack::PushL( helixMetadata );
  1148 	CleanupStack::PushL( helixMetadata );
  1145 
  1149 
       
  1150 	TFileName tempName;
       
  1151 	TUint32 mediaId( 0 );
       
  1152 	TInt blackListError( KErrNone );
       
  1153 	
       
  1154     if( iBlacklist )
       
  1155         {
       
  1156         WRITELOG( "CHarvesterVideoPlugin::GetRmTypeL - Adding URI to blacklist" );
       
  1157         blackListError = aFile.FullName( tempName );
       
  1158         if( blackListError == KErrNone )
       
  1159             {
       
  1160             blackListError = iMediaIdUtil->GetMediaId( tempName, mediaId );
       
  1161             if( blackListError == KErrNone )
       
  1162                 {
       
  1163                 TTime modified ( 0 );
       
  1164                 blackListError = iFs.Modified( tempName, modified );
       
  1165                 if( blackListError == KErrNone )
       
  1166                     {
       
  1167                     iBlacklist->AddFile( tempName, mediaId, modified );
       
  1168                     }
       
  1169                 }
       
  1170             }
       
  1171         }
       
  1172 	
  1146 	TRAPD( err, helixMetadata->OpenFileL( aFile ) );
  1173 	TRAPD( err, helixMetadata->OpenFileL( aFile ) );
  1147 
  1174 
  1148 	if( err == KErrNone )
  1175 	if( err == KErrNone )
  1149 		{
  1176 		{
  1150 		// doesn't own pointers to MIME types
  1177 		// doesn't own pointers to MIME types
  1224 	// Set to Video, regardless how badly file is corrupted
  1251 	// Set to Video, regardless how badly file is corrupted
  1225 	else
  1252 	else
  1226 		{
  1253 		{
  1227 		aType.Copy( KVideo );
  1254 		aType.Copy( KVideo );
  1228 		}
  1255 		}
       
  1256 	
       
  1257     if ( iBlacklist && blackListError == KErrNone )
       
  1258         {
       
  1259         WRITELOG( "CHarvesterVideoPlugin::GetRmTypeL - Removing URI from blacklist" );
       
  1260         iBlacklist->RemoveFile( tempName, mediaId );
       
  1261         }
  1229     
  1262     
  1230 	helixMetadata->ResetL();
  1263 	helixMetadata->ResetL();
  1231     CleanupStack::PopAndDestroy( helixMetadata );
  1264     CleanupStack::PopAndDestroy( helixMetadata );
  1232 	}
  1265 	}
  1233 
  1266