multimediacommsengine/mmcesrv/mmcemediamanager/inc/mceaudiosdpcodec.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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 CMCEAUDIOSDPCODEC_H
       
    22 #define CMCEAUDIOSDPCODEC_H
       
    23 
       
    24 #include "mcemediasdpcodec.h"
       
    25 
       
    26 class CMceComAudioStream;
       
    27 class CMceComAudioCodec;
       
    28 
       
    29 
       
    30 #define MCE_SDP_STRING_AUDIOL()\
       
    31         SdpCodecStringPool::StringPoolL().StringF( \
       
    32         SdpCodecStringConstants::EMediaAudio,\
       
    33         SdpCodecStringPool::StringTableL() )
       
    34 
       
    35 /**
       
    36  * 
       
    37  *
       
    38  * @lib 
       
    39  */
       
    40 class CMceAudioSdpCodec: public CMceMediaSdpCodec
       
    41     {
       
    42 
       
    43     public://constructor and destructor
       
    44     
       
    45         /**
       
    46         * Constructor
       
    47         */
       
    48         static CMceAudioSdpCodec* NewL();
       
    49         
       
    50         /**
       
    51         * Destructor
       
    52         */
       
    53         ~CMceAudioSdpCodec();
       
    54         
       
    55 
       
    56     public: //from CMceSdpCodec
       
    57         
       
    58         /**
       
    59         * Returns ETrue, if media is encoded by this codec
       
    60         * @return ETrue, if media is encoded by this codec
       
    61         */
       
    62         TBool Encodes( const CMceComMediaStream& aStream ) const;
       
    63         
       
    64         
       
    65     public: //from CMceMediaSdpCodec
       
    66     
       
    67 
       
    68         /**
       
    69         * Returns codecs
       
    70         * @param aStream media stream
       
    71         * @param return codecs
       
    72         * @leave if stream type does not macth codecs
       
    73         */
       
    74         const RPointerArray<CMceComCodec>& CodecsL( CMceComMediaStream& aStream ) const;
       
    75 
       
    76         /**
       
    77         * Encodes rtpmap -attribute
       
    78         * @param aCodec codec encoded to rtpmap
       
    79         * @leave system wide error
       
    80         */
       
    81         CSdpFmtAttributeField* EncodeRtpmapAttributeLC( CMceComCodec& aCodec ) const;
       
    82         
       
    83         /**
       
    84         * Encodes media related attributes
       
    85         * @param aCodec the codec
       
    86         * @param aMediaLine media line
       
    87         * @param aRtpmap rtpmap attribute
       
    88         * @leave system wide error
       
    89         */
       
    90         void EncodeMediaAttributesL( CMceComCodec& aCodec, 
       
    91                                      CSdpMediaField& aMediaLine, 
       
    92                                      CSdpFmtAttributeField& aRtpmap ) const;
       
    93 
       
    94         /**
       
    95         * Decodes media related attributes
       
    96         * @param aMediaLine media line
       
    97         * @param aCodec the codec
       
    98         * @leave system wide error
       
    99         */
       
   100        	void DecodeMediaAttributesL( CSdpMediaField& aMediaLine, 
       
   101                                      CMceComCodec& aCodec,
       
   102                                      CSdpFmtAttributeField& aRtpmap ) const;
       
   103 
       
   104         /**
       
   105         * Creates media stream based on sdp type
       
   106         * @param aType the sdp type sendrecv, sendonly or receive only
       
   107         * @return media stream
       
   108         * @leave system wide error
       
   109         */
       
   110         CMceComMediaStream* CreateStreamLC( TInt aType ) const;
       
   111         
       
   112         /**
       
   113         * Updates media based on received offer
       
   114         * @param aStream media stream
       
   115         * @param aDirection the direction 
       
   116         * @leave system wide error
       
   117         */
       
   118         void UpdateStreamL( CMceComMediaStream& aStream, TInt aDirection ) const;
       
   119         
       
   120         /**
       
   121         * Creates codec based on rtpmap line
       
   122         * @param aRtpmap rtpmap line
       
   123         * @return codec or NULL, if not supported
       
   124         * @leave system wide error
       
   125         */
       
   126         CMceComCodec* CreateCodecLC( CSdpFmtAttributeField& aRtpmap ) const;
       
   127         
       
   128         /**
       
   129         * Creates codec based on payload type
       
   130         * @param aPayload payload
       
   131         * @param aMediaLine media line
       
   132         * @return codec or NULL, if not supported
       
   133         * @leave system wide error
       
   134         */
       
   135         CMceComCodec* CreateCodecLC( TUint aPayload, CSdpMediaField& aMediaLine ) const;
       
   136         
       
   137         /**
       
   138         * Decodes session level media attributes
       
   139         * @param aStream media stream
       
   140         * @param aSdpDocument sdp document
       
   141         * @return codec or NULL, if not supported
       
   142         * @leave system wide error
       
   143         */
       
   144         void DecodeSessionMediaAttributesL( CMceComMediaStream& aStream, 
       
   145                                             CSdpDocument& aSdpDocument ) const;
       
   146          
       
   147     private:
       
   148                                  
       
   149 
       
   150         /**
       
   151         * C++ Constructor
       
   152         * @param aMedia media
       
   153         */
       
   154         CMceAudioSdpCodec( RStringF aMedia );
       
   155 
       
   156         /**
       
   157         * Creates uplink audio stream with mic and rtp sink
       
   158         * @return uplink audio stream
       
   159         */
       
   160         CMceComAudioStream* CreateUplinkStreamL() const;
       
   161         
       
   162         /**
       
   163         * Creates downlink audio stream with rtp source and speaker
       
   164         * @return downlink audio stream
       
   165         */
       
   166         CMceComAudioStream* CreateDownlinkStreamL() const;
       
   167         
       
   168     
       
   169     };
       
   170 
       
   171 
       
   172 
       
   173 #endif //CMCEAUDIOSDPCODEC_H
       
   174