equal
deleted
inserted
replaced
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 #include <QtCore/qpointer.h> |
|
66 |
65 QT_BEGIN_NAMESPACE |
67 QT_BEGIN_NAMESPACE |
|
68 |
|
69 class QMediaService; |
66 |
70 |
67 class QVideoWidgetControlInterface |
71 class QVideoWidgetControlInterface |
68 { |
72 { |
69 public: |
73 public: |
70 virtual ~QVideoWidgetControlInterface() {} |
74 virtual ~QVideoWidgetControlInterface() {} |
97 |
101 |
98 class QVideoWidgetControlBackend : public QObject, public QVideoWidgetControlInterface |
102 class QVideoWidgetControlBackend : public QObject, public QVideoWidgetControlInterface |
99 { |
103 { |
100 Q_OBJECT |
104 Q_OBJECT |
101 public: |
105 public: |
102 QVideoWidgetControlBackend(QVideoWidgetControl *control, QWidget *widget); |
106 QVideoWidgetControlBackend(QMediaService *service, QVideoWidgetControl *control, QWidget *widget); |
|
107 |
|
108 void releaseControl(); |
103 |
109 |
104 void setBrightness(int brightness); |
110 void setBrightness(int brightness); |
105 void setContrast(int contrast); |
111 void setContrast(int contrast); |
106 void setHue(int hue); |
112 void setHue(int hue); |
107 void setSaturation(int saturation); |
113 void setSaturation(int saturation); |
110 |
116 |
111 Qt::AspectRatioMode aspectRatioMode() const; |
117 Qt::AspectRatioMode aspectRatioMode() const; |
112 void setAspectRatioMode(Qt::AspectRatioMode mode); |
118 void setAspectRatioMode(Qt::AspectRatioMode mode); |
113 |
119 |
114 private: |
120 private: |
|
121 QMediaService *m_service; |
115 QVideoWidgetControl *m_widgetControl; |
122 QVideoWidgetControl *m_widgetControl; |
116 }; |
123 }; |
117 |
124 |
118 |
125 |
119 class QVideoRendererControl; |
126 class QVideoRendererControl; |
120 |
127 |
121 class QRendererVideoWidgetBackend : public QVideoWidgetBackend |
128 class QRendererVideoWidgetBackend : public QVideoWidgetBackend |
122 { |
129 { |
123 Q_OBJECT |
130 Q_OBJECT |
124 public: |
131 public: |
125 QRendererVideoWidgetBackend(QVideoRendererControl *control, QWidget *widget); |
132 QRendererVideoWidgetBackend(QMediaService *service, QVideoRendererControl *control, QWidget *widget); |
126 ~QRendererVideoWidgetBackend(); |
133 ~QRendererVideoWidgetBackend(); |
127 |
134 |
|
135 void releaseControl(); |
128 void clearSurface(); |
136 void clearSurface(); |
129 |
137 |
130 void setBrightness(int brightness); |
138 void setBrightness(int brightness); |
131 void setContrast(int contrast); |
139 void setContrast(int contrast); |
132 void setHue(int hue); |
140 void setHue(int hue); |
157 void frameChanged(); |
165 void frameChanged(); |
158 |
166 |
159 private: |
167 private: |
160 void updateRects(); |
168 void updateRects(); |
161 |
169 |
|
170 QMediaService *m_service; |
162 QVideoRendererControl *m_rendererControl; |
171 QVideoRendererControl *m_rendererControl; |
163 QWidget *m_widget; |
172 QWidget *m_widget; |
164 QPainterVideoSurface *m_surface; |
173 QPainterVideoSurface *m_surface; |
165 Qt::AspectRatioMode m_aspectRatioMode; |
174 Qt::AspectRatioMode m_aspectRatioMode; |
166 QRect m_boundingRect; |
175 QRect m_boundingRect; |
173 |
182 |
174 class QWindowVideoWidgetBackend : public QVideoWidgetBackend |
183 class QWindowVideoWidgetBackend : public QVideoWidgetBackend |
175 { |
184 { |
176 Q_OBJECT |
185 Q_OBJECT |
177 public: |
186 public: |
178 QWindowVideoWidgetBackend(QVideoWindowControl *control, QWidget *widget); |
187 QWindowVideoWidgetBackend(QMediaService *service, QVideoWindowControl *control, QWidget *widget); |
179 ~QWindowVideoWidgetBackend(); |
188 ~QWindowVideoWidgetBackend(); |
|
189 |
|
190 void releaseControl(); |
180 |
191 |
181 void setBrightness(int brightness); |
192 void setBrightness(int brightness); |
182 void setContrast(int contrast); |
193 void setContrast(int contrast); |
183 void setHue(int hue); |
194 void setHue(int hue); |
184 void setSaturation(int saturation); |
195 void setSaturation(int saturation); |
195 void resizeEvent(QResizeEvent *event); |
206 void resizeEvent(QResizeEvent *event); |
196 void moveEvent(QMoveEvent *event); |
207 void moveEvent(QMoveEvent *event); |
197 void paintEvent(QPaintEvent *event); |
208 void paintEvent(QPaintEvent *event); |
198 |
209 |
199 private: |
210 private: |
|
211 QMediaService *m_service; |
200 QVideoWindowControl *m_windowControl; |
212 QVideoWindowControl *m_windowControl; |
201 QWidget *m_widget; |
213 QWidget *m_widget; |
202 Qt::AspectRatioMode m_aspectRatioMode; |
214 Qt::AspectRatioMode m_aspectRatioMode; |
203 QSize m_pixelAspectRatio; |
215 QSize m_pixelAspectRatio; |
204 }; |
216 }; |
211 Q_DECLARE_PUBLIC(QVideoWidget) |
223 Q_DECLARE_PUBLIC(QVideoWidget) |
212 public: |
224 public: |
213 QVideoWidgetPrivate() |
225 QVideoWidgetPrivate() |
214 : q_ptr(0) |
226 : q_ptr(0) |
215 , mediaObject(0) |
227 , mediaObject(0) |
216 , service(0) |
228 , service(0) |
217 , outputControl(0) |
|
218 , widgetBackend(0) |
229 , widgetBackend(0) |
219 , windowBackend(0) |
230 , windowBackend(0) |
220 , rendererBackend(0) |
231 , rendererBackend(0) |
221 , currentControl(0) |
232 , currentControl(0) |
222 , currentBackend(0) |
233 , currentBackend(0) |
229 , wasFullScreen(false) |
240 , wasFullScreen(false) |
230 { |
241 { |
231 } |
242 } |
232 |
243 |
233 QVideoWidget *q_ptr; |
244 QVideoWidget *q_ptr; |
234 QMediaObject *mediaObject; |
245 QPointer<QMediaObject> mediaObject; |
235 QMediaService *service; |
246 QMediaService *service; |
236 QVideoOutputControl *outputControl; |
|
237 QVideoWidgetControlBackend *widgetBackend; |
247 QVideoWidgetControlBackend *widgetBackend; |
238 QWindowVideoWidgetBackend *windowBackend; |
248 QWindowVideoWidgetBackend *windowBackend; |
239 QRendererVideoWidgetBackend *rendererBackend; |
249 QRendererVideoWidgetBackend *rendererBackend; |
240 QVideoWidgetControlInterface *currentControl; |
250 QVideoWidgetControlInterface *currentControl; |
241 QVideoWidgetBackend *currentBackend; |
251 QVideoWidgetBackend *currentBackend; |
245 int saturation; |
255 int saturation; |
246 Qt::AspectRatioMode aspectRatioMode; |
256 Qt::AspectRatioMode aspectRatioMode; |
247 Qt::WindowFlags nonFullScreenFlags; |
257 Qt::WindowFlags nonFullScreenFlags; |
248 bool wasFullScreen; |
258 bool wasFullScreen; |
249 |
259 |
|
260 bool createWidgetBackend(); |
|
261 bool createWindowBackend(); |
|
262 bool createRendererBackend(); |
|
263 |
250 void setCurrentControl(QVideoWidgetControlInterface *control); |
264 void setCurrentControl(QVideoWidgetControlInterface *control); |
251 void show(); |
|
252 void clearService(); |
265 void clearService(); |
253 |
266 |
254 void _q_serviceDestroyed(); |
267 void _q_serviceDestroyed(); |
255 void _q_mediaObjectDestroyed(); |
|
256 void _q_brightnessChanged(int brightness); |
268 void _q_brightnessChanged(int brightness); |
257 void _q_contrastChanged(int contrast); |
269 void _q_contrastChanged(int contrast); |
258 void _q_hueChanged(int hue); |
270 void _q_hueChanged(int hue); |
259 void _q_saturationChanged(int saturation); |
271 void _q_saturationChanged(int saturation); |
260 void _q_fullScreenChanged(bool fullScreen); |
272 void _q_fullScreenChanged(bool fullScreen); |