QIviMediaPlayerBackendInterface Class

The QIviMediaPlayerBackendInterface defines the interface for backends to the QIviMediaPlayer feature class. More...

Header: #include <QIviMediaPlayerBackendInterface>
qmake: QT += ivimedia
Inherits: QIviFeatureInterface

Public Functions

QIviMediaPlayerBackendInterface(QObject *parent = nullptr)
virtual void fetchData(const QUuid &identifier, int start, int count) = 0
virtual void insert(int index, const QVariant &item) = 0
virtual void move(int currentIndex, int newIndex) = 0
virtual void next() = 0
virtual void pause() = 0
virtual void play() = 0
virtual void previous() = 0
virtual void remove(int index) = 0
virtual void seek(qint64 offset) = 0
virtual void setCurrentIndex(int currentIndex) = 0
virtual void setMuted(bool muted) = 0
virtual void setPlayMode(QIviMediaPlayer::PlayMode playMode) = 0
virtual void setPosition(qint64 position) = 0
virtual void setVolume(int volume) = 0
virtual void stop() = 0


void canReportCountChanged(bool canReportCount = false)
void countChanged(int newLength = -1)
void currentIndexChanged(int currentIndex = -1)
void currentTrackChanged(const QVariant &currentTrack = QVariant())
void dataChanged(const QList<QVariant> &data, int start, int count)
void dataFetched(const QUuid &identifier, const QList<QVariant> &data, int start, bool moreAvailable)
void durationChanged(qint64 duration = -1)
void mutedChanged(bool muted = false)
void playModeChanged(QIviMediaPlayer::PlayMode playMode = QIviMediaPlayer::Normal)
void playStateChanged(QIviMediaPlayer::PlayState playState = QIviMediaPlayer::Stopped)
void positionChanged(qint64 position = -1)
void volumeChanged(int volume = -1)

Detailed Description

The QIviMediaPlayerBackendInterface is the interface used by QIviMediaPlayer

The interface is discovered by a QIviMediaPlayer object, which connects to it and sets it up.

<example of a fully featured backend>

Member Function Documentation

QIviMediaPlayerBackendInterface::QIviMediaPlayerBackendInterface(QObject *parent = nullptr)

Constructs a backend interface.

The parent is sent to the QObject constructor.

[signal] void QIviMediaPlayerBackendInterface::canReportCountChanged(bool canReportCount = false)

This signal is emitted if the backend can return the final number of items (canReportCount) for a specific request. This makes it possible to support the QIviPlayQueue::DataChanged loading type. The number of items can then be returned by emitting the countChanged signal.

See also countChanged().

[signal] void QIviMediaPlayerBackendInterface::countChanged(int newLength = -1)

This signal is emitted once the backend knows about the new size of the play queue. The new number of items is returned as newLength.

This signal is expected to be emitted before the data is returned by emitting the dataFetched() signal.

See also fetchData() and dataFetched().

[signal] void QIviMediaPlayerBackendInterface::currentIndexChanged(int currentIndex = -1)

Emitted when the currently played playable item in the play queue changed. The index of the new current playable item will be passed as currentIndex.

[signal] void QIviMediaPlayerBackendInterface::currentTrackChanged(const QVariant &currentTrack = QVariant())

Emitted when the currently played playable item changed. The new playable item will be passed as currentTrack.

[signal] void QIviMediaPlayerBackendInterface::dataChanged(const QList<QVariant> &data, int start, int count)

This signal is emitted whenever the play queue changes, e.g. by a insert, remove or a move operation. The data argument holds the new data which will replace the data starting at start until count.

If data is empty the rows identified by the range of start and count will be removed. If count is 0, data will be inserted at start.

For inserting a new item, the item is passed in data and start is used for where the item should be inserted, the count argument needs to be 0 as we don't want to replace existing data:

QList<ExampleItem> list;
ExampleItem item = ExampleItem();
list.insert(index, item);
QVariantList items = { QVariant::fromValue(item) };
emit dataChanged(items, index, 0);

Removing an item is very similar, start is used to indicate which item and count to indicate how much:

emit dataChanged(QVariantList(), index, 1);

See also insert(), remove(), and move().

[signal] void QIviMediaPlayerBackendInterface::dataFetched(const QUuid &identifier, const QList<QVariant> &data, int start, bool moreAvailable)

