os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteagents/src/videoplayagent.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteagents/src/videoplayagent.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1303 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Part of the MVS Agents for TechView
1.18 +//
1.19 +
1.20 +#ifdef SYMBIAN_BUILD_GCE
1.21 +#include <videoplayer2.h>
1.22 +#include <surfaceeventhandler.h>
1.23 +#endif
1.24 +
1.25 +#include "videoplayagent.h"
1.26 +
1.27 +/**
1.28 +Constructs and initialises a new instance of the MVS video play agent
1.29 +
1.30 +This function leaves if the video play agent object cannot be created.
1.31 +
1.32 +@param aObserver
1.33 + A client class to receive notifications from the video player.
1.34 +
1.35 +@return A pointer to the new video play agent object.
1.36 +*/
1.37 +EXPORT_C CMVSVideoPlayAgent* CMVSVideoPlayAgent::NewL(MMVSClientObserver& aObserver)
1.38 + {
1.39 + CMVSVideoPlayAgent* self = new(ELeave) CMVSVideoPlayAgent(aObserver);
1.40 + CleanupStack::PushL(self);
1.41 + self->ConstructL();
1.42 + CleanupStack::Pop(self);
1.43 + return self;
1.44 + }
1.45 +
1.46 +void CMVSVideoPlayAgent::ConstructL()
1.47 + {
1.48 + User::LeaveIfError(iFileLogger.Connect());
1.49 + iFileLogger.CreateLog(_L("LogMVSappUi"),_L("LogFile.txt"),EFileLoggingModeAppend);
1.50 + }
1.51 +
1.52 +
1.53 +/**
1.54 +Destructor. Closes any open video clips and frees any resources held by the Video Player.
1.55 +*/
1.56 +EXPORT_C CMVSVideoPlayAgent::~CMVSVideoPlayAgent()
1.57 + {
1.58 +#ifdef SYMBIAN_BUILD_GCE
1.59 + delete iVideoPlayer2;
1.60 + iVideoPlayer2 = NULL;
1.61 +#endif // SYMBIAN_BUILD_GCE
1.62 +
1.63 + delete iVideoPlayer;
1.64 + iVideoPlayer = NULL;
1.65 +
1.66 + if(iFileLogger.Handle())
1.67 + {
1.68 + iFileLogger.CloseLog();
1.69 + iFileLogger.Close();
1.70 + }
1.71 +
1.72 + iFileName.Close();
1.73 + }
1.74 +
1.75 +
1.76 +CMVSVideoPlayAgent::CMVSVideoPlayAgent(MMVSClientObserver& aObserver)
1.77 + : iObserver(aObserver),
1.78 + iControllerUid(KNullUid)
1.79 + {
1.80 + }
1.81 +
1.82 +/**
1.83 +Check if CVideoPlayerUtility2 is used for current video playback.
1.84 +
1.85 +@return ETrue if CVideoPlayerUtility2 is used for video playback. EFalse if
1.86 + CVideoPlayerUtility is used.
1.87 +*/
1.88 +EXPORT_C TBool CMVSVideoPlayAgent::SupportVideoPlayerUtility2() const
1.89 + {
1.90 + if (iCurrentVideoPlayer == NULL)
1.91 + {
1.92 + return EFalse;
1.93 + }
1.94 +
1.95 + if (iCurrentVideoPlayer == iVideoPlayer)
1.96 + {
1.97 + return EFalse;
1.98 + }
1.99 +
1.100 + return ETrue;
1.101 + }
1.102 +
1.103 +/**
1.104 +Set the auto scale on the current video player for the specified window.
1.105 +
1.106 +@see CVideoPlayerUtility
1.107 +*/
1.108 +#ifdef SYMBIAN_BUILD_GCE
1.109 +EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(RWindow& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
1.110 + {
1.111 + iVideoPlayer2->SetAutoScaleL(aWindow, aScaleType, aHorizPos, aVertPos);
1.112 +#else
1.113 +EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(RWindow& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
1.114 + {
1.115 + User::Leave(KErrNotSupported);
1.116 +#endif
1.117 + }
1.118 +
1.119 +/**
1.120 +Set the auto scale on the current video player.
1.121 +
1.122 +@see CVideoPlayerUtility
1.123 +*/
1.124 +EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
1.125 + {
1.126 +#ifdef SYMBIAN_BUILD_GCE
1.127 + iCurrentVideoPlayer->SetAutoScaleL(aScaleType, aHorizPos, aVertPos);
1.128 +#else
1.129 + // Remove warnings
1.130 + aScaleType = aScaleType;
1.131 + aHorizPos = aHorizPos;
1.132 + aVertPos = aVertPos;
1.133 + User::Leave(KErrNotSupported);
1.134 +#endif
1.135 + }
1.136 +
1.137 +/**
1.138 +Video output settings, pre initialisation of all the required settings to play a
1.139 +video clip
1.140 +
1.141 +This function leaves if the video player utility object cannot be created.
1.142 +
1.143 +@param aObserver
1.144 + A client class to receive notifications from the video player.
1.145 +@param aPriority
1.146 + This client's relative priority. This is a value between EMdaPriorityMin and
1.147 + EMdaPriorityMax and represents a relative priority. A higher value indicates
1.148 + a more important request.
1.149 +@param aPref
1.150 + The required behaviour if a higher priority client takes over the sound output device.
1.151 + One of the values defined by TMdaPriorityPreference.
1.152 +@param aWs
1.153 + The window server session id.
1.154 +@param aScreenDevice
1.155 + The software device screen.
1.156 +@param aWindow
1.157 + The display window.
1.158 +@param aScreenRect
1.159 + The dimensions of the display window.
1.160 +@param aClipRect
1.161 + The area of the video clip to display in the window.
1.162 +*/
1.163 +EXPORT_C void CMVSVideoPlayAgent::SetVideoOutputL(RWsSession& aWs,
1.164 + CWsScreenDevice& aScreenDevice,
1.165 + RWindow& aWindow,
1.166 + TRect& aScreenRect,
1.167 + TRect& aClipRect)
1.168 + {
1.169 + iFileLogger.Write(_L("SettingVideoOutput"));
1.170 +
1.171 +#ifdef SYMBIAN_BUILD_GCE
1.172 + // if CVideoPlayerUtility2 is available, instantiate both CVideoPlayerUtility2 &
1.173 + // CVideoPlayerUtility, as it is not clear whether the controller used for a
1.174 + // particular media file also supports the CVideoPlayerUtility2 API until OpenFileL
1.175 + // is called.
1.176 + if (iVideoPlayer2)
1.177 + {
1.178 + delete iVideoPlayer2;
1.179 + iVideoPlayer2 = NULL;
1.180 + }
1.181 +
1.182 + iVideoPlayer2 = CVideoPlayerUtility2::NewL(*this,
1.183 + EMdaPriorityNormal,
1.184 + EMdaPriorityPreferenceNone);
1.185 +#endif // SYMBIAN_BUILD_GCE
1.186 +
1.187 + if (iVideoPlayer)
1.188 + {
1.189 + delete iVideoPlayer;
1.190 + iVideoPlayer = NULL;
1.191 + }
1.192 + iVideoPlayer = CVideoPlayerUtility::NewL(*this,
1.193 + EMdaPriorityNormal,
1.194 + EMdaPriorityPreferenceNone,
1.195 + aWs,
1.196 + aScreenDevice,
1.197 + aWindow,
1.198 + aScreenRect,
1.199 + aClipRect);
1.200 + }
1.201 +
1.202 +/**
1.203 +Adds a new window for displaying the video picture. This is only applicable if
1.204 +CVideoPlayerUtility2 is used.
1.205 +
1.206 +This function leaves if the video player utility object failed to add display window or
1.207 +if this function is called when CVideoPlayerUtility2 is not being used.
1.208 +
1.209 +@param aObserver
1.210 + A client class to receive notifications from the video player.
1.211 +@param aPriority
1.212 + This client's relative priority. This is a value between EMdaPriorityMin and
1.213 + EMdaPriorityMax and represents a relative priority. A higher value indicates
1.214 + a more important request.
1.215 +@param aPref
1.216 + The required behaviour if a higher priority client takes over the sound output device.
1.217 + One of the values defined by TMdaPriorityPreference.
1.218 +@param aWs
1.219 + The window server session id.
1.220 +@param aScreenDevice
1.221 + The software device screen.
1.222 +@param aWindow
1.223 + The display window.
1.224 +@param aScreenRect
1.225 + The dimensions of the display window.
1.226 +@param aClipRect
1.227 + The area of the video clip to display in the window.
1.228 +@leave KErrNotSupported if CVideoPlayerUtility2 is not the current video utility in use
1.229 +@see CVideoPlayerUtility2::AddDisplayWindowL
1.230 +*/
1.231 +#ifdef SYMBIAN_BUILD_GCE
1.232 +EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& aWs,
1.233 + CWsScreenDevice& aScreenDevice,
1.234 + RWindow& aWindow,
1.235 + const TRect& aScreenRect,
1.236 + const TRect& aClipRect)
1.237 +#else
1.238 +EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& /* aWs */,
1.239 + CWsScreenDevice& /* aScreenDevice */,
1.240 + RWindow& /* aWindow */,
1.241 + const TRect& /* aScreenRect */,
1.242 + const TRect& /* aClipRect */)
1.243 +#endif // SYMBIAN_BUILD_GCE
1.244 + {
1.245 +#ifdef SYMBIAN_BUILD_GCE
1.246 + if (SupportVideoPlayerUtility2())
1.247 + {
1.248 + iVideoPlayer2->AddDisplayWindowL(aWs,
1.249 + aScreenDevice,
1.250 + aWindow,
1.251 + aScreenRect,
1.252 + aClipRect);
1.253 + iWindow = &aWindow;
1.254 +
1.255 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.256 + if (iEnableSubtitlesOnAdd)
1.257 + {
1.258 + iVideoPlayer2->EnableSubtitlesL();
1.259 + iEnableSubtitlesOnAdd = EFalse;
1.260 + }
1.261 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.262 +
1.263 + return;
1.264 + }
1.265 +#endif // SYMBIAN_BUILD_GCE
1.266 + User::Leave(KErrNotSupported);
1.267 + }
1.268 +
1.269 +#ifdef SYMBIAN_BUILD_GCE
1.270 +EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& aWs,
1.271 + CWsScreenDevice& aScreenDevice,
1.272 + RWindow& aWindow)
1.273 +#else
1.274 +EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& /* aWs */,
1.275 + CWsScreenDevice& /* aScreenDevice */,
1.276 + RWindow& /* aWindow */)
1.277 +#endif // SYMBIAN_BUILD_GCE
1.278 + {
1.279 +#ifdef SYMBIAN_BUILD_GCE
1.280 + if (SupportVideoPlayerUtility2())
1.281 + {
1.282 + iVideoPlayer2->AddDisplayWindowL(aWs,
1.283 + aScreenDevice,
1.284 + aWindow);
1.285 + iWindow = &aWindow;
1.286 +
1.287 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.288 + if (iEnableSubtitlesOnAdd)
1.289 + {
1.290 + iVideoPlayer2->EnableSubtitlesL();
1.291 + iEnableSubtitlesOnAdd = EFalse;
1.292 + }
1.293 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.294 + return;
1.295 + }
1.296 +#endif // SYMBIAN_BUILD_GCE
1.297 + User::Leave(KErrNotSupported);
1.298 + }
1.299 +
1.300 +EXPORT_C void CMVSVideoPlayAgent::AddDisplayL(RWsSession& aWs, TInt aDisplay, MMMFSurfaceEventHandler& aEventHandler)
1.301 + {
1.302 + if (!SupportVideoPlayerUtility2())
1.303 + {
1.304 + User::Leave(KErrNotSupported);
1.305 + }
1.306 +
1.307 + iVideoPlayer2->AddDisplayL(aWs, aDisplay, aEventHandler);
1.308 + }
1.309 +
1.310 +/**
1.311 +Removes a window that is currently being used to display the video picture.
1.312 +
1.313 +This function should only be called if CVideoPlayerUtility2 is currently being used for display
1.314 +of video.
1.315 +
1.316 +@param aWindow
1.317 + The window to be removed
1.318 +@leave KErrNotSupported if CVideoPlayerUtility2 is not the current video player utility.
1.319 +@see CVideoPlayerUtility2::RemoveDisplayWindow
1.320 +*/
1.321 +EXPORT_C void CMVSVideoPlayAgent::RemoveDisplayWindowL(RWindow& aWindow)
1.322 + {
1.323 +#ifdef SYMBIAN_BUILD_GCE
1.324 + if (SupportVideoPlayerUtility2())
1.325 + {
1.326 + iVideoPlayer2->RemoveDisplayWindow(aWindow);
1.327 + iWindow = NULL;
1.328 + return;
1.329 + }
1.330 +#endif // SYMBIAN_BUILD_GCE
1.331 + // Remove compiler warning
1.332 + aWindow = aWindow;
1.333 + User::Leave(KErrNotSupported);
1.334 + }
1.335 +
1.336 +EXPORT_C void CMVSVideoPlayAgent::RemoveDisplay(TInt aDisplay)
1.337 + {
1.338 + if (!SupportVideoPlayerUtility2())
1.339 + {
1.340 + User::Leave(KErrNotSupported);
1.341 + }
1.342 +
1.343 + iVideoPlayer2->RemoveDisplay(aDisplay);
1.344 + }
1.345 +
1.346 +/**
1.347 +Opens a video clip from a file.
1.348 +
1.349 +This function opens a video clip from a file,this function searches through a list of all available
1.350 +plugins and attempts to use each one until successful or the end of the list is reached.
1.351 +
1.352 +Once the opening of the video clip is complete, successfully or otherwise, the callback function
1.353 +CMVSVideoPlayAgent::MvpuoOpenComplete() is called.
1.354 +
1.355 +This function leaves if errors are encountered opening the specified video clip file, or in initialising a
1.356 +specified/unspecified controller plugin.
1.357 +
1.358 +This function can leave with one of the specified error codes.
1.359 +
1.360 +@param aFileName
1.361 + The full path name of the file containing the video data.
1.362 +*/
1.363 +EXPORT_C void CMVSVideoPlayAgent::OpenFileL(const TDesC& aFileName)
1.364 + {
1.365 + OpenFileL(aFileName, KNullUid);
1.366 + }
1.367 +
1.368 +EXPORT_C void CMVSVideoPlayAgent::OpenFileL(const TDesC& aFileName, TUid aControllerUid)
1.369 + {
1.370 + iFileLogger.Write(_L("Opening a File For CMVSVideoPlayAgent "));
1.371 +
1.372 + // remembers the file name & the controller Uid used for opening file
1.373 + iFileName.Close();
1.374 + iFileName.CreateL(aFileName);
1.375 + iControllerUid = aControllerUid;
1.376 +
1.377 + __ASSERT_DEBUG(iVideoPlayer, User::Leave(KErrNotReady));
1.378 + iVideoPlayer->Close();
1.379 +
1.380 +#ifdef SYMBIAN_BUILD_GCE
1.381 + __ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady));
1.382 + iVideoPlayer2->Close();
1.383 +
1.384 + // First attempt is always to open a file with CVideoPlayerUtility2 if GCE
1.385 + // is enabled
1.386 + iVideoPlayer2->OpenFileL(aFileName, aControllerUid);
1.387 + iCurrentVideoPlayer = iVideoPlayer2;
1.388 +#else
1.389 + iVideoPlayer->OpenFileL(aFileName, aControllerUid);
1.390 + iCurrentVideoPlayer = iVideoPlayer;
1.391 +#endif // SYMBIAN_BUILD_GCE
1.392 +
1.393 + // Now that we have selected the video player, we can issue the request for notification.
1.394 + if (iRequestNotify)
1.395 + {
1.396 + RegisterForNotification();
1.397 + }
1.398 + }
1.399 +
1.400 +EXPORT_C void CMVSVideoPlayAgent::OpenFileL(TMMSource& /*aSource*/)
1.401 + {
1.402 + }
1.403 +
1.404 +EXPORT_C void CMVSVideoPlayAgent::OpenDesL(const TDesC8& /*aDescriptor*/)
1.405 + {
1.406 + }
1.407 +
1.408 +void CMVSVideoPlayAgent::MvpuoOpenComplete(TInt aError)
1.409 + {
1.410 + iFileLogger.Write(_L("CMVSVideoPlayAgent:MvpuoOpenComplete"));
1.411 + if(aError == KErrNone)
1.412 + {
1.413 + iState = EVideoOpening;
1.414 + iFileLogger.Write(_L("MvpuoOpenComplete:VideoOpening"));
1.415 + iObserver.UpdateStateChange(iState, KErrNone);
1.416 +
1.417 + iCurrentVideoPlayer->Prepare();
1.418 + }
1.419 +#ifdef SYMBIAN_BUILD_GCE
1.420 + else if (iCurrentVideoPlayer == iVideoPlayer2 && aError == KErrNotSupported)
1.421 + {
1.422 + // if the controller cannot support GS, try use CVideoPlayerUtility instead
1.423 + TRAPD(err, iVideoPlayer->OpenFileL(iFileName, iControllerUid));
1.424 +
1.425 + if (err != KErrNone)
1.426 + {
1.427 + iState = ENotReady; //init failed so from opening to NotReady
1.428 + iFileLogger.Write(_L("MvpuoOpenComplete:From Opening to NotReady"));
1.429 + iObserver.UpdateStateChange(iState, err);
1.430 + }
1.431 +
1.432 + iCurrentVideoPlayer = iVideoPlayer;
1.433 +
1.434 + // We are switching to a different controller. Cancel the notification request on one
1.435 + // controller and reissue it on the other.
1.436 + if (iRequestNotify)
1.437 + {
1.438 + iVideoPlayer2->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
1.439 + RegisterForNotification();
1.440 + }
1.441 + }
1.442 +#endif // SYMBIAN_BUILD_GCE
1.443 + else
1.444 + {
1.445 + iState = ENotReady; //init failed so from opening to NotReady
1.446 + iFileLogger.Write(_L("MvpuoOpenComplete:From Opening to NotReady"));
1.447 + iObserver.UpdateStateChange(iState, aError);
1.448 + }
1.449 + }
1.450 +
1.451 +void CMVSVideoPlayAgent::MvpuoPrepareComplete(TInt aError)
1.452 + {
1.453 + iFileLogger.Write(_L("CMVSVideoPlayAgent:MvpuoPrepareComplete"));
1.454 + if(aError == KErrNone)
1.455 + {
1.456 + iState = EVideoOpened;
1.457 + iFileLogger.Write(_L("MvpuoPrepareComplete:Video Opened"));
1.458 + }
1.459 + else
1.460 + {
1.461 + iState = ENotReady; //prepare failed so from preparing to NotReady
1.462 + iFileLogger.Write(_L("MvpuoPrepareComplete failed : from preparing to NotReady")) ;
1.463 + }
1.464 + iObserver.UpdateStateChange(iState, aError);
1.465 + }
1.466 +
1.467 +void CMVSVideoPlayAgent::MvpuoPlayComplete(TInt aError)
1.468 + {
1.469 + if(aError == KErrNone)
1.470 + {
1.471 + iState = EVideoOpened;
1.472 + iFileLogger.Write(_L("MvpuoPlayComplete:Video Opened"));
1.473 + }
1.474 + else
1.475 + {
1.476 + iState = ENotReady; //playcomplete failed so from playcomplete to NotReady
1.477 + iFileLogger.Write(_L("MvpuoPlayComplete failed : from playcomplete to NotReady")) ;
1.478 + }
1.479 + iObserver.UpdateStateChange(iState, aError);
1.480 + }
1.481 +
1.482 +void CMVSVideoPlayAgent::MvpuoFrameReady(class CFbsBitmap&, TInt)
1.483 + {
1.484 + }
1.485 +
1.486 +void CMVSVideoPlayAgent::MvpuoEvent(const TMMFEvent& /*aEvent*/)
1.487 + {
1.488 + }
1.489 +
1.490 +void CMVSVideoPlayAgent::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData)
1.491 + {
1.492 + if(aNotificationEventId == KMMFEventCategoryAudioResourceAvailable)
1.493 + {
1.494 + iObserver.MvsResourceNotification(aNotificationData);
1.495 + }
1.496 + }
1.497 +
1.498 +EXPORT_C void CMVSVideoPlayAgent::Prepare()
1.499 + {
1.500 + iCurrentVideoPlayer->Prepare();
1.501 + }
1.502 +
1.503 +
1.504 +/**
1.505 +Closes the video clip.
1.506 +Updates the state to ENotReady after closing
1.507 +*/
1.508 +EXPORT_C void CMVSVideoPlayAgent::Close()
1.509 + {
1.510 + iFileLogger.Write(_L("CMVSVideoPlayAgent Closed"));
1.511 +
1.512 +#ifdef SYMBIAN_BUILD_GCE
1.513 + if (SupportVideoPlayerUtility2())
1.514 + {
1.515 + // Can't leave at this point, this will just remove the leave scan warning
1.516 + TRAP_IGNORE(RemoveDisplayWindowL(*iWindow));
1.517 + iVideoPlayer2->Close();
1.518 + }
1.519 +#endif // SYMBIAN_BUILD_GCE
1.520 + iVideoPlayer->Close();
1.521 +
1.522 + iObserver.UpdateStateChange(ENotReady, KErrNone);
1.523 + iCurrentVideoPlayer = NULL;
1.524 + }
1.525 +
1.526 +
1.527 +/**
1.528 +Begins playback of the initialised video sample at the current volume and priority levels.
1.529 +
1.530 +When playing of the video sample is complete, successfully or otherwise, the callback function
1.531 +CMVSVideoPlayAgent::MvpuoPlayComplete() is called.Updates the current state to EVideoPlaying,
1.532 +and once playing is over it updates the state to EVideoOpen.
1.533 +*/
1.534 +EXPORT_C void CMVSVideoPlayAgent::Play()
1.535 + {
1.536 + iCurrentVideoPlayer->Play();
1.537 +
1.538 + iState = EVideoPlaying;
1.539 + iObserver.UpdateStateChange(iState, KErrNone);
1.540 + }
1.541 +
1.542 +
1.543 +/**
1.544 +Begins playback of the initialised video sample at the specified start and end points.
1.545 +
1.546 +When playing of the video sample is complete, successfully or otherwise, the callback function
1.547 +CMVSVideoPlayAgent::MvpuoPlayComplete() is called.Updates the current state to EVideoPlaying,
1.548 +and once playing is over it updates the state to EVideoOpen.
1.549 +
1.550 +@param aStartTime
1.551 + The point at which to start playback.
1.552 +@param aEndTime
1.553 + The point at which to terminate playback.
1.554 +*/
1.555 +EXPORT_C void CMVSVideoPlayAgent::Play(const TTimeIntervalMicroSeconds& aStartPoint,
1.556 + const TTimeIntervalMicroSeconds& aEndPoint)
1.557 + {
1.558 + iCurrentVideoPlayer->Play(aStartPoint, aEndPoint);
1.559 +
1.560 + iState = EVideoPlaying;
1.561 + iObserver.UpdateStateChange(iState, KErrNone);
1.562 + }
1.563 +
1.564 +
1.565 +/**
1.566 +Stops playback of the video sample as soon as is possible.
1.567 +
1.568 +If the video sample is playing, playback is stopped as soon as possible and the callback function
1.569 +CMVSVideoPlayAgent::MvpuoPlayComplete() is called.
1.570 +
1.571 +If playback is already complete, this function has no effect. In addition, under these circumstances
1.572 +the callback function CMVSVideoPlayAgent::MvpuoPlayComplete() is not called either.
1.573 +
1.574 +The position is reset to the beginning of the file.
1.575 +
1.576 +@return An error code indicating if the function call was successful. KErrNone on success, otherwise
1.577 + another of the system-wide error codes.
1.578 +Also Updates the state to EVideoStopped
1.579 +*/
1.580 +EXPORT_C TInt CMVSVideoPlayAgent::Stop()
1.581 + {
1.582 + TInt err = KErrNotReady;
1.583 + if (iCurrentVideoPlayer)
1.584 + {
1.585 + err = iCurrentVideoPlayer->Stop();
1.586 + }
1.587 +
1.588 + if (err == KErrNone)
1.589 + {
1.590 + iState = EVideoStopped;
1.591 + iFileLogger.Write(_L("CMVSVideoPlayAgent Stopped"));
1.592 + }
1.593 + else
1.594 + {
1.595 + iState = ENotReady;
1.596 + }
1.597 + iObserver.UpdateStateChange(iState, err);
1.598 +
1.599 + return err;
1.600 + }
1.601 +
1.602 +
1.603 +/**
1.604 +Video playback is paused. The current position is maintained and playback can be
1.605 +resumed by calling Play.
1.606 +*/
1.607 +EXPORT_C void CMVSVideoPlayAgent::PauseL()
1.608 + {
1.609 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.610 +
1.611 + TRAPD(err, iCurrentVideoPlayer->PauseL());
1.612 + if(err == KErrNone)
1.613 + {
1.614 + iState = EVideoPaused;
1.615 + iFileLogger.Write(_L("CMVSVideoPlayAgent Paused "));
1.616 + }
1.617 + else
1.618 + {
1.619 + iState = ENotReady;
1.620 + iFileLogger.Write(_L("CMVSVideoPlayAgent Not Ready"));
1.621 + }
1.622 + iObserver.UpdateStateChange(iState, err);
1.623 + }
1.624 +
1.625 +
1.626 +/**
1.627 +Sends custom command to the plugin controller.
1.628 +Passes handle and size of the drawable window.
1.629 +
1.630 +Sets the display window. This is used to provide the video controller with an area of
1.631 +the display to render the current video frame.
1.632 +
1.633 +@param aWs
1.634 + The window server session ID.
1.635 +@param aScreenDevice
1.636 + The software device screen.
1.637 +@param aWindowRect
1.638 + The window to display.
1.639 +@param aScreenRect
1.640 + The dimensions of the display window.
1.641 +@param aClipRect
1.642 + The area of the video clip to display in the window.
1.643 +*/
1.644 +EXPORT_C void CMVSVideoPlayAgent::SetDisplayWindowL(RWsSession &aWs, CWsScreenDevice &aScreenDevice, RWindow &aWindow, const TRect &aWindowRect, const TRect &aClipRect)
1.645 + {
1.646 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.647 +
1.648 + iFileLogger.Write(_L("SettingDisplayWindow"));
1.649 + iCurrentVideoPlayer->SetDisplayWindowL(aWs, aScreenDevice, aWindow, aWindowRect, aClipRect);
1.650 + }
1.651 +
1.652 +
1.653 +/**
1.654 +Sets the video frame rate.
1.655 +
1.656 +@param aFramesPerSecond
1.657 + The number of frames per second to request.
1.658 +*/
1.659 +EXPORT_C void CMVSVideoPlayAgent::SetVideoFrameRateL(TReal32 aFramesPerSecond)
1.660 + {
1.661 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.662 +
1.663 + iFileLogger.Write(_L("SettingVedioFrameRate "));
1.664 + iCurrentVideoPlayer->SetVideoFrameRateL(aFramesPerSecond);
1.665 + }
1.666 +
1.667 +
1.668 +/**
1.669 +Sets the playback volume for the audio track of the video clip.
1.670 +
1.671 +The volume can be changed before or during playback and is effective immediately. The volume can
1.672 +be set to any value between zero (mute) and the maximum permissible volume
1.673 +(determined using MaxVolume()).
1.674 +
1.675 +To determine if the current video clip contains an audio track, use AudioEnabledL().
1.676 +
1.677 +
1.678 +@param aVolume
1.679 + The volume, between 0 and MaxVolume().
1.680 +*/
1.681 +EXPORT_C void CMVSVideoPlayAgent::SetVolumeL(TInt aVolume)
1.682 + {
1.683 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.684 +
1.685 + iFileLogger.Write(_L("Setting CMVSVideoPlayAgent's Volume "));
1.686 + iCurrentVideoPlayer->SetVolumeL(aVolume);
1.687 + }
1.688 +
1.689 +
1.690 +/**
1.691 +Sets the current playback balance for the audio track of the video clip.
1.692 +
1.693 +The balance can be any value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight,
1.694 +the default value being KMMFBalanceCenter.
1.695 +
1.696 +@param aBalance
1.697 + The balance value to set.
1.698 +*/
1.699 +EXPORT_C void CMVSVideoPlayAgent::SetBalanceL(TInt aBalance)
1.700 + {
1.701 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.702 +
1.703 + iFileLogger.Write(_L("Setting CMVSVideoPlayAgent's Balance"));
1.704 + iCurrentVideoPlayer->SetBalanceL(aBalance);
1.705 + }
1.706 +
1.707 +
1.708 +/**
1.709 +Sets the playback priority.
1.710 +
1.711 +This is used to arbitrate between multiple objects simultaneously trying to accesses
1.712 +the sound hardware.
1.713 +
1.714 +@param aPriority
1.715 + The priority level to apply, EMdaPriorityMin client can be interrupted by any other
1.716 + client, EMdaPriorityNormal client can only be interrupted by a client with a higher
1.717 + priority or EMdaPriorityMax client cannot be interrupted by other clients.
1.718 +@param aPref
1.719 + The time and quality preferences to apply, enumerated in TMdaPriorityPreference.
1.720 +*/
1.721 +EXPORT_C void CMVSVideoPlayAgent::SetPriorityL(TInt aPriority, TMdaPriorityPreference aPref)
1.722 + {
1.723 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.724 +
1.725 + iFileLogger.Write(_L("Setting Priority of CMVSVideoPlayAgent"));
1.726 + iCurrentVideoPlayer->SetPriorityL(aPriority, aPref);
1.727 + }
1.728 +
1.729 +
1.730 +/**
1.731 +Sets the position within the video clip from where to start playback.
1.732 +
1.733 +@param aPosition
1.734 + Position from start of clip in microseconds.
1.735 +*/
1.736 +EXPORT_C void CMVSVideoPlayAgent::SetPositionL(const TTimeIntervalMicroSeconds &aPosition)
1.737 + {
1.738 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.739 +
1.740 + iFileLogger.Write(_L("Setting Position of CMVSVideoPlayAgent"));
1.741 + iCurrentVideoPlayer->SetPositionL(aPosition);
1.742 + }
1.743 +
1.744 +
1.745 +/**
1.746 +Rotates the video image on the screen.
1.747 +
1.748 +@param aRotation
1.749 + The desired rotation to apply in 90 degree increments.
1.750 +*/
1.751 +EXPORT_C void CMVSVideoPlayAgent::SetRotationL(TVideoRotation aRotation)
1.752 + {
1.753 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.754 +
1.755 + iFileLogger.Write(_L("Setting Rotations of CMVSVideoPlayAgent"));
1.756 + iCurrentVideoPlayer->SetRotationL(aRotation);
1.757 + }
1.758 +
1.759 +
1.760 +
1.761 +/**
1.762 +Scales the video image to a specified percentage of its original size.
1.763 +
1.764 +@param aWidthPercentage
1.765 + The percentage (100 = original size) to be used to scale the width of the video image
1.766 +@param aHeightPercentage
1.767 + The percentage (100 = original size) to be used to scale the height of the video image.
1.768 + If this is not equal to aWidthPercentage then the image may be distorted.
1.769 +@param aAntiAliasFiltering
1.770 + A boolean specifying if anti-aliasing should be used. True if anti-aliasing filtering
1.771 + should be used. If the plugin does not support this kind of processing,
1.772 + this value will be ignored.
1.773 +*/
1.774 +EXPORT_C void CMVSVideoPlayAgent::SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering)
1.775 + {
1.776 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.777 +
1.778 + iFileLogger.Write(_L("Setting ScaleFactor of CMVSVideoPlayAgent"));
1.779 + iCurrentVideoPlayer->SetScaleFactorL(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering);
1.780 + }
1.781 +
1.782 +
1.783 +/**
1.784 +Selects a region of the video image to be displayed.
1.785 +
1.786 +@param aCropRegion
1.787 + The dimensions of the crop region, relative to the video image.
1.788 +@see GetCropRegionL
1.789 +*/
1.790 +EXPORT_C void CMVSVideoPlayAgent::SetCropRegionL(const TRect& aCropRegion)
1.791 + {
1.792 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.793 +
1.794 + iFileLogger.Write(_L("Setting CorpRegion of CMVSVideoPlayAgent"));
1.795 + iCurrentVideoPlayer->SetCropRegionL(aCropRegion);
1.796 + }
1.797 +
1.798 +/**
1.799 +Selects the video extent on the screen, relative to the window.
1.800 +
1.801 +@param aVideoExtent
1.802 + The new video extent, relative to the window
1.803 +@leave KErrNotSupport if CVideoPlayerUtility is used for video playback
1.804 +*/
1.805 +#ifdef SYMBIAN_BUILD_GCE
1.806 +EXPORT_C void CMVSVideoPlayAgent::SetVideoExtentL(const TRect& aVideoExtent)
1.807 +#else
1.808 +EXPORT_C void CMVSVideoPlayAgent::SetVideoExtentL(const TRect& /* aVideoExtent */)
1.809 +#endif // SYMBIAN_BUILD_GCE
1.810 + {
1.811 + iFileLogger.Write(_L("Setting VideoExtent of CMVSVideoPlayAgent"));
1.812 +
1.813 +#ifdef SYMBIAN_BUILD_GCE
1.814 + if(SupportVideoPlayerUtility2())
1.815 + {
1.816 + if (iWindow)
1.817 + {
1.818 + iVideoPlayer2->SetVideoExtentL(*iWindow, aVideoExtent);
1.819 + }
1.820 + else
1.821 + {
1.822 + iFileLogger.Write(_L("WARNING - Display Window has not been set. Caller should save these values to be set again later."));
1.823 + }
1.824 + return;
1.825 + }
1.826 +#endif // SYMBIAN_BUILD_GCE
1.827 +
1.828 + User::Leave(KErrNotSupported);
1.829 + }
1.830 +
1.831 +/**
1.832 +Selects the window clipping rectangle, relative to the window
1.833 +
1.834 +@param aWindowClipRect
1.835 + The new window clipping rectangle, relative to the window
1.836 +@leave KErrNotSupport if CVideoPlayerUtility is used for video playback
1.837 +*/
1.838 +#ifdef SYMBIAN_BUILD_GCE
1.839 +EXPORT_C void CMVSVideoPlayAgent::SetWindowClipRectL(const TRect& aWindowClipRect)
1.840 +#else
1.841 +EXPORT_C void CMVSVideoPlayAgent::SetWindowClipRectL(const TRect& /* aWindowClipRect */)
1.842 +#endif // SYMBIAN_BUILD_GCE
1.843 + {
1.844 + iFileLogger.Write(_L("Setting WindowClippingRect of CMVSVideoPlayAgent"));
1.845 +
1.846 +#ifdef SYMBIAN_BUILD_GCE
1.847 + if (SupportVideoPlayerUtility2())
1.848 + {
1.849 + if (iWindow)
1.850 + {
1.851 + iVideoPlayer2->SetWindowClipRectL(*iWindow, aWindowClipRect);
1.852 + }
1.853 + else
1.854 + {
1.855 + iFileLogger.Write(_L("WARNING - Display Window has not been set. Caller should save these values to be set again later."));
1.856 + }
1.857 + return;
1.858 + }
1.859 +#endif // SYMBIAN_BUILD_GCE
1.860 +
1.861 + User::Leave(KErrNotSupported);
1.862 + }
1.863 +
1.864 +
1.865 +/**
1.866 +Gets the current frame. The current frame is requested, and will be sent to
1.867 +the client asynchrynously.
1.868 +
1.869 +@param aDisplayMode
1.870 + The display mode for the retrieved frame.
1.871 +*/
1.872 +EXPORT_C void CMVSVideoPlayAgent::GetFrameL(TDisplayMode aDisplayMode)
1.873 + {
1.874 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.875 + iCurrentVideoPlayer->GetFrameL(aDisplayMode);
1.876 + }
1.877 +
1.878 +
1.879 +/**
1.880 +Gets the current frame. The current frame is requested, and will be sent to
1.881 +the client asynchrynously.
1.882 +
1.883 +@param aDisplayMode
1.884 + The display mode for the retrieved frame.
1.885 +@param aIntent
1.886 + The DRM Intent to pass to the controller.
1.887 +*/
1.888 +EXPORT_C void CMVSVideoPlayAgent::GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent)
1.889 + {
1.890 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.891 + iCurrentVideoPlayer->GetFrameL(aDisplayMode, aIntent);
1.892 + }
1.893 +
1.894 +
1.895 +/**
1.896 +Returns the video frame rate in frames/second.
1.897 +
1.898 +@return The video frame rate (frames/second).
1.899 +*/
1.900 +EXPORT_C TReal32 CMVSVideoPlayAgent::VideoFrameRateL()
1.901 + {
1.902 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.903 +
1.904 + iFileLogger.Write(_L("Getting VideoFrameRate for CMVSVideoPlayAgent"));
1.905 + return iCurrentVideoPlayer->VideoFrameRateL();
1.906 + }
1.907 +
1.908 +
1.909 +/**
1.910 +Gets the video frame size.
1.911 +
1.912 +@param aSize
1.913 + The video frame size
1.914 +*/
1.915 +EXPORT_C void CMVSVideoPlayAgent::VideoFrameSizeL(TSize &aSize)
1.916 + {
1.917 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.918 +
1.919 + iFileLogger.Write(_L("Getting VideoFrameFrameSize for CMVSVideoPlayAgent"));
1.920 + iCurrentVideoPlayer->VideoFrameSizeL(aSize);
1.921 + }
1.922 +
1.923 +
1.924 +/**
1.925 +Returns the video format's MIME type.
1.926 +
1.927 +@return The video clip's MIME type.
1.928 +*/
1.929 +EXPORT_C const TDesC8& CMVSVideoPlayAgent::VideoFormatMimeType()
1.930 + {
1.931 + if (iCurrentVideoPlayer)
1.932 + {
1.933 + return iCurrentVideoPlayer->VideoFormatMimeType();
1.934 + }
1.935 + else
1.936 + {
1.937 + return KNullDesC8;
1.938 + }
1.939 + }
1.940 +
1.941 +
1.942 +/**
1.943 +Returns the video bit rate.
1.944 +
1.945 +@return The video bit rate in bits/second.
1.946 +*/
1.947 +EXPORT_C TInt CMVSVideoPlayAgent::VideoBitRateL()
1.948 + {
1.949 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.950 +
1.951 + iFileLogger.Write(_L("Getting VideoBitRate for CMVSVideoPlayAgent"));
1.952 + return iCurrentVideoPlayer->VideoBitRateL();
1.953 + }
1.954 +
1.955 +
1.956 +/**
1.957 +Returns the audio bit rate in bits/second.
1.958 +
1.959 +@return The audio bit rate (bits/second).
1.960 +*/
1.961 +EXPORT_C TInt CMVSVideoPlayAgent::AudioBitRateL()
1.962 + {
1.963 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.964 +
1.965 + iFileLogger.Write(_L("Getting AudioBitRate for CMVSVideoPlayAgent"));
1.966 + return iCurrentVideoPlayer->AudioBitRateL();
1.967 + }
1.968 +
1.969 +
1.970 +/**
1.971 +Returns the codec used for the audio component of the video clip.
1.972 +
1.973 +@return The four character code representing the audio codec.
1.974 +*/
1.975 +EXPORT_C TFourCC CMVSVideoPlayAgent::AudioTypeL()
1.976 + {
1.977 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.978 +
1.979 + iFileLogger.Write(_L("Getting AudioType for CMVSVideoPlayAgent"));
1.980 + return iCurrentVideoPlayer->AudioTypeL();
1.981 + }
1.982 +
1.983 +
1.984 +/**
1.985 +Returns whether the current clip has an audio stream.
1.986 +
1.987 +@return Boolean indication the presence of an audio stream. ETrue if an audio track is present,
1.988 + otherwise EFalse.
1.989 +*/
1.990 +EXPORT_C TBool CMVSVideoPlayAgent::AudioEnabledL()
1.991 + {
1.992 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.993 +
1.994 + iFileLogger.Write(_L("CMVSVideoPlayAgent's Audio Enabled"));
1.995 + return iCurrentVideoPlayer->AudioEnabledL();
1.996 + }
1.997 +
1.998 +
1.999 +/**
1.1000 +Returns the current playback position.
1.1001 +
1.1002 +@return The current position from the start of the clip in microseconds.
1.1003 +*/
1.1004 +EXPORT_C TTimeIntervalMicroSeconds CMVSVideoPlayAgent::PositionL()
1.1005 + {
1.1006 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.1007 + return iCurrentVideoPlayer->PositionL();
1.1008 + }
1.1009 +
1.1010 +
1.1011 +/**
1.1012 +Returns the duration of video clip in mircoseconds.
1.1013 +
1.1014 +@return The duration of clip in microseconds.
1.1015 +*/
1.1016 +EXPORT_C TTimeIntervalMicroSeconds CMVSVideoPlayAgent::DurationL()
1.1017 + {
1.1018 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.1019 + return iCurrentVideoPlayer->DurationL();
1.1020 + }
1.1021 +
1.1022 +
1.1023 +/**
1.1024 +Returns the current playback volume for the audio track of the video clip.
1.1025 +
1.1026 +@return A value between 0 (mute) and the maximum volume returned by MaxVolume().
1.1027 +*/
1.1028 +EXPORT_C TInt CMVSVideoPlayAgent::Volume()
1.1029 + {
1.1030 + return iCurrentVideoPlayer->Volume();
1.1031 + }
1.1032 +
1.1033 +
1.1034 +/**
1.1035 +Get the current playback priority. This is used to arbitrate between simultaneous accesses of
1.1036 +the sound hardware.
1.1037 +
1.1038 +@param aPriority
1.1039 + On return, contains the priority level, EMdaPriorityMin client can be interrupted by any
1.1040 + other client, EMdaPriorityNormal client can only be interrupted by a client with a higher
1.1041 + priority or EMdaPriorityMax client cannot be interrupted by other clients.
1.1042 +@param aPref
1.1043 + On return, contains the time and quality preferences, enumerated in TMdaPriorityPreference.
1.1044 +*/
1.1045 +EXPORT_C void CMVSVideoPlayAgent::PriorityL(TInt &aPriority, TMdaPriorityPreference &aPref)
1.1046 + {
1.1047 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.1048 + iCurrentVideoPlayer->PriorityL(aPriority, aPref);
1.1049 + }
1.1050 +
1.1051 +
1.1052 +/**
1.1053 +Returns the current balance setting for the audio track of the video clip.
1.1054 +
1.1055 +@return A balance value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight.
1.1056 +*/
1.1057 +EXPORT_C TInt CMVSVideoPlayAgent::Balance()
1.1058 + {
1.1059 + return iCurrentVideoPlayer->Balance();
1.1060 + }
1.1061 +
1.1062 +
1.1063 +/**
1.1064 +Query the rotation that is currently applied to the video image.
1.1065 +
1.1066 +@return The applied rotation
1.1067 +
1.1068 +@see SetRotationL
1.1069 +*/
1.1070 +EXPORT_C TVideoRotation CMVSVideoPlayAgent::RotationL()
1.1071 + {
1.1072 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.1073 + return iCurrentVideoPlayer->RotationL();
1.1074 + }
1.1075 +
1.1076 +
1.1077 +/**
1.1078 +Gets the scale factor currently applied to the video image.
1.1079 +
1.1080 +@param aWidthPercentage
1.1081 + On function return, contains the current scaling percentage applied to the width of the
1.1082 + video image (100 = original size).
1.1083 +@param aHeightPercentage
1.1084 + On function return, contains the current scaling percentage applied to the height of the
1.1085 + of the video image (100 = original size).
1.1086 +@param aAntiAliasFiltering
1.1087 + The boolean specifying if anit-aliasing is being used.
1.1088 +@see SetScaleFactorL
1.1089 +*/
1.1090 +EXPORT_C void CMVSVideoPlayAgent::GetScaleFactorL(TReal32 &aWidthPercentage, TReal32 &aHeightPercentage, TBool &aAntiAliasFiltering)
1.1091 + {
1.1092 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.1093 + iCurrentVideoPlayer->GetScaleFactorL(aWidthPercentage,
1.1094 + aHeightPercentage,
1.1095 + aAntiAliasFiltering);
1.1096 + }
1.1097 +
1.1098 +
1.1099 +/**
1.1100 +Gets the crop region currently applied to the image.
1.1101 +
1.1102 +@param aCropRegion
1.1103 + The dimensions of the crop region, relative to the video image. If no
1.1104 + crop region has been applied, the full dimensions of the video image will
1.1105 + be returned.
1.1106 +
1.1107 +@see SetCropRegionL
1.1108 +*/
1.1109 +EXPORT_C void CMVSVideoPlayAgent::GetCropRegionL(TRect &aCropRegion)
1.1110 + {
1.1111 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.1112 + iCurrentVideoPlayer->GetCropRegionL(aCropRegion);
1.1113 + }
1.1114 +
1.1115 +
1.1116 +/**
1.1117 +Returns the number of meta data entries associated with this clip.
1.1118 +
1.1119 +@return The number of meta data entries.
1.1120 +*/
1.1121 +EXPORT_C TInt CMVSVideoPlayAgent::NumberOfMetaDataEntriesL()
1.1122 + {
1.1123 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.1124 + return iCurrentVideoPlayer->NumberOfMetaDataEntriesL();
1.1125 + }
1.1126 +
1.1127 +
1.1128 +/**
1.1129 +Returns an array containing the MetaDataEntry for the given audio clip
1.1130 +
1.1131 +@param aMetaData
1.1132 + The meta data Array
1.1133 +
1.1134 +@leave Leaves with KErrNotFound if the meta data entry does not exist or
1.1135 + KErrNotSupported if the controller does not support meta data
1.1136 + information for this format. Other errors indicate more general system
1.1137 + failure.
1.1138 +*/
1.1139 +EXPORT_C void CMVSVideoPlayAgent::GetMetaDataArrayL(RPointerArray<CMMFMetaDataEntry>& aMetaData)
1.1140 + {
1.1141 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.1142 +
1.1143 + //Reset the meta array
1.1144 + aMetaData.Reset();
1.1145 + TInt entries = NumberOfMetaDataEntriesL();
1.1146 +
1.1147 + CMMFMetaDataEntry* entry = NULL;
1.1148 + for(TInt index= 0; index < entries; ++index)
1.1149 + {
1.1150 + entry = iCurrentVideoPlayer->MetaDataEntryL(index);
1.1151 + aMetaData.Append(entry);
1.1152 + }
1.1153 + }
1.1154 +
1.1155 +/**
1.1156 +Returns the controller implementation information associated with the current controller.
1.1157 +
1.1158 +@return The controller implementation structure
1.1159 +*/
1.1160 +EXPORT_C const CMMFControllerImplementationInformation& CMVSVideoPlayAgent::ControllerImplementationInformationL()
1.1161 + {
1.1162 + __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1.1163 +
1.1164 + iFileLogger.Write(_L("Getting the ControllerImplementationInformation of CMVSVideoPlayAgent")) ;
1.1165 + return iCurrentVideoPlayer->ControllerImplementationInformationL();
1.1166 + }
1.1167 +
1.1168 +
1.1169 +/**
1.1170 +Returns the current state of the CMVSAudioPlayAgent.
1.1171 +
1.1172 +@return The current state, iState.
1.1173 +*/
1.1174 +EXPORT_C TMVSState CMVSVideoPlayAgent::GetState()
1.1175 + {
1.1176 + return iState;
1.1177 + }
1.1178 +
1.1179 +/**
1.1180 +Sets the specified output screen to render the video.
1.1181 +
1.1182 +@return KErrNone,on success else any of the system wide error code.
1.1183 +*/
1.1184 +EXPORT_C TInt CMVSVideoPlayAgent::SetScreenNumber(TInt aScreenNumber)
1.1185 + {
1.1186 + TInt err = KErrNone;
1.1187 +
1.1188 + if (!iCurrentVideoPlayer)
1.1189 + {
1.1190 + err = iVideoPlayer->SetInitScreenNumber(aScreenNumber);
1.1191 + }
1.1192 + else
1.1193 + {
1.1194 + err = iCurrentVideoPlayer->SetInitScreenNumber(aScreenNumber);
1.1195 + }
1.1196 +
1.1197 + if (err == KErrNone)
1.1198 + {
1.1199 + iScreenNumber = aScreenNumber;
1.1200 + }
1.1201 +
1.1202 + return err;
1.1203 + }
1.1204 +
1.1205 +/**
1.1206 +Registers for audio resource notification.
1.1207 +
1.1208 +@return KErrNone,on success else any of the system wide error code.
1.1209 +*/
1.1210 +EXPORT_C TInt CMVSVideoPlayAgent::RegisterForNotification()
1.1211 + {
1.1212 + if (!iCurrentVideoPlayer)
1.1213 + {
1.1214 + // Set the request notify flag. When we select which video player we are using we
1.1215 + // will issue the request for notification.
1.1216 + iRequestNotify = ETrue;
1.1217 + return KErrNone;
1.1218 + }
1.1219 +
1.1220 + return iCurrentVideoPlayer->RegisterAudioResourceNotification(*this, KMMFEventCategoryAudioResourceAvailable);
1.1221 + }
1.1222 +
1.1223 +/**
1.1224 +Cancels any existing registeration to audio resource notification.
1.1225 +
1.1226 +@return KErrNone,on success else any of the system wide error code.
1.1227 +*/
1.1228 +EXPORT_C TInt CMVSVideoPlayAgent::CancelNotification()
1.1229 + {
1.1230 + if (!iCurrentVideoPlayer)
1.1231 + {
1.1232 + iRequestNotify = EFalse;
1.1233 + return KErrNone;
1.1234 + }
1.1235 +
1.1236 + return iCurrentVideoPlayer->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
1.1237 + }
1.1238 +
1.1239 +EXPORT_C TInt CMVSVideoPlayAgent::WillResumePlay()
1.1240 + {
1.1241 + if (!iCurrentVideoPlayer)
1.1242 + {
1.1243 + return KErrNotReady;
1.1244 + }
1.1245 + return iCurrentVideoPlayer->WillResumePlay();
1.1246 + }
1.1247 +
1.1248 +/**
1.1249 +Returns an integer representing the maximum volume that the audio track can support.
1.1250 +
1.1251 +This is the maximum value that can be passed to SetVolumeL(). This value is platform
1.1252 +independent, but is always greater than or equal to one.
1.1253 +
1.1254 +@return The maximum playback volume.
1.1255 +*/
1.1256 +EXPORT_C TInt CMVSVideoPlayAgent::MaxVolume()
1.1257 + {
1.1258 + if (!iCurrentVideoPlayer)
1.1259 + {
1.1260 + return iVideoPlayer->MaxVolume();
1.1261 + }
1.1262 +
1.1263 + return iCurrentVideoPlayer->MaxVolume();
1.1264 + }
1.1265 +
1.1266 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.1267 +EXPORT_C void CMVSVideoPlayAgent::EnableSubtitlesL()
1.1268 + {
1.1269 + __ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady));
1.1270 +
1.1271 + if (iWindow)
1.1272 + {
1.1273 + iVideoPlayer2->EnableSubtitlesL();
1.1274 + }
1.1275 + else
1.1276 + {
1.1277 + iEnableSubtitlesOnAdd = ETrue;
1.1278 + }
1.1279 + }
1.1280 +
1.1281 +EXPORT_C void CMVSVideoPlayAgent::DisableSubtitlesL()
1.1282 + {
1.1283 + __ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady));
1.1284 + iVideoPlayer2->DisableSubtitles();
1.1285 + iEnableSubtitlesOnAdd = EFalse;
1.1286 + }
1.1287 +
1.1288 +EXPORT_C TBool CMVSVideoPlayAgent::SubtitlesAvailable()
1.1289 + {
1.1290 + if (iVideoPlayer2)
1.1291 + {
1.1292 + return iVideoPlayer2->SubtitlesAvailable();
1.1293 + }
1.1294 +
1.1295 + return EFalse;
1.1296 + }
1.1297 +
1.1298 +EXPORT_C void CMVSVideoPlayAgent::RenderSubtitle(const TRect& aRect)
1.1299 + {
1.1300 + if (iVideoPlayer2)
1.1301 + {
1.1302 + iVideoPlayer2->RedrawSubtitle(*iWindow, aRect);
1.1303 + }
1.1304 + }
1.1305 +
1.1306 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT