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/conex.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/conex.c')
-rw-r--r-- | drivers/media/video/gspca/conex.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c index de2e608bf5ba..fd4df402bc2f 100644 --- a/drivers/media/video/gspca/conex.c +++ b/drivers/media/video/gspca/conex.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include "gspca.h" | 24 | #include "gspca.h" |
25 | #define CONEX_CAM 1 /* special JPEG header */ | 25 | #define CONEX_CAM 1 /* special JPEG header */ |
26 | #define QUANT_VAL 0 /* quantization table */ | ||
27 | #include "jpeg.h" | 26 | #include "jpeg.h" |
28 | 27 | ||
29 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); | 28 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); |
@@ -37,6 +36,9 @@ struct sd { | |||
37 | unsigned char brightness; | 36 | unsigned char brightness; |
38 | unsigned char contrast; | 37 | unsigned char contrast; |
39 | unsigned char colors; | 38 | unsigned char colors; |
39 | u8 quality; | ||
40 | |||
41 | u8 *jpeg_hdr; | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | /* V4L2 controls supported by the driver */ | 44 | /* V4L2 controls supported by the driver */ |
@@ -820,6 +822,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
820 | sd->brightness = BRIGHTNESS_DEF; | 822 | sd->brightness = BRIGHTNESS_DEF; |
821 | sd->contrast = CONTRAST_DEF; | 823 | sd->contrast = CONTRAST_DEF; |
822 | sd->colors = COLOR_DEF; | 824 | sd->colors = COLOR_DEF; |
825 | sd->quality = 40; | ||
823 | return 0; | 826 | return 0; |
824 | } | 827 | } |
825 | 828 | ||
@@ -836,6 +839,14 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
836 | 839 | ||
837 | static int sd_start(struct gspca_dev *gspca_dev) | 840 | static int sd_start(struct gspca_dev *gspca_dev) |
838 | { | 841 | { |
842 | struct sd *sd = (struct sd *) gspca_dev; | ||
843 | |||
844 | /* create the JPEG header */ | ||
845 | sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL); | ||
846 | jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, | ||
847 | 0x22); /* JPEG 411 */ | ||
848 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
849 | |||
839 | cx11646_initsize(gspca_dev); | 850 | cx11646_initsize(gspca_dev); |
840 | cx11646_fw(gspca_dev); | 851 | cx11646_fw(gspca_dev); |
841 | cx_sensor(gspca_dev); | 852 | cx_sensor(gspca_dev); |
@@ -846,8 +857,11 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
846 | /* called on streamoff with alt 0 and on disconnect */ | 857 | /* called on streamoff with alt 0 and on disconnect */ |
847 | static void sd_stop0(struct gspca_dev *gspca_dev) | 858 | static void sd_stop0(struct gspca_dev *gspca_dev) |
848 | { | 859 | { |
860 | struct sd *sd = (struct sd *) gspca_dev; | ||
849 | int retry = 50; | 861 | int retry = 50; |
850 | 862 | ||
863 | kfree(sd->jpeg_hdr); | ||
864 | |||
851 | if (!gspca_dev->present) | 865 | if (!gspca_dev->present) |
852 | return; | 866 | return; |
853 | reg_w_val(gspca_dev, 0x0000, 0x00); | 867 | reg_w_val(gspca_dev, 0x0000, 0x00); |
@@ -873,6 +887,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
873 | __u8 *data, /* isoc packet */ | 887 | __u8 *data, /* isoc packet */ |
874 | int len) /* iso packet length */ | 888 | int len) /* iso packet length */ |
875 | { | 889 | { |
890 | struct sd *sd = (struct sd *) gspca_dev; | ||
891 | |||
876 | if (data[0] == 0xff && data[1] == 0xd8) { | 892 | if (data[0] == 0xff && data[1] == 0xd8) { |
877 | 893 | ||
878 | /* start of frame */ | 894 | /* start of frame */ |
@@ -880,7 +896,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
880 | data, 0); | 896 | data, 0); |
881 | 897 | ||
882 | /* put the JPEG header in the new frame */ | 898 | /* put the JPEG header in the new frame */ |
883 | jpeg_put_header(gspca_dev, frame, 0x22); | 899 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, |
900 | sd->jpeg_hdr, JPEG_HDR_SZ); | ||
884 | data += 2; | 901 | data += 2; |
885 | len -= 2; | 902 | len -= 2; |
886 | } | 903 | } |