diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-03-03 03:33:41 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:22 -0400 |
commit | 71cb2764fcc51bd9e1b95be5b0f2da6f026634c7 (patch) | |
tree | cad0450231d5b4e7db071396ea5a33dabd3e314e /drivers/media/video/gspca/zc3xx.c | |
parent | c98afbfc20355dd04a7b817b232e06a4c3e73bac (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/zc3xx.c')
-rw-r--r-- | drivers/media/video/gspca/zc3xx.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index 4f459a746037..a4c673ff8f02 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #define MODULE_NAME "zc3xx" | 23 | #define MODULE_NAME "zc3xx" |
24 | 24 | ||
25 | #include "gspca.h" | 25 | #include "gspca.h" |
26 | #include "jpeg.h" | ||
26 | 27 | ||
27 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " | 28 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " |
28 | "Serge A. Suchkov <Serge.A.S@tochka.ru>"); | 29 | "Serge A. Suchkov <Serge.A.S@tochka.ru>"); |
@@ -32,7 +33,6 @@ MODULE_LICENSE("GPL"); | |||
32 | static int force_sensor = -1; | 33 | static int force_sensor = -1; |
33 | 34 | ||
34 | #define QUANT_VAL 1 /* quantization table */ | 35 | #define QUANT_VAL 1 /* quantization table */ |
35 | #include "jpeg.h" | ||
36 | #include "zc3xx-reg.h" | 36 | #include "zc3xx-reg.h" |
37 | 37 | ||
38 | /* specific webcam descriptor */ | 38 | /* specific webcam descriptor */ |
@@ -45,6 +45,7 @@ struct sd { | |||
45 | __u8 autogain; | 45 | __u8 autogain; |
46 | __u8 lightfreq; | 46 | __u8 lightfreq; |
47 | __u8 sharpness; | 47 | __u8 sharpness; |
48 | u8 quality; /* image quality */ | ||
48 | 49 | ||
49 | signed char sensor; /* Type of image sensor chip */ | 50 | signed char sensor; /* Type of image sensor chip */ |
50 | /* !! values used in different tables */ | 51 | /* !! values used in different tables */ |
@@ -69,6 +70,8 @@ struct sd { | |||
69 | #define SENSOR_TAS5130C_VF0250 17 | 70 | #define SENSOR_TAS5130C_VF0250 17 |
70 | #define SENSOR_MAX 18 | 71 | #define SENSOR_MAX 18 |
71 | unsigned short chip_revision; | 72 | unsigned short chip_revision; |
73 | |||
74 | u8 *jpeg_hdr; | ||
72 | }; | 75 | }; |
73 | 76 | ||
74 | /* V4L2 controls supported by the driver */ | 77 | /* V4L2 controls supported by the driver */ |
@@ -7177,6 +7180,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
7177 | sd->gamma = gamma[(int) sd->sensor]; | 7180 | sd->gamma = gamma[(int) sd->sensor]; |
7178 | sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; | 7181 | sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; |
7179 | sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; | 7182 | sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; |
7183 | sd->quality = 50; | ||
7180 | 7184 | ||
7181 | switch (sd->sensor) { | 7185 | switch (sd->sensor) { |
7182 | case SENSOR_GC0305: | 7186 | case SENSOR_GC0305: |
@@ -7232,6 +7236,12 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
7232 | /* 17 */ | 7236 | /* 17 */ |
7233 | }; | 7237 | }; |
7234 | 7238 | ||
7239 | /* create the JPEG header */ | ||
7240 | sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL); | ||
7241 | jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, | ||
7242 | 0x21); /* JPEG 422 */ | ||
7243 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
7244 | |||
7235 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; | 7245 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; |
7236 | zc3_init = init_tb[(int) sd->sensor][mode]; | 7246 | zc3_init = init_tb[(int) sd->sensor][mode]; |
7237 | switch (sd->sensor) { | 7247 | switch (sd->sensor) { |
@@ -7365,6 +7375,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev) | |||
7365 | { | 7375 | { |
7366 | struct sd *sd = (struct sd *) gspca_dev; | 7376 | struct sd *sd = (struct sd *) gspca_dev; |
7367 | 7377 | ||
7378 | kfree(sd->jpeg_hdr); | ||
7368 | if (!gspca_dev->present) | 7379 | if (!gspca_dev->present) |
7369 | return; | 7380 | return; |
7370 | send_unknown(gspca_dev->dev, sd->sensor); | 7381 | send_unknown(gspca_dev->dev, sd->sensor); |
@@ -7375,12 +7386,15 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
7375 | __u8 *data, | 7386 | __u8 *data, |
7376 | int len) | 7387 | int len) |
7377 | { | 7388 | { |
7389 | struct sd *sd = (struct sd *) gspca_dev; | ||
7378 | 7390 | ||
7379 | if (data[0] == 0xff && data[1] == 0xd8) { /* start of frame */ | 7391 | if (data[0] == 0xff && data[1] == 0xd8) { /* start of frame */ |
7380 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, | 7392 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, |
7381 | data, 0); | 7393 | data, 0); |
7382 | /* put the JPEG header in the new frame */ | 7394 | /* put the JPEG header in the new frame */ |
7383 | jpeg_put_header(gspca_dev, frame, 0x21); | 7395 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, |
7396 | sd->jpeg_hdr, JPEG_HDR_SZ); | ||
7397 | |||
7384 | /* remove the webcam's header: | 7398 | /* remove the webcam's header: |
7385 | * ff d8 ff fe 00 0e 00 00 ss ss 00 01 ww ww hh hh pp pp | 7399 | * ff d8 ff fe 00 0e 00 00 ss ss 00 01 ww ww hh hh pp pp |
7386 | * - 'ss ss' is the frame sequence number (BE) | 7400 | * - 'ss ss' is the frame sequence number (BE) |