How to build Qt mediaservice plugin for radio
-
I want to build radio mediaservice plugin for Qt5.3.2, I coded the plugin and built with Qt creator, then I got a libradio.so, and I put it into plugins/mediaservice folder, but the radio app of Qt example print an error: not service found for 'org.qt-project.qt.audio', Was the way I deployed the libradio.so wrong?
Thanks a lot.
@SGaist SGaist Thanks for your reply:
This is the pro file:
TEMPLATE = lib
TARGET = $$qtLibraryTarget(hsradio)
CONFIG += plugin
Q_MOC_OUTPUT_REVISION = 5.3.2
QT += multimedia-private
QT -= gui
PLUGIN_TYPE = mediaservice
PLUGIN_CLASS_NAME = HsRadioServicePlugin
INCLUDEPATH += $$PWD
#DEFINES += RADIO_LIBRARY
DESTDIR = ../output
SOURCES += hsradioserviceplugin.cpp
hsradiocontrol.cpp
hsradioservice.cpp
HEADERS += hsradioserviceplugin.h
hsradiocontrol.h
hsradioservice.h
OTHER_FILES +=
radio.jsonThe plugin header file:
class HsRadioServicePlugin :
public QMediaServiceProviderPlugin,
public QMediaServiceSupportedDevicesInterface
{
Q_OBJECT
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "radio.json")
public:
QMediaService* create(QString const& key);
void release(QMediaService *service);QList<QByteArray> devices(const QByteArray &service) const; QString deviceDescription(const QByteArray &service, const QByteArray &device);
};
The json file:
{
"Keys": ["hsradio"],
"Services": ["org.qt-project.qt.radio"]
}And I created service and control class referring the v4l mediaservice plugin, It seems that v4l was not built into Qt/plugins/mediaservice/ path, so I built my plugin with Qt creator, and I put 'radio.so' file into Qt/plugins/mediaservice/, but the error still appears.
My Qt version is 5.3.2, Qt creator is 3.2.1.
-
Hi and welcome to devnet,
How did you wrote the plugin ? What base did you use ?