sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __VIDEOPLAYER_H__ sl@0: #define __VIDEOPLAYER_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "mmf/common/mmcaf.h" sl@0: #include sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: An interface to a set of video player callback functions. sl@0: sl@0: The class is a mixin and is intended to be inherited by the client sl@0: class which is observing the video playing operation. The functions sl@0: encapsulated by this class are called when specific events occur in sl@0: the process of initialising and playing an video clip. A reference to sl@0: this object is passed as a parameter when constructing an audio player sl@0: utility object. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class MVideoPlayerUtilityObserver sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Notification to the client that the opening of the video clip has completed, sl@0: successfully, or otherwise. sl@0: sl@0: The status of the video sample after opening is given by aError. The following sl@0: values imply same across all the devices. sl@0: sl@0: - KErrNone: the sample is ready to play; sl@0: - KErrNotSupported: the controller plugin is not recognised or not supported; sl@0: - KErrNotFound: the video sample cannot be found; sl@0: - KErrNoMemory: there is insufficient memory to play this video sample. sl@0: sl@0: Other values are possible indicating a problem opening the video sample. These values sl@0: are device dependent. sl@0: sl@0: The client must now call Prepare() on the video player utility before the sl@0: video clip can be played or any of its properties (e.g. duration) can be sl@0: queried. sl@0: sl@0: @param aError sl@0: The status of the video player after initialisation. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void MvpuoOpenComplete(TInt aError) = 0; sl@0: sl@0: /** sl@0: Notification to the client that the opening of the video clip has been prepared sl@0: successfully, or otherwise. This callback is called in response to a call to sl@0: CVideoPlayerUtility::Prepare(). sl@0: sl@0: The video clip may now be played, or have any of its properties (e.g. duration) queried. sl@0: sl@0: @param aError sl@0: The status of the video player after initialisation. sl@0: This is either KErrNone if the open has completed successfully, sl@0: or one of the system wide error codes. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void MvpuoPrepareComplete(TInt aError) = 0; sl@0: sl@0: /** sl@0: Notification that the frame requested by a call to GetFrameL is ready sl@0: sl@0: @param aFrame sl@0: The returned frame. The bitmap will contain sl@0: the requested frame if the the error code is KErrNone (success). sl@0: @param aError sl@0: The status of the frame request. sl@0: This is either KErrNone if the frame request was successful, sl@0: or one of the system wide error codes. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void MvpuoFrameReady(CFbsBitmap& aFrame,TInt aError) = 0; sl@0: sl@0: /** sl@0: Notification that video playback has completed. This is not called if sl@0: playback is explicitly stopped (such as through the use of the Stop or sl@0: Close commands). sl@0: sl@0: @param aError sl@0: The status of playback. sl@0: This is either KErrNone if the playback was completed successfully, sl@0: or one of the system wide error codes. sl@0: @since 7.0s sl@0: */ sl@0: virtual void MvpuoPlayComplete(TInt aError) = 0; sl@0: sl@0: /** sl@0: General event notification from controller. These events are specified by sl@0: the supplier of the controller sl@0: sl@0: @param aEvent sl@0: The event sent by the controller. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void MvpuoEvent(const TMMFEvent& aEvent) = 0; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: This is a mixin class that allows a client to receive notification of rebuffering sl@0: operations occurring in the video player sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class MVideoLoadingObserver sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Notification that video clip loading/rebuffering has started sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void MvloLoadingStarted() = 0; sl@0: sl@0: /** sl@0: Notification that video clip loading/rebuffering has completed sl@0: sl@0: @since 7.0s sl@0: */ sl@0: virtual void MvloLoadingComplete() = 0; sl@0: }; sl@0: sl@0: class CMMFVideoPlayerCallback; sl@0: class CVideoPlayerUtility2; sl@0: class TVideoPlayRateCapabilities; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Plays sampled video data. sl@0: sl@0: The class offers a simple interface to open, play and obtain information from sampled video data. sl@0: The video data can be provided using files, descriptors or URLs. sl@0: sl@0: Note: sl@0: Some video formats also allow the storing of audio data. To accommodate this, this class contains sl@0: audio functions that can manipulate such data. sl@0: sl@0: While this class is abstract, NewL() constructs, initialises and returns pointers to instances of sl@0: concrete classes derived from this abstract class. This concrete class is part of the MMF sl@0: implementation and is private. sl@0: sl@0: @since 7.0s sl@0: */ sl@0: class CVideoPlayerUtility : public CBase, sl@0: public MMMFClientUtility sl@0: { sl@0: public: sl@0: sl@0: ~CVideoPlayerUtility(); sl@0: sl@0: IMPORT_C static CVideoPlayerUtility* NewL(MVideoPlayerUtilityObserver& aObserver, sl@0: TInt aPriority, sl@0: TInt aPref, sl@0: RWsSession& aWs, sl@0: CWsScreenDevice& aScreenDevice, sl@0: RWindowBase& aWindow, sl@0: const TRect& aScreenRect, sl@0: const TRect& aClipRect); sl@0: sl@0: IMPORT_C void OpenFileL(const TDesC& aFileName,TUid aControllerUid = KNullUid); sl@0: IMPORT_C void OpenFileL(const RFile& aFileName, TUid aControllerUid = KNullUid); sl@0: sl@0: IMPORT_C void OpenFileL(const TMMSource& aSource, TUid aControllerUid = KNullUid); sl@0: sl@0: IMPORT_C void OpenDesL(const TDesC8& aDescriptor,TUid aControllerUid = KNullUid); sl@0: sl@0: IMPORT_C void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8, TUid aControllerUid = KNullUid); sl@0: sl@0: IMPORT_C void Prepare(); sl@0: sl@0: IMPORT_C void Close(); sl@0: sl@0: IMPORT_C void Play(); sl@0: sl@0: IMPORT_C void Play(const TTimeIntervalMicroSeconds& aStartPoint, const TTimeIntervalMicroSeconds& aEndPoint); sl@0: sl@0: IMPORT_C TInt Stop(); sl@0: sl@0: IMPORT_C void PauseL(); sl@0: sl@0: IMPORT_C void SetPriorityL(TInt aPriority, TInt aPref); sl@0: sl@0: IMPORT_C void PriorityL(TInt& aPriority, TMdaPriorityPreference& aPref) const; sl@0: sl@0: IMPORT_C void SetDisplayWindowL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,const TRect& aWindowRect,const TRect& aClipRect); sl@0: sl@0: IMPORT_C void RegisterForVideoLoadingNotification(MVideoLoadingObserver& aCallback); sl@0: sl@0: IMPORT_C void GetVideoLoadingProgressL(TInt& aPercentageComplete); sl@0: sl@0: IMPORT_C void GetFrameL(TDisplayMode aDisplayMode); sl@0: sl@0: IMPORT_C void GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent); sl@0: sl@0: IMPORT_C void RefreshFrameL(); sl@0: sl@0: IMPORT_C TReal32 VideoFrameRateL() const; sl@0: sl@0: IMPORT_C void SetVideoFrameRateL(TReal32 aFramesPerSecond); sl@0: sl@0: IMPORT_C void VideoFrameSizeL(TSize& aSize) const; sl@0: sl@0: IMPORT_C const TDesC8& VideoFormatMimeType() const; sl@0: sl@0: IMPORT_C TInt VideoBitRateL() const; sl@0: sl@0: IMPORT_C TInt AudioBitRateL() const; sl@0: sl@0: IMPORT_C TFourCC AudioTypeL() const; sl@0: sl@0: IMPORT_C TBool AudioEnabledL() const; sl@0: sl@0: IMPORT_C void SetPositionL(const TTimeIntervalMicroSeconds& aPosition); sl@0: sl@0: IMPORT_C TTimeIntervalMicroSeconds PositionL() const; sl@0: sl@0: IMPORT_C TTimeIntervalMicroSeconds DurationL() const; sl@0: sl@0: IMPORT_C void SetVolumeL(TInt aVolume); sl@0: sl@0: IMPORT_C TInt Volume() const; sl@0: sl@0: IMPORT_C TInt MaxVolume() const; sl@0: sl@0: IMPORT_C void SetBalanceL(TInt aBalance); sl@0: sl@0: IMPORT_C TInt Balance()const; sl@0: sl@0: IMPORT_C void SetRotationL(TVideoRotation aRotation); sl@0: sl@0: IMPORT_C TVideoRotation RotationL() const; sl@0: sl@0: IMPORT_C void SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering); sl@0: sl@0: IMPORT_C void GetScaleFactorL(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const; sl@0: sl@0: IMPORT_C void SetCropRegionL(const TRect& aCropRegion); sl@0: sl@0: IMPORT_C void GetCropRegionL(TRect& aCropRegion) const; sl@0: sl@0: IMPORT_C TInt NumberOfMetaDataEntriesL() const; sl@0: sl@0: IMPORT_C CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex) const; sl@0: sl@0: IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); sl@0: sl@0: IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); sl@0: sl@0: IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); sl@0: sl@0: IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); sl@0: sl@0: IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); sl@0: sl@0: IMPORT_C MMMFDRMCustomCommand* GetDRMCustomCommand(); sl@0: sl@0: IMPORT_C void StopDirectScreenAccessL(); sl@0: sl@0: IMPORT_C void StartDirectScreenAccessL(); sl@0: sl@0: IMPORT_C TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8& aNotificationRegistrationData = KNullDesC8); sl@0: sl@0: IMPORT_C TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId); sl@0: sl@0: IMPORT_C TInt WillResumePlay(); sl@0: sl@0: IMPORT_C TInt SetInitScreenNumber(TInt aScreenNumber); sl@0: sl@0: IMPORT_C void SetPlayVelocityL(TInt aVelocity); sl@0: sl@0: IMPORT_C TInt PlayVelocityL() const; sl@0: sl@0: IMPORT_C void StepFrameL(TInt aStep); sl@0: sl@0: IMPORT_C void GetPlayRateCapabilitiesL(TVideoPlayRateCapabilities& aCapabilities) const; sl@0: sl@0: IMPORT_C void SetVideoEnabledL(TBool aVideoEnabled); sl@0: sl@0: IMPORT_C TBool VideoEnabledL() const; sl@0: sl@0: IMPORT_C void SetAudioEnabledL(TBool aAudioEnabled); sl@0: sl@0: IMPORT_C void SetAutoScaleL(TAutoScaleType aScaleType); sl@0: sl@0: IMPORT_C void SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos); sl@0: sl@0: IMPORT_C void SetExternalDisplaySwitchingL(TInt aDisplay, TBool aControl); sl@0: sl@0: private: sl@0: class CBody; sl@0: sl@0: CBody* iBody; sl@0: sl@0: friend class CBody; sl@0: friend class CVideoPlayerUtility2; sl@0: private: sl@0: enum TMMFVideoPlayerState sl@0: { sl@0: EStopped, sl@0: EOpening, sl@0: EPaused, sl@0: EPlaying sl@0: }; sl@0: private: sl@0: friend class CTestStepUnitMMFVidClient; sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: friend class CMediaClientVideoDisplayBody; sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: public: sl@0: class CTestView; sl@0: friend class CTestView; sl@0: }; sl@0: sl@0: sl@0: #endif