sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __MMF_VIDEOOUTPUT_H__ sl@0: #define __MMF_VIDEOOUTPUT_H__ sl@0: sl@0: // Standard EPOC32 includes required by this header file sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // Public Media Server includes sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include "mmfVideoOutputInterfaceUIDs.hrh" sl@0: #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #endif sl@0: sl@0: const TUint KVideoOutputDefaultFrameSize = 0x1000; sl@0: const TUid KUidMmfVideoOutput = {KMmfUidVideoOutputInterface}; sl@0: sl@0: sl@0: void Panic(TInt aPanicCode); sl@0: sl@0: class MMMFVideoOutput : public MDataSink sl@0: /* sl@0: Interface class to allow dynamic linkage to CMMFVideoOutput. sl@0: */ sl@0: { sl@0: public: sl@0: //factory function sl@0: inline static MMMFVideoOutput* NewVideoOutputL(TUid aImplementationUid, const TDesC8& aInitData); sl@0: //interface sl@0: protected: sl@0: //constructor sl@0: MMMFVideoOutput() : MDataSink(KUidMmfVideoOutput) {} sl@0: }; sl@0: sl@0: inline MMMFVideoOutput* MMMFVideoOutput::NewVideoOutputL( TUid aImplementationUid, const TDesC8& aInitData ) sl@0: { sl@0: //make sure the cast will be ok by checking the uid is what we expect sl@0: // __ASSERT_ALWAYS(aImplementationUid==KUidMmfVideoOutput, Panic(EMMFVideoOutputPanicBadUID)); sl@0: MMMFVideoOutput* retPtr = STATIC_CAST(MMMFVideoOutput*, MDataSink::NewSinkL(aImplementationUid, aInitData)); sl@0: return retPtr; sl@0: } sl@0: sl@0: class CHardwareCodec; sl@0: sl@0: class CMMFVideoOutput : public CBase, public MMMFVideoOutput sl@0: /** sl@0: The interface into DevSound sl@0: **/ sl@0: { sl@0: public: sl@0: static MDataSink* NewSinkL() ; sl@0: virtual ~CMMFVideoOutput(); sl@0: sl@0: //MDataSink mixin implementations sl@0: virtual TFourCC SinkDataTypeCode(TMediaId /*aMediaId*/); //used by data path MDataSource/Sink for codec matching sl@0: virtual void EmptyBufferL(CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId /*aMediaId*/);//called by a MDataSource to empty a buffer sl@0: virtual void BufferFilledL(CMMFBuffer* aBuffer); //called by MDataSource to pass back full buffer to the sink sl@0: virtual TBool CanCreateSinkBuffer(); sl@0: virtual CMMFBuffer* CreateSinkBufferL(TMediaId /*aMediaId*/, TBool &aReference); sl@0: virtual TInt SinkThreadLogon(MAsyncEventHandler& aEventHandler); sl@0: virtual void SinkThreadLogoff(); sl@0: virtual void SinkPrimeL(); sl@0: virtual void SinkPauseL(); sl@0: virtual void SinkPlayL(); sl@0: virtual void SinkStopL(); sl@0: virtual void SetSinkPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); sl@0: TInt State(); sl@0: virtual void NegotiateL(MDataSource& aSource); sl@0: sl@0: sl@0: protected: sl@0: virtual void ConstructSinkL( const TDesC8& aInitData ) ; sl@0: sl@0: private: sl@0: inline CMMFVideoOutput() {} sl@0: sl@0: private: sl@0: sl@0: MAsyncEventHandler* iEventHandler; sl@0: sl@0: CMMFDataBuffer* iLastVideoBuffer; sl@0: CMMFDataBuffer* iVideoBufferCopy; sl@0: sl@0: enum TCodec sl@0: { sl@0: EUseARMCodec=0, sl@0: EUseHWCodec sl@0: }; sl@0: sl@0: enum TState sl@0: { sl@0: EIdle=0, sl@0: EDevSoundReady, sl@0: EMMFDevSoundFirstBufferSent, sl@0: EPlaying, sl@0: EPaused, sl@0: EBufferEmpty sl@0: }; sl@0: sl@0: enum TError sl@0: { sl@0: ECantCreateBuffer, sl@0: EEmptyBuffer, sl@0: EDevSoundNotLoaded, sl@0: ERecordNotSupported, sl@0: EDevSoundError, sl@0: EUnknown sl@0: }; sl@0: sl@0: MDataSource* iSupplier; sl@0: TState iState; sl@0: CHardwareCodec* iHWCodec; sl@0: sl@0: TBool iFirstBufferSent; sl@0: TBool iDevSoundLoaded; sl@0: sl@0: TError iError; sl@0: sl@0: TCodec iCodecSelect; sl@0: TMMFPrioritySettings iPrioritySettings; sl@0: sl@0: TUint iSourceSampleRate; sl@0: TUint iSourceChannels; sl@0: TFourCC iSourceFourCC; sl@0: TBool iNeedsSWConversion; sl@0: CMMFChannelAndSampleRateConverterFactory* iChannelAndSampleRateConverterFactory; sl@0: CMMFChannelAndSampleRateConverter* iChannelAndSampleRateConverter; sl@0: CMMFDataBuffer* iConvertBuffer; sl@0: CMMFBuffer* iBufferToEmpty; sl@0: CMMFDataBuffer* iDevSoundBuffer; sl@0: TUint iDestinationSampleRate; sl@0: TUint iDestinationChannels; sl@0: }; sl@0: sl@0: #endif