qtmobility/src/multimedia/qvideowidget_p.h
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
--- a/qtmobility/src/multimedia/qvideowidget_p.h	Fri Jun 11 14:26:25 2010 +0300
+++ b/qtmobility/src/multimedia/qvideowidget_p.h	Wed Jun 23 19:08:38 2010 +0300
@@ -62,8 +62,12 @@
 
 #include "qpaintervideosurface_p.h"
 
+#include <QtCore/qpointer.h>
+
 QT_BEGIN_NAMESPACE
 
+class QMediaService;
+
 class QVideoWidgetControlInterface
 {
 public:
@@ -99,7 +103,9 @@
 {
     Q_OBJECT
 public:
-    QVideoWidgetControlBackend(QVideoWidgetControl *control, QWidget *widget);
+    QVideoWidgetControlBackend(QMediaService *service, QVideoWidgetControl *control, QWidget *widget);
+
+    void releaseControl();
 
     void setBrightness(int brightness);
     void setContrast(int contrast);
@@ -112,6 +118,7 @@
     void setAspectRatioMode(Qt::AspectRatioMode mode);
 
 private:
+    QMediaService *m_service;
     QVideoWidgetControl *m_widgetControl;
 };
 
@@ -122,9 +129,10 @@
 {
     Q_OBJECT
 public:
-    QRendererVideoWidgetBackend(QVideoRendererControl *control, QWidget *widget);
+    QRendererVideoWidgetBackend(QMediaService *service, QVideoRendererControl *control, QWidget *widget);
     ~QRendererVideoWidgetBackend();
 
+    void releaseControl();
     void clearSurface();
 
     void setBrightness(int brightness);
@@ -159,6 +167,7 @@
 private:
     void updateRects();
 
+    QMediaService *m_service;
     QVideoRendererControl *m_rendererControl;
     QWidget *m_widget;
     QPainterVideoSurface *m_surface;
@@ -175,9 +184,11 @@
 {
     Q_OBJECT
 public:
-    QWindowVideoWidgetBackend(QVideoWindowControl *control, QWidget *widget);
+    QWindowVideoWidgetBackend(QMediaService *service, QVideoWindowControl *control, QWidget *widget);
     ~QWindowVideoWidgetBackend();
 
+    void releaseControl();
+
     void setBrightness(int brightness);
     void setContrast(int contrast);
     void setHue(int hue);
@@ -197,6 +208,7 @@
     void paintEvent(QPaintEvent *event);
 
 private:
+    QMediaService *m_service;
     QVideoWindowControl *m_windowControl;
     QWidget *m_widget;
     Qt::AspectRatioMode m_aspectRatioMode;
@@ -213,8 +225,7 @@
     QVideoWidgetPrivate()
         : q_ptr(0)
         , mediaObject(0)
-        , service(0)
-        , outputControl(0)
+        , service(0)        
         , widgetBackend(0)
         , windowBackend(0)
         , rendererBackend(0)
@@ -231,9 +242,8 @@
     }
 
     QVideoWidget *q_ptr;
-    QMediaObject *mediaObject;
+    QPointer<QMediaObject> mediaObject;
     QMediaService *service;
-    QVideoOutputControl *outputControl;
     QVideoWidgetControlBackend *widgetBackend;
     QWindowVideoWidgetBackend *windowBackend;
     QRendererVideoWidgetBackend *rendererBackend;
@@ -247,12 +257,14 @@
     Qt::WindowFlags nonFullScreenFlags;
     bool wasFullScreen;
 
+    bool createWidgetBackend();
+    bool createWindowBackend();
+    bool createRendererBackend();
+
     void setCurrentControl(QVideoWidgetControlInterface *control);
-    void show();
     void clearService();
 
     void _q_serviceDestroyed();
-    void _q_mediaObjectDestroyed();
     void _q_brightnessChanged(int brightness);
     void _q_contrastChanged(int contrast);
     void _q_hueChanged(int hue);