multimediacommsengine/mmcecli/inc/mceavsink.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 MCEAVSINK_H
       
    22 #define MCEAVSINK_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <mcemediasink.h>
       
    26 #include "mcecomserializable.h"
       
    27 #include "mceendpointproxy.h"
       
    28 
       
    29 #include <e32std.h>  
       
    30 #include <gdi.h>
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CWindowGc;
       
    34 class RWindow;
       
    35 class CMceManager;
       
    36 class CMceItcSender;
       
    37 class CMceComAvSink;
       
    38 
       
    39 // DATA TYPES
       
    40 const TMceSinkType KMceAvSink = 99;
       
    41 
       
    42 
       
    43 // CLASS DECLARATION
       
    44 
       
    45 /**
       
    46 * Class representing audio/video sink in MCE.
       
    47 *
       
    48 * CMceAvSink can be used to show video containing audio on screen 
       
    49 * 
       
    50 * @lib mceclient.lib
       
    51 */
       
    52 NONSHARABLE_CLASS( CMceAvSink ) : public CBase,
       
    53                                   public MMceComSerializable,
       
    54                                   public MMceEndPointProxy
       
    55                    
       
    56 	{
       
    57 
       
    58 	public: // Destructor
       
    59 
       
    60 	    /**
       
    61 	    * Two-phased constructor.
       
    62 	    */
       
    63 	    static CMceAvSink* NewL();
       
    64 
       
    65 	    /**
       
    66 	    * Two-phased constructor.
       
    67 	    */
       
    68 		static CMceAvSink* NewLC();
       
    69 
       
    70 
       
    71 		~CMceAvSink();
       
    72 
       
    73 	public: // Functions
       
    74 
       
    75 	    /**
       
    76 	    * Returns the type of the sink.
       
    77 	    * @return The type of the sink.
       
    78 	    */
       
    79 		TMceSinkType Type() const;
       
    80 
       
    81 	    /**
       
    82 	    * Enables streaming explicitly.
       
    83 	    */
       
    84 		virtual void EnableL();
       
    85 
       
    86 	    /**
       
    87 	    * Disables streaming explicitly.
       
    88 	    */
       
    89 		virtual void DisableL();
       
    90 
       
    91 	    /**
       
    92 	    * Returns the state of the sink.
       
    93 	    * @return ETrue if enabled, EFalse if disabled.
       
    94 	    */
       
    95 		TBool IsEnabled() const;
       
    96 
       
    97 	public: //internal
       
    98 		
       
    99 		
       
   100 	    /**
       
   101 	    * ID 
       
   102 	    * @return ID
       
   103 	    */
       
   104 		TMceMediaId Id() const;
       
   105 		
       
   106 	    /**
       
   107 	    * Initializes 
       
   108 	    * @param aParent the parent
       
   109 	    */
       
   110 	    virtual void InitializeL( CMceMediaStream& aParent );
       
   111 
       
   112         /**
       
   113 	    * Initializes 
       
   114 	    * @param aManager the manager. Ownership is NOT transferred
       
   115 	    */
       
   116 	    virtual void InitializeL( CMceManager* aManager );	    
       
   117 	    
       
   118 	    /**
       
   119 	    * Sets and gets reference count describing to how many
       
   120 	    * streams sink is associated
       
   121 	    * @return reference count reference
       
   122 	    */
       
   123 	    TInt& ReferenceCount();
       
   124 	    
       
   125 	    /**
       
   126 	    * Stream is been deleted
       
   127 	    * @param aParent the parent stream
       
   128 	    */
       
   129         void UnInitialize( CMceMediaStream& aParent );
       
   130         
       
   131 	    /**
       
   132 	    * Stream has been added to session
       
   133 	    * @param aParent the parent stream
       
   134 	    */
       
   135         virtual void StreamAddedL( CMceMediaStream& aParent );
       
   136 
       
   137 	    /**
       
   138 	    * Factory
       
   139 	    * @return factory
       
   140 	    */
       
   141 	    static TMceSinkFactory Factory();
       
   142 	    
       
   143     public: // from MMceComSerializable
       
   144 
       
   145 
       
   146         /**
       
   147         * Returns serialization id
       
   148         * @return serialization id
       
   149         */
       
   150         TUint64 SerializationId() const;
       
   151         
       
   152         /**
       
   153         * Internalizes flat data
       
   154         * @param aReadStream read stream
       
   155         */
       
   156         void InternalizeFlatL( RReadStream& aReadStream );
       
   157 
       
   158         /**
       
   159         * Externalizes flat data
       
   160         * @param aWriteStream write stream
       
   161         */
       
   162         void ExternalizeFlatL( RWriteStream& aWriteStream );
       
   163         
       
   164         /**
       
   165         * Internalizes
       
   166         * @param aSerCtx context for serialization
       
   167         */
       
   168         virtual void InternalizeL( MMceComSerializationContext& aSerCtx );
       
   169         
       
   170         /**
       
   171         * Externalizes
       
   172         * @param aSerCtx context for serialization
       
   173         */
       
   174         virtual void ExternalizeL( MMceComSerializationContext& aSerCtx );
       
   175 
       
   176 
       
   177     public: // from MMceEndPointProxy
       
   178 
       
   179         /**
       
   180         * Does proxy serve client
       
   181         * @param aClient a client
       
   182         * @return ETrue, if proxy serves client
       
   183         */
       
   184         TBool ServesProxyClient( const CMceMediaSink& aClient ) const;
       
   185         
       
   186 
       
   187         /**
       
   188         * Adds client to proxy
       
   189         * @param aClient a client
       
   190         */
       
   191         void AddProxyClientL( CMceMediaSink& aClient );
       
   192 
       
   193         /**
       
   194         * Removes client from proxy
       
   195         * @param aClient a client
       
   196         */
       
   197         void RemoveProxyClient( CMceMediaSink& aClient );
       
   198         
       
   199 
       
   200 	public://event handling & update
       
   201 
       
   202 	    /**
       
   203 	    * Traversal event handler
       
   204 	    * @param aEvent the event
       
   205 	    * @return status, if event was consumed or not or object needs update
       
   206 	    */
       
   207 	    virtual TInt EventReceivedL( TMceEvent& aEvent );
       
   208 	    
       
   209 	    /**
       
   210 	    * Called after update
       
   211 	    */
       
   212 	    virtual void Updated();
       
   213 
       
   214 	    /**
       
   215 	    * Updates
       
   216 	    * @param aUpdate updated data
       
   217 	    */
       
   218         void UpdateL( CMceAvSink& aUpdate );
       
   219         
       
   220 	protected:
       
   221 
       
   222 	    /**
       
   223 	     * C++ default constructor.
       
   224 	     */
       
   225 		CMceAvSink();
       
   226 		
       
   227 	    /**
       
   228 	     * second-phase constructor
       
   229 	     */
       
   230 		void ConstructL();
       
   231 
       
   232 	    /**
       
   233 	    * Enables streaming explicitly.
       
   234 	    */
       
   235 		void DoEnableL();
       
   236 
       
   237 	    /**
       
   238 	    * Disables streaming explicitly.
       
   239 	    */
       
   240 		void DoDisableL();
       
   241 
       
   242 	private:
       
   243 
       
   244 	    /**
       
   245 	    * Handles event
       
   246 	    * @param aEvent the event
       
   247 	    * @return status, if event was consumed or not or object needs update
       
   248 	    */
       
   249 	    TInt HandleEvent( TMceEvent& aEvent );
       
   250 
       
   251 	protected: // NOT owned data
       
   252 		
       
   253 	    /**
       
   254 	     * stream
       
   255 	     */
       
   256 		CMceMediaStream* iStream;
       
   257 		
       
   258 		RPointerArray<CMceMediaStream> iParents;
       
   259 		
       
   260 		RPointerArray<CMceMediaSink> iProxyClients;
       
   261 		
       
   262 	protected://data
       
   263 	    
       
   264 	    /**
       
   265 	     * flat data container
       
   266 	     */
       
   267 		CMceComAvSink* iFlatData;
       
   268 
       
   269 		//for testing
       
   270 
       
   271 	    MCE_UNIT_TEST_DEFS	
       
   272 	    
       
   273 		};
       
   274 
       
   275 #endif //MCEAVSINK_H