The QMediaObject class provides a common base for multimedia objects. 更多...
| 頭: | #include <QMediaObject> |
| qmake: | QT += multimedia |
| 繼承: | QObject |
| 繼承者: | QAudioDecoder , QCamera , QMediaPlayer ,和 QRadioTuner |
| ~QMediaObject () | |
| virtual QMultimedia::AvailabilityStatus | availability () const |
| QStringList | availableMetaData () const |
| virtual bool | bind (QObject * object ) |
| virtual bool | isAvailable () const |
| bool | isMetaDataAvailable () const |
| QVariant | metaData (const QString & key ) const |
| int | notifyInterval () const |
| virtual QMediaService * | service () const |
| void | setNotifyInterval (int milliSeconds ) |
| virtual void | unbind (QObject * object ) |
| void | availabilityChanged (bool available ) |
| void | availabilityChanged (QMultimedia::AvailabilityStatus availability ) |
| void | metaDataAvailableChanged (bool available ) |
| void | metaDataChanged () |
| void | metaDataChanged (const QString & key , const QVariant & value ) |
| void | notifyIntervalChanged (int 毫秒 ) |
| QMediaObject (QObject * parent , QMediaService * service ) | |
| void | addPropertyWatch (QByteArray const & name ) |
| void | removePropertyWatch (QByteArray const & name ) |
The QMediaObject class provides a common base for multimedia objects.
It provides some basic functionality that is common to other high level classes like QMediaPlayer , QAudioDecoder and QCamera , including availability and meta-data functionality, as well as functionality to connect media objects with support classes like QMediaPlaylist .
The higher level QMediaObject derived classes provide the actual multimedia functionality, by internally using a QMediaService . Each media object hosts a QMediaService and uses the QMediaControl interfaces implemented by the service to implement its API. These controls can be accessed from the media object if necessary, but in general the useful functionality can be accessed from the higher level classes.
Most media objects when constructed will request a new QMediaService instance, but some like QMediaRecorder and QAudioRecorder will share a service with another object.
另請參閱 QMediaService and QMediaControl .
The interval at which notifiable properties will update.
The interval is expressed in milliseconds, the default value is 1000.
訪問函數:
| int | notifyInterval () const |
| void | setNotifyInterval (int milliSeconds ) |
通知程序信號:
| void | notifyIntervalChanged (int 毫秒 ) |
另請參閱 addPropertyWatch () 和 removePropertyWatch ().
[protected]
QMediaObject::
QMediaObject
(
QObject
*
parent
,
QMediaService
*
service
)
Constructs a media object which uses the functionality provided by a media service .
The parent 被傳遞給 QObject .
This class is meant as a base class for multimedia objects so this constructor is protected.
銷毀此媒體對象。
[protected]
void
QMediaObject::
addPropertyWatch
(
QByteArray
const &
name
)
Watch the property
name
. The property's notify signal will be emitted once every
notifyInterval
毫秒。
另請參閱 notifyInterval .
[虛擬]
QMultimedia::AvailabilityStatus
QMediaObject::
availability
() const
Returns the availability of the functionality offered by this object.
In some cases the functionality may not be available (for example, if the current operating system or platform does not provide the required functionality), or it may be temporarily unavailable (for example, audio playback during a phone call or similar).
[signal]
void
QMediaObject::
availabilityChanged
(
bool
available
)
Signal emitted when the availability state has changed to available .
注意: 信號 availabilityChanged 在此類中是重載。要使用函數指針句法連接到此信號,必須在靜態鑄造中指定信號類型,如此範例所示:
connect(mediaObject, static_cast<void(QMediaObject::*)(bool)>(&QMediaObject::availabilityChanged), [=](bool available){ /* ... */ });
[signal]
void
QMediaObject::
availabilityChanged
(
QMultimedia::AvailabilityStatus
availability
)
Signal emitted when the availability of the service has changed to availability .
注意: 信號 availabilityChanged 在此類中是重載。要使用函數指針句法連接到此信號,必須在靜態鑄造中指定信號類型,如此範例所示:
connect(mediaObject, static_cast<void(QMediaObject::*)(QMultimedia::AvailabilityStatus)>(&QMediaObject::availabilityChanged), [=](QMultimedia::AvailabilityStatus availability){ /* ... */ });
返迴元數據的可用鍵列錶。
[虛擬]
bool
QMediaObject::
bind
(
QObject
*
object
)
綁定 object 到此 QMediaObject 實例。
This method establishes a relationship between this media object and a helper object. The nature of the relationship depends on both parties. This methods returns true if the helper was successfully bound, false otherwise.
大多數子類化的 QMediaObject provide more convenient functions that wrap this functionality, so this function rarely needs to be called directly.
The object passed must implement the QMediaBindableInterface 接口。
另請參閱 QMediaBindableInterface .
[虛擬]
bool
QMediaObject::
isAvailable
() const
返迴 true 若服務可用。
Returns true if there is meta-data associated with this media object, else false.
返迴的值關聯元數據 key .
見預定義列錶 元數據鍵 .
[signal]
void
QMediaObject::
metaDataAvailableChanged
(
bool
available
)
發射信號,當 available state of a media object's meta-data has changed.
[signal]
void
QMediaObject::
metaDataChanged
()
Signals that this media object's meta-data has changed.
If multiple meta-data elements are changed, metaDataChanged(const QString &key, const QVariant &value) signal is emitted for each of them with metaDataChanged() changed emitted once.
注意: 信號 metaDataChanged 在此類中是重載。要使用函數指針句法連接到此信號,必須在靜態鑄造中指定信號類型,如此範例所示:
connect(mediaObject, static_cast<void(QMediaObject::*)()>(&QMediaObject::metaDataChanged), [=](){ /* ... */ });
[signal]
void
QMediaObject::
metaDataChanged
(const
QString
&
key
, const
QVariant
&
value
)
Signal the changes of one meta-data element value 采用給定 key .
注意: 信號 metaDataChanged 在此類中是重載。要使用函數指針句法連接到此信號,必須在靜態鑄造中指定信號類型,如此範例所示:
connect(mediaObject, static_cast<void(QMediaObject::*)(const QString &, const QVariant &)>(&QMediaObject::metaDataChanged), [=](const QString &key, const QVariant &value){ /* ... */ });
[signal]
void
QMediaObject::
notifyIntervalChanged
(
int
毫秒
)
Signal a change in the notify interval period to 毫秒 .
注意: 通知程序信號對於特性 notifyInterval .
[protected]
void
QMediaObject::
removePropertyWatch
(
QByteArray
const &
name
)
移除特性 name from the list of properties whose changes are regularly signaled.
另請參閱 notifyInterval .
[虛擬]
QMediaService
*QMediaObject::
service
() const
Returns the media service that provides the functionality of this multimedia object.
[虛擬]
void
QMediaObject::
unbind
(
QObject
*
object
)
分離 object 從 QMediaObject 實例。
Unbind the helper object from this media object. A warning will be generated if the object was not previously bound to this object.
另請參閱 QMediaBindableInterface .