changeset 10826:ea6a03614754

add port parameter to -vo xv based on patch from Jean-Yves Simon <lethalwp@tiscali.be>
author attila
date Sat, 06 Sep 2003 13:40:00 +0000
parents b9bbfd4a0acc
children 85179ecb5a6e
files libvo/vo_xv.c
diffstat 1 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xv.c	Sat Sep 06 13:36:15 2003 +0000
+++ b/libvo/vo_xv.c	Sat Sep 06 13:40:00 2003 +0000
@@ -593,14 +593,22 @@
     XvPortID xv_p;
     int busy_ports=0;
     
+    xv_port = 0;
+
     if(arg) 
     {
-	mp_msg(MSGT_VO,MSGL_ERR,"vo_xv: Unknown subdevice: %s\n",arg);
-	return ENOSYS;
+	if ((strlen(arg) >= 6) && !strncmp(arg, "port=", 5))
+	{
+	    xv_port = atoi(arg+5);
+	}
+	else
+	{
+	    mp_msg(MSGT_VO,MSGL_ERR,"vo_xv: Unknown subdevice: %s\n",arg);
+	    return ENOSYS;
+	}
     }
     if (!vo_init()) return -1;
 
-    xv_port = 0;
    /* check for Xvideo extension */
     if (Success != XvQueryExtension(mDisplay,&ver,&rel,&req,&ev,&err)){
 	mp_msg(MSGT_VO,MSGL_ERR,"Sorry, Xv not supported by this X11 version/driver\n");
@@ -610,11 +618,22 @@
     
    /* check for Xvideo support */
     if (Success != XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay), &adaptors,&ai)){
-	mp_msg(MSGT_VO,MSGL_ERR,"Xv: XvQueryAdaptors failed");
+	mp_msg(MSGT_VO,MSGL_ERR,"Xv: XvQueryAdaptors failed\n");
 	return -1;
     }
 
    /* check adaptors */
+    if(xv_port >= adaptors)
+    {
+    	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))
+        xv_port = 0;
+    }
+   
     for (i = 0; i < adaptors && xv_port == 0; 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)