CopperSpice API  1.7.2
QMediaObject Class Reference

Provides a common base for multimedia objects. More...

Inheritance diagram for QMediaObject:
QObject QAudioDecoder QCamera QMediaPlayer QRadioTuner

Public Signals

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 milliSeconds)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Methods

 ~QMediaObject ()
 
virtual QMultimedia::AvailabilityStatus availability () const
 
QStringList availableMetaData () const
 
virtual bool bind (QObject *)
 
virtual bool isAvailable () const
 
bool isMetaDataAvailable () const
 
QVariant metaData (const QString &key) const
 
int notifyInterval () const
 
virtual QMediaServiceservice () const
 
void setNotifyInterval (int milliSeconds)
 
virtual void unbind (QObject *)
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &objName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Protected Methods

 QMediaObject (QObject *parent, QMediaService *service)
 
template<typename T >
void addPropertyWatch (const QString &name)
 
void removePropertyWatch (const QString &name)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Properties

 notifyInterval
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Detailed Description

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.

See also
QMediaService, QMediaControl

Constructor & Destructor Documentation

QMediaObject::~QMediaObject ( )

Destroys this media object.

QMediaObject::QMediaObject ( QObject parent,
QMediaService service 
)
protected

Constructs a media object which uses the functionality provided by a media service. The parent is passed to QObject.

This class is meant as a base class for multimedia objects so this constructor is protected.

Method Documentation

template<typename T >
void QMediaObject::addPropertyWatch ( const QString name)
protected

The value for name is the property to be watched. The property's notify signal will be emitted once every notifyInterval milliseconds. When calling this method the data type of the notify signal must be specified.

For example, the media player has a property called position where the notify signal is positionChanged.

// qmediaplayer.h
CS_PROPERTY_READ(position, position)
CS_PROPERTY_WRITE(position, setPosition)
CS_PROPERTY_NOTIFY(position, positionChanged)
// qmediaplayer.cpp
addPropertyWatch<qint64>("position");
See also
removePropertyWatch(), notifyInterval
QMultimedia::AvailabilityStatus QMediaObject::availability ( ) const
virtual

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).

Reimplemented in QMediaPlayer, QCamera, and QRadioTuner.

void QMediaObject::availabilityChanged ( bool  available)
signal

Signal emitted when the availability state has changed to available.

void QMediaObject::availabilityChanged ( QMultimedia::AvailabilityStatus  availability)
signal

Signal emitted when the availability of the service has changed to availability.

QStringList QMediaObject::availableMetaData ( ) const

Returns a list of keys there is meta-data available for.

bool QMediaObject::bind ( QObject object)
virtual

Bind object to this QMediaObject instance. 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.

Most subclasses of 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 interface.

See also
QMediaBindableInterface

Reimplemented in QAudioDecoder.

bool QMediaObject::isAvailable ( ) const
virtual

Returns true if the service is available for use.

bool QMediaObject::isMetaDataAvailable ( ) const

Returns true if there is meta data associated with this media object, else false.

QVariant QMediaObject::metaData ( const QString key) const

Returns the value associated with a meta-data key.

See also
QMediaMetaData
void QMediaObject::metaDataAvailableChanged ( bool  available)
signal

Signals that the available state of a media object's meta-data has changed.

void QMediaObject::metaDataChanged ( )
signal

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.

void QMediaObject::metaDataChanged ( const QString key,
const QVariant value 
)
signal

Signal the changes of one meta-data element value with the given key.

int QMediaObject::notifyInterval ( ) const

Documentation pending.

void QMediaObject::notifyIntervalChanged ( int  milliseconds)
signal

Signal a change in the notify interval period to milliseconds.

void QMediaObject::removePropertyWatch ( const QString name)
protected

Remove property name from the list of properties whose changes are regularly signaled.

See also
addPropertyWatch, notifyInterval
QMediaService * QMediaObject::service ( ) const
virtual

Returns the media service that provides the functionality of this multimedia object.

void QMediaObject::setNotifyInterval ( int  milliSeconds)

Documentation pending.

void QMediaObject::unbind ( QObject object)
virtual

Detach object from the QMediaObject instance. Unbind the helper object from this media object. A warning will be generated if the object was not previously bound to this object.

See also
QMediaBindableInterface

Reimplemented in QAudioDecoder.

Property Documentation

QMediaObject::notifyInterval

The interval at which notifiable properties will update. The interval is expressed in milliseconds, the default value is 1000.

See also
addPropertyWatch(), removePropertyWatch()
PropertiesClass Methods
read notifyInterval
write setNotifyInterval
notify notifyIntervalChanged