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.
16 #ifndef __VIDEOPLAYER_H__
17 #define __VIDEOPLAYER_H__
22 #include <mmf/common/mmfbase.h>
23 #include <mmf/common/mmfcontroller.h>
24 #include <mmf/common/mmfaudio.h>
25 #include <mmf/common/mmfstandardcustomcommands.h>
26 #include <mmf/common/mmfdrmcustomcommands.h>
27 #include <mda/common/base.h>
28 #include <mmf/common/mmfutilities.h>
29 #include <mmf/common/mmfcontrollerframeworkbase.h>
30 #include "mmf/common/mmcaf.h"
31 #include <mmfclntutility.h>
37 An interface to a set of video player callback functions.
39 The class is a mixin and is intended to be inherited by the client
40 class which is observing the video playing operation. The functions
41 encapsulated by this class are called when specific events occur in
42 the process of initialising and playing an video clip. A reference to
43 this object is passed as a parameter when constructing an audio player
48 class MVideoPlayerUtilityObserver
53 Notification to the client that the opening of the video clip has completed,
54 successfully, or otherwise.
56 The status of the video sample after opening is given by aError. The following
57 values imply same across all the devices.
59 - KErrNone: the sample is ready to play;
60 - KErrNotSupported: the controller plugin is not recognised or not supported;
61 - KErrNotFound: the video sample cannot be found;
62 - KErrNoMemory: there is insufficient memory to play this video sample.
64 Other values are possible indicating a problem opening the video sample. These values
67 The client must now call Prepare() on the video player utility before the
68 video clip can be played or any of its properties (e.g. duration) can be
72 The status of the video player after initialisation.
76 virtual void MvpuoOpenComplete(TInt aError) = 0;
79 Notification to the client that the opening of the video clip has been prepared
80 successfully, or otherwise. This callback is called in response to a call to
81 CVideoPlayerUtility::Prepare().
83 The video clip may now be played, or have any of its properties (e.g. duration) queried.
86 The status of the video player after initialisation.
87 This is either KErrNone if the open has completed successfully,
88 or one of the system wide error codes.
92 virtual void MvpuoPrepareComplete(TInt aError) = 0;
95 Notification that the frame requested by a call to GetFrameL is ready
98 The returned frame. The bitmap will contain
99 the requested frame if the the error code is KErrNone (success).
101 The status of the frame request.
102 This is either KErrNone if the frame request was successful,
103 or one of the system wide error codes.
107 virtual void MvpuoFrameReady(CFbsBitmap& aFrame,TInt aError) = 0;
110 Notification that video playback has completed. This is not called if
111 playback is explicitly stopped (such as through the use of the Stop or
115 The status of playback.
116 This is either KErrNone if the playback was completed successfully,
117 or one of the system wide error codes.
120 virtual void MvpuoPlayComplete(TInt aError) = 0;
123 General event notification from controller. These events are specified by
124 the supplier of the controller
127 The event sent by the controller.
131 virtual void MvpuoEvent(const TMMFEvent& aEvent) = 0;
138 This is a mixin class that allows a client to receive notification of rebuffering
139 operations occurring in the video player
143 class MVideoLoadingObserver
148 Notification that video clip loading/rebuffering has started
152 virtual void MvloLoadingStarted() = 0;
155 Notification that video clip loading/rebuffering has completed
159 virtual void MvloLoadingComplete() = 0;
162 class CMMFVideoPlayerCallback;
163 class CVideoPlayerUtility2;
164 class TVideoPlayRateCapabilities;
170 Plays sampled video data.
172 The class offers a simple interface to open, play and obtain information from sampled video data.
173 The video data can be provided using files, descriptors or URLs.
176 Some video formats also allow the storing of audio data. To accommodate this, this class contains
177 audio functions that can manipulate such data.
179 While this class is abstract, NewL() constructs, initialises and returns pointers to instances of
180 concrete classes derived from this abstract class. This concrete class is part of the MMF
181 implementation and is private.
185 class CVideoPlayerUtility : public CBase,
186 public MMMFClientUtility
190 ~CVideoPlayerUtility();
192 IMPORT_C static CVideoPlayerUtility* NewL(MVideoPlayerUtilityObserver& aObserver,
196 CWsScreenDevice& aScreenDevice,
197 RWindowBase& aWindow,
198 const TRect& aScreenRect,
199 const TRect& aClipRect);
201 IMPORT_C void OpenFileL(const TDesC& aFileName,TUid aControllerUid = KNullUid);
202 IMPORT_C void OpenFileL(const RFile& aFileName, TUid aControllerUid = KNullUid);
204 IMPORT_C void OpenFileL(const TMMSource& aSource, TUid aControllerUid = KNullUid);
206 IMPORT_C void OpenDesL(const TDesC8& aDescriptor,TUid aControllerUid = KNullUid);
208 IMPORT_C void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8, TUid aControllerUid = KNullUid);
210 IMPORT_C void Prepare();
212 IMPORT_C void Close();
214 IMPORT_C void Play();
216 IMPORT_C void Play(const TTimeIntervalMicroSeconds& aStartPoint, const TTimeIntervalMicroSeconds& aEndPoint);
218 IMPORT_C TInt Stop();
220 IMPORT_C void PauseL();
222 IMPORT_C void SetPriorityL(TInt aPriority, TInt aPref);
224 IMPORT_C void PriorityL(TInt& aPriority, TMdaPriorityPreference& aPref) const;
226 IMPORT_C void SetDisplayWindowL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,const TRect& aWindowRect,const TRect& aClipRect);
228 IMPORT_C void RegisterForVideoLoadingNotification(MVideoLoadingObserver& aCallback);
230 IMPORT_C void GetVideoLoadingProgressL(TInt& aPercentageComplete);
232 IMPORT_C void GetFrameL(TDisplayMode aDisplayMode);
234 IMPORT_C void GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent);
236 IMPORT_C void RefreshFrameL();
238 IMPORT_C TReal32 VideoFrameRateL() const;
240 IMPORT_C void SetVideoFrameRateL(TReal32 aFramesPerSecond);
242 IMPORT_C void VideoFrameSizeL(TSize& aSize) const;
244 IMPORT_C const TDesC8& VideoFormatMimeType() const;
246 IMPORT_C TInt VideoBitRateL() const;
248 IMPORT_C TInt AudioBitRateL() const;
250 IMPORT_C TFourCC AudioTypeL() const;
252 IMPORT_C TBool AudioEnabledL() const;
254 IMPORT_C void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
256 IMPORT_C TTimeIntervalMicroSeconds PositionL() const;
258 IMPORT_C TTimeIntervalMicroSeconds DurationL() const;
260 IMPORT_C void SetVolumeL(TInt aVolume);
262 IMPORT_C TInt Volume() const;
264 IMPORT_C TInt MaxVolume() const;
266 IMPORT_C void SetBalanceL(TInt aBalance);
268 IMPORT_C TInt Balance()const;
270 IMPORT_C void SetRotationL(TVideoRotation aRotation);
272 IMPORT_C TVideoRotation RotationL() const;
274 IMPORT_C void SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering);
276 IMPORT_C void GetScaleFactorL(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const;
278 IMPORT_C void SetCropRegionL(const TRect& aCropRegion);
280 IMPORT_C void GetCropRegionL(TRect& aCropRegion) const;
282 IMPORT_C TInt NumberOfMetaDataEntriesL() const;
284 IMPORT_C CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex) const;
286 IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
288 IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
290 IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
292 IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
294 IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
296 IMPORT_C MMMFDRMCustomCommand* GetDRMCustomCommand();
298 IMPORT_C void StopDirectScreenAccessL();
300 IMPORT_C void StartDirectScreenAccessL();
302 IMPORT_C TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8& aNotificationRegistrationData = KNullDesC8);
304 IMPORT_C TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId);
306 IMPORT_C TInt WillResumePlay();
308 IMPORT_C TInt SetInitScreenNumber(TInt aScreenNumber);
310 IMPORT_C void SetPlayVelocityL(TInt aVelocity);
312 IMPORT_C TInt PlayVelocityL() const;
314 IMPORT_C void StepFrameL(TInt aStep);
316 IMPORT_C void GetPlayRateCapabilitiesL(TVideoPlayRateCapabilities& aCapabilities) const;
318 IMPORT_C void SetVideoEnabledL(TBool aVideoEnabled);
320 IMPORT_C TBool VideoEnabledL() const;
322 IMPORT_C void SetAudioEnabledL(TBool aAudioEnabled);
324 IMPORT_C void SetAutoScaleL(TAutoScaleType aScaleType);
326 IMPORT_C void SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos);
328 IMPORT_C void SetExternalDisplaySwitchingL(TInt aDisplay, TBool aControl);
336 friend class CVideoPlayerUtility2;
338 enum TMMFVideoPlayerState
346 friend class CTestStepUnitMMFVidClient;
347 #ifdef SYMBIAN_BUILD_GCE
348 friend class CMediaClientVideoDisplayBody;
349 #endif // SYMBIAN_BUILD_GCE
352 friend class CTestView;