sipvoipprovider/inc/svpaudioutility.h
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Static audio utility functions for SVP.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SVPAUDIOUTILITY_H
       
    20 #define SVPAUDIOUTILITY_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CMceAudioStream;
       
    27 class CSVPSessionBase;
       
    28 class CSVPEmergencySession;
       
    29 
       
    30 /**
       
    31  * SVPAudioUtility class contains static audio related utility functions.
       
    32  * 
       
    33  * @lib svp.dll
       
    34  * @since S60 v3.2
       
    35  */
       
    36 class SVPAudioUtility
       
    37     {
       
    38 public: // new methods
       
    39 
       
    40     /**
       
    41      * Determines if the given audiostream is downlink (in) stream.
       
    42      * @since S60 v3.2
       
    43      * @param aStream Audiostream whose direction to determine.
       
    44      * @return TBool ETrue if given stream is downlinkstream, EFalse otherwise.
       
    45      */
       
    46     static TBool IsDownlinkStream( CMceAudioStream& aStream );
       
    47     
       
    48     /**
       
    49      * Sets MMF priorities to streams
       
    50      * @since S60 3.2
       
    51      * @param aAudioInStream Representation of MCE audio stream
       
    52      * @param aAudioOutStream Representation of MCE audio stream
       
    53      * @return TBool ETrue if outband DTMF (tel-event) is used in
       
    54      *               audiostreams.
       
    55      *               EFalse if Inband DTMF is used in audiostreams.
       
    56      */
       
    57     static TBool SetPriorityCodecValuesL( CMceAudioStream& aAudioInStream,
       
    58                                           CMceAudioStream& aAudioOutStream );
       
    59                                           
       
    60     /**
       
    61      * Sets audio priority values to streams. Note that this does not
       
    62      * return information about DTMF status. If both streams are not type
       
    63      * KMceAudioStream, this function leaves with KErrArgument.
       
    64      * @since S60 v3.2
       
    65      * @aMediaStream Representation of MCE media stream
       
    66      * @aBoundStream Representation of MCE media stream, bound to aMediaStream
       
    67      * @return void
       
    68      */
       
    69     static void SetAudioStreamPrioritiesL( CMceMediaStream& aMediaStream,
       
    70                                            CMceMediaStream& aBoundStream );
       
    71     
       
    72     /**
       
    73      * Enables speaker sink from aSink array if found.
       
    74      * @since S60 v3.2
       
    75      * @param aSink Array of media sinks.
       
    76      * @return void
       
    77      */
       
    78     static void EnableSpeakerSinkL(
       
    79         const RPointerArray< CMceMediaSink >& aSink );
       
    80     
       
    81     /**
       
    82      * Disables speaker sink from aSink array if found.
       
    83      * @since S60 v3.2
       
    84      * @param aSink Array of media sinks.
       
    85      * @return void
       
    86      */
       
    87     static void DisableSpeakerSinkL( 
       
    88         const RPointerArray< CMceMediaSink >& aSink );
       
    89     
       
    90     /**
       
    91      * Enables aMicSource if it's type is KMceMicSource.
       
    92      * @since S60 v3.2
       
    93      * @param aMicSource Media source
       
    94      * @return void
       
    95      */
       
    96     static void EnableMicSourceL( CMceMediaSource& aMicSource );
       
    97     
       
    98     /**
       
    99      * Disables aMicSource if it's type is KMceMicSource.
       
   100      * @since S60 v3.2
       
   101      * @param aMicSource
       
   102      * @return void
       
   103      */
       
   104     static void DisableMicSourceL( CMceMediaSource& aMicSource );
       
   105     
       
   106     /**
       
   107      * Enables speaker sinks from aStreams array if found and types of media
       
   108      * streams are KMceAudio.
       
   109      * @since S60 v3.2
       
   110      * @param aStreams Array of media streams.
       
   111      * @return void
       
   112      */
       
   113     static void EnableSpeakerSinksL(
       
   114         const RPointerArray< CMceMediaStream >& aStreams );
       
   115         
       
   116     /**
       
   117      * Disables mic from given media stream or from it's bound stream if
       
   118      * mic source is found from either of the streams.
       
   119      * @since S60 v3.2
       
   120      * @param aStream Media stream
       
   121      * @return void
       
   122      */
       
   123     static void DisableMicSourceL( CMceMediaStream& aStream );
       
   124     
       
   125     /**
       
   126      * Finds a codec of name aCodecname from aAudiostream. Returns NULL if not
       
   127      * found
       
   128      * @since S60 v3.2
       
   129      * @param aAudiostream Audiostream from where to search the codec.
       
   130      * @param aCodecname Name of the codec to search
       
   131      * @return CMceAudioCodec Pointer to the found codec or NULL if not found.
       
   132      */
       
   133     static CMceAudioCodec* FindCodec(
       
   134         CMceAudioStream& aAudiostream, const TDesC8& aCodecname );
       
   135     
       
   136     /**
       
   137      * Removes a codec of name aCodecname from aAudiostream if found.
       
   138      * @since S60 v3.2
       
   139      * @param aAudiostream Audiostream from where to remove the codec.
       
   140      * @param aCodecname Name of the codec to remove
       
   141      * @return void
       
   142      */
       
   143     static void RemoveCodecL( CMceAudioStream& aAudiostream,
       
   144         const TDesC8& aCodecname );
       
   145     
       
   146     /**
       
   147      * Checks the media streams if MMF priority update is needed. Function
       
   148      * assumes that all media streams are of type KMceAudio and will leave
       
   149      * with KErrArgument if it encounters other types of media streams.
       
   150      * @since S60 v3.2
       
   151      * @param aStreams Streams to check if the priority update is needed.
       
   152      * @return TBool ETrue if priority update is needed, EFalse otherwise.
       
   153      */
       
   154     static TBool MmfPriorityUpdateNeededL(
       
   155         const RPointerArray<CMceMediaStream>& aStreams );
       
   156     
       
   157     /**
       
   158      * Checks whether given SVP session is capable to DTMF action
       
   159      * (send, stop, etc.). This means that session
       
   160      * a) does not have HoldController.
       
   161      * b) has HoldController, but is in 'connected' state.
       
   162      * @since S60 v3.2
       
   163      * @param aSession SVP session to check.
       
   164      * @return ETrue If DTMF action can be performed.
       
   165      */
       
   166     static TBool DtmfActionCapableSession(
       
   167         const CSVPSessionBase& aSession );
       
   168 
       
   169     /**
       
   170      * Checks whether given SVP emergency session is capable to DTMF action
       
   171      * (send, stop, etc.). This means that session
       
   172      * a) does not have HoldController.
       
   173      * b) has HoldController, but is in 'connected' state.
       
   174      * @since S60 v3.2
       
   175      * @param aSession SVP emergency session to be check.
       
   176      * @return ETrue If DTMF action can be performed.
       
   177      */
       
   178     static TBool DtmfActionCapableSession(
       
   179         const CSVPEmergencySession& aSession );
       
   180             
       
   181     /**
       
   182      * Checks whether given MCE stream is capable to DTMF action
       
   183      * (send, stop, etc.). This means that stream:
       
   184      * a) Is a MCE audio stream.
       
   185      * b) It has a source.
       
   186      * c) It's source is enabled.
       
   187      * MCE server will handle the rest of the checks and actual DTMF
       
   188      * action will return a error code.
       
   189      * @since S60 v3.2
       
   190      * @param aStream MCE stream to check.
       
   191      * @return ETrue If DTMF action can be performed.
       
   192      */
       
   193     static TBool DtmfActionCapableStream( const CMceMediaStream& aStream );
       
   194         
       
   195 private: // new methods
       
   196 
       
   197     /**
       
   198      * C++ default constructor.
       
   199      */
       
   200     SVPAudioUtility();
       
   201     
       
   202     /**
       
   203      * Method for setting DTMF priority for DTMF codec in aAudioStream if
       
   204      * found from it.
       
   205      * @since S60 v3.2
       
   206      * @param aAudioStream Representation of Mce audio stream.
       
   207      * @return TBool ETrue if aAudioStream contained DTMF codec.
       
   208      */
       
   209     static TBool SetDtmfPriorityL( CMceAudioStream& aAudioStream );
       
   210     
       
   211     /**
       
   212      * Method for setting audio priority and preference for audio codecs.
       
   213      * @since S60 v3.2
       
   214      * @param aAudioStream Representation of Mce audio stream.
       
   215      * @param aAudioPref Audio preference value to be used for the codecs.
       
   216      * @return void
       
   217      */
       
   218     static void SetAudioCodecPrioritiesL( CMceAudioStream& aAudioStream,
       
   219         TUint aAudioPref );
       
   220         
       
   221     /**
       
   222      * Checks a uplink audiostream whether it needs an MMF priority/preference
       
   223      * update.
       
   224      * @since S60 v3.2
       
   225      * @param aUplinkStream Uplink stream to check if it needs priority or
       
   226      *                      preference update.
       
   227      * @return TBool ETrue if priority update is needed, EFalse otherwise.
       
   228      */
       
   229     static TBool MmfPriorityUpdateNeededL( CMceAudioStream& aUplinkStream );
       
   230     
       
   231     };
       
   232 
       
   233 #endif // SVPAUDIOUTILITY_H