changeset 8088:59f4133fbab5

Updated docs with DXR3 overlay info Cleaned new sync code in dxr3 Renamed some internal variables to allow access from GUI
author mswitch
date Sun, 03 Nov 2002 20:05:39 +0000
parents 610976c39408
children 6187579016a5
files DOCS/video.html libvo/vo_dxr3.c
diffstat 2 files changed, 72 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/video.html	Sun Nov 03 17:20:58 2002 +0000
+++ b/DOCS/video.html	Sun Nov 03 20:05:39 2002 +0000
@@ -1173,7 +1173,14 @@
 <H4>Usage:</H4>
 <DL>
   <DT><CODE>-vo dxr3:prebuf:sync:&lt;device&gt;</CODE></DT>
-  <DD><CODE>prebuf</CODE> turns on prebuffering. Prebuffering is a feature
+  <DD><CODE>overlay</CODE> activates the overlay instead of TVOut. It requires
+    that you have a properly configured overlay setup to work right. The easiest
+    way to configure the overlay is to first run autocal. Then run mplayer with
+    dxr3 output and without overlay turned on, run dxr3view. In dxr3view you can
+    tweak the overlay settings and see the effects in realtime, perhaps this
+    feature will be supported by the MPlayer GUI in the future. When overlay is
+    properly set up you will no longer need to use dxr3view.<BR>
+    <CODE>prebuf</CODE> turns on prebuffering. Prebuffering is a feature
     of the em8300 chip that enables it to hold more than one frame of video at
     a time. This means that when you are running with prebuffering
     MPlayer will try to keep the video buffer filled with data at all
@@ -1235,13 +1242,6 @@
     section for further information on AC3.</DD>
 </DL>
 
-<H4>Overlay</H4>
-
-<P>To get overlay run dxr3view that comes with the em8300 package before
-  starting MPlayer. You can set various options in dxr3view by pressing
-  <CODE>T</CODE> while holding the mouse cursor above the window. Activating
-  rectangle mode seems to work for alot of people.</P>
-
 <H4>MPEG1, MPEG2, VCD and DVD Notes</H4>
 
 <P>In some instances, subtitles may not appear properly in sync with the A/V
--- a/libvo/vo_dxr3.c	Sun Nov 03 17:20:58 2002 +0000
+++ b/libvo/vo_dxr3.c	Sun Nov 03 20:05:39 2002 +0000
@@ -6,6 +6,10 @@
  */
 
 /* ChangeLog added 2002-01-10
+ * 2002-01-03:
+ *  Cleaned up syncing code and renamed setup variables so
+ *   they can be accessed from the GUI.
+ *
  * 2002-01-02:
  *  Added native overlay support, activate with :overlay
  *   you have to run dxr3view to modify settings (or manually
@@ -136,12 +140,18 @@
 static int v_width, v_height;
 static int s_width, s_height;
 static int osd_w, osd_h;
-static int prebuf = 0;
-static int newsync = 0;
-static int overlay = 0;
 static int fullscreen = 0;
 static int img_format = 0;
 
+/* Configuration values
+ * Don't declare these static, they 
+ * should be accessible from the gui.
+ */
+int dxr3_prebuf = 0;
+int dxr3_newsync = 0;
+int dxr3_overlay = 0;
+int dxr3_device_num = 0;
+
 /* File descriptors */
 static int fd_control = -1;
 static int fd_video = -1;
@@ -240,13 +250,19 @@
 	case VOCTRL_GUISUPPORT:
 		return VO_TRUE;
 	case VOCTRL_GUI_NOWINDOW:
