os/mm/mmlibs/mmfw/tsrc/mmfunittest/VCLNT/TS_VideoOutput/MmfVideoOutput.cpp
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.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,176 @@
     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 +#include "MmfVideoOutput.h"
    1.20 +#include <mmf/server/mmfdatabuffer.h>
    1.21 +#include <ecom/implementationproxy.h>
    1.22 +#include <mmf/common/mmffourcc.h>
    1.23 +
    1.24 +
    1.25 +void Panic(TInt aPanicCode)
    1.26 +	{
    1.27 +	_LIT(KMMFVideoOutputPanicCategory, "MMFVideoOutput");
    1.28 +	User::Panic(KMMFVideoOutputPanicCategory, aPanicCode);
    1.29 +	}
    1.30 +
    1.31 +MDataSink* CMMFVideoOutput::NewSinkL()
    1.32 +	{
    1.33 +	CMMFVideoOutput* self = new (ELeave) CMMFVideoOutput ;
    1.34 +	return STATIC_CAST( MDataSink*, self ) ;
    1.35 +	}
    1.36 +
    1.37 +
    1.38 +void CMMFVideoOutput::ConstructSinkL( const TDesC8& /*aInitData*/ )
    1.39 +	{
    1.40 +
    1.41 +	}
    1.42 +
    1.43 +
    1.44 +/**
    1.45 + *
    1.46 + * Send Video to MMFDevsound
    1.47 + *
    1.48 + * @param		"CMMFBuffer* aBuffer"
    1.49 + *				The data to write out
    1.50 + * @param		"MDataSource* aSupplier"
    1.51 + * @param		"TMediaId aMediaId"
    1.52 + *				Type of data supplied - currently ignored.
    1.53 + */
    1.54 +
    1.55 +void CMMFVideoOutput::EmptyBufferL(CMMFBuffer* /*aBuffer*/, MDataSource* /*aSupplier*/, TMediaId /*aMediaId*/)
    1.56 +	{
    1.57 +
    1.58 +	}
    1.59 +
    1.60 +void CMMFVideoOutput::NegotiateL(MDataSource& aSource)
    1.61 +	{
    1.62 +	if (aSource.DataSourceType() == KUidMmfFormatDecode)
    1.63 +		{//source is a clip so for now set sink settings to match source
    1.64 +		iSourceSampleRate = ((CMMFFormatDecode&)aSource).SampleRate();
    1.65 +		iSourceChannels = ((CMMFFormatDecode&)aSource).NumChannels();
    1.66 +		iSourceFourCC.Set(aSource.SourceDataTypeCode(TMediaId(KUidMediaTypeVideo)));
    1.67 +		((CMMFFormatDecode&)aSource).SuggestSourceBufferSize(KVideoOutputDefaultFrameSize);
    1.68 +		}
    1.69 +/*	[WINS DevSound supports different sample rates, stereo and different encoding]
    1.70 +	//Use SW conversion but  should configure Dev sound where possible
    1.71 +	// WINS DevSound is 8000 sample rate, mono & pcm16
    1.72 +	if ((iSourceChannels != 1)||(iSourceSampleRate != 8000)) 
    1.73 +		{
    1.74 +		iNeedsSWConversion = ETrue;
    1.75 +		TUint convertedBufferFrameSize = iMMFDevSound->BufferSize( ) / iSourceChannels;
    1.76 +		if (iConvertBuffer) delete iConvertBuffer; 
    1.77 +		iConvertBuffer = NULL;
    1.78 +		iConvertBuffer = CMMFDataBuffer::NewL(convertedBufferFrameSize);
    1.79 +		}
    1.80 +*/
    1.81 +	}
    1.82 +
    1.83 +void CMMFVideoOutput::SetSinkPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
    1.84 +	{
    1.85 +	iPrioritySettings = aPrioritySettings;
    1.86 +	}
    1.87 +
    1.88 +
    1.89 +void CMMFVideoOutput::SinkPrimeL()
    1.90 +	{
    1.91 +	iFirstBufferSent = EFalse;
    1.92 +	}
    1.93 +
    1.94 +
    1.95 +void CMMFVideoOutput::SinkPauseL()
    1.96 +	{
    1.97 +	iFirstBufferSent = EFalse;
    1.98 +	iState = EPaused;
    1.99 +	}
   1.100 +
   1.101 +
   1.102 +void CMMFVideoOutput::SinkPlayL()
   1.103 +	{
   1.104 +	}
   1.105 +
   1.106 +void CMMFVideoOutput::SinkStopL()
   1.107 +	{
   1.108 +	}
   1.109 +
   1.110 +TInt CMMFVideoOutput::State()
   1.111 +	{
   1.112 +	return iState;
   1.113 +	}
   1.114 +
   1.115 +
   1.116 +TInt CMMFVideoOutput::SinkThreadLogon(MAsyncEventHandler& /*aEventHandler*/)
   1.117 +	{
   1.118 +	return KErrNone;
   1.119 +	}
   1.120 +
   1.121 +
   1.122 +void CMMFVideoOutput::SinkThreadLogoff()
   1.123 +	{
   1.124 +	}
   1.125 +
   1.126 +
   1.127 +void CMMFVideoOutput::BufferFilledL(CMMFBuffer* /*aBuffer*/)
   1.128 +	{
   1.129 +//	__ASSERT_DEBUG(EFalse, Panic(EMMFVideoOutputPanicBufferFilledLNotSupported));
   1.130 +	}
   1.131 +
   1.132 +
   1.133 +TFourCC CMMFVideoOutput::SinkDataTypeCode(TMediaId /*aMediaId*/)
   1.134 +	{
   1.135 +	//hardwire 4CC - DevSound should have an interface to get this value
   1.136 +	return KMMFFourCCCodePCM16;
   1.137 +	}
   1.138 +
   1.139 +TBool CMMFVideoOutput::CanCreateSinkBuffer()
   1.140 +	{
   1.141 +	return ETrue;
   1.142 +	}
   1.143 +
   1.144 +CMMFBuffer* CMMFVideoOutput::CreateSinkBufferL(TMediaId /*aMediaId*/, TBool &aReference)
   1.145 +	{
   1.146 +	iDevSoundBuffer = CMMFDataBuffer::NewL(KVideoOutputDefaultFrameSize);
   1.147 +	aReference = ETrue;
   1.148 +	if ( iNeedsSWConversion )
   1.149 +		return iConvertBuffer;
   1.150 +	else
   1.151 +		return iDevSoundBuffer;
   1.152 +	}
   1.153 +
   1.154 +
   1.155 +CMMFVideoOutput::~CMMFVideoOutput()
   1.156 +	{
   1.157 +	delete iChannelAndSampleRateConverterFactory;
   1.158 +	delete iConvertBuffer;
   1.159 +	}
   1.160 +
   1.161 +
   1.162 +// __________________________________________________________________________
   1.163 +// Exported proxy for instantiation method resolution
   1.164 +// Define the interface UIDs
   1.165 +
   1.166 +
   1.167 +
   1.168 +const TImplementationProxy ImplementationTable[] =
   1.169 +	{
   1.170 +		IMPLEMENTATION_PROXY_ENTRY(KMmfUidVideoOutputInterface,	CMMFVideoOutput::NewSinkL)
   1.171 +	};
   1.172 +
   1.173 +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
   1.174 +	{
   1.175 +	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
   1.176 +
   1.177 +	return ImplementationTable;
   1.178 +	}
   1.179 +