aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/stk014.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/stk014.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/stk014.c')
-rw-r--r--drivers/media/video/gspca/stk014.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index dd007cb5200..f25be20cf1a 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
541static 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
557static 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 */
539static const struct sd_desc sd_desc = { 570static 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 -- */