source: trunk/src/3rdparty/phonon/mmf/abstractvideoplayer.h@ 769

Last change on this file since 769 was 769, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

File size: 5.5 KB
Line 
1/* This file is part of the KDE project.
2
3Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4
5This library is free software: you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation, either version 2.1 or 3 of the License.
8
9This library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU Lesser General Public License for more details.
13
14You should have received a copy of the GNU Lesser General Public License
15along with this library. If not, see <http://www.gnu.org/licenses/>.
16
17*/
18
19#ifndef PHONON_MMF_ABSTRACTVIDEOPLAYER_H
20#define PHONON_MMF_ABSTRACTVIDEOPLAYER_H
21
22#include <videoplayer.h> // from epoc32/include
23
24#include <QSize>
25
26#include "abstractmediaplayer.h"
27#include "abstractvideooutput.h"
28#include "defs.h"
29
30QT_BEGIN_NAMESPACE
31
32namespace Phonon
33{
34namespace MMF
35{
36/**
37 * @short ABC for classes which wrap the MMF video player utility
38 *
39 * On devices which use the legacy graphics subsystem which does not
40 * support surfaces, video rendering is done via Direct Screen Access using
41 * the CVideoPlayerUtility API. On devices with a graphics subsystem which
42 * does support surfaces, video rendering is done using the
43 * CVideoPlayerUtility2 API. Because CVideoPlayerUtility2 inherits from
44 * CVideoPlayerUtility, AbstractVideoPlayer holds a pointer to the latter.
45 *
46 * @see DsaVideoPlayer, SurfaceVideoPlayer
47 */
48class AbstractVideoPlayer
49 : public AbstractMediaPlayer
50 , public MVideoPlayerUtilityObserver
51 , public MVideoLoadingObserver
52{
53 Q_OBJECT
54
55public:
56 ~AbstractVideoPlayer();
57
58 typedef CVideoPlayerUtility NativePlayer;
59 NativePlayer *nativePlayer() const;
60
61 // AbstractPlayer
62 virtual void doPlay();
63 virtual void doPause();
64 virtual void doStop();
65 virtual void doSeek(qint64 milliseconds);
66 virtual int setDeviceVolume(int mmfVolume);
67 virtual int openFile(RFile &file);
68 virtual int openUrl(const QString &url);
69 virtual int bufferStatus() const;
70 virtual void close();
71
72 // MediaObjectInterface
73 virtual bool hasVideo() const;
74 virtual qint64 currentTime() const;
75 virtual qint64 totalTime() const;
76
77 // AbstractPlayer
78 virtual void videoOutputChanged();
79
80 // AbstractMediaPlayer
81 virtual int numberOfMetaDataEntries() const;
82 virtual QPair<QString, QString> metaDataEntry(int index) const;
83
84public Q_SLOTS:
85 void videoWindowChanged();
86 void aspectRatioChanged();
87 void scaleModeChanged();
88
89protected:
90 AbstractVideoPlayer(MediaObject *parent, const AbstractPlayer *player);
91 void construct();
92 virtual void initVideoOutput();
93 void updateScaleFactors(const QSize &windowSize, bool apply = true);
94
95 // Called when a video parameter changes. If the underlying native API is
96 // ready to handle the change, it is propagated immediately, otherwise the
97 // change is recorded in m_pendingChanged and handled later by
98 // handlePendingParametersChanged().
99 void parametersChanged(VideoParameters parameter);
100
101 // Implementation must initialize the m_player pointer.
102 virtual void createPlayer() = 0;
103
104 // Called from the MvpuoPrepareComplete callback. Allows derived class to
105 // calculate clipping rectangles and scale factors prior to starting
106 // playback.
107 virtual void prepareCompleted() = 0;
108
109 // Called when native video window handle changes. Derived class may defer
110 // propagation of this change to the MMF video player utility by calling
111 // parametersChanged().
112 virtual void handleVideoWindowChanged() = 0;
113
114 // Called when the derived class must handle changes which have been made
115 // to video parameters such as window handle, screen rectangle and scale
116 // factors. Guaranteed to be called only when the underlying MMF video
117 // player object is ready to handle changes to these parameters.
118 virtual void handleParametersChanged(VideoParameters parameters) = 0;
119
120private:
121 void getVideoClipParametersL(TInt aError);
122
123 // Called when native player API enters a state in which it is able to
124 // handle pending changes such as new video window handle, updated scale
125 // factors etc.
126 void handlePendingParametersChanged();
127
128private:
129 // MVideoPlayerUtilityObserver
130 virtual void MvpuoOpenComplete(TInt aError);
131 virtual void MvpuoPrepareComplete(TInt aError);
132 virtual void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
133 virtual void MvpuoPlayComplete(TInt aError);
134 virtual void MvpuoEvent(const TMMFEvent &aEvent);
135
136 // MVideoLoadingObserver
137 virtual void MvloLoadingStarted();
138 virtual void MvloLoadingComplete();
139
140protected:
141 QScopedPointer<NativePlayer> m_player;
142
143 // Not owned
144 RWsSession& m_wsSession;
145 CWsScreenDevice& m_screenDevice;
146 RWindowBase* m_window;
147
148 // Scaling factors for video display, expressed as percentages
149 TReal32 m_scaleWidth;
150 TReal32 m_scaleHeight;
151
152 // Dimensions of the video clip
153 QSize m_videoFrameSize;
154
155private:
156 // Bitmask of parameters which have changed while the MMF video player
157 // object is not yet ready to receive these changes.
158 // See handlePendingParametersChanged().
159 VideoParameters m_pendingChanges;
160
161 // Duration of the video clip
162 qint64 m_totalTime;
163
164};
165
166}
167}
168
169QT_END_NAMESPACE
170
171#endif
Note: See TracBrowser for help on using the repository browser.