qv4l2: make the destination sizeimage large enough
authorHans Verkuil <hans.verkuil@cisco.com>
Sun, 6 Jul 2014 20:57:04 +0000 (22:57 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Sun, 6 Jul 2014 20:57:04 +0000 (22:57 +0200)
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 <hans.verkuil@cisco.com>
utils/qv4l2/qv4l2.cpp

index d8a3b6c..29c767f 100644 (file)
@@ -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