os/mm/mmlibs/mmfw/tsrc/mmfunittest/VCLNT/TS_VideoOutput/MmfVideoOutput.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __MMF_VIDEOOUTPUT_H__
    17 #define __MMF_VIDEOOUTPUT_H__
    18 
    19 // Standard EPOC32 includes required by this header file
    20 #include <e32base.h>
    21 #include <e32std.h>
    22 
    23 #include <e32hal.h>
    24 #include <e32svr.h>
    25 
    26 // Public Media Server includes
    27 #include <mmf/server/mmfdatasink.h>
    28 #include <mmf/server/mmfdatasource.h>
    29 #include <mmf/server/mmfdatapath.h>
    30 #include <mmf/server/mmfdatasourcesink.hrh>
    31 
    32 #include <mmf/server/mmfcodec.h>
    33 #include <mmf/server/mmfdatabuffer.h>
    34 #include <mmf/common/mmfpaniccodes.h>
    35 
    36 #include "mmfVideoOutputInterfaceUIDs.hrh"
    37 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    38 #include <mmf/common/mmfhelper.h>
    39 #endif
    40 
    41 const TUint KVideoOutputDefaultFrameSize = 0x1000;
    42 const TUid KUidMmfVideoOutput	= {KMmfUidVideoOutputInterface};
    43 
    44 
    45 void Panic(TInt aPanicCode);
    46 
    47 class MMMFVideoOutput : public MDataSink
    48 /*
    49 Interface class to allow dynamic linkage to CMMFVideoOutput.
    50 */
    51 	{
    52 public:
    53 	//factory function
    54 	inline static MMMFVideoOutput* NewVideoOutputL(TUid aImplementationUid, const TDesC8& aInitData);
    55 	//interface
    56 protected:
    57 	//constructor
    58 	MMMFVideoOutput() : MDataSink(KUidMmfVideoOutput) {}
    59 	};
    60 
    61 inline MMMFVideoOutput* MMMFVideoOutput::NewVideoOutputL( TUid aImplementationUid,  const TDesC8& aInitData )
    62 	{
    63 	//make sure the cast will be ok by checking the uid is what we expect
    64 //	__ASSERT_ALWAYS(aImplementationUid==KUidMmfVideoOutput, Panic(EMMFVideoOutputPanicBadUID));
    65 	MMMFVideoOutput* retPtr = STATIC_CAST(MMMFVideoOutput*, MDataSink::NewSinkL(aImplementationUid, aInitData));
    66 	return retPtr;
    67 	}
    68 
    69 class CHardwareCodec;
    70 
    71 class CMMFVideoOutput : public CBase, public MMMFVideoOutput
    72 /**
    73 The interface into DevSound
    74 **/
    75 	{
    76 public:
    77 	static MDataSink* NewSinkL() ;
    78 	virtual ~CMMFVideoOutput();
    79 
    80 	//MDataSink mixin implementations
    81 	virtual TFourCC SinkDataTypeCode(TMediaId /*aMediaId*/); //used by data path MDataSource/Sink for codec matching
    82 	virtual void EmptyBufferL(CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId /*aMediaId*/);//called by a MDataSource to empty a buffer
    83 	virtual void BufferFilledL(CMMFBuffer* aBuffer); //called by MDataSource to pass back full buffer to the sink
    84 	virtual TBool CanCreateSinkBuffer();
    85 	virtual CMMFBuffer* CreateSinkBufferL(TMediaId /*aMediaId*/, TBool &aReference);
    86 	virtual TInt SinkThreadLogon(MAsyncEventHandler& aEventHandler);
    87 	virtual void SinkThreadLogoff();
    88 	virtual void SinkPrimeL();
    89 	virtual void SinkPauseL();
    90 	virtual void SinkPlayL();
    91 	virtual void SinkStopL();
    92 	virtual void SetSinkPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
    93 	TInt State();
    94 	virtual void NegotiateL(MDataSource& aSource);
    95 
    96 
    97 protected:
    98 	virtual void ConstructSinkL( const TDesC8& aInitData ) ;
    99 
   100 private:
   101 	inline CMMFVideoOutput() {}
   102 
   103 private:
   104 
   105 	MAsyncEventHandler* iEventHandler;
   106 
   107 	CMMFDataBuffer* iLastVideoBuffer;
   108 	CMMFDataBuffer* iVideoBufferCopy;
   109 
   110 	enum TCodec
   111 		{
   112 		EUseARMCodec=0,
   113 		EUseHWCodec
   114 		};
   115 
   116 	enum TState
   117 		{
   118 		EIdle=0,
   119 		EDevSoundReady,
   120 		EMMFDevSoundFirstBufferSent,
   121 		EPlaying,
   122 		EPaused,
   123 		EBufferEmpty
   124 		};
   125 
   126 	enum TError
   127 		{
   128 		ECantCreateBuffer,
   129 		EEmptyBuffer,
   130 		EDevSoundNotLoaded,
   131 		ERecordNotSupported,
   132 		EDevSoundError,
   133 		EUnknown
   134 		};
   135 
   136 	MDataSource* iSupplier;
   137 	TState iState;
   138 	CHardwareCodec* iHWCodec;
   139 
   140 	TBool iFirstBufferSent;
   141 	TBool iDevSoundLoaded;
   142 
   143 	TError iError;
   144 
   145 	TCodec iCodecSelect;
   146 	TMMFPrioritySettings iPrioritySettings;
   147 
   148 	TUint iSourceSampleRate;
   149 	TUint iSourceChannels;
   150 	TFourCC iSourceFourCC;
   151 	TBool iNeedsSWConversion;
   152 	CMMFChannelAndSampleRateConverterFactory* iChannelAndSampleRateConverterFactory;
   153 	CMMFChannelAndSampleRateConverter* iChannelAndSampleRateConverter;
   154 	CMMFDataBuffer* iConvertBuffer;
   155 	CMMFBuffer* iBufferToEmpty;
   156 	CMMFDataBuffer* iDevSoundBuffer;
   157 	TUint iDestinationSampleRate;
   158 	TUint iDestinationChannels;
   159 	};
   160 
   161 #endif