From: Hans Verkuil Date: Fri, 18 Jul 2014 11:57:29 +0000 (+0200) Subject: qv4l2: bypass libv4l2 when obtaining the colorspace X-Git-Tag: v4l-utils-1.3.90~87 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7db9686c717731633614b42d4b624e473647a13;p=platform%2Fupstream%2Fv4l-utils.git qv4l2: bypass libv4l2 when obtaining the colorspace libv4l2 does not update the colorspace information when it should. So just for the purpose of reading the colorspace information we bypass libv4l2 and do a direct VIDIOC_G_FMT to the driver. I kept forgetting why I wasn't getting the right colorspace results and everytime it took me a while before I realized that the colorspace was wrong. Signed-off-by: Hans Verkuil --- diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp index b1c3001..2f9b000 100644 --- a/utils/qv4l2/qv4l2.cpp +++ b/utils/qv4l2/qv4l2.cpp @@ -57,6 +57,7 @@ extern "C" { #include #include #include +#include #include #include @@ -981,7 +982,10 @@ void ApplicationWindow::updateColorspace() if (colorspace == 0) { v4l2_format fmt; - g_fmt(m_genTab->bufType(), fmt); + fmt.type = m_genTab->bufType(); + // don't use the wrapped ioctl since it doesn't + // update colorspace correctly. + ::ioctl(fd(), VIDIOC_G_FMT, &fmt); if (m_genTab->isPlanar()) colorspace = fmt.fmt.pix_mp.colorspace; else