|
@@ -444,7 +444,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
|
|
|
s->handle = data[0];
|
|
|
cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype);
|
|
|
|
|
|
- if (atomic_read(&cx->capturing) == 0 && !ts) {
|
|
|
+ if (atomic_read(&cx->ana_capturing) == 0 && !ts) {
|
|
|
/* Stuff from Windows, we don't know what it is */
|
|
|
cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0);
|
|
|
cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1);
|
|
@@ -467,7 +467,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
|
|
|
cx2341x_update(cx, cx18_api_func, NULL, &cx->params);
|
|
|
}
|
|
|
|
|
|
- if (atomic_read(&cx->capturing) == 0) {
|
|
|
+ if (atomic_read(&cx->tot_capturing) == 0) {
|
|
|
clear_bit(CX18_F_I_EOS, &cx->i_flags);
|
|
|
write_reg(7, CX18_DSP0_INTERRUPT_MASK);
|
|
|
}
|
|
@@ -493,7 +493,9 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
|
|
|
}
|
|
|
|
|
|
/* you're live! sit back and await interrupts :) */
|
|
|
- atomic_inc(&cx->capturing);
|
|
|
+ if (!ts)
|
|
|
+ atomic_inc(&cx->ana_capturing);
|
|
|
+ atomic_inc(&cx->tot_capturing);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -524,7 +526,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
|
|
|
|
|
|
CX18_DEBUG_INFO("Stop Capture\n");
|
|
|
|
|
|
- if (atomic_read(&cx->capturing) == 0)
|
|
|
+ if (atomic_read(&cx->tot_capturing) == 0)
|
|
|
return 0;
|
|
|
|
|
|
if (s->type == CX18_ENC_STREAM_TYPE_MPG)
|
|
@@ -538,7 +540,9 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
|
|
|
CX18_INFO("ignoring gop_end: not (yet?) supported by the firmware\n");
|
|
|
}
|
|
|
|
|
|
- atomic_dec(&cx->capturing);
|
|
|
+ if (s->type != CX18_ENC_STREAM_TYPE_TS)
|
|
|
+ atomic_dec(&cx->ana_capturing);
|
|
|
+ atomic_dec(&cx->tot_capturing);
|
|
|
|
|
|
/* Clear capture and no-read bits */
|
|
|
clear_bit(CX18_F_S_STREAMING, &s->s_flags);
|
|
@@ -546,7 +550,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
|
|
|
cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
|
|
|
s->handle = 0xffffffff;
|
|
|
|
|
|
- if (atomic_read(&cx->capturing) > 0)
|
|
|
+ if (atomic_read(&cx->tot_capturing) > 0)
|
|
|
return 0;
|
|
|
|
|
|
write_reg(5, CX18_DSP0_INTERRUPT_MASK);
|