aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/conex.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/conex.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/conex.c')
-rw-r--r--drivers/media/video/gspca/conex.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index fd4df402bc2f..219cfa6fb877 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -37,6 +37,9 @@ struct sd {
37 unsigned char contrast; 37 unsigned char contrast;
38 unsigned char colors; 38 unsigned char colors;
39 u8 quality; 39 u8 quality;
40#define QUALITY_MIN 30
41#define QUALITY_MAX 60
42#define QUALITY_DEF 40
40 43
41 u8 *jpeg_hdr; 44 u8 *jpeg_hdr;
42}; 45};
@@ -822,7 +825,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
822 sd->brightness = BRIGHTNESS_DEF; 825 sd->brightness = BRIGHTNESS_DEF;
823 sd->contrast = CONTRAST_DEF; 826 sd->contrast = CONTRAST_DEF;
824 sd->colors = COLOR_DEF; 827 sd->colors = COLOR_DEF;
825 sd->quality = 40; 828 sd->quality = QUALITY_DEF;
826 return 0; 829 return 0;
827} 830}
828 831
@@ -1000,6 +1003,34 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
1000 return 0; 1003 return 0;
1001} 1004}
1002 1005
1006static int sd_set_jcomp(struct gspca_dev *gspca_dev,
1007 struct v4l2_jpegcompression *jcomp)
1008{
1009 struct sd *sd = (struct sd *) gspca_dev;
1010
1011 if (jcomp->quality < QUALITY_MIN)
1012 sd->quality = QUALITY_MIN;
1013 else if (jcomp->quality > QUALITY_MAX)
1014 sd->quality = QUALITY_MAX;
1015 else
1016 sd->quality = jcomp->quality;
1017 if (gspca_dev->streaming)
1018 jpeg_set_qual(sd->jpeg_hdr, sd->quality);
1019 return 0;
1020}
1021
1022static int sd_get_jcomp(struct gspca_dev *gspca_dev,
1023 struct v4l2_jpegcompression *jcomp)
1024{
1025 struct sd *sd = (struct sd *) gspca_dev;
1026
1027 memset(jcomp, 0, sizeof *jcomp);
1028 jcomp->quality = sd->quality;
1029 jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT
1030 | V4L2_JPEG_MARKER_DQT;
1031 return 0;
1032}
1033
1003/* sub-driver description */ 1034/* sub-driver description */
1004static struct sd_desc sd_desc = { 1035static struct sd_desc sd_desc = {
1005 .name = MODULE_NAME, 1036 .name = MODULE_NAME,
@@ -1010,6 +1041,8 @@ static struct sd_desc sd_desc = {
1010 .start = sd_start, 1041 .start = sd_start,
1011 .stop0 = sd_stop0, 1042 .stop0 = sd_stop0,
1012 .pkt_scan = sd_pkt_scan, 1043 .pkt_scan = sd_pkt_scan,
1044 .get_jcomp = sd_get_jcomp,
1045 .set_jcomp = sd_set_jcomp,
1013}; 1046};
1014 1047
1015/* -- module initialisation -- */ 1048/* -- module initialisation -- */