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: #include "MmfVideoOutput.h" sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: void Panic(TInt aPanicCode) sl@0: { sl@0: _LIT(KMMFVideoOutputPanicCategory, "MMFVideoOutput"); sl@0: User::Panic(KMMFVideoOutputPanicCategory, aPanicCode); sl@0: } sl@0: sl@0: MDataSink* CMMFVideoOutput::NewSinkL() sl@0: { sl@0: CMMFVideoOutput* self = new (ELeave) CMMFVideoOutput ; sl@0: return STATIC_CAST( MDataSink*, self ) ; sl@0: } sl@0: sl@0: sl@0: void CMMFVideoOutput::ConstructSinkL( const TDesC8& /*aInitData*/ ) sl@0: { sl@0: sl@0: } sl@0: sl@0: sl@0: /** sl@0: * sl@0: * Send Video to MMFDevsound sl@0: * sl@0: * @param "CMMFBuffer* aBuffer" sl@0: * The data to write out sl@0: * @param "MDataSource* aSupplier" sl@0: * @param "TMediaId aMediaId" sl@0: * Type of data supplied - currently ignored. sl@0: */ sl@0: sl@0: void CMMFVideoOutput::EmptyBufferL(CMMFBuffer* /*aBuffer*/, MDataSource* /*aSupplier*/, TMediaId /*aMediaId*/) sl@0: { sl@0: sl@0: } sl@0: sl@0: void CMMFVideoOutput::NegotiateL(MDataSource& aSource) sl@0: { sl@0: if (aSource.DataSourceType() == KUidMmfFormatDecode) sl@0: {//source is a clip so for now set sink settings to match source sl@0: iSourceSampleRate = ((CMMFFormatDecode&)aSource).SampleRate(); sl@0: iSourceChannels = ((CMMFFormatDecode&)aSource).NumChannels(); sl@0: iSourceFourCC.Set(aSource.SourceDataTypeCode(TMediaId(KUidMediaTypeVideo))); sl@0: ((CMMFFormatDecode&)aSource).SuggestSourceBufferSize(KVideoOutputDefaultFrameSize); sl@0: } sl@0: /* [WINS DevSound supports different sample rates, stereo and different encoding] sl@0: //Use SW conversion but should configure Dev sound where possible sl@0: // WINS DevSound is 8000 sample rate, mono & pcm16 sl@0: if ((iSourceChannels != 1)||(iSourceSampleRate != 8000)) sl@0: { sl@0: iNeedsSWConversion = ETrue; sl@0: TUint convertedBufferFrameSize = iMMFDevSound->BufferSize( ) / iSourceChannels; sl@0: if (iConvertBuffer) delete iConvertBuffer; sl@0: iConvertBuffer = NULL; sl@0: iConvertBuffer = CMMFDataBuffer::NewL(convertedBufferFrameSize); sl@0: } sl@0: */ sl@0: } sl@0: sl@0: void CMMFVideoOutput::SetSinkPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) sl@0: { sl@0: iPrioritySettings = aPrioritySettings; sl@0: } sl@0: sl@0: sl@0: void CMMFVideoOutput::SinkPrimeL() sl@0: { sl@0: iFirstBufferSent = EFalse; sl@0: } sl@0: sl@0: sl@0: void CMMFVideoOutput::SinkPauseL() sl@0: { sl@0: iFirstBufferSent = EFalse; sl@0: iState = EPaused; sl@0: } sl@0: sl@0: sl@0: void CMMFVideoOutput::SinkPlayL() sl@0: { sl@0: } sl@0: sl@0: void CMMFVideoOutput::SinkStopL() sl@0: { sl@0: } sl@0: sl@0: TInt CMMFVideoOutput::State() sl@0: { sl@0: return iState; sl@0: } sl@0: sl@0: sl@0: TInt CMMFVideoOutput::SinkThreadLogon(MAsyncEventHandler& /*aEventHandler*/) sl@0: { sl@0: return KErrNone; sl@0: } sl@0: sl@0: sl@0: void CMMFVideoOutput::SinkThreadLogoff() sl@0: { sl@0: } sl@0: sl@0: sl@0: void CMMFVideoOutput::BufferFilledL(CMMFBuffer* /*aBuffer*/) sl@0: { sl@0: // __ASSERT_DEBUG(EFalse, Panic(EMMFVideoOutputPanicBufferFilledLNotSupported)); sl@0: } sl@0: sl@0: sl@0: TFourCC CMMFVideoOutput::SinkDataTypeCode(TMediaId /*aMediaId*/) sl@0: { sl@0: //hardwire 4CC - DevSound should have an interface to get this value sl@0: return KMMFFourCCCodePCM16; sl@0: } sl@0: sl@0: TBool CMMFVideoOutput::CanCreateSinkBuffer() sl@0: { sl@0: return ETrue; sl@0: } sl@0: sl@0: CMMFBuffer* CMMFVideoOutput::CreateSinkBufferL(TMediaId /*aMediaId*/, TBool &aReference) sl@0: { sl@0: iDevSoundBuffer = CMMFDataBuffer::NewL(KVideoOutputDefaultFrameSize); sl@0: aReference = ETrue; sl@0: if ( iNeedsSWConversion ) sl@0: return iConvertBuffer; sl@0: else sl@0: return iDevSoundBuffer; sl@0: } sl@0: sl@0: sl@0: CMMFVideoOutput::~CMMFVideoOutput() sl@0: { sl@0: delete iChannelAndSampleRateConverterFactory; sl@0: delete iConvertBuffer; sl@0: } sl@0: sl@0: sl@0: // __________________________________________________________________________ sl@0: // Exported proxy for instantiation method resolution sl@0: // Define the interface UIDs sl@0: sl@0: sl@0: sl@0: const TImplementationProxy ImplementationTable[] = sl@0: { sl@0: IMPLEMENTATION_PROXY_ENTRY(KMmfUidVideoOutputInterface, CMMFVideoOutput::NewSinkL) sl@0: }; sl@0: sl@0: EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) sl@0: { sl@0: aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); sl@0: sl@0: return ImplementationTable; sl@0: } sl@0: