Mercurial > mplayer.hg
comparison libvo/vo_xv.c @ 4307:c494cc258eb8
Attempt to fix NVidia problems
author | nick |
---|---|
date | Tue, 22 Jan 2002 18:19:02 +0000 |
parents | a20c333d6c09 |
children | 9f8a618e87c3 |
comparison
equal
deleted
inserted
replaced
4306:f11e25b77c1e | 4307:c494cc258eb8 |
---|---|
123 extern int vo_gamma_blue_intense; | 123 extern int vo_gamma_blue_intense; |
124 | 124 |
125 static void set_gamma_correction( unsigned int xv_port ) | 125 static void set_gamma_correction( unsigned int xv_port ) |
126 { | 126 { |
127 XvAttribute *attributes; | 127 XvAttribute *attributes; |
128 int howmany; | 128 int howmany, xv_min,xv_max,xv_atomka; |
129 // get available attributes | 129 static int was_reset = 0; |
130 /* get available attributes */ | |
130 attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany); | 131 attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany); |
132 /* first pass try reset */ | |
133 if(!was_reset) | |
134 for (i = 0; i < howmany && attributes; i++) | |
135 { | |
136 if (attributes[i].flags & XvSettable && !strcmp(attributes[i].name,"XV_SET_DEFAULTS" | |
137 )) | |
138 { | |
139 was_reset = 1; | |
140 if(verbose > 1) printf("vo_xv: reset gamma correction\n"); | |
141 xv_atomka = XInternAtom(mDisplay, attributes[i].name, True); | |
142 XvSetPortAttribute(mDisplay, xv_port, xv_atomka, attributes[i].max_value); | |
143 } | |
144 } | |
145 /* for safety purposes */ | |
146 if(!was_reset) return; | |
131 for (i = 0; i < howmany && attributes; i++) | 147 for (i = 0; i < howmany && attributes; i++) |
132 { | 148 { |
133 if (attributes[i].flags & XvSettable) | 149 if (attributes[i].flags & XvSettable) |
134 { | 150 { |
135 int xv_min,xv_max,xv_atomka; | |
136 xv_min = attributes[i].min_value; | 151 xv_min = attributes[i].min_value; |
137 xv_max = attributes[i].max_value; | 152 xv_max = attributes[i].max_value; |
138 xv_atomka = XInternAtom(mDisplay, attributes[i].name, True); | 153 xv_atomka = XInternAtom(mDisplay, attributes[i].name, True); |
139 // since we have SET_DEFAULTS first in our list, we can check if it's available | 154 /* since we have SET_DEFAULTS first in our list, we can check if it's available |
140 // then trigger it if it's ok so that the other values are at default upon query | 155 then trigger it if it's ok so that the other values are at default upon query */ |
141 if (xv_atomka != None) | 156 if (xv_atomka != None) |
142 { | 157 { |
143 int port_value,port_min,port_max,port_mid; | 158 int port_value,port_min,port_max,port_mid; |
144 if(strcmp(attributes[i].name,"XV_BRIGHTNESS") == 0) | 159 if(strcmp(attributes[i].name,"XV_BRIGHTNESS") == 0) |
145 port_value = vo_gamma_brightness; | 160 port_value = vo_gamma_brightness; |
151 port_value = vo_gamma_contrast; | 166 port_value = vo_gamma_contrast; |
152 else | 167 else |
153 if(strcmp(attributes[i].name,"XV_HUE") == 0) | 168 if(strcmp(attributes[i].name,"XV_HUE") == 0) |
154 port_value = vo_gamma_hue; | 169 port_value = vo_gamma_hue; |
155 else continue; | 170 else continue; |
171 /* means that user has untouched this parameter */ | |
172 if(!port_value) continue; | |
156 port_min = xv_min; | 173 port_min = xv_min; |
157 port_max = xv_max; | 174 port_max = xv_max; |
158 port_mid = (port_min + port_max) / 2; | 175 port_mid = (port_min + port_max) / 2; |
159 port_value = port_mid + (port_value * (port_max - port_min)) / 2000; | 176 port_value = port_mid + (port_value * (port_max - port_min)) / 2000; |
160 if(verbose > 1) | 177 if(verbose > 1) |
180 XvPortID xv_p; | 197 XvPortID xv_p; |
181 | 198 |
182 XGCValues xgcv; | 199 XGCValues xgcv; |
183 XSetWindowAttributes xswa; | 200 XSetWindowAttributes xswa; |
184 unsigned long xswamask; | 201 unsigned long xswamask; |
185 XvAttribute *attributes; | |
186 int howmany, j, notyetset = 0; | |
187 | 202 |
188 aspect_save_orig(width,height); | 203 aspect_save_orig(width,height); |
189 aspect_save_prescale(d_width,d_height); | 204 aspect_save_prescale(d_width,d_height); |
190 | 205 |
191 image_height = height; | 206 image_height = height; |