1 /* This file is part of the KDE project. |
|
2 |
|
3 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
|
5 This library is free software: you can redistribute it and/or modify |
|
6 it under the terms of the GNU Lesser General Public License as published by |
|
7 the Free Software Foundation, either version 2.1 or 3 of the License. |
|
8 |
|
9 This library is distributed in the hope that it will be useful, |
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 GNU Lesser General Public License for more details. |
|
13 |
|
14 You should have received a copy of the GNU Lesser General Public License |
|
15 along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
|
17 */ |
|
18 |
|
19 #ifndef PHONON_MMF_VIDEOPLAYER_H |
|
20 #define PHONON_MMF_VIDEOPLAYER_H |
|
21 |
|
22 #include <videoplayer.h> // from epoc32/include |
|
23 |
|
24 #include "abstractmediaplayer.h" |
|
25 #include "videooutput.h" |
|
26 |
|
27 QT_BEGIN_NAMESPACE |
|
28 |
|
29 namespace Phonon |
|
30 { |
|
31 namespace MMF |
|
32 { |
|
33 /** |
|
34 * @short Wrapper over MMF video client utility |
|
35 * |
|
36 * See |
|
37 * <a href="http://wiki.forum.nokia.com/index.php/How_to_play_a_video_file_using_CVideoPlayerUtility">How to |
|
38 * play a video file using CVideoPlayerUtility</a> |
|
39 */ |
|
40 class VideoPlayer : public AbstractMediaPlayer |
|
41 , public MVideoPlayerUtilityObserver |
|
42 , public MVideoLoadingObserver |
|
43 { |
|
44 Q_OBJECT |
|
45 |
|
46 public: |
|
47 VideoPlayer(MediaObject *parent = 0, const AbstractPlayer *player = 0); |
|
48 virtual ~VideoPlayer(); |
|
49 |
|
50 typedef CVideoPlayerUtility NativePlayer; |
|
51 NativePlayer *nativePlayer() const; |
|
52 |
|
53 // AbstractPlayer |
|
54 virtual void doPlay(); |
|
55 virtual void doPause(); |
|
56 virtual void doStop(); |
|
57 virtual void doSeek(qint64 milliseconds); |
|
58 virtual int setDeviceVolume(int mmfVolume); |
|
59 virtual int openFile(RFile& file); |
|
60 virtual int openUrl(const QString& url); |
|
61 virtual int bufferStatus() const; |
|
62 virtual void close(); |
|
63 |
|
64 // MediaObjectInterface |
|
65 virtual bool hasVideo() const; |
|
66 virtual qint64 currentTime() const; |
|
67 virtual qint64 totalTime() const; |
|
68 |
|
69 // AbstractPlayer |
|
70 virtual void videoOutputChanged(); |
|
71 |
|
72 // AbstractMediaPlayer |
|
73 virtual int numberOfMetaDataEntries() const; |
|
74 virtual QPair<QString, QString> metaDataEntry(int index) const; |
|
75 |
|
76 public Q_SLOTS: |
|
77 void videoWindowChanged(); |
|
78 void aspectRatioChanged(); |
|
79 void scaleModeChanged(); |
|
80 void suspendDirectScreenAccess(); |
|
81 void resumeDirectScreenAccess(); |
|
82 |
|
83 private: |
|
84 void construct(); |
|
85 |
|
86 void doPrepareCompleteL(TInt aError); |
|
87 |
|
88 void getVideoWindow(); |
|
89 void initVideoOutput(); |
|
90 void updateVideoRect(); |
|
91 |
|
92 void applyPendingChanges(); |
|
93 void applyVideoWindowChange(); |
|
94 |
|
95 void startDirectScreenAccess(); |
|
96 bool stopDirectScreenAccess(); |
|
97 |
|
98 private: |
|
99 // MVideoPlayerUtilityObserver |
|
100 virtual void MvpuoOpenComplete(TInt aError); |
|
101 virtual void MvpuoPrepareComplete(TInt aError); |
|
102 virtual void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError); |
|
103 virtual void MvpuoPlayComplete(TInt aError); |
|
104 virtual void MvpuoEvent(const TMMFEvent &aEvent); |
|
105 |
|
106 // MVideoLoadingObserver |
|
107 virtual void MvloLoadingStarted(); |
|
108 virtual void MvloLoadingComplete(); |
|
109 |
|
110 private: |
|
111 QScopedPointer<NativePlayer> m_player; |
|
112 |
|
113 // Not owned |
|
114 RWsSession& m_wsSession; |
|
115 CWsScreenDevice& m_screenDevice; |
|
116 RWindowBase* m_window; |
|
117 |
|
118 /* Extent of the video display - will be clipped to m_windowRect */ |
|
119 TRect m_videoRect; |
|
120 |
|
121 TReal32 m_scaleWidth; |
|
122 TReal32 m_scaleHeight; |
|
123 |
|
124 QSize m_videoFrameSize; |
|
125 qint64 m_totalTime; |
|
126 |
|
127 bool m_pendingChanges; |
|
128 bool m_dsaActive; |
|
129 bool m_dsaWasActive; |
|
130 |
|
131 }; |
|
132 |
|
133 } |
|
134 } |
|
135 |
|
136 QT_END_NAMESPACE |
|
137 |
|
138 #endif |
|