vid_tuner struct is not initialized in v4l_set_input which leads to random problems on some cards using the tuner. (see patch included)
--- video.c.dist 2007-11-25 19:51:58.000000000 -0500
+++ video.c 2007-11-25 19:52:16.000000000 -0500
@@ -326,7 +326,9 @@
struct video_channel vid_chnl;
struct video_tuner vid_tuner;
unsigned long frequnits = freq;
-
+
+ memset(&vid_tuner, 0, sizeof(struct video_tuner));
+
if (input != viddev->input || width != viddev->width || height!=viddev->height ||
freq!=viddev->freq || tuner_number!=viddev->tuner_number) {
if (freq) {
Environment
Motion version: |
3.2.9 |
ffmpeg version: |
|
Shared libraries: |
ffmpeg, mysql, postgresql |
Server OS: |
|
--
JasonSharpee - 26 Nov 2007
Follow up
Thanks Jason , i have improved your patch.
--- video.c (revisión: 282)
+++ video.c (copia de trabajo)
@@ -139,6 +139,7 @@
}
if (freq) {
+ memset(&vid_tuner, 0, sizeof(struct video_tuner));
vid_tuner.tuner = tuner_number;
if (ioctl (dev, VIDIOCGTUNER, &vid_tuner)==-1) {
motion_log(LOG_ERR, 1, "ioctl (VIDIOCGTUNER)");
@@ -329,6 +330,9 @@
if (input != viddev->input || width != viddev->width || height!=viddev->height ||
freq!=viddev->freq || tuner_number!=viddev->tuner_number) {
if (freq) {
+
+ memset(&vid_tuner, 0, sizeof(struct video_tuner));
+
vid_tuner.tuner = tuner_number;
if (ioctl (dev, VIDIOCGTUNER, &vid_tuner)==-1) {
motion_log(LOG_ERR, 1, "ioctl (VIDIOCGTUNER)");
@@ -345,6 +349,7 @@
}
}
+ memset(&vid_chnl, 0, sizeof(struct video_channel));
vid_chnl.channel = input;
if (ioctl (dev, VIDIOCGCHAN, &vid_chnl) == -1) {
--
AngelCarpintero - 02 Dec 2007
Fix record
Thanks to pointing to this potencial problem , i have fixed some others missing initializations for video_tuner and video_channel.
--
AngelCarpintero - 02 Dec 2007