mmlibs/mmfw/src/Client/Video/mmfclientvideoplayerbody.cpp
changeset 13 efebd1779a59
parent 0 40261b775718
child 12 b74061f7f3d2
equal deleted inserted replaced
0:40261b775718 13:efebd1779a59
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    21 #include <mmf/server/mmffile.h>
    21 #include <mmf/server/mmffile.h>
    22 #include "mmfvideocallback.h"
    22 #include "mmfvideocallback.h"
    23 #include "VideoPlayerBody.h"
    23 #include "VideoPlayerBody.h"
    24 #include "mmfclientvideocommon.h"
    24 #include "mmfclientvideocommon.h"
    25 #include "mmfclientutility.h"
    25 #include "mmfclientutility.h"
       
    26 #include "mediaclientvideotrace.h"
    26 
    27 
    27 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    28 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    28 #include <mmf/common/mmfvideoenums.h>
    29 #include <mmf/common/mmfvideoenums.h>
    29 #endif
    30 #endif
    30 
    31 
    67 															 CWsScreenDevice& aScreenDevice,
    68 															 CWsScreenDevice& aScreenDevice,
    68 															 RWindowBase& aWindow,
    69 															 RWindowBase& aWindow,
    69 															 const TRect& aScreenRect,
    70 															 const TRect& aScreenRect,
    70 															 const TRect& aClipRect)
    71 															 const TRect& aClipRect)
    71 	{
    72 	{
       
    73     DEBUG_PRINTF("CVideoPlayerUtility::CBody::NewL (CVPU1)++");
    72 	CBody* self = new(ELeave) CBody(aParent, aObserver, aScreenDevice.GetScreenNumber(), aPriority, aPref);
    74 	CBody* self = new(ELeave) CBody(aParent, aObserver, aScreenDevice.GetScreenNumber(), aPriority, aPref);
    73 	CleanupStack::PushL(self);
    75 	CleanupStack::PushL(self);
    74 	self->ConstructL(aWs, aScreenDevice, aWindow, aScreenRect, aClipRect);
    76 	self->ConstructL(aWs, aScreenDevice, aWindow, aScreenRect, aClipRect);
    75 	CleanupStack::Pop();
    77 	CleanupStack::Pop();
       
    78     DEBUG_PRINTF("CVideoPlayerUtility::CBody::NewL (CVPU1)--");
    76 	return self;
    79 	return self;
    77 	}
    80 	}
    78 
    81 
    79 #ifdef SYMBIAN_BUILD_GCE
    82 #ifdef SYMBIAN_BUILD_GCE
    80 CVideoPlayerUtility::CBody* CVideoPlayerUtility::CBody::NewL(CVideoPlayerUtility2* aParent,
    83 CVideoPlayerUtility::CBody* CVideoPlayerUtility::CBody::NewL(CVideoPlayerUtility2* aParent,
    81 															 MVideoPlayerUtilityObserver& aObserver,
    84 															 MVideoPlayerUtilityObserver& aObserver,
    82 															 TInt aPriority,
    85 															 TInt aPriority,
    83 															 TInt aPref)
    86 															 TInt aPref)
    84 	{
    87 	{
       
    88     DEBUG_PRINTF("CVideoPlayerUtility::CBody::NewL (CVPU2)++");
    85 	CBody* self = new(ELeave) CBody(aParent, aObserver, aPriority, aPref);
    89 	CBody* self = new(ELeave) CBody(aParent, aObserver, aPriority, aPref);
    86 	CleanupStack::PushL(self);
    90 	CleanupStack::PushL(self);
    87 	self->ConstructL();
    91 	self->ConstructL();
    88 	CleanupStack::Pop();
    92 	CleanupStack::Pop();
       
    93     DEBUG_PRINTF("CVideoPlayerUtility::CBody::NewL (CVPU2)--");
    89 	return self;
    94 	return self;
    90 	}
    95 	}
    91 #endif // SYMBIAN_BUILD_GCE
    96 #endif // SYMBIAN_BUILD_GCE
    92 
    97 
    93 CVideoPlayerUtility::CBody::~CBody()
    98 CVideoPlayerUtility::CBody::~CBody()
    94 	{
    99 	{
       
   100     DEBUG_PRINTF("CVideoPlayerUtility::CBody::~CBody++");
    95 	Close();
   101 	Close();
    96 	
   102 	
    97 	delete iControllerImplementationInformation;
   103 	delete iControllerImplementationInformation;
    98 	delete iDirectScreenAccess;
   104 	delete iDirectScreenAccess;
    99 	delete iFindAndOpenController;
   105 	delete iFindAndOpenController;
   102 	delete iAsyncCallback;
   108 	delete iAsyncCallback;
   103 	delete iMimeType;
   109 	delete iMimeType;
   104 	delete iFrameBitmap;
   110 	delete iFrameBitmap;
   105 	if (iFbsSessionConnected)
   111 	if (iFbsSessionConnected)
   106 		iFbsSession.Disconnect();
   112 		iFbsSession.Disconnect();
       
   113     DEBUG_PRINTF("CVideoPlayerUtility::CBody::~CBody--");
   107 	}
   114 	}
   108 
   115 
   109 void CVideoPlayerUtility::CBody::Close()
   116 void CVideoPlayerUtility::CBody::Close()
   110 	{
   117 	{
       
   118     DEBUG_PRINTF("CVideoPlayerUtility::CBody::Close++");
   111 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
   119 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
   112 	DisableSubtitles();
   120 	DisableSubtitles();
   113 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
   121 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
   114 
   122 
   115 	if (iAsyncCallback)
   123 	if (iAsyncCallback)
   133 
   141 
   134 	iController.Close();	
   142 	iController.Close();	
   135 	iControllerUid = KNullUid;
   143 	iControllerUid = KNullUid;
   136 	iControllerOpen = EFalse;
   144 	iControllerOpen = EFalse;
   137 	iDirectScreenAccessAbort = EFalse;
   145 	iDirectScreenAccessAbort = EFalse;
       
   146     DEBUG_PRINTF("CVideoPlayerUtility::CBody::Close--");
   138 	}
   147 	}
   139 
   148 
   140 CVideoPlayerUtility::CBody::CBody(CVideoPlayerUtility* aParent,
   149 CVideoPlayerUtility::CBody::CBody(CVideoPlayerUtility* aParent,
   141 								  MVideoPlayerUtilityObserver& aObserver,
   150 								  MVideoPlayerUtilityObserver& aObserver,
   142 								  TInt aScreenNumber,
   151 								  TInt aScreenNumber,
   199 	iPrioritySettings.iPref = aPref;
   208 	iPrioritySettings.iPref = aPref;
   200 	}
   209 	}
   201 
   210 
   202 void CVideoPlayerUtility::CBody::ConstructL()
   211 void CVideoPlayerUtility::CBody::ConstructL()
   203 	{
   212 	{
       
   213     DEBUG_PRINTF("CVideoPlayerUtility::CBody::ConstructL1++");
   204 	CommonConstructL();
   214 	CommonConstructL();
   205 	iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
   215 	iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
   206 	iFindAndOpenController->SetSurfaceMode(iUsingVPU2, &iVideoPlaySurfaceSupportCustomCommands);
   216 	iFindAndOpenController->SetSurfaceMode(iUsingVPU2, &iVideoPlaySurfaceSupportCustomCommands);
   207 	iFindAndOpenController->Configure(KUidMediaTypeVideo, iPrioritySettings, CMMFPluginSelectionParameters::EAllowOtherMediaIds);
   217 	iFindAndOpenController->Configure(KUidMediaTypeVideo, iPrioritySettings, CMMFPluginSelectionParameters::EAllowOtherMediaIds);
   208 	iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback);
   218 	iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback);
       
   219     DEBUG_PRINTF("CVideoPlayerUtility::CBody::ConstructL1--");
   209 	}
   220 	}
   210 
   221 
   211 #endif // SYMBIAN_BUILD_GCE
   222 #endif // SYMBIAN_BUILD_GCE
   212 
   223 
   213 void CVideoPlayerUtility::CBody::ConstructL(RWsSession& aWs,
   224 void CVideoPlayerUtility::CBody::ConstructL(RWsSession& aWs,
   214 						CWsScreenDevice& aScreenDevice,
   225 						CWsScreenDevice& aScreenDevice,
   215 						RWindowBase& aWindow,
   226 						RWindowBase& aWindow,
   216 						const TRect& aWindowRect,
   227 						const TRect& aWindowRect,
   217 						const TRect& aClipRect)
   228 						const TRect& aClipRect)
   218 	{
   229 	{
       
   230     DEBUG_PRINTF("CVideoPlayerUtility::CBody::ConstructL2++");
   219 	CommonConstructL();
   231 	CommonConstructL();
   220 	
   232 	
   221 	SetDisplayWindowL(aWs, aScreenDevice, aWindow, aWindowRect, aClipRect);
   233 	SetDisplayWindowL(aWs, aScreenDevice, aWindow, aWindowRect, aClipRect);
   222 	iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
   234 	iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
   223 #ifdef SYMBIAN_BUILD_GCE	
   235 #ifdef SYMBIAN_BUILD_GCE	
   233 	iClipRect = aClipRect;	
   245 	iClipRect = aClipRect;	
   234 
   246 
   235 #endif
   247 #endif
   236 	iFindAndOpenController->Configure(KUidMediaTypeVideo, iPrioritySettings, CMMFPluginSelectionParameters::EAllowOtherMediaIds);
   248 	iFindAndOpenController->Configure(KUidMediaTypeVideo, iPrioritySettings, CMMFPluginSelectionParameters::EAllowOtherMediaIds);
   237 	iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback);
   249 	iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback);
       
   250     DEBUG_PRINTF("CVideoPlayerUtility::CBody::ConstructL2--");
   238 	}
   251 	}
   239 
   252 
   240 void CVideoPlayerUtility::CBody::CommonConstructL()
   253 void CVideoPlayerUtility::CBody::CommonConstructL()
   241 	{
   254 	{
   242 	iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
   255 	iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
   247 	iFbsSessionConnected = ETrue;
   260 	iFbsSessionConnected = ETrue;
   248 	}
   261 	}
   249 
   262 
   250 void CVideoPlayerUtility::CBody::Reset() 
   263 void CVideoPlayerUtility::CBody::Reset() 
   251 	{
   264 	{
       
   265     DEBUG_PRINTF("CVideoPlayerUtility::CBody::Reset++");
   252 	Close();
   266 	Close();
   253 	
   267 	
   254 	// reset all state variables
   268 	// reset all state variables
   255 	iEventOpenReceived = EFalse;
   269 	iEventOpenReceived = EFalse;
   256 	iCallbackOpenReceived = EFalse;
   270 	iCallbackOpenReceived = EFalse;
   257 	iOpenError = KErrNone;
   271 	iOpenError = KErrNone;
   258 #ifdef SYMBIAN_BUILD_GCE
   272 #ifdef SYMBIAN_BUILD_GCE
   259 	iGraphicsSurfaceSupported = EFalse;
   273 	iGraphicsSurfaceSupported = EFalse;
   260 #endif
   274 #endif
   261 	iControllerUid = KNullUid;
   275 	iControllerUid = KNullUid;
       
   276     DEBUG_PRINTF("CVideoPlayerUtility::CBody::Reset--");
   262 	}
   277 	}
   263 
   278 
   264 void CVideoPlayerUtility::CBody::SetAndUpdateWindow()
   279 void CVideoPlayerUtility::CBody::SetAndUpdateWindow()
   265 	{
   280 	{
       
   281     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetAndUpdateWindow++");
   266 	if (iOpenError == KErrNone)	
   282 	if (iOpenError == KErrNone)	
   267 		{
   283 		{
   268 		// Set the display window and update display region if the controller doesn't support graphics surface. 		
   284 		// Set the display window and update display region if the controller doesn't support graphics surface. 		
   269 		iOpenError = iVideoPlayControllerCustomCommands.SetDisplayWindow(iWindowRect, iClipRect);
   285 		iOpenError = iVideoPlayControllerCustomCommands.SetDisplayWindow(iWindowRect, iClipRect);
   270 		}
   286 		}
   271 
   287 
   272 	if (iOpenError == KErrNone && iDirectScreenAccess && iDirectScreenAccess->DrawingRegion())
   288 	if (iOpenError == KErrNone && iDirectScreenAccess && iDirectScreenAccess->DrawingRegion())
   273 		{
   289 		{
   274 		iOpenError = iVideoPlayControllerCustomCommands.UpdateDisplayRegion(*iDirectScreenAccess->DrawingRegion());
   290 		iOpenError = iVideoPlayControllerCustomCommands.UpdateDisplayRegion(*iDirectScreenAccess->DrawingRegion());
   275 		}
   291 		}
       
   292     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetAndUpdateWindow--");
   276 	}
   293 	}
   277 
   294 
   278 void CVideoPlayerUtility::CBody::MfaocComplete(		
   295 void CVideoPlayerUtility::CBody::MfaocComplete(		
   279 	TInt& aError, 
   296 	TInt& aError, 
   280 	RMMFController*	/*aController*/,
   297 	RMMFController*	/*aController*/,
   281 	TUid aControllerUid, 
   298 	TUid aControllerUid, 
   282 	TMMFMessageDestination* /*aSourceHandle*/, 
   299 	TMMFMessageDestination* /*aSourceHandle*/, 
   283 	TMMFMessageDestination* /*aSinkHandle*/)
   300 	TMMFMessageDestination* /*aSinkHandle*/)
   284 	{
   301 	{
       
   302     DEBUG_PRINTF("CVideoPlayerUtility::CBody::MfaocComplete++");
       
   303     DEBUG_PRINTF3("CVideoPlayerUtility::CBody::MfaocComplete - aError %d, aControllerUid 0x%X", aError, aControllerUid.iUid);
   285 	iCallbackOpenReceived = ETrue;
   304 	iCallbackOpenReceived = ETrue;
   286 
   305 
   287 	// save the error in iOpenError -
   306 	// save the error in iOpenError -
   288 	// unless HandleEvent(KMMFEventCategoryVideoOpenComplete) 
   307 	// unless HandleEvent(KMMFEventCategoryVideoOpenComplete) 
   289 	// has reported an error already
   308 	// has reported an error already
   293 	if (iOpenError == KErrNone)
   312 	if (iOpenError == KErrNone)
   294 		{
   313 		{
   295 #ifdef SYMBIAN_BUILD_GCE
   314 #ifdef SYMBIAN_BUILD_GCE
   296 		// Check if the graphics surfaces is supported
   315 		// Check if the graphics surfaces is supported
   297 		TInt err = CheckSurfaceSupported();
   316 		TInt err = CheckSurfaceSupported();
       
   317 
       
   318 		DEBUG_PRINTF4("CVideoPlayerUtility::CBody::MfaocComplete - Checked surfaces supported - Err %d, Surfaces supported %d, Using VPU2 %d", err, iGraphicsSurfaceSupported, iUsingVPU2);
   298 	
   319 	
   299 		if (!iGraphicsSurfaceSupported)
   320 		if (!iGraphicsSurfaceSupported)
   300 			{
   321 			{
   301 			if (err != KErrNone && iUsingVPU2)
   322 			if (err != KErrNone && iUsingVPU2)
   302 				{
   323 				{
   395 		// stop a subsequent HandleEvent(KMMFEventCategoryVideoOpenComplete) 
   416 		// stop a subsequent HandleEvent(KMMFEventCategoryVideoOpenComplete) 
   396 		// from issuing another callback to client
   417 		// from issuing another callback to client
   397 		iCallbackOpenReceived = EFalse;
   418 		iCallbackOpenReceived = EFalse;
   398 		iAsyncCallback->Signal(iOpenError, CMMFVideoPlayerCallback::EOpenCompleteEvent);
   419 		iAsyncCallback->Signal(iOpenError, CMMFVideoPlayerCallback::EOpenCompleteEvent);
   399 		}
   420 		}
   400 
   421 	
       
   422     DEBUG_PRINTF("CVideoPlayerUtility::CBody::MfaocComplete--");
   401 	}
   423 	}
   402 
   424 
   403 void CVideoPlayerUtility::CBody::OpenFileL(const TDesC& aFileName, TUid aControllerUid)
   425 void CVideoPlayerUtility::CBody::OpenFileL(const TDesC& aFileName, TUid aControllerUid)
   404 	{
   426 	{
       
   427     DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenFileL (filename)++");
   405 	TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
   428 	TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
   406 	OpenFileL(filesource, aControllerUid);
   429 	OpenFileL(filesource, aControllerUid);
       
   430     DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenFileL (filename)--");
   407 	}
   431 	}
   408 	
   432 	
   409 void CVideoPlayerUtility::CBody::OpenFileL(const RFile& aFile, TUid aControllerUid)
   433 void CVideoPlayerUtility::CBody::OpenFileL(const RFile& aFile, TUid aControllerUid)
   410 	{
   434 	{
       
   435     DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenFileL (filehandle)++");
   411 	RFile& file = const_cast<RFile&>(aFile);
   436 	RFile& file = const_cast<RFile&>(aFile);
   412 	TMMFileHandleSource filehandlesource(file, KDefaultContentObject, EPlay);
   437 	TMMFileHandleSource filehandlesource(file, KDefaultContentObject, EPlay);
   413 	OpenFileL(filehandlesource, aControllerUid);
   438 	OpenFileL(filehandlesource, aControllerUid);
       
   439     DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenFileL (filehandle)--");
   414 	}
   440 	}
   415 
   441 
   416 void CVideoPlayerUtility::CBody::OpenFileL(const TMMSource& aSource, TUid aControllerUid)
   442 void CVideoPlayerUtility::CBody::OpenFileL(const TMMSource& aSource, TUid aControllerUid)
   417 	{
   443 	{
       
   444     DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenFileL (source)++");
       
   445     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::OpenFileL - aControllerUid 0x%X", aControllerUid.iUid);
   418 	// Make sure we are closed
   446 	// Make sure we are closed
   419 	Reset();
   447 	Reset();
   420 
   448 
   421 	iFindAndOpenController->ConfigureSourceSink(
   449 	iFindAndOpenController->ConfigureSourceSink(
   422 		aSource,
   450 		aSource,
   432 		}
   460 		}
   433 	else
   461 	else
   434 		{
   462 		{
   435 		iFindAndOpenController->OpenByFileSource(aSource);
   463 		iFindAndOpenController->OpenByFileSource(aSource);
   436 		}
   464 		}
       
   465 
       
   466 	DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenFileL (source)--");
   437 	}
   467 	}
   438 	
   468 	
   439 //
   469 //
   440 // This method launches and initializes plugin controller based on the stream 
   470 // This method launches and initializes plugin controller based on the stream 
   441 // source header passed in the descriptor buffer.
   471 // source header passed in the descriptor buffer.
   442 //
   472 //
   443 void CVideoPlayerUtility::CBody::OpenDesL(const TDesC8& aDescriptor, TUid aControllerUid)
   473 void CVideoPlayerUtility::CBody::OpenDesL(const TDesC8& aDescriptor, TUid aControllerUid)
   444 	{
   474 	{
       
   475     DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenDesL++");
   445 	// Make sure we are closed
   476 	// Make sure we are closed
   446 	Reset();
   477 	Reset();
   447 
   478 
   448 	iFindAndOpenController->ConfigureSourceSink(
   479 	iFindAndOpenController->ConfigureSourceSink(
   449 		CMMFFindAndOpenController::TSourceSink(KUidMmfDescriptorSource, CMMFFindAndOpenController::GetConfigDescriptor(aDescriptor)), 
   480 		CMMFFindAndOpenController::TSourceSink(KUidMmfDescriptorSource, CMMFFindAndOpenController::GetConfigDescriptor(aDescriptor)), 
   459 		}
   490 		}
   460 	else
   491 	else
   461 		{
   492 		{
   462 		iFindAndOpenController->OpenByDescriptor(aDescriptor);
   493 		iFindAndOpenController->OpenByDescriptor(aDescriptor);
   463 		}
   494 		}
       
   495     DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenDesL--");
   464 	}
   496 	}
   465 	
   497 	
   466 void CVideoPlayerUtility::CBody::OpenUrlL(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType, TUid aControllerUid)
   498 void CVideoPlayerUtility::CBody::OpenUrlL(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType, TUid aControllerUid)
   467 	{
   499 	{
       
   500     DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenUrlL++");
   468 	// Make sure we are closed
   501 	// Make sure we are closed
   469 	Reset();
   502 	Reset();
   470 
   503 
   471 	CBufFlat* urlCfgBuffer = NULL;
   504 	CBufFlat* urlCfgBuffer = NULL;
   472     CMMFFindAndOpenController::GetConfigUrlL(urlCfgBuffer, aUrl, aIapId);
   505     CMMFFindAndOpenController::GetConfigUrlL(urlCfgBuffer, aUrl, aIapId);
   485 		}
   518 		}
   486 	else
   519 	else
   487 		iFindAndOpenController->OpenByUrl(aUrl, aIapId, aMimeType);
   520 		iFindAndOpenController->OpenByUrl(aUrl, aIapId, aMimeType);
   488 
   521 
   489 	delete urlCfgBuffer;
   522 	delete urlCfgBuffer;
       
   523 
       
   524 	DEBUG_PRINTF("CVideoPlayerUtility::CBody::OpenUrlL--");
   490 	}
   525 	}
   491 
   526 
   492 void CVideoPlayerUtility::CBody::Play()
   527 void CVideoPlayerUtility::CBody::Play()
   493 	{
   528 	{
       
   529     DEBUG_PRINTF("CVideoPlayerUtility::CBody::Play++");
   494 	TInt err = iController.Prime();
   530 	TInt err = iController.Prime();
   495 	if (err == KErrNone)
   531 	if (err == KErrNone)
   496 		err = iController.Play();
   532 		err = iController.Play();
   497 	if (err != KErrNone)
   533 	if (err != KErrNone)
   498 	    {
   534 	    {
   499 	    iAsyncCallback->Signal(err,CMMFVideoPlayerCallback::EPlayCompleteEvent);
   535 	    iAsyncCallback->Signal(err,CMMFVideoPlayerCallback::EPlayCompleteEvent);
       
   536 	    DEBUG_PRINTF2("CVideoPlayerUtility::CBody::Play (exit 1)-- - Err %d", err);
   500 	    return;
   537 	    return;
   501 	    }
   538 	    }
   502 	iState = EPlaying;
   539 	iState = EPlaying;
   503 	//If Audio Resource Notification request is pending - attempt now
   540 	//If Audio Resource Notification request is pending - attempt now
   504 	if(iArnEventHolder != KNullUid)
   541 	if(iArnEventHolder != KNullUid)
   509 		if(err != KErrNone)
   546 		if(err != KErrNone)
   510 			{
   547 			{
   511 			iAsyncCallback->Signal(err, CMMFVideoPlayerCallback::EPlayCompleteEvent);
   548 			iAsyncCallback->Signal(err, CMMFVideoPlayerCallback::EPlayCompleteEvent);
   512 			}
   549 			}
   513 		}
   550 		}
       
   551     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::Play-- - Err %d", err);
   514 	}
   552 	}
   515 
   553 
   516 void CVideoPlayerUtility::CBody::Play(const TTimeIntervalMicroSeconds& aStartTime, const TTimeIntervalMicroSeconds& aEndTime)
   554 void CVideoPlayerUtility::CBody::Play(const TTimeIntervalMicroSeconds& aStartTime, const TTimeIntervalMicroSeconds& aEndTime)
   517 	{
   555 	{
       
   556     DEBUG_PRINTF("CVideoPlayerUtility::CBody::Play++");
       
   557     DEBUG_PRINTF3("CVideoPlayerUtility::CBody::Play - aStartTime %ld, aEndTime %ld", aStartTime.Int64(), aEndTime.Int64());
   518 	TInt err = iController.Prime();
   558 	TInt err = iController.Prime();
   519 	if (err == KErrNone)
   559 	if (err == KErrNone)
   520 	err = iVideoPlayControllerCustomCommands.Play(aStartTime, aEndTime);
   560 	err = iVideoPlayControllerCustomCommands.Play(aStartTime, aEndTime);
   521 	if (err != KErrNone)
   561 	if (err != KErrNone)
   522 	    {
   562 	    {
   523 	    iAsyncCallback->Signal(err, CMMFVideoPlayerCallback::EPlayCompleteEvent);
   563 	    iAsyncCallback->Signal(err, CMMFVideoPlayerCallback::EPlayCompleteEvent);
       
   564 		DEBUG_PRINTF2("CVideoPlayerUtility::CBody::Play (exit1)-- - Err %d", err);
   524 	    return;
   565 	    return;
   525 	    }
   566 	    }
   526 	iState = EPlaying;
   567 	iState = EPlaying;
   527 	//If Audio Resource Notification request is pending - attempt now
   568 	//If Audio Resource Notification request is pending - attempt now
   528 	if(iArnEventHolder != KNullUid)
   569 	if(iArnEventHolder != KNullUid)
   533 		if(err != KErrNone)
   574 		if(err != KErrNone)
   534 			{
   575 			{
   535 			iAsyncCallback->Signal(err, CMMFVideoPlayerCallback::EPlayCompleteEvent);
   576 			iAsyncCallback->Signal(err, CMMFVideoPlayerCallback::EPlayCompleteEvent);
   536 			}
   577 			}
   537 		}
   578 		}
       
   579     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::Play-- - Err %d", err);
   538 	}
   580 	}
   539 
   581 
   540 
   582 
   541 TInt CVideoPlayerUtility::CBody::Stop()
   583 TInt CVideoPlayerUtility::CBody::Stop()
   542 	{
   584 	{
       
   585     DEBUG_PRINTF("CVideoPlayerUtility::CBody::Stop++");
   543 	TInt err = iController.Stop();
   586 	TInt err = iController.Stop();
   544 	iState = EStopped;
   587 	iState = EStopped;
       
   588     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::Stop-- - Err %d", err);
   545 	return err;
   589 	return err;
   546 	}
   590 	}
   547 
   591 
   548 void CVideoPlayerUtility::CBody::PauseL()
   592 void CVideoPlayerUtility::CBody::PauseL()
   549 	{
   593 	{
       
   594     DEBUG_PRINTF("CVideoPlayerUtility::CBody::PauseL++");
   550 	User::LeaveIfError(iController.Pause());
   595 	User::LeaveIfError(iController.Pause());
   551 	iState = EPaused;
   596 	iState = EPaused;
       
   597     DEBUG_PRINTF("CVideoPlayerUtility::CBody::PauseL--");
   552 	}
   598 	}
   553 
   599 
   554 void CVideoPlayerUtility::CBody::SetVolumeL(TInt aVolume)
   600 void CVideoPlayerUtility::CBody::SetVolumeL(TInt aVolume)
   555 	{
   601 	{
   556 	User::LeaveIfError(iAudioPlayDeviceCustomCommands.SetVolume(aVolume));
   602 	User::LeaveIfError(iAudioPlayDeviceCustomCommands.SetVolume(aVolume));
   557 	}
   603 	}
   558 
   604 
   559 void CVideoPlayerUtility::CBody::PrepareDSAL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow)
   605 void CVideoPlayerUtility::CBody::PrepareDSAL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow)
   560 	{
   606 	{
       
   607     DEBUG_PRINTF("CVideoPlayerUtility::CBody::PrepareDSAL++");
   561 	CDirectScreenAccess* old = iDirectScreenAccess;
   608 	CDirectScreenAccess* old = iDirectScreenAccess;
   562 	iDirectScreenAccess = CDirectScreenAccess::NewL(aWs,aScreenDevice,aWindow,*this);
   609 	iDirectScreenAccess = CDirectScreenAccess::NewL(aWs,aScreenDevice,aWindow,*this);
   563 	delete old;
   610 	delete old;
       
   611     DEBUG_PRINTF("CVideoPlayerUtility::CBody::PrepareDSAL - Starting");
   564 	iDirectScreenAccess->StartL();
   612 	iDirectScreenAccess->StartL();
       
   613     DEBUG_PRINTF("CVideoPlayerUtility::CBody::PrepareDSAL--");
   565 	}
   614 	}
   566 
   615 
   567 void CVideoPlayerUtility::CBody::SetDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice,
   616 void CVideoPlayerUtility::CBody::SetDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice,
   568 							RWindowBase& aWindow, const TRect& aWindowRect,
   617 							RWindowBase& aWindow, const TRect& aWindowRect,
   569 							const TRect& aClipRect)
   618 							const TRect& aClipRect)
   570 	{	
   619 	{	
   571 	iWindowRect = aWindowRect;
   620     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetDisplayWindowL++");
       
   621     DEBUG_PRINTF4("CVideoPlayerUtility::CBody::SetDisplayWindowL - aScreenDevice num %d, width %d, height %d", aScreenDevice.GetScreenNumber(), aScreenDevice.SizeInPixels().iWidth, aScreenDevice.SizeInPixels().iHeight);
       
   622     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SetDisplayWindowL - aWindow WsHandle 0x%X", aWindow.WsHandle());
       
   623     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::SetDisplayWindowL - aWindow abs pos %d,%d - width %d, height %d", aWindow.AbsPosition().iX, aWindow.AbsPosition().iY, aWindow.Size().iWidth, aWindow.Size().iHeight);
       
   624     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::SetDisplayWindowL - aWindowRect %d,%d - %d,%d", aWindowRect.iTl.iX, aWindowRect.iTl.iY, aWindowRect.iBr.iX, aWindowRect.iBr.iY);
       
   625     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::SetDisplayWindowL - aClipRect %d,%d - %d,%d", aClipRect.iTl.iX, aClipRect.iTl.iY, aClipRect.iBr.iX, aClipRect.iBr.iY);
       
   626 
       
   627     iWindowRect = aWindowRect;
   572 	iClipRect = aClipRect;
   628 	iClipRect = aClipRect;
   573 	
   629 	
   574 #ifdef SYMBIAN_BUILD_GCE
   630 #ifdef SYMBIAN_BUILD_GCE
   575 	// If called from CVideoPlayerUtility2, fail with KErrNotSupport. Otherwise, if the controller supports 
   631 	// If called from CVideoPlayerUtility2, fail with KErrNotSupport. Otherwise, if the controller supports 
   576 	// the graphics surfaces, it will render to graphics surfaces. If the controller doesn't support 
   632 	// the graphics surfaces, it will render to graphics surfaces. If the controller doesn't support 
   628 			User::LeaveIfError(iVideoPlayControllerCustomCommands.DirectScreenAccessEvent(EResumeDSA));
   684 			User::LeaveIfError(iVideoPlayControllerCustomCommands.DirectScreenAccessEvent(EResumeDSA));
   629 			iDirectScreenAccessAbort = EFalse;
   685 			iDirectScreenAccessAbort = EFalse;
   630 			}
   686 			}
   631 		}
   687 		}
   632 #endif
   688 #endif
       
   689     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetDisplayWindowL--");
   633 	}
   690 	}
   634 
   691 
   635 TReal32 CVideoPlayerUtility::CBody::VideoFrameRateL() const
   692 TReal32 CVideoPlayerUtility::CBody::VideoFrameRateL() const
   636 	{
   693 	{
   637 	TReal32 framerate = 0;
   694 	TReal32 framerate = 0;
   666 	return bal;
   723 	return bal;
   667 	}
   724 	}
   668 
   725 
   669 void CVideoPlayerUtility::CBody::SetRotationL(TVideoRotation aRotation)
   726 void CVideoPlayerUtility::CBody::SetRotationL(TVideoRotation aRotation)
   670 	{
   727 	{
       
   728     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetRotationL++");
       
   729     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SetRotationL - aRotation %d", aRotation);
       
   730 
   671 #ifdef SYMBIAN_BUILD_GCE
   731 #ifdef SYMBIAN_BUILD_GCE
   672 	if (!iGraphicsSurfaceSupported)
   732 	if (!iGraphicsSurfaceSupported)
   673 		{
   733 		{
   674 		User::LeaveIfError(iVideoPlayControllerCustomCommands.SetRotation(aRotation));
   734 		User::LeaveIfError(iVideoPlayControllerCustomCommands.SetRotation(aRotation));
   675 		}
   735 		}
   706 
   766 
   707 		}
   767 		}
   708 #else 
   768 #else 
   709 	User::LeaveIfError(iVideoPlayControllerCustomCommands.SetRotation(aRotation));
   769 	User::LeaveIfError(iVideoPlayControllerCustomCommands.SetRotation(aRotation));
   710 #endif // SYMBIAN_BUILD_GCE
   770 #endif // SYMBIAN_BUILD_GCE
       
   771 
       
   772 	DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetRotationL--");
   711 	}
   773 	}
   712 
   774 
   713 TVideoRotation CVideoPlayerUtility::CBody::RotationL() const
   775 TVideoRotation CVideoPlayerUtility::CBody::RotationL() const
   714 	{
   776 	{
   715 	TVideoRotation rot = EVideoRotationNone;
   777 	TVideoRotation rot = EVideoRotationNone;
   729 	return rot;
   791 	return rot;
   730 	}
   792 	}
   731 
   793 
   732 void CVideoPlayerUtility::CBody::SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering)
   794 void CVideoPlayerUtility::CBody::SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering)
   733 	{
   795 	{
       
   796     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetScaleFactorL");
       
   797     DEBUG_PRINTF4("CVideoPlayerUtility::CBody::SetScaleFactorL - aWidthPercentage %f, aHeightPercentage %f, aAntiAliasFiltering %d", aWidthPercentage, aHeightPercentage, aAntiAliasFiltering);
       
   798 
   734 #ifdef SYMBIAN_BUILD_GCE
   799 #ifdef SYMBIAN_BUILD_GCE
   735 	if (!iGraphicsSurfaceSupported)
   800 	if (!iGraphicsSurfaceSupported)
   736 		{
   801 		{
   737 		User::LeaveIfError(iVideoPlayControllerCustomCommands.SetScaleFactor(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering));
   802 		User::LeaveIfError(iVideoPlayControllerCustomCommands.SetScaleFactor(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering));
   738 		}
   803 		}
   753 			}
   818 			}
   754 		}
   819 		}
   755 #else
   820 #else
   756 	User::LeaveIfError(iVideoPlayControllerCustomCommands.SetScaleFactor(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering));
   821 	User::LeaveIfError(iVideoPlayControllerCustomCommands.SetScaleFactor(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering));
   757 #endif	// SYMBIAN_BUILD_GCE
   822 #endif	// SYMBIAN_BUILD_GCE
       
   823 
       
   824 	DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetScaleFactorL--");
   758 	}
   825 	}
   759 
   826 
   760 void CVideoPlayerUtility::CBody::GetScaleFactorL(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const
   827 void CVideoPlayerUtility::CBody::GetScaleFactorL(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const
   761 	{
   828 	{
   762 #ifdef SYMBIAN_BUILD_GCE
   829 #ifdef SYMBIAN_BUILD_GCE
   851 	return iController.GetMetaDataEntryL(aMetaDataIndex);
   918 	return iController.GetMetaDataEntryL(aMetaDataIndex);
   852 	}
   919 	}
   853 
   920 
   854 void CVideoPlayerUtility::CBody::SetPriorityL(TInt aPriority, TInt aPref)
   921 void CVideoPlayerUtility::CBody::SetPriorityL(TInt aPriority, TInt aPref)
   855 	{
   922 	{
   856 	iPrioritySettings.iPref = aPref;
   923     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetPriorityL++");
       
   924     DEBUG_PRINTF3("CVideoPlayerUtility::CBody::SetPriorityL - aPriority %d, aPref %d", aPriority, aPref);
       
   925 
       
   926     iPrioritySettings.iPref = aPref;
   857 	iPrioritySettings.iPriority = aPriority;
   927 	iPrioritySettings.iPriority = aPriority;
   858 
   928 
   859 	TInt err = iController.SetPrioritySettings(iPrioritySettings);
   929 	TInt err = iController.SetPrioritySettings(iPrioritySettings);
   860 	if ((err == KErrNone) || (err == KErrNotReady))
   930 	if ((err == KErrNone) || (err == KErrNotReady))
   861 		{
   931 		{
   863 		}
   933 		}
   864 	else
   934 	else
   865 		{
   935 		{
   866 		User::Leave(err);
   936 		User::Leave(err);
   867 		}
   937 		}
       
   938     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetPriorityL--");
   868 	}
   939 	}
   869 
   940 
   870 void CVideoPlayerUtility::CBody::PriorityL(TInt & aPriority, TMdaPriorityPreference &aPref) const 
   941 void CVideoPlayerUtility::CBody::PriorityL(TInt & aPriority, TMdaPriorityPreference &aPref) const 
   871 	{
   942 	{
   872 	aPriority = iPrioritySettings.iPriority;
   943 	aPriority = iPrioritySettings.iPriority;
   874 	}
   945 	}
   875 
   946 
   876 
   947 
   877 void CVideoPlayerUtility::CBody::SetPositionL(const TTimeIntervalMicroSeconds& aPosition)
   948 void CVideoPlayerUtility::CBody::SetPositionL(const TTimeIntervalMicroSeconds& aPosition)
   878 	{
   949 	{
       
   950     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetPositionL++");
       
   951     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SetPositionL - aPosition %ld", aPosition.Int64());
   879 	User::LeaveIfError(iController.SetPosition(aPosition));
   952 	User::LeaveIfError(iController.SetPosition(aPosition));
       
   953     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetPositionL--");
   880 	}
   954 	}
   881 
   955 
   882 
   956 
   883 TTimeIntervalMicroSeconds CVideoPlayerUtility::CBody::DurationL() const
   957 TTimeIntervalMicroSeconds CVideoPlayerUtility::CBody::DurationL() const
   884 	{
   958 	{
   969 	}
  1043 	}
   970 
  1044 
   971 
  1045 
   972 void CVideoPlayerUtility::CBody::HandleEvent(const TMMFEvent& aEvent)
  1046 void CVideoPlayerUtility::CBody::HandleEvent(const TMMFEvent& aEvent)
   973 	{
  1047 	{
   974 	if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete)
  1048     DEBUG_PRINTF("CVideoPlayerUtility::CBody::HandleEvent++");
       
  1049     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::HandleEvent - Event type 0x%X", aEvent.iEventType);
       
  1050 
       
  1051     if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete)
   975 		{
  1052 		{
   976 		// if we haven't had a MfaocComplete() callback yet,
  1053 		// if we haven't had a MfaocComplete() callback yet,
   977 		// we need to delay the call back to the client
  1054 		// we need to delay the call back to the client
   978 		// because the source/sink will not have been opened yet.
  1055 		// because the source/sink will not have been opened yet.
   979 		iEventOpenReceived = ETrue;
  1056 		iEventOpenReceived = ETrue;
  1064 		}
  1141 		}
  1065 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1142 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1066 	else 
  1143 	else 
  1067 		// Pass on all unrecognised events to the client
  1144 		// Pass on all unrecognised events to the client
  1068 		iObserver.MvpuoEvent(aEvent);
  1145 		iObserver.MvpuoEvent(aEvent);
       
  1146 
       
  1147     DEBUG_PRINTF("CVideoPlayerUtility::CBody::HandleEvent--");
  1069 	}
  1148 	}
  1070 
  1149 
  1071 #ifdef SYMBIAN_BUILD_GCE
  1150 #ifdef SYMBIAN_BUILD_GCE
  1072 TInt CVideoPlayerUtility::CBody::SurfaceCreated()
  1151 TInt CVideoPlayerUtility::CBody::SurfaceCreated()
  1073 	{
  1152 	{
  1074 	TInt count = iActiveDisplays.Count();
  1153     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SurfaceCreated++");
       
  1154 
       
  1155     TInt count = iActiveDisplays.Count();
  1075 	TBool replaceSurface = !(iSurfaceId.IsNull());
  1156 	TBool replaceSurface = !(iSurfaceId.IsNull());
  1076 	TSurfaceId oldSurfaceId(iSurfaceId);
  1157 	TSurfaceId oldSurfaceId(iSurfaceId);
  1077 	
  1158 	
  1078 	// first remove surface if one already in use
  1159 	// first remove surface if one already in use
  1079 	if(replaceSurface)
  1160 	if(replaceSurface)
  1128         if (error2 != KErrNone)
  1209         if (error2 != KErrNone)
  1129             {
  1210             {
  1130             error = error2;
  1211             error = error2;
  1131             }
  1212             }
  1132         }
  1213         }
  1133     return error;
  1214 
       
  1215 	DEBUG_PRINTF("CVideoPlayerUtility::CBody::SurfaceCreated--");
       
  1216 	return error;
  1134 	}
  1217 	}
  1135 
  1218 
  1136 TInt CVideoPlayerUtility::CBody::SurfaceParametersChanged()
  1219 TInt CVideoPlayerUtility::CBody::SurfaceParametersChanged()
  1137 	{
  1220 	{
       
  1221     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SurfaceParametersChanged++");
  1138 	if (iSurfaceId.IsNull())
  1222 	if (iSurfaceId.IsNull())
  1139 		{
  1223 		{
  1140 		return KErrNotSupported;
  1224 		return KErrNotSupported;
  1141 		}
  1225 		}
  1142 	
  1226 	
  1169 		if ((error2 != KErrNone) && (error == KErrNone))
  1253 		if ((error2 != KErrNone) && (error == KErrNone))
  1170 			{
  1254 			{
  1171 			error = error2;
  1255 			error = error2;
  1172 			}
  1256 			}
  1173 		}
  1257 		}
  1174 	return error;
  1258     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SurfaceParametersChanged-- - Error %d", error);
       
  1259     return error;
  1175 	}
  1260 	}
  1176 		
  1261 		
  1177 TInt CVideoPlayerUtility::CBody::SetAllBackgroundSurfaces()
  1262 TInt CVideoPlayerUtility::CBody::SetAllBackgroundSurfaces()
  1178 	{
  1263 	{
  1179 	TInt count = iActiveDisplays.Count();
  1264 	TInt count = iActiveDisplays.Count();
  1192 	return err;
  1277 	return err;
  1193 	}
  1278 	}
  1194 
  1279 
  1195 TInt CVideoPlayerUtility::CBody::RemoveSurface(TBool aControllerEvent)
  1280 TInt CVideoPlayerUtility::CBody::RemoveSurface(TBool aControllerEvent)
  1196 	{
  1281 	{
       
  1282     DEBUG_PRINTF("CVideoPlayerUtility::CBody::RemoveSurface++");
  1197 	if (iSurfaceId.IsNull())
  1283 	if (iSurfaceId.IsNull())
  1198 		{
  1284 		{
  1199 		return KErrNotFound;
  1285 		return KErrNotFound;
  1200 		}
  1286 		}
  1201 	
  1287 	
  1207 	
  1293 	
  1208 	TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iSurfaceId);
  1294 	TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iSurfaceId);
  1209 
  1295 
  1210 	iSurfaceId = TSurfaceId::CreateNullId();
  1296 	iSurfaceId = TSurfaceId::CreateNullId();
  1211 	
  1297 	
       
  1298     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::RemoveSurface-- - Error %d", error);
  1212 	return error;
  1299 	return error;
  1213 	}
  1300 	}
  1214 	
  1301 	
  1215 #endif // SYMBIAN_BUILD_GCE
  1302 #endif // SYMBIAN_BUILD_GCE
  1216 
  1303 
  1400 
  1487 
  1401 void CVideoPlayerUtility::CBody::AddDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, 
  1488 void CVideoPlayerUtility::CBody::AddDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, 
  1402 							RWindow& aWindow, const TRect& aVideoExtent, 
  1489 							RWindow& aWindow, const TRect& aVideoExtent, 
  1403 							const TRect& aWindowClipRect)
  1490 							const TRect& aWindowClipRect)
  1404 	{
  1491 	{
  1405 	// set window and get display ID for the window
  1492     DEBUG_PRINTF("CVideoPlayerUtility::CBody::AddDisplayWindowL++");
       
  1493     DEBUG_PRINTF4("CVideoPlayerUtility::CBody::AddDisplayWindowL - aScreenDevice num %d, width %d, height %d", aScreenDevice.GetScreenNumber(), aScreenDevice.SizeInPixels().iWidth, aScreenDevice.SizeInPixels().iHeight);
       
  1494     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::AddDisplayWindowL - aWindow WsHandle 0x%X", aWindow.WsHandle());
       
  1495     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::AddDisplayWindowL - aWindow abs pos %d,%d - width %d, height %d", aWindow.AbsPosition().iX, aWindow.AbsPosition().iY, aWindow.Size().iWidth, aWindow.Size().iHeight);
       
  1496     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::AddDisplayWindowL - aVideoExtent %d,%d - %d,%d", aVideoExtent.iTl.iX, aVideoExtent.iTl.iY, aVideoExtent.iBr.iX, aVideoExtent.iBr.iY);
       
  1497     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::AddDisplayWindowL - aWindowClipRect %d,%d - %d,%d", aWindowClipRect.iTl.iX, aWindowClipRect.iTl.iY, aWindowClipRect.iBr.iX, aWindowClipRect.iBr.iY);
       
  1498 
       
  1499     // set window and get display ID for the window
  1406 	TRect windowRect = TRect(aWindow.Size()); 
  1500 	TRect windowRect = TRect(aWindow.Size()); 
  1407 	
  1501 	
  1408 	// Check the rectangle is contained completely within the window
  1502 	// Check the rectangle is contained completely within the window
  1409 	if (!RectContains(windowRect, aWindowClipRect))
  1503 	if (!RectContains(windowRect, aWindowClipRect))
  1410 		{
  1504 		{
  1413 		//       behaviour in this case
  1507 		//       behaviour in this case
  1414 		User::Leave(KErrArgument);
  1508 		User::Leave(KErrArgument);
  1415 		}
  1509 		}
  1416 		
  1510 		
  1417 	DoAddDisplayWindowL(aWs, aScreenDevice.GetScreenNumber(), aWindow, aWindowClipRect, aVideoExtent, &aWindow);
  1511 	DoAddDisplayWindowL(aWs, aScreenDevice.GetScreenNumber(), aWindow, aWindowClipRect, aVideoExtent, &aWindow);
       
  1512     DEBUG_PRINTF("CVideoPlayerUtility::CBody::AddDisplayWindowL--");
  1418 	}
  1513 	}
  1419 	
  1514 	
  1420 void CVideoPlayerUtility::CBody::AddDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindow& aWindow)
  1515 void CVideoPlayerUtility::CBody::AddDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindow& aWindow)
  1421 	{
  1516 	{
  1422 	DoAddDisplayWindowL(aWs, aScreenDevice.GetScreenNumber(), aWindow, TRect(aWindow.Size()), TRect(aWindow.Size()), &aWindow);
  1517     DEBUG_PRINTF("CVideoPlayerUtility::CBody::AddDisplayWindowL++");
       
  1518     DEBUG_PRINTF4("CVideoPlayerUtility::CBody::AddDisplayWindowL - aScreenDevice num %d, width %d, height %d", aScreenDevice.GetScreenNumber(), aScreenDevice.SizeInPixels().iWidth, aScreenDevice.SizeInPixels().iHeight);
       
  1519     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::AddDisplayWindowL - aWindow WsHandle 0x%X", aWindow.WsHandle());
       
  1520     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::AddDisplayWindowL - aWindow abs pos %d,%d - width %d, height %d", aWindow.AbsPosition().iX, aWindow.AbsPosition().iY, aWindow.Size().iWidth, aWindow.Size().iHeight);
       
  1521 
       
  1522     DoAddDisplayWindowL(aWs, aScreenDevice.GetScreenNumber(), aWindow, TRect(aWindow.Size()), TRect(aWindow.Size()), &aWindow);
       
  1523 
       
  1524 	DEBUG_PRINTF("CVideoPlayerUtility::CBody::AddDisplayWindowL--");
  1423 	}
  1525 	}
  1424 
  1526 
  1425 void CVideoPlayerUtility::CBody::DoAddDisplayWindowL(RWsSession& aWs, TInt aDisplayId, RWindowBase& aWindow,
  1527 void CVideoPlayerUtility::CBody::DoAddDisplayWindowL(RWsSession& aWs, TInt aDisplayId, RWindowBase& aWindow,
  1426 								const TRect& aClipRect, const TRect& aVideoExtent, RWindow* aWindow2)
  1528 								const TRect& aClipRect, const TRect& aVideoExtent, RWindow* aWindow2)
  1427 	{
  1529 	{
  1448 
  1550 
  1449 	if (pos == KErrNotFound)
  1551 	if (pos == KErrNotFound)
  1450 		{
  1552 		{
  1451 		if(iSurfaceId.IsNull())
  1553 		if(iSurfaceId.IsNull())
  1452 			{
  1554 			{
  1453 			display = CMediaClientVideoDisplayBody::NewL(aDisplayId);
  1555 			display = CMediaClientVideoDisplayBody::NewL(aDisplayId, ETrue);
  1454 			}
  1556 			}
  1455 		else
  1557 		else
  1456 			{
  1558 			{
  1457 			display = CMediaClientVideoDisplayBody::NewL(aDisplayId, iSurfaceId, iSurfaceCropRect, iAspectRatio);
  1559 			display = CMediaClientVideoDisplayBody::NewL(aDisplayId, iSurfaceId, iSurfaceCropRect, iAspectRatio, ETrue);
  1458 			}
  1560 			}
  1459 		CleanupStack::PushL(display);
  1561 		CleanupStack::PushL(display);
  1460 		iActiveDisplays.InsertInOrderL(display, CMediaClientVideoDisplayBody::Compare);
  1562 		iActiveDisplays.InsertInOrderL(display, CMediaClientVideoDisplayBody::Compare);
  1461 		CleanupStack::Pop(display);
  1563 		CleanupStack::Pop(display);
  1462 		}
  1564 		}
  1483 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1585 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1484 	}
  1586 	}
  1485 
  1587 
  1486 void CVideoPlayerUtility::CBody::RemoveDisplayWindow(RWindowBase& aWindow)
  1588 void CVideoPlayerUtility::CBody::RemoveDisplayWindow(RWindowBase& aWindow)
  1487 	{
  1589 	{
  1488 	CMediaClientVideoDisplayBody* display = NULL;
  1590     DEBUG_PRINTF("CVideoPlayerUtility::CBody::RemoveDisplayWindow++");
       
  1591     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::RemoveDisplayWindow - aWindow WsHandle 0x%X", aWindow.WsHandle());
       
  1592 
       
  1593     CMediaClientVideoDisplayBody* display = NULL;
  1489 	TRAPD(err, display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow));
  1594 	TRAPD(err, display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow));
  1490 	
  1595 	
  1491 	if (err == KErrNone)
  1596 	if (err == KErrNone)
  1492 		{		
  1597 		{		
  1493 		display->RemoveDisplayWindow(aWindow);
  1598 		display->RemoveDisplayWindow(aWindow);
  1506 			// subtitles are enabled, so remove window config, ignore error
  1611 			// subtitles are enabled, so remove window config, ignore error
  1507 			iSubtitleUtility->RemoveSubtitleConfig(aWindow.WsHandle());
  1612 			iSubtitleUtility->RemoveSubtitleConfig(aWindow.WsHandle());
  1508 			}
  1613 			}
  1509 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1614 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1510 		}	
  1615 		}	
       
  1616     DEBUG_PRINTF("CVideoPlayerUtility::CBody::RemoveDisplayWindow--");
  1511 	}
  1617 	}
  1512 
  1618 
  1513 void CVideoPlayerUtility::CBody::AddDisplayL(TInt aDisplay, MMMFSurfaceEventHandler& aEventHandler)
  1619 void CVideoPlayerUtility::CBody::AddDisplayL(TInt aDisplay, MMMFSurfaceEventHandler& aEventHandler)
  1514 	{
  1620 	{
       
  1621     DEBUG_PRINTF("CVideoPlayerUtility::CBody::AddDisplayL");
       
  1622     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::AddDisplayL - aDisplay %d", aDisplay);
  1515 	if (!iControllerOpen)
  1623 	if (!iControllerOpen)
  1516 		{
  1624 		{
  1517 		User::Leave(KErrNotReady);
  1625 		User::Leave(KErrNotReady);
  1518 		}
  1626 		}
  1519 	
  1627 	
  1522 	if (err == KErrNotFound)
  1630 	if (err == KErrNotFound)
  1523 		{
  1631 		{
  1524 		CMediaClientVideoDisplayBody* display;
  1632 		CMediaClientVideoDisplayBody* display;
  1525 		if(iSurfaceId.IsNull())
  1633 		if(iSurfaceId.IsNull())
  1526 			{
  1634 			{
  1527 			display = CMediaClientVideoDisplayBody::NewL(aDisplay);
  1635 			display = CMediaClientVideoDisplayBody::NewL(aDisplay, ETrue);
  1528 			}
  1636 			}
  1529 		else
  1637 		else
  1530 			{
  1638 			{
  1531 			display = CMediaClientVideoDisplayBody::NewL(aDisplay, iSurfaceId, iSurfaceCropRect, iAspectRatio);
  1639 			display = CMediaClientVideoDisplayBody::NewL(aDisplay, iSurfaceId, iSurfaceCropRect, iAspectRatio, ETrue);
  1532 			}
  1640 			}
  1533 		CleanupStack::PushL(display);
  1641 		CleanupStack::PushL(display);
  1534 		iActiveDisplays.InsertInOrderL(display, CMediaClientVideoDisplayBody::Compare);
  1642 		iActiveDisplays.InsertInOrderL(display, CMediaClientVideoDisplayBody::Compare);
  1535 		CleanupStack::Pop(display);
  1643 		CleanupStack::Pop(display);
  1536 		display->AddDisplayL(aEventHandler);
  1644 		display->AddDisplayL(aEventHandler);
  1538 	else
  1646 	else
  1539 		{
  1647 		{
  1540 		User::LeaveIfError(err);
  1648 		User::LeaveIfError(err);
  1541 		iActiveDisplays[err]->AddDisplayL(aEventHandler);
  1649 		iActiveDisplays[err]->AddDisplayL(aEventHandler);
  1542 		}
  1650 		}
       
  1651     DEBUG_PRINTF("CVideoPlayerUtility::CBody::AddDisplayL--");
  1543 	}
  1652 	}
  1544 
  1653 
  1545 void CVideoPlayerUtility::CBody::RemoveDisplay(TInt aDisplay)
  1654 void CVideoPlayerUtility::CBody::RemoveDisplay(TInt aDisplay)
  1546 	{
  1655 	{
       
  1656     DEBUG_PRINTF("CVideoPlayerUtility::CBody::RemoveDisplay++");
       
  1657     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::RemoveDisplay - aDisplay %d", aDisplay);
  1547 	TInt pos = iActiveDisplays.FindInOrder(aDisplay, CMediaClientVideoDisplayBody::CompareByDisplay);
  1658 	TInt pos = iActiveDisplays.FindInOrder(aDisplay, CMediaClientVideoDisplayBody::CompareByDisplay);
  1548 	
  1659 	
  1549 	if (pos >= KErrNone)
  1660 	if (pos >= KErrNone)
  1550 		{
  1661 		{
  1551 		CMediaClientVideoDisplayBody* disp = iActiveDisplays[pos];
  1662 		CMediaClientVideoDisplayBody* disp = iActiveDisplays[pos];
  1555 			{
  1666 			{
  1556 			iActiveDisplays.Remove(pos);
  1667 			iActiveDisplays.Remove(pos);
  1557 			delete disp;
  1668 			delete disp;
  1558 			}
  1669 			}
  1559 		}
  1670 		}
       
  1671     DEBUG_PRINTF("CVideoPlayerUtility::CBody::RemoveDisplay--");
  1560 	}
  1672 	}
  1561 
  1673 
  1562 void CVideoPlayerUtility::CBody::ConvertFromRelativeToDisplayToRelativeToWindow(
  1674 void CVideoPlayerUtility::CBody::ConvertFromRelativeToDisplayToRelativeToWindow(
  1563             const RWindowBase& aWindow,
  1675             const RWindowBase& aWindow,
  1564             const TRect& aFromWindowRect,
  1676             const TRect& aFromWindowRect,
  1565             const TRect& aFromClipRect,
  1677             const TRect& aFromClipRect,
  1566             TRect& aToWindowRect,
  1678             TRect& aToWindowRect,
  1567             TRect& aToClipRect)
  1679             TRect& aToClipRect)
  1568     {
  1680     {
       
  1681     DEBUG_PRINTF("CVideoPlayerUtility::CBody::ConvertFromRelativeToDisplayToRelativeToWindow++");
  1569     TPoint windowOrigin = aWindow.AbsPosition();
  1682     TPoint windowOrigin = aWindow.AbsPosition();
  1570     
  1683     
  1571     // window rect
  1684     // window rect
  1572     aToWindowRect.iTl.iX = aFromWindowRect.iTl.iX - windowOrigin.iX;
  1685     aToWindowRect.iTl.iX = aFromWindowRect.iTl.iX - windowOrigin.iX;
  1573     aToWindowRect.iTl.iY = aFromWindowRect.iTl.iY - windowOrigin.iY;
  1686     aToWindowRect.iTl.iY = aFromWindowRect.iTl.iY - windowOrigin.iY;
  1577     // clip rect
  1690     // clip rect
  1578     aToClipRect.iTl.iX = aFromClipRect.iTl.iX - windowOrigin.iX;
  1691     aToClipRect.iTl.iX = aFromClipRect.iTl.iX - windowOrigin.iX;
  1579     aToClipRect.iTl.iY = aFromClipRect.iTl.iY - windowOrigin.iY;
  1692     aToClipRect.iTl.iY = aFromClipRect.iTl.iY - windowOrigin.iY;
  1580     aToClipRect.iBr.iX = aFromClipRect.iBr.iX - windowOrigin.iX;
  1693     aToClipRect.iBr.iX = aFromClipRect.iBr.iX - windowOrigin.iX;
  1581     aToClipRect.iBr.iY = aFromClipRect.iBr.iY - windowOrigin.iY;
  1694     aToClipRect.iBr.iY = aFromClipRect.iBr.iY - windowOrigin.iY;
       
  1695 
       
  1696     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::ConvertFromRelativeToDisplayToRelativeToWindow - New Window rect %d,%d - %d,%d", aToWindowRect.iTl.iX, aToWindowRect.iTl.iY, aToWindowRect.iBr.iX, aToWindowRect.iBr.iY);
       
  1697     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::ConvertFromRelativeToDisplayToRelativeToWindow - New Clip rect %d,%d - %d,%d", aToClipRect.iTl.iX, aToClipRect.iTl.iY, aToClipRect.iBr.iX, aToClipRect.iBr.iY);
       
  1698     DEBUG_PRINTF("CVideoPlayerUtility::CBody::ConvertFromRelativeToDisplayToRelativeToWindow--");
  1582     }
  1699     }
  1583 
  1700 
  1584 void CVideoPlayerUtility::CBody::SetVideoExtentL(const RWindowBase& aWindow, const TRect& aVideoExtent)
  1701 void CVideoPlayerUtility::CBody::SetVideoExtentL(const RWindowBase& aWindow, const TRect& aVideoExtent)
  1585 	{
  1702 	{
  1586 	// check opening the source is complete and the client has been recieved an MvpuoOpenComplete() callback
  1703     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetVideoExtentL++");
       
  1704     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SetVideoExtentL - aWindow WsHandle 0x%X", aWindow.WsHandle());
       
  1705     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::SetVideoExtentL - aVideoExtent %d,%d - %d,%d", aVideoExtent.iTl.iX, aVideoExtent.iTl.iY, aVideoExtent.iBr.iX, aVideoExtent.iBr.iY);
       
  1706 
       
  1707     // check opening the source is complete and the client has been recieved an MvpuoOpenComplete() callback
  1587 	if (!iControllerOpen)
  1708 	if (!iControllerOpen)
  1588 		{
  1709 		{
  1589 		User::Leave(KErrNotReady);
  1710 		User::Leave(KErrNotReady);
  1590 		}
  1711 		}
  1591 		
  1712 		
  1592 	CMediaClientVideoDisplayBody* display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow);
  1713 	CMediaClientVideoDisplayBody* display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow);
  1593 	display->SetVideoExtentL(aWindow, aVideoExtent, iCropRegion);
  1714 	display->SetVideoExtentL(aWindow, aVideoExtent, iCropRegion);
       
  1715 
       
  1716 	DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetVideoExtentL--");
  1594 	}
  1717 	}
  1595 
  1718 
  1596 void CVideoPlayerUtility::CBody::SetWindowClipRectL(const RWindowBase& aWindow, const TRect& aWindowClipRect)
  1719 void CVideoPlayerUtility::CBody::SetWindowClipRectL(const RWindowBase& aWindow, const TRect& aWindowClipRect)
  1597 	{
  1720 	{
       
  1721     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetWindowClipRectL++");
       
  1722     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SetWindowClipRectL - aWindow WsHandle 0x%X", aWindow.WsHandle());
       
  1723     DEBUG_PRINTF5("CVideoPlayerUtility::CBody::SetWindowClipRectL - aWindowClipRect %d,%d - %d,%d", aWindowClipRect.iTl.iX, aWindowClipRect.iTl.iY, aWindowClipRect.iBr.iX, aWindowClipRect.iBr.iY);
       
  1724 
  1598     // check opening the source is complete and the client has been recieved an MvpuoOpenComplete() callback
  1725     // check opening the source is complete and the client has been recieved an MvpuoOpenComplete() callback
  1599 	if (!iControllerOpen)
  1726 	if (!iControllerOpen)
  1600 		{
  1727 		{
  1601 		User::Leave(KErrNotReady);
  1728 		User::Leave(KErrNotReady);
  1602 		}
  1729 		}
  1621 		UpdateSurfaceAndSubtitleConfigL(*display, currentWin, aWindowClipRect, currentWin.iRotation, iCropRegion);
  1748 		UpdateSurfaceAndSubtitleConfigL(*display, currentWin, aWindowClipRect, currentWin.iRotation, iCropRegion);
  1622 		}
  1749 		}
  1623 #else
  1750 #else
  1624 	display->SetWindowClipRectL(aWindow, aWindowClipRect, iCropRegion);
  1751 	display->SetWindowClipRectL(aWindow, aWindowClipRect, iCropRegion);
  1625 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1752 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
       
  1753 
       
  1754 	DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetWindowClipRectL--");
  1626 	}
  1755 	}
  1627 
  1756 
  1628 // Check if the controller supports the graphics surface. Has to be called after resource opened.
  1757 // Check if the controller supports the graphics surface. Has to be called after resource opened.
  1629 TInt CVideoPlayerUtility::CBody::CheckSurfaceSupported()
  1758 TInt CVideoPlayerUtility::CBody::CheckSurfaceSupported()
  1630 	{
  1759 	{
  1656 	SetAutoScaleL(aWindow, aScaleType, EHorizontalAlignCenter, EVerticalAlignCenter);
  1785 	SetAutoScaleL(aWindow, aScaleType, EHorizontalAlignCenter, EVerticalAlignCenter);
  1657 	}
  1786 	}
  1658 	
  1787 	
  1659 void CVideoPlayerUtility::CBody::SetAutoScaleL(const RWindowBase& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
  1788 void CVideoPlayerUtility::CBody::SetAutoScaleL(const RWindowBase& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
  1660 	{
  1789 	{
  1661 	if (!iControllerOpen)
  1790     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetAutoScaleL++");
       
  1791     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SetAutoScaleL - aWindow WsHandle 0x%X", aWindow.WsHandle());
       
  1792     DEBUG_PRINTF4("CVideoPlayerUtility::CBody::SetAutoScaleL - aScaleType %d, aHorizPos %d, aVertPos %d", aScaleType, aHorizPos, aVertPos);
       
  1793 
       
  1794     if (!iControllerOpen)
  1662 		{
  1795 		{
  1663 		User::Leave(KErrNotReady);
  1796 		User::Leave(KErrNotReady);
  1664 		}
  1797 		}
  1665 		
  1798 		
  1666 	CMediaClientVideoDisplayBody* display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow);
  1799 	CMediaClientVideoDisplayBody* display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow);
  1667 	display->SetAutoScaleL(aWindow, aScaleType, aHorizPos, aVertPos, iCropRegion);
  1800 	display->SetAutoScaleL(aWindow, aScaleType, aHorizPos, aVertPos, iCropRegion);
       
  1801 
       
  1802 	DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetAutoScaleL--");
  1668 	}
  1803 	}
  1669 
  1804 
  1670 void CVideoPlayerUtility::CBody::SetRotationL(const RWindowBase& aWindow, TVideoRotation aRotation)
  1805 void CVideoPlayerUtility::CBody::SetRotationL(const RWindowBase& aWindow, TVideoRotation aRotation)
  1671 	{
  1806 	{
  1672 	if (!iControllerOpen)
  1807     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetRotationL++");
       
  1808     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SetRotationL - aWindow WsHandle 0x%X", aWindow.WsHandle());
       
  1809     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SetRotationL - aRotation %d", aRotation);
       
  1810 
       
  1811     if (!iControllerOpen)
  1673 		{
  1812 		{
  1674 		User::Leave(KErrNotReady);
  1813 		User::Leave(KErrNotReady);
  1675 		}
  1814 		}
  1676 
  1815 
  1677 	CMediaClientVideoDisplayBody* display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow);
  1816 	CMediaClientVideoDisplayBody* display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow);
  1686 		UpdateSurfaceAndSubtitleConfigL(*display, currentWin, currentWin.iClipRect, aRotation, iCropRegion);
  1825 		UpdateSurfaceAndSubtitleConfigL(*display, currentWin, currentWin.iClipRect, aRotation, iCropRegion);
  1687 		}
  1826 		}
  1688 #else
  1827 #else
  1689 	display->SetRotationL(aWindow, aRotation, iCropRegion);
  1828 	display->SetRotationL(aWindow, aRotation, iCropRegion);
  1690 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1829 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
       
  1830     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetRotationL--");
  1691 	}
  1831 	}
  1692 	
  1832 	
  1693 TVideoRotation CVideoPlayerUtility::CBody::RotationL(const RWindowBase& aWindow) const
  1833 TVideoRotation CVideoPlayerUtility::CBody::RotationL(const RWindowBase& aWindow) const
  1694 	{
  1834 	{
  1695 	if (!iControllerOpen)
  1835 	if (!iControllerOpen)
  1700 	return display->RotationL(aWindow);
  1840 	return display->RotationL(aWindow);
  1701 	}
  1841 	}
  1702 	
  1842 	
  1703 void CVideoPlayerUtility::CBody::SetScaleFactorL(const RWindowBase& aWindow, TReal32 aWidthPercentage, TReal32 aHeightPercentage)
  1843 void CVideoPlayerUtility::CBody::SetScaleFactorL(const RWindowBase& aWindow, TReal32 aWidthPercentage, TReal32 aHeightPercentage)
  1704 	{
  1844 	{
       
  1845     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetScaleFactorL++");
       
  1846     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::SetScaleFactorL - aWindow WsHandle 0x%X", aWindow.WsHandle());
       
  1847     DEBUG_PRINTF3("CVideoPlayerUtility::CBody::SetScaleFactorL - aWidthPercentage %f, aHeightPercentage %f", aWidthPercentage, aHeightPercentage);
  1705 	if (!iControllerOpen)
  1848 	if (!iControllerOpen)
  1706 		{
  1849 		{
  1707 		User::Leave(KErrNotReady);
  1850 		User::Leave(KErrNotReady);
  1708 		
  1851 		
  1709 		}
  1852 		}
  1710 	CMediaClientVideoDisplayBody* display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow);
  1853 	CMediaClientVideoDisplayBody* display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow);
  1711 	display->SetScaleFactorL(aWindow, aWidthPercentage, aHeightPercentage, iCropRegion);
  1854 	display->SetScaleFactorL(aWindow, aWidthPercentage, aHeightPercentage, iCropRegion);
       
  1855     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetScaleFactorL--");
  1712 	}
  1856 	}
  1713 	
  1857 	
  1714 void CVideoPlayerUtility::CBody::GetScaleFactorL(const RWindowBase& aWindow, TReal32& aWidthPercentage, TReal32& aHeightPercentage) const
  1858 void CVideoPlayerUtility::CBody::GetScaleFactorL(const RWindowBase& aWindow, TReal32& aWidthPercentage, TReal32& aHeightPercentage) const
  1715 	{
  1859 	{
  1716 	if (!iControllerOpen)
  1860 	if (!iControllerOpen)
  1850 	{
  1994 	{
  1851 	SetAutoScaleL(aScaleType, EHorizontalAlignCenter, EVerticalAlignCenter);
  1995 	SetAutoScaleL(aScaleType, EHorizontalAlignCenter, EVerticalAlignCenter);
  1852 	}
  1996 	}
  1853 void CVideoPlayerUtility::CBody::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
  1997 void CVideoPlayerUtility::CBody::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
  1854 	{
  1998 	{
  1855 	// Leave if Open is not yet called.
  1999     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetAutoScaleL++");
       
  2000     DEBUG_PRINTF4("CVideoPlayerUtility::CBody::SetAutoScaleL - aScaleType %d, aHorizPos %d, aVertPos %d", aScaleType, aHorizPos, aVertPos);
       
  2001 
       
  2002     // Leave if Open is not yet called.
  1856 	if(!iEventOpenReceived )
  2003 	if(!iEventOpenReceived )
  1857 		{
  2004 		{
  1858 		User::Leave(KErrNotReady);
  2005 		User::Leave(KErrNotReady);
  1859 		}	
  2006 		}	
  1860 
  2007 
  1880 			}
  2027 			}
  1881 		}
  2028 		}
  1882 #else
  2029 #else
  1883 	User::LeaveIfError(iVideoPlayControllerExtCustomCommands.SetAutoScale(aScaleType, aHorizPos, aVertPos));
  2030 	User::LeaveIfError(iVideoPlayControllerExtCustomCommands.SetAutoScale(aScaleType, aHorizPos, aVertPos));
  1884 #endif // SYMBIAN_BUILD_GCE
  2031 #endif // SYMBIAN_BUILD_GCE
       
  2032     DEBUG_PRINTF("CVideoPlayerUtility::CBody::SetAutoScaleL--");
  1885 	}
  2033 	}
  1886 
  2034 
  1887 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  2035 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1888 TBool CVideoPlayerUtility::CBody::SubtitlesAvailable()
  2036 TBool CVideoPlayerUtility::CBody::SubtitlesAvailable()
  1889 	{
  2037 	{