harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpmetadatareader.h
changeset 0 c53acadfccc6
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:  Reads metadata from rtp file meta header
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_HARVESTERRTPMETADATAREADER_H
       
    19 #define C_HARVESTERRTPMETADATAREADER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <f32file.h>
       
    23 #include <etelmm.h>
       
    24 
       
    25 // CONSTANTS
       
    26 const TInt KIntegerBytes ( 4 );
       
    27 const TInt KStringLengthBytes( 1 );
       
    28 const TInt KMaxMetaHeaderLength( 2048 );
       
    29 const TInt KMetaLengthPoint( 0 );
       
    30 const TInt KAttributesPoint( KMetaLengthPoint + KIntegerBytes ); //4
       
    31 const TInt KPlayCountPoint( KAttributesPoint + KIntegerBytes );  // 8
       
    32 const TInt KPlaySpotPoint( KPlayCountPoint + KIntegerBytes );    // 12
       
    33 const TInt KReservedPoint1( KPlaySpotPoint + KIntegerBytes );    // 16
       
    34 const TInt KReservedPoint2( KReservedPoint1 + KIntegerBytes );   // 20
       
    35 const TInt KReservedPoint3( KReservedPoint2 + KIntegerBytes );   // 24
       
    36 const TInt KReservedPoint4( KReservedPoint3 + KIntegerBytes );   // 28
       
    37 const TInt KStartTimePoint( KReservedPoint4 + KIntegerBytes );   // 32
       
    38 const TInt KEndTimePoint( KStartTimePoint + 2 * KIntegerBytes ); // 40
       
    39 const TInt KDurationPoint( KEndTimePoint + 2 * KIntegerBytes );  // 48
       
    40 const TInt KSeekArrayPoint( KDurationPoint + KIntegerBytes );    // 52
       
    41 const TInt KUserIdPoint( KSeekArrayPoint + KIntegerBytes );      // 56
       
    42 const TInt KDeviceInfoPoint( KUserIdPoint + KStringLengthBytes +
       
    43                              RMobilePhone::KIMSISize );          // 72
       
    44 
       
    45 const TInt KSpaceLength( 1 );
       
    46 
       
    47 const TInt KContentRightsLockToDevice( 2 );
       
    48 const TInt KPartiallyFailedLimit ( 60 );
       
    49 
       
    50 // Metaheader attributes
       
    51 const TInt KOngoingFlagShift( 0 );
       
    52 const TInt KCompletedFlagShift( 1 );
       
    53 const TInt KProtectedFlagShift( 2 );
       
    54 const TInt KFailedFlagShift( 3 );
       
    55 const TInt KVersionFieldShift( 4 );
       
    56 const TInt KQualityFieldShift( 8 );
       
    57 const TInt KPostRuleFieldShift( 16 );
       
    58 const TInt KParentalFieldShift( 24 );
       
    59 
       
    60 //DATA TYPES
       
    61 typedef enum // Video flags
       
    62     {
       
    63     //Duplicates in CIptvMyVideosVideoBriefDetails.h:
       
    64     //DO NOT CHANGE
       
    65     EIptvMyVideosVideoTypeRecording      = 0x00000400, // Video type is recording. 
       
    66     EIptvMyVideosVideoIsRecording        = 0x00000800, // Video is being recorded. 
       
    67     EIptvMyVideosVideoRecPartiallyFailed = 0x00020000, // Recording partially failed 
       
    68     EIptvMyVideosVideoRecFailed          = 0x00040000  // Recording failed
       
    69     } TIptvMyVideosVideoFlags;
       
    70 
       
    71 class CHarvesterRtpClipDetails;
       
    72 
       
    73 /**
       
    74  *  Rtp Meta data reader class definition
       
    75  *
       
    76  *  @lib harvesterrtpplugin.dll
       
    77  *  @since S60 S60 v3.x
       
    78  */
       
    79 class CHarvesterRtpMetaDataReader : public CBase
       
    80     {
       
    81 public:
       
    82 
       
    83     /**
       
    84      * Constructs a new CHarvesterRTPPlugin implementation.
       
    85      *  
       
    86      * @param aFileBuffer File data buffer
       
    87      * @return A pointer to CHarvesterRtpMetaDataReader
       
    88      */
       
    89     static CHarvesterRtpMetaDataReader* NewL( const TDesC8* aFileBuffer );
       
    90 
       
    91     /**
       
    92     * Destructor.
       
    93     */
       
    94     virtual ~CHarvesterRtpMetaDataReader();
       
    95 
       
    96     /**
       
    97     * Get metadata of rtp clip
       
    98     * 
       
    99     * @param aDetails Clip metadata from metadata header
       
   100     */
       
   101     void GetClipDetailsL( CHarvesterRtpClipDetails& aDetails );
       
   102 
       
   103 private:
       
   104 
       
   105     /**
       
   106     * C++ constructor
       
   107     * @param aFileBuffer File data buffer
       
   108     */
       
   109     CHarvesterRtpMetaDataReader( const TDesC8* aFileBuffer );
       
   110 
       
   111     /**
       
   112     * 2nd phase constructor
       
   113     */
       
   114     void ConstructL();
       
   115 
       
   116     /**
       
   117     * Reads any string with one byte len info from meta header.
       
   118     * @since 
       
   119     * @param aPosition a position from to read
       
   120     * @param aData a data to read
       
   121     * @return None.
       
   122     */
       
   123     void ReadStringDataL( const TInt aPosition, TPtrC8& aData );
       
   124 
       
   125     /**
       
   126     * Converts bytes to integer.
       
   127     * @since Series 60 3.0
       
   128     * @param aBytes a buffer to convert.
       
   129     * @param aValue a integer converted from bytes.
       
   130     * @return a system wide error code.
       
   131     */
       
   132     TInt GetValue( const TDesC8& aBytes, TUint& aValue );
       
   133 
       
   134     /**
       
   135     * Get channel name and program name from meta header. 
       
   136     * Format to one string. Leaves if cannot read 
       
   137     * data from meta header.
       
   138     *
       
   139     * @param aTitle On return, clip title
       
   140     */
       
   141     void GetProgramTitleL( TDes& aTitle );
       
   142 
       
   143 private: // data
       
   144 
       
   145     /**
       
   146     * Meta total length.
       
   147     */
       
   148     TInt iMetaTotal;
       
   149 
       
   150     /**
       
   151     * Data buffer.
       
   152     * Own.
       
   153     */
       
   154     HBufC8* iMetaData;
       
   155 
       
   156     /**
       
   157     * File data buffer pointer.
       
   158     */
       
   159     TPtr8 iDataPtr;
       
   160     
       
   161     /**
       
   162     * ESG data point.
       
   163     */
       
   164     TInt iEsgDataPoint;
       
   165 
       
   166     /**
       
   167     * File data buffer
       
   168     * Not own.
       
   169     */
       
   170     const TDesC8* iFileBuffer;
       
   171     };
       
   172 
       
   173 #endif // C_HARVESTERRTPMETADATAREADER_H