77,6 → 77,7 |
static unsigned int sloppy = 0; |
static unsigned int v4l2 = 1; |
|
static volatile unsigned int grab_complete = 0; |
|
/* insmod args */ |
MODULE_PARM(radio,"1-" __stringify(BTTV_MAX) "i"); |
2371,34 → 2372,15 |
} |
case VIDIOCSYNC: |
{ |
int *frame = arg; |
struct bttv_buffer *buf; |
|
if (*frame >= VIDEO_MAX_FRAME) |
return -EINVAL; |
/* S.Ha.R.K. Version: Active wait until complete */ |
|
//down(&fh->cap.lock); |
retval = -EINVAL; |
buf = (struct bttv_buffer *)fh->cap.bufs[*frame]; |
if (NULL == buf) |
goto fh_unlock_and_return; |
retval = videobuf_waiton(&buf->vb,0,1); |
if (0 != retval) |
goto fh_unlock_and_return; |
switch (buf->vb.state) { |
case STATE_ERROR: |
retval = -EIO; |
/* fall through */ |
case STATE_DONE: |
//videobuf_dma_pci_sync(btv->dev,&buf->vb.dma); |
bttv_dma_free(btv,buf); |
break; |
default: |
retval = -EINVAL; |
break; |
} |
//up(&fh->cap.lock); |
return retval; |
grab_complete = 0; |
|
while(grab_complete == 0); |
|
return grab_complete; |
|
} |
|
case VIDIOCGVBIFMT: |
3215,6 → 3197,7 |
wakeup->vbi->vb.ts = ts; |
wakeup->vbi->vb.field_count = btv->field_count; |
wakeup->vbi->vb.state = state; |
grab_complete = 1; |
//wake_up(&wakeup->vbi->vb.done); |
} |
if (wakeup->top == wakeup->bottom) { |
3224,6 → 3207,7 |
wakeup->top->vb.ts = ts; |
wakeup->top->vb.field_count = btv->field_count; |
wakeup->top->vb.state = state; |
grab_complete = 1; |
//wake_up(&wakeup->top->vb.done); |
} |
} else { |
3233,6 → 3217,7 |
wakeup->top->vb.ts = ts; |
wakeup->top->vb.field_count = btv->field_count; |
wakeup->top->vb.state = state; |
grab_complete = 1; |
//wake_up(&wakeup->top->vb.done); |
} |
if (NULL != wakeup->bottom && curr->bottom != wakeup->bottom) { |
3241,6 → 3226,7 |
wakeup->bottom->vb.ts = ts; |
wakeup->bottom->vb.field_count = btv->field_count; |
wakeup->bottom->vb.state = state; |
grab_complete = 1; |
//wake_up(&wakeup->bottom->vb.done); |
} |
} |
3276,6 → 3262,7 |
item = list_entry(btv->capture.next, struct bttv_buffer, vb.queue); |
list_del(&item->vb.queue); |
item->vb.state = STATE_ERROR; |
grab_complete = 2; |
//wake_up(&item->vb.done); |
} |
while (!list_empty(&btv->vcapture)) { |
3282,6 → 3269,7 |
item = list_entry(btv->vcapture.next, struct bttv_buffer, vb.queue); |
list_del(&item->vb.queue); |
item->vb.state = STATE_ERROR; |
grab_complete = 2; |
//wake_up(&item->vb.done); |
} |
|
3305,6 → 3293,7 |
//do_gettimeofday(&wakeup->vb.ts); |
wakeup->vb.field_count = btv->field_count; |
wakeup->vb.state = STATE_DONE; |
grab_complete = 1; |
//wake_up(&wakeup->vb.done); |
spin_unlock(&btv->s_lock); |
} |