annotate gui/app/cfg.c @ 37165:681c7f805a23

Double-check that we are really at audio EOF by trying to refill. Somewhat improves trac #2196.
author reimar
date Sun, 31 Aug 2014 09:33:38 +0000
parents ae4f30c4ef02
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
2 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
5 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
7 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
8 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
12 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
13 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
14 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26422
diff changeset
17 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18
34562
fe172cd7b8e8 Add some missing #includes to cfg.c.
ib
parents: 34561
diff changeset
19 #include <stdio.h>
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21 #include <string.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
22
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
23 #include "cfg.h"
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 34708
diff changeset
24 #include "gui.h"
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35521
diff changeset
25 #include "gui/interface.h"
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35521
diff changeset
26 #include "gui/util/list.h"
37024
0790f864cea2 Add a file for miscellaneous auxiliary functions.
ib
parents: 36829
diff changeset
27 #include "gui/util/misc.h"
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35521
diff changeset
28 #include "gui/util/string.h"
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
29
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
30 #include "config.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
31 #include "help_mp.h"
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
32 #include "mixer.h"
33768
cee9987bc81d Remove guiExit().
ib
parents: 33751
diff changeset
33 #include "mp_core.h"
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
34 #include "mp_msg.h"
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
35 #include "mpcommon.h"
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
36 #include "mplayer.h"
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
37 #include "parser-cfg.h"
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
38 #include "path.h"
36032
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35870
diff changeset
39 #include "libavutil/common.h"
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35870
diff changeset
40 #include "libmpcodecs/vd.h"
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35870
diff changeset
41 #include "libmpdemux/demuxer.h"
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35870
diff changeset
42 #include "libvo/video_out.h"
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35870
diff changeset
43 #include "libvo/x11_common.h"
34562
fe172cd7b8e8 Add some missing #includes to cfg.c.
ib
parents: 34561
diff changeset
44 #include "stream/stream.h"
fe172cd7b8e8 Add some missing #includes to cfg.c.
ib
parents: 34561
diff changeset
45 #include "sub/ass_mp.h"
32981
6e22bcc85ac5 Cosmetic: Add required include files.
ib
parents: 32467
diff changeset
46 #include "sub/font_load.h"
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
47 #include "sub/sub.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
36429
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
49 guiTV_t guiTV[2] = {
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
50 { STREAMTYPE_TV, "tv" },
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
51 { STREAMTYPE_DVB, "dvb" }
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
52 };
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
53
33265
62c0471bcf8c Free config.
ib
parents: 33264
diff changeset
54 m_config_t *gui_conf;
62c0471bcf8c Free config.
ib
parents: 33264
diff changeset
55
33220
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
56 int gtkCacheOn;
33180
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
57 int gtkCacheSize = 2048;
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
58
33220
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
59 int gtkVfPP;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60
33249
8fc02babf810 Limit config option vf_lavc to dxr3.
ib
parents: 33242
diff changeset
61 int gtkVfLAVC;
33180
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
62 char *gtkDXR3Device;
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
63
33220
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
64 int gtkAutoSyncOn;
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
65 int gtkAutoSync;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66
33220
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
67 int gtkAONorm;
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
68 int gtkAOSurround;
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
69 int gtkAOExtraStereo;
33221
9920df91c2b7 Make initial value explicitly type float.
ib
parents: 33220
diff changeset
70 float gtkAOExtraStereoMul = 1.0f;
33180
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
71
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
72 char *gtkAOALSAMixer;
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
73 char *gtkAOALSAMixerChannel;
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
74 char *gtkAOALSADevice;
33180
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
75
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
76 char *gtkAOOSSMixer;
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
77 char *gtkAOOSSMixerChannel;
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
78 char *gtkAOOSSDevice;
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
79
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
80 char *gtkAOESDDevice;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81
33180
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
82 char *gtkAOSDLDriver;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83
33220
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
84 int gtkEnableAudioEqualizer;
33747
e5959dcf8fe6 Remove config related variables from interface.[ch].
ib
parents: 33742
diff changeset
85 float gtkEquChannels[6][10];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86
33220
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
87 int gtkSubDumpMPSub;
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
88 int gtkSubDumpSrt;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89
33180
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
90 gtkASS_t gtkASS;
422e5d306d44 Group and sort configuration variable definitions.
ib
parents: 33179
diff changeset
91
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 34708
diff changeset
92 int gtkEnablePlayBar = True;
33220
f17e21799261 Remove needless explicit initialization.
ib
parents: 33218
diff changeset
93 int gtkLoadFullscreen;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 34708
diff changeset
94 int gtkShowVideoWindow = True;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 34708
diff changeset
96 int gui_save_pos = True;
34698
456784c6c904 Cosmetic: Adjust indent.
ib
parents: 34697
diff changeset
97 int gui_main_pos_x = -3;
456784c6c904 Cosmetic: Adjust indent.
ib
parents: 34697
diff changeset
98 int gui_main_pos_y = -3;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
99 int gui_video_pos_x = -3;
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
100 int gui_video_pos_y = -3;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101
36429
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
102 int gui_tv_digital = True;
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
103
33747
e5959dcf8fe6 Remove config related variables from interface.[ch].
ib
parents: 33742
diff changeset
104 int guiWinID = -1;
e5959dcf8fe6 Remove config related variables from interface.[ch].
ib
parents: 33742
diff changeset
105
e5959dcf8fe6 Remove config related variables from interface.[ch].
ib
parents: 33742
diff changeset
106 char *skinName;
e5959dcf8fe6 Remove config related variables from interface.[ch].
ib
parents: 33742
diff changeset
107
33751
c28c967e40e9 Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents: 33750
diff changeset
108 char *fsHistory[5];
33750
8b5898908212 Remove variable holding history of selected files from interface.[ch].
ib
parents: 33748
diff changeset
109
34596
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
110 static const char gui_configuration[] = "gui.conf";
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
111 static const char gui_history[] = "gui.history";
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
112 static const char gui_playlist[] = "gui.pl";
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
113 static const char gui_urllist[] = "gui.url";
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
114
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
115 static const m_option_t gui_opts[] = {
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
116 { "cache", &gtkCacheOn, CONF_TYPE_FLAG, 0, 0, 1, NULL },
34707
0a4b7681a408 Update GUI code after r34792.
ib
parents: 34698
diff changeset
117 { "cache_size", &gtkCacheSize, CONF_TYPE_INT, CONF_RANGE, 32, 0x7fffffff, NULL },
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
118
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
119 { "vf_pp", &gtkVfPP, CONF_TYPE_FLAG, 0, 0, 1, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
120
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27359
diff changeset
121 #ifdef CONFIG_DXR3
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
122 { "vf_lavc", &gtkVfLAVC, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
123 { "vo_dxr3_device", &gtkDXR3Device, CONF_TYPE_STRING, 0, 0, 0, NULL },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
126 { "autosync", &gtkAutoSyncOn, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
127 { "autosync_size", &gtkAutoSync, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
129 { "ao_volnorm", &gtkAONorm, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
130 { "ao_surround", &gtkAOSurround, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
131 { "ao_extra_stereo", &gtkAOExtraStereo, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
132 { "ao_extra_stereo_coefficient", &gtkAOExtraStereoMul, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
133
27390
9d95dc936e66 Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents: 27387
diff changeset
134 #ifdef CONFIG_ALSA
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
135 { "ao_alsa_mixer", &gtkAOALSAMixer, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
136 { "ao_alsa_mixer_channel", &gtkAOALSAMixerChannel, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
137 { "ao_alsa_device", &gtkAOALSADevice, CONF_TYPE_STRING, 0, 0, 0, NULL },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 #endif
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
139
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
140 #ifdef CONFIG_OSS_AUDIO
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
141 { "ao_oss_mixer", &gtkAOOSSMixer, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
142 { "ao_oss_mixer_channel", &gtkAOOSSMixerChannel, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
143 { "ao_oss_device", &gtkAOOSSDevice, CONF_TYPE_STRING, 0, 0, 0, NULL },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144 #endif
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
145
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
146 #ifdef CONFIG_ESD
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
147 { "ao_esd_device", &gtkAOESDDevice, CONF_TYPE_STRING, 0, 0, 0, NULL },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
150 #ifdef CONFIG_SDL
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
151 { "ao_sdl_subdriver", &gtkAOSDLDriver, CONF_TYPE_STRING, 0, 0, 0, NULL },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
154 { "enable_audio_equ", &gtkEnableAudioEqualizer, CONF_TYPE_FLAG, 0, 0, 1, NULL },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
156 { "equ_channel_1", &gtkEquChannel1, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
157 { "equ_channel_2", &gtkEquChannel2, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
158 { "equ_channel_3", &gtkEquChannel3, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
159 { "equ_channel_4", &gtkEquChannel4, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
160 { "equ_channel_5", &gtkEquChannel5, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
161 { "equ_channel_6", &gtkEquChannel6, CONF_TYPE_STRING, 0, 0, 0, NULL },
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
162
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
163 #define audio_equ_row(i, j) \
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
164 { "equ_band_" # i # j, &gtkEquChannels[i][j], CONF_TYPE_FLOAT, CONF_RANGE, -15.0, 15.0, NULL }
33289
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33265
diff changeset
165 audio_equ_row(0, 0), audio_equ_row(0, 1), audio_equ_row(0, 2), audio_equ_row(0, 3), audio_equ_row(0, 4), audio_equ_row(0, 5), audio_equ_row(0, 6), audio_equ_row(0, 7), audio_equ_row(0, 8), audio_equ_row(0, 9),
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33265
diff changeset
166 audio_equ_row(1, 0), audio_equ_row(1, 1), audio_equ_row(1, 2), audio_equ_row(1, 3), audio_equ_row(1, 4), audio_equ_row(1, 5), audio_equ_row(1, 6), audio_equ_row(1, 7), audio_equ_row(1, 8), audio_equ_row(1, 9),
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33265
diff changeset
167 audio_equ_row(2, 0), audio_equ_row(2, 1), audio_equ_row(2, 2), audio_equ_row(2, 3), audio_equ_row(2, 4), audio_equ_row(2, 5), audio_equ_row(2, 6), audio_equ_row(2, 7), audio_equ_row(2, 8), audio_equ_row(2, 9),
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33265
diff changeset
168 audio_equ_row(3, 0), audio_equ_row(3, 1), audio_equ_row(3, 2), audio_equ_row(3, 3), audio_equ_row(3, 4), audio_equ_row(3, 5), audio_equ_row(3, 6), audio_equ_row(3, 7), audio_equ_row(3, 8), audio_equ_row(3, 9),
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33265
diff changeset
169 audio_equ_row(4, 0), audio_equ_row(4, 1), audio_equ_row(4, 2), audio_equ_row(4, 3), audio_equ_row(4, 4), audio_equ_row(4, 5), audio_equ_row(4, 6), audio_equ_row(4, 7), audio_equ_row(4, 8), audio_equ_row(4, 9),
be7d8c249dfd Cosmetic: uncrustify related indent adjustments
ib
parents: 33265
diff changeset
170 audio_equ_row(5, 0), audio_equ_row(5, 1), audio_equ_row(5, 2), audio_equ_row(5, 3), audio_equ_row(5, 4), audio_equ_row(5, 5), audio_equ_row(5, 6), audio_equ_row(5, 7), audio_equ_row(5, 8), audio_equ_row(5, 9),
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 #undef audio_equ_row
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
173 { "playbar", &gtkEnablePlayBar, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
174 { "load_fullscreen", &gtkLoadFullscreen, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
175 { "show_videowin", &gtkShowVideoWindow, CONF_TYPE_FLAG, 0, 0, 1, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
176
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
177 { "gui_save_pos", &gui_save_pos, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
178 { "gui_main_pos_x", &gui_main_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
179 { "gui_main_pos_y", &gui_main_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
180 { "gui_video_out_pos_x", &gui_video_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
181 { "gui_video_out_pos_y", &gui_video_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
182
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
183 { "idle", &player_idle_mode, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL },
33477
49d9967970c0 Add option '-idle' to the GUI configuration file.
ib
parents: 33476
diff changeset
184
36429
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
185 #ifdef CONFIG_TV
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
186 { "gui_tv_digital", &gui_tv_digital, CONF_TYPE_FLAG, 0, 0, 1, NULL },
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
187 #endif
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
188
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
189 // NOTE TO MYSELF: Do we really need all/any non-gtkOptions, i.e. override mplayer options?
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
190
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
191 { "gui_skin", &skinName, CONF_TYPE_STRING, 0, 0, 0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
192
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
193 { "stopxscreensaver", &stop_xscreensaver, CONF_TYPE_FLAG, 0, 0, 1, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
194
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
195 { "cdrom_device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
196 { "dvd_device", &dvd_device, CONF_TYPE_STRING, 0, 0, 0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
197
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
198 { "osd_level", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
199
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
200 { "vo_driver", &video_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
201 { "v_vfm", &video_fm_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
202
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
203 { "vf_autoq", &auto_quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
204 { "vo_direct_render", &vo_directrendering, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
205 { "vo_doublebuffering", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
206 { "vo_panscan", &vo_panscan, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 1.0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
207
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
208 { "v_flip", &flip, CONF_TYPE_INT, CONF_RANGE, -1, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
209 { "v_framedrop", &frame_dropping, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
210 { "v_idx", &index_mode, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
211 { "v_ni", &force_ni, CONF_TYPE_FLAG, 0, 0, 1, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
212
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
213 { "ao_driver", &audio_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
214 { "a_afm", &audio_fm_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
215
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
216 { "softvol", &soft_vol, CONF_TYPE_FLAG, 0, 0, 1, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
217
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
218 { "sub_auto_load", &sub_auto, CONF_TYPE_FLAG, 0, 0, 1, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
219 #ifdef CONFIG_ICONV
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
220 { "sub_cp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
221 #endif
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
222 { "sub_overlap", &suboverlap_enabled, CONF_TYPE_FLAG, 0, 0, 0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
223 { "sub_pos", &sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 200, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
224 { "sub_unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL },
36544
cc8102c4ca83 Add option 'sub_utf8' to the GUI configuration file.
ib
parents: 36429
diff changeset
225 { "sub_utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
226
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
227 { "font_factor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
228 { "font_name", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
229
36730
8bc4d669c5d7 Enable option font_encoding without freetype.
ib
parents: 36694
diff changeset
230 { "font_encoding", &subtitle_font_encoding, CONF_TYPE_STRING, 0, 0, 0, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
231 #ifdef CONFIG_FREETYPE
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
232 { "font_text_scale", &text_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 100.0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
233 { "font_osd_scale", &osd_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 100.0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
234 { "font_blur", &subtitle_font_radius, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 8.0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
235 { "font_outline", &subtitle_font_thickness, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 8.0, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
236 { "font_autoscale", &subtitle_autoscale, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
237 #endif
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
238
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
239 #ifdef CONFIG_ASS
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
240 { "ass_enabled", &ass_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL },
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
241 { "ass_use_margins", &ass_use_margins, CONF_TYPE_FLAG, 0, 0, 1, NULL },
36829
677d96fe1b93 Enable setting full ass margin value ranges.
ib
parents: 36730
diff changeset
242 { "ass_top_margin", &ass_top_margin, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL },
677d96fe1b93 Enable setting full ass margin value ranges.
ib
parents: 36730
diff changeset
243 { "ass_bottom_margin", &ass_bottom_margin, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL },
33223
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
244 #endif
6197c605769e Rearrange GUI options.
ib
parents: 33221
diff changeset
245
34708
c4c333e49d29 Cosmetic: Adjust indent.
ib
parents: 34707
diff changeset
246 { NULL, NULL, 0, 0, 0, 0, NULL }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 };
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248
35521
baf53d200292 Avoid using local variables named filename.
ib
parents: 35493
diff changeset
249 int cfg_gui_include(m_option_t *conf, const char *file)
33470
90e5f5c28304 Add option '-gui-include'.
ib
parents: 33370
diff changeset
250 {
90e5f5c28304 Add option '-gui-include'.
ib
parents: 33370
diff changeset
251 (void)conf;
90e5f5c28304 Add option '-gui-include'.
ib
parents: 33370
diff changeset
252
35521
baf53d200292 Avoid using local variables named filename.
ib
parents: 35493
diff changeset
253 return m_config_parse_config_file(gui_conf, file, 0);
33470
90e5f5c28304 Add option '-gui-include'.
ib
parents: 33370
diff changeset
254 }
90e5f5c28304 Add option '-gui-include'.
ib
parents: 33370
diff changeset
255
34561
f744357e94bd Make cfg_read() and cfg_write() void functions.
ib
parents: 34560
diff changeset
256 void cfg_read(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257 {
34580
065029b847e5 Move buffer at top of function and rename it.
ib
parents: 34579
diff changeset
258 char *fname, line[512];
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
259 FILE *file;
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
260
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 34708
diff changeset
261 player_idle_mode = True; // GUI is in idle mode by default
33476
d068eac6cbf9 Make option '-noidle' working for the GUI.
ib
parents: 33470
diff changeset
262
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
263 /* configuration */
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
264
34596
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
265 fname = get_path(gui_configuration);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
266
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
267 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[cfg] file: %s\n", fname);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
268
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
269 gui_conf = m_config_new();
33480
e413b573e4ec Check error when creating the GUI config object.
ib
parents: 33478
diff changeset
270
e413b573e4ec Check error when creating the GUI config object.
ib
parents: 33478
diff changeset
271 if (!gui_conf) {
e413b573e4ec Check error when creating the GUI config object.
ib
parents: 33478
diff changeset
272 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
33768
cee9987bc81d Remove guiExit().
ib
parents: 33751
diff changeset
273 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
33480
e413b573e4ec Check error when creating the GUI config object.
ib
parents: 33478
diff changeset
274 }
e413b573e4ec Check error when creating the GUI config object.
ib
parents: 33478
diff changeset
275
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
276 m_config_register_options(gui_conf, gui_opts);
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
277
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
278 if (!disable_gui_conf && (m_config_parse_config_file(gui_conf, fname, 1) < 0)) {
34577
22887c794c02 In case of a GUI config error, exit MPlayer with error.
ib
parents: 34576
diff changeset
279 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_ConfigFileError "\n");
22887c794c02 In case of a GUI config error, exit MPlayer with error.
ib
parents: 34576
diff changeset
280 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
281 }
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
282
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
283 free(fname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
285 /* playlist */
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
286
34596
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
287 fname = get_path(gui_playlist);
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
288 file = fopen(fname, "rt");
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
289
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
290 if (file) {
34581
dba158d9b986 Simplify end-of-file detection.
ib
parents: 34580
diff changeset
291 while (fgetstr(line, sizeof(line), file)) {
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
292 plItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
293
34588
94a4e81f214a Prevent reading empty lines.
ib
parents: 34587
diff changeset
294 if (!*line)
94a4e81f214a Prevent reading empty lines.
ib
parents: 34587
diff changeset
295 continue;
94a4e81f214a Prevent reading empty lines.
ib
parents: 34587
diff changeset
296
37083
ae4f30c4ef02 Determine size from variable declaration.
ib
parents: 37024
diff changeset
297 item = calloc(1, sizeof(*item));
34582
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
298
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
299 if (!item) {
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
300 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
301 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
302 }
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
303
34580
065029b847e5 Move buffer at top of function and rename it.
ib
parents: 34579
diff changeset
304 item->path = strdup(line);
34584
500ea19f03eb Check for playlist errors (path, but no file).
ib
parents: 34583
diff changeset
305
34588
94a4e81f214a Prevent reading empty lines.
ib
parents: 34587
diff changeset
306 if (fgetstr(line, sizeof(line), file) && *line) {
34585
60bf43f94f17 Cosmetic: Adjust indent.
ib
parents: 34584
diff changeset
307 item->name = strdup(line);
34681
42fa91951bd2 Rename PLAYLIST_ITEM_ADD PLAYLIST_ITEM_APPEND.
ib
parents: 34668
diff changeset
308 listMgr(PLAYLIST_ITEM_APPEND, item);
34584
500ea19f03eb Check for playlist errors (path, but no file).
ib
parents: 34583
diff changeset
309 } else {
500ea19f03eb Check for playlist errors (path, but no file).
ib
parents: 34583
diff changeset
310 free(item->path);
500ea19f03eb Check for playlist errors (path, but no file).
ib
parents: 34583
diff changeset
311 free(item);
500ea19f03eb Check for playlist errors (path, but no file).
ib
parents: 34583
diff changeset
312 }
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
313 }
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
314
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
315 fclose(file);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
316 }
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
317
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
318 free(fname);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
319
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
320 /* URL list */
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
321
34596
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
322 fname = get_path(gui_urllist);
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
323 file = fopen(fname, "rt");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
325 if (file) {
34581
dba158d9b986 Simplify end-of-file detection.
ib
parents: 34580
diff changeset
326 while (fgetstr(line, sizeof(line), file)) {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33530
diff changeset
327 urlItem *item;
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
328
34588
94a4e81f214a Prevent reading empty lines.
ib
parents: 34587
diff changeset
329 if (!*line)
94a4e81f214a Prevent reading empty lines.
ib
parents: 34587
diff changeset
330 continue;
94a4e81f214a Prevent reading empty lines.
ib
parents: 34587
diff changeset
331
37083
ae4f30c4ef02 Determine size from variable declaration.
ib
parents: 37024
diff changeset
332 item = calloc(1, sizeof(*item));
34582
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
333
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
334 if (!item) {
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
335 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed);
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
336 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
337 }
d0617776d506 Check for allocation error.
ib
parents: 34581
diff changeset
338
34580
065029b847e5 Move buffer at top of function and rename it.
ib
parents: 34579
diff changeset
339 item->url = strdup(line);
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34621
diff changeset
340 listMgr(URLLIST_ITEM_ADD, item);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
341 }
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
342
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
343 fclose(file);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 }
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
345
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
346 free(fname);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
347
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
348 /* directory history */
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
349
34596
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
350 fname = get_path(gui_history);
34579
5097d56b31b1 Fix history file read-only fopen mode.
ib
parents: 34578
diff changeset
351 file = fopen(fname, "rt");
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
352
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
353 if (file) {
34586
ebcc8c7e7fda Prevent out-of-bounds array access of fsHistory.
ib
parents: 34585
diff changeset
354 unsigned int i = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355
34581
dba158d9b986 Simplify end-of-file detection.
ib
parents: 34580
diff changeset
356 while (fgetstr(line, sizeof(line), file))
34588
94a4e81f214a Prevent reading empty lines.
ib
parents: 34587
diff changeset
357 if (*line && (i < FF_ARRAY_ELEMS(fsHistory)))
34589
6327e5a74a5e Don't unnecessarily use gstrdup().
ib
parents: 34588
diff changeset
358 fsHistory[i++] = strdup(line);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
359
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
360 fclose(file);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
362
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
363 free(fname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365
34561
f744357e94bd Make cfg_read() and cfg_write() void functions.
ib
parents: 34560
diff changeset
366 void cfg_write(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 {
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
368 char *fname;
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
369 FILE *file;
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
370
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
371 /* configuration */
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
372
34596
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
373 fname = get_path(gui_configuration);
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
374 file = fopen(fname, "wt+");
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
375
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
376 if (file) {
34621
97148652b0c6 Replace for loop with index by while loop with pointer.
ib
parents: 34610
diff changeset
377 const m_option_t *opts = gui_opts;
97148652b0c6 Replace for loop with index by while loop with pointer.
ib
parents: 34610
diff changeset
378
97148652b0c6 Replace for loop with index by while loop with pointer.
ib
parents: 34610
diff changeset
379 while (opts->name) {
97148652b0c6 Replace for loop with index by while loop with pointer.
ib
parents: 34610
diff changeset
380 char *val = m_option_print(opts, opts->p);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
381
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
382 if (val == (char *)-1) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36544
diff changeset
383 gmp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_GUI_MSG_UnableToSaveOption, opts->name);
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
384 val = NULL;
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
385 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
386
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
387 if (val) {
34595
97bf974e7623 Simplify character array definition.
ib
parents: 34594
diff changeset
388 char delim[] = "\"";
34593
83f7a2f8af3b Adjust content of GUI configuration file to MPlayer configuration files.
ib
parents: 34592
diff changeset
389
83f7a2f8af3b Adjust content of GUI configuration file to MPlayer configuration files.
ib
parents: 34592
diff changeset
390 if (!strchr(val, ' '))
83f7a2f8af3b Adjust content of GUI configuration file to MPlayer configuration files.
ib
parents: 34592
diff changeset
391 *delim = 0;
83f7a2f8af3b Adjust content of GUI configuration file to MPlayer configuration files.
ib
parents: 34592
diff changeset
392
34621
97148652b0c6 Replace for loop with index by while loop with pointer.
ib
parents: 34610
diff changeset
393 fprintf(file, "%s=%s%s%s\n", opts->name, delim, val, delim);
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
394 free(val);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
395 }
34621
97148652b0c6 Replace for loop with index by while loop with pointer.
ib
parents: 34610
diff changeset
396
97148652b0c6 Replace for loop with index by while loop with pointer.
ib
parents: 34610
diff changeset
397 opts++;
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
398 }
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
399
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
400 fclose(file);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401 }
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
402
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
403 free(fname);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
404
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
405 /* playlist */
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
406
34596
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
407 fname = get_path(gui_playlist);
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
408 file = fopen(fname, "wt+");
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
409
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
410 if (file) {
34667
7c447e9db447 Remove global variable pointing to top of playlist.
ib
parents: 34663
diff changeset
411 plItem *item = listMgr(PLAYLIST_GET, 0);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
412
34594
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
413 while (item) {
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
414 if (item->path && item->name) {
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
415 fprintf(file, "%s\n", item->path);
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
416 fprintf(file, "%s\n", item->name);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
417 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
418
34594
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
419 item = item->next;
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
420 }
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
421
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
422 fclose(file);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
423 }
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
424
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
425 free(fname);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
426
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
427 /* URL list */
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
428
34596
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
429 fname = get_path(gui_urllist);
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
430 file = fopen(fname, "wt+");
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
431
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
432 if (file) {
34668
00e8aecfa7ff Remove global variable pointing to top of URL list.
ib
parents: 34667
diff changeset
433 urlItem *item = listMgr(URLLIST_GET, 0);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
434
34594
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
435 while (item) {
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
436 if (item->url)
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
437 fprintf(file, "%s\n", item->url);
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
438
c20ac9b80ea5 Don't destroy list pointers while saving list items.
ib
parents: 34593
diff changeset
439 item = item->next;
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
440 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
441
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
442 fclose(file);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
443 }
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
444
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
445 free(fname);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
446
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
447 /* directory history */
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
448
34596
04feb00f91be Prefer static const char arrays for string constants to #defines.
ib
parents: 34595
diff changeset
449 fname = get_path(gui_history);
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
450 file = fopen(fname, "wt+");
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
451
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
452 if (file) {
34621
97148652b0c6 Replace for loop with index by while loop with pointer.
ib
parents: 34610
diff changeset
453 unsigned int i;
97148652b0c6 Replace for loop with index by while loop with pointer.
ib
parents: 34610
diff changeset
454
35870
26ad65a4e47d Free memory allocated for fsHistory[] elements when GUI ends.
ib
parents: 35525
diff changeset
455 for (i = 0; i < FF_ARRAY_ELEMS(fsHistory); i++) {
26ad65a4e47d Free memory allocated for fsHistory[] elements when GUI ends.
ib
parents: 35525
diff changeset
456 if (fsHistory[i]) {
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
457 fprintf(file, "%s\n", fsHistory[i]);
35870
26ad65a4e47d Free memory allocated for fsHistory[] elements when GUI ends.
ib
parents: 35525
diff changeset
458 free(fsHistory[i]);
26ad65a4e47d Free memory allocated for fsHistory[] elements when GUI ends.
ib
parents: 35525
diff changeset
459 }
26ad65a4e47d Free memory allocated for fsHistory[] elements when GUI ends.
ib
parents: 35525
diff changeset
460 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
461
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
462 fclose(file);
33179
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
463 }
218edd8fc782 Cosmetic: Format to MPlayer coding style.
ib
parents: 32981
diff changeset
464
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34577
diff changeset
465 free(fname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466 }