summaryrefslogtreecommitdiffstats
path: root/src/plugins/android/src/mediacapture
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-09-18 21:12:57 +0200
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-10-20 12:51:17 +0000
commit5b3cd2f8b132a8665d37ceabac3fe8828799788b (patch)
treed56eb29bc02018f5fb527a77268959e4fea6c1e3 /src/plugins/android/src/mediacapture
parentee8aca6c8771a92d558003ea5cf62e5236f21bb5 (diff)
Add private API for conversion from QVideoFrame to QImage.
The Android plugin had a function to convert from NV21 to RGB32. It's now moved to the Qt Multimedia library and it supports additional source formats. It could be further improved with more SIMD code, it could then become a public API. Change-Id: Ibee349027048a263a1a7ea74dc51237f7747912c Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/plugins/android/src/mediacapture')
-rw-r--r--src/plugins/android/src/mediacapture/qandroidcamerasession.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
index 179bcdf96..cf1879eb1 100644
--- a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
+++ b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
@@ -43,6 +43,8 @@
#include <qguiapplication.h>
#include <qdebug.h>
#include <qvideoframe.h>
+#include <private/qmemoryvideobuffer_p.h>
+#include <private/qvideoframe_p.h>
QT_BEGIN_NAMESPACE
@@ -582,11 +584,10 @@ void QAndroidCameraSession::processPreviewImage(int id, const QByteArray &data,
QImage QAndroidCameraSession::prepareImageFromPreviewData(const QByteArray &data, int width, int height, int rotation)
{
- QImage result(width, height, QImage::Format_ARGB32);
- qt_convert_NV21_to_ARGB32((const uchar *)data.constData(),
- (quint32 *)result.bits(),
- width,
- height);
+ QVideoFrame frame(new QMemoryVideoBuffer(data, width),
+ QSize(width, height), QVideoFrame::Format_NV21);
+
+ QImage result = qt_imageFromVideoFrame(frame);
QTransform transform;