changeset 4307:c494cc258eb8

Attempt to fix NVidia problems
author nick
date Tue, 22 Jan 2002 18:19:02 +0000
parents f11e25b77c1e
children d752f99fd535
files libvo/vo_xv.c
diffstat 1 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xv.c	Tue Jan 22 18:12:00 2002 +0000
+++ b/libvo/vo_xv.c	Tue Jan 22 18:19:02 2002 +0000
@@ -125,19 +125,34 @@
 static void set_gamma_correction( unsigned int xv_port )
 {
  XvAttribute *attributes;
- int howmany;
-// get available attributes
+ int howmany, xv_min,xv_max,xv_atomka;
+ static int was_reset = 0;
+/* get available attributes */
      attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany);
+     /* first pass try reset */
+     if(!was_reset)
+     for (i = 0; i < howmany && attributes; i++)
+     {
+            if (attributes[i].flags & XvSettable && !strcmp(attributes[i].name,"XV_SET_DEFAULTS"
+))
+            {
+		was_reset = 1;
+		if(verbose > 1) printf("vo_xv: reset gamma correction\n");
+                xv_atomka = XInternAtom(mDisplay, attributes[i].name, True);
+                XvSetPortAttribute(mDisplay, xv_port, xv_atomka, attributes[i].max_value);
+	    }
+     }
+     /* for safety purposes */
+     if(!was_reset) return;
      for (i = 0; i < howmany && attributes; i++)
      {
             if (attributes[i].flags & XvSettable)
             {
-		int xv_min,xv_max,xv_atomka;
                 xv_min = attributes[i].min_value;
                 xv_max = attributes[i].max_value;
                 xv_atomka = XInternAtom(mDisplay, attributes[i].name, True);
-// since we have SET_DEFAULTS first in our list, we can check if it's available
-// then trigger it if it's ok so that the other values are at default upon query
+/* since we have SET_DEFAULTS first in our list, we can check if it's available
+   then trigger it if it's ok so that the other values are at default upon query */
                 if (xv_atomka != None)
                 {
 		    int port_value,port_min,port_max,port_mid;
@@ -153,6 +168,8 @@
 		    if(strcmp(attributes[i].name,"XV_HUE") == 0)
 				port_value = vo_gamma_hue;
 		    else continue;
+		    /* means that user has untouched this parameter */
+		    if(!port_value) continue;
 		    port_min = xv_min;
 		    port_max = xv_max;
 		    port_mid = (port_min + port_max) / 2;
@@ -182,8 +199,6 @@
  XGCValues xgcv;
  XSetWindowAttributes xswa;
  unsigned long xswamask;
- XvAttribute *attributes;
- int howmany, j, notyetset = 0;
 
  aspect_save_orig(width,height);
  aspect_save_prescale(d_width,d_height);