diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-02 10:40:52 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-02 10:40:52 +0100 |
commit | 001bc08cc9ccdaf3efc87846858fb8d555e7f9cf (patch) | |
tree | 39a0d3e5c5e4a01ecb92ab2e9ceb86ec098580ff /linux/drivers/media/video/gspca/zc3xx.c | |
parent | de8c0bf3ec12371150c93adbcd7216b97003305b (diff) | |
download | mediapointer-dvb-s2-001bc08cc9ccdaf3efc87846858fb8d555e7f9cf.tar.gz mediapointer-dvb-s2-001bc08cc9ccdaf3efc87846858fb8d555e7f9cf.tar.bz2 |
gspca - most jpeg subdrivers: Have the JPEG quality settable.
From: Jean-Francois Moine <moinejf@free.fr>
The JPEG quality of the images (quantization tables) is now settable by the
VIDIOC_S_JPEGCOMP ioctl.
Priority: normal
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/video/gspca/zc3xx.c')
-rw-r--r-- | linux/drivers/media/video/gspca/zc3xx.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/linux/drivers/media/video/gspca/zc3xx.c b/linux/drivers/media/video/gspca/zc3xx.c index ffd53830e..e2ab9c2eb 100644 --- a/linux/drivers/media/video/gspca/zc3xx.c +++ b/linux/drivers/media/video/gspca/zc3xx.c @@ -46,6 +46,9 @@ struct sd { __u8 lightfreq; __u8 sharpness; u8 quality; /* image quality */ +#define QUALITY_MIN 40 +#define QUALITY_MAX 60 +#define QUALITY_DEF 50 signed char sensor; /* Type of image sensor chip */ /* !! values used in different tables */ @@ -7209,7 +7212,7 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->gamma = gamma[(int) sd->sensor]; sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; - sd->quality = 50; + sd->quality = QUALITY_DEF; switch (sd->sensor) { case SENSOR_GC0305: @@ -7569,6 +7572,34 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, return -EINVAL; } +static int sd_set_jcomp(struct gspca_dev *gspca_dev, + struct v4l2_jpegcompression *jcomp) +{ + struct sd *sd = (struct sd *) gspca_dev; + + if (jcomp->quality < QUALITY_MIN) + sd->quality = QUALITY_MIN; + else if (jcomp->quality > QUALITY_MAX) + sd->quality = QUALITY_MAX; + else + sd->quality = jcomp->quality; + if (gspca_dev->streaming) + jpeg_set_qual(sd->jpeg_hdr, sd->quality); + return 0; +} + +static int sd_get_jcomp(struct gspca_dev *gspca_dev, + struct v4l2_jpegcompression *jcomp) +{ + struct sd *sd = (struct sd *) gspca_dev; + + memset(jcomp, 0, sizeof *jcomp); + jcomp->quality = sd->quality; + jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT + | V4L2_JPEG_MARKER_DQT; + return 0; +} + static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, @@ -7579,6 +7610,8 @@ static const struct sd_desc sd_desc = { .stop0 = sd_stop0, .pkt_scan = sd_pkt_scan, .querymenu = sd_querymenu, + .get_jcomp = sd_get_jcomp, + .set_jcomp = sd_set_jcomp, }; static const __devinitdata struct usb_device_id device_table[] = { |