aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/mars.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2009-03-02 04:40:52 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:22 -0400
commit77ac0baf24d1a43498f7bdf6efa2ee6c4ed0ebaa (patch)
treed5a6108117df3bbf9f93ce5e69bd29ee386c9945 /drivers/media/video/gspca/mars.c
parent71cb2764fcc51bd9e1b95be5b0f2da6f026634c7 (diff)
V4L/DVB (11040): gspca - most jpeg subdrivers: Have the JPEG quality settable.
The JPEG quality of the images (quantization tables) is now settable by the VIDIOC_S_JPEGCOMP ioctl. Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/mars.c')
-rw-r--r--drivers/media/video/gspca/mars.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index 6eb813e7b714..75e8d14e4ac7 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -37,6 +37,9 @@ struct sd {
37 u8 gamma; 37 u8 gamma;
38 u8 sharpness; 38 u8 sharpness;
39 u8 quality; 39 u8 quality;
40#define QUALITY_MIN 40
41#define QUALITY_MAX 70
42#define QUALITY_DEF 50
40 43
41 u8 *jpeg_hdr; 44 u8 *jpeg_hdr;
42}; 45};
@@ -178,7 +181,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
178 sd->colors = COLOR_DEF; 181 sd->colors = COLOR_DEF;
179 sd->gamma = GAMMA_DEF; 182 sd->gamma = GAMMA_DEF;
180 sd->sharpness = SHARPNESS_DEF; 183 sd->sharpness = SHARPNESS_DEF;
181 sd->quality = 50; 184 sd->quality = QUALITY_DEF;
182 gspca_dev->nbalt = 9; /* use the altsetting 08 */ 185 gspca_dev->nbalt = 9; /* use the altsetting 08 */
183 return 0; 186 return 0;
184} 187}
@@ -445,6 +448,34 @@ static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
445 return 0; 448 return 0;
446} 449}
447 450
451static int sd_set_jcomp(struct gspca_dev *gspca_dev,
452 struct v4l2_jpegcompression *jcomp)
453{
454 struct sd *sd = (struct sd *) gspca_dev;
455
456 if (jcomp->quality < QUALITY_MIN)
457 sd->quality = QUALITY_MIN;
458 else if (jcomp->quality > QUALITY_MAX)
459 sd->quality = QUALITY_MAX;
460 else
461 sd->quality = jcomp->quality;
462 if (gspca_dev->streaming)
463 jpeg_set_qual(sd->jpeg_hdr, sd->quality);
464 return 0;
465}
466
467static int sd_get_jcomp(struct gspca_dev *gspca_dev,
468 struct v4l2_jpegcompression *jcomp)
469{
470 struct sd *sd = (struct sd *) gspca_dev;
471
472 memset(jcomp, 0, sizeof *jcomp);
473 jcomp->quality = sd->quality;
474 jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT
475 | V4L2_JPEG_MARKER_DQT;
476 return 0;
477}
478
448/* sub-driver description */ 479/* sub-driver description */
449static const struct sd_desc sd_desc = { 480static const struct sd_desc sd_desc = {
450 .name = MODULE_NAME, 481 .name = MODULE_NAME,
@@ -456,6 +487,8 @@ static const struct sd_desc sd_desc = {
456 .stopN = sd_stopN, 487 .stopN = sd_stopN,
457 .stop0 = sd_stop0, 488 .stop0 = sd_stop0,
458 .pkt_scan = sd_pkt_scan, 489 .pkt_scan = sd_pkt_scan,
490 .get_jcomp = sd_get_jcomp,
491 .set_jcomp = sd_set_jcomp,
459}; 492};
460 493
461/* -- module initialisation -- */ 494/* -- module initialisation -- */