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 bool canReportCount() = 0
virtual void fetchData(int start, int count) = 0
virtual void insert(int index, const QIviPlayableItem *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 setPlayMode(QIviMediaPlayer::PlayMode playMode) = 0
virtual void setPosition(qint64 position) = 0
virtual void stop() = 0

Signals

void countChanged(int newLength)
void currentIndexChanged(int currentIndex)
void currentTrackChanged(const QVariant &currentTrack)
void dataChanged(const QList<QVariant> &data, int start, int count)
void dataFetched(const QList<QVariant> &data, int start, bool moreAvailable)
void durationChanged(qint64 duration)
void playModeChanged(QIviMediaPlayer::PlayMode playMode)
void playStateChanged(QIviMediaPlayer::PlayState playState)
void positionChanged(qint64 position)

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

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

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.

[pure virtual] bool QIviMediaPlayerBackendInterface::canReportCount()

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

[signal] void QIviMediaPlayerBackendInterface::countChanged(int newLength)

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)

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)

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:

list.removeAt(index);
emit dataChanged(QVariantList(), index, 1);

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

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

This signal is emitted as a result of a call of fetchData() and returns the requested data in the argument data to the QIviPlayQueue. The arguments start holds the index where the data starts and moreAvailable holds whether there is more data available and a new fetchData() call can be used to retrieve this data.

See also fetchData() and dataFetched().

[signal] void QIviMediaPlayerBackendInterface::durationChanged(qint64 duration)

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

[pure virtual] void QIviMediaPlayerBackendInterface::fetchData(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 which should be fetched. This method is expected to emit the dataFetched() signal once the new data is ready.

See also dataFetched().

[pure virtual] void QIviMediaPlayerBackendInterface::insert(int index, const QIviPlayableItem *item)

Adds the playable item identitifed by item into the play queue at index. The provided item is owned by the QIviMediaPlayer and it's expected that the backend stores its internal representation.

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

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

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

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

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

[signal] void QIviMediaPlayerBackendInterface::positionChanged(qint64 position)

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

[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::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::stop()

Stops playing the current playable item.

See also play() and stop().

© 2018 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.