videoutils_plat/dvrengine_api/inc/ipvideo/CRtpUtil.h
changeset 41 d88d70d98bbc
parent 34 814ba97beeb9
child 46 3bc36dbd63c2
equal deleted inserted replaced
34:814ba97beeb9 41:d88d70d98bbc
     1 /*
       
     2 * Copyright (c) 2007 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 the License "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:    Convertion methods for RTP file format.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CRTPUTIL_H
       
    21 #define CRTPUTIL_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <etelmm.h>
       
    26 
       
    27 // CONSTANTS
       
    28 const TInt KSiKilo( 1000 );
       
    29 const TInt KIntegerBytes( 4 );
       
    30 const TInt KPacketSizeBytePoint( 0 );
       
    31 const TInt KPacketSizeBytesLen( 4 );
       
    32 const TInt KPacketTypeBytesLen( 1 );
       
    33 const TInt KSpecialPacketLength( KPacketSizeBytesLen + KPacketTypeBytesLen + KIntegerBytes );
       
    34 const TInt KPacketTypeBytePoint( KPacketSizeBytePoint + KPacketSizeBytesLen );
       
    35 const TInt KUserIdLength( RMobilePhone::KIMSISize );
       
    36 const TInt KDeviceIdLength( RMobilePhone::KPhoneSerialNumberSize );
       
    37 
       
    38 _LIT8( KRtpClipMimetype, "application/x-nokia-teh-rtp" );
       
    39 _LIT( KDvrTimeShiftFile, "c:\\timeshift." );
       
    40 
       
    41 // MACROS
       
    42 // None
       
    43 
       
    44 // DATA TYPES
       
    45 // None
       
    46 
       
    47 // FORWARD DECLARATIONS
       
    48 // None
       
    49 
       
    50 // CLASS DECLARATION
       
    51 
       
    52 /**
       
    53 *  RTP format common functionalities for Common Recording Engine.
       
    54 *
       
    55 *  @lib CommonRecordingEngine.lib
       
    56 *  @since Series 60 3.0
       
    57 */
       
    58 class CRtpUtil : public CBase
       
    59     {
       
    60 
       
    61 public: // Constructors and destructor
       
    62 
       
    63     /**
       
    64     * Two-phased constructor.
       
    65     */
       
    66     IMPORT_C static CRtpUtil* NewL();
       
    67 
       
    68     /**
       
    69     * Two-phased constructor.
       
    70     */
       
    71     IMPORT_C static CRtpUtil* NewLC();
       
    72 
       
    73     /**
       
    74     * Destructor.
       
    75     */
       
    76     IMPORT_C virtual ~CRtpUtil();
       
    77 
       
    78 public: // New functions
       
    79 
       
    80     /**
       
    81     * Converts integer to a buffer.
       
    82     * @since Series 60 3.0
       
    83     * @param aValue a value to write.
       
    84     * @return a buffer where value stored.
       
    85     */
       
    86     IMPORT_C static HBufC8* MakeBytesLC( const TInt& aValue );
       
    87 
       
    88     /**
       
    89     * Converts integer to a buffer.
       
    90     * @since Series 60 3.0
       
    91     * @param aValue a value to write.
       
    92     * @param aBuf a buffer where value stored.
       
    93     * @return none.
       
    94     */
       
    95     IMPORT_C static void MakeBytesL( const TInt& aValue,
       
    96                                      TDes8& aBuf );
       
    97 
       
    98     /**
       
    99     * Converts integer to a buffer.
       
   100     * @since Series 60 3.0
       
   101     * @param aValue a value to write.
       
   102     * @param aBuf a buffer where value stored.
       
   103     * @return a system wide error code.
       
   104     */
       
   105     IMPORT_C static TInt MakeBytes( const TInt& aValue,
       
   106                                     TDes8& aBuf );
       
   107 
       
   108     /**
       
   109     * Converts bytes to integer.
       
   110     * @since Series 60 3.0
       
   111     * @param aBytes a buffer to convert.
       
   112     * @return an integer converted from bytes.
       
   113     */
       
   114     IMPORT_C static TInt GetValueL( const TDesC8& aBytes );
       
   115 
       
   116     /**
       
   117     * Converts bytes to integer.
       
   118     * @since Series 60 3.0
       
   119     * @param aBytes a buffer to convert.
       
   120     * @param aValue a integer converted from bytes.
       
   121     * @return none.
       
   122     */
       
   123     IMPORT_C static void GetValueL( const TDesC8& aBytes,
       
   124                                     TInt& aValue );
       
   125 
       
   126     /**
       
   127     * Converts bytes to integer.
       
   128     * @since Series 60 3.0
       
   129     * @param aBytes a buffer to convert.
       
   130     * @param aValue a integer converted from bytes.
       
   131     * @return a system wide error code.
       
   132     */
       
   133     IMPORT_C static TInt GetValue( const TDesC8& aBytes,
       
   134                                    TInt& aValue );
       
   135 
       
   136     /**
       
   137     * Converts bytes to integer.
       
   138     * @since Series 60 3.0
       
   139     * @param aBytes a buffer to convert.
       
   140     * @param aValue a integer converted from bytes.
       
   141     * @return a system wide error code.
       
   142     */
       
   143     IMPORT_C static TInt GetValue( const TDesC8& aBytes,
       
   144                                    TUint& aValue );
       
   145 
       
   146     /**
       
   147     * Generates special RTP packet.
       
   148     * @since Series 60 3.0
       
   149     * @param aType a type of RTP packet.
       
   150     * @return a buffer containing generated RTP packet.
       
   151     */
       
   152     IMPORT_C static HBufC8* SpecialPacketL( const TInt aType );
       
   153         
       
   154     /**
       
   155     * Getter for RTP clip mime type info.
       
   156     * @since Series 60 3.0
       
   157     * @param aBuf on return contains the mime type.
       
   158     * @return None.
       
   159     */
       
   160     IMPORT_C static void GetMimeInfo( TDes& aMime );
       
   161     
       
   162     /**
       
   163     * Getter for RTP clip mime type info.
       
   164     * @since Series 60 3.0
       
   165     * @param aBuf on return contains the mime type.
       
   166     * @return None.
       
   167     */
       
   168     IMPORT_C static void GetMimeInfo( TDes8& aMime );
       
   169     
       
   170     /**
       
   171     * Reads IMEI of the phone HW.
       
   172     * @since Series 60 3.0
       
   173     * @param aBuf on return contains the IMEI.
       
   174     * @return none.
       
   175     */
       
   176     IMPORT_C static void GetImeiL( TDes& aImsi );
       
   177 
       
   178 private: // Constructors and destructor
       
   179 
       
   180     /**
       
   181     * C++ default constructor.
       
   182     */
       
   183     CRtpUtil();
       
   184 
       
   185     /**
       
   186     * Symbian 2nd phase constructor can leave and is private by default.
       
   187     */
       
   188     void ConstructL();
       
   189   	    
       
   190 private: // New methods
       
   191 
       
   192     /**
       
   193     * Reads mobile info of the phone.
       
   194     * @since Series 60 3.0
       
   195     * @param none.
       
   196     * @return none.
       
   197     */
       
   198     void static GetMobilePhoneInfoL( RTelServer& aServer,
       
   199                                      RMobilePhone& aPhone );
       
   200 
       
   201   };
       
   202 
       
   203 #endif // CRTPUTIL_H
       
   204 
       
   205 // End of File