mmsharing/mmshengine/inc/musenglivesession.h
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #ifndef MUSENGLIVESESSION_H
    19 #ifndef MUSHENGLIVESESSION_H
    20 #define MUSENGLIVESESSION_H
    20 #define MUSHENGLIVESESSION_H
    21 
    21 
    22 // USER
    22 // USER
    23 #include "musengmceoutsession.h"
    23 #include "musengmceoutsession.h"
    24 #include "musunittesting.h"
    24 #include "musunittesting.h"
    25 #include "mussettings.h"
       
    26 #include "musengcamerahandler.h"
       
    27 
    25 
    28 // SYSTEM
    26 // SYSTEM
    29 #include <lcvideoplayer.h>
    27 #include <ecam.h>
    30 
    28 
    31 // FORWARD DECLARATIONS
    29 // FORWARD DECLARATIONS
    32 class MMusEngLiveSessionObserver;
    30 class MMusEngLiveSessionObserver;
    33 class CMusEngLiveVideoPlayer;
    31 class CMusEngOrientationHandler;
    34 
    32 
    35 
    33 class CMusEngLiveSession : public CMusEngMceOutSession
    36 class CMusEngLiveSession : 
       
    37     public CMusEngMceOutSession
       
    38     {
    34     {
    39     MUS_UNITTEST( UT_CMusEngMceSession )
       
    40     MUS_UNITTEST( UT_CMusEngOutSession )
    35     MUS_UNITTEST( UT_CMusEngOutSession )
    41     MUS_UNITTEST( UT_CMusEngLiveSession )
    36     MUS_UNITTEST( UT_CMusEngLiveSession )
    42     
    37     MUS_UNITTEST( UT_CMusEngOrientationHandler )
       
    38 
    43     public:
    39     public:
       
    40 
       
    41         /**
       
    42         * Creates new MultimediaSharing Live session.
       
    43         *
       
    44         * @param aFileName Media filename
       
    45         * @param aRect UI drawing area. It is allowed handle from engine
       
    46         * @param aSessionObserver Interface for session specific callbacks
       
    47         * @param aOutSessionObserver Interface for outsession specific callbacks
       
    48         * @param aLiveSessionObserver interface for live session specific
       
    49         *        callbacks
       
    50         * @param aSipProfileId SIP profile to be used, 0 is default profile
       
    51         * @return CMusEngLiveSession* New instanse of specified class
       
    52         */
       
    53         IMPORT_C static CMusEngLiveSession* NewL( 
       
    54 							const TDesC& aFileName,
       
    55                             const TRect& aRect,
       
    56                             MMusEngSessionObserver& aSessionObserver,
       
    57                             MMusEngOutSessionObserver& aOutSessionObserver,
       
    58                             MMusEngLiveSessionObserver& aLiveSessionObserver,
       
    59                             TUint aSipProfileId = 0);
    44                             
    60                             
    45         /**
    61         /**
    46         * Creates new MultimediaSharing Live session.
    62         * Creates new MultimediaSharing Live session.
       
    63         *
       
    64         * @param aRect UI drawing area. It is allowed handle from engine
       
    65         * @param aSessionObserver Interface for session specific callbacks
       
    66         * @param aOutSessionObserver Interface for outsession specific callbacks
       
    67         * @param aLiveSessionObserver interface for live session specific
       
    68         *        callbacks
       
    69         * @param aSipProfileId SIP profile to be used, 0 is default profile
    47         * @return CMusEngLiveSession* New instanse of specified class
    70         * @return CMusEngLiveSession* New instanse of specified class
    48         */
    71         */
    49         static CMusEngLiveSession* NewL();
    72         IMPORT_C static CMusEngLiveSession* NewL( 
       
    73                             const TRect& aRect,
       
    74                             MMusEngSessionObserver& aSessionObserver,
       
    75                             MMusEngOutSessionObserver& aOutSessionObserver,
       
    76                             MMusEngLiveSessionObserver& aLiveSessionObserver,
       
    77                             TUint aSipProfileId = 0 );
       
    78 
    50 
    79 
    51     public:
    80     public:
    52 
    81 
    53         /**
    82         /**
    54         * Destructor
    83         * Destructor
    55         */
    84         */
    56         ~CMusEngLiveSession();
    85         ~CMusEngLiveSession();
    57 
    86 
    58     public: // from MLcSession
    87 
    59     
    88 
    60         MLcVideoPlayer* LocalVideoPlayer();  
    89     public: // NEW LIVE SESSION SPECIFIC API FUNCTIONS
    61         
    90 
       
    91         /**
       
    92         * Gets current zoom factor
       
    93         * 
       
    94         * @pre Session is established
       
    95         * @leave KErrNotReady if precondition not fullfilled
       
    96         */
       
    97         IMPORT_C TInt CurrentZoomL() const;
       
    98         
       
    99         /**
       
   100         * Sets new zoom factor
       
   101         * 
       
   102         * @pre Session is established
       
   103         * @pre MinZoomL <= aNewZoomFactor <= MaxZoomL
       
   104         * @leave KErrNotReady if session is not established
       
   105         */
       
   106         IMPORT_C void SetZoomL( TInt aNewZoomFactor );
       
   107         
       
   108         /**
       
   109         * Gets minimum zoom factor
       
   110         * 
       
   111         * @pre Session is established
       
   112         * @leave KErrNotReady if precondition not fullfilled
       
   113         */
       
   114         IMPORT_C TInt MinZoomL() const;
       
   115 
       
   116         /**
       
   117         * Gets maximum zoom factor
       
   118         * 
       
   119         * @pre Session is established
       
   120         * @leave KErrNotReady if precondition not fullfilled
       
   121         */
       
   122         IMPORT_C TInt MaxZoomL() const;
       
   123         
       
   124         /**
       
   125         * Increases zoom factor by one.
       
   126         * 
       
   127         * @pre Session is established
       
   128         * @leave KErrNotReady if precondition not fullfilled
       
   129         */
       
   130         IMPORT_C void ZoomInL();
       
   131 
       
   132         /**
       
   133         * Decreases zoom factor by one.
       
   134         * 
       
   135         * @pre Session is established
       
   136         * @leave KErrNotReady if precondition not fullfilled
       
   137         */
       
   138         IMPORT_C void ZoomOutL();
       
   139 
       
   140         /**
       
   141         * Sets zoom factor to default.
       
   142         * 
       
   143         * @pre Session is established
       
   144         * @leave KErrNotReady if precondition not fullfilled
       
   145         */
       
   146         IMPORT_C void ZoomDefaultL();
       
   147 
       
   148         /**
       
   149         * Sets current brightness
       
   150         * 
       
   151         * @pre Session is established
       
   152         * @leave KErrNotReady if precondition not fullfilled
       
   153         */
       
   154         IMPORT_C void SetBrightnessL( TInt aBrightness ) const;
       
   155 
       
   156 
       
   157         /**
       
   158         * Gets current brightness
       
   159         * 
       
   160         * @pre Session is established
       
   161         * @leave KErrNotReady if precondition not fullfilled
       
   162         */
       
   163         IMPORT_C TInt CurrentBrightnessL() const;
       
   164 
       
   165         /**
       
   166         * Gets maximum brightness
       
   167         * 
       
   168         * @pre Session is established
       
   169         * @leave KErrNotReady if precondition not fullfilled
       
   170         */
       
   171         IMPORT_C TInt MaxBrightnessL() const;
       
   172 
       
   173         /**
       
   174         * Gets minimum brightness
       
   175         * 
       
   176         * @pre Session is established
       
   177         * @leave KErrNotReady if precondition not fullfilled
       
   178         */
       
   179         IMPORT_C TInt MinBrightnessL() const;
       
   180 
       
   181         /**
       
   182         * Increases brightness by one.
       
   183         * 
       
   184         * @pre Session is established
       
   185         * @leave KErrNotReady if precondition not fullfilled
       
   186         */
       
   187         IMPORT_C void IncreaseBrightnessL();
       
   188 
       
   189         /**
       
   190         * Decreases brightness by one.
       
   191         * 
       
   192         * @pre Session is established
       
   193         * @leave KErrNotReady if precondition not fullfilled
       
   194         */
       
   195         IMPORT_C void DecreaseBrightnessL();
       
   196 
       
   197         /**
       
   198         * Sets brightness factor to default.
       
   199         * 
       
   200         * @pre Session is established
       
   201         * @leave KErrNotReady if precondition not fullfilled
       
   202         */
       
   203         IMPORT_C void BrightnessDefaultL();
       
   204 
       
   205         /**
       
   206         * Sets brightness to automatic.
       
   207         * 
       
   208         * @pre Session is established
       
   209         * @leave KErrNotReady if precondition not fullfilled
       
   210         */
       
   211         IMPORT_C void BrightnessAutoL();
       
   212 
       
   213         /**
       
   214         * Starts or pauses recording
       
   215         */
       
   216         IMPORT_C void RecordL( TBool aRecord );
       
   217 
       
   218         /**
       
   219         * Tells whether recording is paused or not
       
   220         */
       
   221         IMPORT_C TBool IsRecording();
       
   222         
       
   223         
       
   224     public: // implementation of virtual API from CMusEngMceOutSession
       
   225 
       
   226         /**
       
   227         * Resumes previously paused session. 
       
   228         * Continues using viewfinder and enables streaming video.
       
   229         *
       
   230         */
       
   231         IMPORT_C void PlayL();
       
   232 
       
   233         /**
       
   234         * Pauses session.
       
   235         * Holds display and disables streaming video to network.
       
   236         *
       
   237         */
       
   238         IMPORT_C void PauseL();
       
   239 
       
   240         /**
       
   241         * Tells whether session is paused or not
       
   242         */
       
   243         IMPORT_C TBool IsPlayingL();
       
   244         
       
   245         void EnableDisplayL( TBool aEnable );
       
   246         
       
   247         void RefreshOrientationL();
       
   248 
       
   249 
    62     protected: // inherited from CMusEngMceOutSession
   250     protected: // inherited from CMusEngMceOutSession
    63 
   251 
    64         /**
   252         /**
    65         * @param aLocalBundle All local streams are supposed to be added to
   253         * @param aLocalBundle All local streams are supposed to be added to
    66         *        this bundle
   254         *        this bundle
    67         */
   255         */
    68 		void CompleteSessionStructureL( CMceStreamBundle& aLocalBundle );
   256 		void CompleteSessionStructureL( CMceStreamBundle& aLocalBundle );
    69 
   257 
    70 
   258 
    71     protected: // overrides ancestor class versions
   259     private: // overrides ancestor class versions
       
   260     
       
   261         /**
       
   262         * The state of the session has changed
       
   263         * @param aSession, the session that has changed.
       
   264         */
       
   265         virtual void HandleSessionStateChanged( CMceSession& aSession,
       
   266                                                 TInt aStatusCode,
       
   267                                                 const TDesC8& aReasonPhrase );
    72                                                 
   268                                                 
    73         /**
   269         /**
    74         * Sets Multimediasharing specific video codec settings like video 
   270         * Sets Multimediasharing specific video codec settings like video 
    75         * bitrate maxbitrate. This functions gets called for every video codec 
   271         * bitrate maxbitrate. This functions gets called for every video codec 
    76         * in session. This function overrides function in ancestor classes. 
   272         * in session. This function overrides function in ancestor classes. 
    77         * Function calls also overridden version.
   273         * Function calls also overridden version.
    78         */ 
   274         */ 
    79         virtual void AdjustVideoCodecL( CMceVideoCodec& aVideoCodec,
   275         virtual void AdjustVideoCodecL( CMceVideoCodec& aVideoCodec );
    80                                         TMceSourceType aSourceType );
       
    81         
   276         
    82         /**
   277         /**
    83         * Sets Multimediasharing specific audio codec settings. This functions 
   278         * Sets Multimediasharing specific audio codec settings. This functions 
    84         * gets called for every audio codec in session. This function overrides 
   279         * gets called for every audio codec in session. This function overrides 
    85         * function in base class. Function calls also overridden version.
   280         * function in base class. Function calls also overridden version.
    90         * Removes AVC if known that it is not supported
   285         * Removes AVC if known that it is not supported
    91         */
   286         */
    92         virtual void DoCodecSelectionL( CMceVideoStream& aVideoStream );
   287         virtual void DoCodecSelectionL( CMceVideoStream& aVideoStream );
    93    
   288    
    94 
   289 
    95     protected: // from MMceStreamObserver, 
   290     private: // from MMceStreamObserver, 
    96              // overrides the function in CMusEngMceSession
   291              // overrides the function in CMusEngMceSession
    97 
   292 
    98         /**
   293         /**
    99         * The state of the sink has changed.
   294         * The state of the sink has changed.
   100         *
   295         *
   103         */
   298         */
   104         void StreamStateChanged( CMceMediaStream& aStream,
   299         void StreamStateChanged( CMceMediaStream& aStream,
   105                                  CMceMediaSink& aSink );    
   300                                  CMceMediaSink& aSink );    
   106                                  
   301                                  
   107 
   302 
   108     protected:
   303     private:
   109 
   304 
   110         /**
   305         /**
   111         * Constructor
   306         * Constructor
   112         */
   307         */
   113         CMusEngLiveSession();
   308         CMusEngLiveSession( MMusEngSessionObserver& aSessionObserver,
       
   309                             MMusEngOutSessionObserver& aOutSessionObserver,
       
   310                             MMusEngLiveSessionObserver& aLiveSessionObserver,
       
   311         					const TRect& aRect,
       
   312         					const TDesC& aRecordedFile = KNullDesC );
   114 
   313 
   115         /**
   314         /**
   116         * Second-phase constructor
   315         * Second-phase constructor
   117         */
   316         */
   118         void ConstructL();
   317         void ConstructL( TUint aSipProfileId );
   119 
   318 
   120 
   319     
   121     protected:
   320     private: // Helpers
   122         
   321     
   123         TMusEngCameraHandler iCameraHandler;
   322         /**
   124         CMusEngLiveVideoPlayer* iLiveVideoPlayer;
   323         * Reads from CenRep and sets encoding device for a codec.
       
   324         */
       
   325         void SetEncodingDeviceL( CMceVideoCodec& aVideoCodec );
       
   326 
       
   327         /**
       
   328         * Sets configuration key for a codec
       
   329         */
       
   330         void SetCodecConfigKeyL( CMceVideoCodec& aVideoCodec );
       
   331     
       
   332         /**
       
   333         * Reads proper configuration key for a codec. NULL if not available.
       
   334         * Ownership is transferred.
       
   335         */
       
   336         HBufC8* ReadCodecConfigKeyL( const CMceVideoCodec& aVideoCodec ) const;
       
   337         
       
   338         /**
       
   339         * Constructs and stores to cenrep a concatenation of all AVC config keys.
       
   340         */
       
   341         void StoreEncoderConfigInfoL() const;
       
   342         
       
   343         /**
       
   344         * Returns config key id for the provided codec. Ownership is transferred
       
   345         */
       
   346         const TPtrC8 ConfigKeyIdL( const CMceVideoCodec& aVideoCodec ) const;
       
   347         
       
   348 
       
   349         /**
       
   350         *    Calculate the zoom step size based time escaped. 
       
   351         * 
       
   352         * @param aTime, start time. pass iZoomInTime or iZoomOutTime as parameter
       
   353         * @return TInt, return calculate result of the step size  
       
   354         */
       
   355         TInt ZoomStepSize( TInt64& aTime );
       
   356         
       
   357         /**
       
   358          *  Calculates iMinZoomStep and iMaxZoomStep zoom step sizes,
       
   359          *  should be called before first ZoomIn()/ZoomOut() call
       
   360          */
       
   361         void InitializeZoomStepSize();
       
   362         
       
   363         
       
   364     private:
       
   365 
       
   366         /**
       
   367         * Reference to live session observer interface.
       
   368         */
       
   369         MMusEngLiveSessionObserver& iLiveSessionObserver;
       
   370 
       
   371         /**
       
   372         *
       
   373         */
       
   374         TCameraInfo iCameraInfo;
       
   375 
       
   376         /**
       
   377         *
       
   378         */
       
   379         TInt iDefaultZoomFactor;
       
   380 
       
   381         /**
       
   382         *
       
   383         */
       
   384         TInt iDefaultBrightness;
       
   385 
       
   386         /**
       
   387         * File name for recording. If KNullDesC no recording performed.
       
   388         */
       
   389         TFileName iRecordedFile;
       
   390         
       
   391         /**
       
   392         * If true, configuration key of current AVC codec must be written to
       
   393         * CenRep after session establishment.
       
   394         */
       
   395         TBool iStoreEncoderConfigInfo;
       
   396         
       
   397         /**
       
   398         * latest Zoomin time
       
   399         */
       
   400 
       
   401         TInt64 iZoomInTime;
       
   402 
       
   403         /**
       
   404         * latest Zoomout time
       
   405         */
       
   406         TInt64 iZoomOutTime;        
       
   407                        
       
   408         /**
       
   409         *
       
   410         */
       
   411         TInt iSmallZoomStep;
       
   412 
       
   413         /**
       
   414         *
       
   415         */
       
   416         TInt iBigZoomStep;
       
   417         
       
   418         CMusEngOrientationHandler* iOrientationHandler;
       
   419         
   125     };
   420     };
   126 
   421 
   127 #endif // MUSENGLIVESESSION_H
   422 #endif
   128 
   423