--- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp Wed Sep 15 12:40:59 2010 +0300
+++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp Wed Oct 13 15:02:02 2010 +0300
@@ -48,24 +48,11 @@
_LIT(KInUse, "InUse");
-CHarvesterOmaDrmPluginPropertyDefs::CHarvesterOmaDrmPluginPropertyDefs() : CBase(),
- iCreationDatePropertyDef( NULL )
+CHarvesterOmaDrmPluginPropertyDefs::CHarvesterOmaDrmPluginPropertyDefs() : CBase()
{
}
-void CHarvesterOmaDrmPluginPropertyDefs::ConstructL( CMdEObjectDef& aObjectDef )
- {
- SetByObjectDefL( aObjectDef );
- }
-
-CHarvesterOmaDrmPluginPropertyDefs* CHarvesterOmaDrmPluginPropertyDefs::NewL()
- {
- CHarvesterOmaDrmPluginPropertyDefs* self =
- new (ELeave) CHarvesterOmaDrmPluginPropertyDefs();
- return self;
- }
-
-void CHarvesterOmaDrmPluginPropertyDefs::SetByObjectDefL( CMdEObjectDef& aObjectDef )
+void CHarvesterOmaDrmPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
{
CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
@@ -94,6 +81,16 @@
iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
}
+CHarvesterOmaDrmPluginPropertyDefs* CHarvesterOmaDrmPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
+ {
+ CHarvesterOmaDrmPluginPropertyDefs* self =
+ new (ELeave) CHarvesterOmaDrmPluginPropertyDefs();
+ CleanupStack::PushL( self );
+ self->ConstructL( aObjectDef );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
/**
* Default constructor
*/
@@ -143,6 +140,9 @@
iPhoneSoundsPath = NULL;
delete iMmcSoundsPath;
iMmcSoundsPath = NULL;
+
+ delete iPropDefs;
+ iPropDefs = NULL;
}
/**
@@ -155,8 +155,6 @@
User::LeaveIfError( iFs.Connect() );
- iPropDefs = CHarvesterOmaDrmPluginPropertyDefs::NewL();
-
TFileName phoneRoot = PathInfo::PhoneMemoryRootPath();
TFileName mmcRoot = PathInfo::MemoryCardRootPath();
@@ -193,7 +191,7 @@
void CHarvesterOMADRMPlugin::HarvestL( CHarvesterData* aHarvesterData )
{
- WRITELOG( "CHarvesterOMADRMPlugin::HarvestL()" );
+ WRITELOG( "CHarvesterImagePlugin::HarvestL()" );
CMdEObject& mdeObject = aHarvesterData->MdeObject();
CDRMHarvestData* drmHarvestData = CDRMHarvestData::NewL();
CleanupStack::PushL( drmHarvestData );
@@ -241,7 +239,7 @@
// ---------------------------------------------------------------------------
//
TInt CHarvesterOMADRMPlugin::GatherDataL( CMdEObject& aMetadataObject, CDRMHarvestData& aDRMharvestData,
- CFileData& aFileData, CHarvestData& /*aHarvestData*/ )
+ CFileData& aFileData, CHarvestData& aHarvestData )
{
WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL" );
@@ -330,36 +328,31 @@
WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting protection info failed %d", err );
}
- if( aMetadataObject.Def().Name() == MdeConstants::Image::KImageObject )
- {
- CImageDecoder* decoder = NULL;
+ CImageDecoder* decoder = NULL;
- TRAP( err, decoder = CImageDecoder::FileNewL( iFs, uri, ContentAccess::EPeek,
- ( CImageDecoder::TOptions )( CImageDecoder::EPreferFastDecode )));
+ TRAP( err, decoder = CImageDecoder::FileNewL( iFs, uri, ContentAccess::EPeek,
+ ( CImageDecoder::TOptions )( CImageDecoder::EPreferFastDecode )));
- CleanupStack::PushL( decoder );
+ CleanupStack::PushL( decoder );
- if(decoder && !err)
- {
- WRITELOG( "CHarvesterImagePlugin::GatherData() - Image decoder has opened the file." );
- // Get image width, frame count, height and bits per pixel from image decoder.
- const TFrameInfo info = decoder->FrameInfo( 0 );
- const TSize imageSize = info.iOverallSizeInPixels;
- const TInt framecount = decoder->FrameCount();
- aFileData.iFrameCount = framecount;
- aFileData.iImageWidth = imageSize.iWidth;
- aFileData.iImageHeight = imageSize.iHeight;
- aFileData.iBitsPerPixel = info.iBitsPerPixel;
- }
- else
- {
- WRITELOG1( "CHarvesterImagePlugin::GatherData() - ERROR: decoder %d", err );
- }
- CleanupStack::PopAndDestroy( decoder );
+ if(decoder && !err)
+ {
+ WRITELOG( "CHarvesterImagePlugin::GatherData() - Image decoder has opened the file." );
+ // Get image width, frame count, height and bits per pixel from image decoder.
+ const TFrameInfo info = decoder->FrameInfo( 0 );
+ const TSize imageSize = info.iOverallSizeInPixels;
+ const TInt framecount = decoder->FrameCount();
+ aFileData.iFrameCount = framecount;
+ aFileData.iImageWidth = imageSize.iWidth;
+ aFileData.iImageHeight = imageSize.iHeight;
+ aFileData.iBitsPerPixel = info.iBitsPerPixel;
+ }
+ else
+ {
+ WRITELOG1( "CHarvesterImagePlugin::GatherData() - ERROR: decoder %d", err );
}
-
- CleanupStack::PopAndDestroy( 3 ); // content, data, attrSet
+ CleanupStack::PopAndDestroy( 4 ); // content, data, attrSet, imagedecoder
return KErrNone;
}
@@ -367,13 +360,19 @@
// HandleObjectPropertiesL
// ---------------------------------------------------------------------------
//
-void CHarvesterOMADRMPlugin::HandleObjectPropertiesL( CHarvestData& /*aHarvestData*/, CDRMHarvestData& aDRMharvestData, CFileData& aFileData,
+void CHarvesterOMADRMPlugin::HandleObjectPropertiesL( CHarvestData& aHarvestData, CDRMHarvestData& aDRMharvestData, CFileData& aFileData,
CHarvesterData& aHarvesterData, TBool aIsAdd )
{
WRITELOG("CHarvesterOMADRMPlugin - HandleNewObject ");
CMdEObject& mdeObject = aHarvesterData.MdeObject();
- InitPropDefsL( mdeObject.Def() );
+ if( !iPropDefs )
+ {
+ CMdEObjectDef& objectDef = mdeObject.Def();
+ iPropDefs = CHarvesterOmaDrmPluginPropertyDefs::NewL( objectDef );
+ // Prefetch max text lengt for validity checking
+ iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL();
+ }
TTimeIntervalSeconds timeOffset = User::UTCOffset();
@@ -649,13 +648,3 @@
}
}
-void CHarvesterOMADRMPlugin::InitPropDefsL( CMdEObjectDef& aObjectDef )
- {
- if( !iPropDefs->iCreationDatePropertyDef )
- {
- iPropDefs->SetByObjectDefL( aObjectDef );
- // Prefetch max text lengt for validity checking
- iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL();
- }
- }
-