Commit 3ec342f2 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (13451): gspca - main: Memorize the current frame buffer.

Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 8157852f
...@@ -126,7 +126,6 @@ EXPORT_SYMBOL(gspca_get_i_frame); ...@@ -126,7 +126,6 @@ EXPORT_SYMBOL(gspca_get_i_frame);
static void fill_frame(struct gspca_dev *gspca_dev, static void fill_frame(struct gspca_dev *gspca_dev,
struct urb *urb) struct urb *urb)
{ {
struct gspca_frame *frame;
u8 *data; /* address of data in the iso message */ u8 *data; /* address of data in the iso message */
int i, len, st; int i, len, st;
cam_pkt_op pkt_scan; cam_pkt_op pkt_scan;
...@@ -146,8 +145,8 @@ static void fill_frame(struct gspca_dev *gspca_dev, ...@@ -146,8 +145,8 @@ static void fill_frame(struct gspca_dev *gspca_dev,
for (i = 0; i < urb->number_of_packets; i++) { for (i = 0; i < urb->number_of_packets; i++) {
/* check the availability of the frame buffer */ /* check the availability of the frame buffer */
frame = gspca_get_i_frame(gspca_dev); if ((gspca_dev->cur_frame->v4l2_buf.flags & BUF_ALL_FLAGS)
if (!frame) { != V4L2_BUF_FLAG_QUEUED) {
gspca_dev->last_packet_type = DISCARD_PACKET; gspca_dev->last_packet_type = DISCARD_PACKET;
break; break;
} }
...@@ -173,7 +172,7 @@ static void fill_frame(struct gspca_dev *gspca_dev, ...@@ -173,7 +172,7 @@ static void fill_frame(struct gspca_dev *gspca_dev,
i, urb->iso_frame_desc[i].offset, len); i, urb->iso_frame_desc[i].offset, len);
data = (u8 *) urb->transfer_buffer data = (u8 *) urb->transfer_buffer
+ urb->iso_frame_desc[i].offset; + urb->iso_frame_desc[i].offset;
pkt_scan(gspca_dev, frame, data, len); pkt_scan(gspca_dev, gspca_dev->cur_frame, data, len);
} }
resubmit: resubmit:
...@@ -204,7 +203,6 @@ static void isoc_irq(struct urb *urb) ...@@ -204,7 +203,6 @@ static void isoc_irq(struct urb *urb)
static void bulk_irq(struct urb *urb) static void bulk_irq(struct urb *urb)
{ {
struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;
struct gspca_frame *frame;
int st; int st;
PDEBUG(D_PACK, "bulk irq"); PDEBUG(D_PACK, "bulk irq");
...@@ -226,13 +224,13 @@ static void bulk_irq(struct urb *urb) ...@@ -226,13 +224,13 @@ static void bulk_irq(struct urb *urb)
} }
/* check the availability of the frame buffer */ /* check the availability of the frame buffer */
frame = gspca_get_i_frame(gspca_dev); if ((gspca_dev->cur_frame->v4l2_buf.flags & BUF_ALL_FLAGS)
if (!frame) { != V4L2_BUF_FLAG_QUEUED) {
gspca_dev->last_packet_type = DISCARD_PACKET; gspca_dev->last_packet_type = DISCARD_PACKET;
} else { } else {
PDEBUG(D_PACK, "packet l:%d", urb->actual_length); PDEBUG(D_PACK, "packet l:%d", urb->actual_length);
gspca_dev->sd_desc->pkt_scan(gspca_dev, gspca_dev->sd_desc->pkt_scan(gspca_dev,
frame, gspca_dev->frame,
urb->transfer_buffer, urb->transfer_buffer,
urb->actual_length); urb->actual_length);
} }
...@@ -260,13 +258,15 @@ static void bulk_irq(struct urb *urb) ...@@ -260,13 +258,15 @@ static void bulk_irq(struct urb *urb)
*/ */
struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
enum gspca_packet_type packet_type, enum gspca_packet_type packet_type,
struct gspca_frame *frame, struct gspca_frame *dummy,
const __u8 *data, const __u8 *data,
int len) int len)
{ {
struct gspca_frame *frame;
int i, j; int i, j;
PDEBUG(D_PACK, "add t:%d l:%d", packet_type, len); PDEBUG(D_PACK, "add t:%d l:%d", packet_type, len);
frame = gspca_dev->cur_frame;
/* when start of a new frame, if the current frame buffer /* when start of a new frame, if the current frame buffer
* is not queued, discard the whole frame */ * is not queued, discard the whole frame */
...@@ -315,7 +315,7 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, ...@@ -315,7 +315,7 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
i, i,
gspca_dev->fr_o); gspca_dev->fr_o);
j = gspca_dev->fr_queue[i]; j = gspca_dev->fr_queue[i];
frame = &gspca_dev->frame[j]; gspca_dev->cur_frame = frame = &gspca_dev->frame[j];
} }
return frame; return frame;
} }
...@@ -398,6 +398,7 @@ static int frame_alloc(struct gspca_dev *gspca_dev, ...@@ -398,6 +398,7 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
frame->v4l2_buf.m.offset = i * frsz; frame->v4l2_buf.m.offset = i * frsz;
} }
gspca_dev->fr_i = gspca_dev->fr_o = gspca_dev->fr_q = 0; gspca_dev->fr_i = gspca_dev->fr_o = gspca_dev->fr_q = 0;
gspca_dev->cur_frame = &gspca_dev->frame[0];
gspca_dev->last_packet_type = DISCARD_PACKET; gspca_dev->last_packet_type = DISCARD_PACKET;
gspca_dev->sequence = 0; gspca_dev->sequence = 0;
return 0; return 0;
......
...@@ -151,6 +151,7 @@ struct gspca_dev { ...@@ -151,6 +151,7 @@ struct gspca_dev {
__u8 *frbuf; /* buffer for nframes */ __u8 *frbuf; /* buffer for nframes */
struct gspca_frame frame[GSPCA_MAX_FRAMES]; struct gspca_frame frame[GSPCA_MAX_FRAMES];
struct gspca_frame *cur_frame; /* frame beeing filled */
__u32 frsz; /* frame size */ __u32 frsz; /* frame size */
char nframes; /* number of frames */ char nframes; /* number of frames */
char fr_i; /* frame being filled */ char fr_i; /* frame being filled */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment