dvrengine/CommonRecordingEngine/DvrRtpUtils/inc/CRtpTsConverter.h
branchRCL_3
changeset 47 826cea16efd9
parent 45 798ee5f1972c
child 48 13a33d82ad98
equal deleted inserted replaced
45:798ee5f1972c 47:826cea16efd9
     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:    Class to provide TS conversion for an RTP-stream based on*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CRTPTSCONVERTER_H
       
    22 #define CRTPTSCONVERTER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <RtpHeader.h>
       
    26 
       
    27 // CONSTANTS
       
    28 const TUint KPipelineClockRate( 1000 );
       
    29 
       
    30 // MACROS
       
    31 // None
       
    32 
       
    33 // DATA TYPES
       
    34 // None
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 // None
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 *  Class for converting RTP-timestamps.
       
    43 *
       
    44 *  @lib CommonRecordingEngine.lib
       
    45 *  @since Series 60 3.0
       
    46 */
       
    47 class CRtpTsConverter : public CBase
       
    48     {
       
    49 
       
    50 public: // Constructors and destructor
       
    51 
       
    52     /**
       
    53     * Two-phased constructor.
       
    54     * @param aClockRate the clockrate for the media stream.
       
    55     */
       
    56     IMPORT_C static CRtpTsConverter* NewL( const TUint aClockRate );
       
    57     
       
    58     /**
       
    59     * Destructor.
       
    60     */
       
    61     IMPORT_C virtual ~CRtpTsConverter();
       
    62 
       
    63 public: // New functions
       
    64 
       
    65     /**
       
    66     * Initialize timestamp converter
       
    67     * @since Series 60 3.0
       
    68     * @param aRtcpPkt a RTCP packet for the media stream to be sychronized.
       
    69     * @return none.
       
    70     */
       
    71     IMPORT_C void Init( const TDesC8& aRtcpPkt );
       
    72     
       
    73     /**
       
    74     * Initialize timestamp converter
       
    75     * @since Series 60 3.0
       
    76     * @param aTs intial value of RTP timestamp
       
    77     * @return none.
       
    78     */
       
    79     IMPORT_C void Init( const TUint& aTs );
       
    80 
       
    81     /**
       
    82     * Gets status on initialization.
       
    83     * @since Series 60 3.0
       
    84     * @param none.
       
    85     * @return true if converter initialized, otherwise false.
       
    86     */
       
    87     IMPORT_C TBool Initiated();
       
    88 
       
    89     /**
       
    90     * Uninitializes the converter.
       
    91     * @since Series 60 3.0
       
    92     * @param none.
       
    93     * @return none.
       
    94     */
       
    95     IMPORT_C void UnInitiate();
       
    96 
       
    97     /**
       
    98     * Gets time stamp from a RTP packet.
       
    99     * @since Series 60 3.0
       
   100     * @param aTimestamp a RTP packet's TS to convert.
       
   101     * @param aUseWallClock if true converts to wall clock time.
       
   102     * @return a time stamp value.
       
   103     */
       
   104     IMPORT_C TUint ConvertTs( const TUint aTimestamp,
       
   105                               const TBool aUseWallClock = EFalse );
       
   106 
       
   107 private: // Constructors and destructor
       
   108 
       
   109     /**
       
   110     * By default Symbian 2nd phase constructor is private.
       
   111     */
       
   112     void ConstructL();
       
   113 
       
   114     /**
       
   115     * C++ default constructor.
       
   116     * @param aClockRate the clockrate for the media stream.
       
   117     */
       
   118     CRtpTsConverter( const TUint aClockRate );
       
   119 
       
   120 
       
   121 private: // New functions
       
   122 
       
   123     /**
       
   124     * Calculate the offset for adjusting the RTP timestamps.
       
   125     * @since Series 60 3.0
       
   126     * @param aRtpTime a RTP time stamp.
       
   127     * @param aSeekTime a wall clock time.
       
   128     * @param clockRate a wall clock time.
       
   129     * @return a offset for RTP TS adjustment.
       
   130     */
       
   131     TUint ComputeOffset( const TUint aRtpTime,
       
   132                          const TUint aSeekTime,
       
   133                          const TInt clockRate );
       
   134 
       
   135 private: // Data
       
   136 
       
   137     /**
       
   138     * Clockrate.
       
   139     */
       
   140     const TUint iClockRate;
       
   141     
       
   142     /**
       
   143     * Offset.
       
   144     */
       
   145     TUint iOffset;
       
   146 
       
   147     /**
       
   148     * Initiated.
       
   149     */
       
   150     TBool iInitiated;
       
   151         
       
   152     };
       
   153 
       
   154 #endif // CRTPTSCONVERTER_H
       
   155 
       
   156 // End of File