summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/gspca/stk014.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-03-03 09:33:41 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-03 09:33:41 +0100
commitde8c0bf3ec12371150c93adbcd7216b97003305b (patch)
tree920a1c382903d7a47254e531c2d9cc9f751b69de /linux/drivers/media/video/gspca/stk014.c
parent823c2d8d6994da5af8399edffb4472992c90b62e (diff)
downloadmediapointer-dvb-s2-de8c0bf3ec12371150c93adbcd7216b97003305b.tar.gz
mediapointer-dvb-s2-de8c0bf3ec12371150c93adbcd7216b97003305b.tar.bz2
gspca - most jpeg subdrivers: Change the JPEG header creation.
From: Jean-Francois Moine <moinejf@free.fr> 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/stk014.c')
-rw-r--r--linux/drivers/media/video/gspca/stk014.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/linux/drivers/media/video/gspca/stk014.c b/linux/drivers/media/video/gspca/stk014.c
index d1d54edd8..dd007cb52 100644
--- a/linux/drivers/media/video/gspca/stk014.c
+++ b/linux/drivers/media/video/gspca/stk014.c
@@ -21,8 +21,6 @@
#define MODULE_NAME "stk014"
#include "gspca.h"
-#define QUANT_VAL 7 /* quantization table */
- /* <= 4 KO - 7: good (enough!) */
#include "jpeg.h"
MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
@@ -37,6 +35,9 @@ struct sd {
unsigned char contrast;
unsigned char colors;
unsigned char lightfreq;
+ u8 quality;
+
+ u8 *jpeg_hdr;
};
/* V4L2 controls supported by the driver */
@@ -300,6 +301,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF;
sd->lightfreq = FREQ_DEF;
+ sd->quality = 80;
return 0;
}
@@ -323,8 +325,15 @@ static int sd_init(struct gspca_dev *gspca_dev)
/* -- start the camera -- */
static int sd_start(struct gspca_dev *gspca_dev)
{
+ struct sd *sd = (struct sd *) gspca_dev;
int ret, value;
+ /* create the JPEG header */
+ sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL);
+ jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width,
+ 0x22); /* JPEG 411 */
+ jpeg_set_qual(sd->jpeg_hdr, sd->quality);
+
/* work on alternate 1 */
usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1);
@@ -396,11 +405,19 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
PDEBUG(D_STREAM, "camera stopped");
}
+static void sd_stop0(struct gspca_dev *gspca_dev)
+{
+ struct sd *sd = (struct sd *) gspca_dev;
+
+ kfree(sd->jpeg_hdr);
+}
+
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
+ struct sd *sd = (struct sd *) gspca_dev;
static unsigned char ffd9[] = {0xff, 0xd9};
/* a frame starts with:
@@ -417,7 +434,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
ffd9, 2);
/* put the JPEG 411 header */
- jpeg_put_header(gspca_dev, frame, 0x22);
+ gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
+ sd->jpeg_hdr, JPEG_HDR_SZ);
/* beginning of the frame */
#define STKHDRSZ 12
@@ -526,6 +544,7 @@ static const struct sd_desc sd_desc = {
.init = sd_init,
.start = sd_start,
.stopN = sd_stopN,
+ .stop0 = sd_stop0,
.pkt_scan = sd_pkt_scan,
.querymenu = sd_querymenu,
};