mmsharing/mmshengine/inc/musengclipsession.h
branchRCL_3
changeset 23 bc78a40cd63c
parent 22 73a1feb507fb
equal deleted inserted replaced
22:73a1feb507fb 23:bc78a40cd63c
    21 
    21 
    22 // USER
    22 // USER
    23 #include "musengmceoutsession.h"
    23 #include "musengmceoutsession.h"
    24 #include "musunittesting.h"
    24 #include "musunittesting.h"
    25 
    25 
       
    26 
    26 class MMusEngClipSessionObserver;
    27 class MMusEngClipSessionObserver;
    27 class CMusEngLiveSession;
    28 class CMusEngLiveSession;
    28 class CMceFileSource;
    29 class CMceFileSource;
    29 class CMceAudioStream;
    30 class CMceAudioStream;
    30 class CMceVideoStream;
    31 class CMceVideoStream;
    31 class CMceAudioCodec;
    32 class CMceAudioCodec;
    32 class CMusEngClipVideoPlayer;
       
    33 
       
    34 
    33 
    35 class CMusEngClipSession : public CMusEngMceOutSession
    34 class CMusEngClipSession : public CMusEngMceOutSession
    36     {
    35     {
    37     MUS_UNITTEST( UT_CMusEngClipSession )
    36     MUS_UNITTEST( UT_CMusEngClipSession )
    38     MUS_UNITTEST( UT_CMusEngMceSession )
    37     
    39     
    38     public:
    40     public: // Constructors and destructor
    39 
    41 
    40         /**
    42         /**
    41         *
    43         * Constructor
    42         */
    44         */
    43         IMPORT_C static CMusEngClipSession* NewL( 
    45         static CMusEngClipSession* NewL();
    44                                 const TRect& aRect,
       
    45                                 MMusEngSessionObserver& aSessionObserver,
       
    46                                 MMusEngOutSessionObserver& aOutSessionObserver,
       
    47                                 MMusEngClipSessionObserver& aClipSessionObserver,
       
    48                                 TUint aSipProfileId = 0 );
    46                                                   
    49                                                   
    47         /**
    50         /**
    48         * Destructor
    51         *
    49         */
    52         */
    50         ~CMusEngClipSession();
    53         ~CMusEngClipSession();
    51 
    54 
    52     public: // from MLcSession
    55 
    53     
    56     public: // new API
    54         MLcVideoPlayer* LocalVideoPlayer();
    57         
       
    58         /**
       
    59         * Sets file to be shared during session.
       
    60         * @pre File cannot be DRM protected
       
    61         * @post InviteL can be called
       
    62         * @leave One of the system wide error codes
       
    63         * @param aFileName Name of the file to be shared
       
    64         */
       
    65         IMPORT_C void SetClipL( const TDesC& aFileName );
       
    66         
       
    67         /**
       
    68         * Starts or stops fast forwarding the clip. Clip is left paused after
       
    69         * stopping the fast forwarding.
       
    70         * @pre Session is ongoing
       
    71         * @param aUseFFWD ETrue to start FFWD, EFalse to stop it.
       
    72         */
       
    73         IMPORT_C void FastForwardL( TBool aUseFFWD );
       
    74 
       
    75         /**
       
    76         * Starts or stops fast rewinding the clip. Clip is left paused after
       
    77         * stopping the fast rewinding.
       
    78         * @pre Session is ongoing
       
    79         * @param aUseFRWD ETrue to start FRWD, EFalse to stop it.
       
    80         */
       
    81         IMPORT_C void FastRewindL( TBool aUseFRWD );
       
    82 
       
    83         /**
       
    84         * Returns current position as time interval.
       
    85         */
       
    86         IMPORT_C TTimeIntervalSeconds PositionL();
       
    87 
       
    88         /**
       
    89         * Returns duration of current clip as time interval
       
    90         */
       
    91         IMPORT_C TTimeIntervalSeconds DurationL();
       
    92 
       
    93         /**
       
    94         *
       
    95         */
       
    96         IMPORT_C void SetPositionL (const TTimeIntervalSeconds &aPosition);
       
    97 
       
    98         /**
       
    99         * Starts transcoding of file. After the transcoding is complete,
       
   100         * file to be shared is changed into the transcoded file.
       
   101         * @pre MMusEngClipSessionObserver::TranscodingNeeded is called
       
   102         * @param aFileName Name of the transcoding output file.
       
   103         */
       
   104         IMPORT_C void TranscodeL( const TFileName& aFileName );
       
   105 
       
   106         /**
       
   107         * Cancels transcoding of file. 
       
   108         * @pre TranscodeL has been called succesfully and transcoding 
       
   109         *      is not completed
       
   110         */
       
   111         IMPORT_C void CancelTranscodeL();
       
   112 
       
   113 
       
   114     public: // implementation of virtual API from CMusEngMceOutSession
       
   115 
       
   116         /**
       
   117         * Resumes previously paused session. 
       
   118         * Continues showing file on display, resumes clip's audio, continues
       
   119         * playing file and enables streaming to network.
       
   120         * @leave KErrNotReady if called during FFWD or FRWD
       
   121         */
       
   122         IMPORT_C void PlayL();
       
   123 
       
   124         /**
       
   125         * Pauses session.
       
   126         * Holds display, mutes clip's audio, pauses file and 
       
   127         * disables all streaming to network.
       
   128         * @leave KErrNotReady if called during FFWD or FRWD
       
   129         */
       
   130         IMPORT_C void PauseL();
       
   131 
       
   132         /**
       
   133         * Tells whether session is paused or not
       
   134         */
       
   135         IMPORT_C TBool IsPlayingL();
    55 
   136 
    56 
   137 
    57     protected: // implementation of virtual helper from CMusEngMceOutSession
   138     protected: // implementation of virtual helper from CMusEngMceOutSession
    58 
   139 
    59         /**
   140         /**
    90         void StreamStateChanged( CMceMediaStream& aStream,
   171         void StreamStateChanged( CMceMediaStream& aStream,
    91                                  CMceMediaSource& aSource );
   172                                  CMceMediaSource& aSource );
    92 
   173 
    93     private:
   174     private:
    94 
   175 
    95         CMusEngClipSession();
   176         /**
    96 
   177         *
    97         void ConstructL();
   178         */
       
   179         CMusEngClipSession( MMusEngSessionObserver& aSessionObserver,
       
   180                             MMusEngOutSessionObserver& aOutSessionObserver,
       
   181                             MMusEngClipSessionObserver& aClipSessionObserver,
       
   182                             const TRect& aRect );
       
   183 
       
   184         /**
       
   185         * @leave KErrPermissionDenied if file is DRM protected
       
   186         */
       
   187         void ConstructL( TUint aSipProfileId );
    98 
   188 
    99 
   189 
   100     private: // HELPERS
   190     private: // HELPERS
       
   191 
       
   192         /**
       
   193         *
       
   194         */
       
   195         TBool IsProtectedFileL( const TDesC& aClipFile );
   101         
   196         
   102         void AddAmrCodecL( CMceAudioStream& aAudioStream );
   197         void AddAmrCodecL( CMceAudioStream& aAudioStream );
   103         
   198         
   104         void AddVideoCodecL( CMceVideoStream& aVideoStream );
   199         void AddVideoCodecL( CMceVideoStream& aVideoStream, TBool aIgnoreNegotiated = EFalse );
   105         
   200         
       
   201         TBool HasClipEnded();
       
   202         
       
   203         TBool IsRewindFromEnd();
       
   204 
       
   205         /**
       
   206         * Returns current position as microseconds.
       
   207         */
       
   208         TTimeIntervalMicroSeconds PositionMicroSecondsL();
       
   209 
       
   210         /**
       
   211         * Constructs audio stream structure during session completion and adds
       
   212         * it to session.
       
   213         * @param aLocalBundle All local streams are supposed to be added to
       
   214         *        this bundle
       
   215         * @pre iSession != NULL
       
   216         */
   106         void ConstructAudioStructureL( CMceStreamBundle& aLocalBundle );
   217         void ConstructAudioStructureL( CMceStreamBundle& aLocalBundle );
   107         
   218         
   108         void DetermineBufferingPeriod( CMceMediaStream& aStream );    
   219         void DetermineBufferingPeriod( CMceMediaStream& aStream );
       
   220             
       
   221         TBool IsH264Supported() const;
       
   222         
       
   223         void HandleTranscodingFailureL( TInt aError );
       
   224         
       
   225         TInt DoCompleteTranscoding();
       
   226         
       
   227         void DeleteTranscodingDestinationFileL();
   109 
   228 
   110     private: // Data
   229     private: // Data
   111         
   230     
   112         CMusEngClipVideoPlayer* iClipVideoPlayer;
   231         /**
       
   232         * Reference to live session observer interface.
       
   233         */
       
   234         MMusEngClipSessionObserver& iClipSessionObserver;
       
   235         
       
   236         TFileName iFileName;
       
   237         
       
   238         TBool iTranscodingOngoing;
       
   239         
       
   240         TTime iFFWDStartTime;
       
   241         TTime iFRWDStartTime;
       
   242         
   113         TTime iBufferingStartedTime;
   243         TTime iBufferingStartedTime;
       
   244         TTimeIntervalMicroSeconds iBufferingPeriod;
       
   245         
       
   246         TTimeIntervalMicroSeconds iDelayFileEndingPos; 
       
   247         TTimeIntervalMicroSeconds iPreviousPos;
       
   248         TBool iClipEnded;
       
   249         
       
   250         TFileName iTranscodingDestFileName;
       
   251         TBool iRewindedToBeginning;
       
   252         TBool iTranscodingRequiredDueMissingOptions;
       
   253         TBool iPause;
       
   254         
   114     };
   255     };
   115 
   256 
   116 #endif // MUSHENGCLIPSESSION_H
   257 #endif
   117 
   258