diff options
58 files changed, 923 insertions, 322 deletions
diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro index fef65aebf..9d9971ed8 100644 --- a/src/gsttools/gsttools.pro +++ b/src/gsttools/gsttools.pro @@ -23,7 +23,6 @@ PKGCONFIG += \ gstreamer-pbutils-0.10 maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10 -contains(config_test_gstreamer_appsrc, yes): PKGCONFIG += gstreamer-app-0.10 contains(config_test_resourcepolicy, yes) { DEFINES += HAVE_RESOURCE_POLICY @@ -42,6 +41,14 @@ PRIVATE_HEADERS += \ qgstutils_p.h \ qgstvideobuffer_p.h \ qvideosurfacegstsink_p.h \ + qgstreamervideorendererinterface_p.h \ + qgstreameraudioinputendpointselector_p.h \ + qgstreamervideorenderer_p.h \ + qgstreamervideoinputdevicecontrol_p.h \ + gstvideoconnector_p.h \ + qgstcodecsinfo_p.h \ + qgstreamervideoprobecontrol_p.h \ + qgstreameraudioprobecontrol_p.h \ SOURCES += \ qgstbufferpoolinterface.cpp \ @@ -50,6 +57,14 @@ SOURCES += \ qgstutils.cpp \ qgstvideobuffer.cpp \ qvideosurfacegstsink.cpp \ + qgstreamervideorendererinterface.cpp \ + qgstreameraudioinputendpointselector.cpp \ + qgstreamervideorenderer.cpp \ + qgstreamervideoinputdevicecontrol.cpp \ + qgstcodecsinfo.cpp \ + gstvideoconnector.c \ + qgstreamervideoprobecontrol.cpp \ + qgstreameraudioprobecontrol.cpp \ contains(config_test_xvideo, yes) { DEFINES += HAVE_XVIDEO @@ -61,6 +76,43 @@ contains(config_test_xvideo, yes) { SOURCES += \ qgstxvimagebuffer.cpp \ + + !isEmpty(QT.widgets.name) { + QT += multimediawidgets + + PRIVATE_HEADERS += \ + qgstreamervideooverlay_p.h \ + qgstreamervideowindow_p.h \ + qgstreamervideowidget_p.h \ + qx11videosurface_p.h \ + + SOURCES += \ + qgstreamervideooverlay.cpp \ + qgstreamervideowindow.cpp \ + qgstreamervideowidget.cpp \ + qx11videosurface.cpp \ + } +} + +maemo6 { + PKGCONFIG += qmsystem2 + + contains(QT_CONFIG, opengles2):!isEmpty(QT.widgets.name) { + PRIVATE_HEADERS += qgstreamergltexturerenderer_p.h + SOURCES += qgstreamergltexturerenderer.cpp + QT += opengl + LIBS += -lEGL -lgstmeegointerfaces-0.10 + } +} + +contains(config_test_gstreamer_appsrc, yes) { + PKGCONFIG += gstreamer-app-0.10 + PRIVATE_HEADERS += qgstappsrc_p.h + SOURCES += qgstappsrc.cpp + + DEFINES += HAVE_GST_APPSRC + + LIBS += -lgstapp-0.10 } HEADERS += $$PRIVATE_HEADERS diff --git a/src/plugins/gstreamer/gstvideoconnector.c b/src/gsttools/gstvideoconnector.c index 9c8d1da7e..c3cb2f430 100644 --- a/src/plugins/gstreamer/gstvideoconnector.c +++ b/src/gsttools/gstvideoconnector.c @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "gstvideoconnector.h" +#include "gstvideoconnector_p.h" #include <unistd.h> /* signals */ diff --git a/src/plugins/gstreamer/qgstappsrc.cpp b/src/gsttools/qgstappsrc.cpp index 7dfe95792..937db3e8e 100644 --- a/src/plugins/gstreamer/qgstappsrc.cpp +++ b/src/gsttools/qgstappsrc.cpp @@ -41,7 +41,7 @@ #include <QDebug> -#include "qgstappsrc.h" +#include "qgstappsrc_p.h" #include <QtNetwork> QGstAppSrc::QGstAppSrc(QObject *parent) diff --git a/src/plugins/gstreamer/qgstcodecsinfo.cpp b/src/gsttools/qgstcodecsinfo.cpp index cf8ae2954..2d39977a3 100644 --- a/src/plugins/gstreamer/qgstcodecsinfo.cpp +++ b/src/gsttools/qgstcodecsinfo.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgstcodecsinfo.h" +#include "qgstcodecsinfo_p.h" #include <QtCore/qset.h> diff --git a/src/plugins/gstreamer/qgstreameraudioinputendpointselector.cpp b/src/gsttools/qgstreameraudioinputendpointselector.cpp index cad931b3e..cdbc67d23 100644 --- a/src/plugins/gstreamer/qgstreameraudioinputendpointselector.cpp +++ b/src/gsttools/qgstreameraudioinputendpointselector.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgstreameraudioinputendpointselector.h" +#include "qgstreameraudioinputendpointselector_p.h" #include <QtCore/QDir> #include <QtCore/QDebug> diff --git a/src/plugins/gstreamer/qgstreameraudioprobecontrol.cpp b/src/gsttools/qgstreameraudioprobecontrol.cpp index d1f15d843..e1efe9606 100644 --- a/src/plugins/gstreamer/qgstreameraudioprobecontrol.cpp +++ b/src/gsttools/qgstreameraudioprobecontrol.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgstreameraudioprobecontrol.h" +#include "qgstreameraudioprobecontrol_p.h" #include <private/qgstutils_p.h> QGstreamerAudioProbeControl::QGstreamerAudioProbeControl(QObject *parent) diff --git a/src/plugins/gstreamer/qgstreamergltexturerenderer.cpp b/src/gsttools/qgstreamergltexturerenderer.cpp index be3c68b49..f5cd2f432 100644 --- a/src/plugins/gstreamer/qgstreamergltexturerenderer.cpp +++ b/src/gsttools/qgstreamergltexturerenderer.cpp @@ -61,7 +61,7 @@ #include <EGL/egl.h> #include <EGL/eglext.h> -#include "qgstreamergltexturerenderer.h" +#include "qgstreamergltexturerenderer_p.h" //#define GL_TEXTURE_SINK_DEBUG 1 diff --git a/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.cpp b/src/gsttools/qgstreamervideoinputdevicecontrol.cpp index 3ffe728aa..5fe9ca705 100644 --- a/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.cpp +++ b/src/gsttools/qgstreamervideoinputdevicecontrol.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgstreamervideoinputdevicecontrol.h" +#include "qgstreamervideoinputdevicecontrol_p.h" #include <QtCore/QDir> #include <QtCore/QDebug> diff --git a/src/plugins/gstreamer/qgstreamervideooverlay.cpp b/src/gsttools/qgstreamervideooverlay.cpp index 8c3a4bfc9..5b8030479 100644 --- a/src/plugins/gstreamer/qgstreamervideooverlay.cpp +++ b/src/gsttools/qgstreamervideooverlay.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qgstreamervideooverlay.h" +#include "qgstreamervideooverlay_p.h" #include <private/qvideosurfacegstsink_p.h> #include <qvideosurfaceformat.h> -#include <qx11videosurface.h> +#include <qx11videosurface_p.h> QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent) : QVideoWindowControl(parent) diff --git a/src/plugins/gstreamer/qgstreamervideoprobecontrol.cpp b/src/gsttools/qgstreamervideoprobecontrol.cpp index 6d586c4a4..8e4e74fad 100644 --- a/src/plugins/gstreamer/qgstreamervideoprobecontrol.cpp +++ b/src/gsttools/qgstreamervideoprobecontrol.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgstreamervideoprobecontrol.h" +#include "qgstreamervideoprobecontrol_p.h" #include <private/qvideosurfacegstsink_p.h> #include <private/qgstvideobuffer_p.h> diff --git a/src/plugins/gstreamer/qgstreamervideorenderer.cpp b/src/gsttools/qgstreamervideorenderer.cpp index d5ee93df4..bd2a0b12e 100644 --- a/src/plugins/gstreamer/qgstreamervideorenderer.cpp +++ b/src/gsttools/qgstreamervideorenderer.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgstreamervideorenderer.h" +#include "qgstreamervideorenderer_p.h" #include <private/qvideosurfacegstsink_p.h> #include <qabstractvideosurface.h> diff --git a/src/plugins/gstreamer/qgstreamervideorendererinterface.cpp b/src/gsttools/qgstreamervideorendererinterface.cpp index de3cd5bf8..5a7a85fcc 100644 --- a/src/plugins/gstreamer/qgstreamervideorendererinterface.cpp +++ b/src/gsttools/qgstreamervideorendererinterface.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgstreamervideorendererinterface.h" +#include "qgstreamervideorendererinterface_p.h" QGstreamerVideoRendererInterface::~QGstreamerVideoRendererInterface() { diff --git a/src/plugins/gstreamer/qgstreamervideowidget.cpp b/src/gsttools/qgstreamervideowidget.cpp index 118265102..9c56a06de 100644 --- a/src/plugins/gstreamer/qgstreamervideowidget.cpp +++ b/src/gsttools/qgstreamervideowidget.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgstreamervideowidget.h" +#include "qgstreamervideowidget_p.h" #include <private/qgstutils_p.h> #include <QtCore/qcoreevent.h> diff --git a/src/plugins/gstreamer/qgstreamervideowindow.cpp b/src/gsttools/qgstreamervideowindow.cpp index 4891ea899..077060fd2 100644 --- a/src/plugins/gstreamer/qgstreamervideowindow.cpp +++ b/src/gsttools/qgstreamervideowindow.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgstreamervideowindow.h" +#include "qgstreamervideowindow_p.h" #include <private/qgstutils_p.h> #include <QtCore/qdebug.h> diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp index 03c31fbdf..b29ca367c 100644 --- a/src/gsttools/qgstutils.cpp +++ b/src/gsttools/qgstutils.cpp @@ -45,6 +45,8 @@ #include <QtCore/qbytearray.h> #include <QtCore/qvariant.h> #include <QtCore/qsize.h> +#include <QtCore/qset.h> +#include <QtCore/qstringlist.h> #include <qaudioformat.h> QT_BEGIN_NAMESPACE @@ -313,4 +315,90 @@ GstCaps *QGstUtils::capsForAudioFormat(QAudioFormat format) return caps; } +void QGstUtils::initializeGst() +{ + static bool initialized = false; + if (!initialized) { + initialized = true; + gst_init(NULL, NULL); + } +} + +namespace { + const char* getCodecAlias(const QString &codec) + { + if (codec.startsWith("avc1.")) + return "video/x-h264"; + + if (codec.startsWith("mp4a.")) + return "audio/mpeg4"; + + if (codec.startsWith("mp4v.20.")) + return "video/mpeg4"; + + if (codec == "samr") + return "audio/amr"; + + return 0; + } + + const char* getMimeTypeAlias(const QString &mimeType) + { + if (mimeType == "video/mp4") + return "video/mpeg4"; + + if (mimeType == "audio/mp4") + return "audio/mpeg4"; + + if (mimeType == "video/ogg" + || mimeType == "audio/ogg") + return "application/ogg"; + + return 0; + } +} + +QtMultimedia::SupportEstimate QGstUtils::hasSupport(const QString &mimeType, + const QStringList &codecs, + const QSet<QString> &supportedMimeTypeSet) +{ + if (supportedMimeTypeSet.isEmpty()) + return QtMultimedia::NotSupported; + + QString mimeTypeLowcase = mimeType.toLower(); + bool containsMimeType = supportedMimeTypeSet.contains(mimeTypeLowcase); + if (!containsMimeType) { + const char* mimeTypeAlias = getMimeTypeAlias(mimeTypeLowcase); + containsMimeType = supportedMimeTypeSet.contains(mimeTypeAlias); + if (!containsMimeType) { + containsMimeType = supportedMimeTypeSet.contains("video/" + mimeTypeLowcase) + || supportedMimeTypeSet.contains("video/x-" + mimeTypeLowcase) + || supportedMimeTypeSet.contains("audio/" + mimeTypeLowcase) + || supportedMimeTypeSet.contains("audio/x-" + mimeTypeLowcase); + } + } + + int supportedCodecCount = 0; + foreach (const QString &codec, codecs) { + QString codecLowcase = codec.toLower(); + const char* codecAlias = getCodecAlias(codecLowcase); + if (codecAlias) { + if (supportedMimeTypeSet.contains(codecAlias)) + supportedCodecCount++; + } else if (supportedMimeTypeSet.contains("video/" + codecLowcase) + || supportedMimeTypeSet.contains("video/x-" + codecLowcase) + || supportedMimeTypeSet.contains("audio/" + codecLowcase) + || supportedMimeTypeSet.contains("audio/x-" + codecLowcase)) { + supportedCodecCount++; + } + } + if (supportedCodecCount > 0 && supportedCodecCount == codecs.size()) + return QtMultimedia::ProbablySupported; + + if (supportedCodecCount == 0 && !containsMimeType) + return QtMultimedia::NotSupported; + + return QtMultimedia::MaybeSupported; +} + QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/qx11videosurface.cpp b/src/gsttools/qx11videosurface.cpp index c4d01a826..232041b1d 100644 --- a/src/plugins/gstreamer/qx11videosurface.cpp +++ b/src/gsttools/qx11videosurface.cpp @@ -45,7 +45,7 @@ #include <QtGui/qplatformnativeinterface_qpa.h> #include <qvideosurfaceformat.h> -#include "qx11videosurface.h" +#include "qx11videosurface_p.h" Q_DECLARE_METATYPE(XvImage*); diff --git a/src/plugins/gstreamer/gstvideoconnector.h b/src/multimedia/gsttools_headers/gstvideoconnector_p.h index 1ac973f43..1ac973f43 100644 --- a/src/plugins/gstreamer/gstvideoconnector.h +++ b/src/multimedia/gsttools_headers/gstvideoconnector_p.h diff --git a/src/plugins/gstreamer/qgstappsrc.h b/src/multimedia/gsttools_headers/qgstappsrc_p.h index dc817e8f0..dc817e8f0 100644 --- a/src/plugins/gstreamer/qgstappsrc.h +++ b/src/multimedia/gsttools_headers/qgstappsrc_p.h diff --git a/src/plugins/gstreamer/qgstcodecsinfo.h b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h index 58e843bcf..58e843bcf 100644 --- a/src/plugins/gstreamer/qgstcodecsinfo.h +++ b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h diff --git a/src/plugins/gstreamer/qgstreameraudioinputendpointselector.h b/src/multimedia/gsttools_headers/qgstreameraudioinputendpointselector_p.h index 5d5bc715d..5d5bc715d 100644 --- a/src/plugins/gstreamer/qgstreameraudioinputendpointselector.h +++ b/src/multimedia/gsttools_headers/qgstreameraudioinputendpointselector_p.h diff --git a/src/plugins/gstreamer/qgstreameraudioprobecontrol.h b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h index 90fc5840d..beb6dca1f 100644 --- a/src/plugins/gstreamer/qgstreameraudioprobecontrol.h +++ b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h @@ -45,7 +45,7 @@ #include <gst/gst.h> #include <qmediaaudioprobecontrol.h> #include <QtCore/qmutex.h> -#include "qaudiobuffer.h" +#include <qaudiobuffer.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/gstreamer/qgstreamergltexturerenderer.h b/src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h index b35964dfd..f18b74b8f 100644 --- a/src/plugins/gstreamer/qgstreamergltexturerenderer.h +++ b/src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h @@ -46,7 +46,7 @@ #include <private/qvideosurfacegstsink_p.h> #include <private/qgstreamerbushelper_p.h> -#include "qgstreamervideorendererinterface.h" +#include "qgstreamervideorendererinterface_p.h" #include <QtGui/qcolor.h> #include <X11/extensions/Xv.h> diff --git a/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.h b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h index f51a9c82f..f51a9c82f 100644 --- a/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.h +++ b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h diff --git a/src/plugins/gstreamer/qgstreamervideooverlay.h b/src/multimedia/gsttools_headers/qgstreamervideooverlay_p.h index 9e0fc40d4..c92c5fff3 100644 --- a/src/plugins/gstreamer/qgstreamervideooverlay.h +++ b/src/multimedia/gsttools_headers/qgstreamervideooverlay_p.h @@ -44,7 +44,7 @@ #include <qvideowindowcontrol.h> -#include "qgstreamervideorendererinterface.h" +#include "qgstreamervideorendererinterface_p.h" QT_BEGIN_NAMESPACE class QAbstractVideoSurface; diff --git a/src/plugins/gstreamer/qgstreamervideoprobecontrol.h b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h index 499983bf0..062040fca 100644 --- a/src/plugins/gstreamer/qgstreamervideoprobecontrol.h +++ b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h @@ -45,7 +45,7 @@ #include <gst/gst.h> #include <qmediavideoprobecontrol.h> #include <QtCore/qmutex.h> -#include "qvideoframe.h" +#include <qvideoframe.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/gstreamer/qgstreamervideorenderer.h b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h index b50139fd4..76a108156 100644 --- a/src/plugins/gstreamer/qgstreamervideorenderer.h +++ b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h @@ -45,7 +45,7 @@ #include <qvideorenderercontrol.h> #include <private/qvideosurfacegstsink_p.h> -#include "qgstreamervideorendererinterface.h" +#include "qgstreamervideorendererinterface_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/gstreamer/qgstreamervideorendererinterface.h b/src/multimedia/gsttools_headers/qgstreamervideorendererinterface_p.h index 42f6d5d5a..42f6d5d5a 100644 --- a/src/plugins/gstreamer/qgstreamervideorendererinterface.h +++ b/src/multimedia/gsttools_headers/qgstreamervideorendererinterface_p.h diff --git a/src/plugins/gstreamer/qgstreamervideowidget.h b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h index 59d69eb3b..ab0d49377 100644 --- a/src/plugins/gstreamer/qgstreamervideowidget.h +++ b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h @@ -44,7 +44,7 @@ #include <qvideowidgetcontrol.h> -#include "qgstreamervideorendererinterface.h" +#include "qgstreamervideorendererinterface_p.h" #include <private/qgstreamerbushelper_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/gstreamer/qgstreamervideowindow.h b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h index 8c962defa..da8af5a8c 100644 --- a/src/plugins/gstreamer/qgstreamervideowindow.h +++ b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h @@ -44,7 +44,7 @@ #include <qvideowindowcontrol.h> -#include "qgstreamervideorendererinterface.h" +#include "qgstreamervideorendererinterface_p.h" #include <private/qgstreamerbushelper_p.h> #include <QtGui/qcolor.h> diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h index 45bf76e1a..5a188c124 100644 --- a/src/multimedia/gsttools_headers/qgstutils_p.h +++ b/src/multimedia/gsttools_headers/qgstutils_p.h @@ -54,6 +54,7 @@ // #include <QtCore/qmap.h> +#include <QtCore/qset.h> #include <gst/gst.h> #include <qaudioformat.h> @@ -71,6 +72,10 @@ namespace QGstUtils { QAudioFormat audioFormatForCaps(const GstCaps *caps); QAudioFormat audioFormatForBuffer(GstBuffer *buffer); GstCaps *capsForAudioFormat(QAudioFormat format); + void initializeGst(); + QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, + const QStringList &codecs, + const QSet<QString> &supportedMimeTypeSet); } QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/qx11videosurface.h b/src/multimedia/gsttools_headers/qx11videosurface_p.h index 243c06907..243c06907 100644 --- a/src/plugins/gstreamer/qx11videosurface.h +++ b/src/multimedia/gsttools_headers/qx11videosurface_p.h diff --git a/src/plugins/gstreamer/audiodecoder/audiodecoder.json b/src/plugins/gstreamer/audiodecoder/audiodecoder.json new file mode 100644 index 000000000..3cc81dc72 --- /dev/null +++ b/src/plugins/gstreamer/audiodecoder/audiodecoder.json @@ -0,0 +1,3 @@ +{ + "Keys": ["org.qt-project.qt.audiodecode"] +} diff --git a/src/plugins/gstreamer/audiodecoder/audiodecoder.pri b/src/plugins/gstreamer/audiodecoder/audiodecoder.pri deleted file mode 100644 index d2711e017..000000000 --- a/src/plugins/gstreamer/audiodecoder/audiodecoder.pri +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDEPATH += $$PWD - -DEFINES += QMEDIA_GSTREAMER_AUDIO_DECODER - -HEADERS += \ - $$PWD/qgstreameraudiodecodercontrol.h \ - $$PWD/qgstreameraudiodecoderservice.h \ - $$PWD/qgstreameraudiodecodersession.h - -SOURCES += \ - $$PWD/qgstreameraudiodecodercontrol.cpp \ - $$PWD/qgstreameraudiodecoderservice.cpp \ - $$PWD/qgstreameraudiodecodersession.cpp - - diff --git a/src/plugins/gstreamer/audiodecoder/audiodecoder.pro b/src/plugins/gstreamer/audiodecoder/audiodecoder.pro new file mode 100644 index 000000000..a0dfcafec --- /dev/null +++ b/src/plugins/gstreamer/audiodecoder/audiodecoder.pro @@ -0,0 +1,30 @@ +load(qt_module) + +TARGET = gstaudiodecoder +PLUGIN_TYPE = mediaservice + +load(qt_plugin) +DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE} + +include(../common.pri) + +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/qgstreameraudiodecodercontrol.h \ + $$PWD/qgstreameraudiodecoderservice.h \ + $$PWD/qgstreameraudiodecodersession.h \ + $$PWD/qgstreameraudiodecoderserviceplugin.h + +SOURCES += \ + $$PWD/qgstreameraudiodecodercontrol.cpp \ + $$PWD/qgstreameraudiodecoderservice.cpp \ + $$PWD/qgstreameraudiodecodersession.cpp \ + $$PWD/qgstreameraudiodecoderserviceplugin.cpp + +target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE} +INSTALLS += target + +OTHER_FILES += \ + audiodecoder.json + diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp new file mode 100644 index 000000000..c52aee3a5 --- /dev/null +++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp @@ -0,0 +1,180 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgstreameraudiodecoderserviceplugin.h" + +#include "qgstreameraudiodecoderservice.h" +#include <private/qgstutils_p.h> + +#include <QtCore/qstring.h> +#include <QtCore/qdebug.h> +#include <QtCore/QDir> +#include <QtCore/QDebug> + +#include <linux/types.h> +#include <sys/time.h> +#include <sys/ioctl.h> +#include <sys/poll.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <sys/mman.h> +#include <linux/videodev2.h> +#include <gst/gst.h> + +// #define QT_SUPPORTEDMIMETYPES_DEBUG + +QMediaService* QGstreamerAudioDecoderServicePlugin::create(const QString &key) +{ + QGstUtils::initializeGst(); + + if (key == QLatin1String(Q_MEDIASERVICE_AUDIODECODER)) + return new QGstreamerAudioDecoderService; + + qWarning() << "Gstreamer audio decoder service plugin: unsupported key:" << key; + return 0; +} + +void QGstreamerAudioDecoderServicePlugin::release(QMediaService *service) +{ + delete service; +} + +QtMultimedia::SupportEstimate QGstreamerAudioDecoderServicePlugin::hasSupport(const QString &mimeType, + const QStringList &codecs) const +{ + if (m_supportedMimeTypeSet.isEmpty()) + updateSupportedMimeTypes(); + + return QGstUtils::hasSupport(mimeType, codecs, m_supportedMimeTypeSet); +} + +void QGstreamerAudioDecoderServicePlugin::updateSupportedMimeTypes() const +{ + //enumerate supported mime types + gst_init(NULL, NULL); + + GList *plugins, *orig_plugins; + orig_plugins = plugins = gst_default_registry_get_plugin_list (); + + while (plugins) { + GList *features, *orig_features; + + GstPlugin *plugin = (GstPlugin *) (plugins->data); + plugins = g_list_next (plugins); + + if (plugin->flags & (1<<1)) //GST_PLUGIN_FLAG_BLACKLISTED + continue; + + orig_features = features = gst_registry_get_feature_list_by_plugin(gst_registry_get_default (), + plugin->desc.name); + while (features) { + if (!G_UNLIKELY(features->data == NULL)) { + GstPluginFeature *feature = GST_PLUGIN_FEATURE(features->data); + if (GST_IS_ELEMENT_FACTORY (feature)) { + GstElementFactory *factory = GST_ELEMENT_FACTORY(gst_plugin_feature_load(feature)); + if (factory + && factory->numpadtemplates > 0 + && (qstrcmp(factory->details.klass, "Codec/Decoder/Audio") == 0 + || qstrcmp(factory->details.klass, "Codec/Demux") == 0 )) { + const GList *pads = factory->staticpadtemplates; + while (pads) { + GstStaticPadTemplate *padtemplate = (GstStaticPadTemplate*)(pads->data); + pads = g_list_next (pads); + if (padtemplate->direction != GST_PAD_SINK) + continue; + if (padtemplate->static_caps.string) { + GstCaps *caps = gst_static_caps_get(&padtemplate->static_caps); + if (!gst_caps_is_any (caps) && ! gst_caps_is_empty (caps)) { + for (guint i = 0; i < gst_caps_get_size(caps); i++) { + GstStructure *structure = gst_caps_get_structure(caps, i); + QString nameLowcase = QString(gst_structure_get_name (structure)).toLower(); + + m_supportedMimeTypeSet.insert(nameLowcase); + if (nameLowcase.contains("mpeg")) { + //Because mpeg version number is only included in the detail + //description, it is necessary to manually extract this information + //in order to match the mime type of mpeg4. + const GValue *value = gst_structure_get_value(structure, "mpegversion"); + if (value) { + gchar *str = gst_value_serialize (value); + QString versions(str); + QStringList elements = versions.split(QRegExp("\\D+"), QString::SkipEmptyParts); + foreach (const QString &e, elements) + m_supportedMimeTypeSet.insert(nameLowcase + e); + g_free (str); + } + } + } + } + } + } + gst_object_unref (factory); + } + } else if (GST_IS_TYPE_FIND_FACTORY(feature)) { + QString name(gst_plugin_feature_get_name(feature)); + if (name.contains('/')) //filter out any string without '/' which is obviously not a mime type + m_supportedMimeTypeSet.insert(name.toLower()); + } + } + features = g_list_next (features); + } + gst_plugin_feature_list_free (orig_features); + } + gst_plugin_list_free (orig_plugins); + +#if defined QT_SUPPORTEDMIMETYPES_DEBUG + QStringList list = m_supportedMimeTypeSet.toList(); + list.sort(); + if (qgetenv("QT_DEBUG_PLUGINS").toInt() > 0) { + foreach (const QString &type, list) + qDebug() << type; + } +#endif +} + +QStringList QGstreamerAudioDecoderServicePlugin::supportedMimeTypes() const +{ + return QStringList(); +} + diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h new file mode 100644 index 000000000..d30adff55 --- /dev/null +++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGSTREAMERAUDIODECODERSERVICEPLUGIN_H +#define QGSTREAMERAUDIODECODERSERVICEPLUGIN_H + +#include <qmediaserviceproviderplugin.h> +#include <QtCore/qset.h> +#include <QtCore/QObject> + +QT_BEGIN_NAMESPACE + +class QGstreamerAudioDecoderServicePlugin + : public QMediaServiceProviderPlugin + , public QMediaServiceSupportedFormatsInterface +{ + Q_OBJECT + Q_INTERFACES(QMediaServiceSupportedFormatsInterface) + Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "audiodecoder.json") + +public: + QMediaService* create(QString const& key); + void release(QMediaService *service); + + QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const; + QStringList supportedMimeTypes() const; + +private: + void updateSupportedMimeTypes() const; + + mutable QSet<QString> m_supportedMimeTypeSet; +}; + +QT_END_NAMESPACE + +#endif // QGSTREAMERAUDIODECODERSERVICEPLUGIN_H diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h index 301123d13..9eec77bfd 100644 --- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h +++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h @@ -49,7 +49,7 @@ #include "qaudiodecoder.h" #if defined(HAVE_GST_APPSRC) -#include "qgstappsrc.h" +#include <private/qgstappsrc_p.h> #endif #include <gst/gst.h> diff --git a/src/plugins/gstreamer/camerabin/camerabin.pri b/src/plugins/gstreamer/camerabin/camerabin.pro index 5c266e784..f79c625cd 100644 --- a/src/plugins/gstreamer/camerabin/camerabin.pri +++ b/src/plugins/gstreamer/camerabin/camerabin.pro @@ -1,10 +1,18 @@ +load(qt_module) + +TARGET = gstcamerabin +PLUGIN_TYPE = mediaservice + +load(qt_plugin) +DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE} + +include(../common.pri) + INCLUDEPATH += $$PWD \ $${SOURCE_DIR}/src/multimedia INCLUDEPATH += camerabin -DEFINES += QMEDIA_GSTREAMER_CAMERABIN - LIBS += -lgstphotography-0.10 DEFINES += GST_USE_UNSTABLE_API #prevents warnings because of unstable photography API @@ -48,3 +56,15 @@ SOURCES += \ $$PWD/camerabinresourcepolicy.cpp \ $$PWD/camerabincapturedestination.cpp \ $$PWD/camerabincapturebufferformat.cpp + +maemo6 { + HEADERS += \ + $$PWD/camerabuttonlistener_meego.h + + SOURCES += \ + $$PWD/camerabuttonlistener_meego.cpp +} + +target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE} +INSTALLS += target + diff --git a/src/plugins/gstreamer/camerabuttonlistener_meego.cpp b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp index 026f49bc5..026f49bc5 100644 --- a/src/plugins/gstreamer/camerabuttonlistener_meego.cpp +++ b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp diff --git a/src/plugins/gstreamer/camerabuttonlistener_meego.h b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h index 01cc3894b..01cc3894b 100644 --- a/src/plugins/gstreamer/camerabuttonlistener_meego.h +++ b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h diff --git a/src/plugins/gstreamer/common.pri b/src/plugins/gstreamer/common.pri new file mode 100644 index 000000000..582b79a6c --- /dev/null +++ b/src/plugins/gstreamer/common.pri @@ -0,0 +1,39 @@ + +QT += multimedia-private network +CONFIG += no_private_qt_headers_warning + +!isEmpty(QT.widgets.name) { + QT += widgets multimediawidgets-private + DEFINES += HAVE_WIDGETS +} + +LIBS += -lqgsttools_p + +CONFIG += link_pkgconfig + +PKGCONFIG += \ + gstreamer-0.10 \ + gstreamer-base-0.10 \ + gstreamer-interfaces-0.10 \ + gstreamer-audio-0.10 \ + gstreamer-video-0.10 \ + gstreamer-pbutils-0.10 + +maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10 + +contains(config_test_resourcepolicy, yes) { + DEFINES += HAVE_RESOURCE_POLICY + PKGCONFIG += libresourceqt1 +} + +contains(config_test_xvideo, yes):!isEmpty(QT.widgets.name): { + DEFINES += HAVE_XVIDEO + LIBS += -lXv -lX11 -lXext +} + +contains(config_test_gstreamer_appsrc, yes) { + PKGCONFIG += gstreamer-app-0.10 + DEFINES += HAVE_GST_APPSRC + LIBS += -lgstapp-0.10 +} + diff --git a/src/plugins/gstreamer/gstreamer.pro b/src/plugins/gstreamer/gstreamer.pro index 073ef43ca..17f9e65e0 100644 --- a/src/plugins/gstreamer/gstreamer.pro +++ b/src/plugins/gstreamer/gstreamer.pro @@ -1,119 +1,14 @@ +TEMPLATE = subdirs -load(qt_module) +SUBDIRS += \ + audiodecoder \ + mediacapture \ + mediaplayer -TARGET = qgstengine -QT += multimedia-private network -CONFIG += no_private_qt_headers_warning - -!isEmpty(QT.widgets.name) { - QT += widgets multimediawidgets-private - DEFINES += HAVE_WIDGETS -} - -PLUGIN_TYPE=mediaservice - -load(qt_plugin) -DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE} - -LIBS += -lqgsttools_p - -unix:!maemo*:contains(QT_CONFIG, alsa) { - DEFINES += HAVE_ALSA - LIBS += -lasound -} - -CONFIG += link_pkgconfig - -PKGCONFIG += \ - gstreamer-0.10 \ - gstreamer-base-0.10 \ - gstreamer-interfaces-0.10 \ - gstreamer-audio-0.10 \ - gstreamer-video-0.10 \ - gstreamer-pbutils-0.10 - -maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10 - -contains(config_test_resourcepolicy, yes) { - DEFINES += HAVE_RESOURCE_POLICY - PKGCONFIG += libresourceqt1 -} - -maemo6 { - HEADERS += camerabuttonlistener_meego.h - SOURCES += camerabuttonlistener_meego.cpp - - PKGCONFIG += qmsystem2 - - contains(QT_CONFIG, opengles2):!isEmpty(QT.widgets.name) { - HEADERS += qgstreamergltexturerenderer.h - SOURCES += qgstreamergltexturerenderer.cpp - QT += opengl - LIBS += -lEGL -lgstmeegointerfaces-0.10 +# Camerabin2 based camera backend is untested and currently disabled +disabled { + contains(config_test_gstreamer_photography, yes) { + SUBDIRS += camerabin } } -HEADERS += \ - qgstreamervideorendererinterface.h \ - qgstreamerserviceplugin.h \ - qgstreameraudioinputendpointselector.h \ - qgstreamervideorenderer.h \ - qgstreamervideoinputdevicecontrol.h \ - gstvideoconnector.h \ - qgstcodecsinfo.h \ - qgstreamervideoprobecontrol.h \ - qgstreameraudioprobecontrol.h \ - -SOURCES += \ - qgstreamervideorendererinterface.cpp \ - qgstreamerserviceplugin.cpp \ - qgstreameraudioinputendpointselector.cpp \ - qgstreamervideorenderer.cpp \ - qgstreamervideoinputdevicecontrol.cpp \ - qgstcodecsinfo.cpp \ - gstvideoconnector.c \ - qgstreamervideoprobecontrol.cpp \ - qgstreameraudioprobecontrol.cpp \ - - -contains(config_test_xvideo, yes):!isEmpty(QT.widgets.name): { - DEFINES += HAVE_XVIDEO - - LIBS += -lXv -lX11 -lXext - - HEADERS += \ - qgstreamervideooverlay.h \ - qgstreamervideowindow.h \ - qgstreamervideowidget.h \ - qx11videosurface.h \ - - SOURCES += \ - qgstreamervideooverlay.cpp \ - qgstreamervideowindow.cpp \ - qgstreamervideowidget.cpp \ - qx11videosurface.cpp \ -} -include(mediaplayer/mediaplayer.pri) -include(mediacapture/mediacapture.pri) -include(audiodecoder/audiodecoder.pri) - -contains(config_test_gstreamer_appsrc, yes) { - PKGCONFIG += gstreamer-app-0.10 - HEADERS += $$PWD/qgstappsrc.h - SOURCES += $$PWD/qgstappsrc.cpp - - DEFINES += HAVE_GST_APPSRC - - LIBS += -lgstapp-0.10 -} - -OTHER_FILES += gstreamer.json - - -#Camerabin2 based camera backend is untested and currently disabled -#contains(config_test_gstreamer_photography, yes) { -# include(camerabin/camerabin.pri) -#} - -target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE} -INSTALLS += target diff --git a/src/plugins/gstreamer/mediacapture/mediacapture.json b/src/plugins/gstreamer/mediacapture/mediacapture.json new file mode 100644 index 000000000..d963a2e3e --- /dev/null +++ b/src/plugins/gstreamer/mediacapture/mediacapture.json @@ -0,0 +1,3 @@ +{ + "Keys": ["org.qt-project.qt.audiosource"] +} diff --git a/src/plugins/gstreamer/mediacapture/mediacapture.pri b/src/plugins/gstreamer/mediacapture/mediacapture.pro index b7f7794f9..f0e984f46 100644 --- a/src/plugins/gstreamer/mediacapture/mediacapture.pri +++ b/src/plugins/gstreamer/mediacapture/mediacapture.pro @@ -1,6 +1,14 @@ -INCLUDEPATH += $$PWD +load(qt_module) + +TARGET = gstmediacapture +PLUGIN_TYPE = mediaservice + +load(qt_plugin) +DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE} -DEFINES += QMEDIA_GSTREAMER_CAPTURE +include(../common.pri) + +INCLUDEPATH += $$PWD HEADERS += $$PWD/qgstreamercaptureservice.h \ $$PWD/qgstreamercapturesession.h \ @@ -12,7 +20,8 @@ HEADERS += $$PWD/qgstreamercaptureservice.h \ $$PWD/qgstreamerv4l2input.h \ $$PWD/qgstreamercapturemetadatacontrol.h \ $$PWD/qgstreamerimagecapturecontrol.h \ - $$PWD/qgstreamerimageencode.h + $$PWD/qgstreamerimageencode.h \ + $$PWD/qgstreamercaptureserviceplugin.h SOURCES += $$PWD/qgstreamercaptureservice.cpp \ $$PWD/qgstreamercapturesession.cpp \ @@ -24,4 +33,22 @@ SOURCES += $$PWD/qgstreamercaptureservice.cpp \ $$PWD/qgstreamerv4l2input.cpp \ $$PWD/qgstreamercapturemetadatacontrol.cpp \ $$PWD/qgstreamerimagecapturecontrol.cpp \ - $$PWD/qgstreamerimageencode.cpp + $$PWD/qgstreamerimageencode.cpp \ + $$PWD/qgstreamercaptureserviceplugin.cpp + +target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE} +INSTALLS += target + +# Camera usage with gstreamer needs to have +#CONFIG += use_gstreamer_camera + +use_gstreamer_camera { +DEFINES += USE_GSTREAMER_CAMERA + +OTHER_FILES += \ + mediacapturecamera.json +} else { +OTHER_FILES += \ + mediacapture.json +} + diff --git a/src/plugins/gstreamer/mediacapture/mediacapturecamera.json b/src/plugins/gstreamer/mediacapture/mediacapturecamera.json new file mode 100644 index 000000000..b31238363 --- /dev/null +++ b/src/plugins/gstreamer/mediacapture/mediacapturecamera.json @@ -0,0 +1,3 @@ +{ + "Keys": ["org.qt-project.qt.audiosource", "org.qt-project.qt.camera"] +} diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp index 405cc5778..bacc9c9ca 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp @@ -51,16 +51,16 @@ #include "qgstreamerv4l2input.h" #include "qgstreamercapturemetadatacontrol.h" -#include "qgstreameraudioinputendpointselector.h" -#include "qgstreamervideoinputdevicecontrol.h" #include "qgstreamerimagecapturecontrol.h" -#include "qgstreameraudioprobecontrol.h" +#include <private/qgstreameraudioinputendpointselector_p.h> +#include <private/qgstreamervideoinputdevicecontrol_p.h> +#include <private/qgstreameraudioprobecontrol_p.h> -#include "qgstreamervideorenderer.h" +#include <private/qgstreamervideorenderer_p.h> #if defined(HAVE_WIDGETS) -#include "qgstreamervideooverlay.h" -#include "qgstreamervideowidget.h" +#include <private/qgstreamervideooverlay_p.h> +#include <private/qgstreamervideowidget_p.h> #endif #include <qmediaserviceproviderplugin.h> diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h index 036d19ecb..80445e452 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h +++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h @@ -46,6 +46,7 @@ #include <qmediacontrol.h> #include <gst/gst.h> + QT_BEGIN_NAMESPACE class QAudioEndpointSelector; class QVideoDeviceControl; @@ -74,7 +75,7 @@ public: void releaseControl(QMediaControl *); private: - void setAudioPreview(GstElement*); + void setAudioPreview(GstElement *); QGstreamerCaptureSession *m_captureSession; QGstreamerCameraControl *m_cameraControl; diff --git a/src/plugins/gstreamer/qgstreamerserviceplugin.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp index d9811d651..1dc2c4b33 100644 --- a/src/plugins/gstreamer/qgstreamerserviceplugin.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp @@ -44,27 +44,12 @@ #include <QtCore/QDir> #include <QtCore/QDebug> -#include "qgstreamerserviceplugin.h" +#include "qgstreamercaptureserviceplugin.h" //#define QT_SUPPORTEDMIMETYPES_DEBUG -#ifdef QMEDIA_GSTREAMER_PLAYER -#include "qgstreamerplayerservice.h" -#endif - -#if defined(QMEDIA_GSTREAMER_CAPTURE) #include "qgstreamercaptureservice.h" -#endif - -#ifdef QMEDIA_GSTREAMER_CAMERABIN -#include "camerabinservice.h" -#endif - -#ifdef QMEDIA_GSTREAMER_AUDIO_DECODER -#include "qgstreameraudiodecoderservice.h" -#endif - -#include <qmediaserviceproviderplugin.h> +#include <private/qgstutils_p.h> #include <linux/types.h> #include <sys/time.h> @@ -77,60 +62,40 @@ #include <stdlib.h> #include <sys/mman.h> #include <linux/videodev2.h> +#include <gst/gst.h> - -QMediaService* QGstreamerServicePlugin::create(const QString &key) +QMediaService* QGstreamerCaptureServicePlugin::create(const QString &key) { - static bool initialized = false; - if (!initialized) { - initialized = true; - gst_init(NULL, NULL); - } + QGstUtils::initializeGst(); -#ifdef QMEDIA_GSTREAMER_PLAYER - if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)) - return new QGstreamerPlayerService; -#endif - -#ifdef QMEDIA_GSTREAMER_CAMERABIN - if (key == QLatin1String(Q_MEDIASERVICE_CAMERA) && CameraBinService::isCameraBinAvailable()) - return new CameraBinService(key); -#endif - -#ifdef QMEDIA_GSTREAMER_AUDIO_DECODER - if (key == QLatin1String(Q_MEDIASERVICE_AUDIODECODER)) - return new QGstreamerAudioDecoderService; -#endif - -#ifdef QMEDIA_GSTREAMER_CAPTURE if (key == QLatin1String(Q_MEDIASERVICE_AUDIOSOURCE)) return new QGstreamerCaptureService(key); +#if defined(USE_GSTREAMER_CAMERA) if (key == QLatin1String(Q_MEDIASERVICE_CAMERA)) return new QGstreamerCaptureService(key); #endif - qWarning() << "Gstreamer service plugin: unsupported key:" << key; + qWarning() << "Gstreamer capture service plugin: unsupported key:" << key; return 0; } -void QGstreamerServicePlugin::release(QMediaService *service) +void QGstreamerCaptureServicePlugin::release(QMediaService *service) { delete service; } -QMediaServiceProviderHint::Features QGstreamerServicePlugin::supportedFeatures( +#if defined(USE_GSTREAMER_CAMERA) +QMediaServiceProviderHint::Features QGstreamerCaptureServicePlugin::supportedFeatures( const QByteArray &service) const { - if (service == Q_MEDIASERVICE_MEDIAPLAYER) - return QMediaServiceProviderHint::StreamPlayback | QMediaServiceProviderHint::VideoSurface; - else if (service == Q_MEDIASERVICE_CAMERA) + if (service == Q_MEDIASERVICE_CAMERA) return QMediaServiceProviderHint::VideoSurface; - else - return QMediaServiceProviderHint::Features(); + + return QMediaServiceProviderHint::Features(); } -QList<QByteArray> QGstreamerServicePlugin::devices(const QByteArray &service) const +QList<QByteArray> QGstreamerCaptureServicePlugin::devices(const QByteArray &service) const { if (service == Q_MEDIASERVICE_CAMERA) { if (m_cameraDevices.isEmpty()) @@ -142,7 +107,7 @@ QList<QByteArray> QGstreamerServicePlugin::devices(const QByteArray &service) co return QList<QByteArray>(); } -QString QGstreamerServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device) +QString QGstreamerCaptureServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device) { if (service == Q_MEDIASERVICE_CAMERA) { if (m_cameraDevices.isEmpty()) @@ -156,7 +121,7 @@ QString QGstreamerServicePlugin::deviceDescription(const QByteArray &service, co return QString(); } -QVariant QGstreamerServicePlugin::deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property) +QVariant QGstreamerCaptureServicePlugin::deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property) { Q_UNUSED(service); Q_UNUSED(device); @@ -164,17 +129,11 @@ QVariant QGstreamerServicePlugin::deviceProperty(const QByteArray &service, cons return QVariant(); } -void QGstreamerServicePlugin::updateDevices() const +void QGstreamerCaptureServicePlugin::updateDevices() const { m_cameraDevices.clear(); m_cameraDescriptions.clear(); -#ifdef Q_WS_MAEMO_6 - m_cameraDevices << "primary" << "secondary"; - m_cameraDescriptions << tr("Main camera") << tr("Front camera"); - return; -#endif - QDir devDir("/dev"); devDir.setFilter(QDir::System); @@ -216,84 +175,18 @@ void QGstreamerServicePlugin::updateDevices() const ::close(fd); } } +#endif -namespace { - const char* getCodecAlias(const QString &codec) - { - if (codec.startsWith("avc1.")) - return "video/x-h264"; - - if (codec.startsWith("mp4a.")) - return "audio/mpeg4"; - - if (codec.startsWith("mp4v.20.")) - return "video/mpeg4"; - - if (codec == "samr") - return "audio/amr"; - - return 0; - } - - const char* getMimeTypeAlias(const QString &mimeType) - { - if (mimeType == "video/mp4") - return "video/mpeg4"; - - if (mimeType == "audio/mp4") - return "audio/mpeg4"; - - if (mimeType == "video/ogg" - || mimeType == "audio/ogg") - return "application/ogg"; - - return 0; - } -} - -QtMultimedia::SupportEstimate QGstreamerServicePlugin::hasSupport(const QString &mimeType, +QtMultimedia::SupportEstimate QGstreamerCaptureServicePlugin::hasSupport(const QString &mimeType, const QStringList& codecs) const { if (m_supportedMimeTypeSet.isEmpty()) updateSupportedMimeTypes(); - QString mimeTypeLowcase = mimeType.toLower(); - bool containsMimeType = m_supportedMimeTypeSet.contains(mimeTypeLowcase); - if (!containsMimeType) { - const char* mimeTypeAlias = getMimeTypeAlias(mimeTypeLowcase); - containsMimeType = m_supportedMimeTypeSet.contains(mimeTypeAlias); - if (!containsMimeType) { - containsMimeType = m_supportedMimeTypeSet.contains("video/" + mimeTypeLowcase) - || m_supportedMimeTypeSet.contains("video/x-" + mimeTypeLowcase) - || m_supportedMimeTypeSet.contains("audio/" + mimeTypeLowcase) - || m_supportedMimeTypeSet.contains("audio/x-" + mimeTypeLowcase); - } - } - - int supportedCodecCount = 0; - foreach(const QString &codec, codecs) { - QString codecLowcase = codec.toLower(); - const char* codecAlias = getCodecAlias(codecLowcase); - if (codecAlias) { - if (m_supportedMimeTypeSet.contains(codecAlias)) - supportedCodecCount++; - } else if (m_supportedMimeTypeSet.contains("video/" + codecLowcase) - || m_supportedMimeTypeSet.contains("video/x-" + codecLowcase) - || m_supportedMimeTypeSet.contains("audio/" + codecLowcase) - || m_supportedMimeTypeSet.contains("audio/x-" + codecLowcase)) { - supportedCodecCount++; - } - } - if (supportedCodecCount > 0 && supportedCodecCount == codecs.size()) - return QtMultimedia::ProbablySupported; - - if (supportedCodecCount == 0 && !containsMimeType) - return QtMultimedia::NotSupported; - - return QtMultimedia::MaybeSupported; + return QGstUtils::hasSupport(mimeType, codecs, m_supportedMimeTypeSet); } -void QGstreamerServicePlugin::updateSupportedMimeTypes() const +void QGstreamerCaptureServicePlugin::updateSupportedMimeTypes() const { //enumerate supported mime types gst_init(NULL, NULL); @@ -345,7 +238,7 @@ void QGstreamerServicePlugin::updateSupportedMimeTypes() const gchar *str = gst_value_serialize (value); QString versions(str); QStringList elements = versions.split(QRegExp("\\D+"), QString::SkipEmptyParts); - foreach(const QString &e, elements) + foreach (const QString &e, elements) m_supportedMimeTypeSet.insert(nameLowcase + e); g_free (str); } @@ -372,13 +265,13 @@ void QGstreamerServicePlugin::updateSupportedMimeTypes() const QStringList list = m_supportedMimeTypeSet.toList(); list.sort(); if (qgetenv("QT_DEBUG_PLUGINS").toInt() > 0) { - foreach(const QString &type, list) + foreach (const QString &type, list) qDebug() << type; } #endif } -QStringList QGstreamerServicePlugin::supportedMimeTypes() const +QStringList QGstreamerCaptureServicePlugin::supportedMimeTypes() const { return QStringList(); } diff --git a/src/plugins/gstreamer/qgstreamerserviceplugin.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h index 96239a6da..8837e2e06 100644 --- a/src/plugins/gstreamer/qgstreamerserviceplugin.h +++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h @@ -40,8 +40,8 @@ ****************************************************************************/ -#ifndef QGSTREAMERSERVICEPLUGIN_H -#define QGSTREAMERSERVICEPLUGIN_H +#ifndef QGSTREAMERCAPTURESERVICEPLUGIN_H +#define QGSTREAMERCAPTURESERVICEPLUGIN_H #include <qmediaserviceproviderplugin.h> #include <QtCore/qset.h> @@ -49,41 +49,52 @@ QT_BEGIN_NAMESPACE - -class QGstreamerServicePlugin +class QGstreamerCaptureServicePlugin : public QMediaServiceProviderPlugin +#if defined(USE_GSTREAMER_CAMERA) , public QMediaServiceSupportedDevicesInterface , public QMediaServiceFeaturesInterface +#endif , public QMediaServiceSupportedFormatsInterface { Q_OBJECT +#if defined(USE_GSTREAMER_CAMERA) Q_INTERFACES(QMediaServiceSupportedDevicesInterface) Q_INTERFACES(QMediaServiceFeaturesInterface) +#endif Q_INTERFACES(QMediaServiceSupportedFormatsInterface) - Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "gstreamer.json") +#if defined(USE_GSTREAMER_CAMERA) + Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mediacapturecamera.json") +#else + Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mediacapture.json") +#endif public: QMediaService* create(QString const& key); void release(QMediaService *service); +#if defined(USE_GSTREAMER_CAMERA) QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const; QList<QByteArray> devices(const QByteArray &service) const; QString deviceDescription(const QByteArray &service, const QByteArray &device); QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property); +#endif QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const; QStringList supportedMimeTypes() const; private: +#if defined(USE_GSTREAMER_CAMERA) void updateDevices() const; mutable QList<QByteArray> m_cameraDevices; mutable QStringList m_cameraDescriptions; - mutable QSet<QString> m_supportedMimeTypeSet; //for fast access - +#endif void updateSupportedMimeTypes() const; + + mutable QSet<QString> m_supportedMimeTypeSet; //for fast access }; QT_END_NAMESPACE -#endif // QGSTREAMERSERVICEPLUGIN_H +#endif // QGSTREAMERCAPTURESERVICEPLUGIN_H diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp index 60cda07bc..56174c4c0 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp @@ -42,12 +42,12 @@ #include "qgstreamercapturesession.h" #include "qgstreamerrecordercontrol.h" #include "qgstreamermediacontainercontrol.h" -#include "qgstreamervideorendererinterface.h" #include "qgstreameraudioencode.h" #include "qgstreamervideoencode.h" #include "qgstreamerimageencode.h" -#include "qgstreameraudioprobecontrol.h" #include <qmediarecorder.h> +#include <private/qgstreamervideorendererinterface_p.h> +#include <private/qgstreameraudioprobecontrol_p.h> #include <private/qgstreamerbushelper_p.h> #include <gst/gsttagsetter.h> diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.json b/src/plugins/gstreamer/mediaplayer/mediaplayer.json new file mode 100644 index 000000000..c4a27ea01 --- /dev/null +++ b/src/plugins/gstreamer/mediaplayer/mediaplayer.json @@ -0,0 +1,3 @@ +{ + "Keys": ["org.qt-project.qt.mediaplayer"] +} diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.pri b/src/plugins/gstreamer/mediaplayer/mediaplayer.pro index 02551f731..82980b397 100644 --- a/src/plugins/gstreamer/mediaplayer/mediaplayer.pri +++ b/src/plugins/gstreamer/mediaplayer/mediaplayer.pro @@ -1,6 +1,14 @@ -INCLUDEPATH += $$PWD +load(qt_module) + +TARGET = gstmediaplayer +PLUGIN_TYPE = mediaservice + +load(qt_plugin) +DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE} -DEFINES += QMEDIA_GSTREAMER_PLAYER +include(../common.pri) + +INCLUDEPATH += $$PWD HEADERS += \ $$PWD/qgstreamerplayercontrol.h \ @@ -8,7 +16,8 @@ HEADERS += \ $$PWD/qgstreamerplayersession.h \ $$PWD/qgstreamerstreamscontrol.h \ $$PWD/qgstreamermetadataprovider.h \ - $$PWD/qgstreameravailabilitycontrol.h + $$PWD/qgstreameravailabilitycontrol.h \ + $$PWD/qgstreamerplayerserviceplugin.h SOURCES += \ $$PWD/qgstreamerplayercontrol.cpp \ @@ -16,6 +25,12 @@ SOURCES += \ $$PWD/qgstreamerplayersession.cpp \ $$PWD/qgstreamerstreamscontrol.cpp \ $$PWD/qgstreamermetadataprovider.cpp \ - $$PWD/qgstreameravailabilitycontrol.cpp + $$PWD/qgstreameravailabilitycontrol.cpp \ + $$PWD/qgstreamerplayerserviceplugin.cpp + +target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE} +INSTALLS += target +OTHER_FILES += \ + mediaplayer.json diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp index 9a6b4b44b..fbd059fe1 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp @@ -53,20 +53,20 @@ #include "qgstreameravailabilitycontrol.h" #if defined(HAVE_WIDGETS) -#include "qgstreamervideooverlay.h" -#include "qgstreamervideowindow.h" -#include "qgstreamervideowidget.h" +#include <private/qgstreamervideooverlay_p.h> +#include <private/qgstreamervideowindow_p.h> +#include <private/qgstreamervideowidget_p.h> #endif -#include "qgstreamervideorenderer.h" +#include <private/qgstreamervideorenderer_p.h> #if defined(Q_WS_MAEMO_6) && defined(__arm__) #include "qgstreamergltexturerenderer.h" #endif #include "qgstreamerstreamscontrol.h" -#include "qgstreameraudioprobecontrol.h" -#include "qgstreamervideoprobecontrol.h" +#include <private/qgstreameraudioprobecontrol_p.h> +#include <private/qgstreamervideoprobecontrol_p.h> #include <private/qmediaplaylistnavigator_p.h> #include <qmediaplaylist.h> diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp new file mode 100644 index 000000000..59a039f8d --- /dev/null +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore/qstring.h> +#include <QtCore/qdebug.h> +#include <QtCore/QDir> +#include <QtCore/QDebug> + +#include "qgstreamerplayerserviceplugin.h" + +//#define QT_SUPPORTEDMIMETYPES_DEBUG + +#include "qgstreamerplayerservice.h" +#include <private/qgstutils_p.h> + +#include <linux/types.h> +#include <sys/time.h> +#include <sys/ioctl.h> +#include <sys/poll.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <sys/mman.h> +#include <linux/videodev2.h> +#include <gst/gst.h> + + +QMediaService* QGstreamerPlayerServicePlugin::create(const QString &key) +{ + QGstUtils::initializeGst(); + + if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)) + return new QGstreamerPlayerService; + + qWarning() << "Gstreamer service plugin: unsupported key:" << key; + return 0; +} + +void QGstreamerPlayerServicePlugin::release(QMediaService *service) +{ + delete service; +} + +QMediaServiceProviderHint::Features QGstreamerPlayerServicePlugin::supportedFeatures( + const QByteArray &service) const +{ + if (service == Q_MEDIASERVICE_MEDIAPLAYER) + return QMediaServiceProviderHint::StreamPlayback | QMediaServiceProviderHint::VideoSurface; + else + return QMediaServiceProviderHint::Features(); +} + +QtMultimedia::SupportEstimate QGstreamerPlayerServicePlugin::hasSupport(const QString &mimeType, + const QStringList &codecs) const +{ + if (m_supportedMimeTypeSet.isEmpty()) + updateSupportedMimeTypes(); + + return QGstUtils::hasSupport(mimeType, codecs, m_supportedMimeTypeSet); +} + +void QGstreamerPlayerServicePlugin::updateSupportedMimeTypes() const +{ + //enumerate supported mime types + gst_init(NULL, NULL); + + GList *plugins, *orig_plugins; + orig_plugins = plugins = gst_default_registry_get_plugin_list (); + + while (plugins) { + GList *features, *orig_features; + + GstPlugin *plugin = (GstPlugin *) (plugins->data); + plugins = g_list_next (plugins); + + if (plugin->flags & (1<<1)) //GST_PLUGIN_FLAG_BLACKLISTED + continue; + + orig_features = features = gst_registry_get_feature_list_by_plugin(gst_registry_get_default (), + plugin->desc.name); + while (features) { + if (!G_UNLIKELY(features->data == NULL)) { + GstPluginFeature *feature = GST_PLUGIN_FEATURE(features->data); + if (GST_IS_ELEMENT_FACTORY (feature)) { + GstElementFactory *factory = GST_ELEMENT_FACTORY(gst_plugin_feature_load(feature)); + if (factory + && factory->numpadtemplates > 0 + && (qstrcmp(factory->details.klass, "Codec/Decoder/Audio") == 0 + || qstrcmp(factory->details.klass, "Codec/Decoder/Video") == 0 + || qstrcmp(factory->details.klass, "Codec/Demux") == 0 )) { + const GList *pads = factory->staticpadtemplates; + while (pads) { + GstStaticPadTemplate *padtemplate = (GstStaticPadTemplate*)(pads->data); + pads = g_list_next (pads); + if (padtemplate->direction != GST_PAD_SINK) + continue; + if (padtemplate->static_caps.string) { + GstCaps *caps = gst_static_caps_get(&padtemplate->static_caps); + if (!gst_caps_is_any (caps) && ! gst_caps_is_empty (caps)) { + for (guint i = 0; i < gst_caps_get_size(caps); i++) { + GstStructure *structure = gst_caps_get_structure(caps, i); + QString nameLowcase = QString(gst_structure_get_name (structure)).toLower(); + + m_supportedMimeTypeSet.insert(nameLowcase); + if (nameLowcase.contains("mpeg")) { + //Because mpeg version number is only included in the detail + //description, it is necessary to manually extract this information + //in order to match the mime type of mpeg4. + const GValue *value = gst_structure_get_value(structure, "mpegversion"); + if (value) { + gchar *str = gst_value_serialize (value); + QString versions(str); + QStringList elements = versions.split(QRegExp("\\D+"), QString::SkipEmptyParts); + foreach (const QString &e, elements) + m_supportedMimeTypeSet.insert(nameLowcase + e); + g_free (str); + } + } + } + } + } + } + gst_object_unref (factory); + } + } else if (GST_IS_TYPE_FIND_FACTORY(feature)) { + QString name(gst_plugin_feature_get_name(feature)); + if (name.contains('/')) //filter out any string without '/' which is obviously not a mime type + m_supportedMimeTypeSet.insert(name.toLower()); + } + } + features = g_list_next (features); + } + gst_plugin_feature_list_free (orig_features); + } + gst_plugin_list_free (orig_plugins); + +#if defined QT_SUPPORTEDMIMETYPES_DEBUG + QStringList list = m_supportedMimeTypeSet.toList(); + list.sort(); + if (qgetenv("QT_DEBUG_PLUGINS").toInt() > 0) { + foreach (const QString &type, list) + qDebug() << type; + } +#endif +} + +QStringList QGstreamerPlayerServicePlugin::supportedMimeTypes() const +{ + return QStringList(); +} + diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h new file mode 100644 index 000000000..e19f31cda --- /dev/null +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef QGSTREAMERPLAYERSERVICEPLUGIN_H +#define QGSTREAMERPLAYERSERVICEPLUGIN_H + +#include <qmediaserviceproviderplugin.h> +#include <QtCore/qset.h> +#include <QtCore/QObject> + +QT_BEGIN_NAMESPACE + + +class QGstreamerPlayerServicePlugin + : public QMediaServiceProviderPlugin + , public QMediaServiceFeaturesInterface + , public QMediaServiceSupportedFormatsInterface +{ + Q_OBJECT + Q_INTERFACES(QMediaServiceFeaturesInterface) + Q_INTERFACES(QMediaServiceSupportedFormatsInterface) + Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mediaplayer.json") +public: + QMediaService* create(QString const& key); + void release(QMediaService *service); + + QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const; + + QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const; + QStringList supportedMimeTypes() const; + +private: + void updateSupportedMimeTypes() const; + + mutable QSet<QString> m_supportedMimeTypeSet; //for fast access +}; + +QT_END_NAMESPACE + +#endif // QGSTREAMERPLAYERSERVICEPLUGIN_H + diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp index 7f48738cb..bd4d57d12 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -42,10 +42,10 @@ #include "qgstreamerplayersession.h" #include <private/qgstreamerbushelper_p.h> -#include "qgstreameraudioprobecontrol.h" -#include "qgstreamervideoprobecontrol.h" -#include "qgstreamervideorendererinterface.h" -#include "gstvideoconnector.h" +#include <private/qgstreameraudioprobecontrol_p.h> +#include <private/qgstreamervideoprobecontrol_p.h> +#include <private/qgstreamervideorendererinterface_p.h> +#include <private/gstvideoconnector_p.h> #include <private/qgstutils_p.h> #include <private/playlistfileparser_p.h> diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h index 4bda52d85..c43be0bd7 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h @@ -52,7 +52,7 @@ #include <qaudioformat.h> #if defined(HAVE_GST_APPSRC) -#include "qgstappsrc.h" +#include <private/qgstappsrc_p.h> #endif #include <gst/gst.h> diff --git a/src/src.pro b/src/src.pro index 4b5b37340..decaa1e4b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -35,6 +35,9 @@ contains(config_test_gstreamer, yes) { # If widgets is around, plugins depends on widgets too (imports does not) src_plugins.depends += src_qtmmwidgets + + # same with qgsttools + src_qgsttools.depends += src_qtmmwidgets } SUBDIRS += src_plugins |