[MPlayer-dev-eng] [patch] improve dxr3 tv norm switching

Jens Axboe axboe at suse.de
Sat Dec 28 15:23:58 CET 2002


Hi,

The merged patch is suboptimal (for me, at least) to what I had in my
tree, so I'll try and merge the two. The most important bit is that tv
norm is not being restored when mplayer quits. This is quite annoying
when used from eg freevo. Second, there's no need to set the video mode
if current norm matches the input file. Also kills a few static ints
being set to 0 (there are quite a few more).

BTW, vo_dxr3 could do with a bit of ifdef cleaning, it's quite nasty...

-- 
Jens Axboe

-------------- next part --------------
Index: libvo/vo_dxr3.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dxr3.c,v
retrieving revision 1.112
diff -u -r1.112 vo_dxr3.c
--- libvo/vo_dxr3.c	24 Dec 2002 12:45:32 -0000	1.112
+++ libvo/vo_dxr3.c	28 Dec 2002 14:21:35 -0000
@@ -178,9 +178,10 @@
 
 
 /* Static variable used in ioctl's */
-static int ioval = 0;
-static int prev_pts = 0;
-static int pts_offset = 0;
+static int ioval;
+static int prev_pts;
+static int pts_offset;
+static int old_vmode = -1;
 
 
 /* Begin overlay.h */
@@ -450,6 +451,13 @@
 
 	/* Set monitor_aspect to avoid jitter */
 	monitor_aspect = (float) width / (float) height;
+
+#ifdef EM8300_IOCTL_GET_VIDEOMODE
+	if (ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &old_vmode) < 0) {
+	    printf("VO: [dxr3] Unable to get TV norm!\n");
+	    old_vmode = -1;
+	}
+#endif
 	
 	/* adjust TV norm */
 #ifdef EM8300_IOCTL_SET_VIDEOMODE
@@ -482,8 +490,10 @@
 			printf("\n"); 
 	    }
 	
-	    if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &ioval) < 0) {
-			printf("VO: [dxr3] Unable to set TV norm!\n");
+	    if (old_vmode != ioval) {
+	    	if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &ioval) < 0) {
+		    printf("VO: [dxr3] Unable to set TV norm!\n");
+	        }
 	    }
 	}
 #endif
@@ -807,6 +817,14 @@
 #endif
 	}
 #endif
+#ifdef EM8300_IOCTL_SET_VIDEOMODE
+	if (old_vmode != -1) {
+	    if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &old_vmode) < 0) {
+		printf("VO: failed restoring TV norm\n");
+	    }
+	}
+#endif
+		
 	if (fd_video) {
 		close(fd_video);
 	}


More information about the MPlayer-dev-eng mailing list