multimediacommsengine/mmceshared/inc/mcecomaudiostream.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 CMCECOMAUDIOSTREAM_H
       
    22 #define CMCECOMAUDIOSTREAM_H
       
    23 
       
    24 #include <e32std.h>  		
       
    25 #include "mcecommediastream.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 
       
    29 class CMceComAudioCodec;
       
    30 
       
    31 /**
       
    32  * 
       
    33  *
       
    34  * @lib 
       
    35  */
       
    36 class CMceComAudioStream : public CMceComMediaStream
       
    37 	{
       
    38 
       
    39 public: // Constructors and destructor
       
    40 
       
    41     /**
       
    42     * Constructor
       
    43     */
       
    44     static CMceComAudioStream* NewL();
       
    45 
       
    46     /**
       
    47     * Constructor
       
    48     */
       
    49     static CMceComAudioStream* NewLC();
       
    50 
       
    51     /**
       
    52     * Destructor.
       
    53     */
       
    54 	~CMceComAudioStream();
       
    55 
       
    56 public: // Functions
       
    57 
       
    58     /**
       
    59     * Adds codec to the stream.
       
    60     * @param aCodec codec to be added to the stream.
       
    61 	*	     Ownership is transferred.
       
    62     */
       
    63 	void AddCodecL( CMceComCodec* aCodec );
       
    64 
       
    65     /**
       
    66     * Removes codec from the stream.
       
    67     * @param aCodec codec to be added to the stream.
       
    68 	*	     Ownership is transferred.
       
    69     */
       
    70     void RemoveCodecL( CMceComCodec* aCodec );
       
    71 	
       
    72 	/**
       
    73 	* Return pointer to codec from the list of codecs.
       
    74 	* aIndex index of codec to get.
       
    75 	*/
       
    76 	CMceComAudioCodec* CodecL( TInt aIndex ) const;
       
    77 
       
    78 	/**
       
    79 	* Returns number of codecs in the stream.
       
    80 	*/
       
    81 	TInt CodecCount() const;
       
    82 	
       
    83     /**
       
    84     * Returns the available codecs to the session.
       
    85     * @return codecs available for the session.
       
    86     */
       
    87 	const RPointerArray<CMceComAudioCodec>& Codecs() const;
       
    88 
       
    89 public: // from CMceComMediaStream
       
    90 
       
    91     /**
       
    92     * Internalizes flat data
       
    93     * @param aReadStream read stream
       
    94     */
       
    95     void InternalizeFlatL( RReadStream& aReadStream );
       
    96 
       
    97     /**
       
    98     * Externalizes flat data
       
    99     * @param aWriteStream write stream
       
   100     */
       
   101     void ExternalizeFlatL( RWriteStream& aWriteStream );
       
   102     
       
   103     /**
       
   104     * Internalizes
       
   105     * @param aReadStream read stream
       
   106     */
       
   107     void InternalizeL( MMceComSerializationContext& aSerCtx );
       
   108     
       
   109     /**
       
   110     * Externalizes
       
   111     * @param aWriteStream write stream
       
   112     */
       
   113     void ExternalizeL( MMceComSerializationContext& aSerCtx );
       
   114 
       
   115 
       
   116 public://from CMceComMediaStream
       
   117 
       
   118 
       
   119     /**
       
   120     * Initializes 
       
   121     * @param aParent the parent
       
   122     */
       
   123     void InitializeL( CMceComSession& aParent );
       
   124 
       
   125     /**
       
   126     * Updates 
       
   127     * @param aStream new stream
       
   128     */
       
   129     void UpdateL( CMceComMediaStream& aStream );
       
   130 
       
   131     /**
       
   132     * Clones
       
   133     */
       
   134     CMceComMediaStream* CloneL();
       
   135     
       
   136     void ReorderCodecs();
       
   137 
       
   138 #ifdef MCE_COMMON_SERVER_SIDE
       
   139 
       
   140     /**
       
   141     * Synchronizes stream's codecs
       
   142     * @param aRoleAnswerer is answerer
       
   143     */
       
   144     void SynchronizeL( TBool aRoleAnswerer );
       
   145     
       
   146     /**
       
   147     * Update default codec to reflect current negotiation
       
   148     */
       
   149     void UpdateDefaultCodecL();
       
   150 
       
   151     /**
       
   152     * Prepares stream for offer/answer
       
   153     */
       
   154     void PrepareL();
       
   155    
       
   156     /**
       
   157     * Return mcc stream type
       
   158     * @return mcc stream type
       
   159     */
       
   160     TInt MccStreamType() const;
       
   161 
       
   162     /**
       
   163     * Return mcc link type
       
   164     * @return mcc link type
       
   165     */
       
   166     TInt MccLinkType() const;
       
   167 
       
   168 #endif//MCE_COMMON_SERVER_SIDE
       
   169     
       
   170 protected: // Functions
       
   171 
       
   172     /**
       
   173     * Constructor
       
   174     */
       
   175 	CMceComAudioStream();
       
   176 	
       
   177     /**
       
   178     * second-phase constructor
       
   179     */
       
   180 	void ConstructL();
       
   181 	
       
   182     /**
       
   183      * second-phase copy constructor
       
   184      */
       
   185 	void ConstructL( CMceComAudioStream& aStream );
       
   186 	
       
   187     /**
       
   188     * Searches for codec matching with input codec instance or sdp name
       
   189     * @param aCodec the search term
       
   190     * @return matching codec or NULL if not found
       
   191     */
       
   192     CMceComCodec* FindCodecL( CMceComCodec& aCodec );
       
   193 
       
   194 	/**
       
   195 	* Find index of codec in the list of codecs.
       
   196 	* aCodec codec to search for.
       
   197 	*/
       
   198 	TInt FindCodecFromList( CMceComCodec* aCodec) const;
       
   199 	
       
   200 	/**
       
   201 	* Removes a codec from the list of codecs.
       
   202 	* @param aIndex index of codec to be removed.
       
   203 	*/
       
   204 	void RemoveCodecFromListL( TInt aIndex );
       
   205 
       
   206 	/**
       
   207 	* Clears list of codecs and deletes each codec in it.
       
   208 	*/
       
   209 	void DestroyCodecs();
       
   210 
       
   211 protected: // Owned data
       
   212 
       
   213     /**
       
   214      * codecs
       
   215      */
       
   216 	RPointerArray<CMceComAudioCodec> iCodecs;
       
   217     
       
   218 #ifdef EUNIT_TEST
       
   219     friend class UT_CMceComAudioStream;
       
   220     friend class UT_CMceMediaSdpCodec;
       
   221     friend class UT_CMceAudioSdpCodec;
       
   222 #endif
       
   223 
       
   224 	};
       
   225 
       
   226 
       
   227 
       
   228 #endif