diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-11-13 05:38:16 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:59 -0500 |
commit | 3ec342f25004c87c0d94de1bc1b5399685d58ad8 (patch) | |
tree | 9a6074b40aad08dd16f12186599a85be7b44b8c6 /drivers/media/video/gspca | |
parent | 8157852f73f961b28d495bfa8374263d293b106d (diff) |
V4L/DVB (13451): gspca - main: Memorize the current frame buffer.
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')
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 21 | ||||
-rw-r--r-- | drivers/media/video/gspca/gspca.h | 1 |
2 files changed, 12 insertions, 10 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 08433f77245a..31ec5aa44910 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -126,7 +126,6 @@ EXPORT_SYMBOL(gspca_get_i_frame); | |||
126 | static void fill_frame(struct gspca_dev *gspca_dev, | 126 | static void fill_frame(struct gspca_dev *gspca_dev, |
127 | struct urb *urb) | 127 | struct urb *urb) |
128 | { | 128 | { |
129 | struct gspca_frame *frame; | ||
130 | u8 *data; /* address of data in the iso message */ | 129 | u8 *data; /* address of data in the iso message */ |
131 | int i, len, st; | 130 | int i, len, st; |
132 | cam_pkt_op pkt_scan; | 131 | cam_pkt_op pkt_scan; |
@@ -146,8 +145,8 @@ static void fill_frame(struct gspca_dev *gspca_dev, | |||
146 | for (i = 0; i < urb->number_of_packets; i++) { | 145 | for (i = 0; i < urb->number_of_packets; i++) { |
147 | 146 | ||
148 | /* check the availability of the frame buffer */ | 147 | /* check the availability of the frame buffer */ |
149 | frame = gspca_get_i_frame(gspca_dev); | 148 | if ((gspca_dev->cur_frame->v4l2_buf.flags & BUF_ALL_FLAGS) |
150 | if (!frame) { | 149 | != V4L2_BUF_FLAG_QUEUED) { |
151 | gspca_dev->last_packet_type = DISCARD_PACKET; | 150 | gspca_dev->last_packet_type = DISCARD_PACKET; |
152 | break; | 151 | break; |
153 | } | 152 | } |
@@ -173,7 +172,7 @@ static void fill_frame(struct gspca_dev *gspca_dev, | |||
173 | i, urb->iso_frame_desc[i].offset, len); | 172 | i, urb->iso_frame_desc[i].offset, len); |
174 | data = (u8 *) urb->transfer_buffer | 173 | data = (u8 *) urb->transfer_buffer |
175 | + urb->iso_frame_desc[i].offset; | 174 | + urb->iso_frame_desc[i].offset; |
176 | pkt_scan(gspca_dev, frame, data, len); | 175 | pkt_scan(gspca_dev, gspca_dev->cur_frame, data, len); |
177 | } | 176 | } |
178 | 177 | ||
179 | resubmit: | 178 | resubmit: |
@@ -204,7 +203,6 @@ static void isoc_irq(struct urb *urb) | |||
204 | static void bulk_irq(struct urb *urb) | 203 | static void bulk_irq(struct urb *urb) |
205 | { | 204 | { |
206 | struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; | 205 | struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; |
207 | struct gspca_frame *frame; | ||
208 | int st; | 206 | int st; |
209 | 207 | ||
210 | PDEBUG(D_PACK, "bulk irq"); | 208 | PDEBUG(D_PACK, "bulk irq"); |
@@ -226,13 +224,13 @@ static void bulk_irq(struct urb *urb) | |||
226 | } | 224 | } |
227 | 225 | ||
228 | /* check the availability of the frame buffer */ | 226 | /* check the availability of the frame buffer */ |
229 | frame = gspca_get_i_frame(gspca_dev); | 227 | if ((gspca_dev->cur_frame->v4l2_buf.flags & BUF_ALL_FLAGS) |
230 | if (!frame) { | 228 | != V4L2_BUF_FLAG_QUEUED) { |
231 | gspca_dev->last_packet_type = DISCARD_PACKET; | 229 | gspca_dev->last_packet_type = DISCARD_PACKET; |
232 | } else { | 230 | } else { |
233 | PDEBUG(D_PACK, "packet l:%d", urb->actual_length); | 231 | PDEBUG(D_PACK, "packet l:%d", urb->actual_length); |
234 | gspca_dev->sd_desc->pkt_scan(gspca_dev, | 232 | gspca_dev->sd_desc->pkt_scan(gspca_dev, |
235 | frame, | 233 | gspca_dev->frame, |
236 | urb->transfer_buffer, | 234 | urb->transfer_buffer, |
237 | urb->actual_length); | 235 | urb->actual_length); |
238 | } | 236 | } |
@@ -260,13 +258,15 @@ resubmit: | |||
260 | */ | 258 | */ |
261 | struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, | 259 | struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, |
262 | enum gspca_packet_type packet_type, | 260 | enum gspca_packet_type packet_type, |
263 | struct gspca_frame *frame, | 261 | struct gspca_frame *dummy, |
264 | const __u8 *data, | 262 | const __u8 *data, |
265 | int len) | 263 | int len) |
266 | { | 264 | { |
265 | struct gspca_frame *frame; | ||
267 | int i, j; | 266 | int i, j; |
268 | 267 | ||
269 | PDEBUG(D_PACK, "add t:%d l:%d", packet_type, len); | 268 | PDEBUG(D_PACK, "add t:%d l:%d", packet_type, len); |
269 | frame = gspca_dev->cur_frame; | ||
270 | 270 | ||
271 | /* when start of a new frame, if the current frame buffer | 271 | /* when start of a new frame, if the current frame buffer |
272 | * is not queued, discard the whole frame */ | 272 | * is not queued, discard the whole frame */ |
@@ -315,7 +315,7 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, | |||
315 | i, | 315 | i, |
316 | gspca_dev->fr_o); | 316 | gspca_dev->fr_o); |
317 | j = gspca_dev->fr_queue[i]; | 317 | j = gspca_dev->fr_queue[i]; |
318 | frame = &gspca_dev->frame[j]; | 318 | gspca_dev->cur_frame = frame = &gspca_dev->frame[j]; |
319 | } | 319 | } |
320 | return frame; | 320 | return frame; |
321 | } | 321 | } |
@@ -398,6 +398,7 @@ static int frame_alloc(struct gspca_dev *gspca_dev, | |||
398 | frame->v4l2_buf.m.offset = i * frsz; | 398 | frame->v4l2_buf.m.offset = i * frsz; |
399 | } | 399 | } |
400 | gspca_dev->fr_i = gspca_dev->fr_o = gspca_dev->fr_q = 0; | 400 | gspca_dev->fr_i = gspca_dev->fr_o = gspca_dev->fr_q = 0; |
401 | gspca_dev->cur_frame = &gspca_dev->frame[0]; | ||
401 | gspca_dev->last_packet_type = DISCARD_PACKET; | 402 | gspca_dev->last_packet_type = DISCARD_PACKET; |
402 | gspca_dev->sequence = 0; | 403 | gspca_dev->sequence = 0; |
403 | return 0; | 404 | return 0; |
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h index d59a684056ca..59078bbf472c 100644 --- a/drivers/media/video/gspca/gspca.h +++ b/drivers/media/video/gspca/gspca.h | |||
@@ -151,6 +151,7 @@ struct gspca_dev { | |||
151 | 151 | ||
152 | __u8 *frbuf; /* buffer for nframes */ | 152 | __u8 *frbuf; /* buffer for nframes */ |
153 | struct gspca_frame frame[GSPCA_MAX_FRAMES]; | 153 | struct gspca_frame frame[GSPCA_MAX_FRAMES]; |
154 | struct gspca_frame *cur_frame; /* frame beeing filled */ | ||
154 | __u32 frsz; /* frame size */ | 155 | __u32 frsz; /* frame size */ |
155 | char nframes; /* number of frames */ | 156 | char nframes; /* number of frames */ |
156 | char fr_i; /* frame being filled */ | 157 | char fr_i; /* frame being filled */ |