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/spca500.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/spca500.c')
-rw-r--r-- | drivers/media/video/gspca/spca500.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c index f44613095d2e..2176ac6850e3 100644 --- a/drivers/media/video/gspca/spca500.c +++ b/drivers/media/video/gspca/spca500.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #define MODULE_NAME "spca500" | 22 | #define MODULE_NAME "spca500" |
23 | 23 | ||
24 | #include "gspca.h" | 24 | #include "gspca.h" |
25 | #define QUANT_VAL 5 /* quantization table */ | ||
26 | #include "jpeg.h" | 25 | #include "jpeg.h" |
27 | 26 | ||
28 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); | 27 | MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); |
@@ -39,6 +38,7 @@ struct sd { | |||
39 | unsigned char brightness; | 38 | unsigned char brightness; |
40 | unsigned char contrast; | 39 | unsigned char contrast; |
41 | unsigned char colors; | 40 | unsigned char colors; |
41 | u8 quality; | ||
42 | 42 | ||
43 | char subtype; | 43 | char subtype; |
44 | #define AgfaCl20 0 | 44 | #define AgfaCl20 0 |
@@ -56,6 +56,8 @@ struct sd { | |||
56 | #define Optimedia 12 | 56 | #define Optimedia 12 |
57 | #define PalmPixDC85 13 | 57 | #define PalmPixDC85 13 |
58 | #define ToptroIndus 14 | 58 | #define ToptroIndus 14 |
59 | |||
60 | u8 *jpeg_hdr; | ||
59 | }; | 61 | }; |
60 | 62 | ||
61 | /* V4L2 controls supported by the driver */ | 63 | /* V4L2 controls supported by the driver */ |
@@ -640,6 +642,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
640 | sd->brightness = BRIGHTNESS_DEF; | 642 | sd->brightness = BRIGHTNESS_DEF; |
641 | sd->contrast = CONTRAST_DEF; | 643 | sd->contrast = CONTRAST_DEF; |
642 | sd->colors = COLOR_DEF; | 644 | sd->colors = COLOR_DEF; |
645 | sd->quality = 85; | ||
643 | return 0; | 646 | return 0; |
644 | } | 647 | } |
645 | 648 | ||
@@ -665,6 +668,12 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
665 | __u8 Data; | 668 | __u8 Data; |
666 | __u8 xmult, ymult; | 669 | __u8 xmult, ymult; |
667 | 670 | ||
671 | /* create the JPEG header */ | ||
672 | sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL); | ||
673 | jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, | ||
674 | 0x22); /* JPEG 411 */ | ||
675 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
676 | |||
668 | if (sd->subtype == LogitechClickSmart310) { | 677 | if (sd->subtype == LogitechClickSmart310) { |
669 | xmult = 0x16; | 678 | xmult = 0x16; |
670 | ymult = 0x12; | 679 | ymult = 0x12; |
@@ -880,6 +889,13 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
880 | gspca_dev->usb_buf[0]); | 889 | gspca_dev->usb_buf[0]); |
881 | } | 890 | } |
882 | 891 | ||
892 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
893 | { | ||
894 | struct sd *sd = (struct sd *) gspca_dev; | ||
895 | |||
896 | kfree(sd->jpeg_hdr); | ||
897 | } | ||
898 | |||
883 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 899 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
884 | struct gspca_frame *frame, /* target */ | 900 | struct gspca_frame *frame, /* target */ |
885 | __u8 *data, /* isoc packet */ | 901 | __u8 *data, /* isoc packet */ |
@@ -900,7 +916,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
900 | ffd9, 2); | 916 | ffd9, 2); |
901 | 917 | ||
902 | /* put the JPEG header in the new frame */ | 918 | /* put the JPEG header in the new frame */ |
903 | jpeg_put_header(gspca_dev, frame, 0x22); | 919 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, |
920 | sd->jpeg_hdr, JPEG_HDR_SZ); | ||
904 | 921 | ||
905 | data += SPCA500_OFFSET_DATA; | 922 | data += SPCA500_OFFSET_DATA; |
906 | len -= SPCA500_OFFSET_DATA; | 923 | len -= SPCA500_OFFSET_DATA; |
@@ -1013,6 +1030,7 @@ static struct sd_desc sd_desc = { | |||
1013 | .init = sd_init, | 1030 | .init = sd_init, |
1014 | .start = sd_start, | 1031 | .start = sd_start, |
1015 | .stopN = sd_stopN, | 1032 | .stopN = sd_stopN, |
1033 | .stop0 = sd_stop0, | ||
1016 | .pkt_scan = sd_pkt_scan, | 1034 | .pkt_scan = sd_pkt_scan, |
1017 | }; | 1035 | }; |
1018 | 1036 | ||