diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2014-03-04 18:03:20 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-06 02:36:46 +0100 |
commit | cf68c9d02c85f5428436b8e756d4279ef93b9ca1 (patch) | |
tree | 9c57dbde81526ee6988b4fc0cb10c1a732942eca /src | |
parent | 0e280e78e2fe0f0417ca284f6b0d7a536a970bfd (diff) | |
download | qtmultimedia-cf68c9d02c85f5428436b8e756d4279ef93b9ca1.tar.gz qtmultimedia-cf68c9d02c85f5428436b8e756d4279ef93b9ca1.tar.bz2 qtmultimedia-cf68c9d02c85f5428436b8e756d4279ef93b9ca1.zip |
GStreamer: Remove tags when an invalid QVariant is assigned.
Clear the tag list before syncing with reference set so old values
are removed and explicitly remove invalid QVariants from the reference
set so that the type correction doesn't result in invalid values being
written instead.
Change-Id: I7d1bdc95cd2a2d601720db84c9b3ef629477bc99
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinmetadata.cpp | 21 | ||||
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.cpp | 2 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp b/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp index b265fc2a..c2b7c33c 100644 --- a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp @@ -198,11 +198,13 @@ QVariant CameraBinMetaData::metaData(const QString &key) const void CameraBinMetaData::setMetaData(const QString &key, const QVariant &value) { QVariant correctedValue = value; - if (key == QMediaMetaData::Orientation) { - correctedValue = toGStreamerOrientation(value); - } else if (key == QMediaMetaData::GPSSpeed) { - // kilometers per hour to meters per second. - correctedValue = (value.toDouble() * 1000) / 3600; + if (value.isValid()) { + if (key == QMediaMetaData::Orientation) { + correctedValue = toGStreamerOrientation(value); + } else if (key == QMediaMetaData::GPSSpeed) { + // kilometers per hour to meters per second. + correctedValue = (value.toDouble() * 1000) / 3600; + } } static const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup); @@ -211,9 +213,12 @@ void CameraBinMetaData::setMetaData(const QString &key, const QVariant &value) if (qt_gstreamerMetaDataKeys[i].key == key) { const char *name = qt_gstreamerMetaDataKeys[i].token; - correctedValue.convert(qt_gstreamerMetaDataKeys[i].type); - - m_values.insert(QByteArray::fromRawData(name, qstrlen(name)), correctedValue); + if (correctedValue.isValid()) { + correctedValue.convert(qt_gstreamerMetaDataKeys[i].type); + m_values.insert(QByteArray::fromRawData(name, qstrlen(name)), correctedValue); + } else { + m_values.remove(QByteArray::fromRawData(name, qstrlen(name))); + } emit QMetaDataWriterControl::metaDataChanged(); emit metaDataChanged(m_values); diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index 28e23777..8ca6bfd8 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -756,6 +756,8 @@ void CameraBinSession::setMetaData(const QMap<QByteArray, QVariant> &data) GstIterator *elements = gst_bin_iterate_all_by_interface(GST_BIN(m_camerabin), GST_TYPE_TAG_SETTER); GstElement *element = 0; while (gst_iterator_next(elements, (void**)&element) == GST_ITERATOR_OK) { + gst_tag_setter_reset_tags(GST_TAG_SETTER(element)); + QMapIterator<QByteArray, QVariant> it(data); while (it.hasNext()) { it.next(); |