harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h
changeset 0 c53acadfccc6
child 8 6752808b2036
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Harvests meta data from oma drm file.*
       
    15 */
       
    16 
       
    17 
       
    18 #ifndef __CHARVESTEROMADRMPLUGIN_H__
       
    19 #define __CHARVESTEROMADRMPLUGIN_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <apmstd.h>
       
    23 #include "harvesterplugin.h"
       
    24 
       
    25 // FORWARD DECLARATION
       
    26 class CMdEObjectDef;
       
    27 class CMdEObject;
       
    28 
       
    29 /**
       
    30 * A data transfer class for harvested drm metadata.
       
    31 */
       
    32 class CDRMHarvestData : public CBase
       
    33     {
       
    34     public:
       
    35 
       
    36         /** NewL */
       
    37         static CDRMHarvestData* NewL()
       
    38             {
       
    39             CDRMHarvestData* self = new (ELeave) CDRMHarvestData;
       
    40             return self;
       
    41             }
       
    42         
       
    43         /** Destructor */
       
    44         virtual ~CDRMHarvestData()
       
    45             {
       
    46             }
       
    47 
       
    48     private:
       
    49         /** Constructor */
       
    50     		CDRMHarvestData() :  iFileSize( 0 ), iDrmProtected( EFalse )
       
    51             {
       
    52             // no implementation required
       
    53             }
       
    54 
       
    55     public:
       
    56 
       
    57     	TBuf<KMaxDataTypeLength> iMimetype;
       
    58         TBuf<KMaxDataTypeLength> iDescription;
       
    59         TBuf<KMaxDataTypeLength> iTitle;
       
    60         TBuf<KMaxDataTypeLength> iAuthor;
       
    61         TInt64 iFileSize;
       
    62         TTime iModified;
       
    63         TBool iDrmProtected;
       
    64     };
       
    65 
       
    66 /**
       
    67  * Helper class to hold all property definitions 
       
    68  * (pointers are not owned) used in harvester OMA DRM plug-in.
       
    69  */
       
    70 class CHarvesterOmaDrmPluginPropertyDefs : public CBase
       
    71 	{
       
    72 	public:
       
    73 		// Common property definitions
       
    74 		CMdEPropertyDef* iCreationDatePropertyDef;
       
    75 		CMdEPropertyDef* iLastModifiedDatePropertyDef;
       
    76 		CMdEPropertyDef* iSizePropertyDef;
       
    77 		CMdEPropertyDef* iItemTypePropertyDef;
       
    78 		CMdEPropertyDef* iTitlePropertyDef;
       
    79 	
       
    80 		// Media property definitions
       
    81 		CMdEPropertyDef* iDrmPropertyDef;
       
    82 		CMdEPropertyDef* iDescriptionPropertyDef;
       
    83 		CMdEPropertyDef* iAuthorPropertyDef;
       
    84 	
       
    85 	private:
       
    86 		CHarvesterOmaDrmPluginPropertyDefs();
       
    87 	
       
    88 		void ConstructL(CMdEObjectDef& aObjectDef);
       
    89 
       
    90 	public:	
       
    91 		static CHarvesterOmaDrmPluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef);
       
    92 	};
       
    93 
       
    94 class CHarvesterOMADRMPlugin : public CHarvesterPlugin
       
    95   	{
       
    96 	public:
       
    97 		/**
       
    98 		* Constructs a new CHarvesterOMADRMPlugin implementation.
       
    99 		*
       
   100 		* @return A pointer to the new CHarvesterOMADRMPlugin implementation
       
   101 		*/
       
   102 		static CHarvesterOMADRMPlugin* NewL();
       
   103 		
       
   104 		/**
       
   105 		* Destructor
       
   106 		*/
       
   107 		virtual ~CHarvesterOMADRMPlugin();
       
   108 		
       
   109 		/**
       
   110 		* Harvests several files. Inherited from CHarvestPlugin.
       
   111 		*
       
   112 		* @param aHarvesterData  CHarvesterData datatype containing needed harvest data
       
   113  		* @param aClientData  TAny* to client specific data
       
   114 		*/
       
   115 		void HarvestL( CHarvesterData* aHD );
       
   116 		
       
   117 		/** */
       
   118 		void GetObjectType( const TDesC& aUri, TDes& aObjectType );
       
   119 		
       
   120 	private:
       
   121 		/**
       
   122 		* C++ constructor - not exported;
       
   123 		* implicitly called from NewL()
       
   124 		*
       
   125 		* @return an instance of CHarvesterOMADRMPlugin.
       
   126 		*/
       
   127 		CHarvesterOMADRMPlugin();
       
   128 		
       
   129 		/**
       
   130 		* 2nd phase construction, called by NewLC()
       
   131 		*/
       
   132 		void ConstructL();
       
   133 		
       
   134 		/**
       
   135         * Gathers data from file to meta data object.
       
   136         *
       
   137         * @param aMetadataObject  A reference to meta data object to gather the data.
       
   138         * @param aHarvestData  An object to store harvested video file data.
       
   139         */
       
   140         void GatherDataL( CMdEObject& aMetadataObject, CDRMHarvestData& aHarvestData );
       
   141 		
       
   142         /**
       
   143          * Handle addition of new mde video objects.
       
   144          *
       
   145          * @param aMetadataObject  A reference to meta data object to gather the data.
       
   146          * @param aHarvestData  An object containing harvested video file data.
       
   147          */
       
   148         void HandleObjectPropertiesL( CHarvesterData& aHD, CDRMHarvestData& aVHD, TBool aIsAdd );
       
   149 
       
   150 	private:
       
   151 		CHarvesterOmaDrmPluginPropertyDefs* iPropDefs;
       
   152 	};
       
   153 
       
   154 #endif // __CHarvesterOMADRMPlugin_H__