" line=%d, field=%d\n",
size, block, line, field);
+ /* Checks if a complete set of frame0 + frame 1 were received */
+ if (dev->isoc_ctl.last_line > line) {
+ if (dev->isoc_ctl.fields == 3) {
+ /* Announces that a new buffer were filled */
+ buffer_filled(dev, dma_q, *buf);
+ dprintk(dev, V4L2_DEBUG_ISOC,
+ "new buffer filled\n");
+ rc = get_next_buf(dma_q, buf);
+
+ dev->isoc_ctl.fields = 0;
+ } else {
+ dev->isoc_ctl.fields |= 1 << field;
+ }
+ }
+ dev->isoc_ctl.last_line = line;
+
if ((last_line!=line)&&(last_line+1!=line) &&
(cmd != TM6000_URB_MSG_ERR) ) {
if (cmd != TM6000_URB_MSG_VIDEO) {
dev->isoc_ctl.nfields++;
if (dev->isoc_ctl.nfields>=2) {
dev->isoc_ctl.nfields=0;
-
- /* Announces that a new buffer were filled */
- buffer_filled (dev, dma_q, *buf);
- dprintk(dev, V4L2_DEBUG_ISOC,
- "new buffer filled\n");
- rc=get_next_buf (dma_q, buf);
}
}
int max_packets, int num_bufs)
{
struct tm6000_dmaqueue *dma_q = &dev->vidq;
- int i;
+ int i, rc;
int sb_size, pipe;
struct urb *urb;
int j, k;
+ dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %dx%d packets"
+ " of %d bytes each to handle %u size\n",
+ max_packets, num_bufs,
+ dev->max_isoc_in, dev->isoc_ctl.max_pkt_size);
+
+
/* De-allocates all pending stuff */
tm6000_uninit_isoc(dev);
}
memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size);
+
pipe=usb_rcvisocpipe(dev->udev,
dev->isoc_in->desc.bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK);
struct tm6000_fh *fh = vq->priv_data;
struct tm6000_buffer *buf = container_of(vb,struct tm6000_buffer,vb);
struct tm6000_core *dev = fh->dev;
- int rc=0, urbsize, urb_init=0, npackets=1;
+ int rc = 0, urb_init = 0;
BUG_ON(NULL == fh->fmt);
urb_init=1;
}
-
if (!dev->isoc_ctl.num_bufs)
urb_init=1;
if (urb_init) {
- /* memory for video
- Should be at least
- Vres x Vres x 2 bytes/pixel by frame */
- urbsize=buf->vb.size;
-
- /* Need also one PTS */
- urbsize+=180;
-
- /* memory for audio
- Should be at least
- bitrate * 2 channels * 2 bytes / frame rate */
- if (dev->norm & V4L2_STD_525_60) {
- urbsize+=(dev->audio_bitrate*4+29)/30;
- } else {
- urbsize+=(dev->audio_bitrate*4+24)/25;
- }
-
- /* each audio frame seeems to have a frame number
- with 2 bytes */
- urbsize+=2;
-
- /* Add 4 bytes by each 180 bytes frame */
- urbsize+=((urbsize+179)/180)*4;
-
- /* Round to an enough number of URBs */
- urbsize=(urbsize+dev->max_isoc_in-1)/dev->max_isoc_in;
-
- /* Avoids allocating big memory areas for URB */
- while ((urbsize*dev->max_isoc_in)/npackets>65535) {
- npackets++;
- }
- urbsize/=(urbsize+npackets-1)/npackets;
-
- dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %dx%d packets"
- " of %d bytes each to handle %lu size\n",
- npackets,urbsize,dev->max_isoc_in,buf->vb.size);
-
- rc = tm6000_prepare_isoc(dev, urbsize, npackets);
-
+ rc = tm6000_prepare_isoc(dev, 128, 1);
if (rc<0)
goto fail;
}