summaryrefslogtreecommitdiff
path: root/src/plugins/directshow/player/directshowmetadatacontrol.cpp
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-11-01 18:13:40 +0100
committerYoann Lopes <yoann.lopes@theqtcompany.com>2016-01-06 15:20:59 +0000
commite3123185a58eca0339ed6a19a41f4af3549be49d (patch)
treefe91e8b22ee44a797e6dc5f15cc9a88a1e02c918 /src/plugins/directshow/player/directshowmetadatacontrol.cpp
parent704ac34cc79e3711880bae8eba9c926080b97131 (diff)
downloadqtmultimedia-e3123185a58eca0339ed6a19a41f4af3549be49d.tar.gz
DirectShow: fix metadata signals when changing media.
The metaDataChanged() and metaDataAvailableChanged() signals should be emitted immediately when changing or clearing the current media. Change-Id: I3152e2c32420ba6f11cf6780013e02208a9d6599 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/plugins/directshow/player/directshowmetadatacontrol.cpp')
-rw-r--r--src/plugins/directshow/player/directshowmetadatacontrol.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/plugins/directshow/player/directshowmetadatacontrol.cpp b/src/plugins/directshow/player/directshowmetadatacontrol.cpp
index 3f58be249..5400ac8d4 100644
--- a/src/plugins/directshow/player/directshowmetadatacontrol.cpp
+++ b/src/plugins/directshow/player/directshowmetadatacontrol.cpp
@@ -362,7 +362,18 @@ static QString convertBSTR(BSTR *string)
return value;
}
-void DirectShowMetaDataControl::updateGraph(IFilterGraph2 *graph, IBaseFilter *source, const QString &fileSrc)
+void DirectShowMetaDataControl::reset()
+{
+ bool hadMetadata = !m_metadata.isEmpty();
+ m_metadata.clear();
+
+ setMetadataAvailable(false);
+
+ if (hadMetadata)
+ emit metaDataChanged();
+}
+
+void DirectShowMetaDataControl::updateMetadata(IFilterGraph2 *graph, IBaseFilter *source, const QString &fileSrc)
{
m_metadata.clear();
@@ -568,13 +579,19 @@ void DirectShowMetaDataControl::customEvent(QEvent *event)
if (event->type() == QEvent::Type(MetaDataChanged)) {
event->accept();
- bool oldAvailable = m_available;
- m_available = !m_metadata.isEmpty();
- if (m_available != oldAvailable)
- emit metaDataAvailableChanged(m_available);
+ setMetadataAvailable(!m_metadata.isEmpty());
emit metaDataChanged();
} else {
QMetaDataReaderControl::customEvent(event);
}
}
+
+void DirectShowMetaDataControl::setMetadataAvailable(bool available)
+{
+ if (m_available == available)
+ return;
+
+ m_available = available;
+ emit metaDataAvailableChanged(m_available);
+}