changeset 8485:4e32317f08be

don't give up when set_tuner fails; more zero div sanity checks
author henry
date Mon, 16 Dec 2002 23:24:02 +0000
parents 9ea5f18a7957
children c268bbb804d9
files libmpdemux/tvi_v4l.c
diffstat 1 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/tvi_v4l.c	Mon Dec 16 22:25:17 2002 +0000
+++ b/libmpdemux/tvi_v4l.c	Mon Dec 16 23:24:02 2002 +0000
@@ -988,6 +988,8 @@
 	    }
 
 	    if (priv->channels[priv->act_channel].flags & VIDEO_VC_TUNER) {
+		int prev_mode;
+		
 		control(priv, TVI_CONTROL_TUN_GET_TUNER, 0);
 		if (((req_mode == TV_NORM_PAL
 		      || req_mode == TV_NORM_PALNC
@@ -1001,6 +1003,8 @@
 		    return(TVI_CONTROL_FALSE);
 		}
 
+		prev_mode = priv->tuner.mode;
+
 		switch(req_mode) {
 		case TV_NORM_PAL:
 		case TV_NORM_PALNC:
@@ -1018,7 +1022,8 @@
 		}
 	    
 		if (control(priv, TVI_CONTROL_TUN_SET_TUNER, &priv->tuner) != TVI_CONTROL_TRUE) {
-		    return(TVI_CONTROL_FALSE);
+		    // norm setting failed, but maybe it's only because it's fixed
+		    if (priv->tuner.mode != prev_mode) return(TVI_CONTROL_FALSE); // no it really failed
 		}
 
 	    }
@@ -1282,11 +1287,14 @@
 		    interval = (double)framecount/priv->fps;
 		}
 
-		if (!priv->immediate_mode && (
-			(interval - prev_interval < (long long)0.85e6/priv->fps)
-			|| (interval - prev_interval > (long long)1.15e6/priv->fps) ) ) {
-		    mp_msg(MSGT_TV, MSGL_V, "\nvideo capture thread: frame delta ~ %.1lf fps\n",
-			   (double)1e6/(interval - prev_interval));
+		if (!priv->immediate_mode) {
+		    if (interval - prev_interval == 0) {
+			mp_msg(MSGT_TV, MSGL_V, "\nvideo capture thread: frame delta = 0\n");
+		    } else if ((interval - prev_interval < (long long)0.85e6/priv->fps)
+			       || (interval - prev_interval > (long long)1.15e6/priv->fps) ) {
+			mp_msg(MSGT_TV, MSGL_V, "\nvideo capture thread: frame delta ~ %.1lf fps\n",
+			       (double)1e6/(interval - prev_interval));
+		    }
 		}
 
 		// interpolate the skew in time
@@ -1304,7 +1312,8 @@
 	    }
 
 	    mp_msg(MSGT_TV, MSGL_DBG3, "\nfps = %lf, interval = %lf, a_skew = %f, corr_skew = %f\n",
-		   (double)1e6/(interval - prev_interval), (double)1e-6*interval, (double)1e-6*xskew, (double)1e-6*skew);
+		   (interval != prev_interval) ? (double)1e6/(interval - prev_interval) : -1,
+		   (double)1e-6*interval, (double)1e-6*xskew, (double)1e-6*skew);
 	    mp_msg(MSGT_TV, MSGL_DBG3, "vcnt = %d, acnt = %d\n", priv->video_cnt, priv->audio_cnt);
 
 	    prev_skew = skew;