Web lists-archives.org

[MPlayer-dev-eng] [PATCH] Xv Adaptor Selection




Hi,

Attached patch adds a new suboption to -vo xv, that can be used to
choose which Xv adaptor
to use to render a video. It is normally possible to do the same
through -vo xv:port=%d
but you need to know which port has been mapped to your adaptor and
it's a bit more complicated
(at least, less user friendly).

It is particularly useful not to choose Adaptor #0 (default) as, for
weird reason, most of
nowadays Xorg drivers tend to have the texture blitting engine as #0
and the genuine overlay engine as #1
(and overlay engine supports much more features and works far better,
for example, using i945 Intel cards
and above, the default renderer causes nasty tearing effects).

If it's OK by everyone, I'll commit such a patch within the week
(with updated doc and the necessary changes for XvMC too).

Ben

-- 
"My life, and by extension everyone else's is meaningless."
Bender, Futurama
Index: libvo/vo_xv.c
===================================================================
--- libvo/vo_xv.c	(revision 26748)
+++ libvo/vo_xv.c	(working copy)
@@ -724,11 +757,13 @@
     unsigned int i;
     strarg_t ck_src_arg = { 0, NULL };
     strarg_t ck_method_arg = { 0, NULL };
-
+    int xv_adaptor = -1;
+    
     opt_t subopts[] =
     {  
       /* name         arg type     arg var         test */
       {  "port",      OPT_ARG_INT, &xv_port,       (opt_test_f)int_pos },
+      {  "adaptor",   OPT_ARG_INT, &xv_adaptor,    (opt_test_f)int_non_neg },
       {  "ck",        OPT_ARG_STR, &ck_src_arg,    xv_test_ck },
       {  "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm },
       {  NULL }
@@ -799,6 +834,10 @@
 
     for (i = 0; i < adaptors && xv_port == 0; i++)
     {
+        /* check of adaptor number has been specified */
+        if (xv_adaptor != -1 && xv_adaptor != i)
+          continue;
+      
         if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask))
         {
             for (xv_p = ai[i].base_id;
@@ -806,6 +845,8 @@
                 if (!XvGrabPort(mDisplay, xv_p, CurrentTime))
                 {
                     xv_port = xv_p;
+                    mp_msg(MSGT_VO, MSGL_INFO,
+                           MSGTR_LIBVO_XV_Adaptor, i, ai[i].name);
                     break;
                 } else
                 {
Index: help/help_mp-en.h
===================================================================
--- help/help_mp-en.h	(revision 26748)
+++ help/help_mp-en.h	(working copy)
@@ -1954,6 +1954,7 @@
 "[VO_XV] DOCS/HTML/en/video.html#xv!\n"\
 "[VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.\n"\
 "[VO_XV] Try -vo x11.\n"
+#define MSGTR_LIBVO_XV_Adaptor "[VO_XV] Using Xv Adaptor #%d (%s)\n"
 
 
 // loader/ldt_keeper.c
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng