|
@@ -50,16 +50,16 @@ static int ivtv_claim_stream(struct ivtv_open_id *id, int type)
|
|
|
|
|
|
if (test_and_set_bit(IVTV_F_S_CLAIMED, &s->s_flags)) {
|
|
|
/* someone already claimed this stream */
|
|
|
- if (s->id == id->open_id) {
|
|
|
+ if (s->fh == &id->fh) {
|
|
|
/* yes, this file descriptor did. So that's OK. */
|
|
|
return 0;
|
|
|
}
|
|
|
- if (s->id == -1 && (type == IVTV_DEC_STREAM_TYPE_VBI ||
|
|
|
+ if (s->fh == NULL && (type == IVTV_DEC_STREAM_TYPE_VBI ||
|
|
|
type == IVTV_ENC_STREAM_TYPE_VBI)) {
|
|
|
/* VBI is handled already internally, now also assign
|
|
|
the file descriptor to this stream for external
|
|
|
reading of the stream. */
|
|
|
- s->id = id->open_id;
|
|
|
+ s->fh = &id->fh;
|
|
|
IVTV_DEBUG_INFO("Start Read VBI\n");
|
|
|
return 0;
|
|
|
}
|
|
@@ -67,7 +67,7 @@ static int ivtv_claim_stream(struct ivtv_open_id *id, int type)
|
|
|
IVTV_DEBUG_INFO("Stream %d is busy\n", type);
|
|
|
return -EBUSY;
|
|
|
}
|
|
|
- s->id = id->open_id;
|
|
|
+ s->fh = &id->fh;
|
|
|
if (type == IVTV_DEC_STREAM_TYPE_VBI) {
|
|
|
/* Enable reinsertion interrupt */
|
|
|
ivtv_clear_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT);
|
|
@@ -104,7 +104,7 @@ void ivtv_release_stream(struct ivtv_stream *s)
|
|
|
struct ivtv *itv = s->itv;
|
|
|
struct ivtv_stream *s_vbi;
|
|
|
|
|
|
- s->id = -1;
|
|
|
+ s->fh = NULL;
|
|
|
if ((s->type == IVTV_DEC_STREAM_TYPE_VBI || s->type == IVTV_ENC_STREAM_TYPE_VBI) &&
|
|
|
test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) {
|
|
|
/* this stream is still in use internally */
|
|
@@ -136,7 +136,7 @@ void ivtv_release_stream(struct ivtv_stream *s)
|
|
|
/* was already cleared */
|
|
|
return;
|
|
|
}
|
|
|
- if (s_vbi->id != -1) {
|
|
|
+ if (s_vbi->fh) {
|
|
|
/* VBI stream still claimed by a file descriptor */
|
|
|
return;
|
|
|
}
|
|
@@ -359,7 +359,7 @@ static ssize_t ivtv_read(struct ivtv_stream *s, char __user *ubuf, size_t tot_co
|
|
|
size_t tot_written = 0;
|
|
|
int single_frame = 0;
|
|
|
|
|
|
- if (atomic_read(&itv->capturing) == 0 && s->id == -1) {
|
|
|
+ if (atomic_read(&itv->capturing) == 0 && s->fh == NULL) {
|
|
|
/* shouldn't happen */
|
|
|
IVTV_DEBUG_WARN("Stream %s not initialized before read\n", s->name);
|
|
|
return -EIO;
|
|
@@ -808,7 +808,7 @@ void ivtv_stop_capture(struct ivtv_open_id *id, int gop_end)
|
|
|
id->type == IVTV_ENC_STREAM_TYPE_VBI) &&
|
|
|
test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) {
|
|
|
/* Also used internally, don't stop capturing */
|
|
|
- s->id = -1;
|
|
|
+ s->fh = NULL;
|
|
|
}
|
|
|
else {
|
|
|
ivtv_stop_v4l2_encode_stream(s, gop_end);
|
|
@@ -890,7 +890,7 @@ int ivtv_v4l2_close(struct file *filp)
|
|
|
v4l2_fh_exit(fh);
|
|
|
|
|
|
/* Easy case first: this stream was never claimed by us */
|
|
|
- if (s->id != id->open_id) {
|
|
|
+ if (s->fh != &id->fh) {
|
|
|
kfree(id);
|
|
|
return 0;
|
|
|
}
|
|
@@ -974,7 +974,6 @@ int ivtv_v4l2_open(struct file *filp)
|
|
|
item->itv = itv;
|
|
|
item->type = s->type;
|
|
|
|
|
|
- item->open_id = itv->open_id++;
|
|
|
filp->private_data = &item->fh;
|
|
|
v4l2_fh_add(&item->fh);
|
|
|
|