Properly handle the case where QtWidgets is not available.

It does use a config test for now, just to make it clearer.  The Mac
backend currently requires widgets, but most of the others should work
without it (just not supporting QVideoWidget/WindowControl).

The QVideoDeviceControl interface was modified to remove the QIcon
usage - it was never implemented.

Unfortunately even the QML examples need widgets for the wrapper
application, and will need to be ported to QtGui based wrapper.

Change-Id: I8a55ad5cf09ab51749510bf16f49de0bd3f0bcdb
Reviewed-by: Ling Hu <ling.hu@nokia.com>
This commit is contained in:
Michael Goddard
2012-01-05 17:22:19 +10:00
committed by Qt by Nokia
parent bc7d964a05
commit c97f5f8c2e
45 changed files with 243 additions and 160 deletions

View File

@@ -61,16 +61,18 @@
#include "qgstreameraudioinputendpointselector.h"
#include "qgstreamervideoinputdevicecontrol.h"
#if defined(HAVE_WIDGETS)
#include "qgstreamervideooverlay.h"
#include "qgstreamervideowindow.h"
#include "qgstreamervideowidget.h"
#endif
#include "qgstreamervideorenderer.h"
#if defined(Q_WS_MAEMO_6) && defined(__arm__)
#include "qgstreamergltexturerenderer.h"
#endif
#include "qgstreamervideowidget.h"
#include <qmediaserviceprovider.h>
#include <QtCore/qdebug.h>
@@ -92,9 +94,11 @@ CameraBinService::CameraBinService(const QString &service, QObject *parent):
m_videoOutput = 0;
m_videoRenderer = 0;
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
m_videoWindow = 0;
m_videoWidgetControl = 0;
m_imageCaptureControl = 0;
#endif
m_imageCaptureControl = 0;
if (service == Q_MEDIASERVICE_CAMERA) {
m_captureSession = new CameraBinSession(this);
@@ -106,29 +110,24 @@ CameraBinService::CameraBinService(const QString &service, QObject *parent):
m_captureSession, SLOT(setDevice(QString)));
if (m_videoInputDevice->deviceCount())
m_captureSession->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));
m_captureSession->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));
#if defined(Q_WS_MAEMO_6) && defined(__arm__)
#if defined(Q_WS_MAEMO_6) && defined(__arm__) && defined(HAVE_WIDGETS)
m_videoRenderer = new QGstreamerGLTextureRenderer(this);
#else
m_videoRenderer = new QGstreamerVideoRenderer(this);
#endif
#ifdef HAVE_XVIDEO
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
#ifdef Q_WS_MAEMO_6
m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink");
//m_videoWindow = new QGstreamerVideoWindow(this);
#else
m_videoWindow = new QGstreamerVideoOverlay(this);
#endif
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
#endif
}
if (!m_captureSession) {
qWarning() << Q_FUNC_INFO << "Service type is not supported:" << service;
return;
@@ -163,11 +162,14 @@ QMediaControl *CameraBinService::requestControl(const char *name)
if (!m_videoOutput) {
if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
m_videoOutput = m_videoRenderer;
} else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
}
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
m_videoOutput = m_videoWindow;
} else if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
m_videoOutput = m_videoWidgetControl;
}
#endif
if (m_videoOutput) {
m_captureSession->setViewfinder(m_videoOutput);

View File

@@ -79,7 +79,7 @@ private:
void setAudioPreview(GstElement*);
CameraBinSession *m_captureSession;
CameraBinControl *m_cameraControl;
CameraBinControl *m_cameraControl;
CameraBinMetaData *m_metaDataControl;
QAudioEndpointSelector *m_audioInputEndpointSelector;
@@ -88,8 +88,10 @@ private:
QMediaControl *m_videoOutput;
QMediaControl *m_videoRenderer;
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
QMediaControl *m_videoWindow;
QGstreamerVideoWidgetControl *m_videoWidgetControl;
#endif
CameraBinImageCapture *m_imageCaptureControl;
};

View File

