From 88c924c520c3868b588a2ce78ce5d39b079ce13b Mon Sep 17 00:00:00 2001 From: attila Date: Sat, 6 Sep 2003 13:40:00 +0000 Subject: [PATCH] add port parameter to -vo xv based on patch from Jean-Yves Simon git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10827 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_xv.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index f1b9c2a4f7..e4c2208385 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -593,14 +593,22 @@ static uint32_t preinit(const char *arg) 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 @@ static uint32_t preinit(const char *arg) /* 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)