<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックHow can I adjust the V4L2 Size or Timing?</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/How-can-I-adjust-the-V4L2-Size-or-Timing/m-p/742309#M115537</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the imx6dual for my project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I finished overlay the camera image(using the V4L2) on the QT Application(GUI Based.) on the LVDS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But,&lt;/P&gt;&lt;P&gt;In the LVDS screen, camera image is not full for LVDS (640x480).&lt;/P&gt;&lt;P&gt;QT GUI is perfectly fit with LVDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at this :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20375i358F4A0F017BF214/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(gray screen is camera image. )&lt;/P&gt;&lt;P&gt;And 4 colored rectangle is on the QT Application.&lt;/P&gt;&lt;P&gt;Each rectangle is positioned each corner.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But Camera image is not fit with each rectangle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like,&amp;nbsp;&lt;/P&gt;&lt;P&gt;V4L2 has a margin like this :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="area.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20338iB4209BBD092E64C7/image-size/large?v=v2&amp;amp;px=999" role="button" title="area.png" alt="area.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(pink is camera area,&amp;nbsp;&lt;/P&gt;&lt;P&gt;blue is gui area.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can I do for this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, I tried this from example of internet source..&lt;/P&gt;&lt;P&gt;So I cannot know how can I access this problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;※ This Camea is fit with same LVDS when I use another CPU.&lt;/P&gt;&lt;P&gt;So I think that this is not problem of LVDS or Camera's setting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below Code is sample code what I referred.&lt;/P&gt;&lt;P&gt;This code is working same as my QT Program.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It has same margin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need see a some another code, please reply to me.&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * Copyright 2007-2013 Freescale Semiconductor, Inc. All rights reserved.&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * The code contained herein is licensed under the GNU General Public&lt;BR /&gt; * License. You may obtain a copy of the GNU General Public License&lt;BR /&gt; * Version 2 or later at the following locations:&lt;BR /&gt; *&lt;BR /&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.opensource.org%2Flicenses%2Fgpl-license.html" rel="nofollow" target="_blank"&gt;http://www.opensource.org/licenses/gpl-license.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.gnu.org%2Fcopyleft%2Fgpl.html" rel="nofollow" target="_blank"&gt;http://www.gnu.org/copyleft/gpl.html&lt;/A&gt;&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * @file mxc_v4l2_tvin.c&lt;BR /&gt; *&lt;BR /&gt; * @brief Mxc TVIN For Linux 2 driver test application&lt;BR /&gt; *&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;#ifdef __cplusplus&lt;BR /&gt;extern "C"{&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;/*=======================================================================&lt;BR /&gt; INCLUDE FILES&lt;BR /&gt;=======================================================================*/&lt;BR /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;BR /&gt;#include &amp;lt;errno.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdint.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/types.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdint.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/stat.h&amp;gt;&lt;BR /&gt;#include &amp;lt;fcntl.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/ioctl.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/time.h&amp;gt;&lt;BR /&gt;#include &amp;lt;unistd.h&amp;gt;&lt;BR /&gt;#include &amp;lt;asm/types.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/videodev2.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/mman.h&amp;gt;&lt;BR /&gt;#include &amp;lt;math.h&amp;gt;&lt;BR /&gt;#include &amp;lt;string.h&amp;gt;&lt;BR /&gt;#include &amp;lt;malloc.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/time.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include "mxcfb.h"&lt;BR /&gt;#include "mxc_v4l2.h"&lt;BR /&gt;#include "ipu.h"&lt;/P&gt;&lt;P&gt;#define TFAIL -1&lt;BR /&gt;#define TPASS 0&lt;/P&gt;&lt;P&gt;char v4l_capture_dev[100] = "/dev/video0";&lt;BR /&gt;char v4l_output_dev[100] = "/dev/video17";&lt;BR /&gt;int fd_capture_v4l = 0;&lt;BR /&gt;int fd_output_v4l = 0;&lt;BR /&gt;int g_cap_mode = 0;&lt;BR /&gt;int g_input = 1;&lt;BR /&gt;int g_fmt = V4L2_PIX_FMT_UYVY;&lt;BR /&gt;int g_rotate = 0;&lt;BR /&gt;int g_vflip = 0;&lt;BR /&gt;int g_hflip = 0;&lt;BR /&gt;int g_vdi_enable = 0;&lt;BR /&gt;int g_vdi_motion = 0;&lt;BR /&gt;int g_tb = 0;&lt;BR /&gt;int g_output = 3;&lt;/P&gt;&lt;P&gt;int g_output_num_buffers = 4;&lt;BR /&gt;int g_capture_num_buffers = 3;&lt;/P&gt;&lt;P&gt;int g_in_width = 0;&lt;BR /&gt;int g_in_height = 0;&lt;BR /&gt;int g_display_width = 0;&lt;BR /&gt;int g_display_height = 0;&lt;BR /&gt;int g_display_top = 0;&lt;BR /&gt;int g_display_left = 0;&lt;BR /&gt;int g_frame_size;&lt;BR /&gt;int g_frame_period = 33333;&lt;BR /&gt;v4l2_std_id g_current_std = V4L2_STD_NTSC;&lt;/P&gt;&lt;P&gt;struct testbuffer&lt;BR /&gt;{&lt;BR /&gt; unsigned char *start;&lt;BR /&gt; size_t offset;&lt;BR /&gt; unsigned int length;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;struct testbuffer output_buffers[4];&lt;BR /&gt;struct testbuffer capture_buffers[3];&lt;/P&gt;&lt;P&gt;int start_capturing(void)&lt;BR /&gt;{&lt;BR /&gt; unsigned int i;&lt;BR /&gt; struct v4l2_buffer buf;&lt;BR /&gt; enum v4l2_buf_type type;&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; g_capture_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; memset(&amp;amp;buf, 0, sizeof (buf));&lt;BR /&gt; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; buf.index = i;&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_QUERYBUF, &amp;amp;buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_QUERYBUF error\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;capture_buffers[i].length = buf.length;&lt;BR /&gt; capture_buffers[i].offset = (size_t) buf.m.offset;&lt;BR /&gt; capture_buffers[i].start = mmap (NULL, capture_buffers[i].length,&lt;BR /&gt; PROT_READ | PROT_WRITE, MAP_SHARED,&lt;BR /&gt; fd_capture_v4l, capture_buffers[i].offset);&lt;BR /&gt; memset(capture_buffers[i].start, 0xFF, capture_buffers[i].length);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; g_capture_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; memset(&amp;amp;buf, 0, sizeof (buf));&lt;BR /&gt; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; buf.index = i;&lt;BR /&gt; buf.m.offset = capture_buffers[i].offset;&lt;BR /&gt; if (ioctl (fd_capture_v4l, VIDIOC_QBUF, &amp;amp;buf) &amp;lt; 0) {&lt;BR /&gt; printf("VIDIOC_QBUF error\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; if (ioctl (fd_capture_v4l, VIDIOC_STREAMON, &amp;amp;type) &amp;lt; 0) {&lt;BR /&gt; printf("VIDIOC_STREAMON error\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int prepare_output(void)&lt;BR /&gt;{&lt;BR /&gt; int i;&lt;BR /&gt; struct v4l2_buffer output_buf;&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; g_output_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; memset(&amp;amp;output_buf, 0, sizeof(output_buf));&lt;BR /&gt; output_buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; output_buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; output_buf.index = i;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_QUERYBUF, &amp;amp;output_buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_QUERYBUF error\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;output_buffers[i].length = output_buf.length;&lt;BR /&gt; output_buffers[i].offset = (size_t) output_buf.m.offset;&lt;BR /&gt; output_buffers[i].start = mmap (NULL, output_buffers[i].length,&lt;BR /&gt; PROT_READ | PROT_WRITE, MAP_SHARED,&lt;BR /&gt; fd_output_v4l, output_buffers[i].offset);&lt;BR /&gt; if (output_buffers[i].start == NULL) {&lt;BR /&gt; printf("v4l2 tvin test: output mmap failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int v4l_capture_setup(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;struct v4l2_capability cap;&lt;BR /&gt; struct v4l2_cropcap cropcap;&lt;BR /&gt; struct v4l2_crop crop;&lt;BR /&gt; struct v4l2_format fmt;&lt;BR /&gt; struct v4l2_requestbuffers req;&lt;BR /&gt; struct v4l2_dbg_chip_ident chip;&lt;BR /&gt; struct v4l2_streamparm parm;&lt;BR /&gt; v4l2_std_id id;&lt;BR /&gt; unsigned int min;&lt;/P&gt;&lt;P&gt;if (ioctl (fd_capture_v4l, VIDIOC_QUERYCAP, &amp;amp;cap) &amp;lt; 0) {&lt;BR /&gt; if (EINVAL == errno) {&lt;BR /&gt; fprintf (stderr, "%s is no V4L2 device\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; } else {&lt;BR /&gt; fprintf (stderr, "%s isn not V4L device,unknow error\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (!(cap.capabilities &amp;amp; V4L2_CAP_VIDEO_CAPTURE)) {&lt;BR /&gt; fprintf (stderr, "%s is no video capture device\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (!(cap.capabilities &amp;amp; V4L2_CAP_STREAMING)) {&lt;BR /&gt; fprintf (stderr, "%s does not support streaming i/o\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_DBG_G_CHIP_IDENT, &amp;amp;chip))&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_DBG_G_CHIP_IDENT failed.\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; printf("TV decoder chip is %s\n", chip.match.name);&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_S_INPUT, &amp;amp;g_input) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_S_INPUT failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_G_STD, &amp;amp;id) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_G_STD failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; g_current_std = id;&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_S_STD, &amp;amp;id) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_S_STD failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Select video input, video standard and tune here. */&lt;/P&gt;&lt;P&gt;memset(&amp;amp;cropcap, 0, sizeof(cropcap));&lt;/P&gt;&lt;P&gt;cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;/P&gt;&lt;P&gt;if (ioctl (fd_capture_v4l, VIDIOC_CROPCAP, &amp;amp;cropcap) &amp;lt; 0) {&lt;BR /&gt; crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; crop.c = cropcap.defrect; /* reset to default */&lt;/P&gt;&lt;P&gt;if (ioctl (fd_capture_v4l, VIDIOC_S_CROP, &amp;amp;crop) &amp;lt; 0) {&lt;BR /&gt; switch (errno) {&lt;BR /&gt; case EINVAL:&lt;BR /&gt; /* Cropping not supported. */&lt;BR /&gt; fprintf (stderr, "%s doesn't support crop\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; break;&lt;BR /&gt; default:&lt;BR /&gt; /* Errors ignored. */&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; } else {&lt;BR /&gt; /* Errors ignored. */&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;parm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; parm.parm.capture.timeperframe.numerator = 1;&lt;BR /&gt; parm.parm.capture.timeperframe.denominator = 0;&lt;BR /&gt; parm.parm.capture.capturemode = 0;&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_S_PARM, &amp;amp;parm) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_S_PARM failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;memset(&amp;amp;fmt, 0, sizeof(fmt));&lt;/P&gt;&lt;P&gt;fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; fmt.fmt.pix.width = 0;&lt;BR /&gt; fmt.fmt.pix.height = 0;&lt;BR /&gt; fmt.fmt.pix.pixelformat = g_fmt;&lt;BR /&gt; fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; if (ioctl (fd_capture_v4l, VIDIOC_S_FMT, &amp;amp;fmt) &amp;lt; 0){&lt;BR /&gt; fprintf (stderr, "%s iformat not supported \n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Note VIDIOC_S_FMT may change width and height. */&lt;/P&gt;&lt;P&gt;/* Buggy driver paranoia. */&lt;BR /&gt; min = fmt.fmt.pix.width * 2;&lt;BR /&gt; if (fmt.fmt.pix.bytesperline &amp;lt; min)&lt;BR /&gt; fmt.fmt.pix.bytesperline = min;&lt;/P&gt;&lt;P&gt;min = fmt.fmt.pix.bytesperline * fmt.fmt.pix.height;&lt;BR /&gt; if (fmt.fmt.pix.sizeimage &amp;lt; min)&lt;BR /&gt; fmt.fmt.pix.sizeimage = min;&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_G_FMT, &amp;amp;fmt) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_G_FMT failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;g_in_width = fmt.fmt.pix.width;&lt;BR /&gt; g_in_height = fmt.fmt.pix.height;&lt;/P&gt;&lt;P&gt;memset(&amp;amp;req, 0, sizeof (req));&lt;/P&gt;&lt;P&gt;req.count = g_capture_num_buffers;&lt;BR /&gt; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; req.memory = V4L2_MEMORY_MMAP;&lt;/P&gt;&lt;P&gt;if (ioctl (fd_capture_v4l, VIDIOC_REQBUFS, &amp;amp;req) &amp;lt; 0) {&lt;BR /&gt; if (EINVAL == errno) {&lt;BR /&gt; fprintf (stderr, "%s does not support "&lt;BR /&gt; "memory mapping\n", v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; } else {&lt;BR /&gt; fprintf (stderr, "%s does not support "&lt;BR /&gt; "memory mapping, unknow error\n", v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (req.count &amp;lt; 2) {&lt;BR /&gt; fprintf (stderr, "Insufficient buffer memory on %s\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int v4l_output_setup(void)&lt;BR /&gt;{&lt;BR /&gt; struct v4l2_control ctrl;&lt;BR /&gt; struct v4l2_format fmt;&lt;BR /&gt; struct v4l2_framebuffer fb;&lt;BR /&gt; struct v4l2_cropcap cropcap;&lt;BR /&gt; struct v4l2_crop crop;&lt;BR /&gt; struct v4l2_capability cap;&lt;BR /&gt; struct v4l2_fmtdesc fmtdesc;&lt;BR /&gt; struct v4l2_requestbuffers buf_req;&lt;/P&gt;&lt;P&gt;if (!ioctl(fd_output_v4l, VIDIOC_QUERYCAP, &amp;amp;cap)) {&lt;BR /&gt; printf("driver=%s, card=%s, bus=%s, \r\n"&lt;BR /&gt; "version=0x%08x, "&lt;BR /&gt; "capabilities=0x%08x\n",&lt;BR /&gt; cap.driver, cap.card, cap.bus_info,&lt;BR /&gt; cap.version,&lt;BR /&gt; cap.capabilities);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;fmtdesc.index = 0;&lt;BR /&gt; fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; while (!ioctl(fd_output_v4l, VIDIOC_ENUM_FMT, &amp;amp;fmtdesc)) {&lt;BR /&gt; printf("fmt %s: fourcc = 0x%08x\n",&lt;BR /&gt; fmtdesc.description,&lt;BR /&gt; fmtdesc.pixelformat);&lt;BR /&gt; fmtdesc.index++;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;memset(&amp;amp;cropcap, 0, sizeof(cropcap));&lt;BR /&gt; cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_CROPCAP, &amp;amp;cropcap) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("get crop capability failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; crop.c.top = g_display_top;&lt;BR /&gt; crop.c.left = g_display_left;&lt;BR /&gt; crop.c.width = g_display_width;&lt;BR /&gt; crop.c.height = g_display_height;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CROP, &amp;amp;crop) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set crop failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;// Set rotation&lt;BR /&gt; ctrl.id = V4L2_CID_ROTATE;&lt;BR /&gt; ctrl.value = g_rotate;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CTRL, &amp;amp;ctrl) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set ctrl rotate failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; ctrl.id = V4L2_CID_VFLIP;&lt;BR /&gt; ctrl.value = g_vflip;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CTRL, &amp;amp;ctrl) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set ctrl vflip failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; ctrl.id = V4L2_CID_HFLIP;&lt;BR /&gt; ctrl.value = g_hflip;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CTRL, &amp;amp;ctrl) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set ctrl hflip failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (g_vdi_enable) {&lt;BR /&gt; ctrl.id = V4L2_CID_MXC_MOTION;&lt;BR /&gt; ctrl.value = g_vdi_motion;&lt;BR /&gt; //ctrl.value = 0; &lt;BR /&gt; &lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CTRL, &amp;amp;ctrl) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set ctrl motion failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;fb.flags = V4L2_FBUF_FLAG_OVERLAY;&lt;BR /&gt; ioctl(fd_output_v4l, VIDIOC_S_FBUF, &amp;amp;fb);&lt;/P&gt;&lt;P&gt;memset(&amp;amp;fmt, 0, sizeof(fmt));&lt;BR /&gt; fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; fmt.fmt.pix.width= g_in_width;&lt;BR /&gt; fmt.fmt.pix.height= g_in_height;&lt;BR /&gt; fmt.fmt.pix.pixelformat = g_fmt;&lt;BR /&gt; fmt.fmt.pix.bytesperline = g_in_width;&lt;BR /&gt; fmt.fmt.pix.priv = 0;&lt;BR /&gt; fmt.fmt.pix.sizeimage = 0;&lt;BR /&gt; &lt;BR /&gt; if (g_tb)&lt;BR /&gt; fmt.fmt.pix.field = V4L2_FIELD_INTERLACED_TB;&lt;BR /&gt; else&lt;BR /&gt; fmt.fmt.pix.field = V4L2_FIELD_INTERLACED_BT;&lt;BR /&gt; &lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_FMT, &amp;amp;fmt) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set format failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (ioctl(fd_output_v4l, VIDIOC_G_FMT, &amp;amp;fmt) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("get format failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; g_frame_size = fmt.fmt.pix.sizeimage;&lt;/P&gt;&lt;P&gt;memset(&amp;amp;buf_req, 0, sizeof(buf_req));&lt;BR /&gt; buf_req.count = g_output_num_buffers;&lt;BR /&gt; buf_req.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; buf_req.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_REQBUFS, &amp;amp;buf_req) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("request buffers failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int&lt;BR /&gt;mxc_v4l_tvin_test(void)&lt;BR /&gt;{&lt;BR /&gt; struct v4l2_buffer capture_buf, output_buf;&lt;BR /&gt; v4l2_std_id id;&lt;BR /&gt; int i, j;&lt;BR /&gt; enum v4l2_buf_type type;&lt;BR /&gt; int total_time;&lt;BR /&gt; struct timeval tv_start, tv_current;&lt;BR /&gt; int rtn;&lt;/P&gt;&lt;P&gt;if (prepare_output() &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("prepare_output failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (start_capturing() &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("start_capturing failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;gettimeofday(&amp;amp;tv_start, 0);&lt;BR /&gt; printf("start time = %d s, %d us\n", (unsigned int) tv_start.tv_sec,&lt;BR /&gt; (unsigned int) tv_start.tv_usec);&lt;/P&gt;&lt;P&gt;for (i = 0; ; i++) {&lt;BR /&gt;begin:&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_G_STD, &amp;amp;id)) {&lt;BR /&gt; printf("VIDIOC_G_STD failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (id == g_current_std)&lt;BR /&gt; {&lt;BR /&gt; //printf("goto next\r\n");&lt;BR /&gt; goto next;&lt;BR /&gt; }&lt;BR /&gt; else if (id == V4L2_STD_PAL || id == V4L2_STD_NTSC) {&lt;BR /&gt; type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; ioctl(fd_output_v4l, VIDIOC_STREAMOFF, &amp;amp;type);&lt;/P&gt;&lt;P&gt;type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; ioctl(fd_capture_v4l, VIDIOC_STREAMOFF, &amp;amp;type);&lt;/P&gt;&lt;P&gt;for (j = 0; j &amp;lt; g_output_num_buffers; j++)&lt;BR /&gt; {&lt;BR /&gt; munmap(output_buffers[j].start, output_buffers[j].length);&lt;BR /&gt; }&lt;BR /&gt; for (j = 0; j &amp;lt; g_capture_num_buffers; j++)&lt;BR /&gt; {&lt;BR /&gt; munmap(capture_buffers[j].start, capture_buffers[j].length);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (v4l_capture_setup() &amp;lt; 0) {&lt;BR /&gt; printf("Setup v4l capture failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (v4l_output_setup() &amp;lt; 0) {&lt;BR /&gt; printf("Setup v4l output failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (prepare_output() &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("prepare_output failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (start_capturing() &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("start_capturing failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; i = 0;&lt;BR /&gt; printf("TV standard changed\n");&lt;BR /&gt; } else {&lt;BR /&gt; sleep(1);&lt;BR /&gt; /* Try again */&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_G_STD, &amp;amp;id)) {&lt;BR /&gt; printf("VIDIOC_G_STD failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (id != V4L2_STD_ALL)&lt;BR /&gt; goto begin;&lt;/P&gt;&lt;P&gt;printf("Cannot detect TV standard\n");&lt;BR /&gt; return 0;&lt;BR /&gt; }&lt;BR /&gt;next:&lt;/P&gt;&lt;P&gt;/*rtn = poll( (struct pollfd *)&amp;amp;poll_fds, 1, tmout );&lt;BR /&gt; if ( rtn &amp;lt; 0 ) return -1;*/&lt;/P&gt;&lt;P&gt;memset(&amp;amp;capture_buf, 0, sizeof(capture_buf));&lt;BR /&gt; capture_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; capture_buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_DQBUF, &amp;amp;capture_buf) &amp;lt; 0) {&lt;BR /&gt; printf("VIDIOC_DQBUF failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;memset(&amp;amp;output_buf, 0, sizeof(output_buf));&lt;BR /&gt; output_buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; output_buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; if (i &amp;lt; g_output_num_buffers) {&lt;BR /&gt; output_buf.index = i;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_QUERYBUF, &amp;amp;output_buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_QUERYBUF failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; } else {&lt;BR /&gt; output_buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; output_buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_DQBUF, &amp;amp;output_buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_DQBUF failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;memcpy(output_buffers[output_buf.index].start, capture_buffers[capture_buf.index].start, g_frame_size);&lt;BR /&gt; &lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_QBUF, &amp;amp;capture_buf) &amp;lt; 0) {&lt;BR /&gt; printf("VIDIOC_QBUF failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;output_buf.timestamp.tv_sec = tv_start.tv_sec;&lt;BR /&gt; output_buf.timestamp.tv_usec = tv_start.tv_usec + (g_frame_period * i);&lt;BR /&gt; if (g_vdi_enable)&lt;BR /&gt; output_buf.field = g_tb ? V4L2_FIELD_INTERLACED_TB :&lt;BR /&gt; V4L2_FIELD_INTERLACED_BT;&lt;BR /&gt; &lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_QBUF, &amp;amp;output_buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_QBUF failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; if (i == 1) {&lt;BR /&gt; type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_STREAMON, &amp;amp;type) &amp;lt; 0) {&lt;BR /&gt; printf("Could not start stream\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;//if(i==4) break;&lt;BR /&gt; }&lt;BR /&gt; gettimeofday(&amp;amp;tv_current, 0);&lt;BR /&gt; total_time = (tv_current.tv_sec - tv_start.tv_sec) * 1000000L;&lt;BR /&gt; total_time += tv_current.tv_usec - tv_start.tv_usec;&lt;BR /&gt; printf("total time for %u frames = %u us = %lld fps\n", i, total_time, (i * 1000000ULL) / total_time);&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int process_cmdline(int argc, char **argv)&lt;BR /&gt;{&lt;BR /&gt; int i;&lt;/P&gt;&lt;P&gt;for (i = 1; i &amp;lt; argc; i++) {&lt;BR /&gt; if (strcmp(argv[i], "-ow") == 0) {&lt;BR /&gt; g_display_width = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-oh") == 0) {&lt;BR /&gt; g_display_height = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-ot") == 0) {&lt;BR /&gt; g_display_top = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-ol") == 0) {&lt;BR /&gt; g_display_left = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-r") == 0) {&lt;BR /&gt; g_rotate = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-f") == 0) {&lt;BR /&gt; i++;&lt;BR /&gt; g_fmt = v4l2_fourcc(argv[i][0], argv[i][1],argv[i][2],argv[i][3]);&lt;BR /&gt; if ((g_fmt != V4L2_PIX_FMT_NV12) &amp;amp;&amp;amp;&lt;BR /&gt; (g_fmt != V4L2_PIX_FMT_UYVY) &amp;amp;&amp;amp;&lt;BR /&gt; (g_fmt != V4L2_PIX_FMT_YUYV) &amp;amp;&amp;amp;&lt;BR /&gt; (g_fmt != V4L2_PIX_FMT_YUV420)) {&lt;BR /&gt; printf("Default format is used: UYVY\n");&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-m") == 0) {&lt;BR /&gt; g_vdi_enable = 1;&lt;BR /&gt; g_vdi_motion = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-tb") == 0) {&lt;BR /&gt; g_tb = 1;&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-help") == 0) {&lt;BR /&gt; printf("MXC Video4Linux TVin Test\n\n" \&lt;BR /&gt; "Syntax: mxc_v4l2_tvin.out\n" \&lt;BR /&gt; " -ow &amp;lt;capture display width&amp;gt;\n" \&lt;BR /&gt; " -oh &amp;lt;capture display height&amp;gt;\n" \&lt;BR /&gt; " -ot &amp;lt;display top&amp;gt;\n" \&lt;BR /&gt; " -ol &amp;lt;display left&amp;gt;\n" \&lt;BR /&gt; " -r &amp;lt;rotation&amp;gt; -c &amp;lt;capture counter&amp;gt; \n"&lt;BR /&gt; " -m &amp;lt;motion&amp;gt; 0:medium 1:low 2:high, 0-default\n"&lt;BR /&gt; " -tb top field first, bottom field first-default\n"&lt;BR /&gt; " -f &amp;lt;format, only YU12, YUYV, UYVY and NV12 are supported&amp;gt; \n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if ((g_display_width == 0) || (g_display_height == 0)) {&lt;BR /&gt; printf("Zero display width or height\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int main(int argc, char **argv)&lt;BR /&gt;{&lt;BR /&gt;#ifdef BUILD_FOR_ANDROID&lt;BR /&gt; char fb_device[100] = "/dev/graphics/fb0";&lt;BR /&gt;#else&lt;BR /&gt; char fb_device[100] = "/dev/fb0";&lt;BR /&gt;#endif&lt;BR /&gt; int fd_fb = 0, i;&lt;BR /&gt; struct mxcfb_gbl_alpha alpha;&lt;BR /&gt; enum v4l2_buf_type type;&lt;/P&gt;&lt;P&gt;if (process_cmdline(argc, argv) &amp;lt; 0) {&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if ((fd_capture_v4l = open(v4l_capture_dev, O_RDWR, 0)) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("Unable to open %s\n", v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if ((fd_output_v4l = open(v4l_output_dev, O_RDWR, 0)) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("Unable to open %s\n", v4l_output_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (v4l_capture_setup() &amp;lt; 0) {&lt;BR /&gt; printf("Setup v4l capture failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (v4l_output_setup() &amp;lt; 0) {&lt;BR /&gt; printf("Setup v4l output failed.\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if ((fd_fb = open(fb_device, O_RDWR )) &amp;lt; 0) {&lt;BR /&gt; printf("Unable to open frame buffer\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Overlay setting */&lt;BR /&gt; alpha.alpha = 0;&lt;BR /&gt; alpha.enable = 1;&lt;BR /&gt; if (ioctl(fd_fb, MXCFB_SET_GBL_ALPHA, &amp;amp;alpha) &amp;lt; 0) {&lt;BR /&gt; printf("Set global alpha failed\n");&lt;BR /&gt; close(fd_fb);&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;mxc_v4l_tvin_test();&lt;/P&gt;&lt;P&gt;type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; ioctl(fd_output_v4l, VIDIOC_STREAMOFF, &amp;amp;type);&lt;/P&gt;&lt;P&gt;type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; ioctl(fd_capture_v4l, VIDIOC_STREAMOFF, &amp;amp;type);&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; g_output_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; munmap(output_buffers[i].start, output_buffers[i].length);&lt;BR /&gt; }&lt;BR /&gt; for (i = 0; i &amp;lt; g_capture_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; munmap(capture_buffers[i].start, capture_buffers[i].length);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;close(fd_capture_v4l);&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; close(fd_fb);&lt;BR /&gt; return 0;&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Jan 2018 06:18:51 GMT</pubDate>
    <dc:creator>호영노</dc:creator>
    <dc:date>2018-01-22T06:18:51Z</dc:date>
    <item>
      <title>How can I adjust the V4L2 Size or Timing?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-can-I-adjust-the-V4L2-Size-or-Timing/m-p/742309#M115537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the imx6dual for my project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I finished overlay the camera image(using the V4L2) on the QT Application(GUI Based.) on the LVDS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But,&lt;/P&gt;&lt;P&gt;In the LVDS screen, camera image is not full for LVDS (640x480).&lt;/P&gt;&lt;P&gt;QT GUI is perfectly fit with LVDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at this :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20375i358F4A0F017BF214/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(gray screen is camera image. )&lt;/P&gt;&lt;P&gt;And 4 colored rectangle is on the QT Application.&lt;/P&gt;&lt;P&gt;Each rectangle is positioned each corner.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But Camera image is not fit with each rectangle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like,&amp;nbsp;&lt;/P&gt;&lt;P&gt;V4L2 has a margin like this :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="area.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20338iB4209BBD092E64C7/image-size/large?v=v2&amp;amp;px=999" role="button" title="area.png" alt="area.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(pink is camera area,&amp;nbsp;&lt;/P&gt;&lt;P&gt;blue is gui area.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can I do for this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, I tried this from example of internet source..&lt;/P&gt;&lt;P&gt;So I cannot know how can I access this problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;※ This Camea is fit with same LVDS when I use another CPU.&lt;/P&gt;&lt;P&gt;So I think that this is not problem of LVDS or Camera's setting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below Code is sample code what I referred.&lt;/P&gt;&lt;P&gt;This code is working same as my QT Program.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It has same margin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need see a some another code, please reply to me.&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * Copyright 2007-2013 Freescale Semiconductor, Inc. All rights reserved.&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * The code contained herein is licensed under the GNU General Public&lt;BR /&gt; * License. You may obtain a copy of the GNU General Public License&lt;BR /&gt; * Version 2 or later at the following locations:&lt;BR /&gt; *&lt;BR /&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.opensource.org%2Flicenses%2Fgpl-license.html" rel="nofollow" target="_blank"&gt;http://www.opensource.org/licenses/gpl-license.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.gnu.org%2Fcopyleft%2Fgpl.html" rel="nofollow" target="_blank"&gt;http://www.gnu.org/copyleft/gpl.html&lt;/A&gt;&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * @file mxc_v4l2_tvin.c&lt;BR /&gt; *&lt;BR /&gt; * @brief Mxc TVIN For Linux 2 driver test application&lt;BR /&gt; *&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;#ifdef __cplusplus&lt;BR /&gt;extern "C"{&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;/*=======================================================================&lt;BR /&gt; INCLUDE FILES&lt;BR /&gt;=======================================================================*/&lt;BR /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;BR /&gt;#include &amp;lt;errno.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdint.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/types.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdint.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/stat.h&amp;gt;&lt;BR /&gt;#include &amp;lt;fcntl.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/ioctl.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/time.h&amp;gt;&lt;BR /&gt;#include &amp;lt;unistd.h&amp;gt;&lt;BR /&gt;#include &amp;lt;asm/types.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/videodev2.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/mman.h&amp;gt;&lt;BR /&gt;#include &amp;lt;math.h&amp;gt;&lt;BR /&gt;#include &amp;lt;string.h&amp;gt;&lt;BR /&gt;#include &amp;lt;malloc.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/time.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include "mxcfb.h"&lt;BR /&gt;#include "mxc_v4l2.h"&lt;BR /&gt;#include "ipu.h"&lt;/P&gt;&lt;P&gt;#define TFAIL -1&lt;BR /&gt;#define TPASS 0&lt;/P&gt;&lt;P&gt;char v4l_capture_dev[100] = "/dev/video0";&lt;BR /&gt;char v4l_output_dev[100] = "/dev/video17";&lt;BR /&gt;int fd_capture_v4l = 0;&lt;BR /&gt;int fd_output_v4l = 0;&lt;BR /&gt;int g_cap_mode = 0;&lt;BR /&gt;int g_input = 1;&lt;BR /&gt;int g_fmt = V4L2_PIX_FMT_UYVY;&lt;BR /&gt;int g_rotate = 0;&lt;BR /&gt;int g_vflip = 0;&lt;BR /&gt;int g_hflip = 0;&lt;BR /&gt;int g_vdi_enable = 0;&lt;BR /&gt;int g_vdi_motion = 0;&lt;BR /&gt;int g_tb = 0;&lt;BR /&gt;int g_output = 3;&lt;/P&gt;&lt;P&gt;int g_output_num_buffers = 4;&lt;BR /&gt;int g_capture_num_buffers = 3;&lt;/P&gt;&lt;P&gt;int g_in_width = 0;&lt;BR /&gt;int g_in_height = 0;&lt;BR /&gt;int g_display_width = 0;&lt;BR /&gt;int g_display_height = 0;&lt;BR /&gt;int g_display_top = 0;&lt;BR /&gt;int g_display_left = 0;&lt;BR /&gt;int g_frame_size;&lt;BR /&gt;int g_frame_period = 33333;&lt;BR /&gt;v4l2_std_id g_current_std = V4L2_STD_NTSC;&lt;/P&gt;&lt;P&gt;struct testbuffer&lt;BR /&gt;{&lt;BR /&gt; unsigned char *start;&lt;BR /&gt; size_t offset;&lt;BR /&gt; unsigned int length;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;struct testbuffer output_buffers[4];&lt;BR /&gt;struct testbuffer capture_buffers[3];&lt;/P&gt;&lt;P&gt;int start_capturing(void)&lt;BR /&gt;{&lt;BR /&gt; unsigned int i;&lt;BR /&gt; struct v4l2_buffer buf;&lt;BR /&gt; enum v4l2_buf_type type;&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; g_capture_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; memset(&amp;amp;buf, 0, sizeof (buf));&lt;BR /&gt; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; buf.index = i;&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_QUERYBUF, &amp;amp;buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_QUERYBUF error\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;capture_buffers[i].length = buf.length;&lt;BR /&gt; capture_buffers[i].offset = (size_t) buf.m.offset;&lt;BR /&gt; capture_buffers[i].start = mmap (NULL, capture_buffers[i].length,&lt;BR /&gt; PROT_READ | PROT_WRITE, MAP_SHARED,&lt;BR /&gt; fd_capture_v4l, capture_buffers[i].offset);&lt;BR /&gt; memset(capture_buffers[i].start, 0xFF, capture_buffers[i].length);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; g_capture_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; memset(&amp;amp;buf, 0, sizeof (buf));&lt;BR /&gt; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; buf.index = i;&lt;BR /&gt; buf.m.offset = capture_buffers[i].offset;&lt;BR /&gt; if (ioctl (fd_capture_v4l, VIDIOC_QBUF, &amp;amp;buf) &amp;lt; 0) {&lt;BR /&gt; printf("VIDIOC_QBUF error\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; if (ioctl (fd_capture_v4l, VIDIOC_STREAMON, &amp;amp;type) &amp;lt; 0) {&lt;BR /&gt; printf("VIDIOC_STREAMON error\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int prepare_output(void)&lt;BR /&gt;{&lt;BR /&gt; int i;&lt;BR /&gt; struct v4l2_buffer output_buf;&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; g_output_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; memset(&amp;amp;output_buf, 0, sizeof(output_buf));&lt;BR /&gt; output_buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; output_buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; output_buf.index = i;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_QUERYBUF, &amp;amp;output_buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_QUERYBUF error\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;output_buffers[i].length = output_buf.length;&lt;BR /&gt; output_buffers[i].offset = (size_t) output_buf.m.offset;&lt;BR /&gt; output_buffers[i].start = mmap (NULL, output_buffers[i].length,&lt;BR /&gt; PROT_READ | PROT_WRITE, MAP_SHARED,&lt;BR /&gt; fd_output_v4l, output_buffers[i].offset);&lt;BR /&gt; if (output_buffers[i].start == NULL) {&lt;BR /&gt; printf("v4l2 tvin test: output mmap failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int v4l_capture_setup(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;struct v4l2_capability cap;&lt;BR /&gt; struct v4l2_cropcap cropcap;&lt;BR /&gt; struct v4l2_crop crop;&lt;BR /&gt; struct v4l2_format fmt;&lt;BR /&gt; struct v4l2_requestbuffers req;&lt;BR /&gt; struct v4l2_dbg_chip_ident chip;&lt;BR /&gt; struct v4l2_streamparm parm;&lt;BR /&gt; v4l2_std_id id;&lt;BR /&gt; unsigned int min;&lt;/P&gt;&lt;P&gt;if (ioctl (fd_capture_v4l, VIDIOC_QUERYCAP, &amp;amp;cap) &amp;lt; 0) {&lt;BR /&gt; if (EINVAL == errno) {&lt;BR /&gt; fprintf (stderr, "%s is no V4L2 device\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; } else {&lt;BR /&gt; fprintf (stderr, "%s isn not V4L device,unknow error\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (!(cap.capabilities &amp;amp; V4L2_CAP_VIDEO_CAPTURE)) {&lt;BR /&gt; fprintf (stderr, "%s is no video capture device\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (!(cap.capabilities &amp;amp; V4L2_CAP_STREAMING)) {&lt;BR /&gt; fprintf (stderr, "%s does not support streaming i/o\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_DBG_G_CHIP_IDENT, &amp;amp;chip))&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_DBG_G_CHIP_IDENT failed.\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; printf("TV decoder chip is %s\n", chip.match.name);&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_S_INPUT, &amp;amp;g_input) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_S_INPUT failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_G_STD, &amp;amp;id) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_G_STD failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; g_current_std = id;&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_S_STD, &amp;amp;id) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_S_STD failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Select video input, video standard and tune here. */&lt;/P&gt;&lt;P&gt;memset(&amp;amp;cropcap, 0, sizeof(cropcap));&lt;/P&gt;&lt;P&gt;cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;/P&gt;&lt;P&gt;if (ioctl (fd_capture_v4l, VIDIOC_CROPCAP, &amp;amp;cropcap) &amp;lt; 0) {&lt;BR /&gt; crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; crop.c = cropcap.defrect; /* reset to default */&lt;/P&gt;&lt;P&gt;if (ioctl (fd_capture_v4l, VIDIOC_S_CROP, &amp;amp;crop) &amp;lt; 0) {&lt;BR /&gt; switch (errno) {&lt;BR /&gt; case EINVAL:&lt;BR /&gt; /* Cropping not supported. */&lt;BR /&gt; fprintf (stderr, "%s doesn't support crop\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; break;&lt;BR /&gt; default:&lt;BR /&gt; /* Errors ignored. */&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; } else {&lt;BR /&gt; /* Errors ignored. */&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;parm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; parm.parm.capture.timeperframe.numerator = 1;&lt;BR /&gt; parm.parm.capture.timeperframe.denominator = 0;&lt;BR /&gt; parm.parm.capture.capturemode = 0;&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_S_PARM, &amp;amp;parm) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_S_PARM failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;memset(&amp;amp;fmt, 0, sizeof(fmt));&lt;/P&gt;&lt;P&gt;fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; fmt.fmt.pix.width = 0;&lt;BR /&gt; fmt.fmt.pix.height = 0;&lt;BR /&gt; fmt.fmt.pix.pixelformat = g_fmt;&lt;BR /&gt; fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; if (ioctl (fd_capture_v4l, VIDIOC_S_FMT, &amp;amp;fmt) &amp;lt; 0){&lt;BR /&gt; fprintf (stderr, "%s iformat not supported \n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Note VIDIOC_S_FMT may change width and height. */&lt;/P&gt;&lt;P&gt;/* Buggy driver paranoia. */&lt;BR /&gt; min = fmt.fmt.pix.width * 2;&lt;BR /&gt; if (fmt.fmt.pix.bytesperline &amp;lt; min)&lt;BR /&gt; fmt.fmt.pix.bytesperline = min;&lt;/P&gt;&lt;P&gt;min = fmt.fmt.pix.bytesperline * fmt.fmt.pix.height;&lt;BR /&gt; if (fmt.fmt.pix.sizeimage &amp;lt; min)&lt;BR /&gt; fmt.fmt.pix.sizeimage = min;&lt;/P&gt;&lt;P&gt;if (ioctl(fd_capture_v4l, VIDIOC_G_FMT, &amp;amp;fmt) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_G_FMT failed\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;g_in_width = fmt.fmt.pix.width;&lt;BR /&gt; g_in_height = fmt.fmt.pix.height;&lt;/P&gt;&lt;P&gt;memset(&amp;amp;req, 0, sizeof (req));&lt;/P&gt;&lt;P&gt;req.count = g_capture_num_buffers;&lt;BR /&gt; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; req.memory = V4L2_MEMORY_MMAP;&lt;/P&gt;&lt;P&gt;if (ioctl (fd_capture_v4l, VIDIOC_REQBUFS, &amp;amp;req) &amp;lt; 0) {&lt;BR /&gt; if (EINVAL == errno) {&lt;BR /&gt; fprintf (stderr, "%s does not support "&lt;BR /&gt; "memory mapping\n", v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; } else {&lt;BR /&gt; fprintf (stderr, "%s does not support "&lt;BR /&gt; "memory mapping, unknow error\n", v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (req.count &amp;lt; 2) {&lt;BR /&gt; fprintf (stderr, "Insufficient buffer memory on %s\n",&lt;BR /&gt; v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int v4l_output_setup(void)&lt;BR /&gt;{&lt;BR /&gt; struct v4l2_control ctrl;&lt;BR /&gt; struct v4l2_format fmt;&lt;BR /&gt; struct v4l2_framebuffer fb;&lt;BR /&gt; struct v4l2_cropcap cropcap;&lt;BR /&gt; struct v4l2_crop crop;&lt;BR /&gt; struct v4l2_capability cap;&lt;BR /&gt; struct v4l2_fmtdesc fmtdesc;&lt;BR /&gt; struct v4l2_requestbuffers buf_req;&lt;/P&gt;&lt;P&gt;if (!ioctl(fd_output_v4l, VIDIOC_QUERYCAP, &amp;amp;cap)) {&lt;BR /&gt; printf("driver=%s, card=%s, bus=%s, \r\n"&lt;BR /&gt; "version=0x%08x, "&lt;BR /&gt; "capabilities=0x%08x\n",&lt;BR /&gt; cap.driver, cap.card, cap.bus_info,&lt;BR /&gt; cap.version,&lt;BR /&gt; cap.capabilities);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;fmtdesc.index = 0;&lt;BR /&gt; fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; while (!ioctl(fd_output_v4l, VIDIOC_ENUM_FMT, &amp;amp;fmtdesc)) {&lt;BR /&gt; printf("fmt %s: fourcc = 0x%08x\n",&lt;BR /&gt; fmtdesc.description,&lt;BR /&gt; fmtdesc.pixelformat);&lt;BR /&gt; fmtdesc.index++;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;memset(&amp;amp;cropcap, 0, sizeof(cropcap));&lt;BR /&gt; cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_CROPCAP, &amp;amp;cropcap) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("get crop capability failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; crop.c.top = g_display_top;&lt;BR /&gt; crop.c.left = g_display_left;&lt;BR /&gt; crop.c.width = g_display_width;&lt;BR /&gt; crop.c.height = g_display_height;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CROP, &amp;amp;crop) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set crop failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;// Set rotation&lt;BR /&gt; ctrl.id = V4L2_CID_ROTATE;&lt;BR /&gt; ctrl.value = g_rotate;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CTRL, &amp;amp;ctrl) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set ctrl rotate failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; ctrl.id = V4L2_CID_VFLIP;&lt;BR /&gt; ctrl.value = g_vflip;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CTRL, &amp;amp;ctrl) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set ctrl vflip failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; ctrl.id = V4L2_CID_HFLIP;&lt;BR /&gt; ctrl.value = g_hflip;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CTRL, &amp;amp;ctrl) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set ctrl hflip failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (g_vdi_enable) {&lt;BR /&gt; ctrl.id = V4L2_CID_MXC_MOTION;&lt;BR /&gt; ctrl.value = g_vdi_motion;&lt;BR /&gt; //ctrl.value = 0; &lt;BR /&gt; &lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_CTRL, &amp;amp;ctrl) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set ctrl motion failed\n");&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;fb.flags = V4L2_FBUF_FLAG_OVERLAY;&lt;BR /&gt; ioctl(fd_output_v4l, VIDIOC_S_FBUF, &amp;amp;fb);&lt;/P&gt;&lt;P&gt;memset(&amp;amp;fmt, 0, sizeof(fmt));&lt;BR /&gt; fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; fmt.fmt.pix.width= g_in_width;&lt;BR /&gt; fmt.fmt.pix.height= g_in_height;&lt;BR /&gt; fmt.fmt.pix.pixelformat = g_fmt;&lt;BR /&gt; fmt.fmt.pix.bytesperline = g_in_width;&lt;BR /&gt; fmt.fmt.pix.priv = 0;&lt;BR /&gt; fmt.fmt.pix.sizeimage = 0;&lt;BR /&gt; &lt;BR /&gt; if (g_tb)&lt;BR /&gt; fmt.fmt.pix.field = V4L2_FIELD_INTERLACED_TB;&lt;BR /&gt; else&lt;BR /&gt; fmt.fmt.pix.field = V4L2_FIELD_INTERLACED_BT;&lt;BR /&gt; &lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_S_FMT, &amp;amp;fmt) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("set format failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (ioctl(fd_output_v4l, VIDIOC_G_FMT, &amp;amp;fmt) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("get format failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; g_frame_size = fmt.fmt.pix.sizeimage;&lt;/P&gt;&lt;P&gt;memset(&amp;amp;buf_req, 0, sizeof(buf_req));&lt;BR /&gt; buf_req.count = g_output_num_buffers;&lt;BR /&gt; buf_req.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; buf_req.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_REQBUFS, &amp;amp;buf_req) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("request buffers failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int&lt;BR /&gt;mxc_v4l_tvin_test(void)&lt;BR /&gt;{&lt;BR /&gt; struct v4l2_buffer capture_buf, output_buf;&lt;BR /&gt; v4l2_std_id id;&lt;BR /&gt; int i, j;&lt;BR /&gt; enum v4l2_buf_type type;&lt;BR /&gt; int total_time;&lt;BR /&gt; struct timeval tv_start, tv_current;&lt;BR /&gt; int rtn;&lt;/P&gt;&lt;P&gt;if (prepare_output() &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("prepare_output failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (start_capturing() &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("start_capturing failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;gettimeofday(&amp;amp;tv_start, 0);&lt;BR /&gt; printf("start time = %d s, %d us\n", (unsigned int) tv_start.tv_sec,&lt;BR /&gt; (unsigned int) tv_start.tv_usec);&lt;/P&gt;&lt;P&gt;for (i = 0; ; i++) {&lt;BR /&gt;begin:&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_G_STD, &amp;amp;id)) {&lt;BR /&gt; printf("VIDIOC_G_STD failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (id == g_current_std)&lt;BR /&gt; {&lt;BR /&gt; //printf("goto next\r\n");&lt;BR /&gt; goto next;&lt;BR /&gt; }&lt;BR /&gt; else if (id == V4L2_STD_PAL || id == V4L2_STD_NTSC) {&lt;BR /&gt; type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; ioctl(fd_output_v4l, VIDIOC_STREAMOFF, &amp;amp;type);&lt;/P&gt;&lt;P&gt;type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; ioctl(fd_capture_v4l, VIDIOC_STREAMOFF, &amp;amp;type);&lt;/P&gt;&lt;P&gt;for (j = 0; j &amp;lt; g_output_num_buffers; j++)&lt;BR /&gt; {&lt;BR /&gt; munmap(output_buffers[j].start, output_buffers[j].length);&lt;BR /&gt; }&lt;BR /&gt; for (j = 0; j &amp;lt; g_capture_num_buffers; j++)&lt;BR /&gt; {&lt;BR /&gt; munmap(capture_buffers[j].start, capture_buffers[j].length);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (v4l_capture_setup() &amp;lt; 0) {&lt;BR /&gt; printf("Setup v4l capture failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (v4l_output_setup() &amp;lt; 0) {&lt;BR /&gt; printf("Setup v4l output failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (prepare_output() &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("prepare_output failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (start_capturing() &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("start_capturing failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; i = 0;&lt;BR /&gt; printf("TV standard changed\n");&lt;BR /&gt; } else {&lt;BR /&gt; sleep(1);&lt;BR /&gt; /* Try again */&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_G_STD, &amp;amp;id)) {&lt;BR /&gt; printf("VIDIOC_G_STD failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (id != V4L2_STD_ALL)&lt;BR /&gt; goto begin;&lt;/P&gt;&lt;P&gt;printf("Cannot detect TV standard\n");&lt;BR /&gt; return 0;&lt;BR /&gt; }&lt;BR /&gt;next:&lt;/P&gt;&lt;P&gt;/*rtn = poll( (struct pollfd *)&amp;amp;poll_fds, 1, tmout );&lt;BR /&gt; if ( rtn &amp;lt; 0 ) return -1;*/&lt;/P&gt;&lt;P&gt;memset(&amp;amp;capture_buf, 0, sizeof(capture_buf));&lt;BR /&gt; capture_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; capture_buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_DQBUF, &amp;amp;capture_buf) &amp;lt; 0) {&lt;BR /&gt; printf("VIDIOC_DQBUF failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;memset(&amp;amp;output_buf, 0, sizeof(output_buf));&lt;BR /&gt; output_buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; output_buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; if (i &amp;lt; g_output_num_buffers) {&lt;BR /&gt; output_buf.index = i;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_QUERYBUF, &amp;amp;output_buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_QUERYBUF failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; } else {&lt;BR /&gt; output_buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; output_buf.memory = V4L2_MEMORY_MMAP;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_DQBUF, &amp;amp;output_buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_DQBUF failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;memcpy(output_buffers[output_buf.index].start, capture_buffers[capture_buf.index].start, g_frame_size);&lt;BR /&gt; &lt;BR /&gt; if (ioctl(fd_capture_v4l, VIDIOC_QBUF, &amp;amp;capture_buf) &amp;lt; 0) {&lt;BR /&gt; printf("VIDIOC_QBUF failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;output_buf.timestamp.tv_sec = tv_start.tv_sec;&lt;BR /&gt; output_buf.timestamp.tv_usec = tv_start.tv_usec + (g_frame_period * i);&lt;BR /&gt; if (g_vdi_enable)&lt;BR /&gt; output_buf.field = g_tb ? V4L2_FIELD_INTERLACED_TB :&lt;BR /&gt; V4L2_FIELD_INTERLACED_BT;&lt;BR /&gt; &lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_QBUF, &amp;amp;output_buf) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("VIDIOC_QBUF failed\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; if (i == 1) {&lt;BR /&gt; type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; if (ioctl(fd_output_v4l, VIDIOC_STREAMON, &amp;amp;type) &amp;lt; 0) {&lt;BR /&gt; printf("Could not start stream\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;//if(i==4) break;&lt;BR /&gt; }&lt;BR /&gt; gettimeofday(&amp;amp;tv_current, 0);&lt;BR /&gt; total_time = (tv_current.tv_sec - tv_start.tv_sec) * 1000000L;&lt;BR /&gt; total_time += tv_current.tv_usec - tv_start.tv_usec;&lt;BR /&gt; printf("total time for %u frames = %u us = %lld fps\n", i, total_time, (i * 1000000ULL) / total_time);&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int process_cmdline(int argc, char **argv)&lt;BR /&gt;{&lt;BR /&gt; int i;&lt;/P&gt;&lt;P&gt;for (i = 1; i &amp;lt; argc; i++) {&lt;BR /&gt; if (strcmp(argv[i], "-ow") == 0) {&lt;BR /&gt; g_display_width = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-oh") == 0) {&lt;BR /&gt; g_display_height = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-ot") == 0) {&lt;BR /&gt; g_display_top = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-ol") == 0) {&lt;BR /&gt; g_display_left = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-r") == 0) {&lt;BR /&gt; g_rotate = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-f") == 0) {&lt;BR /&gt; i++;&lt;BR /&gt; g_fmt = v4l2_fourcc(argv[i][0], argv[i][1],argv[i][2],argv[i][3]);&lt;BR /&gt; if ((g_fmt != V4L2_PIX_FMT_NV12) &amp;amp;&amp;amp;&lt;BR /&gt; (g_fmt != V4L2_PIX_FMT_UYVY) &amp;amp;&amp;amp;&lt;BR /&gt; (g_fmt != V4L2_PIX_FMT_YUYV) &amp;amp;&amp;amp;&lt;BR /&gt; (g_fmt != V4L2_PIX_FMT_YUV420)) {&lt;BR /&gt; printf("Default format is used: UYVY\n");&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-m") == 0) {&lt;BR /&gt; g_vdi_enable = 1;&lt;BR /&gt; g_vdi_motion = atoi(argv[++i]);&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-tb") == 0) {&lt;BR /&gt; g_tb = 1;&lt;BR /&gt; }&lt;BR /&gt; else if (strcmp(argv[i], "-help") == 0) {&lt;BR /&gt; printf("MXC Video4Linux TVin Test\n\n" \&lt;BR /&gt; "Syntax: mxc_v4l2_tvin.out\n" \&lt;BR /&gt; " -ow &amp;lt;capture display width&amp;gt;\n" \&lt;BR /&gt; " -oh &amp;lt;capture display height&amp;gt;\n" \&lt;BR /&gt; " -ot &amp;lt;display top&amp;gt;\n" \&lt;BR /&gt; " -ol &amp;lt;display left&amp;gt;\n" \&lt;BR /&gt; " -r &amp;lt;rotation&amp;gt; -c &amp;lt;capture counter&amp;gt; \n"&lt;BR /&gt; " -m &amp;lt;motion&amp;gt; 0:medium 1:low 2:high, 0-default\n"&lt;BR /&gt; " -tb top field first, bottom field first-default\n"&lt;BR /&gt; " -f &amp;lt;format, only YU12, YUYV, UYVY and NV12 are supported&amp;gt; \n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if ((g_display_width == 0) || (g_display_height == 0)) {&lt;BR /&gt; printf("Zero display width or height\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;int main(int argc, char **argv)&lt;BR /&gt;{&lt;BR /&gt;#ifdef BUILD_FOR_ANDROID&lt;BR /&gt; char fb_device[100] = "/dev/graphics/fb0";&lt;BR /&gt;#else&lt;BR /&gt; char fb_device[100] = "/dev/fb0";&lt;BR /&gt;#endif&lt;BR /&gt; int fd_fb = 0, i;&lt;BR /&gt; struct mxcfb_gbl_alpha alpha;&lt;BR /&gt; enum v4l2_buf_type type;&lt;/P&gt;&lt;P&gt;if (process_cmdline(argc, argv) &amp;lt; 0) {&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if ((fd_capture_v4l = open(v4l_capture_dev, O_RDWR, 0)) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("Unable to open %s\n", v4l_capture_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if ((fd_output_v4l = open(v4l_output_dev, O_RDWR, 0)) &amp;lt; 0)&lt;BR /&gt; {&lt;BR /&gt; printf("Unable to open %s\n", v4l_output_dev);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (v4l_capture_setup() &amp;lt; 0) {&lt;BR /&gt; printf("Setup v4l capture failed.\n");&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if (v4l_output_setup() &amp;lt; 0) {&lt;BR /&gt; printf("Setup v4l output failed.\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;if ((fd_fb = open(fb_device, O_RDWR )) &amp;lt; 0) {&lt;BR /&gt; printf("Unable to open frame buffer\n");&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Overlay setting */&lt;BR /&gt; alpha.alpha = 0;&lt;BR /&gt; alpha.enable = 1;&lt;BR /&gt; if (ioctl(fd_fb, MXCFB_SET_GBL_ALPHA, &amp;amp;alpha) &amp;lt; 0) {&lt;BR /&gt; printf("Set global alpha failed\n");&lt;BR /&gt; close(fd_fb);&lt;BR /&gt; close(fd_capture_v4l);&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; return TFAIL;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;mxc_v4l_tvin_test();&lt;/P&gt;&lt;P&gt;type = V4L2_BUF_TYPE_VIDEO_OUTPUT;&lt;BR /&gt; ioctl(fd_output_v4l, VIDIOC_STREAMOFF, &amp;amp;type);&lt;/P&gt;&lt;P&gt;type = V4L2_BUF_TYPE_VIDEO_CAPTURE;&lt;BR /&gt; ioctl(fd_capture_v4l, VIDIOC_STREAMOFF, &amp;amp;type);&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; g_output_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; munmap(output_buffers[i].start, output_buffers[i].length);&lt;BR /&gt; }&lt;BR /&gt; for (i = 0; i &amp;lt; g_capture_num_buffers; i++)&lt;BR /&gt; {&lt;BR /&gt; munmap(capture_buffers[i].start, capture_buffers[i].length);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;close(fd_capture_v4l);&lt;BR /&gt; close(fd_output_v4l);&lt;BR /&gt; close(fd_fb);&lt;BR /&gt; return 0;&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2018 06:18:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-can-I-adjust-the-V4L2-Size-or-Timing/m-p/742309#M115537</guid>
      <dc:creator>호영노</dc:creator>
      <dc:date>2018-01-22T06:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can I adjust the V4L2 Size or Timing?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-can-I-adjust-the-V4L2-Size-or-Timing/m-p/742310#M115538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi 호영 노&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please look at resizing examples on&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-94961"&gt;ipu-examples release notes - v0.1&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2018 08:23:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-can-I-adjust-the-V4L2-Size-or-Timing/m-p/742310#M115538</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2018-01-22T08:23:52Z</dc:date>
    </item>
  </channel>
</rss>

