sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Part of the MVS Agents for TechView sl@0: // sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: #include sl@0: #include sl@0: #endif sl@0: sl@0: #include "videoplayagent.h" sl@0: sl@0: /** sl@0: Constructs and initialises a new instance of the MVS video play agent sl@0: sl@0: This function leaves if the video play agent object cannot be created. sl@0: sl@0: @param aObserver sl@0: A client class to receive notifications from the video player. sl@0: sl@0: @return A pointer to the new video play agent object. sl@0: */ sl@0: EXPORT_C CMVSVideoPlayAgent* CMVSVideoPlayAgent::NewL(MMVSClientObserver& aObserver) sl@0: { sl@0: CMVSVideoPlayAgent* self = new(ELeave) CMVSVideoPlayAgent(aObserver); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: void CMVSVideoPlayAgent::ConstructL() sl@0: { sl@0: User::LeaveIfError(iFileLogger.Connect()); sl@0: iFileLogger.CreateLog(_L("LogMVSappUi"),_L("LogFile.txt"),EFileLoggingModeAppend); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Destructor. Closes any open video clips and frees any resources held by the Video Player. sl@0: */ sl@0: EXPORT_C CMVSVideoPlayAgent::~CMVSVideoPlayAgent() sl@0: { sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: delete iVideoPlayer2; sl@0: iVideoPlayer2 = NULL; sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: sl@0: delete iVideoPlayer; sl@0: iVideoPlayer = NULL; sl@0: sl@0: if(iFileLogger.Handle()) sl@0: { sl@0: iFileLogger.CloseLog(); sl@0: iFileLogger.Close(); sl@0: } sl@0: sl@0: iFileName.Close(); sl@0: } sl@0: sl@0: sl@0: CMVSVideoPlayAgent::CMVSVideoPlayAgent(MMVSClientObserver& aObserver) sl@0: : iObserver(aObserver), sl@0: iControllerUid(KNullUid) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Check if CVideoPlayerUtility2 is used for current video playback. sl@0: sl@0: @return ETrue if CVideoPlayerUtility2 is used for video playback. EFalse if sl@0: CVideoPlayerUtility is used. sl@0: */ sl@0: EXPORT_C TBool CMVSVideoPlayAgent::SupportVideoPlayerUtility2() const sl@0: { sl@0: if (iCurrentVideoPlayer == NULL) sl@0: { sl@0: return EFalse; sl@0: } sl@0: sl@0: if (iCurrentVideoPlayer == iVideoPlayer) sl@0: { sl@0: return EFalse; sl@0: } sl@0: sl@0: return ETrue; sl@0: } sl@0: sl@0: /** sl@0: Set the auto scale on the current video player for the specified window. sl@0: sl@0: @see CVideoPlayerUtility sl@0: */ sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(RWindow& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos) sl@0: { sl@0: iVideoPlayer2->SetAutoScaleL(aWindow, aScaleType, aHorizPos, aVertPos); sl@0: #else sl@0: EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(RWindow& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: #endif sl@0: } sl@0: sl@0: /** sl@0: Set the auto scale on the current video player. sl@0: sl@0: @see CVideoPlayerUtility sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos) sl@0: { sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: iCurrentVideoPlayer->SetAutoScaleL(aScaleType, aHorizPos, aVertPos); sl@0: #else sl@0: // Remove warnings sl@0: aScaleType = aScaleType; sl@0: aHorizPos = aHorizPos; sl@0: aVertPos = aVertPos; sl@0: User::Leave(KErrNotSupported); sl@0: #endif sl@0: } sl@0: sl@0: /** sl@0: Video output settings, pre initialisation of all the required settings to play a sl@0: video clip sl@0: sl@0: This function leaves if the video player utility object cannot be created. sl@0: sl@0: @param aObserver sl@0: A client class to receive notifications from the video player. sl@0: @param aPriority sl@0: This client's relative priority. This is a value between EMdaPriorityMin and sl@0: EMdaPriorityMax and represents a relative priority. A higher value indicates sl@0: a more important request. sl@0: @param aPref sl@0: The required behaviour if a higher priority client takes over the sound output device. sl@0: One of the values defined by TMdaPriorityPreference. sl@0: @param aWs sl@0: The window server session id. sl@0: @param aScreenDevice sl@0: The software device screen. sl@0: @param aWindow sl@0: The display window. sl@0: @param aScreenRect sl@0: The dimensions of the display window. sl@0: @param aClipRect sl@0: The area of the video clip to display in the window. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetVideoOutputL(RWsSession& aWs, sl@0: CWsScreenDevice& aScreenDevice, sl@0: RWindow& aWindow, sl@0: TRect& aScreenRect, sl@0: TRect& aClipRect) sl@0: { sl@0: iFileLogger.Write(_L("SettingVideoOutput")); sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: // if CVideoPlayerUtility2 is available, instantiate both CVideoPlayerUtility2 & sl@0: // CVideoPlayerUtility, as it is not clear whether the controller used for a sl@0: // particular media file also supports the CVideoPlayerUtility2 API until OpenFileL sl@0: // is called. sl@0: if (iVideoPlayer2) sl@0: { sl@0: delete iVideoPlayer2; sl@0: iVideoPlayer2 = NULL; sl@0: } sl@0: sl@0: iVideoPlayer2 = CVideoPlayerUtility2::NewL(*this, sl@0: EMdaPriorityNormal, sl@0: EMdaPriorityPreferenceNone); sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: sl@0: if (iVideoPlayer) sl@0: { sl@0: delete iVideoPlayer; sl@0: iVideoPlayer = NULL; sl@0: } sl@0: iVideoPlayer = CVideoPlayerUtility::NewL(*this, sl@0: EMdaPriorityNormal, sl@0: EMdaPriorityPreferenceNone, sl@0: aWs, sl@0: aScreenDevice, sl@0: aWindow, sl@0: aScreenRect, sl@0: aClipRect); sl@0: } sl@0: sl@0: /** sl@0: Adds a new window for displaying the video picture. This is only applicable if sl@0: CVideoPlayerUtility2 is used. sl@0: sl@0: This function leaves if the video player utility object failed to add display window or sl@0: if this function is called when CVideoPlayerUtility2 is not being used. sl@0: sl@0: @param aObserver sl@0: A client class to receive notifications from the video player. sl@0: @param aPriority sl@0: This client's relative priority. This is a value between EMdaPriorityMin and sl@0: EMdaPriorityMax and represents a relative priority. A higher value indicates sl@0: a more important request. sl@0: @param aPref sl@0: The required behaviour if a higher priority client takes over the sound output device. sl@0: One of the values defined by TMdaPriorityPreference. sl@0: @param aWs sl@0: The window server session id. sl@0: @param aScreenDevice sl@0: The software device screen. sl@0: @param aWindow sl@0: The display window. sl@0: @param aScreenRect sl@0: The dimensions of the display window. sl@0: @param aClipRect sl@0: The area of the video clip to display in the window. sl@0: @leave KErrNotSupported if CVideoPlayerUtility2 is not the current video utility in use sl@0: @see CVideoPlayerUtility2::AddDisplayWindowL sl@0: */ sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& aWs, sl@0: CWsScreenDevice& aScreenDevice, sl@0: RWindow& aWindow, sl@0: const TRect& aScreenRect, sl@0: const TRect& aClipRect) sl@0: #else sl@0: EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& /* aWs */, sl@0: CWsScreenDevice& /* aScreenDevice */, sl@0: RWindow& /* aWindow */, sl@0: const TRect& /* aScreenRect */, sl@0: const TRect& /* aClipRect */) sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: { sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: if (SupportVideoPlayerUtility2()) sl@0: { sl@0: iVideoPlayer2->AddDisplayWindowL(aWs, sl@0: aScreenDevice, sl@0: aWindow, sl@0: aScreenRect, sl@0: aClipRect); sl@0: iWindow = &aWindow; sl@0: sl@0: #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: if (iEnableSubtitlesOnAdd) sl@0: { sl@0: iVideoPlayer2->EnableSubtitlesL(); sl@0: iEnableSubtitlesOnAdd = EFalse; sl@0: } sl@0: #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: sl@0: return; sl@0: } sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& aWs, sl@0: CWsScreenDevice& aScreenDevice, sl@0: RWindow& aWindow) sl@0: #else sl@0: EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& /* aWs */, sl@0: CWsScreenDevice& /* aScreenDevice */, sl@0: RWindow& /* aWindow */) sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: { sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: if (SupportVideoPlayerUtility2()) sl@0: { sl@0: iVideoPlayer2->AddDisplayWindowL(aWs, sl@0: aScreenDevice, sl@0: aWindow); sl@0: iWindow = &aWindow; sl@0: sl@0: #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: if (iEnableSubtitlesOnAdd) sl@0: { sl@0: iVideoPlayer2->EnableSubtitlesL(); sl@0: iEnableSubtitlesOnAdd = EFalse; sl@0: } sl@0: #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: return; sl@0: } sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: EXPORT_C void CMVSVideoPlayAgent::AddDisplayL(RWsSession& aWs, TInt aDisplay, MMMFSurfaceEventHandler& aEventHandler) sl@0: { sl@0: if (!SupportVideoPlayerUtility2()) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: iVideoPlayer2->AddDisplayL(aWs, aDisplay, aEventHandler); sl@0: } sl@0: sl@0: /** sl@0: Removes a window that is currently being used to display the video picture. sl@0: sl@0: This function should only be called if CVideoPlayerUtility2 is currently being used for display sl@0: of video. sl@0: sl@0: @param aWindow sl@0: The window to be removed sl@0: @leave KErrNotSupported if CVideoPlayerUtility2 is not the current video player utility. sl@0: @see CVideoPlayerUtility2::RemoveDisplayWindow sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::RemoveDisplayWindowL(RWindow& aWindow) sl@0: { sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: if (SupportVideoPlayerUtility2()) sl@0: { sl@0: iVideoPlayer2->RemoveDisplayWindow(aWindow); sl@0: iWindow = NULL; sl@0: return; sl@0: } sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: // Remove compiler warning sl@0: aWindow = aWindow; sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: EXPORT_C void CMVSVideoPlayAgent::RemoveDisplay(TInt aDisplay) sl@0: { sl@0: if (!SupportVideoPlayerUtility2()) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: iVideoPlayer2->RemoveDisplay(aDisplay); sl@0: } sl@0: sl@0: /** sl@0: Opens a video clip from a file. sl@0: sl@0: This function opens a video clip from a file,this function searches through a list of all available sl@0: plugins and attempts to use each one until successful or the end of the list is reached. sl@0: sl@0: Once the opening of the video clip is complete, successfully or otherwise, the callback function sl@0: CMVSVideoPlayAgent::MvpuoOpenComplete() is called. sl@0: sl@0: This function leaves if errors are encountered opening the specified video clip file, or in initialising a sl@0: specified/unspecified controller plugin. sl@0: sl@0: This function can leave with one of the specified error codes. sl@0: sl@0: @param aFileName sl@0: The full path name of the file containing the video data. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::OpenFileL(const TDesC& aFileName) sl@0: { sl@0: OpenFileL(aFileName, KNullUid); sl@0: } sl@0: sl@0: EXPORT_C void CMVSVideoPlayAgent::OpenFileL(const TDesC& aFileName, TUid aControllerUid) sl@0: { sl@0: iFileLogger.Write(_L("Opening a File For CMVSVideoPlayAgent ")); sl@0: sl@0: // remembers the file name & the controller Uid used for opening file sl@0: iFileName.Close(); sl@0: iFileName.CreateL(aFileName); sl@0: iControllerUid = aControllerUid; sl@0: sl@0: __ASSERT_DEBUG(iVideoPlayer, User::Leave(KErrNotReady)); sl@0: iVideoPlayer->Close(); sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: __ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady)); sl@0: iVideoPlayer2->Close(); sl@0: sl@0: // First attempt is always to open a file with CVideoPlayerUtility2 if GCE sl@0: // is enabled sl@0: iVideoPlayer2->OpenFileL(aFileName, aControllerUid); sl@0: iCurrentVideoPlayer = iVideoPlayer2; sl@0: #else sl@0: iVideoPlayer->OpenFileL(aFileName, aControllerUid); sl@0: iCurrentVideoPlayer = iVideoPlayer; sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: sl@0: // Now that we have selected the video player, we can issue the request for notification. sl@0: if (iRequestNotify) sl@0: { sl@0: RegisterForNotification(); sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void CMVSVideoPlayAgent::OpenFileL(TMMSource& /*aSource*/) sl@0: { sl@0: } sl@0: sl@0: EXPORT_C void CMVSVideoPlayAgent::OpenDesL(const TDesC8& /*aDescriptor*/) sl@0: { sl@0: } sl@0: sl@0: void CMVSVideoPlayAgent::MvpuoOpenComplete(TInt aError) sl@0: { sl@0: iFileLogger.Write(_L("CMVSVideoPlayAgent:MvpuoOpenComplete")); sl@0: if(aError == KErrNone) sl@0: { sl@0: iState = EVideoOpening; sl@0: iFileLogger.Write(_L("MvpuoOpenComplete:VideoOpening")); sl@0: iObserver.UpdateStateChange(iState, KErrNone); sl@0: sl@0: iCurrentVideoPlayer->Prepare(); sl@0: } sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: else if (iCurrentVideoPlayer == iVideoPlayer2 && aError == KErrNotSupported) sl@0: { sl@0: // if the controller cannot support GS, try use CVideoPlayerUtility instead sl@0: TRAPD(err, iVideoPlayer->OpenFileL(iFileName, iControllerUid)); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: iState = ENotReady; //init failed so from opening to NotReady sl@0: iFileLogger.Write(_L("MvpuoOpenComplete:From Opening to NotReady")); sl@0: iObserver.UpdateStateChange(iState, err); sl@0: } sl@0: sl@0: iCurrentVideoPlayer = iVideoPlayer; sl@0: sl@0: // We are switching to a different controller. Cancel the notification request on one sl@0: // controller and reissue it on the other. sl@0: if (iRequestNotify) sl@0: { sl@0: iVideoPlayer2->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable); sl@0: RegisterForNotification(); sl@0: } sl@0: } sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: else sl@0: { sl@0: iState = ENotReady; //init failed so from opening to NotReady sl@0: iFileLogger.Write(_L("MvpuoOpenComplete:From Opening to NotReady")); sl@0: iObserver.UpdateStateChange(iState, aError); sl@0: } sl@0: } sl@0: sl@0: void CMVSVideoPlayAgent::MvpuoPrepareComplete(TInt aError) sl@0: { sl@0: iFileLogger.Write(_L("CMVSVideoPlayAgent:MvpuoPrepareComplete")); sl@0: if(aError == KErrNone) sl@0: { sl@0: iState = EVideoOpened; sl@0: iFileLogger.Write(_L("MvpuoPrepareComplete:Video Opened")); sl@0: } sl@0: else sl@0: { sl@0: iState = ENotReady; //prepare failed so from preparing to NotReady sl@0: iFileLogger.Write(_L("MvpuoPrepareComplete failed : from preparing to NotReady")) ; sl@0: } sl@0: iObserver.UpdateStateChange(iState, aError); sl@0: } sl@0: sl@0: void CMVSVideoPlayAgent::MvpuoPlayComplete(TInt aError) sl@0: { sl@0: if(aError == KErrNone) sl@0: { sl@0: iState = EVideoOpened; sl@0: iFileLogger.Write(_L("MvpuoPlayComplete:Video Opened")); sl@0: } sl@0: else sl@0: { sl@0: iState = ENotReady; //playcomplete failed so from playcomplete to NotReady sl@0: iFileLogger.Write(_L("MvpuoPlayComplete failed : from playcomplete to NotReady")) ; sl@0: } sl@0: iObserver.UpdateStateChange(iState, aError); sl@0: } sl@0: sl@0: void CMVSVideoPlayAgent::MvpuoFrameReady(class CFbsBitmap&, TInt) sl@0: { sl@0: } sl@0: sl@0: void CMVSVideoPlayAgent::MvpuoEvent(const TMMFEvent& /*aEvent*/) sl@0: { sl@0: } sl@0: sl@0: void CMVSVideoPlayAgent::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData) sl@0: { sl@0: if(aNotificationEventId == KMMFEventCategoryAudioResourceAvailable) sl@0: { sl@0: iObserver.MvsResourceNotification(aNotificationData); sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void CMVSVideoPlayAgent::Prepare() sl@0: { sl@0: iCurrentVideoPlayer->Prepare(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Closes the video clip. sl@0: Updates the state to ENotReady after closing sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::Close() sl@0: { sl@0: iFileLogger.Write(_L("CMVSVideoPlayAgent Closed")); sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: if (SupportVideoPlayerUtility2()) sl@0: { sl@0: // Can't leave at this point, this will just remove the leave scan warning sl@0: TRAP_IGNORE(RemoveDisplayWindowL(*iWindow)); sl@0: iVideoPlayer2->Close(); sl@0: } sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: iVideoPlayer->Close(); sl@0: sl@0: iObserver.UpdateStateChange(ENotReady, KErrNone); sl@0: iCurrentVideoPlayer = NULL; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Begins playback of the initialised video sample at the current volume and priority levels. sl@0: sl@0: When playing of the video sample is complete, successfully or otherwise, the callback function sl@0: CMVSVideoPlayAgent::MvpuoPlayComplete() is called.Updates the current state to EVideoPlaying, sl@0: and once playing is over it updates the state to EVideoOpen. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::Play() sl@0: { sl@0: iCurrentVideoPlayer->Play(); sl@0: sl@0: iState = EVideoPlaying; sl@0: iObserver.UpdateStateChange(iState, KErrNone); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Begins playback of the initialised video sample at the specified start and end points. sl@0: sl@0: When playing of the video sample is complete, successfully or otherwise, the callback function sl@0: CMVSVideoPlayAgent::MvpuoPlayComplete() is called.Updates the current state to EVideoPlaying, sl@0: and once playing is over it updates the state to EVideoOpen. sl@0: sl@0: @param aStartTime sl@0: The point at which to start playback. sl@0: @param aEndTime sl@0: The point at which to terminate playback. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::Play(const TTimeIntervalMicroSeconds& aStartPoint, sl@0: const TTimeIntervalMicroSeconds& aEndPoint) sl@0: { sl@0: iCurrentVideoPlayer->Play(aStartPoint, aEndPoint); sl@0: sl@0: iState = EVideoPlaying; sl@0: iObserver.UpdateStateChange(iState, KErrNone); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Stops playback of the video sample as soon as is possible. sl@0: sl@0: If the video sample is playing, playback is stopped as soon as possible and the callback function sl@0: CMVSVideoPlayAgent::MvpuoPlayComplete() is called. sl@0: sl@0: If playback is already complete, this function has no effect. In addition, under these circumstances sl@0: the callback function CMVSVideoPlayAgent::MvpuoPlayComplete() is not called either. sl@0: sl@0: The position is reset to the beginning of the file. sl@0: sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: Also Updates the state to EVideoStopped sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::Stop() sl@0: { sl@0: TInt err = KErrNotReady; sl@0: if (iCurrentVideoPlayer) sl@0: { sl@0: err = iCurrentVideoPlayer->Stop(); sl@0: } sl@0: sl@0: if (err == KErrNone) sl@0: { sl@0: iState = EVideoStopped; sl@0: iFileLogger.Write(_L("CMVSVideoPlayAgent Stopped")); sl@0: } sl@0: else sl@0: { sl@0: iState = ENotReady; sl@0: } sl@0: iObserver.UpdateStateChange(iState, err); sl@0: sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Video playback is paused. The current position is maintained and playback can be sl@0: resumed by calling Play. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::PauseL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: TRAPD(err, iCurrentVideoPlayer->PauseL()); sl@0: if(err == KErrNone) sl@0: { sl@0: iState = EVideoPaused; sl@0: iFileLogger.Write(_L("CMVSVideoPlayAgent Paused ")); sl@0: } sl@0: else sl@0: { sl@0: iState = ENotReady; sl@0: iFileLogger.Write(_L("CMVSVideoPlayAgent Not Ready")); sl@0: } sl@0: iObserver.UpdateStateChange(iState, err); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Sends custom command to the plugin controller. sl@0: Passes handle and size of the drawable window. sl@0: sl@0: Sets the display window. This is used to provide the video controller with an area of sl@0: the display to render the current video frame. sl@0: sl@0: @param aWs sl@0: The window server session ID. sl@0: @param aScreenDevice sl@0: The software device screen. sl@0: @param aWindowRect sl@0: The window to display. sl@0: @param aScreenRect sl@0: The dimensions of the display window. sl@0: @param aClipRect sl@0: The area of the video clip to display in the window. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetDisplayWindowL(RWsSession &aWs, CWsScreenDevice &aScreenDevice, RWindow &aWindow, const TRect &aWindowRect, const TRect &aClipRect) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("SettingDisplayWindow")); sl@0: iCurrentVideoPlayer->SetDisplayWindowL(aWs, aScreenDevice, aWindow, aWindowRect, aClipRect); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Sets the video frame rate. sl@0: sl@0: @param aFramesPerSecond sl@0: The number of frames per second to request. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetVideoFrameRateL(TReal32 aFramesPerSecond) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("SettingVedioFrameRate ")); sl@0: iCurrentVideoPlayer->SetVideoFrameRateL(aFramesPerSecond); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Sets the playback volume for the audio track of the video clip. sl@0: sl@0: The volume can be changed before or during playback and is effective immediately. The volume can sl@0: be set to any value between zero (mute) and the maximum permissible volume sl@0: (determined using MaxVolume()). sl@0: sl@0: To determine if the current video clip contains an audio track, use AudioEnabledL(). sl@0: sl@0: sl@0: @param aVolume sl@0: The volume, between 0 and MaxVolume(). sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetVolumeL(TInt aVolume) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Setting CMVSVideoPlayAgent's Volume ")); sl@0: iCurrentVideoPlayer->SetVolumeL(aVolume); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Sets the current playback balance for the audio track of the video clip. sl@0: sl@0: The balance can be any value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight, sl@0: the default value being KMMFBalanceCenter. sl@0: sl@0: @param aBalance sl@0: The balance value to set. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetBalanceL(TInt aBalance) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Setting CMVSVideoPlayAgent's Balance")); sl@0: iCurrentVideoPlayer->SetBalanceL(aBalance); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Sets the playback priority. sl@0: sl@0: This is used to arbitrate between multiple objects simultaneously trying to accesses sl@0: the sound hardware. sl@0: sl@0: @param aPriority sl@0: The priority level to apply, EMdaPriorityMin client can be interrupted by any other sl@0: client, EMdaPriorityNormal client can only be interrupted by a client with a higher sl@0: priority or EMdaPriorityMax client cannot be interrupted by other clients. sl@0: @param aPref sl@0: The time and quality preferences to apply, enumerated in TMdaPriorityPreference. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetPriorityL(TInt aPriority, TMdaPriorityPreference aPref) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Setting Priority of CMVSVideoPlayAgent")); sl@0: iCurrentVideoPlayer->SetPriorityL(aPriority, aPref); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Sets the position within the video clip from where to start playback. sl@0: sl@0: @param aPosition sl@0: Position from start of clip in microseconds. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetPositionL(const TTimeIntervalMicroSeconds &aPosition) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Setting Position of CMVSVideoPlayAgent")); sl@0: iCurrentVideoPlayer->SetPositionL(aPosition); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Rotates the video image on the screen. sl@0: sl@0: @param aRotation sl@0: The desired rotation to apply in 90 degree increments. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetRotationL(TVideoRotation aRotation) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Setting Rotations of CMVSVideoPlayAgent")); sl@0: iCurrentVideoPlayer->SetRotationL(aRotation); sl@0: } sl@0: sl@0: sl@0: sl@0: /** sl@0: Scales the video image to a specified percentage of its original size. sl@0: sl@0: @param aWidthPercentage sl@0: The percentage (100 = original size) to be used to scale the width of the video image sl@0: @param aHeightPercentage sl@0: The percentage (100 = original size) to be used to scale the height of the video image. sl@0: If this is not equal to aWidthPercentage then the image may be distorted. sl@0: @param aAntiAliasFiltering sl@0: A boolean specifying if anti-aliasing should be used. True if anti-aliasing filtering sl@0: should be used. If the plugin does not support this kind of processing, sl@0: this value will be ignored. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Setting ScaleFactor of CMVSVideoPlayAgent")); sl@0: iCurrentVideoPlayer->SetScaleFactorL(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Selects a region of the video image to be displayed. sl@0: sl@0: @param aCropRegion sl@0: The dimensions of the crop region, relative to the video image. sl@0: @see GetCropRegionL sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::SetCropRegionL(const TRect& aCropRegion) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Setting CorpRegion of CMVSVideoPlayAgent")); sl@0: iCurrentVideoPlayer->SetCropRegionL(aCropRegion); sl@0: } sl@0: sl@0: /** sl@0: Selects the video extent on the screen, relative to the window. sl@0: sl@0: @param aVideoExtent sl@0: The new video extent, relative to the window sl@0: @leave KErrNotSupport if CVideoPlayerUtility is used for video playback sl@0: */ sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: EXPORT_C void CMVSVideoPlayAgent::SetVideoExtentL(const TRect& aVideoExtent) sl@0: #else sl@0: EXPORT_C void CMVSVideoPlayAgent::SetVideoExtentL(const TRect& /* aVideoExtent */) sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: { sl@0: iFileLogger.Write(_L("Setting VideoExtent of CMVSVideoPlayAgent")); sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: if(SupportVideoPlayerUtility2()) sl@0: { sl@0: if (iWindow) sl@0: { sl@0: iVideoPlayer2->SetVideoExtentL(*iWindow, aVideoExtent); sl@0: } sl@0: else sl@0: { sl@0: iFileLogger.Write(_L("WARNING - Display Window has not been set. Caller should save these values to be set again later.")); sl@0: } sl@0: return; sl@0: } sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: Selects the window clipping rectangle, relative to the window sl@0: sl@0: @param aWindowClipRect sl@0: The new window clipping rectangle, relative to the window sl@0: @leave KErrNotSupport if CVideoPlayerUtility is used for video playback sl@0: */ sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: EXPORT_C void CMVSVideoPlayAgent::SetWindowClipRectL(const TRect& aWindowClipRect) sl@0: #else sl@0: EXPORT_C void CMVSVideoPlayAgent::SetWindowClipRectL(const TRect& /* aWindowClipRect */) sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: { sl@0: iFileLogger.Write(_L("Setting WindowClippingRect of CMVSVideoPlayAgent")); sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: if (SupportVideoPlayerUtility2()) sl@0: { sl@0: if (iWindow) sl@0: { sl@0: iVideoPlayer2->SetWindowClipRectL(*iWindow, aWindowClipRect); sl@0: } sl@0: else sl@0: { sl@0: iFileLogger.Write(_L("WARNING - Display Window has not been set. Caller should save these values to be set again later.")); sl@0: } sl@0: return; sl@0: } sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Gets the current frame. The current frame is requested, and will be sent to sl@0: the client asynchrynously. sl@0: sl@0: @param aDisplayMode sl@0: The display mode for the retrieved frame. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::GetFrameL(TDisplayMode aDisplayMode) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: iCurrentVideoPlayer->GetFrameL(aDisplayMode); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Gets the current frame. The current frame is requested, and will be sent to sl@0: the client asynchrynously. sl@0: sl@0: @param aDisplayMode sl@0: The display mode for the retrieved frame. sl@0: @param aIntent sl@0: The DRM Intent to pass to the controller. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: iCurrentVideoPlayer->GetFrameL(aDisplayMode, aIntent); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the video frame rate in frames/second. sl@0: sl@0: @return The video frame rate (frames/second). sl@0: */ sl@0: EXPORT_C TReal32 CMVSVideoPlayAgent::VideoFrameRateL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Getting VideoFrameRate for CMVSVideoPlayAgent")); sl@0: return iCurrentVideoPlayer->VideoFrameRateL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Gets the video frame size. sl@0: sl@0: @param aSize sl@0: The video frame size sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::VideoFrameSizeL(TSize &aSize) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Getting VideoFrameFrameSize for CMVSVideoPlayAgent")); sl@0: iCurrentVideoPlayer->VideoFrameSizeL(aSize); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the video format's MIME type. sl@0: sl@0: @return The video clip's MIME type. sl@0: */ sl@0: EXPORT_C const TDesC8& CMVSVideoPlayAgent::VideoFormatMimeType() sl@0: { sl@0: if (iCurrentVideoPlayer) sl@0: { sl@0: return iCurrentVideoPlayer->VideoFormatMimeType(); sl@0: } sl@0: else sl@0: { sl@0: return KNullDesC8; sl@0: } sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the video bit rate. sl@0: sl@0: @return The video bit rate in bits/second. sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::VideoBitRateL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Getting VideoBitRate for CMVSVideoPlayAgent")); sl@0: return iCurrentVideoPlayer->VideoBitRateL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the audio bit rate in bits/second. sl@0: sl@0: @return The audio bit rate (bits/second). sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::AudioBitRateL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Getting AudioBitRate for CMVSVideoPlayAgent")); sl@0: return iCurrentVideoPlayer->AudioBitRateL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the codec used for the audio component of the video clip. sl@0: sl@0: @return The four character code representing the audio codec. sl@0: */ sl@0: EXPORT_C TFourCC CMVSVideoPlayAgent::AudioTypeL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Getting AudioType for CMVSVideoPlayAgent")); sl@0: return iCurrentVideoPlayer->AudioTypeL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns whether the current clip has an audio stream. sl@0: sl@0: @return Boolean indication the presence of an audio stream. ETrue if an audio track is present, sl@0: otherwise EFalse. sl@0: */ sl@0: EXPORT_C TBool CMVSVideoPlayAgent::AudioEnabledL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("CMVSVideoPlayAgent's Audio Enabled")); sl@0: return iCurrentVideoPlayer->AudioEnabledL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the current playback position. sl@0: sl@0: @return The current position from the start of the clip in microseconds. sl@0: */ sl@0: EXPORT_C TTimeIntervalMicroSeconds CMVSVideoPlayAgent::PositionL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: return iCurrentVideoPlayer->PositionL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the duration of video clip in mircoseconds. sl@0: sl@0: @return The duration of clip in microseconds. sl@0: */ sl@0: EXPORT_C TTimeIntervalMicroSeconds CMVSVideoPlayAgent::DurationL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: return iCurrentVideoPlayer->DurationL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the current playback volume for the audio track of the video clip. sl@0: sl@0: @return A value between 0 (mute) and the maximum volume returned by MaxVolume(). sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::Volume() sl@0: { sl@0: return iCurrentVideoPlayer->Volume(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Get the current playback priority. This is used to arbitrate between simultaneous accesses of sl@0: the sound hardware. sl@0: sl@0: @param aPriority sl@0: On return, contains the priority level, EMdaPriorityMin client can be interrupted by any sl@0: other client, EMdaPriorityNormal client can only be interrupted by a client with a higher sl@0: priority or EMdaPriorityMax client cannot be interrupted by other clients. sl@0: @param aPref sl@0: On return, contains the time and quality preferences, enumerated in TMdaPriorityPreference. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::PriorityL(TInt &aPriority, TMdaPriorityPreference &aPref) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: iCurrentVideoPlayer->PriorityL(aPriority, aPref); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the current balance setting for the audio track of the video clip. sl@0: sl@0: @return A balance value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight. sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::Balance() sl@0: { sl@0: return iCurrentVideoPlayer->Balance(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Query the rotation that is currently applied to the video image. sl@0: sl@0: @return The applied rotation sl@0: sl@0: @see SetRotationL sl@0: */ sl@0: EXPORT_C TVideoRotation CMVSVideoPlayAgent::RotationL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: return iCurrentVideoPlayer->RotationL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Gets the scale factor currently applied to the video image. sl@0: sl@0: @param aWidthPercentage sl@0: On function return, contains the current scaling percentage applied to the width of the sl@0: video image (100 = original size). sl@0: @param aHeightPercentage sl@0: On function return, contains the current scaling percentage applied to the height of the sl@0: of the video image (100 = original size). sl@0: @param aAntiAliasFiltering sl@0: The boolean specifying if anit-aliasing is being used. sl@0: @see SetScaleFactorL sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::GetScaleFactorL(TReal32 &aWidthPercentage, TReal32 &aHeightPercentage, TBool &aAntiAliasFiltering) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: iCurrentVideoPlayer->GetScaleFactorL(aWidthPercentage, sl@0: aHeightPercentage, sl@0: aAntiAliasFiltering); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Gets the crop region currently applied to the image. sl@0: sl@0: @param aCropRegion sl@0: The dimensions of the crop region, relative to the video image. If no sl@0: crop region has been applied, the full dimensions of the video image will sl@0: be returned. sl@0: sl@0: @see SetCropRegionL sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::GetCropRegionL(TRect &aCropRegion) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: iCurrentVideoPlayer->GetCropRegionL(aCropRegion); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the number of meta data entries associated with this clip. sl@0: sl@0: @return The number of meta data entries. sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::NumberOfMetaDataEntriesL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: return iCurrentVideoPlayer->NumberOfMetaDataEntriesL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns an array containing the MetaDataEntry for the given audio clip sl@0: sl@0: @param aMetaData sl@0: The meta data Array sl@0: sl@0: @leave Leaves with KErrNotFound if the meta data entry does not exist or sl@0: KErrNotSupported if the controller does not support meta data sl@0: information for this format. Other errors indicate more general system sl@0: failure. sl@0: */ sl@0: EXPORT_C void CMVSVideoPlayAgent::GetMetaDataArrayL(RPointerArray& aMetaData) sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: //Reset the meta array sl@0: aMetaData.Reset(); sl@0: TInt entries = NumberOfMetaDataEntriesL(); sl@0: sl@0: CMMFMetaDataEntry* entry = NULL; sl@0: for(TInt index= 0; index < entries; ++index) sl@0: { sl@0: entry = iCurrentVideoPlayer->MetaDataEntryL(index); sl@0: aMetaData.Append(entry); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: Returns the controller implementation information associated with the current controller. sl@0: sl@0: @return The controller implementation structure sl@0: */ sl@0: EXPORT_C const CMMFControllerImplementationInformation& CMVSVideoPlayAgent::ControllerImplementationInformationL() sl@0: { sl@0: __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady)); sl@0: sl@0: iFileLogger.Write(_L("Getting the ControllerImplementationInformation of CMVSVideoPlayAgent")) ; sl@0: return iCurrentVideoPlayer->ControllerImplementationInformationL(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Returns the current state of the CMVSAudioPlayAgent. sl@0: sl@0: @return The current state, iState. sl@0: */ sl@0: EXPORT_C TMVSState CMVSVideoPlayAgent::GetState() sl@0: { sl@0: return iState; sl@0: } sl@0: sl@0: /** sl@0: Sets the specified output screen to render the video. sl@0: sl@0: @return KErrNone,on success else any of the system wide error code. sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::SetScreenNumber(TInt aScreenNumber) sl@0: { sl@0: TInt err = KErrNone; sl@0: sl@0: if (!iCurrentVideoPlayer) sl@0: { sl@0: err = iVideoPlayer->SetInitScreenNumber(aScreenNumber); sl@0: } sl@0: else sl@0: { sl@0: err = iCurrentVideoPlayer->SetInitScreenNumber(aScreenNumber); sl@0: } sl@0: sl@0: if (err == KErrNone) sl@0: { sl@0: iScreenNumber = aScreenNumber; sl@0: } sl@0: sl@0: return err; sl@0: } sl@0: sl@0: /** sl@0: Registers for audio resource notification. sl@0: sl@0: @return KErrNone,on success else any of the system wide error code. sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::RegisterForNotification() sl@0: { sl@0: if (!iCurrentVideoPlayer) sl@0: { sl@0: // Set the request notify flag. When we select which video player we are using we sl@0: // will issue the request for notification. sl@0: iRequestNotify = ETrue; sl@0: return KErrNone; sl@0: } sl@0: sl@0: return iCurrentVideoPlayer->RegisterAudioResourceNotification(*this, KMMFEventCategoryAudioResourceAvailable); sl@0: } sl@0: sl@0: /** sl@0: Cancels any existing registeration to audio resource notification. sl@0: sl@0: @return KErrNone,on success else any of the system wide error code. sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::CancelNotification() sl@0: { sl@0: if (!iCurrentVideoPlayer) sl@0: { sl@0: iRequestNotify = EFalse; sl@0: return KErrNone; sl@0: } sl@0: sl@0: return iCurrentVideoPlayer->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable); sl@0: } sl@0: sl@0: EXPORT_C TInt CMVSVideoPlayAgent::WillResumePlay() sl@0: { sl@0: if (!iCurrentVideoPlayer) sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: return iCurrentVideoPlayer->WillResumePlay(); sl@0: } sl@0: sl@0: /** sl@0: Returns an integer representing the maximum volume that the audio track can support. sl@0: sl@0: This is the maximum value that can be passed to SetVolumeL(). This value is platform sl@0: independent, but is always greater than or equal to one. sl@0: sl@0: @return The maximum playback volume. sl@0: */ sl@0: EXPORT_C TInt CMVSVideoPlayAgent::MaxVolume() sl@0: { sl@0: if (!iCurrentVideoPlayer) sl@0: { sl@0: return iVideoPlayer->MaxVolume(); sl@0: } sl@0: sl@0: return iCurrentVideoPlayer->MaxVolume(); sl@0: } sl@0: sl@0: #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: EXPORT_C void CMVSVideoPlayAgent::EnableSubtitlesL() sl@0: { sl@0: __ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady)); sl@0: sl@0: if (iWindow) sl@0: { sl@0: iVideoPlayer2->EnableSubtitlesL(); sl@0: } sl@0: else sl@0: { sl@0: iEnableSubtitlesOnAdd = ETrue; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void CMVSVideoPlayAgent::DisableSubtitlesL() sl@0: { sl@0: __ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady)); sl@0: iVideoPlayer2->DisableSubtitles(); sl@0: iEnableSubtitlesOnAdd = EFalse; sl@0: } sl@0: sl@0: EXPORT_C TBool CMVSVideoPlayAgent::SubtitlesAvailable() sl@0: { sl@0: if (iVideoPlayer2) sl@0: { sl@0: return iVideoPlayer2->SubtitlesAvailable(); sl@0: } sl@0: sl@0: return EFalse; sl@0: } sl@0: sl@0: EXPORT_C void CMVSVideoPlayAgent::RenderSubtitle(const TRect& aRect) sl@0: { sl@0: if (iVideoPlayer2) sl@0: { sl@0: iVideoPlayer2->RedrawSubtitle(*iWindow, aRect); sl@0: } sl@0: } sl@0: sl@0: #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT