mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/DataSourceAdapter/Src/DataSourceAdapter.cpp
changeset 0 71ca22bcf22a
child 5 709f89d8c047
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Class definition for the DataSourceAdapter functions.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDES
       
    20 #include "DataSourceAdapter.h"
       
    21 #include "DebugMacros.h"
       
    22 #include <MultimediaDataSourceFactory.h>
       
    23 #include <mmffile.h>
       
    24 #include <MultimediaDataSource.h>
       
    25 #include <AudioOutputControlUtility.h>
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CDataSourceAdapter::CDataSourceAdapter
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 EXPORT_C CDataSourceAdapter::CDataSourceAdapter()
       
    36 	{
       
    37     iPosSeekable = EFalse;
       
    38     iTimeSeekable = EFalse;
       
    39     iDataSource = NULL;
       
    40     iIsProtected = EFalse;
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CDataSourceAdapter::ConstructL
       
    45 // Symbian 2nd phase constructor can leave.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 void CDataSourceAdapter::ConstructL()
       
    49     {
       
    50 	// should end up doing this for all sources
       
    51 	iZeroBuffer = CMMFDataBuffer::NewL(0); // this is just for test to allow source seek
       
    52 	iHdrBuffer = CMMFDataBuffer::NewL(20); // just enough to cover the header lengths create by recorder
       
    53 	}
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CDataSourceAdapter::NewL
       
    57 // Two-phased constructor.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 EXPORT_C CDataSourceAdapter* CDataSourceAdapter::NewL()
       
    61 	{
       
    62 	DP0(_L("CDataSourceAdapter::NewL"));
       
    63     CDataSourceAdapter* self = new(ELeave) CDataSourceAdapter();
       
    64     CleanupStack::PushL(self);
       
    65     self->ConstructL();
       
    66     CleanupStack::Pop(self);
       
    67     return self;
       
    68     }
       
    69 
       
    70 // Destructor
       
    71 EXPORT_C CDataSourceAdapter::~CDataSourceAdapter()
       
    72     {
       
    73 	DP0(_L("CDataSourceAdapter::~CDataSourceAdapter"));
       
    74 	delete iAsyncProxyFillBuffer;
       
    75     delete iZeroBuffer;
       
    76     delete iHdrBuffer;
       
    77     if (iMMDataSource)
       
    78     	{
       
    79     	iMMDataSource->Close();
       
    80 	    delete iMMDataSource;	
       
    81     	}
       
    82     iAudioOutputControlUtility = NULL;
       
    83     }
       
    84 
       
    85 EXPORT_C void CDataSourceAdapter::SetDataSourceL(MDataSource* aDataSource,
       
    86 								 MMultimediaDataSourceObserver* aMMultimediaDataSourceObserver,
       
    87 								 MAsyncEventHandler* aAsyncEventHandler)
       
    88 	{
       
    89 	DP0(_L("CDataSourceAdapter::SetDataSourceL"));
       
    90 	iHeaderOnly = EFalse;
       
    91 	iDataSource = aDataSource;
       
    92 	iAsyncEventHandler = aAsyncEventHandler;
       
    93     iSourceType = iDataSource->DataSourceType();
       
    94 	DP1(_L("CDataSourceAdapter::SetDataSourceL DataSourceType[0x%x]"), iSourceType);
       
    95 		
       
    96     if ((iSourceType == KMmdsStreamingSourceUid) || (iSourceType == KMmdsProgDLSourceUid) ||
       
    97         (iSourceType == KMmdsFileSourceUid) || (iSourceType == KMmdsDescriptorSourceUid))
       
    98         {
       
    99         TInt err = CMultimediaDataSourceFactory::CreateDataSource(*iDataSource, iMMDataSource);
       
   100 
       
   101         User::LeaveIfError(err);
       
   102 
       
   103         iMMDataSource->SetObserver(*aMMultimediaDataSourceObserver);
       
   104         
       
   105         err = iMMDataSource->Open();    
       
   106         User::LeaveIfError(err);
       
   107         
       
   108         iMMDataSource->GetSeekingSupport(iPosSeekable);
       
   109         }
       
   110 	else if ((iSourceType == KUidMmfFileSource) || (iSourceType == KOldProgDLSourceUid))
       
   111     	{
       
   112     	iPosSeekable = ETrue;
       
   113     	iDataSource->SourcePrimeL();
       
   114    		iIsProtected = static_cast<CMMFFile*>(iDataSource)->IsProtectedL();
       
   115 		iClip = static_cast<CMMFClip*>(iDataSource);
       
   116 		iClip->SourceThreadLogon(*aAsyncEventHandler);
       
   117 		iClip->ReadBufferL(iHdrBuffer,0);
       
   118 		iClip->ReadBufferL(iZeroBuffer, 0); // seek back to 0 position
       
   119 		const TUint8* ptr = iHdrBuffer->Data().Ptr();
       
   120     	if (iClip->Size() == 6)
       
   121     		{ // check for just the header from recorder
       
   122     		TUint32* w1p = (TUint32*)ptr;
       
   123     		TUint16* w2p = (TUint16*)(ptr+4);
       
   124     		if (((*w1p & 0x4D412123)==0x4D412123) && 
       
   125     			((*w2p & 0x0A52)==0x0A52))
       
   126     			{
       
   127 	  			iHeaderOnly = ETrue;
       
   128 	  			return;
       
   129     			}
       
   130     		}
       
   131 		}
       
   132 	else if (iSourceType == KUidMmfDescriptorSource)
       
   133 		{
       
   134 	    TRAP_IGNORE(iAsyncProxyFillBuffer = new(ELeave) CAsyncProxyFillBuffer(iDataSource));
       
   135 		}
       
   136 	}
       
   137 
       
   138 EXPORT_C TUid CDataSourceAdapter::DataSourceType() 
       
   139 	{
       
   140 	DP0(_L("CDataSourceAdapter::DataSourceType"));
       
   141 	return iDataSource->DataSourceType();
       
   142 	}
       
   143 
       
   144 EXPORT_C void CDataSourceAdapter::FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId)
       
   145 	{
       
   146 	DP0(_L("CDataSourceAdapter::FillBufferL"));
       
   147 	if (iAsyncProxyFillBuffer)
       
   148 		{// mmf descriptor does not have async intfc
       
   149 		iAsyncProxyFillBuffer->FillBuffer(aBuffer, aConsumer, aMediaId);
       
   150 		}
       
   151 	else
       
   152 		{
       
   153 		iDataSource->FillBufferL(aBuffer, aConsumer, aMediaId);
       
   154 		}	
       
   155 	}
       
   156 
       
   157 EXPORT_C void CDataSourceAdapter::BufferEmptiedL(CMMFBuffer* aBuffer)
       
   158 	{
       
   159 	DP0(_L("CDataSourceAdapter::BufferEmptiedL"));
       
   160 	iDataSource->BufferEmptiedL(aBuffer);
       
   161 	}
       
   162 
       
   163 EXPORT_C TBool CDataSourceAdapter::CanCreateSourceBuffer()
       
   164 	{
       
   165 	DP0(_L("CDataSourceAdapter::CanCreateSourceBuffer"));
       
   166 	return iDataSource->CanCreateSourceBuffer();
       
   167 	}
       
   168 	
       
   169 EXPORT_C CMMFBuffer* CDataSourceAdapter::CreateSourceBufferL(TMediaId aMediaId, TBool& aReference)
       
   170 	{
       
   171 	DP0(_L("CDataSourceAdapter::CreateSourceBufferL"));
       
   172 	return iDataSource->CreateSourceBufferL(aMediaId, aReference);
       
   173 	}
       
   174 
       
   175 EXPORT_C TInt CDataSourceAdapter::SourceThreadLogon(MAsyncEventHandler& aEventHandler)
       
   176 	{
       
   177 	DP0(_L("CDataSourceAdapter::SourceThreadLogon"));
       
   178 	return iDataSource->SourceThreadLogon(aEventHandler);
       
   179 	}
       
   180 
       
   181 EXPORT_C void CDataSourceAdapter::SourceThreadLogoff()
       
   182 	{
       
   183 	DP0(_L("CDataSourceAdapter::SourceThreadLogoff"));
       
   184 	iDataSource->SourceThreadLogoff();
       
   185 	}
       
   186 
       
   187 EXPORT_C void CDataSourceAdapter::SourcePrimeL()
       
   188 	{
       
   189 	DP0(_L("CDataSourceAdapter::SourcePrimeL"));
       
   190 	iDataSource->SourcePrimeL();
       
   191 	}
       
   192 	
       
   193 EXPORT_C void CDataSourceAdapter::SourceStopL()
       
   194 	{
       
   195 	DP0(_L("CDataSourceAdapter::SourceStopL"));
       
   196 	iDataSource->SourceStopL();
       
   197 	if (iAsyncProxyFillBuffer)
       
   198 		{
       
   199 		iAsyncProxyFillBuffer->Cancel();
       
   200 		iAsyncProxyFillBuffer->Reset();
       
   201 		}
       
   202 	}
       
   203 
       
   204 EXPORT_C void CDataSourceAdapter::SourcePlayL()
       
   205 	{
       
   206 	DP0(_L("CDataSourceAdapter::SourcePlayL"));
       
   207 	iDataSource->SourcePlayL();
       
   208 	}
       
   209 
       
   210 EXPORT_C TInt CDataSourceAdapter::SeekToPosition(TUint aPosition)
       
   211 	{
       
   212 	DP1(_L("CDataSourceAdapter::SeekToPosition [%d]"), aPosition);
       
   213 	TInt status = KErrNone;
       
   214 	if (iPosSeekable)
       
   215 		{
       
   216 	    if (iSourceType == KUidMmfFileSource)
       
   217     		{
       
   218 			TRAP(status, iClip->ReadBufferL(iZeroBuffer, aPosition)); // seek
       
   219     		}
       
   220     	else
       
   221     	    {
       
   222         	status = iMMDataSource->Seek(aPosition);
       
   223     	    }	
       
   224 		}
       
   225 	else
       
   226 		{
       
   227 		status = KErrNotSupported;
       
   228 		}	
       
   229 	return status;
       
   230 	}
       
   231 	
       
   232 EXPORT_C TInt CDataSourceAdapter::SeekToTime(TUint /*aTimeMs*/)
       
   233 	{
       
   234 	DP0(_L("CDataSourceAdapter::SeekToTime"));
       
   235 	TInt status = KErrNotSupported;
       
   236 	return status;
       
   237 	}
       
   238 
       
   239 EXPORT_C TInt CDataSourceAdapter::SeekToTime(TUint /*aTimeMs*/, TUint& /*aFoundTimeMs*/)
       
   240 	{
       
   241 	DP0(_L("CDataSourceAdapter::SeekToTime"));
       
   242 	TInt status = KErrNotSupported;
       
   243 	return status;
       
   244 	}
       
   245 	
       
   246 EXPORT_C TBool CDataSourceAdapter::IsTimeSeekable()
       
   247 	{
       
   248 	DP1(_L("CDataSourceAdapter::IsTimeSeekable[%d]"), iTimeSeekable);
       
   249 	return iTimeSeekable;
       
   250 	}
       
   251 	
       
   252 EXPORT_C TBool CDataSourceAdapter::IsPositonSeekable()
       
   253 	{
       
   254 	DP1(_L("CDataSourceAdapter::IsPositonSeekable[%d]"), iPosSeekable);
       
   255 	if (iMMDataSource)
       
   256 		{ // source seekability may change after file is downloaded so ask source again.
       
   257         iMMDataSource->GetSeekingSupport(iPosSeekable);
       
   258 		}
       
   259 	return iPosSeekable;
       
   260 	}
       
   261 
       
   262 EXPORT_C TInt CDataSourceAdapter::SourceSize()
       
   263 	{
       
   264 	DP0(_L("CDataSourceAdapter::SourceSize"));
       
   265 	iSourceSize = KErrUnknown;
       
   266     if ((iSourceType == KUidMmfFileSource) ||(iSourceType == KUidMmfDescriptorSource))
       
   267     	{
       
   268    		iSourceSize  = static_cast<CMMFClip*>(iDataSource)->Size();
       
   269     	}
       
   270 	else if (iMMDataSource)
       
   271         {
       
   272         TUint size;
       
   273         TInt stat = iMMDataSource->GetSize(size);
       
   274         if (stat == KErrNone)
       
   275         	{
       
   276         	iSourceSize = size;
       
   277         	}
       
   278 		}
       
   279     return iSourceSize;	
       
   280 	}
       
   281 
       
   282 EXPORT_C TInt CDataSourceAdapter::IsProtectedL()
       
   283 	{
       
   284 	DP0(_L("CDataSourceAdapter::IsProtectedL"));
       
   285     return iIsProtected;	
       
   286 	}
       
   287 
       
   288 EXPORT_C void CDataSourceAdapter::SetSourcePrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
       
   289 	{
       
   290 	DP0(_L("CDataSourceAdapter::SetSourcePrioritySettings"));
       
   291 	iDataSource->SetSourcePrioritySettings(aPrioritySettings);
       
   292 	}
       
   293 
       
   294 EXPORT_C TBool CDataSourceAdapter::OnlyHeaderPresent()
       
   295 	{
       
   296 	DP1(_L("CDataSourceAdapter::OnlyHeaderPresent [%d]"), iHeaderOnly);
       
   297 	return iHeaderOnly;	
       
   298 	}
       
   299 
       
   300 // -----------------------------------------------------------------------------
       
   301 // CDataSourceAdapter::ExecuteIntent
       
   302 // -----------------------------------------------------------------------------
       
   303 //
       
   304 EXPORT_C TInt CDataSourceAdapter::ExecuteIntent(ContentAccess::TIntent aIntent)
       
   305 	{
       
   306 	DP1(_L("CDataSourceAdapter::ExecuteIntent [%d]"), aIntent);
       
   307 	TInt status = KErrNone;
       
   308 	
       
   309 	if (iMMDataSource)
       
   310 		{
       
   311 	    status = iMMDataSource->ExecuteIntent(aIntent);
       
   312 		}
       
   313 	else if (iSourceType == KUidMmfFileSource)
       
   314 		{
       
   315    		CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
       
   316    		status = file->ExecuteIntent(aIntent);
       
   317 		}	
       
   318 	return status;	
       
   319 	}
       
   320 
       
   321 // -----------------------------------------------------------------------------
       
   322 // CDataSourceAdapter::SetAgentProperty
       
   323 // -----------------------------------------------------------------------------
       
   324 //
       
   325 EXPORT_C TInt CDataSourceAdapter::SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue)
       
   326 	{
       
   327 	DP2(_L("CDataSourceAdapter::SetAgentProperty prop[%d] val[%d]"), aProperty, aValue);
       
   328 	TInt status = KErrNone;
       
   329 	
       
   330 	if (iMMDataSource)
       
   331 		{
       
   332 	    status = iMMDataSource->SetAgentProperty(aProperty, aValue);
       
   333 		}
       
   334 	else if (iSourceType == KUidMmfFileSource)
       
   335 		{
       
   336 		CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
       
   337 		status = file->SetAgentProperty(aProperty, aValue);
       
   338 		}
       
   339 
       
   340 	return status;
       
   341 	}
       
   342 
       
   343 // -----------------------------------------------------------------------------
       
   344 // CDataSourceAdapter::EvaluateIntent
       
   345 // -----------------------------------------------------------------------------
       
   346 //
       
   347 EXPORT_C TInt CDataSourceAdapter::EvaluateIntent(ContentAccess::TIntent aIntent)
       
   348 	{
       
   349 	DP0(_L("CDataSourceAdapter::EvaluateIntent"));
       
   350 	TInt status = KErrNone;
       
   351 	
       
   352 	if (iMMDataSource)
       
   353 		{
       
   354 	    status = iMMDataSource->EvaluateIntent(aIntent);
       
   355 		}
       
   356 	else if (iSourceType == KUidMmfFileSource)
       
   357 		{
       
   358 		CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
       
   359 		status = file->EvaluateIntent(aIntent);
       
   360 		}	
       
   361 
       
   362 	DP1(_L("CDataSourceAdapter::EvaluateIntent aIntent[%d]"), aIntent);
       
   363 	return status;
       
   364 	}
       
   365 
       
   366 // -----------------------------------------------------------------------------
       
   367 // CDataSourceAdapter::GetInterface
       
   368 // -----------------------------------------------------------------------------
       
   369 //
       
   370 EXPORT_C TInt CDataSourceAdapter::GetInterface(TUid aInterfaceId, TVersion& aVersion, TAny*& aInterfaceImpl)
       
   371 	{
       
   372 	TInt err = KErrNotSupported;
       
   373 	
       
   374 	if (iMMDataSource)
       
   375 		{		
       
   376 		err = iMMDataSource->GetInterface(aInterfaceId, aVersion, aInterfaceImpl);
       
   377 		
       
   378 		// This Error check is done because all sources have not Implemented this Interface
       
   379 		// and the Controller will Leave if we return this Error in Prime()
       
   380 		// To maintain compatibility untill all the EMC sources implement GetInterface()
       
   381 		if(err == KErrNotFound)
       
   382 		    return KErrNone;
       
   383 		    
       
   384 		if (err != KErrNone)
       
   385 			return err;
       
   386 		}
       
   387 				
       
   388 	return err;	
       
   389 	}		
       
   390 	
       
   391 // -----------------------------------------------------------------------------
       
   392 // CDataSourceAdapter::Event
       
   393 // -----------------------------------------------------------------------------
       
   394 //
       
   395 EXPORT_C void CDataSourceAdapter::Event(TUid aEvent)
       
   396 	{
       
   397 	if (iMMDataSource)
       
   398 		{
       
   399 		iMMDataSource->Event(aEvent);
       
   400 		}
       
   401 	}
       
   402 
       
   403 // -----------------------------------------------------------------------------
       
   404 // CDataSourceAdapter::CAsyncProxyFillBuffer
       
   405 // -----------------------------------------------------------------------------
       
   406 
       
   407 // -----------------------------------------------------------------------------
       
   408 // CDataSourceAdapter::CAsyncProxyFillBuffer::CAsyncProxyFillBuffer
       
   409 // -----------------------------------------------------------------------------
       
   410 //
       
   411 CDataSourceAdapter::CAsyncProxyFillBuffer::CAsyncProxyFillBuffer(MDataSource* aDataSource) :
       
   412     CActive(EPriorityHigh),
       
   413     iDataSource(aDataSource)
       
   414 	{
       
   415     DP0(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::CAsyncProxyFillBuffer"));
       
   416 	CActiveScheduler::Add(this);
       
   417 	}
       
   418 
       
   419 // -----------------------------------------------------------------------------
       
   420 // CDataSourceAdapter::CAsyncProxyFillBuffer::~CAsyncProxyFillBuffer
       
   421 // -----------------------------------------------------------------------------
       
   422 //
       
   423 	
       
   424 CDataSourceAdapter::CAsyncProxyFillBuffer::~CAsyncProxyFillBuffer()
       
   425 	{
       
   426     DP0(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::~CAsyncProxyFillBuffer"));
       
   427 	Cancel();
       
   428 	iQueuedAsyncBuffers.Close();
       
   429 	}
       
   430 
       
   431 // -----------------------------------------------------------------------------
       
   432 // CDataSourceAdapter::CAsyncProxyFillBuffer::FillBuffer
       
   433 // -----------------------------------------------------------------------------
       
   434 //
       
   435 void CDataSourceAdapter::CAsyncProxyFillBuffer::FillBuffer(CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId)
       
   436 	{
       
   437     DP2(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::FillBuffer buffer[%x] this=consumer[%d]"),
       
   438 	    static_cast<CMMFDataBuffer*>(aBuffer)->Data().Ptr(), (aConsumer == (MDataSink*)this));
       
   439     iMediaId = aMediaId;
       
   440 	if (aConsumer == (MDataSink*)this)
       
   441 		{
       
   442 	    iBuffer = aBuffer;
       
   443 	    iStatus = KRequestPending; // service request would be made here and pending set by service provider
       
   444 		SetActive();
       
   445 		iRequestStatus = &iStatus;
       
   446 		User::RequestComplete(iRequestStatus, KErrNone);
       
   447 		}	
       
   448 	else
       
   449 		{
       
   450 	    iConsumer = aConsumer;
       
   451 	    if (IsActive()|| (iQueuedAsyncBuffers.Count() > 0))
       
   452     		{
       
   453 		    DP1(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::RunL que[%x]"),
       
   454 		    		static_cast<CMMFDataBuffer*>(aBuffer)->Data().Ptr());
       
   455         	iQueuedAsyncBuffers.Append(aBuffer);
       
   456 	    	}
       
   457    		else
       
   458    			{
       
   459 		    iBuffer = aBuffer;
       
   460 		    iStatus = KRequestPending; // service request would be made here and pending set by service provider
       
   461 			SetActive();
       
   462 			iRequestStatus = &iStatus;
       
   463 			User::RequestComplete(iRequestStatus, KErrNone);
       
   464 	   		}
       
   465 		}
       
   466 	}
       
   467     
       
   468 // -----------------------------------------------------------------------------
       
   469 // CDataSourceAdapter::CAsyncProxyFillBuffer::RunL
       
   470 // -----------------------------------------------------------------------------
       
   471 //
       
   472 void CDataSourceAdapter::CAsyncProxyFillBuffer::RunL()
       
   473 	{
       
   474     DP0(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::RunL"));
       
   475     if (iDataSource->DataSourceType() == KUidMmfDescriptorSource)
       
   476     	{ 
       
   477     	// descriptor has no way to set read position back to 0
       
   478     	// so we have to always read using position
       
   479     	// then we can adjust the read position and send the buffer to the consumer
       
   480         static_cast<CMMFFile*>(iDataSource)->ReadBufferL(iBuffer, iReadPos);
       
   481     	TInt bytesRead = static_cast<CMMFDataBuffer*>(iBuffer)->Data().Length();
       
   482     	iReadPos += bytesRead;
       
   483     	iConsumer->BufferFilledL(iBuffer);
       
   484     	}
       
   485     else
       
   486     	{
       
   487         iDataSource->FillBufferL(iBuffer,iConsumer,iMediaId);
       
   488     	}
       
   489 	if (iQueuedAsyncBuffers.Count() > 0)
       
   490 		{
       
   491 	    DP1(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::RunL que count [%d]"),iQueuedAsyncBuffers.Count());
       
   492 		FillBuffer(iQueuedAsyncBuffers[0],(MDataSink*)this,iMediaId);
       
   493 		iQueuedAsyncBuffers.Remove(0);
       
   494 		}
       
   495 	}
       
   496 
       
   497 // -----------------------------------------------------------------------------
       
   498 // CDataSourceAdapter::CAsyncProxyFillBuffer::RunError
       
   499 // -----------------------------------------------------------------------------
       
   500 //
       
   501 TInt CDataSourceAdapter::CAsyncProxyFillBuffer::RunError(TInt aError)
       
   502 	{
       
   503 	if (aError)
       
   504 	    {
       
   505 	    DP1(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::RunError, aError = %d"), aError);
       
   506 	    }
       
   507 	return KErrNone;
       
   508 	}
       
   509 
       
   510 // -----------------------------------------------------------------------------
       
   511 // CDataSourceAdapter::CAsyncProxyFillBuffer::DoCancel
       
   512 // -----------------------------------------------------------------------------
       
   513 //
       
   514 void CDataSourceAdapter::CAsyncProxyFillBuffer::DoCancel()
       
   515 	{
       
   516 	DP0(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::DoCancel"));
       
   517 //	Reset();
       
   518 	}
       
   519 
       
   520 // -----------------------------------------------------------------------------
       
   521 // CDataSourceAdapter::CAsyncProxyFillBuffer::Reset
       
   522 // -----------------------------------------------------------------------------
       
   523 //
       
   524 void CDataSourceAdapter::CAsyncProxyFillBuffer::Reset()
       
   525 	{
       
   526 	DP0(_L("CDataSourceAdapter::CAsyncProxyFillBuffer::Reset"));
       
   527 	iQueuedAsyncBuffers.Reset();
       
   528 	iReadPos = 0;
       
   529 	}
       
   530 
       
   531 // -----------------------------------------------------------------------------
       
   532 // CDataSourceAdapter::SetAudioOutputControlUtil
       
   533 // sets the AudioOutputControlUtitlity reference and sets Datasource to AudioOutputContolUtility
       
   534 // -----------------------------------------------------------------------------
       
   535 //
       
   536 EXPORT_C TInt CDataSourceAdapter::SetAudioOutputControlUtil(CAudioOutputControlUtility* aAudioOutputControlUtility)
       
   537     {
       
   538     DP0(_L("CDataSourceAdapter::SetAudioOutputControlUtil"));
       
   539 	TInt status(KErrNotReady);
       
   540     iAudioOutputControlUtility = aAudioOutputControlUtility;
       
   541     
       
   542     if (iMMDataSource)
       
   543         status = iAudioOutputControlUtility->SetDataSource(iMMDataSource);   //EMC source
       
   544     else
       
   545         status = iAudioOutputControlUtility->SetDataSource(iDataSource);     //MMF source
       
   546 		
       
   547 	return status;
       
   548     }
       
   549 
       
   550 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   551 // End of File
       
   552