summaryrefslogtreecommitdiffstats
path: root/src/gsttools
diff options
context:
space:
mode:
Diffstat (limited to 'src/gsttools')
-rw-r--r--src/gsttools/qgstutils.cpp31
-rw-r--r--src/gsttools/qgstutils_p.h5
2 files changed, 36 insertions, 0 deletions
diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp
index 5989d2133..ac4428e04 100644
--- a/src/gsttools/qgstutils.cpp
+++ b/src/gsttools/qgstutils.cpp
@@ -1521,6 +1521,37 @@ QString QGstUtils::fileExtensionForMimeType(const QString &mimeType)
return extension;
}
+#if GST_CHECK_VERSION(0,10,30)
+QVariant QGstUtils::fromGStreamerOrientation(const QVariant &value)
+{
+ // Note gstreamer tokens either describe the counter clockwise rotation of the
+ // image or the clockwise transform to apply to correct the image. The orientation
+ // value returned is the clockwise rotation of the image.
+ const QString token = value.toString();
+ if (token == QStringLiteral("rotate-90"))
+ return 270;
+ if (token == QStringLiteral("rotate-180"))
+ return 180;
+ if (token == QStringLiteral("rotate-270"))
+ return 90;
+ return 0;
+}
+
+QVariant QGstUtils::toGStreamerOrientation(const QVariant &value)
+{
+ switch (value.toInt()) {
+ case 90:
+ return QStringLiteral("rotate-270");
+ case 180:
+ return QStringLiteral("rotate-180");
+ case 270:
+ return QStringLiteral("rotate-90");
+ default:
+ return QStringLiteral("rotate-0");
+ }
+}
+#endif
+
void qt_gst_object_ref_sink(gpointer object)
{
#if GST_CHECK_VERSION(0,10,24)
diff --git a/src/gsttools/qgstutils_p.h b/src/gsttools/qgstutils_p.h
index 24d3e889d..387a2e27a 100644
--- a/src/gsttools/qgstutils_p.h
+++ b/src/gsttools/qgstutils_p.h
@@ -148,6 +148,11 @@ namespace QGstUtils {
Q_GSTTOOLS_EXPORT QPair<qreal, qreal> structureFrameRateRange(const GstStructure *s);
Q_GSTTOOLS_EXPORT QString fileExtensionForMimeType(const QString &mimeType);
+
+#if GST_CHECK_VERSION(0,10,30)
+ Q_GSTTOOLS_EXPORT QVariant fromGStreamerOrientation(const QVariant &value);
+ Q_GSTTOOLS_EXPORT QVariant toGStreamerOrientation(const QVariant &value);
+#endif
}
Q_GSTTOOLS_EXPORT void qt_gst_object_ref_sink(gpointer object);