dvrengine/CommonRecordingEngine/inc/MCRPacketSource.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:    Class for all rtp packet sources*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef MCRPACKRTSOURCE_H
       
    20 #define MCRPACKRTSOURCE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32def.h>
       
    24 #include <e32cmn.h>
       
    25 
       
    26 // CONSTANTS
       
    27 const TReal KRealZero( 0.0 ); 
       
    28 const TReal KRealMinusOne( -1.0 ); 
       
    29 
       
    30 // MACROS
       
    31 // None
       
    32 
       
    33 // DATA TYPES
       
    34 // None
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CCRPacketBuffer;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 * Interface for packet sources
       
    43 *
       
    44 *  @lib CommonRecordingEngine.lib
       
    45 *  @since Series 60 3.0
       
    46 */
       
    47 class MCRPacketSource
       
    48     {
       
    49 
       
    50 public: // Data types
       
    51 
       
    52     /**
       
    53     * Enum for indicating what stream an individual rtp packet belongs to.
       
    54     */
       
    55     enum TCRPacketStreamId
       
    56         {
       
    57         EAudioStream = 0,           /**< This rtp stream carries audio content data */
       
    58         EAudioControlStream = 1,    /**< This rtp stream carries audio control data */
       
    59         EVideoStream = 2,           /**< This rtp stream carries video content data */
       
    60         EVideoControlStream = 3,    /**< This rtp stream carries video control data */
       
    61         ESubTitleStream = 4,        /**< This rtp stream carries sub title content data */
       
    62         ESubTitleControlStream = 5, /**< This rtp stream carries sub title control data */
       
    63         EDisContinousStream = 6,    /**< This is info of discontinous point in stream */
       
    64         EStreamEndTag = 7,          /**< This is info of end point of stream */
       
    65         EStreamIdCount              /**< Number of different sources */
       
    66         };    
       
    67 
       
    68     /** 
       
    69     * Enum for indicating rtp packet source state.
       
    70     */
       
    71     enum TCRPacketSourceState
       
    72         {
       
    73         ERtpStateIdle = 0,          /**< Nothing started yet */
       
    74         ERtpStateSdpAvailable,      /**< SDP received */
       
    75         ERtpStateSeqAndTSAvailable, /**< Should be ready for prime-time */
       
    76         ERtpStateSetupRepply,       /**< Setup repply received */
       
    77         ERtpStatePlaying,           /**< Stream is playing */
       
    78         ERtpStateClosing,           /**< Stream is about to end */
       
    79         ERtpStateCount              /**< Count number of different states */
       
    80         };
       
    81             
       
    82 public: // New methods
       
    83 
       
    84     /**
       
    85     * Method for acquiring sdp. 
       
    86     * @since Series 60 3.0
       
    87     * @param aSdp is string pointer that will be .Set() to contain
       
    88     *        the sdp. If no sdp is available no .Set() will occur.
       
    89     * @return KErrNotReady if no sdp available. 
       
    90     */
       
    91     virtual TInt GetSdp( TPtrC8& aSdp ) = 0;
       
    92 
       
    93     /**
       
    94     * Method for acquiring (almost) up-to-date sequence and ts numbers.
       
    95     * @since Series 60 3.0
       
    96     * @param aAudioSeq is reference to TUint that will be set by this
       
    97     *        method to contain latest available sequence number for
       
    98     *        audio stream being received via this packet source. 
       
    99     * @param aAudioTS rtp timestamp for audio
       
   100     * @param aVideoSeq rtp seq for video. If no video,
       
   101              value will not be touched.
       
   102     * @param aVideoTS rtp ts for video.
       
   103     * @return KErrNone if data available. 
       
   104     */
       
   105     virtual TInt SeqAndTS( TUint& aAudioSeq,
       
   106                            TUint& aAudioTS,
       
   107                            TUint& aVideoSeq,
       
   108                            TUint& aVideoTS ) = 0; 
       
   109 
       
   110     /** 
       
   111     * Method for ordering "play" for packet source.
       
   112     * @since Series 60 3.0
       
   113     * @param aStartPos is start position in sends.
       
   114     * @param aEndPos is play end position in seconds.
       
   115     * @return a system wide error code.
       
   116     */         
       
   117     virtual TInt Play( const TReal& aStartPos,
       
   118                        const TReal& aEndPos ) = 0;
       
   119 
       
   120     /** 
       
   121     * Method for ordering "pause" for packet source.
       
   122     * @since Series 60 3.0
       
   123     * @param none.
       
   124     * @return a system wide error code.
       
   125     */         
       
   126     virtual TInt Pause() = 0;
       
   127                 
       
   128     /** 
       
   129     * Method for stopping play from source.
       
   130     * @since Series 60 3.0
       
   131     * @param none.
       
   132     * @return a system wide error code.
       
   133     */
       
   134     virtual TInt Stop() = 0;
       
   135         
       
   136     /**
       
   137     * Method for getting range of stream. If no range/duration
       
   138     * is available this method will set the return values to
       
   139     * 0.0,-1.0 and that may be quite normal state live streams. 
       
   140     * Also, depending on type of source this data may not be always
       
   141     * available, for instance rtsp sources know the range after
       
   142     * play command has been issued but not before. 
       
   143     * @since Series 60 3.0
       
   144     * @param aLower is where to start from. If no value available, 
       
   145     *        value of aLower must be set to 0
       
   146     * @param aUpper is where to stop. Negative values mean eternity.
       
   147     * @return none
       
   148     */      
       
   149     virtual void GetRange( TReal& aLower,
       
   150                            TReal& aUpper ) = 0; 
       
   151     
       
   152     /**
       
   153     * Post action after source initialized.
       
   154     * @since Series 60 3.0
       
   155     * @param none.
       
   156     * @return none.
       
   157     */
       
   158     virtual void PostActionL() = 0;
       
   159 
       
   160     /**
       
   161     * Method for requesting more packets to buffer.
       
   162     * @since Series 60 3.0
       
   163     * @param none.
       
   164     * @return none.
       
   165     */
       
   166     virtual void Restore() = 0;
       
   167 
       
   168     /**
       
   169     * Setter for current position.
       
   170     * @since Series 60 3.0
       
   171     * @param aPosition a postion of playback.
       
   172     * @return a system wide error code.
       
   173     */
       
   174     virtual TInt SetPosition( const TInt64 aPosition ) = 0;
       
   175     
       
   176     /**
       
   177     * Getter for current position.
       
   178     * @since Series 60 3.0
       
   179     * @param aPosition a postion of playback.
       
   180     * @param aDuration a duration of playback.
       
   181     * @return a system wide error code.
       
   182     */
       
   183     virtual TInt GetPosition( TInt64& aPosition,
       
   184                               TInt64& aDuration ) = 0;
       
   185     
       
   186     };
       
   187 
       
   188 #endif // MCRPACKRTSOURCE_H
       
   189 
       
   190 //  End of File