summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2014-01-30 14:01:55 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-30 14:34:00 +0100
commit8fd3a5a198acaf32243617d46e269991284e8e13 (patch)
tree2634cb1100d7ec839a4b6baa87b0f2cd2c749d43
parentbffb1cc117e08fb7571836698a5b688d0f4f5de9 (diff)
Android: add missing information in frames retrieved with QVideoProbe.
The number of bytes per line was missing. Change-Id: I0afbdcfd6d7195b7beb3fd09f4ed262f756be848 Reviewed-by: Denis Kormalev <dkormalev@ics.com> Reviewed-by: Christian Stromme <christian.stromme@digia.com>
-rw-r--r--src/plugins/android/src/mediacapture/qandroidcamerasession.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
index 86c5e3120..2b540dc87 100644
--- a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
+++ b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp
@@ -57,15 +57,16 @@ QT_BEGIN_NAMESPACE
class DataVideoBuffer : public QAbstractVideoBuffer
{
public:
- DataVideoBuffer(const QByteArray &d)
+ DataVideoBuffer(const QByteArray &d, int bpl = -1)
: QAbstractVideoBuffer(NoHandle)
, data(d)
, mode(NotMapped)
+ , bytesPerLine(bpl)
{ }
MapMode mapMode() const { return mode; }
- uchar *map(MapMode m, int *numBytes, int *bytesPerLine)
+ uchar *map(MapMode m, int *numBytes, int *bpl)
{
if (mode != NotMapped || m == NotMapped)
return 0;
@@ -75,8 +76,8 @@ public:
if (numBytes)
*numBytes = data.size();
- if (bytesPerLine)
- *bytesPerLine = -1;
+ if (bpl)
+ *bpl = bytesPerLine;
return reinterpret_cast<uchar *>(data.data());
}
@@ -86,6 +87,7 @@ public:
private:
QByteArray data;
MapMode mode;
+ int bytesPerLine;
};
@@ -543,8 +545,11 @@ void QAndroidCameraSession::onCameraFrameFetched(const QByteArray &frame)
{
m_videoProbesMutex.lock();
if (frame.size() && m_videoProbes.count()) {
- QVideoFrame videoFrame(new DataVideoBuffer(frame),
- m_camera->previewSize(),
+ const QSize frameSize = m_camera->previewSize();
+ // Bytes per line should be only for the first plane. For NV21, the Y plane has 8 bits
+ // per sample, so bpl == width
+ QVideoFrame videoFrame(new DataVideoBuffer(frame, frameSize.width()),
+ frameSize,
QVideoFrame::Format_NV21);
foreach (QAndroidMediaVideoProbeControl *probe, m_videoProbes)
probe->newFrameProbed(videoFrame);