From 174aaea2e81e8b5daa447081ee3f8f3d02d121d2 Mon Sep 17 00:00:00 2001 From: nicklas79 Date: Fri, 12 Jun 2009 07:38:53 +0000 Subject: [PATCH] End of 0x408 device integration git-svn-id: https://syntekdriver.svn.sourceforge.net/svnroot/syntekdriver/trunk@90 7ebf7acc-fb20-0410-9ab9-f560f4c3b721 --- driver/stk11xx-dev-0408.c | 74 ----------------------------------------------- driver/stk11xx-dev.h | 1 - driver/stk11xx-v4l.c | 61 ++++++++++++++++++++++++++------------ 3 files changed, 42 insertions(+), 94 deletions(-) diff --git a/driver/stk11xx-dev-0408.c b/driver/stk11xx-dev-0408.c index d079432..a759586 100644 --- a/driver/stk11xx-dev-0408.c +++ b/driver/stk11xx-dev-0408.c @@ -1151,77 +1151,3 @@ int dev_stk0408_decode(struct usb_stk11xx *dev) } -/* - * Want to restrict number of available modes for 0408 based card for - * now. - */ -int dev_stk0408_select_video_mode(struct usb_stk11xx *dev, int width, int height) -{ - int i; - int find; - - if (! (((width == 720) && (height==576))|| - ((width == 720) && (height==480))|| - ((width == 640) && (height==480)))) - { - width = 640; - height = 480; - } - - for (i=0, find=0; i<=STK11XX_720x576; i++) { - if (stk11xx_image_sizes[i].x == width && stk11xx_image_sizes[i].y == height) - find = i; - } - // Save the new resolution - dev->resolution = find; - - STK_INFO("Set mode %d [%dx%d]\n", dev->resolution, - stk11xx_image_sizes[dev->resolution].x, stk11xx_image_sizes[dev->resolution].y); - - // Save the new size - dev->view.x = width; - dev->view.y = height; - - // Calculate the frame size - switch (dev->resolution) { - case STK11XX_640x480: - dev->image.x = stk11xx_image_sizes[dev->resolution].x; - dev->image.y = stk11xx_image_sizes[dev->resolution].y; - dev->frame_size = 640*480; //dev->image.x * dev->image.y; - break; -/* case STK11XX_720x480: - dev->image.x = stk11xx_image_sizes[STK11XX_720x480].x; - dev->image.y = stk11xx_image_sizes[STK11XX_720x480].y; - dev->frame_size = dev->image.x * dev->image.y; - break;*/ - case STK11XX_720x576: - dev->image.x = stk11xx_image_sizes[STK11XX_720x576].x; - dev->image.y = stk11xx_image_sizes[STK11XX_720x576].y; - dev->frame_size = dev->image.x * dev->image.y; - break; - } - // Calculate the image size - switch (dev->vsettings.palette) { - case STK11XX_PALETTE_RGB24: - case STK11XX_PALETTE_BGR24: - dev->view_size = 3 * dev->view.x * dev->view.y; - dev->image_size = 3 * dev->frame_size; - break; - - case STK11XX_PALETTE_RGB32: - case STK11XX_PALETTE_BGR32: - dev->view_size = 3 * dev->view.x * dev->view.y; - dev->image_size = 4 * dev->frame_size; - break; - - case STK11XX_PALETTE_UYVY: - case STK11XX_PALETTE_YUYV: - dev->view_size = 2 * dev->view.x * dev->view.y; - dev->image_size = 2 * dev->frame_size; - break; - } - - return 0; - -} - diff --git a/driver/stk11xx-dev.h b/driver/stk11xx-dev.h index 1ad6bfe..1b6e66b 100644 --- a/driver/stk11xx-dev.h +++ b/driver/stk11xx-dev.h @@ -34,7 +34,6 @@ #ifndef STK11XX_DEV_H #define STK11XX_DEV_H -int dev_stk0408_select_video_mode(struct usb_stk11xx *, int, int); int dev_stk0408_initialize_device(struct usb_stk11xx *); int dev_stk0408_configure_device(struct usb_stk11xx *, int); int dev_stk0408_start_stream(struct usb_stk11xx *); diff --git a/driver/stk11xx-v4l.c b/driver/stk11xx-v4l.c index 5299b76..5ffebdf 100644 --- a/driver/stk11xx-v4l.c +++ b/driver/stk11xx-v4l.c @@ -169,6 +169,15 @@ int v4l_stk11xx_select_video_mode(struct usb_stk11xx *dev, int width, int height } break; + case STK11XX_PAL: + if (! (((width == 720) && (height==576)) + || ((width == 720) && (height==480)) + || ((width == 640) && (height==480)))) { + width = 640; + height = 480; + } + break; + default: return -1; } @@ -190,6 +199,12 @@ int v4l_stk11xx_select_video_mode(struct usb_stk11xx *dev, int width, int height } break; + case STK11XX_PAL: + for (i=0, find=0; i<=STK11XX_720x576; i++) { + if (stk11xx_image_sizes[i].x <= width && stk11xx_image_sizes[i].y <= height) + find = i; + } + default: return -1; } @@ -206,26 +221,34 @@ int v4l_stk11xx_select_video_mode(struct usb_stk11xx *dev, int width, int height // Calculate the frame size - switch (dev->resolution) { - case STK11XX_80x60: - case STK11XX_128x96: - case STK11XX_160x120: - case STK11XX_213x160: - case STK11XX_320x240: - case STK11XX_640x480: - dev->image.x = stk11xx_image_sizes[STK11XX_640x480].x; - dev->image.y = stk11xx_image_sizes[STK11XX_640x480].y; - dev->frame_size = dev->image.x * dev->image.y; - break; + if (dev->webcam_type == STK11XX_PAL) { + // Here, dev->resolution equals : 640x480 || 720x576 + dev->image.x = stk11xx_image_sizes[dev->resolution].x; + dev->image.y = stk11xx_image_sizes[dev->resolution].y; + dev->frame_size = dev->image.x * dev->image.y; + } + else { + switch (dev->resolution) { + case STK11XX_80x60: + case STK11XX_128x96: + case STK11XX_160x120: + case STK11XX_213x160: + case STK11XX_320x240: + case STK11XX_640x480: + dev->image.x = stk11xx_image_sizes[STK11XX_640x480].x; + dev->image.y = stk11xx_image_sizes[STK11XX_640x480].y; + dev->frame_size = dev->image.x * dev->image.y; + break; - case STK11XX_720x576: - case STK11XX_800x600: - case STK11XX_1024x768: - case STK11XX_1280x1024: - dev->image.x = stk11xx_image_sizes[STK11XX_1280x1024].x; - dev->image.y = stk11xx_image_sizes[STK11XX_1280x1024].y; - dev->frame_size = dev->image.x * dev->image.y; - break; + case STK11XX_720x576: + case STK11XX_800x600: + case STK11XX_1024x768: + case STK11XX_1280x1024: + dev->image.x = stk11xx_image_sizes[STK11XX_1280x1024].x; + dev->image.y = stk11xx_image_sizes[STK11XX_1280x1024].y; + dev->frame_size = dev->image.x * dev->image.y; + break; + } } -- 2.11.4.GIT