multimediacommscontroller/mmccvideosourcesink/inc/mccvideosink.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 
       
    22 #ifndef MCCVIDEOSINK_H
       
    23 #define MCCVIDEOSINK_H
       
    24 
       
    25 //  INCLUDES
       
    26 
       
    27 
       
    28 #include <e32std.h>
       
    29 #include <in_sock.h>
       
    30 #include <es_sock.h>
       
    31 #include <mmf/common/mmfcontrollerframeworkbase.h>
       
    32 #include <videoplayer.h>
       
    33 #include <mmf/server/mmfbuffer.h>
       
    34 #include "rtpdef.h"
       
    35 #include "mccdatasink.h"
       
    36 
       
    37 
       
    38 
       
    39 // CONSTANTS
       
    40 
       
    41 // MACROS
       
    42 
       
    43 // DATA TYPES
       
    44 
       
    45 // FUNCTION PROTOTYPES
       
    46 
       
    47 // FORWARD DECLARATIONS
       
    48 class MDataSource;
       
    49 class MVideoPlayerUtilityObserver;
       
    50 class CMccVideoSinkImpl;
       
    51 class CMMFDataBuffer;
       
    52 class TMccCodecInfo;
       
    53 
       
    54 // CLASS DECLARATION
       
    55     
       
    56 /**
       
    57 *  
       
    58 *
       
    59 *  @lib 
       
    60 *  @since 
       
    61 */
       
    62 class CMccVideoSink : public CMccDataSink
       
    63     {
       
    64     public:    // Constructors and destructor
       
    65 
       
    66         /**
       
    67         * Two-phased constructor. Virtual function from MDataSink
       
    68         */
       
    69         static MDataSink* NewSinkL( TUid aImplementationUid, 
       
    70                                     const TDesC8& aInitData );
       
    71    
       
    72         /**
       
    73         * Destructor.
       
    74         */
       
    75         virtual ~CMccVideoSink();
       
    76         
       
    77 
       
    78 
       
    79     public:    // New functions
       
    80     
       
    81         void EmptyVideoSinkBufferL( CMMFBuffer* aBuffer, 
       
    82 	                       MDataSource* aSupplier,
       
    83 	                       TMediaId aMediaId,
       
    84 	                       TRtpRecvHeader& aHeaderInfo );
       
    85       
       
    86         virtual void SetVideoCodecL( const TMccCodecInfo& aVideoCodec );       
       
    87         
       
    88         virtual void SetAudioCodecL( const TMccCodecInfo& aAudioCodec );  
       
    89         
       
    90         virtual void SetCurrentUser( MAsyncEventHandler* aEventHandler );
       
    91        
       
    92     public :   // New functions From MDataSink
       
    93         
       
    94      
       
    95         /**
       
    96         * From MDataSink. Pure virtual function that must be implemented.
       
    97         *                  Out of usage. Leave KErrNotSupported.
       
    98         * @since Series 60 3.0
       
    99         * @param "aBuffer" Out of usage
       
   100         * @param "aSupplier" Out of usage
       
   101         * @param "aMediaId" Out of usage
       
   102         * @return void
       
   103         */
       
   104         void EmptyBufferL( CMMFBuffer* aBuffer, 
       
   105                            MDataSource* aSupplier, 
       
   106                            TMediaId aMediaId );
       
   107 
       
   108         /**
       
   109         * From MDataSink Method to 'logon' the data source to 
       
   110         *                 the same thread that source will be supplying data in.
       
   111         * @since Series 60 3.0
       
   112         * @param aEventHandler for send event to datasource when buffer is embtied. 
       
   113         * @return KErrNone if successful, otherwise a system wide error code.
       
   114         */
       
   115         TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler );
       
   116 
       
   117         /**
       
   118         * From MDataSink Method to 'logoff' the data source from 
       
   119         *                 the same thread that source supplies data in.
       
   120         * @since Series 60 3.0
       
   121         * @param None
       
   122         * @return void
       
   123         */
       
   124         void SinkThreadLogoff();
       
   125 
       
   126         /**
       
   127         * From MDataSink pure virtual function that must be implemented.
       
   128         *                 Returns the data type as a fourCC code of the data sink.
       
   129         * @since Series 60 3.0
       
   130         * @param "aMediaId" This identifies the type of media eg audio and the stream id.
       
   131         *                    This parameter is required in cases where the sink can accept data
       
   132         *                    of more than one media type.
       
   133         * @return the datatype code ( codec ).
       
   134         */
       
   135         TFourCC SinkDataTypeCode( TMediaId aMediaId );
       
   136 
       
   137         /**
       
   138         * From MDataSink pure virtual function that must be implemented.
       
   139         *                 Sets the data type as a fourCC code for the data sink.
       
   140         * @since Series 60 3.0
       
   141         * @param "aSinkFourCC" This specifies the data type as a fourCC code to set the sink to
       
   142         * @param "aMediaId" This identifies the type of media eg audio and the stream id.
       
   143         * @return KErrNone if successful.
       
   144         * @return KErrLocked if Sink thread locked. Codec must to be set before thread logon.
       
   145         * @return KErrNotSupported if the sink does not support media type.
       
   146         */
       
   147         TInt SetSinkDataTypeCode( TFourCC aCodec, TMediaId aMedia );
       
   148 
       
   149         /**
       
   150         * From MDataSink pure virtual function that must be implemented. 
       
   151         *                 Out of usage. Function leaves with KErrNotSupported.  
       
   152         * @since    Series 60 3.0
       
   153         * @param    "aCodec" Out of usage
       
   154         * @param    aMedia    Out of usage
       
   155         * @return    void
       
   156         */
       
   157         void BufferFilledL( CMMFBuffer* aBuffer );
       
   158 
       
   159         /**
       
   160         * From MDataSink pure virtual function that must be implemented.
       
   161         * Method to indicate whether the data sink can create a buffer.
       
   162         * @deprecated
       
   163         *
       
   164         * @since Series 60 3.0
       
   165         * @param "aBuffer" Out of usage
       
   166         * @return False
       
   167         */
       
   168         TBool CanCreateSinkBuffer();
       
   169 
       
   170         /**
       
   171         * From MDataSink pure virtual function that must be implemented.
       
   172         * Out of usage. Function leaves with KErrNotSupported.
       
   173         * @deprecated
       
   174         *
       
   175         * @since Series 60 3.0
       
   176         * @param "aMediaId" Out of usage.
       
   177         * @param "aReference" Out of useage.
       
   178         * @return 
       
   179         */
       
   180         CMMFBuffer* CreateSinkBufferL( TMediaId /*aMediaId*/, 
       
   181                                        TBool& aReference );
       
   182                                   
       
   183         /**
       
   184         * From MDataSink. This is a virtual function that a derived data sink 
       
   185         *                 can implement if any data sink specific 'priming' is required
       
   186         * @since    Series 60 3.0
       
   187         * @param    None
       
   188         * @return   void
       
   189         */
       
   190         void SinkPrimeL();
       
   191 
       
   192         /**
       
   193         * From MDataSink. This is a virtual function that a derived data sink can implement if
       
   194         *                 any data sink specific action is required prior to 'playing'ie the 
       
   195         *                 start of data transfer
       
   196         * @since    Series 60 3.0
       
   197         * @param    None
       
   198         * @return   void
       
   199         */
       
   200         void SinkPlayL();
       
   201 
       
   202         /**
       
   203         * From MDataSink. This is a virtual function that a derived data sink can implement if 
       
   204         *                 any data sink specific action is required to 'pause'
       
   205         * @since    Series 60 3.0
       
   206         * @param    None
       
   207         * @return   void
       
   208         */
       
   209         void SinkPauseL();
       
   210         
       
   211         /**
       
   212         * From MDataSink. This is a virtual function that a derived data sink can implement if 
       
   213         *                 any data sink specific action is required to 'stop'
       
   214         * @since    Series 60 3.0
       
   215         * @param    None
       
   216         * @return   void
       
   217         */
       
   218         void SinkStopL();
       
   219         
       
   220         /**
       
   221         * From MDataSink. 
       
   222         * @since    Series 60 3.0
       
   223         * @param    None
       
   224         * @return   void
       
   225         */
       
   226         void SetSinkPrioritySettings( const TMMFPrioritySettings& aPrioritySettings );
       
   227         
       
   228         /**
       
   229         * From MDataSink. Used for custom command receiving.
       
   230         * @since    Series 60 3.0
       
   231         * @param    aMessage    The message specifying the custom command.
       
   232         * @return   void
       
   233         */
       
   234         void SinkCustomCommand( TMMFMessage& aMessage );
       
   235         
       
   236     public: // from MMccSourceSink 
       
   237     
       
   238         virtual void GetParameterL( TUint32 aParam, TDes8& aVal );
       
   239         
       
   240         virtual void SetParameterL( TUint32 aParam, const TDesC8& aVal );
       
   241         
       
   242     protected:  // Functions from base classes
       
   243         
       
   244         /**
       
   245         * Method to perform any sink construction dependant on the sink construction
       
   246         * initialisation data aInitData
       
   247         *
       
   248         * This is a pure virtual function that a derrived data sink must implement
       
   249         *
       
   250         * @param    "aInitData"
       
   251         *            Sink specific initialisation data required for sink construction
       
   252         */
       
   253         void ConstructSinkL( const TDesC8& aInitData );
       
   254         
       
   255     private:
       
   256 
       
   257         /**
       
   258         * C++ default constructor.
       
   259         */
       
   260         CMccVideoSink();
       
   261         
       
   262         
       
   263     private: 
       
   264         
       
   265         CMccVideoSinkImpl* iMediaInterface;
       
   266         
       
   267 		TFourCC iVideoFourCC;
       
   268 		TFourCC iAudioFourCC;		
       
   269 				
       
   270 		TUint8  iVideoPayloadType;
       
   271 		TUint   iMaxVideoBitRate;	
       
   272         TUint   iVideoCodecMode;
       
   273         
       
   274         TUint8  iAudioPayloadType;	
       
   275         TUint   iAudioCodecMode;
       
   276         
       
   277         TBool   iAudioReady;
       
   278         TBool   iVideoReady;
       
   279 	    	
       
   280 	private:
       
   281     	#ifdef TEST_EUNIT
       
   282 			friend class UT_CMccVideoSink;	
       
   283    		#endif
       
   284         
       
   285     };
       
   286 
       
   287 #endif