Added loading of video node factories from plugins

This change will allow us to add new video node factories that
can be loaded dynamically at runtime.

The previous video node factories, I420 and RGB have been kept
as static parts of the Qt Multimedia imports, but can be moved
to plugins at a later date.

For plugins to be able to find and use QSGVideoNode, the class
has to be exported.

Change-Id: Idbead9a8ad33619cebe90fcec92eb29cf52ae9bd
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Jonas Rabbe
2012-02-06 10:55:59 +10:00
committed by Qt by Nokia
parent a94c8a1ac2
commit 6de7c31040
12 changed files with 180 additions and 11 deletions

View File

@@ -40,7 +40,7 @@
****************************************************************************/
#include "qdeclarativevideooutput_p.h"
#include "qsgvideonode_p.h"
#include <private/qsgvideonode_p.h>
#include "qsgvideonode_i420.h"
#include "qsgvideonode_rgb.h"
@@ -50,7 +50,7 @@
#include <QtMultimedia/qmediaservice.h>
#include <QtMultimedia/qvideorenderercontrol.h>
#include <QtMultimedia/qvideosurfaceformat.h>
#include <private/qmediapluginloader_p.h>
#include <QtCore/qmetaobject.h>
@@ -59,6 +59,9 @@ Q_DECLARE_METATYPE(QAbstractVideoSurface*)
QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, videoNodeFactoryLoader,
(QSGVideoNodeFactory_iid, QLatin1String("video"), Qt::CaseInsensitive))
class QSGVideoItemSurface : public QAbstractVideoSurface
{
public:
@@ -172,6 +175,14 @@ QDeclarativeVideoOutput::QDeclarativeVideoOutput(QQuickItem *parent) :
connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
this, SLOT(_q_updateNativeSize(QVideoSurfaceFormat)), Qt::QueuedConnection);
foreach (QObject *instance, videoNodeFactoryLoader()->instances(QSGVideoNodeFactoryPluginKey)) {
QSGVideoNodeFactory* plugin = qobject_cast<QSGVideoNodeFactory*>(instance);
if (plugin) {
m_videoNodeFactories.append(plugin);
}
}
// Append existing node factories as fallback if we have no plugins
m_videoNodeFactories.append(new QSGVideoNodeFactory_I420);
m_videoNodeFactories.append(new QSGVideoNodeFactory_RGB);
}