equal
deleted
inserted
replaced
52 // |
52 // |
53 // We mean it. |
53 // We mean it. |
54 // |
54 // |
55 |
55 |
56 #include <qmobilityglobal.h> |
56 #include <qmobilityglobal.h> |
57 #include <qvideowidget.h> |
57 #include "qvideowidget.h" |
58 |
58 |
59 #ifndef QT_NO_OPENGL |
59 #ifndef QT_NO_OPENGL |
60 #include <QGLWidget> |
60 #include <QGLWidget> |
61 #endif |
61 #endif |
62 |
62 |
63 #include <qpaintervideosurface_p.h> |
63 #include "qpaintervideosurface_p.h" |
64 |
64 |
65 QTM_BEGIN_NAMESPACE |
65 QTM_BEGIN_NAMESPACE |
66 |
66 |
67 class QVideoWidgetControlInterface |
67 class QVideoWidgetControlInterface |
68 { |
68 { |
74 virtual void setHue(int hue) = 0; |
74 virtual void setHue(int hue) = 0; |
75 virtual void setSaturation(int saturation) = 0; |
75 virtual void setSaturation(int saturation) = 0; |
76 |
76 |
77 virtual void setFullScreen(bool fullScreen) = 0; |
77 virtual void setFullScreen(bool fullScreen) = 0; |
78 |
78 |
79 virtual QVideoWidget::AspectRatioMode aspectRatioMode() const = 0; |
79 virtual Qt::AspectRatioMode aspectRatioMode() const = 0; |
80 virtual void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) = 0; |
80 virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0; |
81 }; |
81 }; |
82 |
82 |
83 class QVideoWidgetBackend : public QObject, public QVideoWidgetControlInterface |
83 class QVideoWidgetBackend : public QObject, public QVideoWidgetControlInterface |
84 { |
84 { |
85 Q_OBJECT |
85 Q_OBJECT |
106 void setHue(int hue); |
106 void setHue(int hue); |
107 void setSaturation(int saturation); |
107 void setSaturation(int saturation); |
108 |
108 |
109 void setFullScreen(bool fullScreen); |
109 void setFullScreen(bool fullScreen); |
110 |
110 |
111 QVideoWidget::AspectRatioMode aspectRatioMode() const; |
111 Qt::AspectRatioMode aspectRatioMode() const; |
112 void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); |
112 void setAspectRatioMode(Qt::AspectRatioMode mode); |
113 |
113 |
114 private: |
114 private: |
115 QVideoWidgetControl *m_widgetControl; |
115 QVideoWidgetControl *m_widgetControl; |
116 }; |
116 }; |
117 |
117 |
132 void setHue(int hue); |
132 void setHue(int hue); |
133 void setSaturation(int saturation); |
133 void setSaturation(int saturation); |
134 |
134 |
135 void setFullScreen(bool fullScreen); |
135 void setFullScreen(bool fullScreen); |
136 |
136 |
137 QVideoWidget::AspectRatioMode aspectRatioMode() const; |
137 Qt::AspectRatioMode aspectRatioMode() const; |
138 void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); |
138 void setAspectRatioMode(Qt::AspectRatioMode mode); |
139 |
139 |
140 QSize sizeHint() const; |
140 QSize sizeHint() const; |
141 |
141 |
142 void showEvent(); |
142 void showEvent(); |
143 void hideEvent(QHideEvent *event); |
143 void hideEvent(QHideEvent *event); |
150 void brightnessChanged(int brightness); |
150 void brightnessChanged(int brightness); |
151 void contrastChanged(int contrast); |
151 void contrastChanged(int contrast); |
152 void hueChanged(int hue); |
152 void hueChanged(int hue); |
153 void saturationChanged(int saturation); |
153 void saturationChanged(int saturation); |
154 |
154 |
|
155 private Q_SLOTS: |
|
156 void formatChanged(const QVideoSurfaceFormat &format); |
|
157 void frameChanged(); |
|
158 |
155 private: |
159 private: |
156 QRect displayRect() const; |
160 void updateRects(); |
157 |
161 |
158 QVideoRendererControl *m_rendererControl; |
162 QVideoRendererControl *m_rendererControl; |
159 QWidget *m_widget; |
163 QWidget *m_widget; |
160 QPainterVideoSurface *m_surface; |
164 QPainterVideoSurface *m_surface; |
161 QVideoWidget::AspectRatioMode m_aspectRatioMode; |
165 Qt::AspectRatioMode m_aspectRatioMode; |
162 QSize m_aspectRatio; |
166 QRect m_boundingRect; |
|
167 QRectF m_sourceRect; |
|
168 QSize m_nativeSize; |
163 bool m_updatePaintDevice; |
169 bool m_updatePaintDevice; |
164 }; |
170 }; |
165 |
171 |
166 class QVideoWindowControl; |
172 class QVideoWindowControl; |
167 |
173 |
177 void setHue(int hue); |
183 void setHue(int hue); |
178 void setSaturation(int saturation); |
184 void setSaturation(int saturation); |
179 |
185 |
180 void setFullScreen(bool fullScreen); |
186 void setFullScreen(bool fullScreen); |
181 |
187 |
182 QVideoWidget::AspectRatioMode aspectRatioMode() const; |
188 Qt::AspectRatioMode aspectRatioMode() const; |
183 void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); |
189 void setAspectRatioMode(Qt::AspectRatioMode mode); |
184 |
190 |
185 QSize sizeHint() const; |
191 QSize sizeHint() const; |
186 |
192 |
187 void showEvent(); |
193 void showEvent(); |
188 void hideEvent(QHideEvent *event); |
194 void hideEvent(QHideEvent *event); |
191 void paintEvent(QPaintEvent *event); |
197 void paintEvent(QPaintEvent *event); |
192 |
198 |
193 private: |
199 private: |
194 QVideoWindowControl *m_windowControl; |
200 QVideoWindowControl *m_windowControl; |
195 QWidget *m_widget; |
201 QWidget *m_widget; |
196 QVideoWidget::AspectRatioMode m_aspectRatioMode; |
202 Qt::AspectRatioMode m_aspectRatioMode; |
197 QSize m_pixelAspectRatio; |
203 QSize m_pixelAspectRatio; |
198 }; |
204 }; |
199 |
205 |
200 class QMediaService; |
206 class QMediaService; |
201 class QVideoOutputControl; |
207 class QVideoOutputControl; |
216 , currentBackend(0) |
222 , currentBackend(0) |
217 , brightness(0) |
223 , brightness(0) |
218 , contrast(0) |
224 , contrast(0) |
219 , hue(0) |
225 , hue(0) |
220 , saturation(0) |
226 , saturation(0) |
221 , aspectRatioMode(QVideoWidget::KeepAspectRatio) |
227 , aspectRatioMode(Qt::KeepAspectRatio) |
222 , nonFullScreenFlags(0) |
228 , nonFullScreenFlags(0) |
223 , wasFullScreen(false) |
229 , wasFullScreen(false) |
224 { |
230 { |
225 } |
231 } |
226 |
232 |
235 QVideoWidgetBackend *currentBackend; |
241 QVideoWidgetBackend *currentBackend; |
236 int brightness; |
242 int brightness; |
237 int contrast; |
243 int contrast; |
238 int hue; |
244 int hue; |
239 int saturation; |
245 int saturation; |
240 QVideoWidget::AspectRatioMode aspectRatioMode; |
246 Qt::AspectRatioMode aspectRatioMode; |
241 Qt::WindowFlags nonFullScreenFlags; |
247 Qt::WindowFlags nonFullScreenFlags; |
242 bool wasFullScreen; |
248 bool wasFullScreen; |
243 |
249 |
244 void setCurrentControl(QVideoWidgetControlInterface *control); |
250 void setCurrentControl(QVideoWidgetControlInterface *control); |
245 void show(); |
251 void show(); |