[MPlayer-DOCS] r28096 - trunk/DOCS/man/en/mplayer.1

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Dec 5 18:17:37 CET 2008


On Fri, Dec 05, 2008 at 11:07:17AM -0500, compn wrote:
> On Fri,  5 Dec 2008 16:55:25 +0100 (CET), reimar wrote:
> >+\-vo gl:yuv=2:rectangle=2:force\-pbo:ati\-hack \-dr \-noslices
> 
> is it planned to have some autodetection for vo_gl to automatically use
> ati-hack/yuv=2/force-pbo when a card supports it?

Well...
ati-hack:  I am not too fond of auto-detecting bug workarounds and still
           hope that ATI one day will release a driver that is not total crap.
           But if someone told me auto-detection is a really desired
           thing, I think it should be easy.
yuv:       A lot of stuff goes into this, seems hard to do properly.
force-pbo: Probably not. It could be faster or slower, hard to know
           what to do.
rectangle: setting to 2 automatically should not be too hard...

Or you could try attached patch. I have some doubts it will work on
Windows, it might always return Microsoft as vendor.

Greetings,
Reimar Döffinger
-------------- next part --------------
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 736d9f6..5422019 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -392,11 +392,20 @@ static void uninitGl(void) {
   err_shown = 0;
 }
 
+static void autodetectGlExtensions(void) {
+  const char *extensions = glGetString(GL_EXTENSIONS);
+  const char *vendor     = glGetString(GL_VENDOR);
+  if (ati_hack  == -1) ati_hack  = strstr(vendor, "ATI") != NULL;
+  if (force_pbo == -1) force_pbo = strstr(extensions, "_pixel_buffer_object") != NULL;
+  if (rectangle == -1) rectangle = strstr(extensions, "_texture_rectangle") ? 2 : 0;
+}
+
 /**
  * \brief Initialize a (new or reused) OpenGL context.
  * set global gl-related variables to their default values
  */
 static int initGl(uint32_t d_width, uint32_t d_height) {
+  autodetectGlExtensions();
   texSize(image_width, image_height, &texture_width, &texture_height);
 
   glDisable(GL_BLEND); 
@@ -892,10 +901,10 @@ static int preinit(const char *arg)
     lscale = 0;
     cscale = 0;
     filter_strength = 0.5;
-    use_rectangle = 0;
+    use_rectangle = -1;
     use_glFinish = 0;
-    ati_hack = 0;
-    force_pbo = 0;
+    ati_hack = -1;
+    force_pbo = -1;
     swap_interval = 1;
     slice_height = 0;
     custom_prog = NULL;


More information about the MPlayer-DOCS mailing list