diff options
Diffstat (limited to 'drivers/media/video/gspca/stk014.c')
-rw-r--r-- | drivers/media/video/gspca/stk014.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index dd007cb52006..f25be20cf1a6 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c | |||
@@ -36,6 +36,9 @@ struct sd { | |||
36 | unsigned char colors; | 36 | unsigned char colors; |
37 | unsigned char lightfreq; | 37 | unsigned char lightfreq; |
38 | u8 quality; | 38 | u8 quality; |
39 | #define QUALITY_MIN 60 | ||
40 | #define QUALITY_MAX 95 | ||
41 | #define QUALITY_DEF 80 | ||
39 | 42 | ||
40 | u8 *jpeg_hdr; | 43 | u8 *jpeg_hdr; |
41 | }; | 44 | }; |
@@ -301,7 +304,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
301 | sd->contrast = CONTRAST_DEF; | 304 | sd->contrast = CONTRAST_DEF; |
302 | sd->colors = COLOR_DEF; | 305 | sd->colors = COLOR_DEF; |
303 | sd->lightfreq = FREQ_DEF; | 306 | sd->lightfreq = FREQ_DEF; |
304 | sd->quality = 80; | 307 | sd->quality = QUALITY_DEF; |
305 | return 0; | 308 | return 0; |
306 | } | 309 | } |
307 | 310 | ||
@@ -535,6 +538,34 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, | |||
535 | return -EINVAL; | 538 | return -EINVAL; |
536 | } | 539 | } |
537 | 540 | ||
541 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
542 | struct v4l2_jpegcompression *jcomp) | ||
543 | { | ||
544 | struct sd *sd = (struct sd *) gspca_dev; | ||
545 | |||
546 | if (jcomp->quality < QUALITY_MIN) | ||
547 | sd->quality = QUALITY_MIN; | ||
548 | else if (jcomp->quality > QUALITY_MAX) | ||
549 | sd->quality = QUALITY_MAX; | ||
550 | else | ||
551 | sd->quality = jcomp->quality; | ||
552 | if (gspca_dev->streaming) | ||
553 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
554 | return 0; | ||
555 | } | ||
556 | |||
557 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
558 | struct v4l2_jpegcompression *jcomp) | ||
559 | { | ||
560 | struct sd *sd = (struct sd *) gspca_dev; | ||
561 | |||
562 | memset(jcomp, 0, sizeof *jcomp); | ||
563 | jcomp->quality = sd->quality; | ||
564 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
565 | | V4L2_JPEG_MARKER_DQT; | ||
566 | return 0; | ||
567 | } | ||
568 | |||
538 | /* sub-driver description */ | 569 | /* sub-driver description */ |
539 | static const struct sd_desc sd_desc = { | 570 | static const struct sd_desc sd_desc = { |
540 | .name = MODULE_NAME, | 571 | .name = MODULE_NAME, |
@@ -547,6 +578,8 @@ static const struct sd_desc sd_desc = { | |||
547 | .stop0 = sd_stop0, | 578 | .stop0 = sd_stop0, |
548 | .pkt_scan = sd_pkt_scan, | 579 | .pkt_scan = sd_pkt_scan, |
549 | .querymenu = sd_querymenu, | 580 | .querymenu = sd_querymenu, |
581 | .get_jcomp = sd_get_jcomp, | ||
582 | .set_jcomp = sd_set_jcomp, | ||
550 | }; | 583 | }; |
551 | 584 | ||
552 | /* -- module initialisation -- */ | 585 | /* -- module initialisation -- */ |