changeset 8722:86c0d90cd841

Added patch that makes the dxr3 return to the previous tv norm when quiting.
author mswitch
date Thu, 02 Jan 2003 18:54:16 +0000
parents 97a1afe2d615
children 48a2c2545d5c
files libvo/vo_dxr3.c
diffstat 1 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_dxr3.c	Thu Jan 02 16:51:19 2003 +0000
+++ b/libvo/vo_dxr3.c	Thu Jan 02 18:54:16 2003 +0000
@@ -6,6 +6,9 @@
  */
 
 /* ChangeLog added 2002-01-10
+ * 2003-01-02:
+ *  Added patch that makes vo_dxr3 return to previous TV norm after quiting.
+ *
  * 2002-12-24: (Hohoho)
  *  Added patch from Thomas Jarosch <tomj@simonv.com> which adds support
  *   for setting the TV norm by movie framerate.
@@ -181,6 +184,7 @@
 static int ioval = 0;
 static int prev_pts = 0;
 static int pts_offset = 0;
+static int old_vmode = -1;
 
 
 /* Begin overlay.h */
@@ -450,9 +454,13 @@
 
 	/* Set monitor_aspect to avoid jitter */
 	monitor_aspect = (float) width / (float) height;
+
+	if (ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &old_vmode) < 0) {
+		printf("VO: [dxr3] Unable to get TV norm!\n");
+		old_vmode = -1;
+	}
 	
 	/* adjust TV norm */
-#ifdef EM8300_IOCTL_SET_VIDEOMODE
 	if (dxr3_norm != 0) {
 	    if (dxr3_norm == 5) {
 			ioval = EM8300_VIDEOMODE_NTSC;
@@ -470,7 +478,7 @@
 			printf("VO: [dxr3] Auto-selected TV norm by frame rate: ");
 			ioval == EM8300_VIDEOMODE_PAL60 ? printf("PAL-60") : printf("PAL");
 			printf("\n"); 
-		} else if (dxr3_norm == 1) {
+		} else {
 			if (vo_fps > 28) {
 			    ioval = EM8300_VIDEOMODE_NTSC;
 			} else {
@@ -482,17 +490,17 @@
 			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
 	
 	
 	/* libavcodec requires a width and height that is x|16 */
 	aspect_save_orig(width, height);
 	aspect_save_prescale(d_width, d_height);
-#ifdef EM8300_IOCTL_GET_VIDEOMODE
 	ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &ioval);
 	if (ioval == EM8300_VIDEOMODE_NTSC) {
 		printf("VO: [dxr3] Setting up for NTSC.\n");
@@ -501,7 +509,6 @@
 		printf("VO: [dxr3] Setting up for PAL/SECAM.\n");
 		aspect_save_screenres(352, 288);
 	}
-#endif
 	aspect(&s_width, &s_height, A_ZOOM);
 	s_width -= s_width % 16;
 	s_height -= s_height % 16;
@@ -807,6 +814,12 @@
 #endif
 	}
 #endif
+	if (old_vmode != -1) {
+		if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &old_vmode) < 0) {
+			printf("VO: [dxr3] Failed restoring TV norm!\n");
+		}
+	}
+	
 	if (fd_video) {
 		close(fd_video);
 	}