Updated plugins to use new plugin architecture
Changed QMediaPluginLoader to use QFactoryLoader instead of QPluginLoader and used metadata to get keys. Removed QAudioPluginLoader and changed audio classes to use instead use QMediaPluginLoader. The plugins must include the Q_PLUGIN_METADATA macro, and no longer use the Q_PLUGIN_EXPORT/Q_PLUGIN_EXPORT2 macros. A json file has been added for each plugin which can contain metadata which is available to the plugin loader before the plugin is actually loaded, and is used to read the keys for the plugin, e.g. supported services. QFactoryInterface will be deprecated and has been removed from all plugins. Change-Id: I035b82f9c9c65717bebf704d560ea8f891df21da Reviewed-by: Michael Goddard <michael.goddard@nokia.com> Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
@@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE
|
||||
class QAudioEngineDeclarativeModule : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
|
||||
|
||||
public:
|
||||
virtual void registerTypes(const char *uri)
|
||||
{
|
||||
@@ -81,5 +83,3 @@ QT_END_NAMESPACE
|
||||
|
||||
#include "audioengine.moc"
|
||||
|
||||
Q_EXPORT_PLUGIN2("QtAudioEngine", QT_PREPEND_NAMESPACE(QAudioEngineDeclarativeModule));
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ QT_BEGIN_NAMESPACE
|
||||
class QMultimediaDeclarativeModule : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
|
||||
|
||||
public:
|
||||
virtual void registerTypes(const char *uri)
|
||||
{
|
||||
@@ -129,5 +131,3 @@ QT_END_NAMESPACE
|
||||
|
||||
#include "multimedia.moc"
|
||||
|
||||
Q_EXPORT_PLUGIN2(qmultimediadeclarativemodule, QT_PREPEND_NAMESPACE(QMultimediaDeclarativeModule));
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
****************************************************************************/
|
||||
#include "qdeclarativevideooutput_p.h"
|
||||
|
||||
#include <private/qsgvideonode_p.h>
|
||||
#include "qsgvideonode_i420.h"
|
||||
#include "qsgvideonode_rgb.h"
|
||||
|
||||
@@ -60,7 +59,7 @@ Q_DECLARE_METATYPE(QAbstractVideoSurface*)
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, videoNodeFactoryLoader,
|
||||
(QSGVideoNodeFactory_iid, QLatin1String("video"), Qt::CaseInsensitive))
|
||||
(QSGVideoNodeFactoryInterface_iid, QLatin1String("video"), Qt::CaseInsensitive))
|
||||
|
||||
class QSGVideoItemSurface : public QAbstractVideoSurface
|
||||
{
|
||||
@@ -79,7 +78,7 @@ public:
|
||||
{
|
||||
QList<QVideoFrame::PixelFormat> formats;
|
||||
|
||||
foreach (QSGVideoNodeFactory* factory, m_item->m_videoNodeFactories) {
|
||||
foreach (QSGVideoNodeFactoryInterface* factory, m_item->m_videoNodeFactories) {
|
||||
formats.append(factory->supportedPixelFormats(handleType));
|
||||
}
|
||||
|
||||
@@ -177,7 +176,7 @@ QDeclarativeVideoOutput::QDeclarativeVideoOutput(QQuickItem *parent) :
|
||||
this, SLOT(_q_updateNativeSize(QVideoSurfaceFormat)), Qt::QueuedConnection);
|
||||
|
||||
foreach (QObject *instance, videoNodeFactoryLoader()->instances(QSGVideoNodeFactoryPluginKey)) {
|
||||
QSGVideoNodeFactory* plugin = qobject_cast<QSGVideoNodeFactory*>(instance);
|
||||
QSGVideoNodeFactoryInterface* plugin = qobject_cast<QSGVideoNodeFactoryInterface*>(instance);
|
||||
if (plugin) {
|
||||
m_videoNodeFactories.append(plugin);
|
||||
}
|
||||
@@ -758,7 +757,7 @@ QSGNode *QDeclarativeVideoOutput::updatePaintNode(QSGNode *oldNode, UpdatePaintN
|
||||
}
|
||||
|
||||
if (videoNode == 0) {
|
||||
foreach (QSGVideoNodeFactory* factory, m_videoNodeFactories) {
|
||||
foreach (QSGVideoNodeFactoryInterface* factory, m_videoNodeFactories) {
|
||||
videoNode = factory->createNode(m_surface->surfaceFormat());
|
||||
if (videoNode)
|
||||
break;
|
||||
|
||||
@@ -138,7 +138,7 @@ private:
|
||||
QWeakPointer<QMediaService> m_service;
|
||||
QWeakPointer<QVideoRendererControl> m_rendererControl;
|
||||
|
||||
QList<QSGVideoNodeFactory*> m_videoNodeFactories;
|
||||
QList<QSGVideoNodeFactoryInterface*> m_videoNodeFactories;
|
||||
QSGVideoItemSurface *m_surface;
|
||||
QVideoFrame m_frame;
|
||||
FillMode m_fillMode;
|
||||
|
||||
@@ -65,11 +65,6 @@ QSGVideoNode *QSGVideoNodeFactory_I420::createNode(const QVideoSurfaceFormat &fo
|
||||
return 0;
|
||||
}
|
||||
|
||||
QStringList QSGVideoNodeFactory_I420::keys() const
|
||||
{
|
||||
return QStringList() << QSGVideoNodeFactoryPluginKey;
|
||||
}
|
||||
|
||||
|
||||
class QSGVideoMaterialShader_YUV420 : public QSGMaterialShader
|
||||
{
|
||||
|
||||
@@ -64,11 +64,10 @@ private:
|
||||
QSGVideoMaterial_YUV420 *m_material;
|
||||
};
|
||||
|
||||
class QSGVideoNodeFactory_I420 : public QSGVideoNodeFactory {
|
||||
class QSGVideoNodeFactory_I420 : public QSGVideoNodeFactoryInterface {
|
||||
public:
|
||||
QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const;
|
||||
QSGVideoNode *createNode(const QVideoSurfaceFormat &format);
|
||||
QStringList keys() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -70,11 +70,6 @@ QSGVideoNode *QSGVideoNodeFactory_RGB::createNode(const QVideoSurfaceFormat &for
|
||||
return 0;
|
||||
}
|
||||
|
||||
QStringList QSGVideoNodeFactory_RGB::keys() const
|
||||
{
|
||||
return QStringList() << QSGVideoNodeFactoryPluginKey;
|
||||
}
|
||||
|
||||
|
||||
class QSGVideoMaterialShader_RGB : public QSGMaterialShader
|
||||
{
|
||||
|
||||
@@ -64,11 +64,10 @@ private:
|
||||
QVideoFrame m_frame;
|
||||
};
|
||||
|
||||
class QSGVideoNodeFactory_RGB : public QSGVideoNodeFactory {
|
||||
class QSGVideoNodeFactory_RGB : public QSGVideoNodeFactoryInterface {
|
||||
public:
|
||||
QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const;
|
||||
QSGVideoNode *createNode(const QVideoSurfaceFormat &format);
|
||||
QStringList keys() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user