Attempt to fix NVidia problems

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4308 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nick 2002-01-22 18:19:02 +00:00
parent 7f5bcb338f
commit 7b94d58c45
1 changed files with 22 additions and 7 deletions

View File

@ -125,19 +125,34 @@ extern int vo_gamma_blue_intense;
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 @@ static void set_gamma_correction( unsigned int xv_port )
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 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
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);