multimediacommscontroller/mmccavcpayloadformat/inc/avcpayloadformatwrite.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:    The payloadization part of the AVC payloadization/depayloadization plugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef AVCPAYLOADFORMATWRITE_H
       
    22 #define AVCPAYLOADFORMATWRITE_H
       
    23 
       
    24 // include files
       
    25 #include<e32base.h>
       
    26 #include<e32std.h>
       
    27 #include<mmf/server/mmfdatabuffer.h>
       
    28 #include<mmf/common/mmfutilities.h>
       
    29 
       
    30 #include "rtpheader.h"
       
    31 #include "mccinternalcodecs.h"
       
    32 #include "formatstatemachine.h"
       
    33 #include "rfc3984encode.h"
       
    34 #include "avcrtpstruct.h"
       
    35 
       
    36 // Forward declarations
       
    37 
       
    38 class CRFC3984Encode;
       
    39 class TRtpRecvHeader;
       
    40 
       
    41 
       
    42 
       
    43 
       
    44 // CAvcPayloadFormatWrite class declaration. 
       
    45 // The class receives one avc frame and payloadizes it into
       
    46 // one ore more RTP packets and gives the packets to the RTP
       
    47 // layer
       
    48 
       
    49 class CAvcPayloadFormatWrite : public CPayloadFormatWrite, public MPayloadFormatWrite
       
    50     {
       
    51 	public: 
       
    52 	
       
    53 		static CAvcPayloadFormatWrite * NewL( MDataSink * aSink);
       
    54 		
       
    55 		virtual ~CAvcPayloadFormatWrite();
       
    56 		
       
    57 		// from MPayloadFormatWrite
       
    58 		void EmptySourceBufferL( );
       
    59 		void SourceBufferEmptiedL( );
       
    60 		virtual void SetPayloadType( TUint8 aPayloadType);
       
    61 		void CancelUlRequest();
       
    62 		
       
    63 		// from CMMFFormatEncode (currently for audio, so none of these
       
    64 		// is implemented)
       
    65 		
       
    66 		virtual  TTimeIntervalMicroSeconds FrameTimeInterval( TMediaId aMediaType ) const;
       
    67 		virtual  TTimeIntervalMicroSeconds Duration( TMediaId /*aMediaType*/ ) const;
       
    68 	
       
    69 		// from MDataSink (one of the above public class is derived from it)
       
    70 		virtual CMMFBuffer* CreateSinkBufferL( TMediaId aMediaId, 
       
    71                                                TBool &aReference ); 
       
    72         virtual TFourCC SinkDataTypeCode( TMediaId aMediaId );
       
    73         virtual TInt SetSinkDataTypeCode( TFourCC aSinkFourCC, 
       
    74                                               TMediaId aMediaId ); 
       
    75         virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler );
       
    76         virtual void SinkThreadLogoff( );
       
    77         virtual void EmptyBufferL( CMMFBuffer* aBuffer, 
       
    78                                        MDataSource* aSupplier,
       
    79                                        TMediaId aMediaId );
       
    80         virtual void BufferEmptiedL( CMMFBuffer* aBuffer );
       
    81         virtual void SinkPrimeL();
       
    82         virtual void SinkPlayL( );
       
    83         virtual void SinkPauseL( );
       
    84         virtual void SinkStopL( );
       
    85     
       
    86 		/**
       
    87         * Configures payload format with format spesific parameters.
       
    88         * Leaves with KErrArgument if parameters are invalid.
       
    89         * @param    aConfigParams       Configuration parameters
       
    90         * @param    aClock
       
    91         */
       
    92         void ConfigurePayloadFormatL( const TDesC8& aConfigParams, 
       
    93                                       CMccRtpMediaClock& aClock );
       
    94         
       
    95 	private:
       
    96 	
       
    97 		CAvcPayloadFormatWrite ( );
       
    98 		void ConstructL( MDataSink* aSink);
       
    99 		TBool ProcessFramesL();
       
   100 		CMMFDataBuffer* CreateSinkBufferOfSizeL( TUint aSize ); 
       
   101     
       
   102     private:
       
   103   
       
   104       	CFormatEncodeStateMachine * iStateMachine;
       
   105       	CMMFDataBuffer * iSourceBuffer;
       
   106       	CRFC3984Encode * iEncoder; 					// payloadization class pointer
       
   107       	CMMFDataBuffer * iSinkBuffer;			// sink buffer 
       
   108       	TRtpSendHeader iRtpSendHeader;   	// RTP Header	
       
   109       	TTimeIntervalMicroSeconds iFrameTimeInterval;
       
   110       	TMediaId iMediaId;
       
   111       	
       
   112       	// Parameters relating to RTP data encoding
       
   113         TMccCodecInfo iCInfo;
       
   114         
       
   115         // Pointer to current sink (redundancy or rtp data sink)
       
   116         MDataSink* iCurDataSink;
       
   117         
       
   118         TBool iIsRtpSink;
       
   119         
       
   120         TUint iSeqNumIncrementer;
       
   121 	
       
   122 	    #if defined( TEST_EUNIT ) && defined ( __WINSCW__ )
       
   123         friend class UT_CAvcPayloadFormatWrite;
       
   124         #endif
       
   125     };
       
   126 
       
   127 #endif