multimediacommsengine/mmcesrv/mmcemediamanager/inc/mcemediamanager.h
changeset 0 1bce908db942
child 3 513a8b745b2f
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004 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 "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:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef CMCEMEDIAMANAGER_H
       
    23 #define CMCEMEDIAMANAGER_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <e32base.h>
       
    27 #include <e32cmn.h>
       
    28 #include "mcemediadefs.h"
       
    29 #include "mcedefs.h"
       
    30 #include "mcesip.h"
       
    31 #include "mcesrv.h"
       
    32 #include "mcecomfilesource.h"
       
    33 #include "mcesrvstream.h"
       
    34 #include "mcesecuremediasession.h"
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class MMceMediaGeneralObserver;
       
    38 class CMceComSession;
       
    39 class CMceComAudioStream;
       
    40 class CMceComAudioCodec;
       
    41 class CMceComMediaStream;
       
    42 class CMceSdpSession;
       
    43 class CSdpDocument;
       
    44 class CMceComMediaSink;
       
    45 class CMceComMediaSource;
       
    46 class CMceComRtpSource;
       
    47 class CMceComRtpSink;
       
    48 class CMceComSpeakerSink;
       
    49 class CMceComDisplaySink;
       
    50 class CMceComCameraSource;
       
    51 class CMceComAMRCodec;
       
    52 class CSdpMediaField;
       
    53 class CMceSdpCodec;
       
    54 class RStringF;
       
    55 class CMccInterface;
       
    56 class CMccSecureInterface;
       
    57 class CMceNatPluginManager;
       
    58 // Constants
       
    59 
       
    60 const TInt KRtcpRR = 1;
       
    61 const TInt KRtcpSR = 2;
       
    62 const TInt KRtcpUndefined = 3;
       
    63 
       
    64 
       
    65 
       
    66 /**
       
    67 *  Media negotiator for encoding and decoding SDP according to 
       
    68 *  offer/answer model defined in RFC 3264 and managing the MCC interface
       
    69 */
       
    70 class CMceMediaManager : public CBase, public MMccCtrlObserver
       
    71     {
       
    72         
       
    73     public:  // Constructors and destructor
       
    74         
       
    75         /**
       
    76         * Two-phased constructor.
       
    77         */
       
    78         static CMceMediaManager* NewL( MMceMediaGeneralObserver& aObserver );
       
    79 
       
    80         /**
       
    81         * Two-phased constructor.
       
    82         */
       
    83         static CMceMediaManager* NewLC( MMceMediaGeneralObserver& aObserver );
       
    84         
       
    85         /**
       
    86         * Destructor.
       
    87         */
       
    88         ~CMceMediaManager();
       
    89         
       
    90 
       
    91     public: // new API for server
       
    92 
       
    93         CMceNatPluginManager& NatPluginManager();
       
    94         
       
    95         CSdpDocument* EncodeL( CMceComSession& aSession );
       
    96 
       
    97         TMceSipWarningCode DecodeL( CMceComSession& aSession,
       
    98                                     CSdpDocument& aSdpDocument );
       
    99 
       
   100         TMceReturnStatus UpdateL( CMceComSession& aSession );
       
   101                       
       
   102         TMceReturnStatus ReserveL( CMceComSession& aSession, const TDesC8& aToken );
       
   103 
       
   104         TBool ReservationNeeded( CMceComSession& aSession );
       
   105 
       
   106         TBool NeedToNegotiate( CMceComSession& aSession, CSdpDocument* aSdpDocument = NULL );
       
   107 
       
   108         TBool ConfirmationNeeded( CMceComSession& aSession );
       
   109         
       
   110         TMceNegotiationRole GetRole( CMceComSession& aSession );
       
   111 
       
   112         
       
   113     public: // API for server
       
   114         
       
   115         
       
   116         /**
       
   117         * Creates a rejected SDP answer with all media lines set to 0. 
       
   118         *
       
   119         * @param  aSession, server session
       
   120         * @return none.
       
   121         */
       
   122         void CreateRejectedAnswer( CMceComSession& aSession );
       
   123         
       
   124         /**
       
   125         * Pauses the sink 
       
   126         *
       
   127         * @param  aSink, server sink 
       
   128         * @leaves with a system-wide error code
       
   129         */
       
   130         void PauseL( CMceComMediaSink& aSink );
       
   131         
       
   132         /**
       
   133         * Pauses the source 
       
   134         *
       
   135         * @param  aSource, server source
       
   136         * @leaves with a system-wide error code
       
   137         */
       
   138         void PauseL( CMceComMediaSource& aSource );
       
   139         
       
   140         /**
       
   141         * Resumes the sink
       
   142         *
       
   143         * @param  aSink, server sink 
       
   144         * @leaves with a system-wide error code
       
   145         */
       
   146         void ResumeL( CMceComMediaSink& aSink );
       
   147         
       
   148         /**
       
   149         * Stops the source
       
   150         *
       
   151         * @param  aSource, server source 
       
   152         * @leaves with a system-wide error code
       
   153         */
       
   154         void ResumeL( CMceComMediaSource& aSource );
       
   155         
       
   156         /**
       
   157         * Closes the session
       
   158         *
       
   159         * @param  aSession, server session
       
   160         * @return One of the standard system-wide error codes.
       
   161         */
       
   162         TInt CloseSession( CMceComSession& aSession );
       
   163         
       
   164         /**
       
   165         * Starts inactivity timer for the given RTP source
       
   166         * @param aRtpSource
       
   167         * @param aInactivityTimeout inactivity timeout
       
   168         * @leaves with a system-wide error code
       
   169         */
       
   170         void StartInactivityTimerL( const CMceComRtpSource& aRtpSource,
       
   171                                     TUint32 aInactivityTimeout );
       
   172 
       
   173         /**
       
   174         * Stops inactivity timer for the given RTP source
       
   175         * @param aRtpSource
       
   176         * @leaves with a system-wide error code
       
   177         */
       
   178         void StopInactivityTimerL( const CMceComRtpSource& aRtpSource );
       
   179         
       
   180         /**
       
   181         * Sends RTCP any data
       
   182         * @param aMediaStream, stream 
       
   183         * @param aData, data payload   
       
   184         * @leaves with a system-wide error code
       
   185         */
       
   186         void SendRTCPAnyDataL( const CMceComMediaStream& aMediaStream, 
       
   187                               const TDesC8& aData );
       
   188 
       
   189         /**
       
   190         * Sends RTCP receiver report to uplink if possible.
       
   191         * @param aRtpSink, rtp source
       
   192         * @leaves with a system-wide error code
       
   193         */
       
   194         void SendRTCPReceiverReportL( const CMceComRtpSource& aRtpSource );
       
   195 
       
   196         /**
       
   197         * Sends RTCP sender report to uplink if possible.
       
   198         * @param aRtpSink, rtp sink
       
   199         * @leaves with a system-wide error code
       
   200         */
       
   201         void SendRTCPSenderReportL( const CMceComRtpSink& aRtpSink );
       
   202         
       
   203         /**
       
   204         * Gets current maximum volume supported.
       
   205         * @param aMaxVolume - [output] maximum volume supported
       
   206         * @leaves with a system-wide error code
       
   207         */
       
   208         void GetMaxVolumeL( TInt& aMaxVolume );
       
   209                            
       
   210         /**
       
   211         * Gets current volume.
       
   212         * @param aSink, sink
       
   213         * @param aVolume - [output] After completion, current volume
       
   214         * @leaves with a system-wide error code
       
   215         */
       
   216         void GetVolumeL( const CMceComMediaSink& aSink, 
       
   217                         TInt& aVolume );
       
   218         
       
   219         /**
       
   220         * Sets playback volume.
       
   221         * @param aSink, sink
       
   222         * @param aVolume - [input] Volume value to set
       
   223         * @leaves with a system-wide error code
       
   224         */
       
   225         void SetVolumeL( const CMceComMediaSink& aSink, 
       
   226                          TInt aVolume );
       
   227         
       
   228 
       
   229         /**
       
   230         * Gets audio routing.
       
   231         * @param aSpeaker - [input] speaker sink
       
   232         * @param aRoutingDestination on return contains destination where audio
       
   233         *        is currently routed. Usable values are defined in
       
   234         *        mmccinterfacedef.h (e.g. KMccAudioToPublic).
       
   235         * @leaves with a system-wide error code
       
   236         */
       
   237         void GetAudioRoutingL( const CMceComSpeakerSink& aSpeaker, 
       
   238                                TInt& aRoutingDestination );
       
   239 
       
   240         /**
       
   241         * Sets audio routing.
       
   242         * @param aSpeaker - [input] speaker sink
       
   243         * @param aRoutingDestination destination into which audio is routed.
       
   244         *        Usable values are defined in mmccinterfacedef.h 
       
   245         *        (e.g. KMccAudioToPublic).
       
   246         */
       
   247         void SetAudioRoutingL( const CMceComSpeakerSink& aSpeaker, 
       
   248                                TInt aRoutingDestination );
       
   249         
       
   250                               
       
   251         /**
       
   252         * Sets balance of a given sink.
       
   253         * @param aSink, sink
       
   254         * @param aBalance - [input] Balance value to set
       
   255         * @leaves with a system-wide error code
       
   256         */
       
   257         void SetBalanceL( const CMceComMediaSink& aSink, 
       
   258                          TInt aBalance );
       
   259 
       
   260         /**
       
   261         * Sets balance of a given source.
       
   262         * @param aSource, source
       
   263         * @param aBalance - [input] Balance value to set
       
   264         * @leaves with a system-wide error code
       
   265         */
       
   266         void SetBalanceL( const CMceComMediaSource& aSource, 
       
   267                          TInt aBalance );
       
   268 
       
   269         /**
       
   270         * Gets current gain used in recording.
       
   271         * @param aSource, source
       
   272         * @param aGain - [output] After completion, current gain
       
   273         * @leaves with a system-wide error code
       
   274         */
       
   275         void GetGainL( const CMceComMediaSource& aSource, 
       
   276                       TInt& aGain );
       
   277 
       
   278         /**
       
   279         * Gets current maximum gain supported.
       
   280         * @param aMaxGain - [output] After completion, current gain
       
   281         * @leaves with a system-wide error code
       
   282         */
       
   283         void GetMaxGainL( TInt& aMaxGain );
       
   284 
       
   285         /**
       
   286         * Sets uplink/record gain to all ongoing sessions.
       
   287         * @param aSource, source
       
   288         * @param aGain - [input] Gain value to set
       
   289         * @leaves with a system-wide error code
       
   290         */
       
   291         void SetGainL( const CMceComMediaSource& aSource,
       
   292                       TInt aGain );
       
   293 
       
   294 
       
   295         /**
       
   296         * Gets number of displays available
       
   297         * @param aDisplaysAvailable, return value
       
   298         * @return One of the standard system-wide error codes.
       
   299         */
       
   300         void GetDisplaysAvailableL( TInt& aDisplaysAvailable );
       
   301 
       
   302         /**
       
   303         * Gets display size
       
   304         * @param aSink, sink
       
   305         * @param aDisplayRect, return value
       
   306         * @leaves with a system-wide error code
       
   307         */
       
   308         void GetDisplayRectL( CMceComDisplaySink& aSink, 
       
   309                              TRect& aDisplayRect );
       
   310 
       
   311         /**
       
   312         * Sets display size
       
   313         * @param aSink, sink
       
   314         * @param aDisplayRect, input value
       
   315         * @leaves with a system-wide error code
       
   316         */
       
   317         void SetDisplayRectL( CMceComDisplaySink& aSink, 
       
   318                              TRect aDisplayRect );
       
   319 
       
   320         /**
       
   321         * Gets display priority
       
   322         * @param aSink, sink
       
   323         * @param aDisplayPriority, return value
       
   324         * @leaves with a system-wide error code
       
   325         */
       
   326         void GetDisplayPriorityL( CMceComDisplaySink& aSink, 
       
   327                                  TInt& aDisplayPriority );
       
   328                                  
       
   329 
       
   330         /**
       
   331         * Gets display rotation
       
   332         * @param aSink, sink
       
   333         * @param aDisplayRotation, return value
       
   334         * @leaves with a system-wide error code
       
   335         */
       
   336         void GetDisplayRotationL( CMceComDisplaySink& aSink, 
       
   337                                   TInt& aDisplayRotation );
       
   338 
       
   339         /**
       
   340         * Sets display priority
       
   341         * @param aSink, sink
       
   342         * @param aDisplayPriority, input value
       
   343         * @leaves with a system-wide error code
       
   344         */
       
   345         void SetDisplayPriorityL( CMceComDisplaySink& aSink, 
       
   346                                  TInt aDisplayPriority );
       
   347 
       
   348         /**
       
   349         * Sets display index
       
   350         * @param aSink, sink
       
   351         * @param aDisplayIndex, input value
       
   352         * @leaves with a system-wide error code
       
   353         */
       
   354         void SetDisplayIndexL( CMceComDisplaySink& aSink, 
       
   355                               TInt aDisplayIndex );
       
   356 
       
   357         /**
       
   358         * Sets display rotation
       
   359         * @param aSink, sink
       
   360         * @param aDisplayRotation, input value
       
   361         * @leaves with a system-wide error code
       
   362         */
       
   363         void SetDisplayRotationL( CMceComDisplaySink& aSink, 
       
   364                                   TInt aDisplayRotation );
       
   365          
       
   366 
       
   367         /**
       
   368         * Gets camera info
       
   369         * @param aCameraIndex, input value
       
   370         * @param aCameraInfo, return value
       
   371         * @leaves with a system-wide error code
       
   372         */
       
   373         void GetCameraInfoL( TInt aCameraIndex, 
       
   374                              TCameraInfo& aCameraInfo );
       
   375 
       
   376         /**
       
   377         * Gets available cameras
       
   378         * @param aCamerasAvailable, return value
       
   379         * @leaves with a system-wide error code
       
   380         */
       
   381         void GetCamerasAvailableL( TInt& aCamerasAvailable );
       
   382 
       
   383         /**
       
   384         * Gets zoom factor of camera
       
   385         * @param aSource, source
       
   386         * @param aZoomFactor, return value
       
   387         * @leaves with a system-wide error code
       
   388         */
       
   389         void GetZoomFactorL( CMceComCameraSource& aSource, 
       
   390                              TInt& aZoomFactor );
       
   391 
       
   392         /**
       
   393         * Gets digital zoom factor of camera
       
   394         * @param aSource, source
       
   395         * @param aDigitalZoomFactor, return value
       
   396         * @leaves with a system-wide error code
       
   397         */
       
   398         void GetDigitalZoomFactorL( CMceComCameraSource& aSource, 
       
   399                                     TInt& aDigitalZoomFactor );
       
   400 
       
   401         /**
       
   402         * Gets contrast of camera
       
   403         * @param aSource, source
       
   404         * @param aContrast, return value
       
   405         * @leaves with a system-wide error code
       
   406         */
       
   407         void GetContrastL( CMceComCameraSource& aSource, 
       
   408                            TInt& aContrast );
       
   409 
       
   410         /**
       
   411         * Gets brightness of camera
       
   412         * @param aSource, source
       
   413         * @param aBrightness, return value
       
   414         * @leaves with a system-wide error code
       
   415         */
       
   416         void GetBrightnessL( CMceComCameraSource& aSource, 
       
   417                              TInt& aBrightness );
       
   418 
       
   419         /**
       
   420         * Gets exposure of camera
       
   421         * @param aSource, source
       
   422         * @param aExposure, return value
       
   423         * @leaves with a system-wide error code
       
   424         */
       
   425         void GetExposureL( CMceComCameraSource& aSource, 
       
   426                            TInt& aExposure );
       
   427 
       
   428         /**
       
   429         * Gets white balance of camera
       
   430         * @param aSource, source
       
   431         * @param aWhiteBalance, return value
       
   432         * @leaves with a system-wide error code
       
   433         */
       
   434         void GetWhiteBalanceL( CMceComCameraSource& aSource, 
       
   435                                TInt& aWhiteBalance );
       
   436 
       
   437         /**
       
   438         * Sets camera index of camera
       
   439         * @param aSource, source
       
   440         * @param aCameraIndex, input value
       
   441         * @param aCameraInfo, return value
       
   442         * 
       
   443         * @leaves with a system-wide error code
       
   444         */
       
   445         void SetCameraIndexL( CMceComCameraSource& aSource, 
       
   446                               TInt aCameraIndex,
       
   447                               TCameraInfo& aCameraInfo );
       
   448 
       
   449         /**
       
   450         * Sets zoom factor of camera
       
   451         * @param aSource, source
       
   452         * @param aZoomFactor, input value
       
   453         * @leaves with a system-wide error code
       
   454         */
       
   455         void SetZoomFactorL( CMceComCameraSource& aSource, 
       
   456                              TInt aZoomFactor );
       
   457 
       
   458         /**
       
   459         * Sets digital zoom factor of camera
       
   460         * @param aSource, source
       
   461         * @param aDigitalZoomFactor, input value
       
   462         * @leaves with a system-wide error code
       
   463         */
       
   464         void SetDigitalZoomFactorL( CMceComCameraSource& aSource, 
       
   465                                    TInt aDigitalZoomFactor );
       
   466 
       
   467         /**
       
   468         * Sets contrast of camera
       
   469         * @param aSource, source
       
   470         * @param aContrast, input value
       
   471         * @leaves with a system-wide error code
       
   472         */
       
   473         void SetContrastL( CMceComCameraSource& aSource, 
       
   474                            TInt aContrast );
       
   475 
       
   476         /**
       
   477         * Sets brightness of camera
       
   478         * @param aSource, source
       
   479         * @param aBrightness, input value
       
   480         * @leaves with a system-wide error code
       
   481         */
       
   482         void SetBrightnessL( CMceComCameraSource& aSource, 
       
   483                              TInt aBrightness );
       
   484 
       
   485         /**
       
   486         * Sets exposure of camera
       
   487         * @param aSource, source
       
   488         * @param aExposure, input value
       
   489         * @leaves with a system-wide error code
       
   490         */
       
   491         void SetExposureL( CMceComCameraSource& aSource, 
       
   492                            TInt aExposure );
       
   493 
       
   494         /**
       
   495         * Sets white balance of camera
       
   496         * @param aSource, source
       
   497         * @param aWhiteBalance, input value
       
   498         * @leaves with a system-wide error code
       
   499         */
       
   500         void SetWhiteBalanceL( CMceComCameraSource& aSource, 
       
   501                                TInt aWhiteBalance );
       
   502 
       
   503         /**
       
   504         * Gets file info
       
   505         * @param aSource, source
       
   506         * @param aFileInfo, return value
       
   507         * @leaves with a system-wide error code
       
   508         */
       
   509         void GetFileInfoL( CMceComFileSource& aSource, 
       
   510                            TMceFileInfo& aFileInfo );
       
   511                            
       
   512 
       
   513         /**
       
   514         * Gets file info
       
   515         * @param aFileInfo, return value
       
   516         * @leaves with a system-wide error code
       
   517         */
       
   518        void GetFileInfoL( TMceFileInfo& aFileInfo );
       
   519 
       
   520 
       
   521         /**
       
   522         * Sets file info
       
   523         * @param aSource, source
       
   524         * @param aFileInfo, return value
       
   525         * @leaves with a system-wide error code
       
   526         */
       
   527        void SetFileInfoL( CMceComFileSource& aSource, 
       
   528                           TMceFileInfo& aFileInfo );
       
   529                            
       
   530 
       
   531         /**
       
   532         * Gets file position
       
   533         * @param aSource, source
       
   534         * @param aFilePosition, return value
       
   535         * @leaves with a system-wide error code
       
   536         */
       
   537         void GetFilePositionL( CMceComFileSource& aSource, 
       
   538                                TTimeIntervalMicroSeconds& aFilePosition );
       
   539 
       
   540         /**
       
   541         * Sets file position
       
   542         * @param aSource, source
       
   543         * @param aFilePosition, input value
       
   544         * @leaves with a system-wide error code
       
   545         */
       
   546         void SetFilePositionL( CMceComFileSource& aSource, 
       
   547                                TTimeIntervalMicroSeconds& aFilePosition );
       
   548 
       
   549         /**
       
   550         * Sets FF 
       
   551         * @param aSource, source
       
   552         * @param aOnOff, inout value
       
   553         * @leaves with a system-wide error code
       
   554         */
       
   555         void FastForwardL( CMceComFileSource& aSource, 
       
   556                            TBool& aOnOff );
       
   557 
       
   558         /**
       
   559         * Sets RW 
       
   560         * @param aSource, source
       
   561         * @param aOnOff, inout value
       
   562         * @leaves with a system-wide error code
       
   563         */
       
   564         void FastRewindL( CMceComFileSource& aSource, 
       
   565                           TBool& aOnOff );
       
   566 
       
   567 
       
   568         /**
       
   569         * Transcodes file
       
   570         * @param aFile, source
       
   571         * @return transcoding session id
       
   572         * @leaves with a system-wide error code
       
   573         */
       
   574         TUint32 TranscodeFileL( CMceComFileSource* aFile );
       
   575 
       
   576         /**
       
   577         * Cancels transcoding
       
   578         * @param aSessionId, transcoding session id
       
   579         * @leaves with a system-wide error code
       
   580         */
       
   581         void CancelTranscodeFileL( TUint32 aSessionId );
       
   582 
       
   583         /**
       
   584         * Get supported codecs.
       
   585         * @param aCodecs - [output] An array to be filled with FourCC codes
       
   586         * @return One of the standard system-wide error codes.
       
   587         */
       
   588         TInt GetSupportedCodecs( RArray<TFourCC>& aCodecs );
       
   589                                 
       
   590         /**
       
   591         * Returns array of audio capabilities in aCapabilities. Note that data that
       
   592         * the aCapabilities contains before calling this function will be
       
   593         * lost during the excecution of this function. Note also that the CLIENT
       
   594         * is responsible for the destruction of the objects contained in the
       
   595         * parameter array.
       
   596         * @param aCapabilities Codec capabilities
       
   597         * @return None
       
   598         */
       
   599         void GetCapabilitiesL( RPointerArray<CMceComAudioCodec>& aCapabilities );
       
   600 
       
   601         /**
       
   602         * Returns array of video capabilities in aCapabilities. Note that data that
       
   603         * the aCapabilities contains before calling this function will be
       
   604         * lost during the excecution of this function. Note also that the CLIENT
       
   605         * is responsible for the destruction of the objects contained in the
       
   606         * parameter array.
       
   607         * @param aCapabilities Codec capabilities
       
   608         * @return None
       
   609         */
       
   610         void GetCapabilitiesL( RPointerArray<CMceComVideoCodec>& aCapabilities );
       
   611         
       
   612         /**
       
   613         * Handles dtmf sending.
       
   614         * @param aMediaSource
       
   615         * @param aEvent
       
   616         * @param aSequence
       
   617         * @return None
       
   618         */
       
   619         void DtmfL( CMceComMediaSource& aSource, 
       
   620                     TMceComEvent& aEvent, 
       
   621                     const TDesC8& aSequence = KNullDesC8 );
       
   622 
       
   623         /**
       
   624         * Sets CName used in RTP session
       
   625         * @param aEndpoint
       
   626         * @param aCName
       
   627         */
       
   628         void SetCNameL( const CMceComEndpoint& aEndpoint, const TDesC8& aCName );
       
   629         
       
   630         /**
       
   631         * Updates configuration key fetched from camera to all endpoints
       
   632         * within the same session which might need configuration key information,
       
   633         * @param aSource
       
   634         */
       
   635         void UpdateConfigKeyL( const CMceComMediaSource& aSource );
       
   636 
       
   637     private: // 
       
   638 
       
   639         /**
       
   640         * Callback function to receive media link created prepared event.
       
   641         * @param aSessionId Session ID
       
   642         * @param aLinkId Link ID
       
   643         * @param aNetSettings network settings
       
   644         */
       
   645         void MccMediaLinkCreated( TUint32 aSessionId,
       
   646                                   TUint32 aLinkId,
       
   647                                   const TDesC8& aNetSettings );
       
   648 
       
   649 
       
   650     private: // from MMccCtrlObserver
       
   651   
       
   652         /**
       
   653         * Callback function to receive media signalling
       
   654         * @param aEvent Received media signal
       
   655         */
       
   656         void MccEventReceived( const TMccEvent& aEvent );
       
   657         
       
   658 
       
   659         /**
       
   660         * Callback function to receive media prepared event.
       
   661         * @param aSessionId Session ID
       
   662         * @param aLinkId Link ID
       
   663         * @param aStreamId Stream ID
       
   664         * @param aSinkSourceId Sink or source ID
       
   665         */
       
   666         void MccMediaPrepared( TUint32 aSessionId,
       
   667                                        TUint32 aLinkId,
       
   668                                        TUint32 aStreamId,
       
   669                                        TUint32 aSinkSourceId );
       
   670                                        
       
   671         /**
       
   672         * Callback function to receive media started event.
       
   673         * @param aSessionId Session ID
       
   674         * @param aLinkId Link ID
       
   675         * @param aStreamId Stream ID
       
   676         * @param aSinkSourceId Sink or source ID
       
   677         */
       
   678         void MccMediaStarted( TUint32 aSessionId,
       
   679                                       TUint32 aLinkId,     
       
   680                                       TUint32 aStreamId,
       
   681                                       TUint32 aSinkSourceId );
       
   682         
       
   683         /**
       
   684         * Callback function to receive media stopped event.
       
   685         * @param aSessionId Session ID
       
   686         * @param aLinkId Link ID
       
   687         * @param aStreamId Stream ID
       
   688         * @param aSinkSourceId Sink or source ID
       
   689         */
       
   690         void MccMediaStopped( TUint32 aSessionId,
       
   691                                       TUint32 aLinkId,
       
   692                                       TUint32 aStreamId,
       
   693                                       TUint32 aSinkSourceId );
       
   694 
       
   695         /**
       
   696         * Callback function to receive media paused event.
       
   697         * @param aSessionId Session ID
       
   698         * @param aLinkId Link ID
       
   699         * @param aStreamId Stream ID
       
   700         * @param aSinkSourceId Sink or source ID
       
   701         */
       
   702         void MccMediaPaused( TUint32 aSessionId,
       
   703                                      TUint32 aLinkId,
       
   704                                      TUint32 aStreamId,
       
   705                                      TUint32 aSinkSourceId );
       
   706 
       
   707         /**
       
   708         * Callback function to receive media resumed event.
       
   709         * @param aSessionId Session ID
       
   710         * @param aLinkId Link ID
       
   711         * @param aStreamId Stream ID
       
   712         * @param aSinkSourceId Sink or source ID
       
   713         */
       
   714         void MccMediaResumed( TUint32 aSessionId,
       
   715                                       TUint32 aLinkId,
       
   716                                       TUint32 aStreamId,
       
   717                                       TUint32 aSinkSourceId );
       
   718 
       
   719  
       
   720         /**
       
   721         * Callback function to receive media inactivity event.
       
   722         * @param aSessionId Session ID
       
   723         * @param aLinkId Link ID
       
   724         * @param aStreamId Stream ID
       
   725         * @param aSinkSourceId Sink or source ID
       
   726         */
       
   727         void MccMediaInactive( TUint32 aSessionId,
       
   728                                        TUint32 aLinkId,
       
   729                                        TUint32 aStreamId,
       
   730                                        TUint32 aSinkSourceId );
       
   731 
       
   732         /**
       
   733         * Callback function to receive media activity event. The
       
   734         * function is called when the first RTP packet is received
       
   735         * by a downlink stream.
       
   736         * @param aSessionId Session ID
       
   737         * @param aLinkId Link ID
       
   738         * @param aStreamId Stream ID
       
   739         * @param aSinkSourceId Sink or source ID
       
   740         */
       
   741         void MccMediaActive( TUint32 aSessionId,
       
   742                                      TUint32 aLinkId,
       
   743                                      TUint32 aStreamId,
       
   744                                      TUint32 aSinkSourceId );
       
   745 
       
   746         /**
       
   747         * Callback function to receive error event.
       
   748         * @param aError Error code
       
   749         * @param aSessionId Session ID
       
   750         * @param aLinkId Link ID
       
   751         * @param aSinkSourceId Sink or source ID
       
   752         */
       
   753         void MccCtrlError( TInt aError,
       
   754                                    TUint32 aSessionId,
       
   755                                    TUint32 aLinkId,
       
   756                                    TUint32 aStreamId,
       
   757                                    TUint32 aSinkSourceId );
       
   758 
       
   759         
       
   760     public: // new functions
       
   761         
       
   762                 
       
   763         CMceSdpSession& CreateSessionL( CMceComSession& aSession );
       
   764         CMceSdpSession* SdpSession( CMceComSession& aSession );
       
   765         
       
   766         void CreateMccSessionL( CMceComSession& aSession );
       
   767         
       
   768         void InitializeMccStreamL( CMceSrvStream& aStream );
       
   769         void CreateMccLinkL( CMceSrvStream& aStream );
       
   770         void CreateMccStreamL( CMceSrvStream& aStream, 
       
   771                                TMceNegotiationRole aRole );
       
   772         void PrepareMccStreamL( CMceSrvStream& aStream, 
       
   773                                TMceNegotiationRole aRole );
       
   774         void StartMccStreamL( CMceSrvStream& aStream );
       
   775         void AdjustMccStreamL( CMceSrvStream& aStream );
       
   776         void ValidateMccStreamL( CMceSrvStream& aStream );
       
   777         void StopMccStream( CMceSrvStream& aStream );
       
   778     
       
   779         void SetRemoteAddressL( CMceSrvStream& aStream );
       
   780 
       
   781         void PrepareUpdateL( CMceSdpSession& aSession );
       
   782 
       
   783         void CleanupL( CMceComSession& aSession );
       
   784         
       
   785         void DisposeMediaStreamL( CMceComMediaStream* aStream );
       
   786         void DisposeCodecL( CMceComCodec* aCodec );
       
   787         
       
   788 
       
   789         CMceSdpCodec* SdpCodec( const CSdpMediaField& aMedia );
       
   790         CMceSdpCodec* SdpCodec( CMceComMediaStream& aStream );
       
   791         
       
   792         void SynchronizeMccStreamL( CMceSrvStream& aStream, 
       
   793                                     TMceNegotiationRole aRole,
       
   794                                     TBool aSyncCodecOnly = EFalse );
       
   795                                     
       
   796         void SynchronizeMccStreamL( CMceSrvStream& aStream, 
       
   797                                     TUint32 aForceEnableEndpoint = 0, 
       
   798                                     TUint32 aForceDisableEndpoint = 0 );
       
   799 
       
   800         TUint32 GetSSRCL( CMceSrvStream& aStream );
       
   801         void EnableViewFinderL( const CMceComMediaSink& aMediaSink, const TDesC8& aParam );
       
   802         void DisableViewFinderL( const CMceComMediaSink& aMediaSink );
       
   803                 
       
   804         TBool ReuseLink( CMceSrvStream& aStream );
       
   805         TBool ReuseSource( CMceSrvStream& aStream );
       
   806         TBool ReuseSink( CMceSrvStream& aStream );
       
   807 
       
   808         TBool CanReleaseEndpoint( CMceSrvStream& aStream, TUint32 aEndpointId );
       
   809         TInt ReleaseSink( CMceSrvStream& aStream, TUint32 aEndpointId );
       
   810         TInt ReleaseSource( CMceSrvStream& aStream, TUint32 aEndpointId );
       
   811         
       
   812 
       
   813         void SetMccParameterL( TUint32 aParam,
       
   814                                const TDesC8& aValue ) const;
       
   815         
       
   816         void GetMccParameterL( TUint32 aParam,
       
   817                                TDes8& aValue ) const;
       
   818                               
       
   819         void SetMccParameterL( const CMceComMediaSink& aMediaSink,
       
   820                               TUint32 aParam,
       
   821                               const TDesC8& aValue,
       
   822                               TBool aAllowNonPrepared = EFalse ) const;
       
   823         void SetMccParameterL( const CMceComMediaSource& aMediaSource,
       
   824                               TUint32 aParam,
       
   825                               const TDesC8& aValue,
       
   826                               TBool aAllowNonPrepared = EFalse ) const;
       
   827         void GetMccParameterL( const CMceComMediaSink& aMediaSink,
       
   828                               TUint32 aParam,
       
   829                               TDes8& aValue,
       
   830                               TBool aAllowNonPrepared = EFalse ) const;
       
   831         void GetMccParameterL( const CMceComMediaSource& aMediaSource,
       
   832                               TUint32 aParam,
       
   833                               TDes8& aValue,
       
   834                               TBool aAllowNonPrepared = EFalse ) const;
       
   835         
       
   836         void UpdateMccSourceL( CMceComCameraSource& aMediaSource );
       
   837         
       
   838         
       
   839     private: // for private usage only
       
   840 
       
   841         CMccCodecInformation* CreateMccCodecLC( CMceSrvStream& aStream,
       
   842                                                 TMceNegotiationRole aRole );
       
   843 
       
   844 
       
   845         void UpdateAcceptedL( CMceSdpSession& aSdpSession );
       
   846         
       
   847         void UpdateRejectedL( CMceSdpSession& aSdpSession );
       
   848         
       
   849 
       
   850         TInt RequireSignallingL( CMceComSession& aSession,
       
   851                                   CMceComSession& aBackup );
       
   852                                  
       
   853     
       
   854 
       
   855         void CleanupSessionL( CMceComSession& aSession );
       
   856     
       
   857 
       
   858         /** 
       
   859         * Gets Sdp session
       
   860         * @param aMccSessionId.
       
   861         * @return session if found, NULL otherwise
       
   862         */
       
   863         CMceComSession* Session( TUint32 aSessionId );
       
   864         
       
   865         /** 
       
   866         * Removes corresponding Sdp session(s), which is no longer needed
       
   867         */
       
   868         void RemoveSession( CMceSdpSession* sdpSession );
       
   869         
       
   870         CMceComFileSource* TranscodingSession( const CMceComFileSource& aFile ) const;
       
   871 
       
   872         CMceComFileSource* TranscodingSession( TUint32 aTcSessionId ) const;
       
   873    
       
   874        
       
   875         void MccTranscodeEventReceived( const TMccEvent& aEvent );
       
   876         
       
   877         TBool UseRtcp( CMceSrvStream& aStream );
       
   878         
       
   879         void FillMceFileInfoL( TMccFileSourceSetting& aMccFileInfo,
       
   880                                TMceFileInfo& aMceFileInfo ) const;
       
   881                                
       
   882         TBool DoStartEndpointsL( CMceSrvStream& aStream, 
       
   883                                  TUint32 aForceEnableEndpoint,
       
   884                                  TUint32 aForceDisableEndpoint );
       
   885                                
       
   886         TBool DoResumeEndpointsL( CMceSrvStream& aStream, TUint32 aForceEnableEndpoint );
       
   887        
       
   888         TBool DoPauseEndpointsL( CMceSrvStream& aStream, 
       
   889                                  TUint32 aForceDisableeEndpoint );
       
   890                                 
       
   891         void SetPendingState( CMceSrvStream& aStream, 
       
   892                               TUint32 aEndpointId, 
       
   893                               CMceSrvStream::TState aState );
       
   894                             
       
   895         TBool DoDtmfL( CMceComMediaSource& aSource, 
       
   896                        TMceComEvent& aEvent,
       
   897                        const TDesC8& aSequence,
       
   898                        TBool aUseBoundStream = EFalse );
       
   899         
       
   900         CMceComCodec* DoAdjustMccStreamL( CMceSrvStream& aStream );
       
   901         
       
   902         void DoConfigKeyUpdateL( CMceComMediaStream& aStream, HBufC8* aConfigKey );
       
   903         
       
   904         void CreateTranscodingOutputCodecsL( CMccCodecInformation** aAudioCodec ,
       
   905         								    CMccCodecInformation** aVideoCodec, 
       
   906         								    CMceComFileSource* aFile );
       
   907                 
       
   908     private:
       
   909     
       
   910         /**
       
   911         * By default Symbian 2nd phase constructor is private.
       
   912         */
       
   913         void ConstructL( MMceMediaGeneralObserver& aObserver );
       
   914                                                     
       
   915         
       
   916         /**
       
   917         * C++ default constructor
       
   918         */
       
   919         CMceMediaManager();
       
   920 
       
   921 	public :   // Data
       
   922 		
       
   923 		CMccSecureInterface* iMccSecureInterface; 
       
   924 
       
   925     private:    // Data
       
   926     
       
   927         // Pointer to MCCInterface, owned
       
   928         CMccInterface* iMccInterface; 
       
   929         
       
   930         // Pointer to CMceNatPluginManager, owned
       
   931         CMceNatPluginManager* iNatPluginManager;
       
   932 
       
   933         RPointerArray<CMceSdpSession> iMceSdpSessions;
       
   934         
       
   935         MMceMediaGeneralObserver* iObserver;
       
   936 
       
   937         // List of SDP codecs
       
   938         RPointerArray<CMceSdpCodec> iSdpCodecs;
       
   939         
       
   940         RPointerArray<CMceComFileSource> iTranscodeSessions;
       
   941 
       
   942         
       
   943 
       
   944     private:
       
   945     
       
   946         friend class CMceSdpSession;
       
   947         
       
   948     	//definitions for unit testing
       
   949     	MCEMM_UT_DEFINITIONS
       
   950     	friend class UT_CMceSecureDesStream;
       
   951     	friend class UT_CMceSecureMediaSession;
       
   952     };
       
   953 
       
   954 #endif      // CMCEMEDIAMANAGER_H   
       
   955             
       
   956 // End of File