os/mm/mmlibs/mmfw/tsrc/mmfunittest/VCLNT/TS_VideoOutput/MmfVideoOutput.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 #include "MmfVideoOutput.h"
    17 #include <mmf/server/mmfdatabuffer.h>
    18 #include <ecom/implementationproxy.h>
    19 #include <mmf/common/mmffourcc.h>
    20 
    21 
    22 void Panic(TInt aPanicCode)
    23 	{
    24 	_LIT(KMMFVideoOutputPanicCategory, "MMFVideoOutput");
    25 	User::Panic(KMMFVideoOutputPanicCategory, aPanicCode);
    26 	}
    27 
    28 MDataSink* CMMFVideoOutput::NewSinkL()
    29 	{
    30 	CMMFVideoOutput* self = new (ELeave) CMMFVideoOutput ;
    31 	return STATIC_CAST( MDataSink*, self ) ;
    32 	}
    33 
    34 
    35 void CMMFVideoOutput::ConstructSinkL( const TDesC8& /*aInitData*/ )
    36 	{
    37 
    38 	}
    39 
    40 
    41 /**
    42  *
    43  * Send Video to MMFDevsound
    44  *
    45  * @param		"CMMFBuffer* aBuffer"
    46  *				The data to write out
    47  * @param		"MDataSource* aSupplier"
    48  * @param		"TMediaId aMediaId"
    49  *				Type of data supplied - currently ignored.
    50  */
    51 
    52 void CMMFVideoOutput::EmptyBufferL(CMMFBuffer* /*aBuffer*/, MDataSource* /*aSupplier*/, TMediaId /*aMediaId*/)
    53 	{
    54 
    55 	}
    56 
    57 void CMMFVideoOutput::NegotiateL(MDataSource& aSource)
    58 	{
    59 	if (aSource.DataSourceType() == KUidMmfFormatDecode)
    60 		{//source is a clip so for now set sink settings to match source
    61 		iSourceSampleRate = ((CMMFFormatDecode&)aSource).SampleRate();
    62 		iSourceChannels = ((CMMFFormatDecode&)aSource).NumChannels();
    63 		iSourceFourCC.Set(aSource.SourceDataTypeCode(TMediaId(KUidMediaTypeVideo)));
    64 		((CMMFFormatDecode&)aSource).SuggestSourceBufferSize(KVideoOutputDefaultFrameSize);
    65 		}
    66 /*	[WINS DevSound supports different sample rates, stereo and different encoding]
    67 	//Use SW conversion but  should configure Dev sound where possible
    68 	// WINS DevSound is 8000 sample rate, mono & pcm16
    69 	if ((iSourceChannels != 1)||(iSourceSampleRate != 8000)) 
    70 		{
    71 		iNeedsSWConversion = ETrue;
    72 		TUint convertedBufferFrameSize = iMMFDevSound->BufferSize( ) / iSourceChannels;
    73 		if (iConvertBuffer) delete iConvertBuffer; 
    74 		iConvertBuffer = NULL;
    75 		iConvertBuffer = CMMFDataBuffer::NewL(convertedBufferFrameSize);
    76 		}
    77 */
    78 	}
    79 
    80 void CMMFVideoOutput::SetSinkPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
    81 	{
    82 	iPrioritySettings = aPrioritySettings;
    83 	}
    84 
    85 
    86 void CMMFVideoOutput::SinkPrimeL()
    87 	{
    88 	iFirstBufferSent = EFalse;
    89 	}
    90 
    91 
    92 void CMMFVideoOutput::SinkPauseL()
    93 	{
    94 	iFirstBufferSent = EFalse;
    95 	iState = EPaused;
    96 	}
    97 
    98 
    99 void CMMFVideoOutput::SinkPlayL()
   100 	{
   101 	}
   102 
   103 void CMMFVideoOutput::SinkStopL()
   104 	{
   105 	}
   106 
   107 TInt CMMFVideoOutput::State()
   108 	{
   109 	return iState;
   110 	}
   111 
   112 
   113 TInt CMMFVideoOutput::SinkThreadLogon(MAsyncEventHandler& /*aEventHandler*/)
   114 	{
   115 	return KErrNone;
   116 	}
   117 
   118 
   119 void CMMFVideoOutput::SinkThreadLogoff()
   120 	{
   121 	}
   122 
   123 
   124 void CMMFVideoOutput::BufferFilledL(CMMFBuffer* /*aBuffer*/)
   125 	{
   126 //	__ASSERT_DEBUG(EFalse, Panic(EMMFVideoOutputPanicBufferFilledLNotSupported));
   127 	}
   128 
   129 
   130 TFourCC CMMFVideoOutput::SinkDataTypeCode(TMediaId /*aMediaId*/)
   131 	{
   132 	//hardwire 4CC - DevSound should have an interface to get this value
   133 	return KMMFFourCCCodePCM16;
   134 	}
   135 
   136 TBool CMMFVideoOutput::CanCreateSinkBuffer()
   137 	{
   138 	return ETrue;
   139 	}
   140 
   141 CMMFBuffer* CMMFVideoOutput::CreateSinkBufferL(TMediaId /*aMediaId*/, TBool &aReference)
   142 	{
   143 	iDevSoundBuffer = CMMFDataBuffer::NewL(KVideoOutputDefaultFrameSize);
   144 	aReference = ETrue;
   145 	if ( iNeedsSWConversion )
   146 		return iConvertBuffer;
   147 	else
   148 		return iDevSoundBuffer;
   149 	}
   150 
   151 
   152 CMMFVideoOutput::~CMMFVideoOutput()
   153 	{
   154 	delete iChannelAndSampleRateConverterFactory;
   155 	delete iConvertBuffer;
   156 	}
   157 
   158 
   159 // __________________________________________________________________________
   160 // Exported proxy for instantiation method resolution
   161 // Define the interface UIDs
   162 
   163 
   164 
   165 const TImplementationProxy ImplementationTable[] =
   166 	{
   167 		IMPLEMENTATION_PROXY_ENTRY(KMmfUidVideoOutputInterface,	CMMFVideoOutput::NewSinkL)
   168 	};
   169 
   170 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
   171 	{
   172 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
   173 
   174 	return ImplementationTable;
   175 	}
   176