From d15b4dfb2a191371910a5d72b14fdf7570bb053f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 6 Jul 2014 22:57:04 +0200 Subject: [PATCH] qv4l2: make the destination sizeimage large enough Normally v4lconvert_try_format() will make sure that sizeimage is large enough by calling try_fmt(). But if the multiplanar plugin is in use, then v4lconvert_try_format() bypasses that plugin and try_fmt() will fail since the driver expects the _MPLANE buffer types. Normal programs won't use this function, so it won't be a problem there. But in our case the solution is fairly simple: just calculate sizeimage ourselves. Signed-off-by: Hans Verkuil --- utils/qv4l2/qv4l2.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp index d8a3b6c..29c767f 100644 --- a/utils/qv4l2/qv4l2.cpp +++ b/utils/qv4l2/qv4l2.cpp @@ -1151,6 +1151,9 @@ void ApplicationWindow::capStart(bool start) m_mustConvert = true; dstPix.pixelformat = V4L2_PIX_FMT_RGB24; + // Make sure sizeimage is large enough. This is necessary if the mplane + // plugin is in use since v4lconvert_try_format() bypasses the plugin. + dstPix.sizeimage = dstPix.width * dstPix.height * 3; v4l2_format copy = m_capSrcFormat; v4lconvert_try_format(m_convertData, &m_capDestFormat, &m_capSrcFormat); // v4lconvert_try_format sometimes modifies the source format if it thinks -- 2.7.4