-		if (overlay) {
+		if (dxr3_overlay) {
 			return VO_FALSE;
 		}
 		return VO_TRUE;
+	case VOCTRL_SET_SPU_PALETTE:
+		if (ioctl(fd_spu, EM8300_IOCTL_SPU_SETPALETTE, data) < 0) {
+			printf("VO: [dxr3] Unable to load new SPU palette!\n");
+			return VO_ERROR;
+		}
+		return VO_TRUE;
 #ifdef HAVE_X11
 	case VOCTRL_FULLSCREEN:
-		if (overlay) {
+		if (dxr3_overlay) {
 			vo_x11_fullscreen();
 			if (fullscreen) {
 				overlay_signalmode(overlay_data, EM8300_OVERLAY_SIGNAL_WITH_VGA);
@@ -260,7 +276,15 @@
 		return VO_FALSE;
 #endif
 	case VOCTRL_RESUME:
-		if (prebuf) {
+		if (dxr3_newsync) {
+			ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
+			pts_offset = vo_pts - (ioval << 1);
+			if (pts_offset < 0) {
+				pts_offset = 0;
+			}
+		}
+		
+		if (dxr3_prebuf) {
 			ioval = EM8300_PLAYMODE_PLAY;
 			if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
 				printf("VO: [dxr3] Unable to set playmode!\n");
@@ -268,7 +292,7 @@
 		}
 		return VO_TRUE;
 	case VOCTRL_PAUSE:
-		if (prebuf) {
+		if (dxr3_prebuf) {
 			ioval = EM8300_PLAYMODE_PAUSED;
 			if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
 				printf("VO: [dxr3] Unable to set playmode!\n");
@@ -276,7 +300,7 @@
 		}
 		return VO_TRUE;
 	case VOCTRL_RESET:
-		if (prebuf || sync) {
+		if (dxr3_prebuf) {
 			close(fd_video);
 			fd_video = open(fdv_name, O_WRONLY);
 			close(fd_spu);
@@ -293,7 +317,7 @@
 		    return 0;
 
 		flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_SPU;
-		if (prebuf)
+		if (dxr3_prebuf)
 		    flag |= VFCAP_TIMER;
 		return flag;
 	    }
@@ -392,7 +416,7 @@
 #ifdef MVCOMMAND_SYNC
 	reg.microcode_register = 1;
 	reg.reg = 0;
-	reg.val = MVCOMMAND_SYNC;
+	reg.val = MVCOMMAND_START;
 	ioctl(fd_control, EM8300_IOCTL_WRITEREG, &reg);
 #endif
 
@@ -411,8 +435,6 @@
 	fsync(fd_video);
 	ioval = 0x900;
 	ioctl(fd_control, EM8300_IOCTL_SCR_SETSPEED, &ioval);
-	ioval = 0;
-	ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval);
 
 	/* Store some variables statically that we need later in another scope */
 	img_format = format;
@@ -489,7 +511,7 @@
 #endif
 
 #ifdef HAVE_X11
-	if (overlay) {
+	if (dxr3_overlay) {
 		XVisualInfo vinfo;
 		XSetWindowAttributes xswa;
 		XSizeHints hint;
@@ -677,7 +699,7 @@
 static void flip_page(void)
 {
 #ifdef HAVE_X11
-	if (overlay) {
+	if (dxr3_overlay) {
 		int event = vo_x11_check_events(mDisplay);
 		if (event & VO_EVENT_RESIZE) {
 			Window junkwindow;
@@ -696,7 +718,7 @@
 	}
 #endif
 
-	if (newsync) {
+	if (dxr3_newsync) {
 		ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
 		ioval <<= 1;
 		if (vo_pts == 0) {
@@ -716,7 +738,7 @@
 		ioctl(fd_video, EM8300_IOCTL_SPU_SETPTS, &ioval);
 		ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &ioval);
 		prev_pts = vo_pts;
-	} else if (prebuf) {
+	} else if (dxr3_prebuf) {
 		ioctl(fd_spu, EM8300_IOCTL_SPU_SETPTS, &vo_pts);
 		ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts);
 	}
@@ -731,7 +753,7 @@
 {
 	printf("VO: [dxr3] Uninitializing\n");
 #ifdef HAVE_X11
-	if (overlay) {
+	if (dxr3_overlay) {
 		overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_OFF);
 		overlay_release(overlay_data);
 		
@@ -739,6 +761,7 @@
 		if (!use_gui) {
 #endif
 			vo_x11_uninit();
+
 #ifdef HAVE_NEW_GUI
 		}
 #endif
@@ -770,26 +793,26 @@
 static uint32_t preinit(const char *arg)
 {
 	char devname[80];
-	char devnum = 0;
 	int fdflags = O_WRONLY;
 
 	/* Parse commandline */
 	while (arg) {
-		if (!strncmp("prebuf", arg, 6) && !prebuf) {
+		if (!strncmp("prebuf", arg, 6) && !dxr3_prebuf) {
 			printf("VO: [dxr3] Enabling prebuffering.\n");
-			prebuf = 1;
-		} else if (!strncmp("sync", arg, 4) && !newsync) {
+			dxr3_prebuf = 1;
+			fdflags |= O_NONBLOCK;
+		} else if (!strncmp("sync", arg, 4) && !dxr3_newsync) {
 			printf("VO: [dxr3] Using new sync engine.\n");
-			newsync = 1;
-		} else if (!strncmp("overlay", arg, 7) && !overlay) {
+			dxr3_newsync = 1;
+		} else if (!strncmp("overlay", arg, 7) && !dxr3_overlay) {
 #ifdef HAVE_X11
 			printf("VO: [dxr3] Using overlay.\n");
-			overlay = 1;
+			dxr3_overlay = 1;
 #else
 			printf("VO: [dxr3] Error: You need to compile mplayer with x11 libraries and headers installed to use overlay.\n");
 #endif
 		} else if (arg[0] == '0' || arg[0] == '1' || arg[0] == '2' || arg[0] == '3') {
-			devnum = arg[0];
+			dxr3_device_num = arg[0];
 		}
 		
 		arg = strchr(arg, ':');
@@ -798,19 +821,9 @@
 		}
 	}
 	
-	if (prebuf) {
-		fdflags |= O_NONBLOCK;
-	}
-	
 
 	/* Open the control interface */
-	if (devnum) {
-		printf("VO: [dxr3] Forcing use of device %c\n", devnum);
-		sprintf(devname, "/dev/em8300-%c", devnum);
-	} else {
-		/* Try new naming scheme by default */
-		sprintf(devname, "/dev/em8300-0");
-	}
+	sprintf(devname, "/dev/em8300-%d", dxr3_device_num);
 	fd_control = open(devname, fdflags);
 	if (fd_control < 1) {
 		/* Fall back to old naming scheme */
@@ -821,15 +834,12 @@
 			printf("VO: [dxr3] Error opening /dev/em8300 for writing as well!\nBailing\n");
 			return -1;
 		}
+	} else {
+		printf("VO: [dxr3] Opened %s\n", devname);
 	}
 
 	/* Open the video interface */
-	if (devnum) {
-		sprintf(devname, "/dev/em8300_mv-%c", devnum);
-	} else {
-		/* Try new naming scheme by default */
-		sprintf(devname, "/dev/em8300_mv-0");
-	}
+	sprintf(devname, "/dev/em8300_mv-%d", dxr3_device_num);
 	fd_video = open(devname, fdflags);
 	if (fd_video < 0) {
 		/* Fall back to old naming scheme */
@@ -848,12 +858,7 @@
 	
 	/* Open the subpicture interface */
 	fdflags |= O_NONBLOCK;
-	if (devnum) {
-		sprintf(devname, "/dev/em8300_sp-%c", devnum);
-	} else {
-		/* Try new naming scheme by default */
-		sprintf(devname, "/dev/em8300_sp-0");
-	}
+	sprintf(devname, "/dev/em8300_sp-%d", dxr3_device_num);
 	fd_spu = open(devname, fdflags);
 	if (fd_spu < 0) {
 		/* Fall back to old naming scheme */
@@ -865,14 +870,13 @@
 			uninit();
 			return -1;
 		}
+	} else {
+		printf("VO: [dxr3] Opened %s\n", devname);
 	}
 	strcpy(fds_name, devname);
 	
-	ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
-	pts_offset = vo_pts - (ioval << 1);
-
 #ifdef HAVE_X11
-	if (overlay) {
+	if (dxr3_overlay) {
 	
 		/* Fucked up hack needed to enable overlay.
 		 * Will be removed as soon as I figure out
@@ -913,6 +917,14 @@
 	}
 #endif
 
+	if (dxr3_newsync) {
+		ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
+		pts_offset = vo_pts - (ioval << 1);
+		if (pts_offset < 0) {
+			pts_offset = 0;
+		}
+	}
+
 	return 0;
 }