ipappsrv_plat/multimedia_comms_api/inc/mcevideostream.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 MCEVIDEOSTREAM_H
       
    22 #define MCEVIDEOSTREAM_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32std.h>  		
       
    26 #include <mcemediastream.h>
       
    27 
       
    28 // CONSTANTS
       
    29 const TMceMediaType KMceVideo = 2;
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CMceVideoCodec;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 * Class for representing unidirectional video stream.
       
    38 *
       
    39 * It defines the used video codecs for the stream.
       
    40 * In order to be complete structure, at least one codec is required.
       
    41 *
       
    42 * @lib mceclient.lib
       
    43 */
       
    44 class CMceVideoStream : public CMceMediaStream
       
    45 	{
       
    46 	public: // Constructors and destructor
       
    47 
       
    48 	    /**
       
    49 	    * Two-phased constructor.
       
    50 	    */
       
    51 		IMPORT_C static CMceVideoStream* NewL();
       
    52 	   
       
    53 	    /**
       
    54 	    * Two-phased constructor.
       
    55 	    */
       
    56 		IMPORT_C static CMceVideoStream* NewLC();
       
    57 		
       
    58 	    /**
       
    59 	    * Destructor.
       
    60 	    */
       
    61 		IMPORT_C ~CMceVideoStream();
       
    62 
       
    63 	public: // Functions
       
    64 
       
    65 	    /**
       
    66 	    * Returns the codecs available to the session.
       
    67 	    * For CMceOutSession, array contains all codecs supported by
       
    68 	    * terminal in default. For CMceInSession, array contains codecs
       
    69 	    * that were offered by remote terminal, and supported by local terminal.
       
    70 	    * Codecs are in preference order in the array. 
       
    71 	    * Codec in the first element of the array has highest preference.
       
    72 	    * Adding, removing or replacing a codec or changing the preference
       
    73 	    * of a codec causes the returned array to be in invalid state.
       
    74 	    * @return codecs available for the session
       
    75 	    */
       
    76 		IMPORT_C const RPointerArray<CMceVideoCodec>& Codecs();
       
    77 
       
    78         /**
       
    79 	    * Adds codec to the stream. The codec contains preference value
       
    80 	    * which will define its preference when added to the stream.
       
    81 	    * Preference of codecs with the same preference value is determined
       
    82 	    * by order they were added to the stream. In case of bound streams,
       
    83 	    * codec is also automatically added to the opposite direction stream.
       
    84 	    * After adding a codec an array of codecs received with a call
       
    85         * to Codecs() is not valid. 
       
    86 	    * @param aCodec codec added to the stream; ownership is transferred
       
    87 	    */
       
    88 		IMPORT_C void AddCodecL( CMceVideoCodec* aCodec );
       
    89 
       
    90 	    /**
       
    91 	    * Removes codec from the stream. In case of bound streams, codec is
       
    92 	    * also automatically removed from the opposite direction stream.
       
    93 	    * After removing a codec an array of codecs previously received with 
       
    94 	    * a call to Codecs() is not valid. 
       
    95 	    * @param aCodec codec removed from stream
       
    96 	    */
       
    97 		IMPORT_C void RemoveCodecL( CMceVideoCodec& aCodec );
       
    98 		
       
    99 		/**
       
   100 	    * Replaces codecs of the stream. Preference values of codecs will define
       
   101 	    * the preference order. In case of bound streams, codecs are
       
   102 	    * also automatically added to the opposite direction stream.
       
   103 	    * After replacing codecs an array of codecs received with a call
       
   104         * to Codecs() is not valid. 
       
   105 	    * @param aCodecs array of codecs which will replace existing codecs; 
       
   106 	    *        ownership is transferred
       
   107 	    */
       
   108 		IMPORT_C void ReplaceCodecsL( RPointerArray<CMceVideoCodec>* aCodecs );
       
   109 
       
   110 	    /**
       
   111 	    * Gets supported video codecs of the current stream configuration.
       
   112 	    * Supported codecs for this video stream is affected by attached
       
   113 	    * sinks and sources.
       
   114 	    * @return supported video codecs of the current stream configuration
       
   115 	    */
       
   116 	    IMPORT_C const RPointerArray<const CMceVideoCodec>& 
       
   117 	                    SupportedVideoCodecs() const;		
       
   118 
       
   119 	public: // serialization
       
   120 
       
   121 	    /**
       
   122 	    * Internalizes
       
   123 	    * @param aReadStream read stream
       
   124 	    * @param aTarget to which read to
       
   125 	    */
       
   126 	    void InternalizeL( MMceComSerializationContext& aSerCtx );
       
   127 	    
       
   128 	    /**
       
   129 	    * Externalizes
       
   130 	    * @param aWriteStream write stream
       
   131 	    */
       
   132 	    void ExternalizeL( MMceComSerializationContext& aSerCtx );
       
   133 	 
       
   134 	    
       
   135 	public: // From CMceMediaStream
       
   136 		
       
   137 	    /**
       
   138 	    * Initializes the stream. 
       
   139 	    * @param aParent the parent
       
   140 	    * @param aDiscardUnusedCodecs
       
   141 	    */
       
   142 	    void InitializeL( CMceSession& aParent, TBool aDiscardUnusedCodecs );
       
   143 
       
   144 	    /**
       
   145 	    * Initializes the stream.
       
   146 	    * @param aManager the manager; ownership is not transferred
       
   147 	    * @param aSession the Session.
       
   148 	    */
       
   149         void InitializeL( CMceManager* aManager, CMceSession& aSession );
       
   150 
       
   151 	    /**
       
   152 	    * Traversal event handler.
       
   153 	    * @param aEvent the event
       
   154 	    * @return status if event was consumed or not or object needs update
       
   155 	    */
       
   156 	    TInt EventReceivedL( TMceEvent& aEvent );
       
   157 	    
       
   158 	    
       
   159 	    /**
       
   160 	    * Called file source wants to synchronized with stream
       
   161 	    * @param aFile the file source
       
   162 	    */
       
   163         void SynchronizeWithFileL( CMceFileSource& aFile );
       
   164         
       
   165         /**
       
   166         * Searches for codec matching with input codec instance or sdp name
       
   167         * @param aCodec the search term
       
   168         * @return matching codec or NULL if not found
       
   169         */
       
   170         CMceCodec* FindCodec( CMceCodec& aCodec );
       
   171         
       
   172         /**
       
   173         * Arrange video codecs according codec preferences.
       
   174         */
       
   175         void ReorderCodecsByPreferenceL( TBool aDiscardUnusedCodecs );
       
   176         
       
   177         /**
       
   178         * Return codecs of stream.
       
   179         * @return list of codecs in the stream.
       
   180         */
       
   181         const RPointerArray<CMceCodec>& BaseCodecs();
       
   182 	    	    
       
   183 	public: // Internal
       
   184 	
       
   185 	     /**
       
   186         * Removes codec
       
   187         * @param aCodec
       
   188         * @param aBinderOriginated
       
   189         */
       
   190 	    void RemoveCodecL( CMceVideoCodec& aCodec, TBool aBinderOriginated );
       
   191 	    
       
   192 	protected: // From CMceMediaStream
       
   193 	
       
   194 	    /**
       
   195 	    * Determine whether current combination of source and sinks
       
   196 	    * is allowed for spesific stream type.
       
   197 	    * @return ETrue is combination is allowed; otherwise EFalse
       
   198 	    */
       
   199 	    virtual TBool IsAllowedCombination();	
       
   200 
       
   201 	private:
       
   202 
       
   203 	    /**
       
   204 	    * C++ default constructor.
       
   205 	    */
       
   206 		CMceVideoStream();
       
   207 
       
   208 	    /**
       
   209 	    * Second-phase constructor.
       
   210 	    */
       
   211 		void ConstructL();
       
   212 	    		
       
   213 
       
   214 	private: // Owned data
       
   215 
       
   216 	    /**
       
   217 	    * Codecs.
       
   218 	    */
       
   219 		RPointerArray<CMceVideoCodec> iCodecs;
       
   220 
       
   221         /**
       
   222 	    * Supported video codecs.
       
   223 	    */
       
   224 	    RPointerArray<const CMceVideoCodec> iSupportedVideoCodecs;
       
   225 
       
   226     private: // Reserved for future use
       
   227     
       
   228         TAny* iReserved1;       
       
   229 
       
   230    
       
   231 	//for testing
       
   232 
       
   233     MCE_UNIT_TEST_DEFS	
       
   234     
       
   235 	};
       
   236 
       
   237 #endif