DragonIcyMetadata Class

Implicit-shared ICY metadata from radio streams. More...

Header: #include <DragonIcyMetadata>
CMake: find_package(DragonMediaBackend REQUIRED COMPONENTS DragonMediaBackend)
target_link_libraries(mytarget PRIVATE DragonMediaBackend::DragonMediaBackend)

Public Functions

DragonIcyMetadata()
DragonIcyMetadata(const DragonIcyMetadata &other)
void clear()
QHash<QString, QString> customFields() const
bool hasStreamTitle() const
bool hasStreamUrl() const
void insertCustomField(const QString &key, const QString &value)
bool isNull() const
void setCustomFields(const QHash<QString, QString> &fields)
void setStreamTitle(const QString &title)
void setStreamUrl(const QString &url)
QString streamTitle() const
QString streamUrl() const
bool operator!=(const DragonIcyMetadata &other) const
DragonIcyMetadata &operator=(const DragonIcyMetadata &other)
bool operator==(const DragonIcyMetadata &other) const

Detailed Description

While an internet radio stream is played, the stream interleaves ICY metadata blocks with the audio. Dragon Media Backend extracts them and reports the currently playing track through DragonPlayer::currentPlayingForRadiosChanged().

The well-known fields streamTitle and streamUrl are exposed directly, all other fields are available through customFields(). The class is implicitly shared, so copying one is cheap.

See also DragonPlayer::currentPlayingForRadiosChanged().

Member Function Documentation

DragonIcyMetadata::DragonIcyMetadata()

Constructs a null metadata object. isNull() returns true.

DragonIcyMetadata::DragonIcyMetadata(const DragonIcyMetadata &other)

Copies other. The underlying data is implicitly shared.

void DragonIcyMetadata::clear()

Clears all metadata, making this object null.

QHash<QString, QString> DragonIcyMetadata::customFields() const

Returns all custom ICY fields the stream provided, as a mapping of field name to value.

See also setCustomFields().

bool DragonIcyMetadata::hasStreamTitle() const

Returns true if the stream provided a stream title.

bool DragonIcyMetadata::hasStreamUrl() const

Returns true if the stream provided a stream URL.

void DragonIcyMetadata::insertCustomField(const QString &key, const QString &value)

Inserts the custom ICY field key with value, replacing any previous value stored under key.

bool DragonIcyMetadata::isNull() const

Returns true if this object was default-constructed and no metadata was set.

void DragonIcyMetadata::setCustomFields(const QHash<QString, QString> &fields)

Replaces the custom ICY fields with fields.

See also customFields().

void DragonIcyMetadata::setStreamTitle(const QString &title)

Sets the ICY stream title to title.

See also streamTitle().

void DragonIcyMetadata::setStreamUrl(const QString &url)

Sets the ICY stream URL to url.

See also streamUrl().

QString DragonIcyMetadata::streamTitle() const

Returns the ICY stream title, typically the artist and track name of the song currently playing.

Returns an empty string if the stream did not provide a title; use hasStreamTitle() to distinguish that case.

See also setStreamTitle().

QString DragonIcyMetadata::streamUrl() const

Returns the ICY stream URL, usually the stream's home page.

Returns an empty string if the stream did not provide a URL; use hasStreamUrl() to distinguish that case.

See also setStreamUrl().

bool DragonIcyMetadata::operator!=(const DragonIcyMetadata &other) const

Returns true if other holds different metadata.

DragonIcyMetadata &DragonIcyMetadata::operator=(const DragonIcyMetadata &other)

Assigns other to this object. The underlying data is implicitly shared.

bool DragonIcyMetadata::operator==(const DragonIcyMetadata &other) const

Returns true if other holds the same metadata.