harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h
changeset 0 c53acadfccc6
child 8 6752808b2036
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2007-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 metadata for rtp video file
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_HARVESTERRTPPLUGIN_H
       
    19 #define C_HARVESTERRTPPLUGIN_H
       
    20 
       
    21 #include <harvesterplugin.h>
       
    22 #include <e32std.h>
       
    23 #include <apmstd.h>
       
    24 
       
    25 // FORWARD DECLARATION 
       
    26 class CHarvesterData;
       
    27 class CMdEObject;
       
    28 class CMdEObjectDef;
       
    29 
       
    30 const TInt KMaxMimeTypeLength( KMaxDataTypeLength );
       
    31 const TInt KMaxProgramTitle( 255 ); //to fit in db
       
    32 
       
    33 /**
       
    34  * Helper class to hold all property definitions 
       
    35  * (pointers are not owned) used in harvester OMA DRM plug-in.
       
    36  */
       
    37 class CHarvesterRtpPluginPropertyDefs : public CBase
       
    38 	{
       
    39 	public:
       
    40 		// Common property definitions
       
    41 		CMdEPropertyDef* iCreationDatePropertyDef;
       
    42 		CMdEPropertyDef* iLastModifiedDatePropertyDef;
       
    43 		CMdEPropertyDef* iSizePropertyDef;
       
    44 		CMdEPropertyDef* iItemTypePropertyDef;
       
    45 		CMdEPropertyDef* iTitlePropertyDef;
       
    46 	
       
    47 		// Media property definitions
       
    48 		CMdEPropertyDef* iCaptureDatePropertyDef;
       
    49 		CMdEPropertyDef* iDurationPropertyDef;
       
    50 
       
    51 		// Video property definitions
       
    52 		CMdEPropertyDef* iAgeProfilePropertyDef;
       
    53 		CMdEPropertyDef* iRecordingFlagsPropertyDef;
       
    54 		
       
    55 	private:
       
    56 		CHarvesterRtpPluginPropertyDefs();
       
    57 	
       
    58 		void ConstructL(CMdEObjectDef& aObjectDef);
       
    59 
       
    60 	public:	
       
    61 		static CHarvesterRtpPluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef);
       
    62 	};
       
    63 
       
    64 /**
       
    65  *  Data class for rtp harvester
       
    66  *
       
    67  *  Includes clip metadata from metaheader
       
    68  *
       
    69  */
       
    70 class CHarvesterRtpClipDetails : public CBase
       
    71     {
       
    72 public:
       
    73 	
       
    74 /** NewL */
       
    75 static CHarvesterRtpClipDetails* NewL()
       
    76     {
       
    77     CHarvesterRtpClipDetails* self = new (ELeave) CHarvesterRtpClipDetails;
       
    78     return self;
       
    79     }
       
    80 
       
    81 /** Destructor */
       
    82 virtual ~CHarvesterRtpClipDetails()
       
    83     {
       
    84     }
       
    85 
       
    86 public:
       
    87 
       
    88     /**
       
    89      * Mime type
       
    90      */
       
    91      TBuf<KMaxMimeTypeLength> iMimeType;
       
    92 
       
    93      /**
       
    94      * Modification date
       
    95      */
       
    96      TTime iModifiedDate;
       
    97 
       
    98      /**
       
    99       * File size
       
   100       */
       
   101      TUint32 iFileSize;
       
   102      
       
   103     /**
       
   104     * Program title including service name and program name
       
   105     */
       
   106     TBuf<KMaxProgramTitle> iTitle;       
       
   107     
       
   108     /**
       
   109     * Recording duration.
       
   110     */
       
   111     TReal32 iDuration;
       
   112 
       
   113     /**
       
   114     * Clip's quality. 
       
   115     */
       
   116     TUint8 iQuality; 
       
   117 
       
   118     /**
       
   119     * Recording currently ongoing state.
       
   120     */
       
   121     TBool iRecOngoing;
       
   122 
       
   123     /**
       
   124     * Recording completed status.
       
   125     */
       
   126     TBool iRecCompleted;
       
   127 
       
   128     /**
       
   129     * Recording failed status.
       
   130     */
       
   131     TBool iRecFailed;
       
   132     
       
   133     /**
       
   134     * Parental rate
       
   135     */
       
   136     TInt iParental;
       
   137     
       
   138     /**
       
   139     * Post acquisition rule
       
   140     */
       
   141     TBool iPostRule;        
       
   142     
       
   143 private:
       
   144 
       
   145     /**
       
   146      * Default constructor
       
   147      */
       
   148     CHarvesterRtpClipDetails()
       
   149     {
       
   150     }
       
   151 };
       
   152 
       
   153 /**
       
   154  *  This class implements RTP harvester plugin.
       
   155  *
       
   156  *  @lib harvesterrtpplugin.dll
       
   157  *  @since S60 S60 v3.x
       
   158  */
       
   159 class CHarvesterRtpPlugin : public CHarvesterPlugin
       
   160     {
       
   161 public:
       
   162 
       
   163     /**
       
   164      * Constructs a new CHarvesterRtpPlugin implementation.
       
   165      * 
       
   166      * @return A pointer to the new CHarvesterRtpPlugin implementation
       
   167      */
       
   168     static CHarvesterRtpPlugin* NewL();
       
   169 
       
   170     /**
       
   171     * Destructor.
       
   172     */
       
   173     virtual ~CHarvesterRtpPlugin();
       
   174 
       
   175     // from base class CHarvesterPlugin
       
   176     
       
   177     /**
       
   178     * Harvest file. 
       
   179     * 
       
   180     * @param aHarvesterData  
       
   181     */
       
   182     void HarvestL( CHarvesterData* aHarvesterData );
       
   183 
       
   184 private:
       
   185 
       
   186     /**
       
   187     * C++ constructor
       
   188     */
       
   189     CHarvesterRtpPlugin();
       
   190 
       
   191     /**
       
   192     * 2nd phase constructor
       
   193     */
       
   194     void ConstructL();
       
   195     
       
   196     /**
       
   197      * Gathers data from file to meta data object. 
       
   198      * Leaves if mime type is not supported.
       
   199      *
       
   200      * @param aMetadataObject  A reference to meta data object to gather the data. 
       
   201      */
       
   202      void GatherDataL( CMdEObject& aMetadataObject, CHarvesterRtpClipDetails& aClipDetails );
       
   203      
       
   204      /**
       
   205       * Recognize file mime type
       
   206       *
       
   207       * @param aFilePath File path for recognizer
       
   208       * @param aFileBuffer Data buffer for file recognition
       
   209       * @return KErrNone if file is recognized, otherwise symbian error code.
       
   210       */
       
   211      TInt RecognizeFile( const TDesC& aFilePath, const TDesC8& aFileBuffer, CHarvesterRtpClipDetails& aClipDetails );
       
   212       
       
   213       /**
       
   214        * Check if mime type is supported
       
   215        * @param aMimeBuf Mime type 
       
   216        * @return KErrNone if mime type is supported
       
   217        * @return KErrNotSupported if mime type is not supported
       
   218        */
       
   219      TInt CheckIfMimeSupported( const TDesC& aMimeBuf );
       
   220      
       
   221      /** */
       
   222      void HandleObjectPropertiesL( CHarvesterData& aHD, CHarvesterRtpClipDetails& aClipDetails, TBool aIsAdd);
       
   223 
       
   224 private: // data
       
   225 	CHarvesterRtpPluginPropertyDefs* iPropDefs;
       
   226     };
       
   227 
       
   228 #endif // C_HARVESTERWMVPLUGIN_H