os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteagents/src/videoplayagent.cpp
Update contrib.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Part of the MVS Agents for TechView
17 #ifdef SYMBIAN_BUILD_GCE
18 #include <videoplayer2.h>
19 #include <surfaceeventhandler.h>
22 #include "videoplayagent.h"
25 Constructs and initialises a new instance of the MVS video play agent
27 This function leaves if the video play agent object cannot be created.
30 A client class to receive notifications from the video player.
32 @return A pointer to the new video play agent object.
34 EXPORT_C CMVSVideoPlayAgent* CMVSVideoPlayAgent::NewL(MMVSClientObserver& aObserver)
36 CMVSVideoPlayAgent* self = new(ELeave) CMVSVideoPlayAgent(aObserver);
37 CleanupStack::PushL(self);
39 CleanupStack::Pop(self);
43 void CMVSVideoPlayAgent::ConstructL()
45 User::LeaveIfError(iFileLogger.Connect());
46 iFileLogger.CreateLog(_L("LogMVSappUi"),_L("LogFile.txt"),EFileLoggingModeAppend);
51 Destructor. Closes any open video clips and frees any resources held by the Video Player.
53 EXPORT_C CMVSVideoPlayAgent::~CMVSVideoPlayAgent()
55 #ifdef SYMBIAN_BUILD_GCE
58 #endif // SYMBIAN_BUILD_GCE
63 if(iFileLogger.Handle())
65 iFileLogger.CloseLog();
73 CMVSVideoPlayAgent::CMVSVideoPlayAgent(MMVSClientObserver& aObserver)
74 : iObserver(aObserver),
75 iControllerUid(KNullUid)
80 Check if CVideoPlayerUtility2 is used for current video playback.
82 @return ETrue if CVideoPlayerUtility2 is used for video playback. EFalse if
83 CVideoPlayerUtility is used.
85 EXPORT_C TBool CMVSVideoPlayAgent::SupportVideoPlayerUtility2() const
87 if (iCurrentVideoPlayer == NULL)
92 if (iCurrentVideoPlayer == iVideoPlayer)
101 Set the auto scale on the current video player for the specified window.
103 @see CVideoPlayerUtility
105 #ifdef SYMBIAN_BUILD_GCE
106 EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(RWindow& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
108 iVideoPlayer2->SetAutoScaleL(aWindow, aScaleType, aHorizPos, aVertPos);
110 EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(RWindow& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
112 User::Leave(KErrNotSupported);
117 Set the auto scale on the current video player.
119 @see CVideoPlayerUtility
121 EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
123 #ifdef SYMBIAN_BUILD_GCE
124 iCurrentVideoPlayer->SetAutoScaleL(aScaleType, aHorizPos, aVertPos);
127 aScaleType = aScaleType;
128 aHorizPos = aHorizPos;
130 User::Leave(KErrNotSupported);
135 Video output settings, pre initialisation of all the required settings to play a
138 This function leaves if the video player utility object cannot be created.
141 A client class to receive notifications from the video player.
143 This client's relative priority. This is a value between EMdaPriorityMin and
144 EMdaPriorityMax and represents a relative priority. A higher value indicates
145 a more important request.
147 The required behaviour if a higher priority client takes over the sound output device.
148 One of the values defined by TMdaPriorityPreference.
150 The window server session id.
152 The software device screen.
156 The dimensions of the display window.
158 The area of the video clip to display in the window.
160 EXPORT_C void CMVSVideoPlayAgent::SetVideoOutputL(RWsSession& aWs,
161 CWsScreenDevice& aScreenDevice,
166 iFileLogger.Write(_L("SettingVideoOutput"));
168 #ifdef SYMBIAN_BUILD_GCE
169 // if CVideoPlayerUtility2 is available, instantiate both CVideoPlayerUtility2 &
170 // CVideoPlayerUtility, as it is not clear whether the controller used for a
171 // particular media file also supports the CVideoPlayerUtility2 API until OpenFileL
175 delete iVideoPlayer2;
176 iVideoPlayer2 = NULL;
179 iVideoPlayer2 = CVideoPlayerUtility2::NewL(*this,
181 EMdaPriorityPreferenceNone);
182 #endif // SYMBIAN_BUILD_GCE
189 iVideoPlayer = CVideoPlayerUtility::NewL(*this,
191 EMdaPriorityPreferenceNone,
200 Adds a new window for displaying the video picture. This is only applicable if
201 CVideoPlayerUtility2 is used.
203 This function leaves if the video player utility object failed to add display window or
204 if this function is called when CVideoPlayerUtility2 is not being used.
207 A client class to receive notifications from the video player.
209 This client's relative priority. This is a value between EMdaPriorityMin and
210 EMdaPriorityMax and represents a relative priority. A higher value indicates
211 a more important request.
213 The required behaviour if a higher priority client takes over the sound output device.
214 One of the values defined by TMdaPriorityPreference.
216 The window server session id.
218 The software device screen.
222 The dimensions of the display window.
224 The area of the video clip to display in the window.
225 @leave KErrNotSupported if CVideoPlayerUtility2 is not the current video utility in use
226 @see CVideoPlayerUtility2::AddDisplayWindowL
228 #ifdef SYMBIAN_BUILD_GCE
229 EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& aWs,
230 CWsScreenDevice& aScreenDevice,
232 const TRect& aScreenRect,
233 const TRect& aClipRect)
235 EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& /* aWs */,
236 CWsScreenDevice& /* aScreenDevice */,
237 RWindow& /* aWindow */,
238 const TRect& /* aScreenRect */,
239 const TRect& /* aClipRect */)
240 #endif // SYMBIAN_BUILD_GCE
242 #ifdef SYMBIAN_BUILD_GCE
243 if (SupportVideoPlayerUtility2())
245 iVideoPlayer2->AddDisplayWindowL(aWs,
252 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
253 if (iEnableSubtitlesOnAdd)
255 iVideoPlayer2->EnableSubtitlesL();
256 iEnableSubtitlesOnAdd = EFalse;
258 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
262 #endif // SYMBIAN_BUILD_GCE
263 User::Leave(KErrNotSupported);
266 #ifdef SYMBIAN_BUILD_GCE
267 EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& aWs,
268 CWsScreenDevice& aScreenDevice,
271 EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& /* aWs */,
272 CWsScreenDevice& /* aScreenDevice */,
273 RWindow& /* aWindow */)
274 #endif // SYMBIAN_BUILD_GCE
276 #ifdef SYMBIAN_BUILD_GCE
277 if (SupportVideoPlayerUtility2())
279 iVideoPlayer2->AddDisplayWindowL(aWs,
284 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
285 if (iEnableSubtitlesOnAdd)
287 iVideoPlayer2->EnableSubtitlesL();
288 iEnableSubtitlesOnAdd = EFalse;
290 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
293 #endif // SYMBIAN_BUILD_GCE
294 User::Leave(KErrNotSupported);
297 EXPORT_C void CMVSVideoPlayAgent::AddDisplayL(RWsSession& aWs, TInt aDisplay, MMMFSurfaceEventHandler& aEventHandler)
299 if (!SupportVideoPlayerUtility2())
301 User::Leave(KErrNotSupported);
304 iVideoPlayer2->AddDisplayL(aWs, aDisplay, aEventHandler);
308 Removes a window that is currently being used to display the video picture.
310 This function should only be called if CVideoPlayerUtility2 is currently being used for display
314 The window to be removed
315 @leave KErrNotSupported if CVideoPlayerUtility2 is not the current video player utility.
316 @see CVideoPlayerUtility2::RemoveDisplayWindow
318 EXPORT_C void CMVSVideoPlayAgent::RemoveDisplayWindowL(RWindow& aWindow)
320 #ifdef SYMBIAN_BUILD_GCE
321 if (SupportVideoPlayerUtility2())
323 iVideoPlayer2->RemoveDisplayWindow(aWindow);
327 #endif // SYMBIAN_BUILD_GCE
328 // Remove compiler warning
330 User::Leave(KErrNotSupported);
333 EXPORT_C void CMVSVideoPlayAgent::RemoveDisplay(TInt aDisplay)
335 if (!SupportVideoPlayerUtility2())
337 User::Leave(KErrNotSupported);
340 iVideoPlayer2->RemoveDisplay(aDisplay);
344 Opens a video clip from a file.
346 This function opens a video clip from a file,this function searches through a list of all available
347 plugins and attempts to use each one until successful or the end of the list is reached.
349 Once the opening of the video clip is complete, successfully or otherwise, the callback function
350 CMVSVideoPlayAgent::MvpuoOpenComplete() is called.
352 This function leaves if errors are encountered opening the specified video clip file, or in initialising a
353 specified/unspecified controller plugin.
355 This function can leave with one of the specified error codes.
358 The full path name of the file containing the video data.
360 EXPORT_C void CMVSVideoPlayAgent::OpenFileL(const TDesC& aFileName)
362 OpenFileL(aFileName, KNullUid);
365 EXPORT_C void CMVSVideoPlayAgent::OpenFileL(const TDesC& aFileName, TUid aControllerUid)
367 iFileLogger.Write(_L("Opening a File For CMVSVideoPlayAgent "));
369 // remembers the file name & the controller Uid used for opening file
371 iFileName.CreateL(aFileName);
372 iControllerUid = aControllerUid;
374 __ASSERT_DEBUG(iVideoPlayer, User::Leave(KErrNotReady));
375 iVideoPlayer->Close();
377 #ifdef SYMBIAN_BUILD_GCE
378 __ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady));
379 iVideoPlayer2->Close();
381 // First attempt is always to open a file with CVideoPlayerUtility2 if GCE
383 iVideoPlayer2->OpenFileL(aFileName, aControllerUid);
384 iCurrentVideoPlayer = iVideoPlayer2;
386 iVideoPlayer->OpenFileL(aFileName, aControllerUid);
387 iCurrentVideoPlayer = iVideoPlayer;
388 #endif // SYMBIAN_BUILD_GCE
390 // Now that we have selected the video player, we can issue the request for notification.
393 RegisterForNotification();
397 EXPORT_C void CMVSVideoPlayAgent::OpenFileL(TMMSource& /*aSource*/)
401 EXPORT_C void CMVSVideoPlayAgent::OpenDesL(const TDesC8& /*aDescriptor*/)
405 void CMVSVideoPlayAgent::MvpuoOpenComplete(TInt aError)
407 iFileLogger.Write(_L("CMVSVideoPlayAgent:MvpuoOpenComplete"));
408 if(aError == KErrNone)
410 iState = EVideoOpening;
411 iFileLogger.Write(_L("MvpuoOpenComplete:VideoOpening"));
412 iObserver.UpdateStateChange(iState, KErrNone);
414 iCurrentVideoPlayer->Prepare();
416 #ifdef SYMBIAN_BUILD_GCE
417 else if (iCurrentVideoPlayer == iVideoPlayer2 && aError == KErrNotSupported)
419 // if the controller cannot support GS, try use CVideoPlayerUtility instead
420 TRAPD(err, iVideoPlayer->OpenFileL(iFileName, iControllerUid));
424 iState = ENotReady; //init failed so from opening to NotReady
425 iFileLogger.Write(_L("MvpuoOpenComplete:From Opening to NotReady"));
426 iObserver.UpdateStateChange(iState, err);
429 iCurrentVideoPlayer = iVideoPlayer;
431 // We are switching to a different controller. Cancel the notification request on one
432 // controller and reissue it on the other.
435 iVideoPlayer2->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
436 RegisterForNotification();
439 #endif // SYMBIAN_BUILD_GCE
442 iState = ENotReady; //init failed so from opening to NotReady
443 iFileLogger.Write(_L("MvpuoOpenComplete:From Opening to NotReady"));
444 iObserver.UpdateStateChange(iState, aError);
448 void CMVSVideoPlayAgent::MvpuoPrepareComplete(TInt aError)
450 iFileLogger.Write(_L("CMVSVideoPlayAgent:MvpuoPrepareComplete"));
451 if(aError == KErrNone)
453 iState = EVideoOpened;
454 iFileLogger.Write(_L("MvpuoPrepareComplete:Video Opened"));
458 iState = ENotReady; //prepare failed so from preparing to NotReady
459 iFileLogger.Write(_L("MvpuoPrepareComplete failed : from preparing to NotReady")) ;
461 iObserver.UpdateStateChange(iState, aError);
464 void CMVSVideoPlayAgent::MvpuoPlayComplete(TInt aError)
466 if(aError == KErrNone)
468 iState = EVideoOpened;
469 iFileLogger.Write(_L("MvpuoPlayComplete:Video Opened"));
473 iState = ENotReady; //playcomplete failed so from playcomplete to NotReady
474 iFileLogger.Write(_L("MvpuoPlayComplete failed : from playcomplete to NotReady")) ;
476 iObserver.UpdateStateChange(iState, aError);
479 void CMVSVideoPlayAgent::MvpuoFrameReady(class CFbsBitmap&, TInt)
483 void CMVSVideoPlayAgent::MvpuoEvent(const TMMFEvent& /*aEvent*/)
487 void CMVSVideoPlayAgent::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData)
489 if(aNotificationEventId == KMMFEventCategoryAudioResourceAvailable)
491 iObserver.MvsResourceNotification(aNotificationData);
495 EXPORT_C void CMVSVideoPlayAgent::Prepare()
497 iCurrentVideoPlayer->Prepare();
502 Closes the video clip.
503 Updates the state to ENotReady after closing
505 EXPORT_C void CMVSVideoPlayAgent::Close()
507 iFileLogger.Write(_L("CMVSVideoPlayAgent Closed"));
509 #ifdef SYMBIAN_BUILD_GCE
510 if (SupportVideoPlayerUtility2())
512 // Can't leave at this point, this will just remove the leave scan warning
513 TRAP_IGNORE(RemoveDisplayWindowL(*iWindow));
514 iVideoPlayer2->Close();
516 #endif // SYMBIAN_BUILD_GCE
517 iVideoPlayer->Close();
519 iObserver.UpdateStateChange(ENotReady, KErrNone);
520 iCurrentVideoPlayer = NULL;
525 Begins playback of the initialised video sample at the current volume and priority levels.
527 When playing of the video sample is complete, successfully or otherwise, the callback function
528 CMVSVideoPlayAgent::MvpuoPlayComplete() is called.Updates the current state to EVideoPlaying,
529 and once playing is over it updates the state to EVideoOpen.
531 EXPORT_C void CMVSVideoPlayAgent::Play()
533 iCurrentVideoPlayer->Play();
535 iState = EVideoPlaying;
536 iObserver.UpdateStateChange(iState, KErrNone);
541 Begins playback of the initialised video sample at the specified start and end points.
543 When playing of the video sample is complete, successfully or otherwise, the callback function
544 CMVSVideoPlayAgent::MvpuoPlayComplete() is called.Updates the current state to EVideoPlaying,
545 and once playing is over it updates the state to EVideoOpen.
548 The point at which to start playback.
550 The point at which to terminate playback.
552 EXPORT_C void CMVSVideoPlayAgent::Play(const TTimeIntervalMicroSeconds& aStartPoint,
553 const TTimeIntervalMicroSeconds& aEndPoint)
555 iCurrentVideoPlayer->Play(aStartPoint, aEndPoint);
557 iState = EVideoPlaying;
558 iObserver.UpdateStateChange(iState, KErrNone);
563 Stops playback of the video sample as soon as is possible.
565 If the video sample is playing, playback is stopped as soon as possible and the callback function
566 CMVSVideoPlayAgent::MvpuoPlayComplete() is called.
568 If playback is already complete, this function has no effect. In addition, under these circumstances
569 the callback function CMVSVideoPlayAgent::MvpuoPlayComplete() is not called either.
571 The position is reset to the beginning of the file.
573 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
574 another of the system-wide error codes.
575 Also Updates the state to EVideoStopped
577 EXPORT_C TInt CMVSVideoPlayAgent::Stop()
579 TInt err = KErrNotReady;
580 if (iCurrentVideoPlayer)
582 err = iCurrentVideoPlayer->Stop();
587 iState = EVideoStopped;
588 iFileLogger.Write(_L("CMVSVideoPlayAgent Stopped"));
594 iObserver.UpdateStateChange(iState, err);
601 Video playback is paused. The current position is maintained and playback can be
602 resumed by calling Play.
604 EXPORT_C void CMVSVideoPlayAgent::PauseL()
606 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
608 TRAPD(err, iCurrentVideoPlayer->PauseL());
611 iState = EVideoPaused;
612 iFileLogger.Write(_L("CMVSVideoPlayAgent Paused "));
617 iFileLogger.Write(_L("CMVSVideoPlayAgent Not Ready"));
619 iObserver.UpdateStateChange(iState, err);
624 Sends custom command to the plugin controller.
625 Passes handle and size of the drawable window.
627 Sets the display window. This is used to provide the video controller with an area of
628 the display to render the current video frame.
631 The window server session ID.
633 The software device screen.
635 The window to display.
637 The dimensions of the display window.
639 The area of the video clip to display in the window.
641 EXPORT_C void CMVSVideoPlayAgent::SetDisplayWindowL(RWsSession &aWs, CWsScreenDevice &aScreenDevice, RWindow &aWindow, const TRect &aWindowRect, const TRect &aClipRect)
643 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
645 iFileLogger.Write(_L("SettingDisplayWindow"));
646 iCurrentVideoPlayer->SetDisplayWindowL(aWs, aScreenDevice, aWindow, aWindowRect, aClipRect);
651 Sets the video frame rate.
653 @param aFramesPerSecond
654 The number of frames per second to request.
656 EXPORT_C void CMVSVideoPlayAgent::SetVideoFrameRateL(TReal32 aFramesPerSecond)
658 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
660 iFileLogger.Write(_L("SettingVedioFrameRate "));
661 iCurrentVideoPlayer->SetVideoFrameRateL(aFramesPerSecond);
666 Sets the playback volume for the audio track of the video clip.
668 The volume can be changed before or during playback and is effective immediately. The volume can
669 be set to any value between zero (mute) and the maximum permissible volume
670 (determined using MaxVolume()).
672 To determine if the current video clip contains an audio track, use AudioEnabledL().
676 The volume, between 0 and MaxVolume().
678 EXPORT_C void CMVSVideoPlayAgent::SetVolumeL(TInt aVolume)
680 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
682 iFileLogger.Write(_L("Setting CMVSVideoPlayAgent's Volume "));
683 iCurrentVideoPlayer->SetVolumeL(aVolume);
688 Sets the current playback balance for the audio track of the video clip.
690 The balance can be any value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight,
691 the default value being KMMFBalanceCenter.
694 The balance value to set.
696 EXPORT_C void CMVSVideoPlayAgent::SetBalanceL(TInt aBalance)
698 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
700 iFileLogger.Write(_L("Setting CMVSVideoPlayAgent's Balance"));
701 iCurrentVideoPlayer->SetBalanceL(aBalance);
706 Sets the playback priority.
708 This is used to arbitrate between multiple objects simultaneously trying to accesses
712 The priority level to apply, EMdaPriorityMin client can be interrupted by any other
713 client, EMdaPriorityNormal client can only be interrupted by a client with a higher
714 priority or EMdaPriorityMax client cannot be interrupted by other clients.
716 The time and quality preferences to apply, enumerated in TMdaPriorityPreference.
718 EXPORT_C void CMVSVideoPlayAgent::SetPriorityL(TInt aPriority, TMdaPriorityPreference aPref)
720 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
722 iFileLogger.Write(_L("Setting Priority of CMVSVideoPlayAgent"));
723 iCurrentVideoPlayer->SetPriorityL(aPriority, aPref);
728 Sets the position within the video clip from where to start playback.
731 Position from start of clip in microseconds.
733 EXPORT_C void CMVSVideoPlayAgent::SetPositionL(const TTimeIntervalMicroSeconds &aPosition)
735 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
737 iFileLogger.Write(_L("Setting Position of CMVSVideoPlayAgent"));
738 iCurrentVideoPlayer->SetPositionL(aPosition);
743 Rotates the video image on the screen.
746 The desired rotation to apply in 90 degree increments.
748 EXPORT_C void CMVSVideoPlayAgent::SetRotationL(TVideoRotation aRotation)
750 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
752 iFileLogger.Write(_L("Setting Rotations of CMVSVideoPlayAgent"));
753 iCurrentVideoPlayer->SetRotationL(aRotation);
759 Scales the video image to a specified percentage of its original size.
761 @param aWidthPercentage
762 The percentage (100 = original size) to be used to scale the width of the video image
763 @param aHeightPercentage
764 The percentage (100 = original size) to be used to scale the height of the video image.
765 If this is not equal to aWidthPercentage then the image may be distorted.
766 @param aAntiAliasFiltering
767 A boolean specifying if anti-aliasing should be used. True if anti-aliasing filtering
768 should be used. If the plugin does not support this kind of processing,
769 this value will be ignored.
771 EXPORT_C void CMVSVideoPlayAgent::SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering)
773 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
775 iFileLogger.Write(_L("Setting ScaleFactor of CMVSVideoPlayAgent"));
776 iCurrentVideoPlayer->SetScaleFactorL(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering);
781 Selects a region of the video image to be displayed.
784 The dimensions of the crop region, relative to the video image.
787 EXPORT_C void CMVSVideoPlayAgent::SetCropRegionL(const TRect& aCropRegion)
789 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
791 iFileLogger.Write(_L("Setting CorpRegion of CMVSVideoPlayAgent"));
792 iCurrentVideoPlayer->SetCropRegionL(aCropRegion);
796 Selects the video extent on the screen, relative to the window.
799 The new video extent, relative to the window
800 @leave KErrNotSupport if CVideoPlayerUtility is used for video playback
802 #ifdef SYMBIAN_BUILD_GCE
803 EXPORT_C void CMVSVideoPlayAgent::SetVideoExtentL(const TRect& aVideoExtent)
805 EXPORT_C void CMVSVideoPlayAgent::SetVideoExtentL(const TRect& /* aVideoExtent */)
806 #endif // SYMBIAN_BUILD_GCE
808 iFileLogger.Write(_L("Setting VideoExtent of CMVSVideoPlayAgent"));
810 #ifdef SYMBIAN_BUILD_GCE
811 if(SupportVideoPlayerUtility2())
815 iVideoPlayer2->SetVideoExtentL(*iWindow, aVideoExtent);
819 iFileLogger.Write(_L("WARNING - Display Window has not been set. Caller should save these values to be set again later."));
823 #endif // SYMBIAN_BUILD_GCE
825 User::Leave(KErrNotSupported);
829 Selects the window clipping rectangle, relative to the window
831 @param aWindowClipRect
832 The new window clipping rectangle, relative to the window
833 @leave KErrNotSupport if CVideoPlayerUtility is used for video playback
835 #ifdef SYMBIAN_BUILD_GCE
836 EXPORT_C void CMVSVideoPlayAgent::SetWindowClipRectL(const TRect& aWindowClipRect)
838 EXPORT_C void CMVSVideoPlayAgent::SetWindowClipRectL(const TRect& /* aWindowClipRect */)
839 #endif // SYMBIAN_BUILD_GCE
841 iFileLogger.Write(_L("Setting WindowClippingRect of CMVSVideoPlayAgent"));
843 #ifdef SYMBIAN_BUILD_GCE
844 if (SupportVideoPlayerUtility2())
848 iVideoPlayer2->SetWindowClipRectL(*iWindow, aWindowClipRect);
852 iFileLogger.Write(_L("WARNING - Display Window has not been set. Caller should save these values to be set again later."));
856 #endif // SYMBIAN_BUILD_GCE
858 User::Leave(KErrNotSupported);
863 Gets the current frame. The current frame is requested, and will be sent to
864 the client asynchrynously.
867 The display mode for the retrieved frame.
869 EXPORT_C void CMVSVideoPlayAgent::GetFrameL(TDisplayMode aDisplayMode)
871 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
872 iCurrentVideoPlayer->GetFrameL(aDisplayMode);
877 Gets the current frame. The current frame is requested, and will be sent to
878 the client asynchrynously.
881 The display mode for the retrieved frame.
883 The DRM Intent to pass to the controller.
885 EXPORT_C void CMVSVideoPlayAgent::GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent)
887 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
888 iCurrentVideoPlayer->GetFrameL(aDisplayMode, aIntent);
893 Returns the video frame rate in frames/second.
895 @return The video frame rate (frames/second).
897 EXPORT_C TReal32 CMVSVideoPlayAgent::VideoFrameRateL()
899 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
901 iFileLogger.Write(_L("Getting VideoFrameRate for CMVSVideoPlayAgent"));
902 return iCurrentVideoPlayer->VideoFrameRateL();
907 Gets the video frame size.
912 EXPORT_C void CMVSVideoPlayAgent::VideoFrameSizeL(TSize &aSize)
914 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
916 iFileLogger.Write(_L("Getting VideoFrameFrameSize for CMVSVideoPlayAgent"));
917 iCurrentVideoPlayer->VideoFrameSizeL(aSize);
922 Returns the video format's MIME type.
924 @return The video clip's MIME type.
926 EXPORT_C const TDesC8& CMVSVideoPlayAgent::VideoFormatMimeType()
928 if (iCurrentVideoPlayer)
930 return iCurrentVideoPlayer->VideoFormatMimeType();
940 Returns the video bit rate.
942 @return The video bit rate in bits/second.
944 EXPORT_C TInt CMVSVideoPlayAgent::VideoBitRateL()
946 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
948 iFileLogger.Write(_L("Getting VideoBitRate for CMVSVideoPlayAgent"));
949 return iCurrentVideoPlayer->VideoBitRateL();
954 Returns the audio bit rate in bits/second.
956 @return The audio bit rate (bits/second).
958 EXPORT_C TInt CMVSVideoPlayAgent::AudioBitRateL()
960 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
962 iFileLogger.Write(_L("Getting AudioBitRate for CMVSVideoPlayAgent"));
963 return iCurrentVideoPlayer->AudioBitRateL();
968 Returns the codec used for the audio component of the video clip.
970 @return The four character code representing the audio codec.
972 EXPORT_C TFourCC CMVSVideoPlayAgent::AudioTypeL()
974 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
976 iFileLogger.Write(_L("Getting AudioType for CMVSVideoPlayAgent"));
977 return iCurrentVideoPlayer->AudioTypeL();
982 Returns whether the current clip has an audio stream.
984 @return Boolean indication the presence of an audio stream. ETrue if an audio track is present,
987 EXPORT_C TBool CMVSVideoPlayAgent::AudioEnabledL()
989 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
991 iFileLogger.Write(_L("CMVSVideoPlayAgent's Audio Enabled"));
992 return iCurrentVideoPlayer->AudioEnabledL();
997 Returns the current playback position.
999 @return The current position from the start of the clip in microseconds.
1001 EXPORT_C TTimeIntervalMicroSeconds CMVSVideoPlayAgent::PositionL()
1003 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1004 return iCurrentVideoPlayer->PositionL();
1009 Returns the duration of video clip in mircoseconds.
1011 @return The duration of clip in microseconds.
1013 EXPORT_C TTimeIntervalMicroSeconds CMVSVideoPlayAgent::DurationL()
1015 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1016 return iCurrentVideoPlayer->DurationL();
1021 Returns the current playback volume for the audio track of the video clip.
1023 @return A value between 0 (mute) and the maximum volume returned by MaxVolume().
1025 EXPORT_C TInt CMVSVideoPlayAgent::Volume()
1027 return iCurrentVideoPlayer->Volume();
1032 Get the current playback priority. This is used to arbitrate between simultaneous accesses of
1036 On return, contains the priority level, EMdaPriorityMin client can be interrupted by any
1037 other client, EMdaPriorityNormal client can only be interrupted by a client with a higher
1038 priority or EMdaPriorityMax client cannot be interrupted by other clients.
1040 On return, contains the time and quality preferences, enumerated in TMdaPriorityPreference.
1042 EXPORT_C void CMVSVideoPlayAgent::PriorityL(TInt &aPriority, TMdaPriorityPreference &aPref)
1044 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1045 iCurrentVideoPlayer->PriorityL(aPriority, aPref);
1050 Returns the current balance setting for the audio track of the video clip.
1052 @return A balance value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight.
1054 EXPORT_C TInt CMVSVideoPlayAgent::Balance()
1056 return iCurrentVideoPlayer->Balance();
1061 Query the rotation that is currently applied to the video image.
1063 @return The applied rotation
1067 EXPORT_C TVideoRotation CMVSVideoPlayAgent::RotationL()
1069 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1070 return iCurrentVideoPlayer->RotationL();
1075 Gets the scale factor currently applied to the video image.
1077 @param aWidthPercentage
1078 On function return, contains the current scaling percentage applied to the width of the
1079 video image (100 = original size).
1080 @param aHeightPercentage
1081 On function return, contains the current scaling percentage applied to the height of the
1082 of the video image (100 = original size).
1083 @param aAntiAliasFiltering
1084 The boolean specifying if anit-aliasing is being used.
1085 @see SetScaleFactorL
1087 EXPORT_C void CMVSVideoPlayAgent::GetScaleFactorL(TReal32 &aWidthPercentage, TReal32 &aHeightPercentage, TBool &aAntiAliasFiltering)
1089 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1090 iCurrentVideoPlayer->GetScaleFactorL(aWidthPercentage,
1092 aAntiAliasFiltering);
1097 Gets the crop region currently applied to the image.
1100 The dimensions of the crop region, relative to the video image. If no
1101 crop region has been applied, the full dimensions of the video image will
1106 EXPORT_C void CMVSVideoPlayAgent::GetCropRegionL(TRect &aCropRegion)
1108 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1109 iCurrentVideoPlayer->GetCropRegionL(aCropRegion);
1114 Returns the number of meta data entries associated with this clip.
1116 @return The number of meta data entries.
1118 EXPORT_C TInt CMVSVideoPlayAgent::NumberOfMetaDataEntriesL()
1120 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1121 return iCurrentVideoPlayer->NumberOfMetaDataEntriesL();
1126 Returns an array containing the MetaDataEntry for the given audio clip
1131 @leave Leaves with KErrNotFound if the meta data entry does not exist or
1132 KErrNotSupported if the controller does not support meta data
1133 information for this format. Other errors indicate more general system
1136 EXPORT_C void CMVSVideoPlayAgent::GetMetaDataArrayL(RPointerArray<CMMFMetaDataEntry>& aMetaData)
1138 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1140 //Reset the meta array
1142 TInt entries = NumberOfMetaDataEntriesL();
1144 CMMFMetaDataEntry* entry = NULL;
1145 for(TInt index= 0; index < entries; ++index)
1147 entry = iCurrentVideoPlayer->MetaDataEntryL(index);
1148 aMetaData.Append(entry);
1153 Returns the controller implementation information associated with the current controller.
1155 @return The controller implementation structure
1157 EXPORT_C const CMMFControllerImplementationInformation& CMVSVideoPlayAgent::ControllerImplementationInformationL()
1159 __ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
1161 iFileLogger.Write(_L("Getting the ControllerImplementationInformation of CMVSVideoPlayAgent")) ;
1162 return iCurrentVideoPlayer->ControllerImplementationInformationL();
1167 Returns the current state of the CMVSAudioPlayAgent.
1169 @return The current state, iState.
1171 EXPORT_C TMVSState CMVSVideoPlayAgent::GetState()
1177 Sets the specified output screen to render the video.
1179 @return KErrNone,on success else any of the system wide error code.
1181 EXPORT_C TInt CMVSVideoPlayAgent::SetScreenNumber(TInt aScreenNumber)
1183 TInt err = KErrNone;
1185 if (!iCurrentVideoPlayer)
1187 err = iVideoPlayer->SetInitScreenNumber(aScreenNumber);
1191 err = iCurrentVideoPlayer->SetInitScreenNumber(aScreenNumber);
1194 if (err == KErrNone)
1196 iScreenNumber = aScreenNumber;
1203 Registers for audio resource notification.
1205 @return KErrNone,on success else any of the system wide error code.
1207 EXPORT_C TInt CMVSVideoPlayAgent::RegisterForNotification()
1209 if (!iCurrentVideoPlayer)
1211 // Set the request notify flag. When we select which video player we are using we
1212 // will issue the request for notification.
1213 iRequestNotify = ETrue;
1217 return iCurrentVideoPlayer->RegisterAudioResourceNotification(*this, KMMFEventCategoryAudioResourceAvailable);
1221 Cancels any existing registeration to audio resource notification.
1223 @return KErrNone,on success else any of the system wide error code.
1225 EXPORT_C TInt CMVSVideoPlayAgent::CancelNotification()
1227 if (!iCurrentVideoPlayer)
1229 iRequestNotify = EFalse;
1233 return iCurrentVideoPlayer->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
1236 EXPORT_C TInt CMVSVideoPlayAgent::WillResumePlay()
1238 if (!iCurrentVideoPlayer)
1240 return KErrNotReady;
1242 return iCurrentVideoPlayer->WillResumePlay();
1246 Returns an integer representing the maximum volume that the audio track can support.
1248 This is the maximum value that can be passed to SetVolumeL(). This value is platform
1249 independent, but is always greater than or equal to one.
1251 @return The maximum playback volume.
1253 EXPORT_C TInt CMVSVideoPlayAgent::MaxVolume()
1255 if (!iCurrentVideoPlayer)
1257 return iVideoPlayer->MaxVolume();
1260 return iCurrentVideoPlayer->MaxVolume();
1263 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1264 EXPORT_C void CMVSVideoPlayAgent::EnableSubtitlesL()
1266 __ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady));
1270 iVideoPlayer2->EnableSubtitlesL();
1274 iEnableSubtitlesOnAdd = ETrue;
1278 EXPORT_C void CMVSVideoPlayAgent::DisableSubtitlesL()
1280 __ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady));
1281 iVideoPlayer2->DisableSubtitles();
1282 iEnableSubtitlesOnAdd = EFalse;
1285 EXPORT_C TBool CMVSVideoPlayAgent::SubtitlesAvailable()
1289 return iVideoPlayer2->SubtitlesAvailable();
1295 EXPORT_C void CMVSVideoPlayAgent::RenderSubtitle(const TRect& aRect)
1299 iVideoPlayer2->RedrawSubtitle(*iWindow, aRect);
1303 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT