lists.zerezo.com



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

PATCH: gspca-add-driver-get_buf_size-method.patch saved



Hi All,

This patch adds a get_buff_size op to the driver desc struct, and modifies
gspca_get_buff_size to call this (if defined) instead of calculating the
buff_size itself.

This is needed for the pac207 with decoding removed, as the pac207 does
line by line compression prefixing each line with a header indicating wether
or not it is compressed, and only does compression when needed to meet
bandwidth constraints. In half resolution mode, when there are no
bandwidth constraints, the imagesize is actually larger (due to the line
headers) then the raw bayer, so in this case gspca_get_buff_size does the
wrong thing. The best solution in special cases like this is to allow the
driver to provide its own get_buff_size, overriding gspca_get_buff_size's
normal calculations.

Signed-off-by: Hans de Goede <j.w.r.degoede@xxxxxx>

Regards,

Hans
This patch adds a get_buff_size op to the driver desc struct, and modifies
gspca_get_buff_size to call this (if defined) instead of calculating the
buff_size itself.

This is needed for the pac207 with decoding removed, as the pac207 does
line by line compression prefixing each line with a header indicating wether
or not it is compressed, and only does compression when needed to meet
bandwidth constraints. In half resolution mode, when there are no
bandwidth constraints, the imagesize is actually larger (due to the line
headers) then the raw bayer, so in this case gspca_get_buff_size does the
wrong thing. The best solution in special cases like this is to allow the
driver to provide its own get_buff_size, overriding gspca_get_buff_size's
normal calculations.

Signed-off-by: Hans de Goede <j.w.r.degoede@xxxxxx>

diff -r b8dc1b84f3c5 linux/drivers/media/video/gspca/gspca.c
--- a/linux/drivers/media/video/gspca/gspca.c	Fri Jul 04 09:36:32 2008 +0200
+++ b/linux/drivers/media/video/gspca/gspca.c	Fri Jul 04 09:44:31 2008 +0200
@@ -400,6 +400,9 @@
 static int gspca_get_buff_size(struct gspca_dev *gspca_dev, int mode)
 {
 	unsigned int size;
+
+	if (gspca_dev->sd_desc->get_buff_size)
+		return gspca_dev->sd_desc->get_buff_size(gspca_dev, mode);
 
 	size =  gspca_dev->cam.cam_mode[mode].width *
 		gspca_dev->cam.cam_mode[mode].height *
diff -r b8dc1b84f3c5 linux/drivers/media/video/gspca/gspca.h
--- a/linux/drivers/media/video/gspca/gspca.h	Fri Jul 04 09:36:32 2008 +0200
+++ b/linux/drivers/media/video/gspca/gspca.h	Fri Jul 04 09:44:31 2008 +0200
@@ -100,6 +100,7 @@
 				struct gspca_frame *frame,
 				__u8 *data,
 				int len);
+typedef int (*cam_get_buff_size_op) (struct gspca_dev *gspca_dev, int mode);
 
 struct ctrl {
 	struct v4l2_queryctrl qctrl;
@@ -126,6 +127,7 @@
 	cam_jpg_op get_jcomp;
 	cam_jpg_op set_jcomp;
 	cam_qmnu_op querymenu;
+	cam_get_buff_size_op get_buff_size; /* optional */
 };
 
 /* packet types when moving from iso buf to frame buf */
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list