2 * MPlayer GUI for Win32
3 * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
4 * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
5 * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
7 * This file is part of MPlayer.
9 * MPlayer is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * MPlayer is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 #include "libvo/video_out.h"
35 #include "gui/mplayer/gmplayer.h"
36 #include "gui/interface.h"
41 int gtkAOExtraStereo
= 0;
42 float gtkAOExtraStereoMul
= 1.0;
44 int gtkCacheSize
= 2048;
45 int gtkAutoSyncOn
= 0;
52 int gui_main_pos_x
= -2;
53 int gui_main_pos_y
= -2;
54 int gui_sub_pos_x
= -1;
55 int gui_sub_pos_y
= -1;
57 /* External functions */
58 extern char *proc_priority
;
59 int m_config_parse_config_file(m_config_t
*config
, char *conffile
);
61 static m_config_t
*gui_conf
;
62 static const m_option_t gui_opts
[] =
64 { "priority", &proc_priority
, CONF_TYPE_STRING
, 0, 0, 0, NULL
},
65 { "vo_driver", &video_driver_list
, CONF_TYPE_STRING_LIST
, 0, 0, 0, NULL
},
66 { "v_framedrop", &frame_dropping
, CONF_TYPE_INT
, CONF_RANGE
, 0, 2, NULL
},
67 { "vo_doublebuffering", &vo_doublebuffering
, CONF_TYPE_FLAG
, 0, 0, 1, NULL
},
68 { "vo_direct_render", &vo_directrendering
, CONF_TYPE_FLAG
, 0, 0, 1, NULL
},
69 { "ao_driver", &audio_driver_list
, CONF_TYPE_STRING_LIST
, 0, 0, 0, NULL
},
70 { "ao_volnorm", >kAONorm
, CONF_TYPE_FLAG
, 0, 0, 1, NULL
},
71 { "softvol", &soft_vol
, CONF_TYPE_FLAG
, 0, 0, 1, NULL
},
72 { "ao_extra_stereo", >kAOExtraStereo
, CONF_TYPE_FLAG
, 0, 0, 1, NULL
},
73 { "ao_extra_stereo_coefficient", >kAOExtraStereoMul
, CONF_TYPE_FLOAT
, CONF_RANGE
, -10, 10, NULL
},
74 { "delay", &audio_delay
, CONF_TYPE_FLOAT
, CONF_RANGE
, -100.0, 100.0, NULL
},
75 { "dvd_device", &dvd_device
, CONF_TYPE_STRING
, 0, 0, 0, NULL
},
76 { "cdrom_device", &cdrom_device
, CONF_TYPE_STRING
, 0, 0, 0, NULL
},
77 { "osd_level", &osd_level
, CONF_TYPE_INT
, CONF_RANGE
, 0, 3, NULL
},
78 { "cache", >kCacheOn
, CONF_TYPE_FLAG
, 0, 0, 1, NULL
},
79 { "cache_size", >kCacheSize
, CONF_TYPE_INT
, CONF_RANGE
, -1, 65535, NULL
},
80 { "autosync", >kAutoSyncOn
, CONF_TYPE_FLAG
, 0, 0, 1, NULL
},
81 { "autosync_size", >kAutoSync
, CONF_TYPE_INT
, CONF_RANGE
, 0, 10000, NULL
},
82 { "gui_skin", &skinName
, CONF_TYPE_STRING
, 0, 0, 0, NULL
},
83 { "gui_main_pos_x", &gui_main_pos_x
, CONF_TYPE_INT
, 0, 0, 0, NULL
},
84 { "gui_main_pos_y", &gui_main_pos_y
, CONF_TYPE_INT
, 0, 0, 0, NULL
},
85 { "gui_sub_pos_x", &gui_sub_pos_x
, CONF_TYPE_INT
, 0, 0, 0, NULL
},
86 { "gui_sub_pos_y", &gui_sub_pos_y
, CONF_TYPE_INT
, 0, 0, 0, NULL
},
87 { "sub_window", &sub_window
, CONF_TYPE_FLAG
, 0, 0, 1, NULL
},
88 { "console", &console
, CONF_TYPE_FLAG
, 0, 0, 1, NULL
},
89 { NULL
, NULL
, 0, 0, 0, 0, NULL
}
92 char *gfgets(char *str
, int size
, FILE *f
)
94 char *s
= fgets(str
, size
, f
);
99 if ((c
== '\n') || (c
== '\r'))
101 c
= s
[strlen(s
) - 1];
102 if ((c
== '\n') || (c
== '\r'))
110 char *cfg
= get_path("gui.conf");
112 /* read configuration */
113 mp_msg(MSGT_GPLAYER
, MSGL_V
, "[GUI] [cfg] reading config file: %s\n", cfg
);
114 gui_conf
= m_config_new();
115 m_config_register_options(gui_conf
, gui_opts
);
116 if (m_config_parse_config_file(gui_conf
, cfg
) < 0)
117 mp_msg(MSGT_GPLAYER
, MSGL_FATAL
, MSGTR_ConfigFileError
);
124 char *cfg
= get_path("gui.conf");
128 /* save configuration */
129 if ((f
= fopen(cfg
, "wt+")))
131 for (i
=0; gui_opts
[i
].name
; i
++)
133 char *v
= m_option_print(&gui_opts
[i
], gui_opts
[i
].p
);
134 if(v
== (char *)-1) {
135 mp_msg(MSGT_GPLAYER
, MSGL_WARN
, MSGTR_UnableToSaveOption
, gui_opts
[i
].name
);
140 fprintf(f
, "%s = \"%s\"\n", gui_opts
[i
].name
, v
);