@@ -2,7 +2,14 @@
load(qt_module)
TARGET = qgstengine
QT += multimedia-private network multimediawidgets-private
QT += multimedia-private network
CONFIG += no_private_qt_headers_warning
contains(config_test_widgets, yes) {
QT += widgets multimediawidgets-private
DEFINES += HAVE_WIDGETS
}
PLUGIN_TYPE=mediaservice
load(qt_plugin)
@@ -11,9 +18,8 @@ DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
LIBS += -lqgsttools_p
unix:!maemo*:contains(QT_CONFIG, alsa) {
DEFINES += HAVE_ALSA
LIBS += \
-lasound
DEFINES += HAVE_ALSA
LIBS += -lasound
}
CONFIG += link_pkgconfig
@@ -40,7 +46,7 @@ maemo6 {
PKGCONFIG += qmsystem2
isEqual(QT_ARCH,armv6) {
isEqual(QT_ARCH,armv6):contains(config_test_widgets, yes) {
HEADERS += qgstreamergltexturerenderer.h
SOURCES += qgstreamergltexturerenderer.cpp
QT += opengl
@@ -68,7 +74,7 @@ SOURCES += \
gstvideoconnector.c \
contains(config_test_xvideo, yes) {
contains(config_test_xvideo, yes):contains(config_test_widgets, yes): {
DEFINES += HAVE_XVIDEO
LIBS += -lXv -lX11 -lXext

View File

@@ -55,10 +55,12 @@
#include "qgstreamervideoinputdevicecontrol.h"
#include "qgstreamerimagecapturecontrol.h"
#include "qgstreamervideooverlay.h"
#include "qgstreamervideorenderer.h"
#if defined(HAVE_WIDGETS)
#include "qgstreamervideooverlay.h"
#include "qgstreamervideowidget.h"
#endif
#include <qmediaserviceprovider.h>
@@ -77,8 +79,10 @@ QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObje
m_videoOutput = 0;
m_videoRenderer = 0;
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
m_videoWindow = 0;
m_videoWidgetControl = 0;
#endif
m_imageCaptureControl = 0;
if (service == Q_MEDIASERVICE_AUDIOSOURCE) {
@@ -100,10 +104,10 @@ QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObje
m_videoRenderer = new QGstreamerVideoRenderer(this);
#ifdef HAVE_XVIDEO
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
m_videoWindow = new QGstreamerVideoOverlay(this);
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
#endif
#endif
m_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession);
}
@@ -125,8 +129,8 @@ QGstreamerCaptureService::~QGstreamerCaptureService()
QMediaControl *QGstreamerCaptureService::requestControl(const char *name)
{
if (!m_captureSession)
return 0;
return 0;
if (qstrcmp(name,QAudioEndpointSelector_iid) == 0)
return m_audioInputEndpointSelector;
@@ -157,15 +161,18 @@ QMediaControl *QGstreamerCaptureService::requestControl(const char *name)
if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
return m_imageCaptureControl;
if (!m_videoOutput) {
if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
m_videoOutput = m_videoRenderer;
} else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
}
#if defined(HAVE_WIDGETS) && defined(HAVE_XVIDEO)
else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
m_videoOutput = m_videoWindow;
} else if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
m_videoOutput = m_videoWidgetControl;
}
#endif
if (m_videoOutput) {
m_captureSession->setVideoPreview(m_videoOutput);

View File

@@ -87,8 +87,10 @@ private:
QMediaControl *m_videoOutput;
QGstreamerVideoRenderer *m_videoRenderer;
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
QMediaControl *m_videoWindow;
QMediaControl *m_videoWidgetControl;
#endif
QGstreamerImageCaptureControl *m_imageCaptureControl;
};

View File

@@ -41,22 +41,28 @@
#include <QtCore/qvariant.h>
#include <QtCore/qdebug.h>
#if defined(HAVE_WIDGETS)
#include <QtWidgets/qwidget.h>
#endif
#include "qgstreamerplayerservice.h"
#include "qgstreamerplayercontrol.h"
#include "qgstreamerplayersession.h"
#include "qgstreamermetadataprovider.h"
#if defined(HAVE_WIDGETS)
#include "qgstreamervideooverlay.h"
#include "qgstreamervideowindow.h"
#include "qgstreamervideowidget.h"
#endif
#include "qgstreamervideorenderer.h"
#if defined(Q_WS_MAEMO_6) && defined(__arm__)
#include "qgstreamergltexturerenderer.h"
#endif
#include "qgstreamervideowidget.h"
#include "qgstreamerstreamscontrol.h"
#include <qmediaplaylistnavigator.h>
@@ -65,11 +71,13 @@
QT_BEGIN_NAMESPACE
QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent):
QMediaService(parent),
m_videoOutput(0),
m_videoRenderer(0),
m_videoWindow(0),
m_videoWidget(0)
QMediaService(parent)
, m_videoOutput(0)
, m_videoRenderer(0)
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
, m_videoWindow(0)
, m_videoWidget(0)
#endif
{
m_session = new QGstreamerPlayerSession(this);
m_control = new QGstreamerPlayerControl(m_session, this);
@@ -82,14 +90,12 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent):
m_videoRenderer = new QGstreamerVideoRenderer(this);
#endif
#ifdef HAVE_XVIDEO
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
#ifdef Q_WS_MAEMO_6
m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink");
#else
m_videoWindow = new QGstreamerVideoOverlay(this);
#endif
m_videoWidget = new QGstreamerVideoWidgetControl(this);
#endif
}
@@ -110,12 +116,14 @@ QMediaControl *QGstreamerPlayerService::requestControl(const char *name)
return m_streamsControl;
if (!m_videoOutput) {
if (qstrcmp(name, QVideoWidgetControl_iid) == 0)
m_videoOutput = m_videoWidget;
else if (qstrcmp(name, QVideoRendererControl_iid) == 0)
if (qstrcmp(name, QVideoRendererControl_iid) == 0)
m_videoOutput = m_videoRenderer;
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
else if (qstrcmp(name, QVideoWidgetControl_iid) == 0)
m_videoOutput = m_videoWidget;
else if (qstrcmp(name, QVideoWindowControl_iid) == 0)
m_videoOutput = m_videoWindow;
#endif
if (m_videoOutput) {
m_control->setVideoOutput(m_videoOutput);

View File

@@ -80,8 +80,10 @@ private:
QMediaControl *m_videoOutput;
QMediaControl *m_videoRenderer;
#if defined(HAVE_XVIDEO) && defined(HAVE_WIDGETS)
QMediaControl *m_videoWindow;
QMediaControl *m_videoWidget;
#endif
};
QT_END_NAMESPACE

View File

@@ -41,7 +41,6 @@
#include "qgstreameraudioinputendpointselector.h"
#include <QtWidgets/QIcon>
#include <QtCore/QDir>
#include <QtCore/QDebug>

View File

@@ -41,7 +41,6 @@
#include <QtCore/qstring.h>
#include <QtCore/qdebug.h>
#include <QtWidgets/QIcon>
#include <QtCore/QDir>
#include <QtCore/QDebug>

View File

@@ -41,7 +41,6 @@
#include "qgstreamervideoinputdevicecontrol.h"
#include <QtWidgets/QIcon>
#include <QtCore/QDir>
#include <QtCore/QDebug>
@@ -82,12 +81,6 @@ QString QGstreamerVideoInputDeviceControl::deviceDescription(int index) const
return m_descriptions[index];
}
QIcon QGstreamerVideoInputDeviceControl::deviceIcon(int index) const
{
Q_UNUSED(index);
return QIcon();
}
int QGstreamerVideoInputDeviceControl::defaultDevice() const
{
return 0;

View File

@@ -58,7 +58,6 @@ public:
QString deviceName(int index) const;
QString deviceDescription(int index) const;
QIcon deviceIcon(int index) const;
int defaultDevice() const;
int selectedDevice() const;

View File

@@ -43,8 +43,6 @@
#include <private/qvideosurfacegstsink_p.h>
#include <qabstractvideosurface.h>
#include <QEvent>
#include <QtWidgets/QApplication>
#include <QDebug>
#include <gst/gst.h>