Remove the last remainders of the old plugin system
authorLars Knoll <lars.knoll@nokia.com>
Sun, 27 May 2012 10:20:55 +0000 (12:20 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 5 Jun 2012 10:44:29 +0000 (12:44 +0200)
Port the last two currently unused plugins (v4l and wmf) over to the new plugin
format.

Fix documentation that still mentioned Q_EXPORT_PLUGIN.

Change-Id: I18200dd792e8973687e92180fc41d11395b35132
Reviewed-by: Jonas Rabbe <jonas.rabbe@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
src/multimedia/audio/qaudiosystemplugin.cpp
src/plugins/v4l/v4l.json [new file with mode: 0644]
src/plugins/v4l/v4lserviceplugin.cpp
src/plugins/v4l/v4lserviceplugin.h
src/plugins/wmf/wmf.json [new file with mode: 0644]
src/plugins/wmf/wmfserviceplugin.cpp
src/plugins/wmf/wmfserviceplugin.h

index a6457f03102ab44794a30f1fedb0d306e1af5e4e..0fcfd5561467298ea91e5e5158fcabcbefb5c327 100644 (file)
@@ -54,9 +54,17 @@ QT_BEGIN_NAMESPACE
     \internal
 
     Writing a audio plugin is achieved by subclassing this base class,
-    reimplementing the pure virtual functions keys(), availableDevices(),
+    reimplementing the pure virtual functions availableDevices(),
     createInput(), createOutput() and createDeviceInfo() then exporting
-    the class with the Q_EXPORT_PLUGIN2() macro.
+    the class with the Q_PLUGIN_METADATA() macro.
+
+    The json file containing the meta data should contain a list of keys
+    matching the plugin. Add "default" to your list of keys available
+    to override the default audio device to be provided by your plugin.
+
+    \code
+    { "Keys": [ "default" ] }
+    \endcode
 
     Unit tests are available to help in debugging new plugins.
 
@@ -69,8 +77,6 @@ QT_BEGIN_NAMESPACE
     creating a plugin subclassing QAudioSystemPlugin, QAbstractAudioDeviceInfo,
     QAbstractAudioOutput and QAbstractAudioInput.
 
-    Add "default" to your list of keys() available to override the default
-    audio device to be provided by your plugin.
 
     -audio-backend configure option will force compiling in of the builtin backend
     into the QtMultimedia library at compile time. This is automatic by default
diff --git a/src/plugins/v4l/v4l.json b/src/plugins/v4l/v4l.json
new file mode 100644 (file)
index 0000000..f87f329
--- /dev/null
@@ -0,0 +1,3 @@
+{
+    "Keys": ["org.qt-project.qt.radio"]
+}
index a506eafff172582f10e00c2625740ed214747cf6..49adbd9429440108eae1a8c61390c4c770701fdc 100644 (file)
 #include <qmediaserviceprovider.h>
 
 
-QStringList V4LServicePlugin::keys() const
-{
-    return QStringList() <<
-            QLatin1String(Q_MEDIASERVICE_RADIO);
-}
-
 QMediaService* V4LServicePlugin::create(QString const& key)
 {
     if (key == QLatin1String(Q_MEDIASERVICE_RADIO))
@@ -78,7 +72,3 @@ QString V4LServicePlugin::deviceDescription(const QByteArray &service, const QBy
 {
     return QString();
 }
-
-
-Q_EXPORT_PLUGIN2(qtmedia_v4lengine, V4LServicePlugin);
-
index 7d83fc376a0e636f8e90d5a02daaf0a6248463d5..190812f300723a443c98f84caaa465b3f13eb5ff 100644 (file)
@@ -51,8 +51,8 @@ class V4LServicePlugin : public QMediaServiceProviderPlugin, public QMediaServic
 {
     Q_OBJECT
     Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
+    Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "v4l.json")
 public:
-    QStringList keys() const;
     QMediaService* create(QString const& key);
     void release(QMediaService *service);
 
diff --git a/src/plugins/wmf/wmf.json b/src/plugins/wmf/wmf.json
new file mode 100644 (file)
index 0000000..c4a27ea
--- /dev/null
@@ -0,0 +1,3 @@
+{
+    "Keys": ["org.qt-project.qt.mediaplayer"]
+}
index 1886516495600701f17d17fe1b21edb7d658bf6c..6876d28d00c473a1d7b4e6411f9621660a39354c 100644 (file)
 #endif
 #include <qmediaserviceprovider.h>
 
-QStringList WMFServicePlugin::keys() const
-{
-    return QStringList()
-#ifdef QMEDIA_MEDIAFOUNDATION_PLAYER
-            << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)
-#endif
-            ;
-}
-
 QMediaService* WMFServicePlugin::create(QString const& key)
 {
 #ifdef QMEDIA_MEDIAFOUNDATION_PLAYER
@@ -93,5 +84,3 @@ QString WMFServicePlugin::deviceDescription(const QByteArray &service, const QBy
     return QString();
 }
 
-Q_EXPORT_PLUGIN2(qtmedia_wmfengine, WMFServicePlugin);
-
index d9e1efa9ad8832735308b4f749484bb4ae96bc41..e2672db1af335414677b9faa7c91cd42c00198fd 100644 (file)
@@ -54,8 +54,8 @@ class WMFServicePlugin
     Q_OBJECT
     Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
     Q_INTERFACES(QMediaServiceFeaturesInterface)
+    Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "wmf.json")
 public:
-    QStringList keys() const;
     QMediaService* create(QString const& key);
     void release(QMediaService *service);