dvrengine/CommonRecordingEngine/inc/CCRRtpFileSource.h
branchRCL_3
changeset 23 13a33d82ad98
parent 0 822a42b6c3f1
equal deleted inserted replaced
22:826cea16efd9 23: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:    Class that reads RTP packets from propriatary file format.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCRRTPFILESOURCE_H
       
    21 #define CCRRTPFILESOURCE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "CCRPacketSourceBase.h"
       
    25 #include <ipvideo/MRtpFileReadObserver.h>
       
    26 #include <ipvideo/MRtpFileWriteObserver.h>
       
    27 
       
    28 // CONSTANTS
       
    29 // None
       
    30 
       
    31 // MACROS
       
    32 // None
       
    33 
       
    34 // DATA TYPES
       
    35 // None
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CRtpClipHandler;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 *  Class that negotiaties RTP stream using RTSP.
       
    44 *
       
    45 *  @lib CommonRecordingEngine.lib
       
    46 *  @since Series 60 3.0
       
    47 */
       
    48 class CCRRtpFileSource : public CCRPacketSourceBase,
       
    49                          public MRtpFileReadObserver
       
    50     {
       
    51 
       
    52 public: // Constructors and destructor
       
    53 
       
    54     /**
       
    55     * Two-phased constructor.
       
    56     * @return CCRRtpFileSource pointer to CCRRtpFileSource class
       
    57     */
       
    58     static CCRRtpFileSource* NewL( const SCRRtpPlayParams& aParams,
       
    59                                    CRtpClipHandler*& aClipHandler,
       
    60                                    MCRStreamObserver& aSessionObs,
       
    61                                    CCRStreamingSession& aOwningSession );
       
    62 
       
    63     /**
       
    64     * Two-phased constructor.
       
    65     * @return CCRRtpFileSource pointer to CCRRtpFileSource class
       
    66     */
       
    67     static CCRRtpFileSource* NewL( const RFile& aRtpHandle,
       
    68                                    CRtpClipHandler*& aClipHandler,
       
    69                                    MCRStreamObserver& aSessionObs,
       
    70                                    CCRStreamingSession& aOwningSession );
       
    71 
       
    72     /**
       
    73     * Destructor.
       
    74     */
       
    75     virtual ~CCRRtpFileSource();
       
    76 
       
    77 public: // New functions
       
    78 
       
    79     /**
       
    80     * 
       
    81     * @since Series 60 3.0
       
    82     * @param none. 
       
    83     * @return none.
       
    84     */
       
    85     //void PunchPacketsSent();
       
    86 
       
    87 private: // Constructors and destructor
       
    88 
       
    89     /**
       
    90     * C++ default constructor.
       
    91     * @param aSessionObs a session observer.
       
    92     * @param aOwningSession a owning session.
       
    93     */
       
    94     CCRRtpFileSource( CRtpClipHandler*& aClipHandler,
       
    95                       MCRStreamObserver& aSessionObs,
       
    96                       CCRStreamingSession& aOwningSession );
       
    97 
       
    98     /**
       
    99     * By default Symbian 2nd phase constructor is private.
       
   100     */
       
   101     void ConstructL( const SCRRtpPlayParams& aParams );
       
   102 
       
   103     /**
       
   104     * By default Symbian 2nd phase constructor is private.
       
   105     */
       
   106     void ConstructL( const RFile& aRtpHandle );
       
   107 
       
   108 private: // Methods from base classes
       
   109 
       
   110     /**
       
   111     * From CCRPacketSourceBase.
       
   112     * Method for acquiring sdp.
       
   113     * @since Series 60 3.0
       
   114     * @param aSdp is string pointer that will be .Set() to contain the sdp.
       
   115     *        If no sdp is available no .Set() will occur.
       
   116     * @return KErrNotReady if no sdp available.
       
   117     */
       
   118     TInt GetSdp( TPtrC8& aSdp );
       
   119 
       
   120     /**
       
   121     * From CCRPacketSourceBase.
       
   122     * Method for setting buffers to packet source
       
   123     * @since Series 60 3.0
       
   124     * @param aBuffer is buffer to be set.
       
   125     * @return none.
       
   126     */
       
   127     void SetBuffer( CCRPacketBuffer* aBuffer );
       
   128 
       
   129     /**
       
   130     * From CCRPacketSourceBase.
       
   131     * Post action after source initialized.
       
   132     * @since Series 60 3.0
       
   133     * @param none.
       
   134     * @return none.
       
   135     */
       
   136     void PostActionL();
       
   137 
       
   138     /**
       
   139     * From CCRPacketSourceBase.
       
   140     * Method for requesting more packets to buffer.
       
   141     * @since Series 60 3.0
       
   142     * @param none.
       
   143     * @return none.
       
   144     */
       
   145     void Restore();
       
   146 
       
   147     /**
       
   148     * From CCRPacketSourceBase.
       
   149     * Method for ordering "play" for packet source.
       
   150     * @since Series 60 3.0
       
   151     * @param aStartPos is start position in seconds.
       
   152     * @param aEndPos is end position in seconds.
       
   153     * @return a system wide error code.
       
   154     */
       
   155     TInt Play( const TReal& aStartPos,
       
   156                const TReal& aEndPos );
       
   157 
       
   158     /**
       
   159     * From CCRPacketSourceBase.
       
   160     * Method for stopping play from source.
       
   161     * @since Series 60 3.0
       
   162     * @param none.
       
   163     * @return a system wide error code.
       
   164     */
       
   165     TInt Stop();
       
   166 
       
   167     /**
       
   168     * From CCRPacketSourceBase.
       
   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     TInt SetPosition( const TInt64 aPosition );
       
   175     
       
   176     /**
       
   177     * From CCRPacketSourceBase.
       
   178     * Getter for current position.
       
   179     * @since Series 60 3.0
       
   180     * @param aPosition a postion of playback.
       
   181     * @param aDuration a duration of playback.
       
   182     * @return a system wide error code.
       
   183     */
       
   184     TInt GetPosition( TInt64& aPosition,
       
   185                       TInt64& aDuration );
       
   186     
       
   187     /**
       
   188     * From MRtpFileReadObserver.
       
   189     * Called when RTP packets group readed from a file.
       
   190     * @since Series 60 3.0
       
   191     * @param aGroup a RTP data readed from a file.
       
   192     * @param aGroupTime a group time in milli seconds.
       
   193     * @param aLastGroup a indication of last group in clip.
       
   194     * @return none.
       
   195     */
       
   196     void GroupReadedL( const TDesC8& aGroup,
       
   197                        const TUint aGroupTime,
       
   198                        const TBool aLastGroup );
       
   199 
       
   200     /**
       
   201     * From MRtpFileReadObserver.
       
   202     * File handler status of playback.
       
   203     * @since Series 60 3.0
       
   204     * @param aStatus a status of file reading.
       
   205     * @return none.
       
   206     */
       
   207     void ReadStatus( TInt aStatus );
       
   208 
       
   209 private: // New methods
       
   210 
       
   211     /**
       
   212     * Method for requesting more packets to buffer.
       
   213     * @since Series 60 3.0
       
   214     * @param aForce if true, forces read packets even buffer more than threshold.
       
   215     * @return a system wide error code.
       
   216     */
       
   217     TInt NextClipGroup( const TBool aForce );
       
   218 
       
   219     /**
       
   220     * Setter for current position of .rtp clip.
       
   221     * @since Series 60 3.0
       
   222     * @param aPosition a postion of playback.
       
   223     * @return a system wide error code.
       
   224     */
       
   225     TInt RtpPosition( const TUint aPosition );
       
   226     
       
   227     /**
       
   228     * Converts old RTP propriatary format packet type to stream id.
       
   229     * @since Series 60 3.0
       
   230     * @param aType a packet type from a clip.
       
   231     * @param aStream a stream id to update.
       
   232     * @return true if packet valid, otherwise false.
       
   233     */
       
   234     TBool TypeToStream( const MRtpFileWriteObserver::TRtpType& aType,
       
   235                         MCRPacketSource::TCRPacketStreamId& aStream );
       
   236 
       
   237 private:  // Data
       
   238 
       
   239     /**
       
   240     * Clip handler for RTP clip.
       
   241     */
       
   242     CRtpClipHandler*& iClipHandler;
       
   243 
       
   244     /**
       
   245     * Session observer.
       
   246     */
       
   247     MCRStreamObserver& iSessionObs;
       
   248     
       
   249     /**
       
   250     * SDP data.
       
   251     */
       
   252     HBufC8* iSdp;
       
   253     
       
   254     /**
       
   255     * Time of initialy readed group.
       
   256     */
       
   257     TUint iInitialTime;
       
   258 
       
   259     /**
       
   260     * Pause packet sent to sink from a clip.
       
   261     */
       
   262     TInt iClipPauseSent;
       
   263 
       
   264     };
       
   265 
       
   266 #endif // CCRRTPFILESOURCE_H
       
   267 
       
   268 // End of file