diff options
Diffstat (limited to 'drivers/media/video/cx18/cx18-streams.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-streams.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index dee6cc988090..5a065869401c 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -444,7 +444,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s) | |||
444 | s->handle = data[0]; | 444 | s->handle = data[0]; |
445 | cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype); | 445 | cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype); |
446 | 446 | ||
447 | if (atomic_read(&cx->capturing) == 0 && !ts) { | 447 | if (atomic_read(&cx->ana_capturing) == 0 && !ts) { |
448 | /* Stuff from Windows, we don't know what it is */ | 448 | /* Stuff from Windows, we don't know what it is */ |
449 | cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0); | 449 | cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0); |
450 | cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1); | 450 | 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) | |||
467 | cx2341x_update(cx, cx18_api_func, NULL, &cx->params); | 467 | cx2341x_update(cx, cx18_api_func, NULL, &cx->params); |
468 | } | 468 | } |
469 | 469 | ||
470 | if (atomic_read(&cx->capturing) == 0) { | 470 | if (atomic_read(&cx->tot_capturing) == 0) { |
471 | clear_bit(CX18_F_I_EOS, &cx->i_flags); | 471 | clear_bit(CX18_F_I_EOS, &cx->i_flags); |
472 | write_reg(7, CX18_DSP0_INTERRUPT_MASK); | 472 | write_reg(7, CX18_DSP0_INTERRUPT_MASK); |
473 | } | 473 | } |
@@ -493,7 +493,9 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s) | |||
493 | } | 493 | } |
494 | 494 | ||
495 | /* you're live! sit back and await interrupts :) */ | 495 | /* you're live! sit back and await interrupts :) */ |
496 | atomic_inc(&cx->capturing); | 496 | if (!ts) |
497 | atomic_inc(&cx->ana_capturing); | ||
498 | atomic_inc(&cx->tot_capturing); | ||
497 | return 0; | 499 | return 0; |
498 | } | 500 | } |
499 | 501 | ||
@@ -524,7 +526,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end) | |||
524 | 526 | ||
525 | CX18_DEBUG_INFO("Stop Capture\n"); | 527 | CX18_DEBUG_INFO("Stop Capture\n"); |
526 | 528 | ||
527 | if (atomic_read(&cx->capturing) == 0) | 529 | if (atomic_read(&cx->tot_capturing) == 0) |
528 | return 0; | 530 | return 0; |
529 | 531 | ||
530 | if (s->type == CX18_ENC_STREAM_TYPE_MPG) | 532 | 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) | |||
538 | CX18_INFO("ignoring gop_end: not (yet?) supported by the firmware\n"); | 540 | CX18_INFO("ignoring gop_end: not (yet?) supported by the firmware\n"); |
539 | } | 541 | } |
540 | 542 | ||
541 | atomic_dec(&cx->capturing); | 543 | if (s->type != CX18_ENC_STREAM_TYPE_TS) |
544 | atomic_dec(&cx->ana_capturing); | ||
545 | atomic_dec(&cx->tot_capturing); | ||
542 | 546 | ||
543 | /* Clear capture and no-read bits */ | 547 | /* Clear capture and no-read bits */ |
544 | clear_bit(CX18_F_S_STREAMING, &s->s_flags); | 548 | 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) | |||
546 | cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); | 550 | cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); |
547 | s->handle = 0xffffffff; | 551 | s->handle = 0xffffffff; |
548 | 552 | ||
549 | if (atomic_read(&cx->capturing) > 0) | 553 | if (atomic_read(&cx->tot_capturing) > 0) |
550 | return 0; | 554 | return 0; |
551 | 555 | ||
552 | write_reg(5, CX18_DSP0_INTERRUPT_MASK); | 556 | write_reg(5, CX18_DSP0_INTERRUPT_MASK); |