summaryrefslogtreecommitdiff
path: root/drivers/media/video/gspca/mars.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2009-03-03 05:33:41 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 12:43:22 -0300
commit71cb2764fcc51bd9e1b95be5b0f2da6f026634c7 (patch)
treecad0450231d5b4e7db071396ea5a33dabd3e314e /drivers/media/video/gspca/mars.c
parentc98afbfc20355dd04a7b817b232e06a4c3e73bac (diff)
V4L/DVB (11039): gspca - most jpeg subdrivers: Change the JPEG header creation.
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/mars.c')
-rw-r--r--drivers/media/video/gspca/mars.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index ce065d363e8a..6eb813e7b714 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -22,7 +22,6 @@
#define MODULE_NAME "mars"
#include "gspca.h"
-#define QUANT_VAL 1 /* quantization table */
#include "jpeg.h"
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
@@ -37,6 +36,9 @@ struct sd {
u8 colors;
u8 gamma;
u8 sharpness;
+ u8 quality;
+
+ u8 *jpeg_hdr;
};
/* V4L2 controls supported by the driver */
@@ -176,6 +178,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->colors = COLOR_DEF;
sd->gamma = GAMMA_DEF;
sd->sharpness = SHARPNESS_DEF;
+ sd->quality = 50;
gspca_dev->nbalt = 9; /* use the altsetting 08 */
return 0;
}
@@ -193,6 +196,12 @@ static int sd_start(struct gspca_dev *gspca_dev)
u8 *data;
int i;
+ /* create the JPEG header */
+ sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL);
+ jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width,
+ 0x21); /* JPEG 422 */
+ jpeg_set_qual(sd->jpeg_hdr, sd->quality);
+
data = gspca_dev->usb_buf;
data[0] = 0x01; /* address */
@@ -303,11 +312,19 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
PDEBUG(D_ERR, "Camera Stop failed");
}
+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;
int p;
if (len < 6) {
@@ -330,7 +347,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
frame, data, p);
/* put the JPEG header */
- jpeg_put_header(gspca_dev, frame, 0x21);
+ gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
+ sd->jpeg_hdr, JPEG_HDR_SZ);
data += p + 16;
len -= p + 16;
break;
@@ -436,6 +454,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,
};