[PATCH] cx18: Fix VIDIOC_TRY_FMT to fill in sizeimage and bytesperline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was having trouble capturing raw video from GStreamer; turns out that I
now need VIDIOC_TRY_FMT to fill in sizeimage and bytesperline to make it work.

Signed-off-by: Simon Farnsworth <simon.farnsworth@xxxxxxxxxxxx>
---

I'm leaving ONELAN on Friday, so this is a drive-by patch being sent for the
benefit of anyone else trying to use raw capture from a cx18 card. If it's
not suitable for applying as-is, please feel free to just leave it in the
archives so that someone else hitting the same problem can find my fix.

 drivers/media/pci/cx18/cx18-ioctl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c
index 55525af..1c9924a 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -234,6 +234,13 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh,
 
 	fmt->fmt.pix.width = w;
 	fmt->fmt.pix.height = h;
+	if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_HM12) {
+		fmt->fmt.pix.sizeimage = h * 720 * 3 / 2;
+		fmt->fmt.pix.bytesperline = 720; /* First plane */
+	} else {
+		fmt->fmt.pix.sizeimage = h * 720 * 2;
+		fmt->fmt.pix.bytesperline = 1440; /* Packed */
+	}
 	return 0;
 }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux