Update contrib.
1 // Copyright (c) 2002-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.
17 #include <mmf/common/mmfstandardcustomcommands.h>
18 #include <mmf/common/mmfvideo.h>
19 #include <mmf/common/mmfpaniccodes.h>
20 #include <mmf/server/mmfdes.h>
21 #include <mmf/server/mmffile.h>
22 #include <videoplayer.h>
23 #include "mmfvideocallback.h"
24 #include "VideoPlayerBody.h"
25 #include "mmfvideopaniccodes.h"
26 #include "mmfclientvideocommon.h"
29 void Panic(TInt aPanicCode)
31 _LIT(KMMFMediaClientVideoPanicCategory, "MMFVideoClient");
32 User::Panic(KMMFMediaClientVideoPanicCategory, aPanicCode);
36 Constructs and initialises a new instance of the video player utility.
38 This function leaves if the video player utility object cannot be created.
41 A client class to receive notifications from the video player.
43 The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and
44 EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request.
46 The Priority Preference - an additional audio policy parameter. The suggested default is
47 EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional
48 values may be supported by given phones and/or platforms, but should not be depended upon by
51 The window server session id.
53 The software device screen.
57 The dimensions of the display window.
59 The area of the video clip to display in the window.
61 @return A pointer to the new video player utility object.
65 Note: The Priority Value and Priority Preference are used primarily when deciding what to do when
66 several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference,
67 the adaptation may consider other parameters such as the SecureId and Capabilities of the client process.
68 Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may
69 vary between different phones. Portable applications are advised not to assume any specific behaviour.
71 EXPORT_C CVideoPlayerUtility* CVideoPlayerUtility::NewL(MVideoPlayerUtilityObserver& aObserver,
75 CWsScreenDevice& aScreenDevice,
77 const TRect& aScreenRect,
78 const TRect& aClipRect)
80 CVideoPlayerUtility* s = new(ELeave) CVideoPlayerUtility();
81 CleanupStack::PushL(s);
82 s->iBody = CBody::NewL(s, aObserver, aPriority, aPref, aWs, aScreenDevice,
83 aWindow, aScreenRect, aClipRect);
89 Destructor. Closes any open video clips and frees any resources held by the Video Player.
93 CVideoPlayerUtility::~CVideoPlayerUtility()
99 Opens a video clip from a file.
101 This function opens a video clip from a file using an optionally specified plugin. If no controller
102 plugin is specified, this function searches through a list of all available plugins and attempts to
103 use each one until successful or the end of the list is reached.
105 Once the opening of the video clip is complete, successfully or otherwise, the callback function
106 MVideoPlayerUtilityObserver::MvpuoOpenComplete() is called.
108 This function leaves if errors are encountered opening the specified video clip file, or in initialising a
109 specified/unspecified controller plugin.
111 This function can leave with one of the specified error codes. Most open failures
112 will however be reported through the MVideoPlayerUtilityObserver interface.
114 From Symbian release v9.5 onwards, this function will enable graphics surface use if the controller supports it.
115 If this function is called through an instance of the derived class CVideoPlayerUtility2 and the controller doesn't support graphics surfaces,
116 it fails with KErrNotSupported.
119 The full path name of the file containing the video data.
120 @param aControllerUid
121 If specified, it will force the video player to use the
122 controller with the given UID.
126 EXPORT_C void CVideoPlayerUtility::OpenFileL(const TDesC& aFileName, TUid aControllerUid)
128 iBody->OpenFileL(aFileName, aControllerUid);
132 Opens a video clip from a file.
134 This function opens a video clip from a file using an optionally specified plugin. If no controller
135 plugin is specified, this function searches through a list of all available plugins and attempts to
136 use each one until successful or the end of the list is reached.
138 Once the opening of the video clip is complete, successfully or otherwise, the callback function
139 MVideoPlayerUtilityObserver::MvpuoOpenComplete() is called.
141 This function leaves if errors are encountered opening the specified video clip file, or in initialising a
142 specified/unspecified controller plugin.
144 This function can leave with one of the specified error codes. Most open failures
145 will however be reported through the MVideoPlayerUtilityObserver interface.
147 From Symbian release v9.5 onwards, this function will enable graphics surface use if the controller supports it.
148 If this function is called through an instance of the derived class CVideoPlayerUtility2 and the controller doesn't support graphics surfaces,
149 it fails with KErrNotSupported.
152 An open handle to a file containing the video clip
153 @param aControllerUid
154 If specified, it will force the video player to use the
155 controller with the given UID.
159 EXPORT_C void CVideoPlayerUtility::OpenFileL(const RFile& aFile, TUid aControllerUid)
161 iBody->OpenFileL(aFile, aControllerUid);
166 Opens a video clip from a file.
168 This function opens a video clip from a file using an optionally specified plugin. If no controller
169 plugin is specified, this function searches through a list of all available plugins and attempts to
170 use each one until successful or the end of the list is reached.
172 Once the opening of the video clip is complete, successfully or otherwise, the callback function
173 MVideoPlayerUtilityObserver::MvpuoOpenComplete() is called.
175 This function leaves if errors are encountered opening the specified video clip file, or in initialising a
176 specified/unspecified controller plugin.
178 This function can leave with one of the specified error codes. Most open failures
179 will however be reported through the MVideoPlayerUtilityObserver interface.
181 From Symbian release v9.5 onwards, this function will enable graphics surface use if the controller supports it.
182 If this function is called through an instance of the derived class CVideoPlayerUtility2 and the controller doesn't support graphics surfaces,
183 it fails with KErrNotSupported.
186 A filename or an open handle to a file containing the video clip
187 @param aControllerUid
188 If specified, it will force the video player to use the
189 controller with the given UID.
191 EXPORT_C void CVideoPlayerUtility::OpenFileL(const TMMSource& aSource, TUid aControllerUid)
193 iBody->OpenFileL(aSource, aControllerUid);
197 Opens a video clip contained in a descriptor.
199 This function opens a video clip contained as binary data in a descriptor using an optionally specified
200 plugin. If no controller plugin is specified, this function searches through a list of all available
201 plugins and attempts to use each one until successful or the end of the list is reached.
203 Once the opening of the video clip is complete, successfully or otherwise, the callback function
204 MVideoPlayerUtilityObserver::MvpuoOpenComplete() is called.
206 This function can leave with one of the specified error codes. Most open failures will however be
207 reported through the interface.
209 From Symbian release v9.5 onwards, this function will enable graphics surface use if the controller supports it.
210 If this function is called through an instance of the derived class CVideoPlayerUtility2 and the controller doesn't support graphics surfaces,
211 it fails with KErrNotSupported.
214 The descriptor containing the video clip
215 @param aControllerUid
216 If specified, it will force the video player to use the
217 controller with the given UID.
221 EXPORT_C void CVideoPlayerUtility::OpenDesL(const TDesC8& aDescriptor, TUid aControllerUid)
223 iBody->OpenDesL(aDescriptor, aControllerUid);
227 Opens a video clip from a URL.
229 This function opens a video clip stored at a specified URL and identified by a MIME type. In addition
230 a plugin can be specified if necessary. If no controller plugin is specified, this function searches
231 through a list of all available plugins and attempts to use each one until successful or the end
232 of the list is reached.
234 Once the opening of the video clip is complete, successfully or otherwise, the callback function
235 MVideoPlayerUtilityObserver::MvpuoOpenComplete() is called.
237 This function can leave with one of the specified error codes. Most open failures
238 will however be reported through the MVideoPlayerUtilityObserver interface.
240 From Symbian release v9.5 onwards, this function will enable graphics surface use if the controller supports it.
241 If this function is called through an instance of the derived class CVideoPlayerUtility2 and the controller doesn't support graphics surfaces,
242 it fails with KErrNotSupported.
245 The URL of the video clip to open.
247 The Id of the internet access point to use
249 The MIME type associated with this video clip. This is
250 used to determine the format of the video clip.
251 @param aControllerUid
252 If specified, it will force the video player to use the controller with the given Uid.
256 EXPORT_C void CVideoPlayerUtility::OpenUrlL(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType, TUid aControllerUid)
258 iBody->OpenUrlL(aUrl, aIapId, aMimeType, aControllerUid);
262 Closes the video clip.
266 EXPORT_C void CVideoPlayerUtility::Close()
272 Begins playback of the initialised video sample at the current volume and priority levels.
274 When playing of the video sample is complete, successfully or otherwise, the callback function
275 MVideoPlayerUtilityObserver::MvpuoPlayComplete() is called.
279 EXPORT_C void CVideoPlayerUtility::Play()
285 Begins playback of the initialised video sample at the specified start and end points.
287 When playing of the video sample is complete, successfully or otherwise, the callback function
288 MVideoPlayerUtilityObserver::MvpuoPlayComplete() is called.
291 The point at which to start playback.
293 The point at which to terminate playback.
297 EXPORT_C void CVideoPlayerUtility::Play(const TTimeIntervalMicroSeconds& aStartTime, const TTimeIntervalMicroSeconds& aEndTime)
299 iBody->Play(aStartTime, aEndTime);
303 Stops playback of the video sample as soon as is possible.
305 If the video sample is playing, playback is stopped as soon as possible.
307 If playback is already complete, this function has no effect.
309 The position is reset to the beginning of the file.
311 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
312 another of the system-wide error codes.
316 EXPORT_C TInt CVideoPlayerUtility::Stop()
318 return iBody->Stop();
322 Video playback is paused. The current position is maintained and playback can be
323 resumed by calling Play.
327 EXPORT_C void CVideoPlayerUtility::PauseL()
333 Sets the playback volume for the audio track of the video clip.
335 The volume can be changed before or during playback and is effective immediately. The volume can
336 be set to any value between zero (mute) and the maximum permissible volume
337 (determined using MaxVolume()).
339 To determine if the current video clip contains an audio track, use AudioEnabledL().
343 The volume, between 0 and MaxVolume().
347 EXPORT_C void CVideoPlayerUtility::SetVolumeL(TInt aVolume)
349 iBody->SetVolumeL(aVolume);
354 // Sends custom command to the plugin controller.
355 // Passes handle and size of the drawable window.
358 Sets the display window. This is used to provide the video controller with an area of
359 the display to render the current video frame.
361 From Symbian release 9.5 onwards this method is not supported when called on an instance of CVideoPlayerUtility2, and will always
362 leave with KErrNotSupported.
366 The window server session ID.
368 The software device screen.
370 The window to display.
372 The dimensions of the display window.
374 The area of the video clip to display in the window.
378 EXPORT_C void CVideoPlayerUtility::SetDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice,
379 RWindowBase& aWindow, const TRect& aScreenRect,
380 const TRect& aClipRect)
382 iBody->SetDisplayWindowL(aWs, aScreenDevice, aWindow, aScreenRect, aClipRect);
386 Returns the video frame rate in frames/second.
388 @return The video frame rate (frames/second).
392 EXPORT_C TReal32 CVideoPlayerUtility::VideoFrameRateL() const
394 return iBody->VideoFrameRateL();
398 Gets the video frame size.
405 EXPORT_C void CVideoPlayerUtility::VideoFrameSizeL(TSize& aSize) const
407 iBody->VideoFrameSizeL(aSize);
411 Returns the current playback volume for the audio track of the video clip.
413 @return A value between 0 (mute) and the maximum volume returned by MaxVolume().
417 EXPORT_C TInt CVideoPlayerUtility::Volume() const
419 return iBody->Volume();
423 Sets the current playback balance for the audio track of the video clip.
425 The balance can be any value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight,
426 the default value being KMMFBalanceCenter.
429 The balance value to set.
433 EXPORT_C void CVideoPlayerUtility::SetBalanceL(TInt aBalance)
435 iBody->SetBalanceL(aBalance);
439 Returns the current balance setting for the audio track of the video clip.
441 @return A balance value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight.
445 EXPORT_C TInt CVideoPlayerUtility::Balance() const
447 return iBody->Balance();
451 Returns the video format's MIME type.
453 @return The video clip's MIME type.
456 @see NumberOfMetaDataEntriesL
458 EXPORT_C const TDesC8& CVideoPlayerUtility::VideoFormatMimeType() const
460 return iBody->VideoFormatMimeType();
464 Returns the number of meta data entries associated with this clip.
466 @return The number of meta data entries.
470 EXPORT_C TInt CVideoPlayerUtility::NumberOfMetaDataEntriesL() const
472 return iBody->NumberOfMetaDataEntriesL();
476 Returns a meta data entry from the clip.
478 @param aMetaDataIndex
479 The index of the meta data entry to retrieve.
481 @return The metadata entry requested.
484 @see NumberOfMetaDataEntriesL
486 EXPORT_C CMMFMetaDataEntry* CVideoPlayerUtility::MetaDataEntryL(TInt aMetaDataIndex) const
488 return iBody->MetaDataEntryL(aMetaDataIndex);
492 Sets the playback priority.
494 This is used to arbitrate between multiple objects simultaneously trying to accesses
500 The Priority Preference.
502 @see CVideoPlayerUtility::NewL()
507 EXPORT_C void CVideoPlayerUtility::SetPriorityL(TInt aPriority, TInt aPref)
509 iBody->SetPriorityL(aPriority, aPref);
513 Get the current playback priority. This is used to arbitrate between simultaneous accesses of
517 On return, contains the priority level, EMdaPriorityMin client can be interrupted by any
518 other client, EMdaPriorityNormal client can only be interrupted by a client with a higher
519 priority or EMdaPriorityMax client cannot be interrupted by other clients.
521 On return, contains the time and quality preferences, enumerated in TMdaPriorityPreference.
525 EXPORT_C void CVideoPlayerUtility::PriorityL(TInt& aPriority, TMdaPriorityPreference& aPref) const
527 iBody->PriorityL(aPriority, aPref);
531 Sets the position within the video clip from where to start playback.
534 Position from start of clip in microseconds.
538 EXPORT_C void CVideoPlayerUtility::SetPositionL(const TTimeIntervalMicroSeconds& aPosition)
540 iBody->SetPositionL(aPosition);
544 Returns the duration of video clip in mircoseconds.
546 @return The duration of clip in microseconds.
550 EXPORT_C TTimeIntervalMicroSeconds CVideoPlayerUtility::DurationL() const
552 return iBody->DurationL();
556 Returns the current playback position.
558 @return The current position from the start of the clip in microseconds.
562 EXPORT_C TTimeIntervalMicroSeconds CVideoPlayerUtility::PositionL() const
564 return iBody->PositionL();
568 Returns an integer representing the maximum volume that the audio track can support.
570 This is the maximum value that can be passed to SetVolumeL(). This value is platform
571 independent, but is always greater than or equal to one.
573 @return The naximum playback volume.
577 EXPORT_C TInt CVideoPlayerUtility::MaxVolume() const
579 return iBody->MaxVolume();
583 Gets the current frame. The current frame is requested, and will be sent to
584 the client asynchrynously via the MvpuoFrameReady callback.
587 The display mode for the retrieved frame.
591 EXPORT_C void CVideoPlayerUtility::GetFrameL(TDisplayMode aDisplayMode)
593 iBody->GetFrameL(aDisplayMode);
597 Gets the current frame. The current frame is requested, and will be sent to
598 the client asynchrynously via the MvpuoFrameReady callback.
601 The display mode for the retrieved frame.
603 The DRM Intent to pass to the controller.
605 EXPORT_C void CVideoPlayerUtility::GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent)
607 iBody->GetFrameL(aDisplayMode, ETrue, aIntent);
611 Returns the video bit rate.
613 @return The video bit rate in bits/second.
617 EXPORT_C TInt CVideoPlayerUtility::VideoBitRateL() const
619 return iBody->VideoBitRateL();
623 Returns the audio bit rate in bits/second.
625 @return The audio bit rate (bits/second).
629 EXPORT_C TInt CVideoPlayerUtility::AudioBitRateL() const
631 return iBody->AudioBitRateL();
635 Returns whether the current clip has an audio stream and audio playback
636 is enabled. This method will return EFalse if the clip does no have an
637 audio track or if audio playback has been disabled with
640 @return ETrue if an audio track is present and audio playback is
641 enabled, otherwise EFalse.
645 EXPORT_C TBool CVideoPlayerUtility::AudioEnabledL() const
647 return iBody->AudioEnabledL();
650 EXPORT_C void Reserved2()
652 // reserved function replacing removed VideoTypeL() method
653 // this function should never be called hence generate a
654 // panic with code ENoVideoTypeL
655 Panic( ENoVideoTypeL );
659 Returns the codec used for the audio component of the video clip.
661 @return The four character code representing the audio codec.
665 EXPORT_C TFourCC CVideoPlayerUtility::AudioTypeL() const
667 return iBody->AudioTypeL();
671 Gets the progress of video clip loading/rebuffering.
673 @param aPercentageProgress
674 The percentage of loading/rebuffering complete. The parameter
675 is zero if loading has not begun and 100 if loading has already completed.
679 EXPORT_C void CVideoPlayerUtility::GetVideoLoadingProgressL(TInt& aPercentageProgress)
681 iBody->GetVideoLoadingProgressL(aPercentageProgress);
685 Sends a synchronous custom command to the controller.
688 The destination of the message, consisting of the UID of
689 the interface of this message.
691 The function number to indicate which function is to be called
692 on the interface defined in the aDestination parameter.
694 A reference to the first chunk of data to be copied to the controller
695 framework. The exact contents of the data are dependent on the
696 interface being called. Can be KNullDesC8.
698 A reference to the second chunk of data to be copied to the controller
699 framework. The exact contents of the data are dependent on the
700 interface being called. Can be KNullDesC8.
702 A reference to an area of memory to which the controller framework will
703 write any data to be passed back to the client. Can't be KNullDesC8.
705 @return The result of the request. The exact range of values is dependent on the interface.
709 EXPORT_C TInt CVideoPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
711 return iBody->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
715 Sends a synchronous custom command to the controller.
718 The destination of the message, consisting of the uid of
719 the interface of this message.
721 The function number to indicate which function is to be called
722 on the interface defined in the aDestination parameter.
724 A reference to the first chunk of data to be copied to the controller
725 framework. The exact contents of the data are dependent on the
726 interface being called. Can be KNullDesC8.
728 A reference to the second chunk of data to be copied to the controller
729 framework. The exact contents of the data are dependent on the
730 interface being called. Can be KNullDesC8.
732 @return The result of the request. The exact range of values is dependent on the interface.
736 EXPORT_C TInt CVideoPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
738 return iBody->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
742 Sends an asynchronous custom command to the controller.
745 This method will return immediately. The RunL of the active object owning the
746 aStatus parameter will be called when the command is completed by the
747 controller framework.
750 The destination of the message, consisting of the uid of
751 the interface of this message.
753 The function number to indicate which function is to be called
754 on the interface defined in the aDestination parameter.
756 A reference to the first chunk of data to be copied to the controller
757 framework. The exact contents of the data are dependent on the
758 interface being called. Can be KNullDesC8.
760 A reference to the second chunk of data to be copied to the controller
761 framework. The exact contents of the data are dependent on the
762 interface being called. Can be KNullDesC8.
764 A reference to an area of memory to which the controller framework will
765 write any data to be passed back to the client. Can't be KNullDesC8.
767 The TRequestStatus of an active object. This will contain the
768 result of the request on completion. The exact range of
769 result values is dependent on the interface.
773 EXPORT_C void CVideoPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
775 iBody->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
779 Send a asynchronous custom command to the controller.
782 This method will return immediately. The RunL of the active object owning the
783 aStatus parameter will be called when the command is completed by the
784 controller framework.
787 The destination of the message, consisting of the uid of
788 the interface of this message.
790 The function number to indicate which function is to be called
791 on the interface defined in the aDestination parameter.
793 A reference to the first chunk of data to be copied to the controller
794 framework. The exact contents of the data are dependent on the
795 interface being called. Can be KNullDesC8.
797 A reference to the second chunk of data to be copied to the controller
798 framework. The exact contents of the data are dependent on the
799 interface being called. Can be KNullDesC8.
801 The TRequestStatus of an active object. This will contain the
802 result of the request on completion. The exact range of
803 result values is dependent on the interface.
807 EXPORT_C void CVideoPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
809 iBody->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
813 Register to receive notifications of video clip loading/rebuffering.
815 When a video clip is being streamed in, it may require rebuffering from time to time. This function
816 "switches on" callbacks that report the status of the rebuffering.
818 The two callbacks that can be sent are MVideoLoadingObserver::MvloLoadingStarted() and
819 MVideoLoadingObserver::MvloLoadingComplete().
822 The object to receive video loading notifications.
826 EXPORT_C void CVideoPlayerUtility::RegisterForVideoLoadingNotification(MVideoLoadingObserver& aCallback)
828 iBody->RegisterForVideoLoadingNotification(aCallback);
832 Sets the video frame rate.
834 @param aFramesPerSecond
835 The number of frames per second to request.
839 EXPORT_C void CVideoPlayerUtility::SetVideoFrameRateL(TReal32 aFramesPerSecond)
841 iBody->SetVideoFrameRateL(aFramesPerSecond);
845 Requests the video controller to redraw the current frame.
849 EXPORT_C void CVideoPlayerUtility::RefreshFrameL()
851 iBody->RefreshFrameL();
855 Rotates the video image on the screen.
858 The desired rotation to apply in 90 degree increments.
863 EXPORT_C void CVideoPlayerUtility::SetRotationL(TVideoRotation aRotation)
865 iBody->SetRotationL(aRotation);
869 Query the rotation that is currently applied to the video image.
871 @return The applied rotation
876 EXPORT_C TVideoRotation CVideoPlayerUtility::RotationL() const
878 return iBody->RotationL();
882 Scales the video image to a specified percentage of its original size.
884 @param aWidthPercentage
885 The percentage (100 = original size) to be used to scale the width of the video image
886 @param aHeightPercentage
887 The percentage (100 = original size) to be used to scale the height of the video image.
888 If this is not equal to aWidthPercentage then the image may be distorted.
889 @param aAntiAliasFiltering
890 A boolean specifying if anti-aliasing should be used. True if anti-aliasing filtering
891 should be used. If the plugin does not support this kind of processing,
892 this value will be ignored.
897 EXPORT_C void CVideoPlayerUtility::SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering)
899 iBody->SetScaleFactorL(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering);
903 Gets the scale factor currently applied to the video image.
905 @param aWidthPercentage
906 On function return, contains the current scaling percentage applied to the width of the
907 video image (100 = original size).
908 @param aHeightPercentage
909 On function return, contains the current scaling percentage applied to the height of the
910 of the video image (100 = original size).
911 @param aAntiAliasFiltering
912 The boolean specifying if anit-aliasing is being used.
917 EXPORT_C void CVideoPlayerUtility::GetScaleFactorL(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const
919 iBody->GetScaleFactorL(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering);
923 Selects a region of the video image to be displayed.
926 The dimensions of the crop region, relative to the video image.
931 EXPORT_C void CVideoPlayerUtility::SetCropRegionL(const TRect& aCropRegion)
933 iBody->SetCropRegionL(aCropRegion);
937 Gets the crop region currently applied to the image.
940 The dimensions of the crop region, relative to the video image. If no
941 crop region has been applied, the full dimensions of the video image will
947 EXPORT_C void CVideoPlayerUtility::GetCropRegionL(TRect& aCropRegion) const
949 iBody->GetCropRegionL(aCropRegion);
953 Prepares the video clip to be accessed.
955 A call to this method tells the loaded controller plugin to finalise its configuration
956 and to prepare to start reading the video clip. It is not possible to play the video clip
957 or query any of its properties (e.g. duration, meta data etc.) until this method has signalled
958 its completion (successful or otherwise) via the callback MvpuoPrepareComplete.
962 EXPORT_C void CVideoPlayerUtility::Prepare()
968 Returns the controller implementation information associated with the current controller.
970 @return The controller implementation structure associated with the controller.
974 EXPORT_C const CMMFControllerImplementationInformation& CVideoPlayerUtility::ControllerImplementationInformationL()
976 return iBody->ControllerImplementationInformationL();
980 Gets a controller's DRM custom command implementation.
982 @return A pointer to a controller's DRM custom command implementation, or NULL
983 if the controller does not support it.
985 EXPORT_C MMMFDRMCustomCommand* CVideoPlayerUtility::GetDRMCustomCommand()
987 return iBody->GetDRMCustomCommand();
992 Enables a client application to stop the video player from using direct screen access (DSA).
994 From Symbian release 9.5 onwards this method is not supported when called on an instance of CVideoPlayerUtility2, and will always
995 leave with KErrNotSupported.
997 This function leaves if errors are encountered when trying to stop DSA.
999 EXPORT_C void CVideoPlayerUtility::StopDirectScreenAccessL()
1001 iBody->StopDirectScreenAccessL();
1005 Enables a client application to start the video player using direct screen access (DSA).
1007 From Symbian release 9.5 onwards this method is not supported when called on an instance of CVideoPlayerUtility2, and will always
1008 leave with KErrNotSupported.
1010 This function leaves if errors are encountered when trying to start DSA.
1012 EXPORT_C void CVideoPlayerUtility::StartDirectScreenAccessL()
1014 iBody->StartDirectScreenAccessL();
1018 Registers for notification, when audio resource is available.
1021 Observer interface for audio resource notification event
1023 @param aNotificationEventId
1024 The Event for which the client registers.
1026 @param aNotificationRegistrationData
1027 Data specific to notification registration.This has been reserved for future use and its value should be NULL.
1029 @return An error code indicating if the registration is successful. KErrNone on success,
1030 otherwise another of the system-wide error codes.
1032 EXPORT_C TInt CVideoPlayerUtility::RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback, TUid aNotificationEventId, const TDesC8& aNotificationRegistrationData)
1034 return iBody->RegisterAudioResourceNotification(aCallback, aNotificationEventId, aNotificationRegistrationData);
1038 Cancels the registration for audio resource notification.
1040 @param aNotificationEventId
1041 The Event to be cancellled.
1043 @return An error code indicating if the cancellation is successful. KErrNone on success,
1044 otherwise another of the system-wide error codes.
1046 EXPORT_C TInt CVideoPlayerUtility::CancelRegisterAudioResourceNotification(TUid aNotificationEventId)
1048 return iBody->CancelRegisterAudioResourceNotification(aNotificationEventId);
1052 Waits for the client to resume the play even after the default timer expires.
1053 Unless the client completes the play no other client gets notification.
1055 @return An error code indicating if the function call is successful. KErrNone on success,
1056 otherwise another of the system-wide error codes.
1058 EXPORT_C TInt CVideoPlayerUtility::WillResumePlay()
1060 return iBody->WillResumePlay();
1064 Sets the initial screen to be used for the video display.
1066 From Symbian release 9.5 onwards this method is not supported when called on an instance of CVideoPlayerUtility2, and will always
1067 leave with KErrNotSupported.
1069 @param aScreenNumber
1070 The screen number of the device.
1072 @return KErrNotSupported if the secondary screen display is not supported in Multimedia Framework or
1073 from Symbian release 9.5 onwards when called on an instance of CVideoPlayerUtility2. KErrNone on success.
1075 EXPORT_C TInt CVideoPlayerUtility::SetInitScreenNumber(TInt aScreenNumber)
1077 return iBody->SetInitScreenNumber(aScreenNumber);
1080 _LIT(KMMFMediaClientVideoPanicCategory, "MediaClientVideo");
1081 GLDEF_C void Panic(TMmfVideoPanic aError)
1083 User::Panic(KMMFMediaClientVideoPanicCategory, aError);
1087 Set video playback velocity relative to the normal video clip speed.
1088 This method can be used for fast forward, rewind, and slow-motion
1089 playback, depending on the capabilities of the underlying play-controller
1090 implementation and the characteristics of the video clip. Velocity set
1091 in this call will take effect immediately. Additionally,
1092 playback velocity cannot be changed for streamed video. Use
1093 GetPlayRateCapabilitiesL() to determine what playback modes are
1096 Note that due to performance reasons, it may not be possible to perform
1097 fast forward or rewind at the requested speed. If that happens, the
1098 play-controller will use the nearest available velocity. This is not
1099 considered an error and the method will not leave. User can query
1100 velocity in effect by calling PlayVelocityL().
1102 The default playback velocity is 100.
1103 Play velocity is persistent across stop play calls on utility.
1104 That is SetPlayVelocityL(),call StopL(),then PlayL() will play with
1105 the velocity set in most recent call. On opening different
1106 file the velocity will default to 100.
1108 This function quits or exits leaving any of the system wide error codes.
1109 Common error codes are listed below.
1111 @param aVelocity Playback velocity as a percentage relative to the
1112 normal video clip speed. Use 100 for normal-speed
1113 forward playback and negative value for reverse. Values above
1114 100 and below 0 correspond to fast forward and
1115 rewind respectively, while values 1 to 100 represent
1116 slow-motioned playback.
1118 @pre Playback has been started, but may be paused.
1120 @see CVideoPlayerUtility::GetPlayRateCapabilitiesL()
1122 @leave KErrNotSupported The requested playback velocity is not
1124 @leave KErrNotReady Playback has not yet been started
1128 EXPORT_C void CVideoPlayerUtility::SetPlayVelocityL(TInt aVelocity)
1130 iBody->SetPlayVelocityL(aVelocity);
1134 Returns the current playback velocity. If setting play velocity is
1135 not supported or velocity is not set this will return default play velocity
1136 100 corresponding to normal playback.
1138 If implementation is not supporting the velocity set with SetPlayVelocityL
1139 it will default to the nearest velocity. In this case this API will return
1140 the value it has defaulted to.
1142 If an error occurs, this function leaves with any of the system
1143 wide error codes. Common error codes are listed below.
1145 @return The current playback velocity as a percentage relative to the
1146 normal video clip speed.
1148 @pre Playback has been started, but may be paused.
1150 @see CVideoPlayerUtility::SetPlayVelocityL()
1152 @leave KErrNotReady Playback has not yet been started
1156 EXPORT_C TInt CVideoPlayerUtility::PlayVelocityL() const
1158 return iBody->PlayVelocityL();
1162 Steps the current video playback position forward or backward by a
1163 number of frames. Frame step is only available when playback is paused.
1165 Support for frame stepping may depend on the underlying play-controller
1166 implementation and the video clip open. Additionally, frame step is
1167 typically not available in streamed playback. Use GetPlayRateCapabilitiesL()
1168 to query if frame step is currently possible. Application may check the
1169 value of the current positon after stepping through several frames by calling
1172 Implementations may not be able to step exactly the number of frames
1173 requested, especially when stepping backwards. If this happens, the
1174 play-controller will step to a frame close to the one requested. This is
1175 not considered an error.
1177 This function quits or exits leaving any of the system wide error codes.
1178 Common error codes are listed below.
1180 @param aStep The number of frames to step. Use positive values for
1181 stepping forward and negative values for stepping
1184 @pre Playback has been started and is currently paused.
1185 That means this API can be called only in paused state.
1187 @see CVideoPlayerUtility::GetPlayRateCapabilitiesL()
1189 @leave KErrNotSupported Frame step is not supported. Note that some
1190 implementations may support step forward but not step backward.
1191 @leave KErrNotReady Playback has not yet been started or is not in paused state.
1195 EXPORT_C void CVideoPlayerUtility::StepFrameL(TInt aStep)
1197 iBody->StepFrameL(aStep);
1201 Queries the current playback rate capabilities. The capabilities
1202 describe whether fast forward, reverse playback, slow motion, or
1203 step backward or forward is possible. The capabilities may depend on
1204 the controller implementation and the video clip. Additionally,
1205 only normal-speed forward playback is typically possible in streamed playback.
1207 This function quits or exits leaving any of the system wide error codes.
1208 Common error codes are listed below.
1210 @param aCapabilities Playback rate capabilities
1212 @pre The video clip has been opened
1214 @leave KErrNotReady The video clip has not yet been opened
1218 EXPORT_C void CVideoPlayerUtility::GetPlayRateCapabilitiesL(TVideoPlayRateCapabilities& aCapabilities)const
1220 iBody->GetPlayRateCapabilitiesL(aCapabilities);
1224 Enables or disables video playback. This function is used to disable
1225 video playback in a video clip to play only the audio track. By default
1226 video playback is always enabled if the clip has a video track.
1228 This method can be called after the video clip has been opened, but
1229 only before calling Prepare().
1231 This function quits or exits leaving any of the system wide error codes.
1232 Common error codes are listed below.
1234 @param aVideoEnabled ETrue to enable video playback, EFalse to disable
1236 @pre The video clip has been opened by the client and Prepare() has not been called.
1238 @leave KErrNotSupported This method is not supported -- video playback
1240 @leave KErrNotReady The clip has not been opened or the client has
1241 already called Prepare().
1245 EXPORT_C void CVideoPlayerUtility::SetVideoEnabledL(TBool aVideoEnabled)
1247 iBody->SetVideoEnabledL(aVideoEnabled);
1251 Queries whether video playback is currently enabled or not.
1252 If an error occurs, this function leaves with any of the system
1253 wide error codes. Common error codes are listed below.
1255 @return ETrue if video playback is enabled, EFalse if not.
1259 EXPORT_C TBool CVideoPlayerUtility::VideoEnabledL() const
1261 return iBody->VideoEnabledL();
1265 Enables or disables audio playback. This function is used to disable
1266 audio playback in a video clip to play only the video track. By default
1267 audio playback is always enabled if the clip has an audio track.
1269 This method can be called after the video clip has been opened, but
1270 only before calling Prepare().
1272 This function quits or exits leaving any of the system wide error codes.
1273 Common error codes are listed below.
1275 @param aAudioEnabled ETrue to enable audio playback, EFalse to disable
1277 @pre The video clip has been opened by the client and Prepare() has not been called.
1279 @leave KErrNotSupported This method is not supported -- audio playback
1281 @leave KErrNotReady The clip has not been opened or the client has
1282 already called Prepare().
1286 EXPORT_C void CVideoPlayerUtility::SetAudioEnabledL(TBool aAudioEnabled)
1288 iBody->SetAudioEnabledL(aAudioEnabled);
1292 Set video automatic scaling. When automatic scaling is active, the
1293 video picture is scaled automatically to match the video window,
1294 based on the scaling type. This variant of SetAutoScaleL() will
1295 always center the picture in the window.
1297 Calling SetAutoScaleL() will override any scaling factors set with
1298 SetScaleFactorL(). Calling SetScaleFactorL() will disable automatic
1301 Not all video controllers support automatic scaling.
1303 This function quits or exits leaving any of the system wide error codes.
1304 Common error codes are listed below.
1306 @see TAutoScaleType, THorizontalAlign, TVerticalAlign
1308 @param aScaleType Automatic scaling type
1310 @pre The video clip has been opened by the client
1312 @leave KErrNotSupported Automatic scaling is not supported
1314 EXPORT_C void CVideoPlayerUtility::SetAutoScaleL(TAutoScaleType aScaleType)
1316 iBody->SetAutoScaleL(aScaleType);
1320 Set video automatic scaling. When automatic scaling is active, the
1321 video picture is scaled automatically to match the video window,
1322 based on the scaling type, and positioned according to the
1325 Calling SetAutoScaleL() will override any scaling factors set with
1326 SetScaleFactorL(). Calling SetScaleFactorL() will disable automatic
1329 Not all video controller support automatic scaling.
1331 This function quits or exits leaving any of the system wide error codes.
1332 Common error codes are listed below.
1334 @see TAutoScaleType, THorizontalAlign, TVerticalAlign
1336 @param aScaleType Automatic scaling type
1337 @param aHorizPos Video picture horizontal position, relative to the
1338 video window. The value can be either a pixel offset
1339 (positive or negative) from the top left corner of the
1340 window to the top left corner of the picture, or an
1341 alignment constant from enum THorizontalAlign.
1342 @param aVertPos Video picture vertical position, relative to the
1343 video window. The value can be either a pixel offset
1344 (positive or negative) from the top left corner of the
1345 window to the top left corner of the picture, or an
1346 alignment constant from enum TVerticalAlign.
1348 @pre The video clip has been opened by the client.
1350 @leave KErrNotSupported Automatic scaling is not supported
1352 EXPORT_C void CVideoPlayerUtility::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
1354 iBody->SetAutoScaleL(aScaleType, aHorizPos, aVertPos );
1358 When enabled sets automatic switching of surface to/from external display when it is connected/disconnected from the device.
1360 Automatic switching is enabled by default, but only if the client thread that created this utility has an Active Scheduler
1361 installed and the device supports external display switching.
1363 To use this function the client thread must have an Active Scheduler installed otherwise it will leave with KErrNotReady.
1366 ETrue to enable. EFalse to disable.
1368 Display id of display to enable external switching for.
1369 @leave KErrNotSupported Device does not support external displays
1370 @leave KErrNotReady CActiveScheduler is not installed
1372 EXPORT_C void CVideoPlayerUtility::SetExternalDisplaySwitchingL(TInt aDisplay, TBool aControl)
1374 iBody->SetExternalDisplaySwitchingL(aDisplay, aControl);