comparison libvo/vo_xv.c @ 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 3aea64e0d6d9
children ca838366710d
comparison
equal deleted inserted replaced
10825:b9bbfd4a0acc 10826:ea6a03614754
591 static uint32_t preinit(const char *arg) 591 static uint32_t preinit(const char *arg)
592 { 592 {
593 XvPortID xv_p; 593 XvPortID xv_p;
594 int busy_ports=0; 594 int busy_ports=0;
595 595
596 xv_port = 0;
597
596 if(arg) 598 if(arg)
597 { 599 {
598 mp_msg(MSGT_VO,MSGL_ERR,"vo_xv: Unknown subdevice: %s\n",arg); 600 if ((strlen(arg) >= 6) && !strncmp(arg, "port=", 5))
599 return ENOSYS; 601 {
602 xv_port = atoi(arg+5);
603 }
604 else
605 {
606 mp_msg(MSGT_VO,MSGL_ERR,"vo_xv: Unknown subdevice: %s\n",arg);
607 return ENOSYS;
608 }
600 } 609 }
601 if (!vo_init()) return -1; 610 if (!vo_init()) return -1;
602 611
603 xv_port = 0;
604 /* check for Xvideo extension */ 612 /* check for Xvideo extension */
605 if (Success != XvQueryExtension(mDisplay,&ver,&rel,&req,&ev,&err)){ 613 if (Success != XvQueryExtension(mDisplay,&ver,&rel,&req,&ev,&err)){
606 mp_msg(MSGT_VO,MSGL_ERR,"Sorry, Xv not supported by this X11 version/driver\n"); 614 mp_msg(MSGT_VO,MSGL_ERR,"Sorry, Xv not supported by this X11 version/driver\n");
607 mp_msg(MSGT_VO,MSGL_ERR,"******** Try with -vo x11 or -vo sdl *********\n"); 615 mp_msg(MSGT_VO,MSGL_ERR,"******** Try with -vo x11 or -vo sdl *********\n");
608 return -1; 616 return -1;
609 } 617 }
610 618
611 /* check for Xvideo support */ 619 /* check for Xvideo support */
612 if (Success != XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay), &adaptors,&ai)){ 620 if (Success != XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay), &adaptors,&ai)){
613 mp_msg(MSGT_VO,MSGL_ERR,"Xv: XvQueryAdaptors failed"); 621 mp_msg(MSGT_VO,MSGL_ERR,"Xv: XvQueryAdaptors failed\n");
614 return -1; 622 return -1;
615 } 623 }
616 624
617 /* check adaptors */ 625 /* check adaptors */
626 if(xv_port >= adaptors)
627 {
628 mp_msg(MSGT_VO, MSGL_WARN,"Xv: Invalid port parameter, overriding with port 0\n");
629 xv_port = 0;
630 }
631 if (xv_port)
632 {
633 if (XvGrabPort(mDisplay, xv_port, CurrentTime))
634 xv_port = 0;
635 }
636
618 for (i = 0; i < adaptors && xv_port == 0; i++){ 637 for (i = 0; i < adaptors && xv_port == 0; i++){
619 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) { 638 if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) {
620 for (xv_p = ai[i].base_id; xv_p < ai[i].base_id+ai[i].num_ports; ++xv_p) 639 for (xv_p = ai[i].base_id; xv_p < ai[i].base_id+ai[i].num_ports; ++xv_p)
621 if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) { 640 if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) {
622 xv_port = xv_p; 641 xv_port = xv_p;