void MmRendererMetaDataReaderControl::setMetaData(const MmRendererMetaData &data) { const MmRendererMetaData oldMetaData = m_metaData; const bool oldMetaDataAvailable = isMetaDataAvailable(); m_metaData = data; bool changed = false; if (m_metaData.title() != oldMetaData.title()) { changed = true; emit metaDataChanged(QMediaMetaData::Title, m_metaData.title()); } else if (m_metaData.artist() != oldMetaData.artist()) { changed = true; emit metaDataChanged(QMediaMetaData::Author, m_metaData.artist()); } else if (m_metaData.comment() != oldMetaData.comment()) { changed = true; emit metaDataChanged(QMediaMetaData::Comment, m_metaData.comment()); } else if (m_metaData.genre() != oldMetaData.genre()) { changed = true; emit metaDataChanged(QMediaMetaData::Genre, m_metaData.genre()); } else if (m_metaData.year() != oldMetaData.year()) { changed = true; emit metaDataChanged(QMediaMetaData::Year, m_metaData.year()); } else if (m_metaData.mediaType() != oldMetaData.mediaType()) { changed = true; emit metaDataChanged(QMediaMetaData::MediaType, m_metaData.mediaType()); } else if (m_metaData.duration() != oldMetaData.duration()) { changed = true; emit metaDataChanged(QMediaMetaData::Duration, m_metaData.duration()); } else if (m_metaData.audioBitRate() != oldMetaData.audioBitRate()) { changed = true; emit metaDataChanged(QMediaMetaData::AudioBitRate, m_metaData.audioBitRate()); } else if (m_metaData.sampleRate() != oldMetaData.sampleRate()) { changed = true; emit metaDataChanged(QMediaMetaData::SampleRate, m_metaData.sampleRate()); } else if (m_metaData.album() != oldMetaData.album()) { changed = true; emit metaDataChanged(QMediaMetaData::AlbumTitle, m_metaData.album()); } else if (m_metaData.track() != oldMetaData.track()) { changed = true; emit metaDataChanged(QMediaMetaData::TrackNumber, m_metaData.track()); } else if (m_metaData.resolution() != oldMetaData.resolution()) { changed = true; emit metaDataChanged(QMediaMetaData::Resolution, m_metaData.resolution()); } if (changed) emit metaDataChanged(); const bool metaDataAvailable = isMetaDataAvailable(); if (metaDataAvailable != oldMetaDataAvailable) emit metaDataAvailableChanged(metaDataAvailable); }
void QGstreamerMetaDataProvider::updateTags() { QVariantMap oldTags = m_tags; m_tags.clear(); bool changed = false; QMapIterator<QByteArray ,QVariant> i(m_session->tags()); while (i.hasNext()) { i.next(); //use gstreamer native keys for elements not in our key map QString key = qt_gstreamerMetaDataKeys()->value(i.key(), i.key()); m_tags.insert(key, i.value()); if (i.value() != oldTags.value(key)) { changed = true; emit metaDataChanged(key, i.value()); } } if (oldTags.isEmpty() != m_tags.isEmpty()) { emit metaDataAvailableChanged(isMetaDataAvailable()); changed = true; } if (changed) emit metaDataChanged(); }