9
9
** $QT_BEGIN_LICENSE:LGPL$
10
10
** Commercial Usage
11
** Licensees holding valid Qt Commercial licenses may use this file in
12
** accordance with the Qt Solutions Commercial License Agreement provided
13
** with the Software or, alternatively, in accordance with the terms
11
** Licensees holding valid Qt Commercial licenses may use this file in
12
** accordance with the Qt Commercial License Agreement provided with
13
** the Software or, alternatively, in accordance with the terms
14
14
** contained in a written agreement between you and Nokia.
16
16
** GNU Lesser General Public License Usage
33
33
** ensure the GNU General Public License version 3.0 requirements will be
34
34
** met: http://www.gnu.org/copyleft/gpl.html.
36
** Please note Third Party Software included with Qt Solutions may impose
37
** additional restrictions and it is the user's responsibility to ensure
38
** that they have met the licensing requirements of the GPL, LGPL, or Qt
39
** Solutions Commercial license and the relevant license of the Third
40
** Party Software they are using.
42
36
** If you are unsure which license is appropriate for your use, please
43
37
** contact the sales department at qt-sales@nokia.com.
44
38
** $QT_END_LICENSE$
56
49
#include "s60cameraengineobserver.h"
58
51
class CCameraEngine;
52
class S60CameraControl;
59
53
class QAbstractVideoSurface;
60
#ifdef SYMBIAN_3_PLATFORM
55
// For DirectScreen ViewFinder
62
57
class CWsScreenDevice;
64
#endif // SYMBIAN_3_PLATFORM
66
class CCameraViewfinderEngine : public QObject, public MCameraViewfinderObserver
62
* Class implementing video output selection for the viewfinder and the handler of
63
* all common viewfinder operations.
65
class S60CameraViewfinderEngine : public QObject, public MCameraViewfinderObserver
70
69
public: // Constructor & Destructor
72
CCameraViewfinderEngine(QObject *parent, CCameraEngine *engine);
73
virtual ~CCameraViewfinderEngine();
71
S60CameraViewfinderEngine(QObject *parent, CCameraEngine *engine);
72
virtual ~S60CameraViewfinderEngine();
80
79
void setVideoWindowControl(QObject *viewfinderOutput);
83
void startViewfinderL();
84
void stopViewfinder();
86
protected: // MCameraViewfinderObserver
82
void startViewfinder(const bool internalStart = false);
83
void stopViewfinder(const bool internalStop = false);
85
// Start using new CameraEngine
86
void setNewCameraEngine(CCameraEngine *engine);
88
protected: // MCameraViewfinderObserver (Bitmap ViewFinder)
88
90
void MceoViewFinderFrameReady(CFbsBitmap& aFrame);
92
private: // Internal operation
94
void checkAndRotateCamera();
92
98
void error(int error, const QString &errorString);
97
103
void resetViewfinderSize(QSize size);
98
104
void resetViewfinderDisplay();
99
105
void viewFinderBitmapReady(const QPixmap &pixmap);
106
void handleVisibilityChange(const bool isVisible);
107
void handleDesktopResize(int screen);
101
109
private: // Enums
112
* Defines whether viewfinder output backend control is of type
113
* QVideoWidgetControl, QVideoRendererControl or QVideoWindowControl
103
115
enum ViewfinderOutputType {
104
OutputTypeNotSet = 0,
105
OutputTypeVideoWidget,
107
OutputTypevideoWindow
116
OutputTypeNotSet = 0, // No viewfinder output connected
117
OutputTypeVideoWidget, // Using QVideoWidget
118
OutputTypeRenderer, // Using QGraphicsVideoItem
119
OutputTypevideoWindow // Using QVideoWindow
123
* Defines the internal state of the viewfinder. ViewFinder will only be
124
* started if output is connected to Camera and Camera is started (and
125
* ViewFinder widget is visible in case of QVideoWidget).
127
enum ViewFinderState {
128
EVFNotConnectedNotStarted = 0, // 0 - No output connected, viewfinder is not started
129
EVFNotConnectedIsStarted, // 1 - No output connected, viewfinder is started
130
EVFIsConnectedNotStarted, // 2 - Output is connected, viewfinder is not started
131
EVFIsConnectedIsStartedNotVisible, // 3 - Output is connected, viewfinder is started but is not visible
132
EVFIsConnectedIsStartedIsVisible // 4 - Output is connected, viewfinder is started and is visible
136
* The native type of ViewFinder. DirectScreen ViewFinder is used with
137
* QVideoWidget if support for it is available in the platform. For
138
* QGraphicsVideoItem Bitmap ViewFinder is always used.
140
enum NativeViewFinderType {
141
EBitmapViewFinder = 0,
142
EDirectScreenViewFinder
112
147
CCameraEngine *m_cameraEngine;
148
S60CameraControl *m_cameraControl;
113
149
QObject *m_viewfinderOutput;
114
150
QAbstractVideoSurface *m_viewfinderSurface; // Used only by QVideoRendererControl
115
#ifdef SYMBIAN_3_PLATFORM
116
151
RWsSession &m_wsSession;
117
152
CWsScreenDevice &m_screenDevice;
118
153
RWindowBase *m_window;
119
#endif // SYMBIAN_3_PLATFORM
154
QDesktopWidget *m_desktopWidget;
155
ViewFinderState m_vfState;
120
156
QSize m_viewfinderSize;
157
// Actual viewfinder size, which may differ from requested
158
// (m_viewfinderSize), if the size/aspect ratio was not supported.
159
QSize m_actualViewFinderSize;
121
160
ViewfinderOutputType m_viewfinderType;
161
NativeViewFinderType m_viewfinderNativeType;
122
162
QVideoSurfaceFormat m_surfaceFormat; // Used only by QVideoRendererControl
163
bool m_isViewFinderVisible;
164
bool m_uiLandscape; // For detecting UI rotation
165
int m_vfErrorsSignalled;
125
168
#endif // S60CAMERAVIEWFINDERENGINE_H