multimediacommscontroller/mmcccontroller/inc/mccresources.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006 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 #ifndef MCCRESOURCES_H
       
    22 #define MCCRESOURCES_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "rtpdef.h"
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // DATA TYPES
       
    33 
       
    34 // FUNCTION PROTOTYPES
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class MDataSink;
       
    38 class MDataSource;
       
    39 class TMccEvent;
       
    40 class CMccMultiplexer;
       
    41 class MMccTimerManager;
       
    42 class CMMFBuffer;
       
    43 class TMccVideoSinkSetting;
       
    44 
       
    45 // CLASS DECLARATION
       
    46 
       
    47 class TMccResourceParams
       
    48     {
       
    49 public:
       
    50 
       
    51     TMccResourceParams( TUint32 aSessionId, 
       
    52                         TUint32 aLinkId, 
       
    53                         TUint32 aStreamId,
       
    54                         TUint32 aIapId,
       
    55                         TBool aIsStandby,
       
    56                         TInt aStreamType ) :
       
    57         iSessionId( aSessionId ),
       
    58         iLinkId( aLinkId ),
       
    59         iStreamId( aStreamId ),
       
    60         iIapId( aIapId ),
       
    61         iIsStandby( aIsStandby ),
       
    62         iStreamType( aStreamType ),
       
    63         iIsStopped( EFalse )
       
    64         {
       
    65         }
       
    66         
       
    67 public:
       
    68 
       
    69     TUint32 iSessionId;
       
    70     TUint32 iLinkId;
       
    71     TUint32 iStreamId; 
       
    72     TUint32 iIapId;
       
    73     TBool iIsStandby; 
       
    74     TInt iStreamType;
       
    75     TBool iIsStopped;
       
    76       
       
    77     };
       
    78     
       
    79 /**
       
    80 *
       
    81 */
       
    82 class MMccResources
       
    83     {
       
    84     public:
       
    85     
       
    86         enum TResourceState
       
    87             {
       
    88             EConstructed,
       
    89             EPrepared,
       
    90             EStarted,
       
    91             EResourcePaused,
       
    92             EResourceStopped
       
    93             };
       
    94     
       
    95     public:
       
    96     
       
    97         /**
       
    98         * Stores sink as candidate for next stream resource reservation.
       
    99         * @param aSink
       
   100         * @param aEndpointId id of the sink
       
   101         */
       
   102         virtual void ReserveSinkL( MDataSink* aSink, TUint32 aEndpointId ) = 0;
       
   103         
       
   104         /**
       
   105         * Stores source as candidate for next stream resource reservation.
       
   106         * @param aSource
       
   107         * @param aEndpointId id of the sink
       
   108         */
       
   109         virtual void ReserveSourceL( MDataSource* aSource, TUint32 aEndpointId ) = 0;
       
   110         
       
   111         /**
       
   112         * Prepares resources for removing certain endpoint.
       
   113         * @param aEndpointId id of the endpoint to be removed
       
   114         * @param aAffectedStreams information about streams which are using
       
   115         *        the endpoint which is in removal process
       
   116         */
       
   117         virtual void PrepareEndpointRemovalL( TUint32 aEndpointId, 
       
   118                                       RArray<TMccResourceParams>& aAffectedStreams ) = 0;
       
   119         
       
   120         /**
       
   121         * Removes endpoint from resources.
       
   122         * @param aEndpointId
       
   123         */
       
   124         virtual void RemoveEndpointL( TUint32 aEndpointId ) = 0;
       
   125         
       
   126         /**
       
   127         * Reserves some stream specific resources if needed. May depend
       
   128         * on state of the stream (e.g. camera resources are needed when live video
       
   129         * upstream is in playing state).
       
   130         * @param aParams resource parameters
       
   131         */                              
       
   132         virtual void ReserveResourcesL( const TMccResourceParams& aParams ) = 0;
       
   133         
       
   134         /**
       
   135         * Free resources of certain stream.
       
   136         * @param aStreamId
       
   137         */                                
       
   138         virtual void FreeResources( TUint32 aStreamId ) = 0;
       
   139          
       
   140         /**
       
   141         * Checks whether stream can use resources it needs.
       
   142         * @param aStreamId
       
   143         * @return ETrue if resources can be used
       
   144         */                         
       
   145         virtual TBool IsResourceUsageAllowed( TUint32 aStreamId ) = 0;                         
       
   146          
       
   147         /**
       
   148         * Sets resource state.
       
   149         * @param aStreamId
       
   150         * @param aEndpointId
       
   151         * @param aState
       
   152         * @param aControlNetworkResources on return tells whether resource
       
   153         *        needs network resources
       
   154         * @param aControlledEndpoint on return contains list of endpoint
       
   155         *        ids of which changed state because of this command
       
   156         * @param aUncontrolledEndpoints on return contains list of endpoint
       
   157         *        ids of which didn't change state although command was pointed
       
   158         *        for those. 
       
   159         */                                    
       
   160         virtual void SetResourceStateL( TUint32 aStreamId,
       
   161                                         TUint32 aEndpointId, 
       
   162                                         TResourceState aState,
       
   163                                         TBool& aControlNetworkResources,
       
   164                                         RArray<TUint32>& aControlledEndpoints,
       
   165                                         RArray<TUint32>& aUncontrolledEndpoints ) = 0;
       
   166         
       
   167         /**
       
   168         * Should be called by user after state change has been completed
       
   169         * successfully.
       
   170         */                                    
       
   171         virtual void ResourceStateSetL() = 0;
       
   172         
       
   173         /**
       
   174         * Check if resources are affected becuase of event.
       
   175         * @param aDiscardEvent on return ETrue if event should be discarded
       
   176         * @param aEffectiveStandby on return ETrue if event was effective
       
   177         *        standby event
       
   178         * @param aAdditionalEvent on return contains NULL or additional event
       
   179         *        which should be handled as well. Ownership of event is
       
   180         *        transferred.
       
   181         * @return error code
       
   182         */
       
   183         virtual TInt EventReceived( TMccEvent& aEvent, 
       
   184                                     TBool& aDiscardEvent,
       
   185                                     TBool& aEffectiveStandby,
       
   186                                     TMccEvent** aAdditionalEvent ) = 0;
       
   187         
       
   188         /**
       
   189         * Get sinks.
       
   190         * @param aOnlyInternals ETrue if only mcc internal sinks are fetched.
       
   191         * @return list of sinks
       
   192         */
       
   193         virtual const RPointerArray<MDataSink>& Sinks( TBool aOnlyInternals ) = 0;
       
   194         
       
   195         /**
       
   196         * Get sources.
       
   197         * @param aOnlyInternals ETrue if only mcc internal sources are fetched.
       
   198         * @return list of sources
       
   199         */
       
   200         virtual const RPointerArray<MDataSource>& Sources( TBool aOnlyInternals ) = 0;
       
   201         
       
   202         /**
       
   203         * Get multiplexer for specific source
       
   204         * @param aSource
       
   205         * @return NULL or multiplexer, ownership is not transferred
       
   206         */
       
   207         virtual CMccMultiplexer* MultiplexerL( MDataSource* aSource ) = 0;
       
   208         
       
   209         /**
       
   210         * Find resource
       
   211         * @param aLinkId search term
       
   212         * @param aEndpointId search term
       
   213         * @param aResourceUid search term
       
   214         * @param aSource on return NULL or source, ownership is not transferred
       
   215         * @param aSink on return NULL or sink, ownership is not transferred
       
   216         * @return KErrNone if resource was found
       
   217         */
       
   218         virtual TInt FindResource( TUint32 aLinkId,
       
   219                                    TUint32 aEndpointId, 
       
   220                                    TUid aResourceUid, 
       
   221                                    MDataSource** aSource, 
       
   222                                    MDataSink** aSink ) = 0;
       
   223         
       
   224         /**
       
   225         * Find network resource based on rtp stream id
       
   226         * @param aMccSessionId MCC session id
       
   227         * @param aRtpStreamId search term
       
   228         * @param aSource on return NULL or source, ownership is not transferred
       
   229         * @param aSink on return NULL or sink, ownership is not transferred
       
   230         * @return KErrNone if resource was found
       
   231         */                           
       
   232         virtual TInt FindNetworkResourceByRtpStreamId( 
       
   233                                   const TUint32 aMccSessionId,
       
   234                                   const TRtpId& aRtpStreamId,
       
   235                                   MDataSource** aSource, 
       
   236                                   MDataSink** aSink ) = 0;
       
   237         
       
   238         /**
       
   239         * Find network resource based on rtp ssrc
       
   240         * @param aRtpSsrc search term
       
   241         * @param aSource on return NULL or source, ownership is not transferred
       
   242         * @param aSink on return NULL or sink, ownership is not transferred
       
   243         * @return KErrNone if resource was found
       
   244         */        
       
   245         virtual TInt FindNetworkResourceByRtpSsrc( 
       
   246                                   const TRtpSSRC& aRtpSsrc,
       
   247                                   MDataSource** aSource, 
       
   248                                   MDataSink** aSink ) = 0;
       
   249         
       
   250         /**
       
   251         * Timer services.
       
   252         * @return timer
       
   253         */                          
       
   254         virtual MMccTimerManager& TimerManager() = 0;
       
   255         
       
   256         /**
       
   257         * Store information about keyframe, can be helpful when some other endpoint
       
   258         * needs to know whether some buffer is keyframe as that information cannot
       
   259         * be carried in CMMFBuffer.
       
   260         * @param aEndpointId
       
   261         * @param aKeyFrame
       
   262         */  
       
   263         virtual void StoreKeyFrameInfoL( TUint32 aEndpointId, CMMFBuffer& aKeyFrame ) = 0;
       
   264         
       
   265         /**
       
   266         * Check whether buffer is keyframe.
       
   267         * @param aEndpointId
       
   268         * @param aBuffer
       
   269         * @return ETrue if buffer contains keyframe
       
   270         */
       
   271         virtual TBool IsKeyFrame( TUint32 aEndpointId, CMMFBuffer& aBuffer ) = 0;
       
   272         
       
   273         /**
       
   274         * Enables viewfinder
       
   275         */
       
   276         virtual void EnableViewFinderL( TMccVideoSinkSetting& aSetting ) = 0;
       
   277         
       
   278         /**
       
   279         * Disables viewfinder
       
   280         */
       
   281         virtual void DisableViewFinderL() = 0;
       
   282 
       
   283     };
       
   284 
       
   285 #endif      // MCCRESOURCES_H   
       
   286             
       
   287 // End of File