[MPlayer-dev-eng] [PATCH] -vo xv:port=

Jim Hawkins mplayer at jawkins.com
Sun Sep 7 17:50:30 CEST 2003


On Sun, 7 Sep 2003, Attila Kinali wrote:

> It's corrected now

It's still not much use. It only allows me to select a port on the first
adaptor, which in my case only has one port and is the adaptor I want to
avoid. How's this new patch look?

Jim
-------------- next part --------------
Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.147
diff -u -r1.147 vo_xv.c
--- vo_xv.c	7 Sep 2003 14:45:10 -0000	1.147
+++ vo_xv.c	7 Sep 2003 16:09:20 -0000
@@ -623,15 +623,25 @@
     }
 
    /* check adaptors */
-    if(xv_port >= ai[0].num_ports || xv_port < 0) // FIXME: ai[0] should not be hardcoded
-    {
-    	mp_msg(MSGT_VO, MSGL_WARN,"Xv: Invalid port parameter, overriding with port 0\n");
-    	xv_port = 0;
-    }
-    if (xv_port)
-    {
-      if (XvGrabPort(mDisplay, xv_port, CurrentTime))
+    if (xv_port) {
+      int port_found;
+      for (port_found = 0, i = 0; !port_found && i < adaptors; i++) {
+        if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) {
+          for (xv_p = ai[i].base_id; xv_p < ai[i].base_id+ai[i].num_ports; ++xv_p) {
+            if (xv_p == xv_port) {
+              port_found = 1;
+              break;
+            }
+          }
+        }
+      }
+      if (port_found) {
+        if (XvGrabPort(mDisplay, xv_port, CurrentTime))
+          xv_port = 0;
+      } else {
+        mp_msg(MSGT_VO, MSGL_WARN,"Xv: Invalid port parameter, overriding with port 0\n");
         xv_port = 0;
+      }
     }
    
     for (i = 0; i < adaptors && xv_port == 0; i++){


More information about the MPlayer-dev-eng mailing list