mmsharing/mmshengine/inc/musengclipsession.h
branchRCL_3
changeset 22 73a1feb507fb
parent 16 ce86b6d44a6d
child 23 bc78a40cd63c
equal deleted inserted replaced
21:33a5d2bbf6fc 22:73a1feb507fb
    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 
       
    27 class MMusEngClipSessionObserver;
    26 class MMusEngClipSessionObserver;
    28 class CMusEngLiveSession;
    27 class CMusEngLiveSession;
    29 class CMceFileSource;
    28 class CMceFileSource;
    30 class CMceAudioStream;
    29 class CMceAudioStream;
    31 class CMceVideoStream;
    30 class CMceVideoStream;
    32 class CMceAudioCodec;
    31 class CMceAudioCodec;
       
    32 class CMusEngClipVideoPlayer;
       
    33 
    33 
    34 
    34 class CMusEngClipSession : public CMusEngMceOutSession
    35 class CMusEngClipSession : public CMusEngMceOutSession
    35     {
    36     {
    36     MUS_UNITTEST( UT_CMusEngClipSession )
    37     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 );
       
    49                                                   
    46                                                   
    50         /**
    47         /**
    51         *
    48         * Destructor
    52         */
    49         */
    53         ~CMusEngClipSession();
    50         ~CMusEngClipSession();
    54 
    51 
    55 
    52     public: // from MLcSession
    56     public: // new API
    53     
    57         
    54         MLcVideoPlayer* LocalVideoPlayer();
    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();
       
   136 
    55 
   137 
    56 
   138     protected: // implementation of virtual helper from CMusEngMceOutSession
    57     protected: // implementation of virtual helper from CMusEngMceOutSession
   139 
    58 
   140         /**
    59         /**
   171         void StreamStateChanged( CMceMediaStream& aStream,
    90         void StreamStateChanged( CMceMediaStream& aStream,
   172                                  CMceMediaSource& aSource );
    91                                  CMceMediaSource& aSource );
   173 
    92 
   174     private:
    93     private:
   175 
    94 
   176         /**
    95         CMusEngClipSession();
   177         *
       
   178         */
       
   179         CMusEngClipSession( MMusEngSessionObserver& aSessionObserver,
       
   180                             MMusEngOutSessionObserver& aOutSessionObserver,
       
   181                             MMusEngClipSessionObserver& aClipSessionObserver,
       
   182                             const TRect& aRect );
       
   183 
    96 
   184         /**
    97         void ConstructL();
   185         * @leave KErrPermissionDenied if file is DRM protected
       
   186         */
       
   187         void ConstructL( TUint aSipProfileId );
       
   188 
    98 
   189 
    99 
   190     private: // HELPERS
   100     private: // HELPERS
   191 
       
   192         /**
       
   193         *
       
   194         */
       
   195         TBool IsProtectedFileL( const TDesC& aClipFile );
       
   196         
   101         
   197         void AddAmrCodecL( CMceAudioStream& aAudioStream );
   102         void AddAmrCodecL( CMceAudioStream& aAudioStream );
   198         
   103         
   199         void AddVideoCodecL( CMceVideoStream& aVideoStream, TBool aIgnoreNegotiated = EFalse );
   104         void AddVideoCodecL( CMceVideoStream& aVideoStream );
   200         
   105         
   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         */
       
   217         void ConstructAudioStructureL( CMceStreamBundle& aLocalBundle );
   106         void ConstructAudioStructureL( CMceStreamBundle& aLocalBundle );
   218         
   107         
   219         void DetermineBufferingPeriod( CMceMediaStream& aStream );
   108         void DetermineBufferingPeriod( CMceMediaStream& aStream );    
   220             
       
   221         TBool IsH264Supported() const;
       
   222         
       
   223         void HandleTranscodingFailureL( TInt aError );
       
   224         
       
   225         TInt DoCompleteTranscoding();
       
   226         
       
   227         void DeleteTranscodingDestinationFileL();
       
   228 
   109 
   229     private: // Data
   110     private: // Data
   230     
       
   231         /**
       
   232         * Reference to live session observer interface.
       
   233         */
       
   234         MMusEngClipSessionObserver& iClipSessionObserver;
       
   235         
   111         
   236         TFileName iFileName;
   112         CMusEngClipVideoPlayer* iClipVideoPlayer;
   237         
       
   238         TBool iTranscodingOngoing;
       
   239         
       
   240         TTime iFFWDStartTime;
       
   241         TTime iFRWDStartTime;
       
   242         
       
   243         TTime iBufferingStartedTime;
   113         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         
       
   255     };
   114     };
   256 
   115 
   257 #endif
   116 #endif // MUSHENGCLIPSESSION_H
   258 
   117