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

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

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

File size: 5.7 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(const QString &fileName);
68 virtual int openFile(RFile &file);
69 virtual int openUrl(const QString &url, int iap);
70 virtual int openDescriptor(const TDesC8 &des);
71 virtual int bufferStatus() const;
72 virtual void doClose();
73
74 // MediaObjectInterface
75 virtual bool hasVideo() const;
76 virtual qint64 totalTime() const;
77
78 // AbstractPlayer
79 virtual void videoOutputChanged();
80
81 // AbstractMediaPlayer
82 virtual qint64 getCurrentTime() const;
83 virtual int numberOfMetaDataEntries() const;
84 virtual QPair<QString, QString> metaDataEntry(int index) const;
85
86public Q_SLOTS:
87 void videoWindowChanged();
88 void aspectRatioChanged();
89 void scaleModeChanged();
90
91protected:
92 AbstractVideoPlayer(MediaObject *parent, const AbstractPlayer *player);
93 void construct();
94 virtual void initVideoOutput();
95 void updateScaleFactors(const QSize &windowSize, bool apply = true);
96
97 // Called when a video parameter changes. If the underlying native API is
98 // ready to handle the change, it is propagated immediately, otherwise the
99 // change is recorded in m_pendingChanged and handled later by
100 // handlePendingParametersChanged().
101 void parametersChanged(VideoParameters parameter);
102
103 // Implementation must initialize the m_player pointer.
104 virtual void createPlayer() = 0;
105
106 // Called from the MvpuoPrepareComplete callback. Allows derived class to
107 // calculate clipping rectangles and scale factors prior to starting
108 // playback.
109 virtual void prepareCompleted() = 0;
110
111 // Called when native video window handle changes. Derived class may defer
112 // propagation of this change to the MMF video player utility by calling
113 // parametersChanged().
114 virtual void handleVideoWindowChanged() = 0;
115
116 // Called when the derived class must handle changes which have been made
117 // to video parameters such as window handle, screen rectangle and scale
118 // factors. Guaranteed to be called only when the underlying MMF video
119 // player object is ready to handle changes to these parameters.
120 virtual void handleParametersChanged(VideoParameters parameters) = 0;
121
122private:
123 void getVideoClipParametersL(TInt aError);
124
125 // Called when native player API enters a state in which it is able to
126 // handle pending changes such as new video window handle, updated scale
127 // factors etc.
128 void handlePendingParametersChanged();
129
130private:
131 // MVideoPlayerUtilityObserver
132 virtual void MvpuoOpenComplete(TInt aError);
133 virtual void MvpuoPrepareComplete(TInt aError);
134 virtual void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
135 virtual void MvpuoPlayComplete(TInt aError);
136 virtual void MvpuoEvent(const TMMFEvent &aEvent);
137
138 // MVideoLoadingObserver
139 virtual void MvloLoadingStarted();
140 virtual void MvloLoadingComplete();
141
142protected:
143 QScopedPointer<NativePlayer> m_player;
144
145 // Not owned
146 RWsSession& m_wsSession;
147 CWsScreenDevice& m_screenDevice;
148 RWindowBase* m_window;
149
150 // Scaling factors for video display, expressed as percentages
151 TReal32 m_scaleWidth;
152 TReal32 m_scaleHeight;
153
154 // Dimensions of the video clip
155 QSize m_videoFrameSize;
156
157private:
158 // Bitmask of parameters which have changed while the MMF video player
159 // object is not yet ready to receive these changes.
160 // See handlePendingParametersChanged().
161 VideoParameters m_pendingChanges;
162
163 // Duration of the video clip
164 qint64 m_totalTime;
165
166};
167
168}
169}
170
171QT_END_NAMESPACE
172
173#endif
Note: See TracBrowser for help on using the repository browser.