Skip to contentSkip to conversation

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

PATCH Hans de Goede 1 participant 1 message Jul 4, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

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.

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.

linux/drivers/media/video/gspca/gspca.c +3 -0
diff -r b8dc1b84f3c5 linux/drivers/media/video/gspca/gspca.c
@@ -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 *
linux/drivers/media/video/gspca/gspca.h +2 -0
diff -r b8dc1b84f3c5 linux/drivers/media/video/gspca/gspca.h
@@ -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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list