From 7b94d58c45752016e641f2a31b38d19483b6772e Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 22 Jan 2002 18:19:02 +0000 Subject: Attempt to fix NVidia problems git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4308 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_xv.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'libvo/vo_xv.c') diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index ef9f2f0a92..5357f5f2f8 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -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); -- cgit v1.2.3