aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/pac7302.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/pac7302.c')
-rw-r--r--drivers/media/video/gspca/pac7302.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c
index bf47180a4e2f..88cc03bb3f94 100644
--- a/drivers/media/video/gspca/pac7302.c
+++ b/drivers/media/video/gspca/pac7302.c
@@ -804,7 +804,6 @@ static const unsigned char pac_jpeg_header2[] = {
804}; 804};
805 805
806static void pac_start_frame(struct gspca_dev *gspca_dev, 806static void pac_start_frame(struct gspca_dev *gspca_dev,
807 struct gspca_frame *frame,
808 __u16 lines, __u16 samples_per_line) 807 __u16 lines, __u16 samples_per_line)
809{ 808{
810 unsigned char tmpbuf[4]; 809 unsigned char tmpbuf[4];
@@ -829,15 +828,15 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
829 int len) /* iso packet length */ 828 int len) /* iso packet length */
830{ 829{
831 struct sd *sd = (struct sd *) gspca_dev; 830 struct sd *sd = (struct sd *) gspca_dev;
832 struct gspca_frame *frame; 831 u8 *image;
833 unsigned char *sof; 832 unsigned char *sof;
834 833
835 sof = pac_find_sof(&sd->sof_read, data, len); 834 sof = pac_find_sof(&sd->sof_read, data, len);
836 if (sof) { 835 if (sof) {
837 int n, lum_offset, footer_length; 836 int n, lum_offset, footer_length;
838 837
839 frame = gspca_get_i_frame(gspca_dev); 838 image = gspca_dev->image;
840 if (frame == NULL) { 839 if (image == NULL) {
841 gspca_dev->last_packet_type = DISCARD_PACKET; 840 gspca_dev->last_packet_type = DISCARD_PACKET;
842 return; 841 return;
843 } 842 }
@@ -852,16 +851,15 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
852 /* Finish decoding current frame */ 851 /* Finish decoding current frame */
853 n = (sof - data) - (footer_length + sizeof pac_sof_marker); 852 n = (sof - data) - (footer_length + sizeof pac_sof_marker);
854 if (n < 0) { 853 if (n < 0) {
855 frame->data_end += n; 854 gspca_dev->image_len += n;
856 n = 0; 855 n = 0;
856 } else {
857 gspca_frame_add(gspca_dev, INTER_PACKET, data, n);
857 } 858 }
858 gspca_frame_add(gspca_dev, INTER_PACKET, 859 if (gspca_dev->last_packet_type != DISCARD_PACKET
859 data, n); 860 && image[gspca_dev->image_len - 2] == 0xff
860 if (gspca_dev->last_packet_type != DISCARD_PACKET && 861 && image[gspca_dev->image_len - 1] == 0xd9)
861 frame->data_end[-2] == 0xff && 862 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
862 frame->data_end[-1] == 0xd9)
863 gspca_frame_add(gspca_dev, LAST_PACKET,
864 NULL, 0);
865 863
866 n = sof - data; 864 n = sof - data;
867 len -= n; 865 len -= n;
@@ -877,7 +875,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
877 875
878 /* Start the new frame with the jpeg header */ 876 /* Start the new frame with the jpeg header */
879 /* The PAC7302 has the image rotated 90 degrees */ 877 /* The PAC7302 has the image rotated 90 degrees */
880 pac_start_frame(gspca_dev, frame, 878 pac_start_frame(gspca_dev,
881 gspca_dev->width, gspca_dev->height); 879 gspca_dev->width, gspca_dev->height);
882 } 880 }
883 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); 881 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);