QMediaService Class

The QMediaService class provides a common base class for media service implementations. 更多...

头文件: #include <QMediaService>
qmake: QT += multimedia
基类: QObject

公有函数

~QMediaService()
virtual void releaseControl(QMediaControl *control) = 0
virtual QMediaControl *requestControl(const char *interface) = 0
T requestControl()
  • 32 个公有函数继承自 QObject

受保护的函数

QMediaService(QObject *parent)
  • 9 个受保护的函数继承自 QObject

其他继承的成员

  • 1 个属性继承自 QObject
  • 1 个公有槽函数继承自 QObject
  • 2 个信号继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

The QMediaService class provides a common base class for media service implementations.

Media services provide implementations of the functionality promised by media objects, and allow multiple providers to implement a QMediaObject.

To provide the functionality of a QMediaObject media services implement QMediaControl interfaces. Services typically implement one core media control which provides the core feature of a media object, and some number of additional controls which provide either optional features of the media object, or features of a secondary media object or peripheral object.

A pointer to media service's QMediaControl implementation can be obtained by passing the control's interface name to the requestControl() function.


  QMediaPlayerControl *control = qobject_cast<QMediaPlayerControl *>(
          mediaService->requestControl("org.qt-project.qt.mediaplayercontrol/5.0"));

Media objects can use services loaded dynamically from plug-ins or implemented statically within an applications. Plug-in based services should also implement the QMediaServiceProviderPlugin interface. Static services should implement the QMediaServiceProvider interface. In general, implementing a QMediaService is outside of the scope of this documentation and support on the relevant mailing lists or IRC channels should be sought.

参见 QMediaObject and QMediaControl.

成员函数

[protected] QMediaService::QMediaService(QObject *parent)

Construct a media service with the given parent. This class is meant as a base class for Multimedia services so this constructor is protected.

QMediaService::~QMediaService()

Destroys a media service.

[pure virtual] void QMediaService::releaseControl(QMediaControl *control)

Releases a control back to the service.

[pure virtual] QMediaControl *QMediaService::requestControl(const char *interface)

Returns a pointer to the media control implementing interface.

If the service does not implement the control, or if it is unavailable a null pointer is returned instead.

Controls must be returned to the service when no longer needed using the releaseControl() function.

T QMediaService::requestControl()

Returns a pointer to the media control of type T implemented by a media service.

If the service does not implement the control, or if it is unavailable a null pointer is returned instead.

Controls must be returned to the service when no longer needed using the releaseControl() function.