diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-03-02 04:40:52 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:22 -0400 |
commit | 77ac0baf24d1a43498f7bdf6efa2ee6c4ed0ebaa (patch) | |
tree | d5a6108117df3bbf9f93ce5e69bd29ee386c9945 /drivers/media/video/gspca/zc3xx.c | |
parent | 71cb2764fcc51bd9e1b95be5b0f2da6f026634c7 (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/zc3xx.c')
-rw-r--r-- | drivers/media/video/gspca/zc3xx.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index a4c673ff8f02..e4c27a1e1e29 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c | |||
@@ -46,6 +46,9 @@ struct sd { | |||
46 | __u8 lightfreq; | 46 | __u8 lightfreq; |
47 | __u8 sharpness; | 47 | __u8 sharpness; |
48 | u8 quality; /* image quality */ | 48 | u8 quality; /* image quality */ |
49 | #define QUALITY_MIN 40 | ||
50 | #define QUALITY_MAX 60 | ||
51 | #define QUALITY_DEF 50 | ||
49 | 52 | ||
50 | signed char sensor; /* Type of image sensor chip */ | 53 | signed char sensor; /* Type of image sensor chip */ |
51 | /* !! values used in different tables */ | 54 | /* !! values used in different tables */ |
@@ -7180,7 +7183,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
7180 | sd->gamma = gamma[(int) sd->sensor]; | 7183 | sd->gamma = gamma[(int) sd->sensor]; |
7181 | sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; | 7184 | sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; |
7182 | sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; | 7185 | sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; |
7183 | sd->quality = 50; | 7186 | sd->quality = QUALITY_DEF; |
7184 | 7187 | ||
7185 | switch (sd->sensor) { | 7188 | switch (sd->sensor) { |
7186 | case SENSOR_GC0305: | 7189 | case SENSOR_GC0305: |
@@ -7536,6 +7539,34 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, | |||
7536 | return -EINVAL; | 7539 | return -EINVAL; |
7537 | } | 7540 | } |
7538 | 7541 | ||
7542 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
7543 | struct v4l2_jpegcompression *jcomp) | ||
7544 | { | ||
7545 | struct sd *sd = (struct sd *) gspca_dev; | ||
7546 | |||
7547 | if (jcomp->quality < QUALITY_MIN) | ||
7548 | sd->quality = QUALITY_MIN; | ||
7549 | else if (jcomp->quality > QUALITY_MAX) | ||
7550 | sd->quality = QUALITY_MAX; | ||
7551 | else | ||
7552 | sd->quality = jcomp->quality; | ||
7553 | if (gspca_dev->streaming) | ||
7554 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
7555 | return 0; | ||
7556 | } | ||
7557 | |||
7558 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
7559 | struct v4l2_jpegcompression *jcomp) | ||
7560 | { | ||
7561 | struct sd *sd = (struct sd *) gspca_dev; | ||
7562 | |||
7563 | memset(jcomp, 0, sizeof *jcomp); | ||
7564 | jcomp->quality = sd->quality; | ||
7565 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
7566 | | V4L2_JPEG_MARKER_DQT; | ||
7567 | return 0; | ||
7568 | } | ||
7569 | |||
7539 | static const struct sd_desc sd_desc = { | 7570 | static const struct sd_desc sd_desc = { |
7540 | .name = MODULE_NAME, | 7571 | .name = MODULE_NAME, |
7541 | .ctrls = sd_ctrls, | 7572 | .ctrls = sd_ctrls, |
@@ -7546,6 +7577,8 @@ static const struct sd_desc sd_desc = { | |||
7546 | .stop0 = sd_stop0, | 7577 | .stop0 = sd_stop0, |
7547 | .pkt_scan = sd_pkt_scan, | 7578 | .pkt_scan = sd_pkt_scan, |
7548 | .querymenu = sd_querymenu, | 7579 | .querymenu = sd_querymenu, |
7580 | .get_jcomp = sd_get_jcomp, | ||
7581 | .set_jcomp = sd_set_jcomp, | ||
7549 | }; | 7582 | }; |
7550 | 7583 | ||
7551 | static const __devinitdata struct usb_device_id device_table[] = { | 7584 | static const __devinitdata struct usb_device_id device_table[] = { |