QMediaControl Class

The QMediaControl class provides a base interface for media service controls. 更多...

头: #include <QMediaControl>
qmake: QT += multimedia
继承: QObject
继承者:
39 类型

QAudioDecoderControl , QAudioEncoderSettingsControl , QAudioInputSelectorControl , QAudioOutputSelectorControl , QAudioRoleControl , QCameraCaptureBufferFormatControl , QCameraCaptureDestinationControl , QCameraControl , QCameraExposureControl , QCameraFeedbackControl , QCameraFlashControl , QCameraFocusControl , QCameraImageCaptureControl , QCameraImageProcessingControl , QCameraInfoControl , QCameraLocksControl , QCameraViewfinderSettingsControl , QCameraViewfinderSettingsControl2 , QCameraZoomControl , QCustomAudioRoleControl , QImageEncoderControl , QMediaAudioProbeControl , QMediaAvailabilityControl , QMediaContainerControl , QMediaGaplessPlaybackControl , QMediaNetworkAccessControl , QMediaPlayerControl , QMediaRecorderControl , QMediaStreamsControl , QMediaVideoProbeControl , QMetaDataReaderControl , QMetaDataWriterControl , QRadioDataControl , QRadioTunerControl , QVideoDeviceSelectorControl , QVideoEncoderSettingsControl , QVideoRendererControl , QVideoWidgetControl ,和 QVideoWindowControl

该类已过时。 提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

公共函数

virtual ~QMediaControl ()

保护函数

QMediaControl (QObject * parent = nullptr)

Q_MEDIA_DECLARE_CONTROL ( Class , IId )

详细描述

Media controls provide an interface to individual features provided by a media service. Most services implement a principal control which exposes the core functionality of the service and a number of optional controls which expose any additional functionality.

A pointer to a control implemented by a media service can be obtained using the QMediaService::requestControl () member of QMediaService . If the service doesn't implement a control it will instead return a null pointer.

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

Alternatively if the IId of the control has been declared using Q_MEDIA_DECLARE_CONTROL the template version of QMediaService::requestControl () can be used to request the service without explicitly passing the IId or using qobject_cast ().

QMediaPlayerControl *control = mediaService->requestControl<QMediaPlayerControl *>();
					

Most application code will not interface directly with a media service's controls, instead the QMediaObject which owns the service acts as an intermediary between one or more controls and the application.

另请参阅 QMediaService and QMediaObject .

成员函数文档编制

[protected] QMediaControl:: QMediaControl ( QObject * parent = nullptr)

Constructs a media control with the given parent .

[虚拟] QMediaControl:: ~QMediaControl ()

Destroys a media control.

宏文档编制

Q_MEDIA_DECLARE_CONTROL ( Class , IId )

The Q_MEDIA_DECLARE_CONTROL macro declares an IId 对于 Class that inherits from QMediaControl .

Declaring an IId for a QMediaControl allows an instance of that control to be requested from QMediaService::requestControl () without explicitly passing the IId.

QMediaPlayerControl *control = mediaService->requestControl<QMediaPlayerControl *>();
					

另请参阅 QMediaService::requestControl ().