multimediacommsengine/mmceshared/inc/mcecomstreambundle.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 MCECOMSTREAMBUNDLE_H
       
    22 #define MCECOMSTREAMBUNDLE_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>  	
       
    26 #include <mcedefs.h>
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 #ifdef MCE_COMMON_SERVER_SIDE
       
    31 
       
    32 #include "mcesrv.h"
       
    33 
       
    34 #endif//MCE_COMMON_SERVER_SIDE
       
    35 
       
    36 #include "mcestreambundle.h"
       
    37 #include "mcecomserializable.h"
       
    38 
       
    39 class CMceComMediaStream;
       
    40 class CMceComSession;
       
    41 class CMceComEndpoint;
       
    42 class TMceComFactory;
       
    43 class MMceComEndPointProxy;
       
    44 
       
    45 // FORWARD DECLARATIONS
       
    46 
       
    47 /**
       
    48 * Class for handling grouping of Mce streams (i.e. grouping of media lines).
       
    49 *
       
    50 * Can be used for example to synchronize audio and video streams.
       
    51 *
       
    52 * If streams are added to the bundle or removed from it after the bundle
       
    53 * has been added to the session, the session has to be updated with
       
    54 * CMceSEssion::UpdateL() function in order to complete the changes. 
       
    55 *
       
    56 *  @lib mceclient.lib
       
    57 */
       
    58 class CMceComStreamBundle : public CBase, 
       
    59                             public MMceComSerializable
       
    60 	{
       
    61 	
       
    62 public: // Constructors and destructor
       
    63 
       
    64     /**
       
    65     * Two-phased constructor.
       
    66     */
       
    67     static CMceComStreamBundle* NewL( CMceStreamBundle::TMceStreamBundleType aType );
       
    68 
       
    69     /**
       
    70     * Two-phased constructor.
       
    71     */
       
    72 	static CMceComStreamBundle* NewLC( CMceStreamBundle::TMceStreamBundleType aType );
       
    73          
       
    74     /**
       
    75     * Destructor.
       
    76     */
       
    77 	~CMceComStreamBundle();
       
    78 
       
    79 public: //static API
       
    80 
       
    81 
       
    82     static TBool InBundle( CMceComEndpoint& aEndpoint, 
       
    83                            CMceComSession& aSession );
       
    84 
       
    85 public:
       
    86 
       
    87     /**
       
    88     * Type of the bundle
       
    89     * @param aParent the parent
       
    90     */
       
    91     CMceStreamBundle::TMceStreamBundleType Type() const;
       
    92 
       
    93     /**
       
    94     * Adds stream to the bundle.
       
    95     * @param aStream, stream to be added
       
    96     */
       
    97     void AddStreamL( CMceComMediaStream& aStream );
       
    98     
       
    99     /**
       
   100     * Removes stream from the bundle.
       
   101     * @param aStream, stream to be removed
       
   102     */
       
   103     void RemoveStreamL( CMceComMediaStream& aStream );
       
   104     
       
   105      /**
       
   106     * Returns the streams belonging to the bundle.
       
   107     * @return streams of the bundle.
       
   108     */
       
   109 	const RPointerArray< CMceComMediaStream >& Streams() const;
       
   110 	
       
   111     /**
       
   112     * Called when bundle has beed added to session
       
   113     */
       
   114     void AddedL();
       
   115     
       
   116     
       
   117 public: // from MMceComSerializable
       
   118 
       
   119     /**
       
   120     * Returns serialization id
       
   121     * @return serialization id
       
   122     */
       
   123     TUint64 SerializationId() const;
       
   124 
       
   125     /**
       
   126     * Internalizes flat data
       
   127     * @param aReadStream read stream
       
   128     */
       
   129     void InternalizeFlatL( RReadStream& aReadStream );
       
   130 
       
   131     /**
       
   132     * Externalizes flat data
       
   133     * @param aWriteStream write stream
       
   134     */
       
   135     void ExternalizeFlatL( RWriteStream& aWriteStream );
       
   136 
       
   137     /**
       
   138     * Internalizes
       
   139     * @param aSerCtx context for serialization
       
   140     */
       
   141     void InternalizeL( MMceComSerializationContext& aSerCtx );
       
   142     
       
   143     /**
       
   144     * Externalizes
       
   145     * @param aSerCtx context for serialization
       
   146     */
       
   147     void ExternalizeL( MMceComSerializationContext& aSerCtx );
       
   148 
       
   149 
       
   150 public: // new functions
       
   151 
       
   152     /**
       
   153     * ID 
       
   154     * @return ID
       
   155     */
       
   156 	TMceMediaId Id() const;
       
   157 
       
   158     /**
       
   159     * Factory
       
   160     * @return factory
       
   161     */
       
   162     TMceComFactory BaseFactory();
       
   163 
       
   164     /**
       
   165     * Initializes 
       
   166     * @param aParent the parent
       
   167     */
       
   168     void InitializeL( CMceComSession& aParent );
       
   169 
       
   170     /**
       
   171     * Updates this object
       
   172     * @param aUpdate object updates this
       
   173     */
       
   174     void UpdateL( CMceComStreamBundle& aUpdate );
       
   175     
       
   176     /**
       
   177     * Clones this object
       
   178     * @return the cloned object
       
   179     */
       
   180     CMceComStreamBundle* CloneL();
       
   181 
       
   182     /**
       
   183     * Clones this object
       
   184     * @param aStreams array containing streams
       
   185     * @return the cloned object
       
   186     */
       
   187     CMceComStreamBundle* CloneL( const RPointerArray<CMceComMediaStream>& aStreams );
       
   188 
       
   189 
       
   190 private: //methods
       
   191 
       
   192     /**
       
   193      * C++ default constructor.
       
   194      */
       
   195 	CMceComStreamBundle( CMceStreamBundle::TMceStreamBundleType aType );
       
   196 
       
   197     /**
       
   198      * second-phase constructor
       
   199      */
       
   200 	void ConstructL();
       
   201 
       
   202     /**
       
   203     * Zeroes instance (used in cloning)
       
   204     */
       
   205     void Zero();
       
   206 
       
   207 
       
   208     void AddedSinkL( CMceComMediaStream& aStream,
       
   209                      CMceComEndpoint*& aCurrentSink,
       
   210                      MMceComEndPointProxy*& aProxy );
       
   211 
       
   212     void AddedSourceL( CMceComMediaStream& aStream,
       
   213                        CMceComEndpoint*& aCurrentSource,
       
   214                        MMceComEndPointProxy*& aProxy );
       
   215 
       
   216     
       
   217 private: // Data
       
   218 
       
   219 
       
   220     /**
       
   221      * type
       
   222      */
       
   223     CMceStreamBundle::TMceStreamBundleType iBundleType;
       
   224     
       
   225     /**
       
   226      * ID
       
   227      */
       
   228     TMceMediaId iID;
       
   229 
       
   230     /**
       
   231      * streams
       
   232      */
       
   233     RPointerArray< CMceComMediaStream > iStreams;
       
   234     
       
   235     /**
       
   236      * session
       
   237      */
       
   238     CMceComSession* iSession;
       
   239     
       
   240     
       
   241 #ifdef MCE_COMMON_SERVER_SIDE
       
   242 
       
   243 	//definitions for unit testing
       
   244 	MCEMM_UT_DEFINITIONS
       
   245     
       
   246 #endif//MCE_COMMON_SERVER_SIDE
       
   247         
       
   248 	MCE_UNIT_TEST_DEFS
       
   249 	
       
   250 	};
       
   251 
       
   252 	
       
   253 
       
   254 #endif //MCECOMSTREAMBUNDLE_H