epoc32/include/videoplayer.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 videoplayer.h
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __VIDEOPLAYER_H__
       
    17 #define __VIDEOPLAYER_H__
       
    18 
       
    19 #include <w32std.h>
       
    20 #include <fbs.h>
       
    21 #include <f32file.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>
       
    32 
       
    33 /**
       
    34 @publishedAll
       
    35 @released
       
    36 
       
    37 An interface to a set of video player callback functions.
       
    38 
       
    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
       
    44 utility object.
       
    45 
       
    46 @since 7.0s
       
    47 */
       
    48 class MVideoPlayerUtilityObserver
       
    49 	{
       
    50 public:
       
    51 
       
    52 	/**
       
    53 	Notification to the client that the opening of the video clip has completed,
       
    54 	successfully, or otherwise.
       
    55 
       
    56 	The status of the video sample after opening is given by aError. The following
       
    57 	values imply same across all the devices.
       
    58 
       
    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.
       
    63 
       
    64 	Other values are possible indicating a problem opening the video sample. These values
       
    65 	are device dependent.
       
    66 
       
    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
       
    69 	queried.
       
    70 
       
    71 	@param  aError
       
    72 	        The status of the video player after initialisation.
       
    73 
       
    74 	@since  7.0s
       
    75 	*/
       
    76 	virtual void MvpuoOpenComplete(TInt aError) = 0;
       
    77 
       
    78 	/**
       
    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().
       
    82 
       
    83 	The video clip may now be played, or have any of its properties (e.g. duration) queried.
       
    84 
       
    85 	@param  aError
       
    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.
       
    89 	
       
    90 	@since  7.0s
       
    91 	*/
       
    92 	virtual void MvpuoPrepareComplete(TInt aError) = 0;
       
    93 
       
    94 	/**
       
    95 	Notification that the frame requested by a call to GetFrameL is ready
       
    96 
       
    97 	@param  aFrame
       
    98 	        The returned frame. The bitmap will contain
       
    99 	        the requested frame if the the error code is KErrNone (success).
       
   100 	@param  aError
       
   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.
       
   104 
       
   105 	@since	7.0s
       
   106 	*/
       
   107 	virtual void MvpuoFrameReady(CFbsBitmap& aFrame,TInt aError) = 0;
       
   108 
       
   109 	/**
       
   110 	Notification that video playback has completed. This is not called if
       
   111 	playback is explicitly stopped by calling Stop.
       
   112 
       
   113 	@param  aError
       
   114 	        The status of playback.
       
   115 	        This is either KErrNone if the playback was completed successfully,
       
   116 	        or one of the system wide error codes.
       
   117 	@since  7.0s
       
   118 	*/
       
   119 	virtual void MvpuoPlayComplete(TInt aError) = 0;
       
   120 	
       
   121 	/**
       
   122 	General event notification from controller. These events are specified by
       
   123 	the supplier of the controller
       
   124 
       
   125 	@param  aEvent
       
   126 	        The event sent by the controller.
       
   127 
       
   128 	@since  7.0s
       
   129 	*/
       
   130 	virtual void MvpuoEvent(const TMMFEvent& aEvent) = 0;
       
   131 	};
       
   132 	
       
   133 /**
       
   134 @publishedAll
       
   135 @released
       
   136 
       
   137 This is a mixin class that allows a client to receive notification of rebuffering
       
   138 operations occurring in the video player
       
   139 
       
   140 @since 7.0s
       
   141 */
       
   142 class MVideoLoadingObserver
       
   143 	{
       
   144 public:
       
   145 
       
   146 	/**
       
   147 	Notification that video clip loading/rebuffering has started
       
   148 
       
   149 	@since  7.0s
       
   150 	*/
       
   151 	virtual void MvloLoadingStarted() = 0;
       
   152 
       
   153 	/**
       
   154 	Notification that video clip loading/rebuffering has completed
       
   155 
       
   156 	@since  7.0s
       
   157 	*/
       
   158 	virtual void MvloLoadingComplete() = 0;
       
   159 	};
       
   160 
       
   161 class CMMFVideoPlayerCallback;
       
   162 
       
   163 /**
       
   164 @publishedAll
       
   165 @released
       
   166 
       
   167 Plays sampled video data.
       
   168 
       
   169 The class offers a simple interface to open, play and obtain information from sampled video data. 
       
   170 The video data can be provided using files, descriptors or URLs.
       
   171 
       
   172 Note: 
       
   173 Some video formats also allow the storing of audio data. To accommodate this, this class contains 
       
   174 audio functions that can manipulate such data.
       
   175 
       
   176 While this class is abstract, NewL() constructs, initialises and returns pointers to instances of 
       
   177 concrete classes derived from this abstract class. This concrete class is part of the MMF 
       
   178 implementation and is private.
       
   179 
       
   180 @since 7.0s
       
   181 */
       
   182 class CVideoPlayerUtility : public CBase,
       
   183 							public MMMFClientUtility
       
   184 	{
       
   185 	class CBody;
       
   186 public:
       
   187 
       
   188 	~CVideoPlayerUtility();
       
   189 
       
   190 	IMPORT_C static CVideoPlayerUtility* NewL(MVideoPlayerUtilityObserver& aObserver,
       
   191 											  TInt aPriority,
       
   192 											  TMdaPriorityPreference aPref,
       
   193 											  RWsSession& aWs,
       
   194 											  CWsScreenDevice& aScreenDevice,
       
   195 											  RWindowBase& aWindow,
       
   196 											  const TRect& aScreenRect,
       
   197 											  const TRect& aClipRect);
       
   198 
       
   199 	IMPORT_C void OpenFileL(const TDesC& aFileName,TUid aControllerUid = KNullUid);
       
   200 	IMPORT_C void OpenFileL(const RFile& aFileName, TUid aControllerUid = KNullUid);
       
   201 
       
   202 	IMPORT_C void OpenFileL(const TMMSource& aSource, TUid aControllerUid = KNullUid);
       
   203 
       
   204 	IMPORT_C void OpenDesL(const TDesC8& aDescriptor,TUid aControllerUid = KNullUid);
       
   205 
       
   206 	IMPORT_C void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8, TUid aControllerUid = KNullUid);
       
   207 
       
   208 	IMPORT_C void Prepare();
       
   209 
       
   210 	IMPORT_C void Close();
       
   211 
       
   212 	IMPORT_C void Play();
       
   213 
       
   214 	IMPORT_C void Play(const TTimeIntervalMicroSeconds& aStartPoint, const TTimeIntervalMicroSeconds& aEndPoint);
       
   215 
       
   216 	IMPORT_C TInt Stop();
       
   217 
       
   218 	IMPORT_C void PauseL();
       
   219 
       
   220 	IMPORT_C void SetPriorityL(TInt aPriority, TMdaPriorityPreference aPref);
       
   221 
       
   222 	IMPORT_C void PriorityL(TInt& aPriority, TMdaPriorityPreference& aPref) const;
       
   223 
       
   224 	IMPORT_C void SetDisplayWindowL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,const TRect& aWindowRect,const TRect& aClipRect);
       
   225 
       
   226 	IMPORT_C void RegisterForVideoLoadingNotification(MVideoLoadingObserver& aCallback);
       
   227 
       
   228 	IMPORT_C void GetVideoLoadingProgressL(TInt& aPercentageComplete);
       
   229 
       
   230 	IMPORT_C void GetFrameL(TDisplayMode aDisplayMode);
       
   231 
       
   232 	IMPORT_C void GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent);
       
   233 
       
   234 	IMPORT_C void RefreshFrameL();
       
   235 
       
   236 	IMPORT_C TReal32 VideoFrameRateL() const;
       
   237 
       
   238 	IMPORT_C void SetVideoFrameRateL(TReal32 aFramesPerSecond);
       
   239 
       
   240 	IMPORT_C void VideoFrameSizeL(TSize& aSize) const;
       
   241 
       
   242 	IMPORT_C const TDesC8& VideoFormatMimeType() const;
       
   243 
       
   244 	IMPORT_C TInt VideoBitRateL() const;
       
   245 
       
   246 	IMPORT_C TInt AudioBitRateL() const;
       
   247 
       
   248 	IMPORT_C TFourCC AudioTypeL() const;
       
   249 
       
   250 	IMPORT_C TBool AudioEnabledL() const;
       
   251 
       
   252 	IMPORT_C void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
       
   253 
       
   254 	IMPORT_C TTimeIntervalMicroSeconds PositionL() const;
       
   255 
       
   256 	IMPORT_C TTimeIntervalMicroSeconds DurationL() const;
       
   257 
       
   258 	IMPORT_C void SetVolumeL(TInt aVolume);
       
   259 
       
   260 	IMPORT_C TInt Volume() const;
       
   261 
       
   262 	IMPORT_C TInt MaxVolume() const;
       
   263 
       
   264 	IMPORT_C void SetBalanceL(TInt aBalance);
       
   265 
       
   266 	IMPORT_C TInt Balance()const;
       
   267 
       
   268 	IMPORT_C void SetRotationL(TVideoRotation aRotation);
       
   269 
       
   270 	IMPORT_C TVideoRotation RotationL() const;
       
   271 
       
   272 	IMPORT_C void SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering);
       
   273 
       
   274 	IMPORT_C void GetScaleFactorL(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const;
       
   275 
       
   276 	IMPORT_C void SetCropRegionL(const TRect& aCropRegion);
       
   277 
       
   278 	IMPORT_C void GetCropRegionL(TRect& aCropRegion) const;
       
   279 
       
   280 	IMPORT_C TInt NumberOfMetaDataEntriesL() const;
       
   281 
       
   282 	IMPORT_C CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex) const;
       
   283 
       
   284 	IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
       
   285 
       
   286 	IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
       
   287 
       
   288 	IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
       
   289 
       
   290 	IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
       
   291 
       
   292 	IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
       
   293 
       
   294 	IMPORT_C MMMFDRMCustomCommand* GetDRMCustomCommand();
       
   295 
       
   296 	IMPORT_C void StopDirectScreenAccessL();
       
   297 	
       
   298 	IMPORT_C void StartDirectScreenAccessL();
       
   299 
       
   300 	IMPORT_C TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8& aNotificationRegistrationData = KNullDesC8);
       
   301 
       
   302 	IMPORT_C TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId);
       
   303     
       
   304 	IMPORT_C TInt WillResumePlay();
       
   305 	
       
   306 	IMPORT_C TInt SetInitScreenNumber(TInt aScreenNumber);
       
   307 
       
   308 	// SetPlayVelocityL() is publishedPartner and prototype as it is not yet used by licensees,
       
   309 	// and there is a possibility that it may change on licensee request for a short period.
       
   310 	// It will eventually be moved to publishedAll and released.
       
   311 	IMPORT_C void SetPlayVelocityL(TInt aVelocity);
       
   312 
       
   313 	// PlayVelocityL() is publishedPartner and prototype as it is not yet used by licensees,
       
   314 	// and there is a possibility that it may change on licensee request for a short period.
       
   315 	// It will eventually be moved to publishedAll and released.
       
   316 	IMPORT_C TInt PlayVelocityL() const;
       
   317 
       
   318 	// StepFrameL() is publishedPartner and prototype as it is not yet used by licensees,
       
   319 	// and there is a possibility that it may change on licensee request for a short period.
       
   320 	// It will eventually be moved to publishedAll and released.
       
   321 	IMPORT_C void StepFrameL(TInt aStep);
       
   322 	
       
   323 	// GetPlayRateCapabilitiesL() is publishedPartner and prototype as it is not yet used by licensees,
       
   324 	// and there is a possibility that it may change on licensee request for a short period.
       
   325 	// It will eventually be moved to publishedAll and released.
       
   326 	IMPORT_C void GetPlayRateCapabilitiesL(TVideoPlayRateCapabilities& aCapabilities) const;
       
   327 	
       
   328 	// SetVideoEnabledL() is publishedPartner and prototype as it is not yet used by licensees,
       
   329 	// and there is a possibility that it may change on licensee request for a short period.
       
   330 	// It will eventually be moved to publishedAll and released.
       
   331 	IMPORT_C void SetVideoEnabledL(TBool aVideoEnabled);
       
   332 
       
   333 	// VideoEnabledL() is publishedPartner and prototype as it is not yet used by licensees,
       
   334 	// and there is a possibility that it may change on licensee request for a short period.
       
   335 	// It will eventually be moved to publishedAll and released.
       
   336 	IMPORT_C TBool VideoEnabledL() const;
       
   337 
       
   338 	// SetAudioEnabledL() is publishedPartner and prototype as it is not yet used by licensees,
       
   339 	// and there is a possibility that it may change on licensee request for a short period.
       
   340 	// It will eventually be moved to publishedAll and released.
       
   341 	IMPORT_C void SetAudioEnabledL(TBool aAudioEnabled);
       
   342 
       
   343 	// SetAutoScaleL() is publishedPartner and prototype as it is not yet used by licensees,
       
   344 	// and there is a possibility that it may change on licensee request for a short period.
       
   345 	// It will eventually be moved to publishedAll and released.
       
   346 	IMPORT_C void SetAutoScaleL(TAutoScaleType aScaleType);
       
   347 
       
   348 	// SetAutoScaleL() is publishedPartner and prototype as it is not yet used by licensees,
       
   349 	// and there is a possibility that it may change on licensee request for a short period.
       
   350 	// It will eventually be moved to publishedAll and released.
       
   351 	IMPORT_C void SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos);	
       
   352 private:
       
   353 	enum TMMFVideoPlayerState
       
   354 		{
       
   355 		EStopped,
       
   356 		EOpening,
       
   357 		EPaused,
       
   358 		EPlaying		
       
   359 		};
       
   360 
       
   361 private:
       
   362 	CBody* iBody;
       
   363 
       
   364 	friend class CBody;
       
   365 	friend class CTestStepUnitMMFVidClient;
       
   366 public:
       
   367 	class CTestView;
       
   368 	friend class CTestView;
       
   369 	};
       
   370 
       
   371 #endif