This signal is emitted as a result of a call to fetchData() and returns the requested data to the QIviPlayQueue instance identified by identifier. The arguments start holds the index where the data starts, moreAvailable holds whether there is more data available. To retrieve this data, use a new fetchData() call.

See also fetchData() and dataFetched().

[signal] void QIviMediaPlayerBackendInterface::durationChanged(qint64 duration = -1)

Emitted when the duration of the currently playing playable item changed. The new duration will be passed as duration in ms.

[signal] void QIviMediaPlayerBackendInterface::mutedChanged(bool muted = false)

Emitted when the player changes its mute state. The player is muted when muted is set to true.

[signal] void QIviMediaPlayerBackendInterface::playModeChanged(QIviMediaPlayer::PlayMode playMode = QIviMediaPlayer::Normal)

Emitted when the play mode changed. The new play mode will be passed as playMode.

[signal] void QIviMediaPlayerBackendInterface::playStateChanged(QIviMediaPlayer::PlayState playState = QIviMediaPlayer::Stopped)

Emitted when the play state changed. The new play state will be passed as playState.

[signal] void QIviMediaPlayerBackendInterface::positionChanged(qint64 position = -1)

Emitted when the position of the currently playing playable item changed. The new position will be passed as position in ms.

[signal] void QIviMediaPlayerBackendInterface::volumeChanged(int volume = -1)

Emitted when the volume of this player changed. The new volume of the player will be passed as volume.

[pure virtual] void QIviMediaPlayerBackendInterface::fetchData(const QUuid &identifier, int start, int count)

This function is called whenever new playable items needs to be retrieved by the QIviPlayQueue.

The parameters start and count define the range of data to be fetched. This method is expected to emit the dataFetched() signal when the new data is ready. Use identifier to identify the calling QIviPlayQueue instance.

See also dataFetched().

[pure virtual] void QIviMediaPlayerBackendInterface::insert(int index, const QVariant &item)

Adds the playable item identitifed by item into the play queue at index.

See also dataChanged().

[pure virtual] void QIviMediaPlayerBackendInterface::move(int currentIndex, int newIndex)

Moves the playable item at position currentIndex of the play queue to the new position newIndex.

See also dataChanged().

[pure virtual] void QIviMediaPlayerBackendInterface::next()

Skips to the next playable item.

[pure virtual] void QIviMediaPlayerBackendInterface::pause()

Pauses the playback of the current playable item.

See also play() and stop().

[pure virtual] void QIviMediaPlayerBackendInterface::play()

Starts playing the current playable item.

See also pause() and stop().

[pure virtual] void QIviMediaPlayerBackendInterface::previous()

Skips to the previous playable item.

[pure virtual] void QIviMediaPlayerBackendInterface::remove(int index)

Removes the playable item at position index from the play queue.

See also dataChanged().

[pure virtual] void QIviMediaPlayerBackendInterface::seek(qint64 offset)

Seeks the current playable item using offset in ms.

The offset can be positive or negative to either seek forward or backward. A successful seek will result in a change of the position property.

[pure virtual] void QIviMediaPlayerBackendInterface::setCurrentIndex(int currentIndex)

Sets the currentIndex of the play-queue to the given index. If a valid index is passed, the function should update the current playable item and emit the corresponding change signals

See also currentIndexChanged, currentTrackChanged, and durationChanged.

[pure virtual] void QIviMediaPlayerBackendInterface::setMuted(bool muted)

When muted is set to true, the player will be muted and un-muted otherwise.

See also mutedChanged.

[pure virtual] void QIviMediaPlayerBackendInterface::setPlayMode(QIviMediaPlayer::PlayMode playMode)

Sets playMode as the new playback mode for the player. If a valid playMode is passed, the function should emit the corresponding change signal.

See also playModeChanged.

[pure virtual] void QIviMediaPlayerBackendInterface::setPosition(qint64 position)

Sets the position of the currently playing item. If a valid position is passed, the function should emit the corresponding change signals

See also positionChanged.

[pure virtual] void QIviMediaPlayerBackendInterface::setVolume(int volume)

Sets the current player volume. The value needs to be between 0 and 100.

See also volumeChanged.

[pure virtual] void QIviMediaPlayerBackendInterface::stop()

Stops playing the current playable item.

See also play() and stop().

© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.