sl@0: // Copyright (c) 2002-2010 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 VIDEOPLAYERBODY_H sl@0: #define VIDEOPLAYERBODY_H sl@0: sl@0: #include sl@0: #include sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: #include sl@0: #endif 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 "mmf/common/mmcaf.h" sl@0: #include "mmfclientutility.h" sl@0: sl@0: #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: #include "mmfsubtitleutility.h" sl@0: #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: #include "mediaclientvideodisplaybody.h" sl@0: #endif sl@0: sl@0: class CMMFVideoPlayerCallback; sl@0: class MMMFDRMCustomCommand; sl@0: class CVideoPlayerUtility; sl@0: class MMMFSurfaceEventHandler; sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: class TWindowData; sl@0: class CMediaClientVideoDisplayBody; sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: NONSHARABLE_CLASS( CVideoPlayerUtility::CBody ): public CBase, sl@0: public MDirectScreenAccess, sl@0: public MMMFControllerEventMonitorObserver, sl@0: public MMMFFindAndOpenControllerObserver sl@0: sl@0: { sl@0: sl@0: public: sl@0: ~CBody(); sl@0: sl@0: static CBody* NewL(CVideoPlayerUtility* aParent, sl@0: 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: #ifdef SYMBIAN_BUILD_GCE sl@0: static CBody* NewL(CVideoPlayerUtility2* aParent, sl@0: MVideoPlayerUtilityObserver& aObserver, sl@0: TInt aPriority, sl@0: TInt aPref); sl@0: #endif sl@0: void OpenFileL(const TDesC& aFileName,TUid aControllerUid = KNullUid); sl@0: void OpenFileL(const RFile& aFile, TUid aControllerUid = KNullUid); sl@0: sl@0: sl@0: void OpenFileL(const TMMSource& aSource, TUid aControllerUid = KNullUid); sl@0: sl@0: void OpenDesL(const TDesC8& aDescriptor,TUid aControllerUid = KNullUid); sl@0: void OpenUrlL(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType=KNullDesC8, TUid aControllerUid = KNullUid); sl@0: sl@0: void Prepare(); sl@0: sl@0: void Close(); sl@0: sl@0: void Play(); sl@0: void Play(const TTimeIntervalMicroSeconds& aStartPoint, const TTimeIntervalMicroSeconds& aEndPoint); sl@0: TInt Stop(); sl@0: void PauseL(); sl@0: sl@0: void SetPriorityL(TInt aPriority, TInt aPref); sl@0: void PriorityL(TInt& aPriority, TMdaPriorityPreference& aPref) const; sl@0: sl@0: void SetDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, sl@0: const TRect& aScreenRect, const TRect& aClipRect); sl@0: sl@0: void RegisterForVideoLoadingNotification(MVideoLoadingObserver& aObserver); sl@0: sl@0: void GetFrameL(TDisplayMode aDisplayMode, TBool aUseIntentAPI = EFalse, ContentAccess::TIntent aIntent = ContentAccess::EPeek ); sl@0: void RefreshFrameL(); sl@0: sl@0: TReal32 VideoFrameRateL() const; sl@0: void VideoFrameSizeL(TSize& aSize) const; sl@0: const TDesC8& VideoFormatMimeType() const; sl@0: TInt VideoBitRateL() const; sl@0: sl@0: TInt AudioBitRateL() const; sl@0: TFourCC AudioTypeL() const; sl@0: TBool AudioEnabledL() const; sl@0: sl@0: void SetPositionL(const TTimeIntervalMicroSeconds& aPosition); sl@0: TTimeIntervalMicroSeconds PositionL() const; sl@0: TTimeIntervalMicroSeconds DurationL() const; sl@0: sl@0: void SetVolumeL(TInt aVolume); sl@0: TInt Volume() const; sl@0: TInt MaxVolume() const; sl@0: void SetBalanceL(TInt aBalance); sl@0: TInt Balance()const; sl@0: sl@0: void SetRotationL(TVideoRotation aRotation); sl@0: TVideoRotation RotationL() const; sl@0: void SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering); sl@0: void GetScaleFactorL(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const; sl@0: void SetCropRegionL(const TRect& aCropRegion); sl@0: void GetCropRegionL(TRect& aCropRegion) const; sl@0: sl@0: TInt NumberOfMetaDataEntriesL() const; sl@0: CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex) const; sl@0: sl@0: void GetVideoLoadingProgressL(TInt& aPercentageProgress); sl@0: TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); sl@0: TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); sl@0: void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); sl@0: void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); sl@0: sl@0: void SetVideoFrameRateL(TReal32 aFramesPerSecond); sl@0: const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); sl@0: sl@0: MMMFDRMCustomCommand* GetDRMCustomCommand(); sl@0: sl@0: void StopDirectScreenAccessL(); sl@0: void StartDirectScreenAccessL(); sl@0: sl@0: TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8& aNotificationRegistrationData = KNullDesC8); sl@0: TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId); sl@0: TInt WillResumePlay(); sl@0: sl@0: TInt SetInitScreenNumber(TInt aScreenNumber); sl@0: sl@0: void SetPlayVelocityL(TInt aVelocity); sl@0: TInt PlayVelocityL() const; sl@0: void StepFrameL(TInt aStep); sl@0: void GetPlayRateCapabilitiesL(TVideoPlayRateCapabilities& aCapabilities) const; sl@0: void SetVideoEnabledL(TBool aVideoEnabled); sl@0: TBool VideoEnabledL() const; sl@0: void SetAudioEnabledL(TBool aAudioEnabled); sl@0: void SetAutoScaleL(TAutoScaleType aScaleType); sl@0: void SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos); sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: void AddDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, sl@0: RWindow& aWindow, const TRect& aVideoExtent, sl@0: const TRect& aWindowClipRect); sl@0: void AddDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindow& aWindow); sl@0: void RemoveDisplayWindow(RWindowBase& aWindow); sl@0: void SetVideoExtentL(const RWindowBase& aWindow, const TRect& aVideoExtent); sl@0: void SetWindowClipRectL(const RWindowBase& aWindow, const TRect& aWindowClipRect); sl@0: sl@0: void SetAutoScaleL(const RWindowBase& aWindow, TAutoScaleType aScaleType); sl@0: void SetAutoScaleL(const RWindowBase& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos); sl@0: sl@0: void SetRotationL(const RWindowBase& aWindow, TVideoRotation aRotation); sl@0: TVideoRotation RotationL(const RWindowBase& aWindow) const; sl@0: void SetScaleFactorL(const RWindowBase& aWindow, TReal32 aWidthPercentage, TReal32 aHeightPercentage); sl@0: void GetScaleFactorL(const RWindowBase& aWindow, TReal32& aWidthPercentage, TReal32& aHeightPercentage) const; sl@0: void AddDisplayL(TInt aDisplay, MMMFSurfaceEventHandler& aEventHandler); sl@0: void RemoveDisplay(TInt aDisplay); sl@0: void ConvertFromRelativeToDisplayToRelativeToWindow( sl@0: const RWindowBase& aWindow, sl@0: const TRect& aFromWindowRect, sl@0: const TRect& aFromClipRect, sl@0: TRect& aToWindowRect, sl@0: TRect& aToClipRect); sl@0: void SetExternalDisplaySwitchingL(TInt aDisplay, TBool aControl); sl@0: #endif sl@0: sl@0: #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: TBool SubtitlesAvailable(); sl@0: void EnableSubtitlesL(); sl@0: void DisableSubtitles(); sl@0: TArray SupportedSubtitleLanguagesL(); sl@0: TLanguage SubtitleLanguageL(); sl@0: void SetSubtitleLanguageL(TLanguage aLanguage); sl@0: void RedrawSubtitle(RWindow& aWindow, const TRect &aRect); sl@0: static RWindow* FindWindowWithWsHandle(const RPointerArray& aDisplays, TInt aWsHandle); sl@0: TInt EnableSubtitles(CMediaClientVideoDisplayBody& aDisplay); sl@0: TInt AddSubtitleConfig(CMediaClientVideoDisplayBody::TWindowData& aWindowData); sl@0: void GetSubtitleConfigFromWindowData(CMediaClientVideoDisplayBody::TWindowData& aWindowData, TMMFSubtitleWindowConfig& aConfig); sl@0: #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: sl@0: private: sl@0: void ConstructL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow, sl@0: const TRect& aWindowRect, const TRect& aClipRect); sl@0: CBody(CVideoPlayerUtility* aParent, sl@0: MVideoPlayerUtilityObserver& aObserver, sl@0: TInt aScreenNumber, sl@0: TInt aPriority=EMdaPriorityNormal, sl@0: TInt aPref=EMdaPriorityPreferenceTimeAndQuality); sl@0: sl@0: void CommonConstructL(); sl@0: void SetAndUpdateWindow(); sl@0: void PrepareDSAL(RWsSession& aWs, CWsScreenDevice& aScreenDevice, RWindowBase& aWindow); sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: CBody(CVideoPlayerUtility2* aParent, sl@0: MVideoPlayerUtilityObserver& aObserver, sl@0: TInt aPriority=EMdaPriorityNormal, sl@0: TInt aPref=EMdaPriorityPreferenceTimeAndQuality); sl@0: sl@0: void ConstructL(); sl@0: TInt CheckSurfaceSupported(); sl@0: TBool RectContains(const TRect& aLeft, const TRect& aRight); sl@0: void DoAddDisplayWindowL(RWsSession& aWs, TInt aDisplay, RWindowBase& aWindow, sl@0: const TRect& aClipRect, const TRect& aVideoExtent, RWindow* aWindow2); sl@0: void DoUpdateDisplayWindowL(RWsSession& aWs, RWindowBase& aWindow, sl@0: const TRect& aClipRect, const TRect& aVideoExtent, RWindow* aWindow2); sl@0: TInt SurfaceCreated(); sl@0: TInt SurfaceParametersChanged(); sl@0: TInt RemoveSurface(TBool aControllerEvent); sl@0: TInt SetAllBackgroundSurfaces(); sl@0: sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: sl@0: // from MMMFControllerEventMonitorObserver sl@0: virtual void HandleEvent(const TMMFEvent& aEvent); sl@0: sl@0: //from MDirectScreenAccess sl@0: virtual void AbortNow(RDirectScreenAccess::TTerminationReasons aReason); sl@0: virtual void Restart(RDirectScreenAccess::TTerminationReasons aReason); sl@0: sl@0: // from MMMFFindAndOpenControllerObserver sl@0: virtual void MfaocComplete( sl@0: TInt& aError, sl@0: RMMFController* aController, sl@0: TUid aControllerUid, sl@0: TMMFMessageDestination* aSourceHandle, sl@0: TMMFMessageDestination* aSinkHandle); sl@0: sl@0: sl@0: void OpenComplete(TInt aError); sl@0: void FrameReady(TInt aError); sl@0: void PlayComplete(TInt aError); sl@0: void Reset(); sl@0: sl@0: private: sl@0: //Source and sink handle info sl@0: TMMFMessageDestination iSourceHandle; sl@0: TMMFMessageDestination iSinkHandle; sl@0: sl@0: RMMFController iController; sl@0: RMMFVideoControllerCustomCommands iVideoControllerCustomCommands; sl@0: RMMFVideoPlayControllerCustomCommands iVideoPlayControllerCustomCommands; sl@0: RMMFAudioPlayDeviceCustomCommands iAudioPlayDeviceCustomCommands; sl@0: RMMFAudioRecordDeviceCustomCommands iAudioRecordDeviceCustomCommands; sl@0: RMMFVideoDRMExtCustomCommands iVideoDRMExtCustomCommands; sl@0: RMMFDRMCustomCommands iDRMCustomCommands; sl@0: RMMFVideoPlayControllerExtCustomCommands iVideoPlayControllerExtCustomCommands; sl@0: RMMFResourceNotificationCustomCommands iNotificationRegistrationCommands; sl@0: MMMFAudioResourceNotificationCallback* iAudioResourceNotificationCallBack; sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: RMMFVideoPlaySurfaceSupportCustomCommands iVideoPlaySurfaceSupportCustomCommands; sl@0: #endif sl@0: //for audio resource notification sl@0: TUid iArnEventHolder; sl@0: TBuf8 iNotificationDataHolder; sl@0: sl@0: RMMFVideoSetInitScreenCustomCommands iVideoSetInitScreenCustomCommands; sl@0: MVideoPlayerUtilityObserver& iObserver; sl@0: CMMFControllerEventMonitor* iControllerEventMonitor; sl@0: CVideoPlayerUtility::TMMFVideoPlayerState iState; sl@0: TTimeIntervalMicroSeconds iDuration; sl@0: TMMFPrioritySettings iPrioritySettings; sl@0: sl@0: MVideoLoadingObserver *iVideoLoadingObserver; sl@0: CDirectScreenAccess * iDirectScreenAccess; sl@0: HBufC8* iMimeType; sl@0: CMMFVideoPlayerCallback* iAsyncCallback; sl@0: CMMFVideoPlayerCallback* iFrameCallback; sl@0: CMMFControllerImplementationInformation* iControllerImplementationInformation; sl@0: TUid iControllerUid; sl@0: sl@0: CVideoPlayerUtility* iParent; sl@0: CFbsBitmap* iFrameBitmap; sl@0: RFbsSession iFbsSession; sl@0: sl@0: TRect iWindowRect; sl@0: TRect iClipRect; sl@0: TBool iControllerOpen; sl@0: TBool iFbsSessionConnected; sl@0: sl@0: // utility class to find and open a suitable controller asynchronously sl@0: CMMFFindAndOpenController* iFindAndOpenController; sl@0: sl@0: // received a KMMFEventCategoryVideoOpenComplete event sl@0: TBool iEventOpenReceived; sl@0: sl@0: // received a MfaocComplete() callback sl@0: TBool iCallbackOpenReceived; sl@0: sl@0: TInt iOpenError; sl@0: TInt iScreenNumber; sl@0: sl@0: // flag indicating DSA abort in StopDirectScreenAccess() - to be used in SetDisplayWindowL sl@0: TBool iDirectScreenAccessAbort; sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: sl@0: TSurfaceId iSurfaceId; sl@0: sl@0: //video graphics surface supported sl@0: TBool iGraphicsSurfaceSupported; sl@0: TBool iUsingVPU2; sl@0: sl@0: // store scale factor sl@0: TReal32 iGlobalScaleWidth; sl@0: TReal32 iGlobalScaleHeight; sl@0: TBool iAntiAliasFiltering; sl@0: TRect iCropRegion; sl@0: TVideoRotation iGlobalRotation; sl@0: TRect iSurfaceCropRect; sl@0: TVideoAspectRatio iAspectRatio; sl@0: // for storing window added during NewL, sl@0: // i.e. DSA sl@0: RWsSession* iWs; sl@0: TInt iDisplayId; sl@0: RWindowBase* iWindow; sl@0: sl@0: RPointerArray iActiveDisplays; sl@0: sl@0: // Autoscale info sl@0: TAutoScaleType iGlobalAutoScaleType; sl@0: TInt iGlobalHorizPos; sl@0: TInt iGlobalVertPos; sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: sl@0: #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: CMMFSubtitleUtility* iSubtitleUtility; sl@0: #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: sl@0: friend class CMMFVideoPlayerCallback; sl@0: friend class CTestStepUnitMMFVidClient; sl@0: friend class CTestView; sl@0: friend class CVideoPlayerUtility; sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: friend class CVideoPlayerUtility2; sl@0: #endif sl@0: }; sl@0: sl@0: sl@0: #endif // VIDEOPLAYERBODY_H