From: Barry S. <bar...@on...> - 2004-09-16 11:13:49
|
This patch fixes a bug in selecting video sources for V4L MRL's it is against the RC5 released source code. Below are logs from the old xine code and the new code with the patch that showing the change in behaviour. The tests are to Select Composite0 and S-Video. The correct input values are 0 for Composite0 and 1 for S-Video, the old code with use 2 in the S-Video case. Look at the different values reported in the these log lines: input_v4l: (search_by_channel:nnn) (0) Set channel to ? Barry ------------------------- start patch -------------------------- --- src/input/input_v4l.c.orig 2004-06-13 22:28:56.000000000 +0100 +++ src/input/input_v4l.c 2004-06-21 12:30:12.000000000 +0100 @@ -626,39 +626,37 @@ static int search_by_channel(v4l_input_plugin_t *this, char *input_source) { int ret = 0; int fd = 0; + lprintf("input_source: %s\n", input_source); + this->input = 0; if (this->video_fd > 0) fd = this->video_fd; else fd = this->radio_fd; /* Tune into channel */ - ret = ioctl(fd, VIDIOCGCHAN, &this->video_channel); - lprintf("(%d) V4L device currently set to:\n", ret); - lprintf("Channel: %d\n", this->video_channel.channel); - lprintf("Name: %s\n", this->video_channel.name); - lprintf("Tuners: %d\n", this->video_channel.tuners); - lprintf("Flags: %d\n", this->video_channel.flags); - lprintf("Type: %d\n", this->video_channel.type); - lprintf("Norm: %d\n", this->video_channel.norm); - if (strlen(input_source) > 0) { - while (strstr(this->video_channel.name, input_source) == NULL && - ioctl(fd, VIDIOCGCHAN, &this->video_channel) == 0) { - + for( this->video_channel.channel = 0; + ioctl(fd, VIDIOCGCHAN, &this->video_channel) == 0; + this->video_channel.channel++ ) { + lprintf("V4L device currently set to:\n"); lprintf("Channel: %d\n", this->video_channel.channel); lprintf("Name: %s\n", this->video_channel.name); lprintf("Tuners: %d\n", this->video_channel.tuners); lprintf("Flags: %d\n", this->video_channel.flags); lprintf("Type: %d\n", this->video_channel.type); lprintf("Norm: %d\n", this->video_channel.norm); - this->video_channel.channel = ++this->input; + + if (strstr(this->video_channel.name, input_source) != NULL) { + this->input = this->video_channel.channel; + break; + } } if (strstr(this->video_channel.name, input_source) == NULL) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("Tuner name not found\n")); return -1; -------------------------- end patch --------------------------- ------------------- Xine old code Composite0 test -------------- input_v4l: (extract_mrl:519) Tuner name: 'Composite0' freq: 0 input_v4l: (v4l_class_get_video_instance:1794) Device opened, tv 7 input_v4l: (search_by_channel:629) Xine Unpatched: search_by_channel( input_source: Composite0 ) input_v4l: (search_by_channel:640) (0) V4L device currently set to: input_v4l: (search_by_channel:641) Channel: 0 input_v4l: (search_by_channel:642) Name: Composite0 input_v4l: (search_by_channel:643) Tuners: 0 input_v4l: (search_by_channel:644) Flags: 2 input_v4l: (search_by_channel:645) Type: 2 input_v4l: (search_by_channel:646) Norm: 0 input_v4l: (search_by_channel:670) (0) Set channel to 0 input_v4l: (search_by_channel:678) (0) Response on set tuner to 0 input_v4l: (search_by_channel:687) (-1) Flags 0 input_v4l: (search_by_channel:689) VIDEO_TUNER_PAL not set input_v4l: (search_by_channel:690) VIDEO_TUNER_NTSC not set input_v4l: (search_by_channel:691) VIDEO_TUNER_SECAM not set input_v4l: (search_by_channel:692) VIDEO_TUNER_LOW not set input_v4l: (search_by_channel:693) VIDEO_TUNER_NORM not set input_v4l: (search_by_channel:694) VIDEO_TUNER_STEREO_ON not set input_v4l: (search_by_channel:695) VIDEO_TUNER_RDS_ON not set input_v4l: (search_by_channel:696) VIDEO_TUNER_MBS_ON not set input_v4l: (search_by_channel:700) The tuner is in PAL mode input_v4l: (open_video_capture_device:812) open_video_capture_device input_v4l: (open_video_capture_device:825) Device opened, tv 7 input_v4l: (store_aud_frame:437) store_aud_frame ------------------- Xine old code S-Video test ----------------- input_v4l: (extract_mrl:519) Tuner name: 'S-Video' freq: 0 input_v4l: (v4l_class_get_video_instance:1794) Device opened, tv 7 input_v4l: (search_by_channel:629) Xine Unpatched: search_by_channel( input_source: S-Video ) input_v4l: (search_by_channel:640) (0) V4L device currently set to: input_v4l: (search_by_channel:641) Channel: 0 input_v4l: (search_by_channel:642) Name: Composite0 input_v4l: (search_by_channel:643) Tuners: 0 input_v4l: (search_by_channel:644) Flags: 2 input_v4l: (search_by_channel:645) Type: 2 input_v4l: (search_by_channel:646) Norm: 0 input_v4l: (search_by_channel:652) V4L device currently set to: input_v4l: (search_by_channel:653) Channel: 0 input_v4l: (search_by_channel:654) Name: Composite0 input_v4l: (search_by_channel:655) Tuners: 0 input_v4l: (search_by_channel:656) Flags: 2 input_v4l: (search_by_channel:657) Type: 2 input_v4l: (search_by_channel:658) Norm: 0 input_v4l: (search_by_channel:652) V4L device currently set to: input_v4l: (search_by_channel:653) Channel: 1 input_v4l: (search_by_channel:654) Name: S-Video input_v4l: (search_by_channel:655) Tuners: 0 input_v4l: (search_by_channel:656) Flags: 2 input_v4l: (search_by_channel:657) Type: 2 input_v4l: (search_by_channel:658) Norm: 0 input_v4l: (search_by_channel:670) (-1) Set channel to 2 input_v4l: (search_by_channel:678) (0) Response on set tuner to 0 input_v4l: (search_by_channel:687) (-1) Flags 0 input_v4l: (search_by_channel:689) VIDEO_TUNER_PAL not set input_v4l: (search_by_channel:690) VIDEO_TUNER_NTSC not set input_v4l: (search_by_channel:691) VIDEO_TUNER_SECAM not set input_v4l: (search_by_channel:692) VIDEO_TUNER_LOW not set input_v4l: (search_by_channel:693) VIDEO_TUNER_NORM not set input_v4l: (search_by_channel:694) VIDEO_TUNER_STEREO_ON not set input_v4l: (search_by_channel:695) VIDEO_TUNER_RDS_ON not set input_v4l: (search_by_channel:696) VIDEO_TUNER_MBS_ON not set input_v4l: (search_by_channel:700) The tuner is in PAL mode input_v4l: (open_video_capture_device:812) open_video_capture_device input_v4l: (open_video_capture_device:825) Device opened, tv 7 input_v4l: (store_aud_frame:437) store_aud_frame ------------------- Patched code Composite0 test --------------- input_v4l: (extract_mrl:519) Tuner name: 'Composite0' freq: 0 input_v4l: (v4l_class_get_video_instance:1790) Device opened, tv 7 input_v4l: (search_by_channel:629) Barry Scott Patch: search_by_channel( input_source: Composite0 ) input_v4l: (search_by_channel:644) V4L device currently set to: input_v4l: (search_by_channel:645) Channel: 0 input_v4l: (search_by_channel:646) Name: Composite0 input_v4l: (search_by_channel:647) Tuners: 0 input_v4l: (search_by_channel:648) Flags: 2 input_v4l: (search_by_channel:649) Type: 2 input_v4l: (search_by_channel:650) Norm: 0 input_v4l: (search_by_channel:666) (0) Set channel to 0 input_v4l: (search_by_channel:674) (0) Response on set tuner to 0 input_v4l: (search_by_channel:683) (-1) Flags 0 input_v4l: (search_by_channel:685) VIDEO_TUNER_PAL not set input_v4l: (search_by_channel:686) VIDEO_TUNER_NTSC not set input_v4l: (search_by_channel:687) VIDEO_TUNER_SECAM not set input_v4l: (search_by_channel:688) VIDEO_TUNER_LOW not set input_v4l: (search_by_channel:689) VIDEO_TUNER_NORM not set input_v4l: (search_by_channel:690) VIDEO_TUNER_STEREO_ON not set input_v4l: (search_by_channel:691) VIDEO_TUNER_RDS_ON not set input_v4l: (search_by_channel:692) VIDEO_TUNER_MBS_ON not set input_v4l: (search_by_channel:696) The tuner is in PAL mode input_v4l: (open_video_capture_device:808) open_video_capture_device input_v4l: (open_video_capture_device:821) Device opened, tv 7 input_v4l: (store_aud_frame:437) store_aud_frame ------------------- Patched code S-Video test ------------------ input_v4l: (extract_mrl:519) Tuner name: 'S-Video' freq: 0 input_v4l: (v4l_class_get_video_instance:1790) Device opened, tv 7 input_v4l: (search_by_channel:629) Barry Scott Patch: search_by_channel( input_source: S-Video ) input_v4l: (search_by_channel:644) V4L device currently set to: input_v4l: (search_by_channel:645) Channel: 0 input_v4l: (search_by_channel:646) Name: Composite0 input_v4l: (search_by_channel:647) Tuners: 0 input_v4l: (search_by_channel:648) Flags: 2 input_v4l: (search_by_channel:649) Type: 2 input_v4l: (search_by_channel:650) Norm: 0 input_v4l: (search_by_channel:644) V4L device currently set to: input_v4l: (search_by_channel:645) Channel: 1 input_v4l: (search_by_channel:646) Name: S-Video input_v4l: (search_by_channel:647) Tuners: 0 input_v4l: (search_by_channel:648) Flags: 2 input_v4l: (search_by_channel:649) Type: 2 input_v4l: (search_by_channel:650) Norm: 0 input_v4l: (search_by_channel:666) (0) Set channel to 1 input_v4l: (search_by_channel:674) (0) Response on set tuner to 0 input_v4l: (search_by_channel:683) (-1) Flags 0 input_v4l: (search_by_channel:685) VIDEO_TUNER_PAL not set input_v4l: (search_by_channel:686) VIDEO_TUNER_NTSC not set input_v4l: (search_by_channel:687) VIDEO_TUNER_SECAM not set input_v4l: (search_by_channel:688) VIDEO_TUNER_LOW not set input_v4l: (search_by_channel:689) VIDEO_TUNER_NORM not set input_v4l: (search_by_channel:690) VIDEO_TUNER_STEREO_ON not set input_v4l: (search_by_channel:691) VIDEO_TUNER_RDS_ON not set input_v4l: (search_by_channel:692) VIDEO_TUNER_MBS_ON not set input_v4l: (search_by_channel:696) The tuner is in PAL mode input_v4l: (open_video_capture_device:808) open_video_capture_device input_v4l: (open_video_capture_device:821) Device opened, tv 7 input_v4l: (store_aud_frame:437) store_aud_frame -------------------------------------------------------------- |