Ticket #37: set_gamma.diff

File set_gamma.diff, 1.7 KB (added by reimar, 22 years ago)

Different attempt

Line 
1--- mplayer.c 2004-07-20 00:32:02.000000000 +0200
2+++ ../MPlayer-test/mplayer.c 2004-07-22 22:24:00.000000000 +0200
3 current_module="init_vo";
4 if (sh_video)
5 {
6- if (vo_gamma_gamma != 1000)
7- set_video_colors (sh_video, "gamma", vo_gamma_gamma);
8- if (vo_gamma_brightness != 1000)
9- set_video_colors(sh_video, "brightness", vo_gamma_brightness);
10- if (vo_gamma_contrast != 1000)
11- set_video_colors(sh_video, "contrast", vo_gamma_contrast);
12- if (vo_gamma_saturation != 1000)
13- set_video_colors(sh_video, "saturation", vo_gamma_saturation);
14- if (vo_gamma_hue != 1000)
15- set_video_colors(sh_video, "hue", vo_gamma_hue);
16+ char cmd[100];
17+ // numbers are checked to be < 1000, so string should fit in this,
18+ // but initialize anyway to make sure
19+ cmd[99] = 0;
20+ if (vo_gamma_gamma < 1000) {
21+ snprintf(cmd, 99, "gamma %i 1", vo_gamma_gamma);
22+ mp_input_queue_cmd(mp_input_parse_cmd(cmd));
23+ }
24+ if (vo_gamma_brightness < 1000) {
25+ snprintf(cmd, 99, "brightness %i 1", vo_gamma_brightness);
26+ mp_input_queue_cmd(mp_input_parse_cmd(cmd));
27+ }
28+ if (vo_gamma_contrast < 1000) {
29+ snprintf(cmd, 99, "contrast %i 1", vo_gamma_contrast);
30+ mp_input_queue_cmd(mp_input_parse_cmd(cmd));
31+ }
32+ if (vo_gamma_saturation < 1000) {
33+ snprintf(cmd, 99, "saturation %i 1", vo_gamma_saturation);
34+ mp_input_queue_cmd(mp_input_parse_cmd(cmd));
35+ }
36+ if (vo_gamma_hue < 1000) {
37+ snprintf(cmd, 99, "hue %i 1", vo_gamma_hue);
38+ mp_input_queue_cmd(mp_input_parse_cmd(cmd));
39+ }
40 }
41
42 if(vo_flags & 0x08 && vo_spudec)