multimediacommsengine/mmcesrv/mmcemediamanager/inc/mcevideosdpcodec.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 CMCEVIDEOSDPCODEC_H
       
    22 #define CMCEVIDEOSDPCODEC_H
       
    23 
       
    24 #include "mcemediasdpcodec.h"
       
    25 
       
    26 class CMceComVideoCodec;
       
    27 class CMceComVideoStream;
       
    28 
       
    29 #define MCE_SDP_STRING_VIDEOL()\
       
    30         SdpCodecStringPool::StringPoolL().StringF( \
       
    31         SdpCodecStringConstants::EMediaVideo,\
       
    32         SdpCodecStringPool::StringTableL() )
       
    33 
       
    34 
       
    35 
       
    36 
       
    37 /**
       
    38  * 
       
    39  *
       
    40  * @lib 
       
    41  */
       
    42 class CMceVideoSdpCodec : public CMceMediaSdpCodec
       
    43     {
       
    44 
       
    45     public://constructor and destructor
       
    46     
       
    47         /**
       
    48         * Constructor
       
    49         */
       
    50         static CMceVideoSdpCodec* NewL();
       
    51         
       
    52         /**
       
    53         * Destructor
       
    54         */
       
    55         ~CMceVideoSdpCodec();
       
    56         
       
    57 
       
    58     public: //from CMceSdpCodec
       
    59         
       
    60         /**
       
    61         * Returns ETrue, if media is encoded by this codec
       
    62         * @return ETrue, if media is encoded by this codec
       
    63         */
       
    64         TBool Encodes( const CMceComMediaStream& aStream ) const;
       
    65         
       
    66         
       
    67     public: //from CMceMediaSdpCodec
       
    68     
       
    69 
       
    70         /**
       
    71         * Returns codecs
       
    72         * @param aStream media stream
       
    73         * @param return codecs
       
    74         * @leave if stream type does not macth codecs
       
    75         */
       
    76         const RPointerArray<CMceComCodec>& CodecsL( CMceComMediaStream& aStream ) const;
       
    77 
       
    78         /**
       
    79         * Encodes rtpmap -attribute
       
    80         * @param aCodec codec encoded to rtpmap
       
    81         * @leave system wide error
       
    82         */
       
    83         CSdpFmtAttributeField* EncodeRtpmapAttributeLC( CMceComCodec& aCodec ) const;
       
    84         
       
    85         /**
       
    86         * Encodes media related attributes
       
    87         * @param aCodec the codec
       
    88         * @param aMediaLine media line
       
    89         * @param aRtpmap rtpmap attribute
       
    90         * @leave system wide error
       
    91         */
       
    92         void EncodeMediaAttributesL( CMceComCodec& aCodec, 
       
    93                                      CSdpMediaField& aMediaLine, 
       
    94                                      CSdpFmtAttributeField& aRtpmap ) const;
       
    95 
       
    96         /**
       
    97         * Decodes media related attributes
       
    98         * @param aMediaLine media line
       
    99         * @param aCodec the codec
       
   100         * @leave system wide error
       
   101         */
       
   102         
       
   103 		void DecodeMediaAttributesL( CSdpMediaField& aMediaLine,
       
   104                                      CMceComCodec& aCodec,
       
   105                                      CSdpFmtAttributeField& aRtpmap ) const;		                                     
       
   106 
       
   107         /**
       
   108         * Creates media stream based on sdp type
       
   109         * @param aType the sdp type sendrecv, sendonly or receive only
       
   110         * @return media stream
       
   111         * @leave system wide error
       
   112         */
       
   113         CMceComMediaStream* CreateStreamLC( TInt aType ) const;
       
   114         
       
   115         /**
       
   116         * Updates media based on received offer
       
   117         * @param aStream media stream
       
   118         * @param aDirection the direction 
       
   119         * @leave system wide error
       
   120         */
       
   121         void UpdateStreamL( CMceComMediaStream& aStream, TInt aDirection ) const;
       
   122         
       
   123         /**
       
   124         * Creates codec based on rtpmap line
       
   125         * @param aRtpmap rtpmap line
       
   126         * @return codec or NULL, if not supported
       
   127         * @leave system wide error
       
   128         */
       
   129         CMceComCodec* CreateCodecLC( CSdpFmtAttributeField& aRtpmap ) const;
       
   130         
       
   131         /**
       
   132         * Creates codec based on payload type
       
   133         * @param aPayload payload
       
   134         * @param aMediaLine media line
       
   135         * @return codec or NULL, if not supported
       
   136         * @leave system wide error
       
   137         */
       
   138         CMceComCodec* CreateCodecLC( TUint aPayload, CSdpMediaField& aMediaLine ) const;
       
   139         
       
   140         /**
       
   141         * Decodes session level media attributes
       
   142         * @param aStream media stream
       
   143         * @param aSdpDocument sdp document
       
   144         * @return codec or NULL, if not supported
       
   145         * @leave system wide error
       
   146         */
       
   147         void DecodeSessionMediaAttributesL( CMceComMediaStream& aStream, 
       
   148                                             CSdpDocument& aSdpDocument ) const;
       
   149         
       
   150     private:
       
   151 
       
   152     
       
   153         /**
       
   154         * C++ Constructor
       
   155         * @param aMedia media
       
   156         */
       
   157         CMceVideoSdpCodec( RStringF aMedia );
       
   158         
       
   159         /**
       
   160         * 2nd phase constructor
       
   161         */
       
   162         void ConstructL();
       
   163         
       
   164 
       
   165         /**
       
   166         * Encodes framerate attribute
       
   167         * @param aCodec the codec
       
   168         * @param aMediaLine media line
       
   169         * @param aRtpmap rtpmap attribute
       
   170         * @leave system wide error
       
   171         */
       
   172         void EncodeFrameRateAttributeL( CMceComVideoCodec& aCodec,
       
   173                                         CSdpMediaField& aMedia,
       
   174                                         CSdpFmtAttributeField& aFmtpline ) const;
       
   175     
       
   176         /**
       
   177         * Encodes framesize attribute
       
   178         * @param aCodec the codec
       
   179         * @param aMediaLine media line
       
   180         * @param aRtpmap rtpmap attribute
       
   181         * @leave system wide error
       
   182         */
       
   183         void EncodeFrameSizeAttributeL( CMceComVideoCodec& aCodec,
       
   184                                         CSdpMediaField& aMedia,
       
   185                                         CSdpFmtAttributeField& aFmtpline ) const;
       
   186 
       
   187 
       
   188         /**
       
   189         * Creates uplink video stream with camera and rtp sink
       
   190         * @return uplink video stream
       
   191         */
       
   192         CMceComVideoStream* CreateUplinkStreamL() const;
       
   193         
       
   194         /**
       
   195         * Creates downlink video stream with rtp source and display
       
   196         * @return downlink video stream
       
   197         */
       
   198         CMceComVideoStream* CreateDownlinkStreamL() const;
       
   199         
       
   200     
       
   201     
       
   202     private:
       
   203     
       
   204         RStringF iFrameSizeAttr;
       
   205         
       
   206     
       
   207     };
       
   208 
       
   209 
       
   210 
       
   211 #endif //CMCEVIDEOSDPCODEC_H