diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2018-11-29 14:48:58 +0300 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2019-02-01 13:59:46 +0000 |
commit | c877776c354a625373e1dc0f38ac4918da9a056f (patch) | |
tree | 2feb1e9be8a346e63f378509fe375cd9bb0e55a3 /src/gsttools | |
parent | b0c7dffcdb1150dd9d8cbf92b93ce0cae4fa10ad (diff) |
GStreamer: support video orientation
Change-Id: I233c45824f517c185cb245d8a7d77cab8551fc51
Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
Diffstat (limited to 'src/gsttools')
-rw-r--r-- | src/gsttools/qgstutils.cpp | 31 | ||||
-rw-r--r-- | src/gsttools/qgstutils_p.h | 5 |
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); |