dvrengine/CommonRecordingEngine/inc/CCRPacketSourceBase.h
branchRCL_3
changeset 48 13a33d82ad98
parent 0 822a42b6c3f1
equal deleted inserted replaced
47:826cea16efd9 48:13a33d82ad98
       
     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:    Common interface for sources*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef MCRPACKETSOURCEBASE_H
       
    20 #define MCRPACKETSOURCEBASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "CCRStreamingSession.h"
       
    24 #include "MCRPacketSource.h"
       
    25 #include "MCRConnectionObserver.h"
       
    26 
       
    27 // CONSTANTS
       
    28 // None
       
    29 
       
    30 // MACROS
       
    31 // None
       
    32 
       
    33 // DATA TYPES
       
    34 // None
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 // None
       
    38 
       
    39 // CLASS DECLARATION
       
    40 // None
       
    41 
       
    42 /**
       
    43 * Interface to source.
       
    44 *
       
    45 *  @lib CommonRecordingEngine.lib
       
    46 *  @since Series 60 3.0
       
    47 */
       
    48 class CCRPacketSourceBase : public CBase,
       
    49                             public MCRPacketSource
       
    50     {
       
    51 
       
    52 public: // Constructors and destructors
       
    53 
       
    54     /**
       
    55     * Destructor
       
    56     */
       
    57     virtual ~CCRPacketSourceBase(); 
       
    58 
       
    59 public: // Methods from base classes
       
    60 
       
    61 	/**
       
    62     * From MCRPacketSource.
       
    63     * Method for setting buffers to packet source.
       
    64 	* @since Series 60 3.0
       
    65 	* @param aBuffer is buffer to be set.
       
    66 	* @return none.
       
    67 	*/
       
    68 	virtual void SetBuffer( CCRPacketBuffer* aBuffer );
       
    69 
       
    70     /**
       
    71     * From MCRPacketSource.
       
    72     * Method for acquiring sdp.
       
    73     * @since Series 60 3.0
       
    74     * @param aSdp is string pointer that will be .Set() to contain the sdp.
       
    75     *        If no sdp is available no .Set() will occur.
       
    76     * @return KErrNotReady if no sdp available.
       
    77     */
       
    78     virtual TInt GetSdp( TPtrC8& aSdp ) = 0;
       
    79 
       
    80     /**
       
    81     * From MCRPacketSource.
       
    82     * Method for acquiring (almost) up-to-date sequence and ts numbers.
       
    83     * @since Series 60 3.0
       
    84     * @param aAudioSeq is reference to TUint that will be set by this
       
    85     *        method to contain latest available sequence number for
       
    86     *        audio stream being received via this packet source.
       
    87     * @param aAudioTS rtp timestamp for audio.
       
    88     * @param aVideoSeq rtp seq for video. If no video, value will not be touched.
       
    89     * @param aVideoTS rtp ts for video.
       
    90     * @return KErrNone if data available.
       
    91     */
       
    92     virtual TInt SeqAndTS( TUint& aAudioSeq,
       
    93                            TUint& aAudioTS,
       
    94                            TUint& aVideoSeq,
       
    95                            TUint& aVideoTS );
       
    96 
       
    97     /**
       
    98     * From MCRPacketSource.
       
    99     * Method for ordering "play" for packet source.
       
   100     * @since Series 60 3.0
       
   101     * @param aStartPos is start position in seconds.
       
   102     * @param aEndPos is end position in seconds.
       
   103     * @return a system wide error code.
       
   104     */
       
   105     virtual TInt Play( const TReal& aStartPos,
       
   106                        const TReal& aEndPos );
       
   107 
       
   108     /**
       
   109     * From MCRPacketSource.
       
   110     * Method for pausing play from source.
       
   111     * @since Series 60 3.0
       
   112     * @param none.
       
   113     * @return a system wide error code.
       
   114     */
       
   115     virtual TInt Pause();
       
   116 
       
   117     /**
       
   118     * From MCRPacketSource.
       
   119     * Method for stopping play from source.
       
   120     * @since Series 60 3.0
       
   121     * @param none.
       
   122     * @return a system wide error code.
       
   123     */
       
   124     virtual TInt Stop();
       
   125 
       
   126     /**
       
   127     * From MCRPacketSource.
       
   128     * Setter for current position.
       
   129     * @since Series 60 3.0
       
   130     * @param aPosition a postion of playback.
       
   131     * @return a system wide error code.
       
   132     */
       
   133     virtual TInt SetPosition( const TInt64 aPosition );
       
   134     
       
   135     /**
       
   136     * From MCRPacketSource.
       
   137     * Getter for current position.
       
   138     * @since Series 60 3.0
       
   139     * @param aPosition a postion of playback.
       
   140     * @param aDuration a duration of playback.
       
   141     * @return a system wide error code.
       
   142     */
       
   143     virtual TInt GetPosition( TInt64& aPosition,
       
   144                               TInt64& aDuration );
       
   145     
       
   146     /**
       
   147     * From MCRPacketSource.
       
   148     * Method for getting range of stream. If no range/duration
       
   149     * is available this method will set the return values to
       
   150     * 0.0,-1.0 and that may be quite normal state live streams.
       
   151     * @since Series 60 3.0
       
   152     * @param aLower is where to start from.
       
   153              If no value available, value of aLower must be set to 0.
       
   154     * @param aUpper is where to stop. Negative values mean eternity.
       
   155     * @return none.
       
   156     */
       
   157     virtual void GetRange( TReal& aLower,
       
   158                            TReal& aUpper );
       
   159 
       
   160     /**
       
   161     * From MCRPacketSource.
       
   162     * Post action after source initialized.
       
   163     * @since Series 60 3.0
       
   164     * @param none.
       
   165     * @return none.
       
   166     */
       
   167     virtual void PostActionL();
       
   168 
       
   169     /**
       
   170     * From MCRPacketSource.
       
   171     * Method for requesting more packets to buffer.
       
   172     * @since Series 60 3.0
       
   173     * @param none.
       
   174     * @return none.
       
   175     */
       
   176     virtual void Restore();
       
   177 
       
   178 public: // New methods
       
   179 
       
   180     /**
       
   181     * Method that owner of source may utilitze to distinguish
       
   182     * between sources
       
   183     * @since Series 60 3.0
       
   184     * @param none.
       
   185     * @return Id that may have been set. 
       
   186     */
       
   187     virtual CCRStreamingSession::TCRSourceId Id( void ) const; 
       
   188     
       
   189     /**
       
   190     * Registers connection observer.
       
   191     * @since Series 60 3.0
       
   192     * @param aObserver aObserver.
       
   193     * @return none.
       
   194     */
       
   195     virtual void RegisterConnectionObs( MCRConnectionObserver* aObserver );
       
   196 
       
   197 protected: // Constructors and destructors
       
   198 
       
   199     /**
       
   200     * Default constructor 
       
   201     */
       
   202     CCRPacketSourceBase( CCRStreamingSession& aSession,
       
   203                          CCRStreamingSession::TCRSourceId aSourceId ); 
       
   204 
       
   205 protected: // Data
       
   206     
       
   207     /** 
       
   208     * Pointer to streaming session that owns us.
       
   209     */
       
   210     CCRStreamingSession& iOwningSession;                     
       
   211     
       
   212     /**
       
   213     * Buffer used by sources.
       
   214     */
       
   215     CCRPacketBuffer* iBuffer;
       
   216      
       
   217     /**
       
   218     * Source id, set by owner
       
   219     */
       
   220     const CCRStreamingSession::TCRSourceId iSourceId; 
       
   221     
       
   222     };
       
   223 
       
   224 #endif // MCRPACKETSOURCEBASE_H
       
   225 
       
   226 //  End of File