qv4l2: fix incorrect handling of fields
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 3 Mar 2014 14:02:35 +0000 (15:02 +0100)
committerHans Verkuil <hans.verkuil@cisco.com>
Mon, 3 Mar 2014 14:02:35 +0000 (15:02 +0100)
I assumed that the format height stays the same when the field value
changes to TOP/BOTTOM/ALTERNATE, but it turns out that the height will
match that of the field height.

So update qv4l2 to match what drivers actually do.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/qv4l2/qv4l2.cpp
utils/qv4l2/qv4l2.h

index 83c9593..7d03c4a 100644 (file)
@@ -841,8 +841,7 @@ void ApplicationWindow::enableScaling(bool enable)
 void ApplicationWindow::updatePixelAspectRatio()
 {
        if (m_capture != NULL && m_genTab != NULL)
-               m_capture->setPixelAspectRatio(m_genTab->getPixelAspectRatio() /
-                                               (m_fieldCapture ? 2 : 1));
+               m_capture->setPixelAspectRatio(m_genTab->getPixelAspectRatio());
 }
 
 void ApplicationWindow::updateCropping()
@@ -979,10 +978,6 @@ void ApplicationWindow::capStart(bool start)
        }
 
        g_fmt_cap(m_capSrcFormat);
-       m_fieldCapture = m_capSrcFormat.fmt.pix.field == V4L2_FIELD_TOP ||
-                        m_capSrcFormat.fmt.pix.field == V4L2_FIELD_BOTTOM ||
-                        m_capSrcFormat.fmt.pix.field == V4L2_FIELD_ALTERNATE;
-       m_heightDiv = m_fieldCapture ? 2 : 1;
        s_fmt(m_capSrcFormat);
        if (m_genTab->get_interval(interval))
                set_interval(interval);
@@ -1008,14 +1003,14 @@ void ApplicationWindow::capStart(bool start)
        // Ensure that the initial image is large enough for native 32 bit per pixel formats
        if (dstPix.pixelformat == V4L2_PIX_FMT_RGB32 || dstPix.pixelformat == V4L2_PIX_FMT_BGR32)
                dstFmt = QImage::Format_ARGB32;
-       m_capImage = new QImage(dstPix.width, dstPix.height / m_heightDiv, dstFmt);
+       m_capImage = new QImage(dstPix.width, dstPix.height, dstFmt);
        m_capImage->fill(0);
        
        updatePixelAspectRatio();
        
        m_capture->setFrame(m_capImage->width(), m_capImage->height(),
                            m_capDestFormat.fmt.pix.pixelformat, m_capImage->bits(), "No frame");
-       m_capture->resize(dstPix.width, dstPix.height / m_heightDiv);
+       m_capture->resize(dstPix.width, dstPix.height);
        if (showFrames())
                m_capture->show();
 
index 8130318..b8cc3b8 100644 (file)
@@ -106,8 +106,6 @@ private:
        struct buffer *m_buffers;
        struct v4l2_format m_capSrcFormat;
        struct v4l2_format m_capDestFormat;
-       bool m_fieldCapture;
-       unsigned m_heightDiv;
        unsigned char *m_frameData;
        unsigned m_nbuffers;
        struct v4lconvert_data *m_convertData;