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