~ubuntu-branches/ubuntu/quantal/qtmobility/quantal

« back to all changes in this revision

Viewing changes to plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-11-16 16:18:07 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20101116161807-k2dzt2nyse975r3l
Tags: 1.1.0-0ubuntu1
* New upstream release
* Syncronise with Debian, no remaining changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
**
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.
15
15
**
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.
35
35
**
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.
41
 
**
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$
47
41
#ifndef S60CAMERAVIEWFINDERENGINE_H
48
42
#define S60CAMERAVIEWFINDERENGINE_H
49
43
 
50
 
#include <QtCore/qobject.h>
51
44
#include <QtCore/qsize.h>
52
45
#include <QtGui/qpixmap.h>
53
46
 
56
49
#include "s60cameraengineobserver.h"
57
50
 
58
51
class CCameraEngine;
 
52
class S60CameraControl;
59
53
class QAbstractVideoSurface;
60
 
#ifdef SYMBIAN_3_PLATFORM
 
54
 
 
55
// For DirectScreen ViewFinder
61
56
class RWsSession;
62
57
class CWsScreenDevice;
63
58
class RWindowBase;
64
 
#endif // SYMBIAN_3_PLATFORM
 
59
class QDesktopWidget;
65
60
 
66
 
class CCameraViewfinderEngine : public QObject, public MCameraViewfinderObserver
 
61
/*
 
62
 * Class implementing video output selection for the viewfinder and the handler of
 
63
 * all common viewfinder operations.
 
64
 */
 
65
class S60CameraViewfinderEngine : public QObject, public MCameraViewfinderObserver
67
66
{
68
67
    Q_OBJECT
69
68
 
70
69
public: // Constructor & Destructor
71
70
 
72
 
    CCameraViewfinderEngine(QObject *parent, CCameraEngine *engine);
73
 
    virtual ~CCameraViewfinderEngine();
 
71
    S60CameraViewfinderEngine(QObject *parent, CCameraEngine *engine);
 
72
    virtual ~S60CameraViewfinderEngine();
74
73
 
75
74
public: // Methods
76
75
 
80
79
    void setVideoWindowControl(QObject *viewfinderOutput);
81
80
 
82
81
    // Controls
83
 
    void startViewfinderL();
84
 
    void stopViewfinder();
85
 
 
86
 
protected: // MCameraViewfinderObserver
 
82
    void startViewfinder(const bool internalStart = false);
 
83
    void stopViewfinder(const bool internalStop = false);
 
84
 
 
85
    // Start using new CameraEngine
 
86
    void setNewCameraEngine(CCameraEngine *engine);
 
87
 
 
88
protected: // MCameraViewfinderObserver (Bitmap ViewFinder)
87
89
 
88
90
    void MceoViewFinderFrameReady(CFbsBitmap& aFrame);
89
91
 
 
92
private: // Internal operation
 
93
 
 
94
    void checkAndRotateCamera();
 
95
 
90
96
Q_SIGNALS:
91
97
 
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);
100
108
 
101
109
private: // Enums
102
110
 
 
111
    /*
 
112
     * Defines whether viewfinder output backend control is of type
 
113
     * QVideoWidgetControl, QVideoRendererControl or QVideoWindowControl
 
114
     */
103
115
    enum ViewfinderOutputType {
104
 
        OutputTypeNotSet = 0,
105
 
        OutputTypeVideoWidget,
106
 
        OutputTypeRenderer,
107
 
        OutputTypevideoWindow
 
116
        OutputTypeNotSet = 0,   // No viewfinder output connected
 
117
        OutputTypeVideoWidget,  // Using QVideoWidget
 
118
        OutputTypeRenderer,     // Using QGraphicsVideoItem
 
119
        OutputTypevideoWindow   // Using QVideoWindow
 
120
    };
 
121
 
 
122
    /*
 
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).
 
126
     */
 
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
 
133
    };
 
134
 
 
135
    /*
 
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.
 
139
     */
 
140
    enum NativeViewFinderType {
 
141
        EBitmapViewFinder = 0,
 
142
        EDirectScreenViewFinder
108
143
    };
109
144
 
110
145
private: // Data
111
146
 
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;
123
166
};
124
167
 
125
168
#endif // S60CAMERAVIEWFINDERENGINE_H