diff options
Diffstat (limited to 'drivers/media/video/gspca/sunplus.c')
-rw-r--r-- | drivers/media/video/gspca/sunplus.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index 9d08a66fe23d..eadfaa9f97d2 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #define MODULE_NAME "sunplus" | 22 | #define MODULE_NAME "sunplus" |
23 | 23 | ||
24 | #include "gspca.h" | 24 | #include "gspca.h" |
25 | #define QUANT_VAL 5 /* quantization table */ | ||
26 | #include "jpeg.h" | 25 | #include "jpeg.h" |
27 | 26 | ||
28 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); | 27 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); |
@@ -40,6 +39,7 @@ struct sd { | |||
40 | unsigned char contrast; | 39 | unsigned char contrast; |
41 | unsigned char colors; | 40 | unsigned char colors; |
42 | unsigned char autogain; | 41 | unsigned char autogain; |
42 | u8 quality; | ||
43 | 43 | ||
44 | char bridge; | 44 | char bridge; |
45 | #define BRIDGE_SPCA504 0 | 45 | #define BRIDGE_SPCA504 0 |
@@ -52,6 +52,8 @@ struct sd { | |||
52 | #define LogitechClickSmart420 2 | 52 | #define LogitechClickSmart420 2 |
53 | #define LogitechClickSmart820 3 | 53 | #define LogitechClickSmart820 3 |
54 | #define MegapixV4 4 | 54 | #define MegapixV4 4 |
55 | |||
56 | u8 *jpeg_hdr; | ||
55 | }; | 57 | }; |
56 | 58 | ||
57 | /* V4L2 controls supported by the driver */ | 59 | /* V4L2 controls supported by the driver */ |
@@ -852,6 +854,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
852 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; | 854 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; |
853 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; | 855 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; |
854 | sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; | 856 | sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; |
857 | sd->quality = 85; | ||
855 | return 0; | 858 | return 0; |
856 | } | 859 | } |
857 | 860 | ||
@@ -968,6 +971,12 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
968 | __u8 i; | 971 | __u8 i; |
969 | __u8 info[6]; | 972 | __u8 info[6]; |
970 | 973 | ||
974 | /* create the JPEG header */ | ||
975 | sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL); | ||
976 | jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, | ||
977 | 0x22); /* JPEG 411 */ | ||
978 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
979 | |||
971 | if (sd->bridge == BRIDGE_SPCA504B) | 980 | if (sd->bridge == BRIDGE_SPCA504B) |
972 | spca504B_setQtable(gspca_dev); | 981 | spca504B_setQtable(gspca_dev); |
973 | spca504B_SetSizeType(gspca_dev); | 982 | spca504B_SetSizeType(gspca_dev); |
@@ -1077,6 +1086,13 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
1077 | } | 1086 | } |
1078 | } | 1087 | } |
1079 | 1088 | ||
1089 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
1090 | { | ||
1091 | struct sd *sd = (struct sd *) gspca_dev; | ||
1092 | |||
1093 | kfree(sd->jpeg_hdr); | ||
1094 | } | ||
1095 | |||
1080 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 1096 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
1081 | struct gspca_frame *frame, /* target */ | 1097 | struct gspca_frame *frame, /* target */ |
1082 | __u8 *data, /* isoc packet */ | 1098 | __u8 *data, /* isoc packet */ |
@@ -1153,7 +1169,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
1153 | ffd9, 2); | 1169 | ffd9, 2); |
1154 | 1170 | ||
1155 | /* put the JPEG header in the new frame */ | 1171 | /* put the JPEG header in the new frame */ |
1156 | jpeg_put_header(gspca_dev, frame, 0x22); | 1172 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, |
1173 | sd->jpeg_hdr, JPEG_HDR_SZ); | ||
1157 | } | 1174 | } |
1158 | 1175 | ||
1159 | /* add 0x00 after 0xff */ | 1176 | /* add 0x00 after 0xff */ |
@@ -1311,6 +1328,7 @@ static const struct sd_desc sd_desc = { | |||
1311 | .init = sd_init, | 1328 | .init = sd_init, |
1312 | .start = sd_start, | 1329 | .start = sd_start, |
1313 | .stopN = sd_stopN, | 1330 | .stopN = sd_stopN, |
1331 | .stop0 = sd_stop0, | ||
1314 | .pkt_scan = sd_pkt_scan, | 1332 | .pkt_scan = sd_pkt_scan, |
1315 | }; | 1333 | }; |
1316 | 1334 | ||