GStreamer: correctly get metadata from live sources.
For some unknown reason, "iradio-mode" was set to false on the source element, which was preventing new metadata to be received when playing live streams. Task-number: QTBUG-37640 Change-Id: Ib90297e81e26a99c3dfc753bdcd5cbd1ee2f6764 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
0821606260
commit
464ed66119
@@ -162,25 +162,18 @@ void QGstreamerMetaDataProvider::updateTags()
|
|||||||
{
|
{
|
||||||
QVariantMap oldTags = m_tags;
|
QVariantMap oldTags = m_tags;
|
||||||
m_tags.clear();
|
m_tags.clear();
|
||||||
|
bool changed = false;
|
||||||
QSet<QString> allTags = QSet<QString>::fromList(m_tags.keys());
|
|
||||||
|
|
||||||
QMapIterator<QByteArray ,QVariant> i(m_session->tags());
|
QMapIterator<QByteArray ,QVariant> i(m_session->tags());
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
//use gstreamer native keys for elements not in m_keysMap
|
//use gstreamer native keys for elements not in m_keysMap
|
||||||
QString key = m_keysMap.value(i.key(), i.key());
|
QString key = m_keysMap.value(i.key(), i.key());
|
||||||
m_tags[key] = i.value();
|
m_tags.insert(key, i.value());
|
||||||
allTags.insert(key);
|
if (i.value() != oldTags.value(key)) {
|
||||||
}
|
changed = true;
|
||||||
|
emit metaDataChanged(key, i.value());
|
||||||
bool changed = false;
|
}
|
||||||
foreach (const QString &key, allTags) {
|
|
||||||
const QVariant value = m_tags.value(key);
|
|
||||||
if (value != oldTags.value(key)) {
|
|
||||||
changed = true;
|
|
||||||
emit metaDataChanged(key, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
|
|||||||
@@ -987,13 +987,15 @@ bool QGstreamerPlayerSession::processBusMessage(const QGstreamerMessage &message
|
|||||||
if (gm) {
|
if (gm) {
|
||||||
//tag message comes from elements inside playbin, not from playbin itself
|
//tag message comes from elements inside playbin, not from playbin itself
|
||||||
if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_TAG) {
|
if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_TAG) {
|
||||||
//qDebug() << "tag message";
|
|
||||||
GstTagList *tag_list;
|
GstTagList *tag_list;
|
||||||
gst_message_parse_tag(gm, &tag_list);
|
gst_message_parse_tag(gm, &tag_list);
|
||||||
m_tags.unite(QGstUtils::gstTagListToMap(tag_list));
|
|
||||||
|
QMap<QByteArray, QVariant> newTags = QGstUtils::gstTagListToMap(tag_list);
|
||||||
|
QMap<QByteArray, QVariant>::const_iterator it = newTags.constBegin();
|
||||||
|
for ( ; it != newTags.constEnd(); ++it)
|
||||||
|
m_tags.insert(it.key(), it.value()); // overwrite existing tags
|
||||||
|
|
||||||
gst_tag_list_free(tag_list);
|
gst_tag_list_free(tag_list);
|
||||||
//qDebug() << m_tags;
|
|
||||||
|
|
||||||
emit tagsChanged();
|
emit tagsChanged();
|
||||||
} else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_DURATION) {
|
} else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_DURATION) {
|
||||||
@@ -1459,13 +1461,6 @@ void QGstreamerPlayerSession::playbinNotifySource(GObject *o, GParamSpec *p, gpo
|
|||||||
qDebug() << "Playbin source added:" << G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(source));
|
qDebug() << "Playbin source added:" << G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(source));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Turn off icecast metadata request, will be re-set if in QNetworkRequest
|
|
||||||
// (souphttpsrc docs say is false by default, but header appears in request
|
|
||||||
// @version 0.10.21)
|
|
||||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "iradio-mode") != 0)
|
|
||||||
g_object_set(G_OBJECT(source), "iradio-mode", FALSE, NULL);
|
|
||||||
|
|
||||||
|
|
||||||
// Set Headers
|
// Set Headers
|
||||||
const QByteArray userAgentString("User-Agent");
|
const QByteArray userAgentString("User-Agent");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user