os/mm/mmlibs/mmfw/tsrc/mmfunittest/VCLNT/TS_VideoOutput/MmfVideoOutput.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/VCLNT/TS_VideoOutput/MmfVideoOutput.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,161 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __MMF_VIDEOOUTPUT_H__
    1.20 +#define __MMF_VIDEOOUTPUT_H__
    1.21 +
    1.22 +// Standard EPOC32 includes required by this header file
    1.23 +#include <e32base.h>
    1.24 +#include <e32std.h>
    1.25 +
    1.26 +#include <e32hal.h>
    1.27 +#include <e32svr.h>
    1.28 +
    1.29 +// Public Media Server includes
    1.30 +#include <mmf/server/mmfdatasink.h>
    1.31 +#include <mmf/server/mmfdatasource.h>
    1.32 +#include <mmf/server/mmfdatapath.h>
    1.33 +#include <mmf/server/mmfdatasourcesink.hrh>
    1.34 +
    1.35 +#include <mmf/server/mmfcodec.h>
    1.36 +#include <mmf/server/mmfdatabuffer.h>
    1.37 +#include <mmf/common/mmfpaniccodes.h>
    1.38 +
    1.39 +#include "mmfVideoOutputInterfaceUIDs.hrh"
    1.40 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.41 +#include <mmf/common/mmfhelper.h>
    1.42 +#endif
    1.43 +
    1.44 +const TUint KVideoOutputDefaultFrameSize = 0x1000;
    1.45 +const TUid KUidMmfVideoOutput	= {KMmfUidVideoOutputInterface};
    1.46 +
    1.47 +
    1.48 +void Panic(TInt aPanicCode);
    1.49 +
    1.50 +class MMMFVideoOutput : public MDataSink
    1.51 +/*
    1.52 +Interface class to allow dynamic linkage to CMMFVideoOutput.
    1.53 +*/
    1.54 +	{
    1.55 +public:
    1.56 +	//factory function
    1.57 +	inline static MMMFVideoOutput* NewVideoOutputL(TUid aImplementationUid, const TDesC8& aInitData);
    1.58 +	//interface
    1.59 +protected:
    1.60 +	//constructor
    1.61 +	MMMFVideoOutput() : MDataSink(KUidMmfVideoOutput) {}
    1.62 +	};
    1.63 +
    1.64 +inline MMMFVideoOutput* MMMFVideoOutput::NewVideoOutputL( TUid aImplementationUid,  const TDesC8& aInitData )
    1.65 +	{
    1.66 +	//make sure the cast will be ok by checking the uid is what we expect
    1.67 +//	__ASSERT_ALWAYS(aImplementationUid==KUidMmfVideoOutput, Panic(EMMFVideoOutputPanicBadUID));
    1.68 +	MMMFVideoOutput* retPtr = STATIC_CAST(MMMFVideoOutput*, MDataSink::NewSinkL(aImplementationUid, aInitData));
    1.69 +	return retPtr;
    1.70 +	}
    1.71 +
    1.72 +class CHardwareCodec;
    1.73 +
    1.74 +class CMMFVideoOutput : public CBase, public MMMFVideoOutput
    1.75 +/**
    1.76 +The interface into DevSound
    1.77 +**/
    1.78 +	{
    1.79 +public:
    1.80 +	static MDataSink* NewSinkL() ;
    1.81 +	virtual ~CMMFVideoOutput();
    1.82 +
    1.83 +	//MDataSink mixin implementations
    1.84 +	virtual TFourCC SinkDataTypeCode(TMediaId /*aMediaId*/); //used by data path MDataSource/Sink for codec matching
    1.85 +	virtual void EmptyBufferL(CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId /*aMediaId*/);//called by a MDataSource to empty a buffer
    1.86 +	virtual void BufferFilledL(CMMFBuffer* aBuffer); //called by MDataSource to pass back full buffer to the sink
    1.87 +	virtual TBool CanCreateSinkBuffer();
    1.88 +	virtual CMMFBuffer* CreateSinkBufferL(TMediaId /*aMediaId*/, TBool &aReference);
    1.89 +	virtual TInt SinkThreadLogon(MAsyncEventHandler& aEventHandler);
    1.90 +	virtual void SinkThreadLogoff();
    1.91 +	virtual void SinkPrimeL();
    1.92 +	virtual void SinkPauseL();
    1.93 +	virtual void SinkPlayL();
    1.94 +	virtual void SinkStopL();
    1.95 +	virtual void SetSinkPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
    1.96 +	TInt State();
    1.97 +	virtual void NegotiateL(MDataSource& aSource);
    1.98 +
    1.99 +
   1.100 +protected:
   1.101 +	virtual void ConstructSinkL( const TDesC8& aInitData ) ;
   1.102 +
   1.103 +private:
   1.104 +	inline CMMFVideoOutput() {}
   1.105 +
   1.106 +private:
   1.107 +
   1.108 +	MAsyncEventHandler* iEventHandler;
   1.109 +
   1.110 +	CMMFDataBuffer* iLastVideoBuffer;
   1.111 +	CMMFDataBuffer* iVideoBufferCopy;
   1.112 +
   1.113 +	enum TCodec
   1.114 +		{
   1.115 +		EUseARMCodec=0,
   1.116 +		EUseHWCodec
   1.117 +		};
   1.118 +
   1.119 +	enum TState
   1.120 +		{
   1.121 +		EIdle=0,
   1.122 +		EDevSoundReady,
   1.123 +		EMMFDevSoundFirstBufferSent,
   1.124 +		EPlaying,
   1.125 +		EPaused,
   1.126 +		EBufferEmpty
   1.127 +		};
   1.128 +
   1.129 +	enum TError
   1.130 +		{
   1.131 +		ECantCreateBuffer,
   1.132 +		EEmptyBuffer,
   1.133 +		EDevSoundNotLoaded,
   1.134 +		ERecordNotSupported,
   1.135 +		EDevSoundError,
   1.136 +		EUnknown
   1.137 +		};
   1.138 +
   1.139 +	MDataSource* iSupplier;
   1.140 +	TState iState;
   1.141 +	CHardwareCodec* iHWCodec;
   1.142 +
   1.143 +	TBool iFirstBufferSent;
   1.144 +	TBool iDevSoundLoaded;
   1.145 +
   1.146 +	TError iError;
   1.147 +
   1.148 +	TCodec iCodecSelect;
   1.149 +	TMMFPrioritySettings iPrioritySettings;
   1.150 +
   1.151 +	TUint iSourceSampleRate;
   1.152 +	TUint iSourceChannels;
   1.153 +	TFourCC iSourceFourCC;
   1.154 +	TBool iNeedsSWConversion;
   1.155 +	CMMFChannelAndSampleRateConverterFactory* iChannelAndSampleRateConverterFactory;
   1.156 +	CMMFChannelAndSampleRateConverter* iChannelAndSampleRateConverter;
   1.157 +	CMMFDataBuffer* iConvertBuffer;
   1.158 +	CMMFBuffer* iBufferToEmpty;
   1.159 +	CMMFDataBuffer* iDevSoundBuffer;
   1.160 +	TUint iDestinationSampleRate;
   1.161 +	TUint iDestinationChannels;
   1.162 +	};
   1.163 +
   1.164 +#endif