Mercurial > mplayer.hg
annotate gui/win32/wincfg.c @ 35319:ba51b077d042
Set CONFIG_LIBXVID up properly.
author | reimar |
---|---|
date | Sat, 10 Nov 2012 15:01:48 +0000 |
parents | 0a4b7681a408 |
children | 7bb176fac55c |
rev | line source |
---|---|
23077 | 1 /* |
23079 | 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> | |
6 * | |
7 * This file is part of MPlayer. | |
8 * | |
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. | |
13 * | |
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. | |
18 * | |
26457 | 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 | |
23079 | 22 */ |
23077 | 23 |
26193
609236ad27f4
more header / declaration cleanups; fixes a lot of warnings as well as a preempt to removal of redundant wincfg.h.
vayne
parents:
25713
diff
changeset
|
24 #include <windows.h> |
23077 | 25 #include <stdlib.h> |
26 #include <string.h> | |
30901 | 27 #include "path.h" |
23123
21e29d5932c5
header / declarations cleanup, also fixes broken compilation.
vayne
parents:
23091
diff
changeset
|
28 #include "mplayer.h" |
23091
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
29 #include "mp_msg.h" |
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
30 #include "help_mp.h" |
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
31 #include "m_config.h" |
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
32 #include "m_option.h" |
32020
6c48f42a9c75
Replace m_config_parse_config_file() forward declaration by proper #include.
diego
parents:
31327
diff
changeset
|
33 #include "parser-cfg.h" |
23091
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
34 #include "libvo/video_out.h" |
32068
ab6ac5b156ca
Replace proc_priority extern declaration by osdep/priority.h #include.
diego
parents:
32020
diff
changeset
|
35 #include "osdep/priority.h" |
23091
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
36 #include "mixer.h" |
33557 | 37 #include "gui/ui/gmplayer.h" |
26372
76413880bfad
Update include paths to account for build system changes.
diego
parents:
26193
diff
changeset
|
38 #include "gui/interface.h" |
26193
609236ad27f4
more header / declaration cleanups; fixes a lot of warnings as well as a preempt to removal of redundant wincfg.h.
vayne
parents:
25713
diff
changeset
|
39 #include "gui.h" |
23077 | 40 |
34596
04feb00f91be
Prefer static const char arrays for string constants to #defines.
ib
parents:
34595
diff
changeset
|
41 static const char gui_configuration[] = "gui.conf"; |
34576 | 42 |
23077 | 43 /* params */ |
44 int gtkAONorm = 0; | |
45 int gtkAOExtraStereo = 0; | |
46 float gtkAOExtraStereoMul = 1.0; | |
47 int gtkCacheOn = 0; | |
48 int gtkCacheSize = 2048; | |
49 int gtkAutoSyncOn = 0; | |
50 int gtkAutoSync = 0; | |
51 | |
34697 | 52 int video_window = 1; |
23077 | 53 int console = 0; |
54 | |
55 int gui_save_pos = 1; | |
56 int gui_main_pos_x = -2; | |
57 int gui_main_pos_y = -2; | |
34697 | 58 int gui_video_pos_x = -1; |
59 int gui_video_pos_y = -1; | |
23077 | 60 |
33297 | 61 m_config_t *gui_conf; |
25713
0fe20154a883
gui_opts should be const for win32 gui as well (why, oh why, was all
reimar
parents:
25712
diff
changeset
|
62 static const m_option_t gui_opts[] = |
23077 | 63 { |
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 { "osd_level", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL }, | |
76 { "cache", >kCacheOn, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
34707 | 77 { "cache_size", >kCacheSize, CONF_TYPE_INT, CONF_RANGE, 32, 0x7fffffff, NULL }, |
23077 | 78 { "autosync", >kAutoSyncOn, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
79 { "autosync_size", >kAutoSync, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL }, | |
80 { "gui_skin", &skinName, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
81 { "gui_main_pos_x", &gui_main_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL }, | |
82 { "gui_main_pos_y", &gui_main_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL }, | |
34697 | 83 { "gui_sub_pos_x", &gui_video_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL }, |
84 { "gui_sub_pos_y", &gui_video_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL }, | |
85 { "sub_window", &video_window, CONF_TYPE_FLAG, 0, 0, 1, NULL}, | |
23077 | 86 { "console", &console, CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
34085 | 87 { "idle", &player_idle_mode, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, |
23077 | 88 { NULL, NULL, 0, 0, 0, 0, NULL } |
89 }; | |
90 | |
33566 | 91 int cfg_gui_include(m_option_t *conf, const char *filename) |
92 { | |
93 (void)conf; | |
94 | |
34193
95f91c9bcc9f
Add missing parameter to Win32 GUI's call to m_config_parse_config_file().
ib
parents:
34085
diff
changeset
|
95 return m_config_parse_config_file(gui_conf, filename, 0); |
33566 | 96 } |
97 | |
34561 | 98 void cfg_read(void) |
23077 | 99 { |
34596
04feb00f91be
Prefer static const char arrays for string constants to #defines.
ib
parents:
34595
diff
changeset
|
100 char *cfg = get_path(gui_configuration); |
23077 | 101 |
34085 | 102 player_idle_mode = 1; // GUI is in idle mode by default |
103 | |
23077 | 104 /* read configuration */ |
105 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] [cfg] reading config file: %s\n", cfg); | |
106 gui_conf = m_config_new(); | |
107 m_config_register_options(gui_conf, gui_opts); | |
34194
280b461a6676
Add missing parameter to Win32 GUI's call to m_config_parse_config_file().
ib
parents:
34193
diff
changeset
|
108 if (m_config_parse_config_file(gui_conf, cfg, 1) < 0) |
34577
22887c794c02
In case of a GUI config error, exit MPlayer with error.
ib
parents:
34576
diff
changeset
|
109 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_ConfigFileError "\n"); |
23077 | 110 free(cfg); |
111 } | |
112 | |
34561 | 113 void cfg_write(void) |
23077 | 114 { |
34596
04feb00f91be
Prefer static const char arrays for string constants to #defines.
ib
parents:
34595
diff
changeset
|
115 char *cfg = get_path(gui_configuration); |
23077 | 116 FILE *f; |
117 int i; | |
118 | |
119 /* save configuration */ | |
120 if ((f = fopen(cfg, "wt+"))) | |
121 { | |
122 for (i=0; gui_opts[i].name; i++) | |
123 { | |
124 char *v = m_option_print(&gui_opts[i], gui_opts[i].p); | |
25712
363e217ce9fd
Win32 gui has the same m_option_print error handling bug
reimar
parents:
23123
diff
changeset
|
125 if(v == (char *)-1) { |
363e217ce9fd
Win32 gui has the same m_option_print error handling bug
reimar
parents:
23123
diff
changeset
|
126 mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_UnableToSaveOption, gui_opts[i].name); |
363e217ce9fd
Win32 gui has the same m_option_print error handling bug
reimar
parents:
23123
diff
changeset
|
127 v = NULL; |
363e217ce9fd
Win32 gui has the same m_option_print error handling bug
reimar
parents:
23123
diff
changeset
|
128 } |
23077 | 129 if(v) |
130 { | |
34595 | 131 char delim[] = "\""; |
34593
83f7a2f8af3b
Adjust content of GUI configuration file to MPlayer configuration files.
ib
parents:
34577
diff
changeset
|
132 |
34626 | 133 if (!strchr(v, ' ')) *delim = 0; |
34593
83f7a2f8af3b
Adjust content of GUI configuration file to MPlayer configuration files.
ib
parents:
34577
diff
changeset
|
134 |
34626 | 135 fprintf(f, "%s=%s%s%s\n", gui_opts[i].name, delim, v, delim); |
23077 | 136 free(v); |
137 } | |
138 } | |
139 fclose(f); | |
140 } | |
141 free(cfg); | |
142 } |