Move QVideoWindowControl out of widgets.
There is no widget dependency in it, and this enables the QML Video element to support video overlays later. Change-Id: I7ebcde350f9595a9f7c319663ff745930535a8a7 Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
a775af111b
commit
7c84225cc8
@@ -30,6 +30,7 @@ PUBLIC_HEADERS += \
|
||||
controls/qvideodevicecontrol.h \
|
||||
controls/qvideoencodercontrol.h \
|
||||
controls/qvideorenderercontrol.h \
|
||||
controls/qvideowindowcontrol.h \
|
||||
controls/qmediaaudioprobecontrol.h \
|
||||
controls/qmediavideoprobecontrol.h \
|
||||
controls/qmediaavailabilitycontrol.h
|
||||
@@ -68,6 +69,7 @@ SOURCES += \
|
||||
controls/qvideodevicecontrol.cpp \
|
||||
controls/qvideoencodercontrol.cpp \
|
||||
controls/qvideorenderercontrol.cpp \
|
||||
controls/qvideowindowcontrol.cpp \
|
||||
controls/qmediaaudioprobecontrol.cpp \
|
||||
controls/qmediavideoprobecontrol.cpp \
|
||||
controls/qmediaavailabilitycontrol.cpp \
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
#define QVIDEOWINDOWCONTROL_H
|
||||
|
||||
#include "qmediacontrol.h"
|
||||
#include "qvideowidget.h"
|
||||
|
||||
#include <QtWidgets/qwidget.h>
|
||||
#include <QtCore/qrect.h>
|
||||
#include <QtCore/qsize.h>
|
||||
#include <QtGui/qwindowdefs.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
|
||||
QT_MODULE(Multimedia)
|
||||
|
||||
|
||||
class Q_MULTIMEDIAWIDGETS_EXPORT QVideoWindowControl : public QMediaControl
|
||||
class Q_MULTIMEDIA_EXPORT QVideoWindowControl : public QMediaControl
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -29,15 +29,13 @@ PUBLIC_HEADERS += \
|
||||
qcameraviewfinder.h \
|
||||
qgraphicsvideoitem.h \
|
||||
qvideowidgetcontrol.h \
|
||||
qvideowidget.h \
|
||||
qvideowindowcontrol.h
|
||||
qvideowidget.h
|
||||
|
||||
SOURCES += \
|
||||
qcameraviewfinder.cpp \
|
||||
qpaintervideosurface.cpp \
|
||||
qvideowidgetcontrol.cpp \
|
||||
qvideowidget.cpp \
|
||||
qvideowindowcontrol.cpp \
|
||||
qvideowidget.cpp
|
||||
|
||||
mac {
|
||||
# QtWidgets is not yet supported on Mac (!).
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
#include "qgstreamervideorendererinterface.h"
|
||||
#include <private/qgstreamerbushelper_p.h>
|
||||
#include <QtGui/qcolor.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAbstractVideoSurface;
|
||||
|
||||
@@ -56,10 +56,7 @@
|
||||
#include "../qmultimedia_common/mockcameracontrol.h"
|
||||
#include "../qmultimedia_common/mockvideosurface.h"
|
||||
#include "../qmultimedia_common/mockvideorenderercontrol.h"
|
||||
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
#include "../qmultimedia_common/mockvideowindowcontrol.h"
|
||||
#endif
|
||||
|
||||
class MockSimpleCameraService : public QMediaService
|
||||
{
|
||||
@@ -107,9 +104,7 @@ public:
|
||||
mockImageProcessingControl = new MockImageProcessingControl(this);
|
||||
mockImageEncoderControl = new MockImageEncoderControl(this);
|
||||
rendererControl = new MockVideoRendererControl(this);
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
windowControl = new MockVideoWindowControl(this);
|
||||
#endif
|
||||
rendererRef = 0;
|
||||
windowRef = 0;
|
||||
}
|
||||
@@ -159,14 +154,12 @@ public:
|
||||
return rendererControl;
|
||||
}
|
||||
}
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
if (qstrcmp(iid, QVideoWindowControl_iid) == 0) {
|
||||
if (windowRef == 0) {
|
||||
windowRef += 1;
|
||||
return windowControl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -174,10 +167,8 @@ public:
|
||||
{
|
||||
if (control == rendererControl)
|
||||
rendererRef -= 1;
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
if (control == windowControl)
|
||||
windowRef -= 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
MockCameraControl *mockControl;
|
||||
@@ -192,9 +183,7 @@ public:
|
||||
MockImageProcessingControl *mockImageProcessingControl;
|
||||
MockImageEncoderControl *mockImageEncoderControl;
|
||||
MockVideoRendererControl *rendererControl;
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
MockVideoWindowControl *windowControl;
|
||||
#endif
|
||||
int rendererRef;
|
||||
int windowRef;
|
||||
};
|
||||
|
||||
@@ -49,9 +49,7 @@
|
||||
#include "mockmedianetworkaccesscontrol.h"
|
||||
#include "mockvideorenderercontrol.h"
|
||||
#include "mockvideoprobecontrol.h"
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
#include "mockvideowindowcontrol.h"
|
||||
#endif
|
||||
|
||||
class MockMediaPlayerService : public QMediaService
|
||||
{
|
||||
@@ -66,10 +64,8 @@ public:
|
||||
rendererControl = new MockVideoRendererControl;
|
||||
rendererRef = 0;
|
||||
mockVideoProbeControl = new MockVideoProbeControl;
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
windowControl = new MockVideoWindowControl;
|
||||
windowRef = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
~MockMediaPlayerService()
|
||||
@@ -79,9 +75,7 @@ public:
|
||||
delete mockNetworkControl;
|
||||
delete rendererControl;
|
||||
delete mockVideoProbeControl;
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
delete windowControl;
|
||||
#endif
|
||||
}
|
||||
|
||||
QMediaControl* requestControl(const char *iid)
|
||||
@@ -96,14 +90,12 @@ public:
|
||||
} else if (qstrcmp(iid, QMediaVideoProbeControl_iid) == 0) {
|
||||
return mockVideoProbeControl;
|
||||
}
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
if (qstrcmp(iid, QVideoWindowControl_iid) == 0) {
|
||||
if (windowRef == 0) {
|
||||
windowRef += 1;
|
||||
return windowControl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (qstrcmp(iid, QMediaNetworkAccessControl_iid) == 0)
|
||||
return mockNetworkControl;
|
||||
@@ -114,10 +106,8 @@ public:
|
||||
{
|
||||
if (control == rendererControl)
|
||||
rendererRef -= 1;
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
if (control == windowControl)
|
||||
windowRef -= 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void setState(QMediaPlayer::State state) { emit mockControl->stateChanged(mockControl->_state = state); }
|
||||
@@ -170,10 +160,8 @@ public:
|
||||
MockNetworkAccessControl *mockNetworkControl;
|
||||
MockVideoRendererControl *rendererControl;
|
||||
MockVideoProbeControl *mockVideoProbeControl;
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
MockVideoWindowControl *windowControl;
|
||||
int windowRef;
|
||||
#endif
|
||||
int rendererRef;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,12 +3,8 @@ INCLUDEPATH += $$PWD \
|
||||
../../../src/multimedia \
|
||||
../../../src/multimedia/video
|
||||
|
||||
contains(QT,multimediawidgets)|contains(QT,multimediawidgets-private) {
|
||||
HEADERS *= ../qmultimedia_common/mockvideowindowcontrol.h
|
||||
DEFINES *= QT_MULTIMEDIA_MOCK_WIDGETS
|
||||
}
|
||||
|
||||
HEADERS *= \
|
||||
../qmultimedia_common/mockvideosurface.h \
|
||||
../qmultimedia_common/mockvideorenderercontrol.h
|
||||
../qmultimedia_common/mockvideorenderercontrol.h \
|
||||
../qmultimedia_common/mockvideowindowcontrol.h
|
||||
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
#ifndef MOCKVIDEOWINDOWCONTROL_H
|
||||
#define MOCKVIDEOWINDOWCONTROL_H
|
||||
|
||||
#if defined(QT_MULTIMEDIA_MOCK_WIDGETS)
|
||||
|
||||
#include "qvideowindowcontrol.h"
|
||||
|
||||
class MockVideoWindowControl : public QVideoWindowControl
|
||||
@@ -70,5 +68,4 @@ public:
|
||||
void setSaturation(int) {}
|
||||
};
|
||||
|
||||
#endif // QT_MULTIMEDIA_MOCK_WIDGETS
|
||||
#endif // MOCKVIDEOWINDOWCONTROL_H
|
||||
|
||||
Reference in New Issue
Block a user