diff -r 1a1258f9ba2d linux/drivers/media/video/ivtv/ivtv-ioctl.c
|
a
|
b
|
int ivtv_v4l2_ioctls(struct ivtv *itv, s
|
| 932 | 932 | |
| 933 | 933 | case VIDIOC_S_INPUT:{ |
| 934 | 934 | int inp = *(int *)arg; |
| | 935 | int restart = 0; |
| | 936 | int restarts[IVTV_MAX_STREAMS]; |
| 935 | 937 | |
| 936 | 938 | if (inp < 0 || inp >= itv->nof_inputs) |
| 937 | 939 | return -EINVAL; |
| … |
… |
int ivtv_v4l2_ioctls(struct ivtv *itv, s
|
| 941 | 943 | break; |
| 942 | 944 | } |
| 943 | 945 | if (atomic_read(&itv->capturing) > 0) { |
| 944 | | return -EBUSY; |
| | 946 | IVTV_DEBUG_INFO("We're doing an input switch " |
| | 947 | "while capturing..\n"); |
| | 948 | restart = ivtv_stop_all_captures_temp(itv,0,restarts); |
| 945 | 949 | } |
| 946 | 950 | IVTV_DEBUG_INFO("Changing input from %d to %d\n", |
| 947 | 951 | itv->active_input, inp); |
| … |
… |
int ivtv_v4l2_ioctls(struct ivtv *itv, s
|
| 957 | 961 | ivtv_video_set_io(itv); |
| 958 | 962 | ivtv_audio_set_io(itv); |
| 959 | 963 | ivtv_unmute(itv); |
| | 964 | |
| | 965 | if (restart) { |
| | 966 | int ok = ivtv_restart_all_captures(itv, restarts); |
| | 967 | /* TODO handle errors */ |
| | 968 | } |
| | 969 | |
| 960 | 970 | break; |
| 961 | 971 | } |
| 962 | 972 | |
diff -r 1a1258f9ba2d linux/drivers/media/video/ivtv/ivtv-streams.c
|
a
|
b
|
void ivtv_stop_all_captures(struct ivtv
|
| 709 | 709 | } |
| 710 | 710 | } |
| 711 | 711 | |
| | 712 | int ivtv_stop_all_captures_temp(struct ivtv *itv, int gop_end, int *stopped) |
| | 713 | { |
| | 714 | int i; |
| | 715 | int total = 0; |
| | 716 | |
| | 717 | for (i = IVTV_MAX_STREAMS - 1; i >= 0; i--) { |
| | 718 | struct ivtv_stream *s = &itv->streams[i]; |
| | 719 | |
| | 720 | stopped[i] = 0; |
| | 721 | |
| | 722 | if (s->v4l2dev == NULL) |
| | 723 | continue; |
| | 724 | if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { |
| | 725 | stopped[i] = 1; |
| | 726 | total++; |
| | 727 | ivtv_stop_v4l2_encode_stream(s, gop_end); |
| | 728 | } |
| | 729 | } |
| | 730 | |
| | 731 | return total; |
| | 732 | } |
| | 733 | |
| | 734 | int ivtv_restart_all_captures(struct ivtv *itv, int *stopped) |
| | 735 | { |
| | 736 | int i; |
| | 737 | int errors = 0; |
| | 738 | |
| | 739 | for (i = IVTV_MAX_STREAMS - 1; i >= 0; i--) { |
| | 740 | struct ivtv_stream *s = &itv->streams[i]; |
| | 741 | |
| | 742 | if (s->v4l2dev == NULL) |
| | 743 | continue; |
| | 744 | |
| | 745 | if (!stopped[i]) |
| | 746 | continue; |
| | 747 | |
| | 748 | errors += (0 == ivtv_start_v4l2_encode_stream(s)) ? 0 : 1; |
| | 749 | } |
| | 750 | |
| | 751 | return errors; |
| | 752 | } |
| | 753 | |
| 712 | 754 | int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) |
| 713 | 755 | { |
| 714 | 756 | struct ivtv *itv = s->itv; |
diff -r 1a1258f9ba2d linux/drivers/media/video/ivtv/ivtv-streams.h
|
a
|
b
|
void ivtv_stop_all_captures(struct ivtv
|
| 34 | 34 | void ivtv_stop_all_captures(struct ivtv *itv); |
| 35 | 35 | int ivtv_passthrough_mode(struct ivtv *itv, int enable); |
| 36 | 36 | |
| | 37 | int ivtv_stop_all_captures_temp(struct ivtv *itv, int gop_end, int *stopped); |
| | 38 | int ivtv_restart_all_captures(struct ivtv *itv, int *stopped); |
| | 39 | |
| 37 | 40 | #endif |