Parent Directory | Revision Log
Revision 1.23 - (view) (download)
1 : | Isibaar | 1.1 | /************************************************************************** |
2 : | * | ||
3 : | * XVID VFW FRONTEND | ||
4 : | * config | ||
5 : | * | ||
6 : | * This program is free software; you can redistribute it and/or modify | ||
7 : | * it under the terms of the GNU General Public License as published by | ||
8 : | * the Free Software Foundation; either version 2 of the License, or | ||
9 : | * (at your option) any later version. | ||
10 : | * | ||
11 : | * This program is distributed in the hope that it will be useful, | ||
12 : | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 : | * GNU General Public License for more details. | ||
15 : | * | ||
16 : | * You should have received a copy of the GNU General Public License | ||
17 : | * along with this program; if not, write to the Free Software | ||
18 : | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 : | * | ||
20 : | *************************************************************************/ | ||
21 : | |||
22 : | /************************************************************************** | ||
23 : | * | ||
24 : | * History: | ||
25 : | * | ||
26 : | suxen_drol | 1.11 | * 15.06.2002 added bframes options |
27 : | h | 1.10 | * 21.04.2002 fixed custom matrix support, tried to get dll size down |
28 : | h | 1.9 | * 17.04.2002 re-enabled lumi masking in 1st pass |
29 : | h | 1.8 | * 15.04.2002 updated cbr support |
30 : | h | 1.7 | * 07.04.2002 min keyframe interval checkbox |
31 : | * 2-pass max bitrate and overflow customization | ||
32 : | h | 1.6 | * 04.04.2002 interlacing support |
33 : | * hinted ME support | ||
34 : | h | 1.5 | * 24.03.2002 daniel smith <danielsmith@astroboymail.com> |
35 : | * added Foxer's new CBR engine | ||
36 : | * - cbr_buffer is being used as reaction delay (quick hack) | ||
37 : | h | 1.4 | * 23.03.2002 daniel smith <danielsmith@astroboymail.com> |
38 : | * added load defaults button | ||
39 : | * merged foxer's alternative 2-pass code (2-pass alt tab) | ||
40 : | * added proper tooltips | ||
41 : | * moved registry data into reg_ints/reg_strs arrays | ||
42 : | * added DEBUGERR output on errors instead of returning | ||
43 : | h | 1.3 | * 16.03.2002 daniel smith <danielsmith@astroboymail.com> |
44 : | * rewrote/restructured most of file | ||
45 : | * added tooltips (kind of - dirty message hook method) | ||
46 : | * split tabs into a main dialog / advanced prop sheet | ||
47 : | * advanced controls are now enabled/disabled by mode | ||
48 : | * added modulated quantization, DX50 fourcc | ||
49 : | * 11.03.2002 Min Chen <chenm001@163.com> | ||
50 : | * now get Core Version use xvid_init() | ||
51 : | * 05.03.2002 Min Chen <chenm001@163.com> | ||
52 : | * Add Core version display to about box | ||
53 : | suxen_drol | 1.21 | * 01.12.2001 inital version; (c)2001 peter ross <pross@xvid.org> |
54 : | Isibaar | 1.1 | * |
55 : | *************************************************************************/ | ||
56 : | |||
57 : | |||
58 : | #include <windows.h> | ||
59 : | h | 1.3 | #include <commctrl.h> |
60 : | Isibaar | 1.1 | #include <shlobj.h> |
61 : | #include <prsht.h> | ||
62 : | suxen_drol | 1.13 | #ifdef _SMP |
63 : | #include <pthread.h> | ||
64 : | #endif | ||
65 : | Isibaar | 1.1 | |
66 : | Isibaar | 1.20 | #include <xvid.h> // XviD API |
67 : | |||
68 : | Isibaar | 1.1 | #include "codec.h" |
69 : | #include "config.h" | ||
70 : | #include "resource.h" | ||
71 : | h | 1.3 | |
72 : | Isibaar | 1.1 | |
73 : | suxen_drol | 1.13 | |
74 : | h | 1.4 | /* registry info structs */ |
75 : | |||
76 : | CONFIG reg; | ||
77 : | |||
78 : | REG_INT const reg_ints[] = { | ||
79 : | {"mode", ®.mode, DLG_MODE_CBR}, | ||
80 : | {"quality", ®.quality, 85}, | ||
81 : | {"quant", ®.quant, 5}, | ||
82 : | h | 1.8 | {"rc_bitrate", ®.rc_bitrate, 900000}, |
83 : | {"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, | ||
84 : | {"rc_averaging_period", ®.rc_averaging_period, 100}, | ||
85 : | {"rc_buffer", ®.rc_buffer, 100}, | ||
86 : | h | 1.4 | |
87 : | suxen_drol | 1.23 | {"motion_search", ®.motion_search, 6}, |
88 : | h | 1.4 | {"quant_type", ®.quant_type, 0}, |
89 : | {"fourcc_used", ®.fourcc_used, 0}, | ||
90 : | suxen_drol | 1.23 | {"vhq_mode", ®.vhq_mode, 0}, |
91 : | h | 1.4 | {"max_key_interval", ®.max_key_interval, 300}, |
92 : | h | 1.7 | {"min_key_interval", ®.min_key_interval, 1}, |
93 : | h | 1.4 | {"lum_masking", ®.lum_masking, 0}, |
94 : | h | 1.6 | {"interlacing", ®.interlacing, 0}, |
95 : | suxen_drol | 1.23 | {"qpel", ®.qpel, 0}, |
96 : | {"gmc", ®.gmc, 0}, | ||
97 : | {"chromame", ®.chromame, 0}, | ||
98 : | Foxer | 1.18 | //added by koepi for gruel's greyscale_mode |
99 : | {"greyscale", ®.greyscale, 0}, | ||
100 : | // end of koepi's additions | ||
101 : | suxen_drol | 1.12 | {"max_bframes", ®.max_bframes, -1}, |
102 : | suxen_drol | 1.23 | {"bquant_ratio", ®.bquant_ratio, 150}, |
103 : | {"bquant_offset", ®.bquant_offset, 100}, | ||
104 : | suxen_drol | 1.12 | {"packed", ®.packed, 0}, |
105 : | suxen_drol | 1.23 | {"dx50bvop", ®.dx50bvop, 1}, |
106 : | suxen_drol | 1.12 | {"debug", ®.debug, 0}, |
107 : | suxen_drol | 1.23 | {"reduced_resolution", ®.reduced_resolution, 0}, |
108 : | {"chroma_opt", ®.chroma_opt, 0}, | ||
109 : | suxen_drol | 1.14 | {"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
110 : | h | 1.4 | |
111 : | suxen_drol | 1.19 | {"min_iquant", ®.min_iquant, 2}, |
112 : | h | 1.4 | {"max_iquant", ®.max_iquant, 31}, |
113 : | suxen_drol | 1.19 | {"min_pquant", ®.min_pquant, 2}, |
114 : | h | 1.4 | {"max_pquant", ®.max_pquant, 31}, |
115 : | |||
116 : | {"desired_size", ®.desired_size, 570000}, | ||
117 : | suxen_drol | 1.19 | {"keyframe_boost", ®.keyframe_boost, 0}, |
118 : | h | 1.4 | {"discard1pass", ®.discard1pass, 1}, |
119 : | {"dummy2pass", ®.dummy2pass, 0}, | ||
120 : | Foxer | 1.15 | // added by koepi for new two-pass curve treatment |
121 : | {"kftreshold", ®.kftreshold, 10}, | ||
122 : | suxen_drol | 1.23 | {"kfreduction", ®.kfreduction, 20}, |
123 : | Foxer | 1.15 | // end of koepi's additions |
124 : | suxen_drol | 1.23 | {"curve_compression_high", ®.curve_compression_high, 0}, |
125 : | {"curve_compression_low", ®.curve_compression_low, 0}, | ||
126 : | {"use_alt_curve", ®.use_alt_curve, 0}, | ||
127 : | h | 1.4 | {"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
128 : | suxen_drol | 1.19 | {"alt_curve_auto_str", ®.alt_curve_auto_str, 30}, |
129 : | h | 1.4 | {"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
130 : | {"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, | ||
131 : | {"alt_curve_type", ®.alt_curve_type, 1}, | ||
132 : | suxen_drol | 1.19 | {"alt_curve_high_dist", ®.alt_curve_high_dist, 500}, |
133 : | {"alt_curve_low_dist", ®.alt_curve_low_dist, 90}, | ||
134 : | h | 1.4 | {"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
135 : | suxen_drol | 1.19 | {"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
136 : | h | 1.4 | {"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
137 : | h | 1.7 | {"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
138 : | {"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, | ||
139 : | {"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, | ||
140 : | h | 1.6 | {"hinted_me", ®.hinted_me, 0}, |
141 : | h | 1.4 | |
142 : | {"credits_start", ®.credits_start, 0}, | ||
143 : | {"credits_start_begin", ®.credits_start_begin, 0}, | ||
144 : | {"credits_start_end", ®.credits_start_end, 0}, | ||
145 : | {"credits_end", ®.credits_end, 0}, | ||
146 : | {"credits_end_begin", ®.credits_end_begin, 0}, | ||
147 : | {"credits_end_end", ®.credits_end_end, 0}, | ||
148 : | |||
149 : | Foxer | 1.18 | // added by koepi for greyscale credits |
150 : | {"credits_greyscale", ®.credits_greyscale, 0}, | ||
151 : | // end of koepi's addition | ||
152 : | h | 1.4 | {"credits_mode", ®.credits_mode, 0}, |
153 : | {"credits_rate", ®.credits_rate, 20}, | ||
154 : | {"credits_quant_i", ®.credits_quant_i, 20}, | ||
155 : | {"credits_quant_p", ®.credits_quant_p, 20}, | ||
156 : | {"credits_start_size", ®.credits_start_size, 10000}, | ||
157 : | suxen_drol | 1.23 | {"credits_end_size", ®.credits_end_size, 10000}, |
158 : | |||
159 : | /* decoder */ | ||
160 : | {"deblock_y", ®.deblock_y, 0}, | ||
161 : | {"deblock_uv", ®.deblock_uv, 0} | ||
162 : | h | 1.4 | }; |
163 : | |||
164 : | REG_STR const reg_strs[] = { | ||
165 : | h | 1.6 | {"hintfile", reg.hintfile, CONFIG_HINTFILE}, |
166 : | h | 1.4 | {"stats1", reg.stats1, CONFIG_2PASS_1_FILE}, |
167 : | {"stats2", reg.stats2, CONFIG_2PASS_2_FILE} | ||
168 : | // {"build", reg.build, XVID_BUILD} | ||
169 : | }; | ||
170 : | |||
171 : | Isibaar | 1.1 | /* get config settings from registry */ |
172 : | |||
173 : | #define REG_GET_B(X, Y, Z) size=sizeof((Z));if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {memcpy(Y, Z, sizeof((Z)));} | ||
174 : | |||
175 : | void config_reg_get(CONFIG * config) | ||
176 : | { | ||
177 : | HKEY hKey; | ||
178 : | DWORD size; | ||
179 : | XVID_INIT_PARAM init_param; | ||
180 : | h | 1.4 | int i; |
181 : | Isibaar | 1.1 | |
182 : | suxen_drol | 1.12 | init_param.cpu_flags = XVID_CPU_CHKONLY; |
183 : | Isibaar | 1.1 | xvid_init(0, 0, &init_param, NULL); |
184 : | suxen_drol | 1.12 | reg.cpu = init_param.cpu_flags; |
185 : | Isibaar | 1.1 | |
186 : | suxen_drol | 1.13 | #ifdef _SMP |
187 : | reg.num_threads = pthread_num_processors_np(); | ||
188 : | #endif | ||
189 : | |||
190 : | h | 1.3 | RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
191 : | Isibaar | 1.1 | |
192 : | h | 1.4 | for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
193 : | { | ||
194 : | size = sizeof(int); | ||
195 : | |||
196 : | if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS) | ||
197 : | { | ||
198 : | *reg_ints[i].config_int = reg_ints[i].def; | ||
199 : | } | ||
200 : | } | ||
201 : | |||
202 : | for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) | ||
203 : | { | ||
204 : | size = MAX_PATH; | ||
205 : | |||
206 : | if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS) | ||
207 : | { | ||
208 : | memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); | ||
209 : | } | ||
210 : | } | ||
211 : | Isibaar | 1.1 | |
212 : | { | ||
213 : | BYTE default_qmatrix_intra[] = { | ||
214 : | 8, 17,18,19,21,23,25,27, | ||
215 : | 17,18,19,21,23,25,27,28, | ||
216 : | 20,21,22,23,24,26,28,30, | ||
217 : | 21,22,23,24,26,28,30,32, | ||
218 : | 22,23,24,26,28,30,32,35, | ||
219 : | 23,24,26,28,30,32,35,38, | ||
220 : | 25,26,28,30,32,35,38,41, | ||
221 : | 27,28,30,32,35,38,41,45 | ||
222 : | }; | ||
223 : | |||
224 : | BYTE default_qmatrix_inter[] = { | ||
225 : | 16,17,18,19,20,21,22,23, | ||
226 : | 17,18,19,20,21,22,23,24, | ||
227 : | 18,19,20,21,22,23,24,25, | ||
228 : | 19,20,21,22,23,24,26,27, | ||
229 : | 20,21,22,23,25,26,27,28, | ||
230 : | 21,22,23,24,26,27,28,30, | ||
231 : | 22,23,24,26,27,28,30,31, | ||
232 : | 23,24,25,27,28,30,31,33 | ||
233 : | }; | ||
234 : | |||
235 : | h | 1.4 | REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra); |
236 : | REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter); | ||
237 : | Isibaar | 1.1 | } |
238 : | |||
239 : | h | 1.4 | memcpy(config, ®, sizeof(CONFIG)); |
240 : | |||
241 : | Isibaar | 1.1 | RegCloseKey(hKey); |
242 : | } | ||
243 : | |||
244 : | |||
245 : | /* put config settings in registry */ | ||
246 : | |||
247 : | #define REG_SET_B(X, Y) RegSetValueEx(hKey, X, 0, REG_BINARY, Y, sizeof((Y))) | ||
248 : | |||
249 : | void config_reg_set(CONFIG * config) | ||
250 : | { | ||
251 : | HKEY hKey; | ||
252 : | DWORD dispo; | ||
253 : | h | 1.4 | int i; |
254 : | Isibaar | 1.1 | |
255 : | if (RegCreateKeyEx( | ||
256 : | XVID_REG_KEY, | ||
257 : | h | 1.3 | XVID_REG_PARENT "\\" XVID_REG_CHILD, |
258 : | Isibaar | 1.1 | 0, |
259 : | XVID_REG_CLASS, | ||
260 : | REG_OPTION_NON_VOLATILE, | ||
261 : | KEY_WRITE, | ||
262 : | 0, | ||
263 : | &hKey, | ||
264 : | &dispo) != ERROR_SUCCESS) | ||
265 : | { | ||
266 : | DEBUG1("Couldn't create XVID_REG_SUBKEY - ", GetLastError()); | ||
267 : | return; | ||
268 : | } | ||
269 : | |||
270 : | h | 1.4 | memcpy(®, config, sizeof(CONFIG)); |
271 : | |||
272 : | for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) | ||
273 : | { | ||
274 : | RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int)); | ||
275 : | } | ||
276 : | |||
277 : | for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) | ||
278 : | { | ||
279 : | RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1); | ||
280 : | } | ||
281 : | |||
282 : | REG_SET_B("qmatrix_intra", reg.qmatrix_intra); | ||
283 : | REG_SET_B("qmatrix_inter", reg.qmatrix_inter); | ||
284 : | Isibaar | 1.1 | |
285 : | RegCloseKey(hKey); | ||
286 : | } | ||
287 : | |||
288 : | |||
289 : | h | 1.3 | /* clear XviD registry key, load defaults */ |
290 : | Isibaar | 1.1 | |
291 : | h | 1.3 | void config_reg_default(CONFIG * config) |
292 : | Isibaar | 1.1 | { |
293 : | h | 1.3 | HKEY hKey; |
294 : | Isibaar | 1.1 | |
295 : | h | 1.3 | if (RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT, 0, KEY_ALL_ACCESS, &hKey)) |
296 : | Isibaar | 1.1 | { |
297 : | h | 1.3 | DEBUG1("Couldn't open registry key for deletion - ", GetLastError()); |
298 : | return; | ||
299 : | Isibaar | 1.1 | } |
300 : | h | 1.3 | |
301 : | h | 1.4 | if (RegDeleteKey(hKey, XVID_REG_CHILD)) |
302 : | Isibaar | 1.1 | { |
303 : | h | 1.3 | DEBUG1("Couldn't delete registry key - ", GetLastError()); |
304 : | return; | ||
305 : | Isibaar | 1.1 | } |
306 : | |||
307 : | h | 1.4 | RegCloseKey(hKey); |
308 : | h | 1.3 | config_reg_get(config); |
309 : | h | 1.4 | config_reg_set(config); |
310 : | h | 1.3 | } |
311 : | |||
312 : | Isibaar | 1.1 | |
313 : | h | 1.3 | /* leaves current config value if dialog item is empty */ |
314 : | Isibaar | 1.1 | |
315 : | suxen_drol | 1.11 | int config_get_int(HWND hDlg, INT item, int config) |
316 : | { | ||
317 : | BOOL success = FALSE; | ||
318 : | |||
319 : | int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); | ||
320 : | |||
321 : | return (success) ? tmp : config; | ||
322 : | } | ||
323 : | |||
324 : | |||
325 : | int config_get_uint(HWND hDlg, UINT item, int config) | ||
326 : | h | 1.3 | { |
327 : | BOOL success = FALSE; | ||
328 : | Isibaar | 1.1 | |
329 : | h | 1.3 | int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
330 : | Isibaar | 1.1 | |
331 : | h | 1.3 | return (success) ? tmp : config; |
332 : | Isibaar | 1.1 | } |
333 : | |||
334 : | |||
335 : | h | 1.3 | /* downloads data from main dialog */ |
336 : | Isibaar | 1.1 | |
337 : | h | 1.3 | void main_download(HWND hDlg, CONFIG * config) |
338 : | Isibaar | 1.1 | { |
339 : | h | 1.3 | switch(config->mode) |
340 : | Isibaar | 1.1 | { |
341 : | h | 1.3 | default : |
342 : | case DLG_MODE_CBR : | ||
343 : | suxen_drol | 1.11 | config->rc_bitrate = config_get_uint(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
344 : | Isibaar | 1.1 | break; |
345 : | |||
346 : | h | 1.3 | case DLG_MODE_VBR_QUAL : |
347 : | suxen_drol | 1.11 | config->quality = config_get_uint(hDlg, IDC_VALUE, config->quality); |
348 : | Isibaar | 1.1 | break; |
349 : | |||
350 : | h | 1.3 | case DLG_MODE_VBR_QUANT : |
351 : | suxen_drol | 1.11 | config->quant = config_get_uint(hDlg, IDC_VALUE, config->quant); |
352 : | Isibaar | 1.1 | break; |
353 : | |||
354 : | h | 1.3 | case DLG_MODE_2PASS_2_INT : |
355 : | suxen_drol | 1.11 | config->desired_size = config_get_uint(hDlg, IDC_VALUE, config->desired_size); |
356 : | Isibaar | 1.1 | break; |
357 : | } | ||
358 : | h | 1.3 | |
359 : | config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); | ||
360 : | Isibaar | 1.1 | } |
361 : | |||
362 : | |||
363 : | h | 1.3 | /* updates the edit box */ |
364 : | Isibaar | 1.1 | |
365 : | h | 1.3 | void main_value(HWND hDlg, CONFIG* config) |
366 : | Isibaar | 1.1 | { |
367 : | h | 1.3 | char* text; |
368 : | Isibaar | 1.1 | int value; |
369 : | h | 1.3 | int enabled = TRUE; |
370 : | Isibaar | 1.1 | |
371 : | h | 1.3 | switch (config->mode) |
372 : | Isibaar | 1.1 | { |
373 : | h | 1.3 | default : |
374 : | enabled = FALSE; | ||
375 : | Isibaar | 1.1 | |
376 : | h | 1.3 | case DLG_MODE_CBR : |
377 : | text = "Bitrate (Kbps):"; | ||
378 : | h | 1.8 | value = config->rc_bitrate / CONFIG_KBPS; |
379 : | Isibaar | 1.1 | break; |
380 : | |||
381 : | h | 1.3 | case DLG_MODE_VBR_QUAL : |
382 : | text = "Quality:"; | ||
383 : | value = config->quality; | ||
384 : | Isibaar | 1.1 | break; |
385 : | |||
386 : | h | 1.3 | case DLG_MODE_VBR_QUANT : |
387 : | text = "Quantizer:"; | ||
388 : | value = config->quant; | ||
389 : | Isibaar | 1.1 | break; |
390 : | |||
391 : | h | 1.3 | case DLG_MODE_2PASS_2_INT : |
392 : | text = "Desired size (Kbtyes):"; | ||
393 : | value = config->desired_size; | ||
394 : | Isibaar | 1.1 | break; |
395 : | } | ||
396 : | h | 1.3 | |
397 : | SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); | ||
398 : | SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); | ||
399 : | |||
400 : | EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); | ||
401 : | EnableWindow(GetDlgItem(hDlg, IDC_VALUE), enabled); | ||
402 : | Isibaar | 1.1 | } |
403 : | |||
404 : | |||
405 : | /* updates the slider */ | ||
406 : | |||
407 : | h | 1.3 | void main_slider(HWND hDlg, CONFIG * config) |
408 : | Isibaar | 1.1 | { |
409 : | char* text; | ||
410 : | long range; | ||
411 : | int pos; | ||
412 : | h | 1.3 | int enabled = TRUE; |
413 : | Isibaar | 1.1 | |
414 : | switch (config->mode) | ||
415 : | { | ||
416 : | default : | ||
417 : | h | 1.3 | enabled = FALSE; |
418 : | |||
419 : | Isibaar | 1.1 | case DLG_MODE_CBR : |
420 : | text = "Bitrate (Kbps):"; | ||
421 : | range = MAKELONG(0,10000); | ||
422 : | h | 1.8 | pos = config->rc_bitrate / CONFIG_KBPS; |
423 : | Isibaar | 1.1 | break; |
424 : | |||
425 : | case DLG_MODE_VBR_QUAL : | ||
426 : | text = "Quality:"; | ||
427 : | range = MAKELONG(0,100); | ||
428 : | pos = config->quality; | ||
429 : | break; | ||
430 : | |||
431 : | case DLG_MODE_VBR_QUANT : | ||
432 : | text = "Quantizer:"; | ||
433 : | range = MAKELONG(1,31); | ||
434 : | pos = config->quant; | ||
435 : | break; | ||
436 : | } | ||
437 : | |||
438 : | SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); | ||
439 : | SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); | ||
440 : | SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); | ||
441 : | h | 1.3 | |
442 : | EnableWindow(GetDlgItem(hDlg, IDC_SLIDER_STATIC), enabled); | ||
443 : | EnableWindow(GetDlgItem(hDlg, IDC_SLIDER), enabled); | ||
444 : | Isibaar | 1.1 | } |
445 : | |||
446 : | |||
447 : | h | 1.3 | /* load advanced options property sheet */ |
448 : | Isibaar | 1.1 | |
449 : | h | 1.3 | void adv_dialog(HWND hParent, CONFIG * config) |
450 : | Isibaar | 1.1 | { |
451 : | h | 1.3 | PROPSHEETINFO psi[DLG_COUNT]; |
452 : | PROPSHEETPAGE psp[DLG_COUNT]; | ||
453 : | PROPSHEETHEADER psh; | ||
454 : | CONFIG temp; | ||
455 : | int i; | ||
456 : | |||
457 : | config->save = FALSE; | ||
458 : | memcpy(&temp, config, sizeof(CONFIG)); | ||
459 : | Isibaar | 1.1 | |
460 : | h | 1.3 | for (i=0 ; i<DLG_COUNT ; ++i) |
461 : | Isibaar | 1.1 | { |
462 : | h | 1.3 | psp[i].dwSize = sizeof(PROPSHEETPAGE); |
463 : | psp[i].dwFlags = 0; | ||
464 : | psp[i].hInstance = hInst; | ||
465 : | psp[i].pfnDlgProc = adv_proc; | ||
466 : | psp[i].lParam = (LPARAM)&psi[i]; | ||
467 : | psp[i].pfnCallback = NULL; | ||
468 : | |||
469 : | psi[i].page = i; | ||
470 : | psi[i].config = &temp; | ||
471 : | } | ||
472 : | |||
473 : | psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); | ||
474 : | psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); | ||
475 : | psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); | ||
476 : | h | 1.4 | psp[DLG_2PASSALT].pszTemplate = MAKEINTRESOURCE(IDD_2PASSALT); |
477 : | h | 1.3 | psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
478 : | psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); | ||
479 : | |||
480 : | psh.dwSize = sizeof(PROPSHEETHEADER); | ||
481 : | psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; | ||
482 : | psh.hwndParent = hParent; | ||
483 : | psh.hInstance = hInst; | ||
484 : | psh.pszCaption = (LPSTR) "XviD Configuration"; | ||
485 : | psh.nPages = DLG_COUNT; | ||
486 : | psh.nStartPage = DLG_GLOBAL; | ||
487 : | psh.ppsp = (LPCPROPSHEETPAGE)&psp; | ||
488 : | psh.pfnCallback = NULL; | ||
489 : | Isibaar | 1.1 | |
490 : | h | 1.3 | PropertySheet(&psh); |
491 : | Isibaar | 1.1 | |
492 : | h | 1.3 | if (temp.save) |
493 : | { | ||
494 : | memcpy(config, &temp, sizeof(CONFIG)); | ||
495 : | Isibaar | 1.1 | } |
496 : | h | 1.3 | } |
497 : | Isibaar | 1.1 | |
498 : | |||
499 : | h | 1.3 | /* enable/disable advanced controls based on encoder mode */ |
500 : | Isibaar | 1.1 | |
501 : | h | 1.3 | #define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
502 : | #define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) | ||
503 : | Isibaar | 1.1 | |
504 : | h | 1.4 | #define MOD_CBR |
505 : | |||
506 : | h | 1.3 | void adv_mode(HWND hDlg, int mode) |
507 : | Isibaar | 1.1 | { |
508 : | h | 1.3 | // create arrays of controls to be disabled for each mode |
509 : | h | 1.10 | const short twopass_disable[] = { |
510 : | IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, | ||
511 : | Foxer | 1.15 | // added by koepi for new curve treatment |
512 : | IDC_KFTRESHOLD, IDC_KFREDUCTION, | ||
513 : | //end of koepi's additions | ||
514 : | h | 1.3 | IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
515 : | h | 1.10 | IDC_STATS2, IDC_STATS2_BROWSE, |
516 : | }; | ||
517 : | |||
518 : | const short cbr_disable[] = { | ||
519 : | IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, | ||
520 : | h | 1.3 | IDC_CREDITS_START, IDC_CREDITS_END, IDC_CREDITS_START_BEGIN, IDC_CREDITS_START_END, |
521 : | IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, | ||
522 : | IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, | ||
523 : | chl | 1.17 | IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
524 : | Foxer | 1.18 | IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, IDC_CREDITS_GREYSCALE, IDC_HINTFILE |
525 : | h | 1.3 | }; |
526 : | |||
527 : | h | 1.10 | const short qual_disable[] = { |
528 : | IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, | ||
529 : | h | 1.8 | IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
530 : | Foxer | 1.18 | IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
531 : | IDC_HINTFILE | ||
532 : | h | 1.3 | }; |
533 : | |||
534 : | h | 1.10 | const short quant_disable[] = { |
535 : | IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, | ||
536 : | h | 1.8 | IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
537 : | h | 1.3 | IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
538 : | Foxer | 1.18 | IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
539 : | IDC_HINTFILE | ||
540 : | h | 1.3 | }; |
541 : | |||
542 : | h | 1.10 | const short twopass1_disable[] = { |
543 : | h | 1.8 | IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
544 : | h | 1.9 | IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
545 : | h | 1.3 | IDC_CREDITS_RATE_RADIO, IDC_CREDITS_RATE, IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, |
546 : | IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE | ||
547 : | }; | ||
548 : | |||
549 : | h | 1.10 | const short twopass2_ext_disable[] = { |
550 : | h | 1.8 | IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
551 : | suxen_drol | 1.23 | IDC_CREDITS_RATE_RADIO, |
552 : | h | 1.3 | IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
553 : | suxen_drol | 1.23 | IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
554 : | h | 1.3 | }; |
555 : | |||
556 : | h | 1.10 | const short twopass2_int_disable[] = { |
557 : | h | 1.8 | IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
558 : | h | 1.3 | IDC_STATS2, IDC_STATS2_BROWSE |
559 : | }; | ||
560 : | |||
561 : | // store pointers in order so we can lookup using config->mode | ||
562 : | h | 1.10 | const short* modes[] = { |
563 : | h | 1.3 | cbr_disable, qual_disable, quant_disable, |
564 : | twopass1_disable, twopass2_ext_disable, twopass2_int_disable | ||
565 : | }; | ||
566 : | |||
567 : | // ditto modes[] | ||
568 : | const int lengths[] = { | ||
569 : | h | 1.10 | sizeof(cbr_disable)/sizeof(short), sizeof(qual_disable)/sizeof(short), |
570 : | sizeof(quant_disable)/sizeof(short), sizeof(twopass1_disable)/sizeof(short), | ||
571 : | sizeof(twopass2_ext_disable)/sizeof(short), sizeof(twopass2_int_disable)/sizeof(short), 0 | ||
572 : | h | 1.3 | }; |
573 : | |||
574 : | int i; | ||
575 : | h | 1.10 | int hinted_me, use_alt, use_alt_auto, use_alt_auto_bonus; |
576 : | int credits_start, credits_end, credits_rate, credits_quant, credits_size; | ||
577 : | int cpu_force; | ||
578 : | Isibaar | 1.1 | |
579 : | h | 1.3 | // first perform checkbox-based enable/disable |
580 : | h | 1.10 | hinted_me = ISDLGSET(IDC_HINTEDME); |
581 : | CONTROLDLG(IDC_HINTFILE, hinted_me); | ||
582 : | CONTROLDLG(IDC_HINT_BROWSE, hinted_me); | ||
583 : | |||
584 : | use_alt = ISDLGSET(IDC_USEALT) && (mode == DLG_MODE_2PASS_2_EXT || mode == DLG_MODE_2PASS_2_INT); | ||
585 : | use_alt_auto = ISDLGSET(IDC_USEAUTO); | ||
586 : | use_alt_auto_bonus = ISDLGSET(IDC_USEAUTOBONUS); | ||
587 : | CONTROLDLG(IDC_USEAUTO, use_alt); | ||
588 : | CONTROLDLG(IDC_AUTOSTR, use_alt && use_alt_auto); | ||
589 : | CONTROLDLG(IDC_USEAUTOBONUS, use_alt); | ||
590 : | CONTROLDLG(IDC_BONUSBIAS, use_alt && !use_alt_auto_bonus); | ||
591 : | CONTROLDLG(IDC_CURVETYPE, use_alt); | ||
592 : | CONTROLDLG(IDC_ALTCURVEHIGH, use_alt); | ||
593 : | CONTROLDLG(IDC_ALTCURVELOW, use_alt); | ||
594 : | CONTROLDLG(IDC_MINQUAL, use_alt && !use_alt_auto); | ||
595 : | |||
596 : | credits_start = ISDLGSET(IDC_CREDITS_START); | ||
597 : | CONTROLDLG(IDC_CREDITS_START_BEGIN, credits_start); | ||
598 : | CONTROLDLG(IDC_CREDITS_START_END, credits_start); | ||
599 : | |||
600 : | credits_end = ISDLGSET(IDC_CREDITS_END); | ||
601 : | CONTROLDLG(IDC_CREDITS_END_BEGIN, credits_end); | ||
602 : | CONTROLDLG(IDC_CREDITS_END_END, credits_end); | ||
603 : | |||
604 : | credits_rate = ISDLGSET(IDC_CREDITS_RATE_RADIO); | ||
605 : | credits_quant = ISDLGSET(IDC_CREDITS_QUANT_RADIO); | ||
606 : | credits_size = ISDLGSET(IDC_CREDITS_SIZE_RADIO); | ||
607 : | CONTROLDLG(IDC_CREDITS_RATE, credits_rate); | ||
608 : | CONTROLDLG(IDC_CREDITS_QUANTI, credits_quant); | ||
609 : | CONTROLDLG(IDC_CREDITS_QUANTP, credits_quant); | ||
610 : | CONTROLDLG(IDC_CREDITS_START_SIZE, credits_size); | ||
611 : | CONTROLDLG(IDC_CREDITS_END_SIZE, credits_size); | ||
612 : | |||
613 : | cpu_force = ISDLGSET(IDC_CPU_FORCE); | ||
614 : | CONTROLDLG(IDC_CPU_MMX, cpu_force); | ||
615 : | CONTROLDLG(IDC_CPU_MMXEXT, cpu_force); | ||
616 : | CONTROLDLG(IDC_CPU_SSE, cpu_force); | ||
617 : | CONTROLDLG(IDC_CPU_SSE2, cpu_force); | ||
618 : | CONTROLDLG(IDC_CPU_3DNOW, cpu_force); | ||
619 : | CONTROLDLG(IDC_CPU_3DNOWEXT, cpu_force); | ||
620 : | Isibaar | 1.1 | |
621 : | h | 1.3 | // now perform codec mode enable/disable |
622 : | for (i=0 ; i<lengths[mode] ; ++i) | ||
623 : | { | ||
624 : | EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); | ||
625 : | Isibaar | 1.1 | } |
626 : | h | 1.10 | |
627 : | if (mode != DLG_MODE_2PASS_2_EXT && mode != DLG_MODE_2PASS_2_INT) | ||
628 : | { | ||
629 : | for (i=0 ; i<sizeof(twopass_disable)/sizeof(short) ; ++i) | ||
630 : | { | ||
631 : | EnableWindow(GetDlgItem(hDlg, twopass_disable[i]), FALSE); | ||
632 : | } | ||
633 : | } | ||
634 : | Isibaar | 1.1 | } |
635 : | |||
636 : | |||
637 : | h | 1.3 | /* upload config data into dialog */ |
638 : | Isibaar | 1.1 | |
639 : | h | 1.3 | void adv_upload(HWND hDlg, int page, CONFIG * config) |
640 : | Isibaar | 1.1 | { |
641 : | h | 1.3 | switch (page) |
642 : | { | ||
643 : | case DLG_GLOBAL : | ||
644 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); | ||
645 : | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); | ||
646 : | SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); | ||
647 : | suxen_drol | 1.23 | SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
648 : | h | 1.3 | SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
649 : | h | 1.7 | SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
650 : | h | 1.3 | CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
651 : | Foxer | 1.18 | CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
652 : | suxen_drol | 1.23 | |
653 : | CheckDlgButton(hDlg, IDC_QPEL, config->qpel ? BST_CHECKED : BST_UNCHECKED); | ||
654 : | CheckDlgButton(hDlg, IDC_GMC, config->gmc ? BST_CHECKED : BST_UNCHECKED); | ||
655 : | CheckDlgButton(hDlg, IDC_CHROMAME, config->chromame ? BST_CHECKED : BST_UNCHECKED); | ||
656 : | chl | 1.16 | // added by koepi for gruel's greyscale_mode |
657 : | Foxer | 1.18 | CheckDlgButton(hDlg, IDC_GREYSCALE, config->greyscale ? BST_CHECKED : BST_UNCHECKED); |
658 : | // end of koepi's addition | ||
659 : | suxen_drol | 1.11 | SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
660 : | SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); | ||
661 : | suxen_drol | 1.23 | SetDlgItemInt(hDlg, IDC_BQUANTOFFSET, config->bquant_offset, FALSE); |
662 : | suxen_drol | 1.11 | CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
663 : | suxen_drol | 1.12 | CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); |
664 : | CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); | ||
665 : | suxen_drol | 1.23 | |
666 : | CheckDlgButton(hDlg, IDC_REDUCED, config->reduced_resolution ? BST_CHECKED : BST_UNCHECKED); | ||
667 : | h | 1.3 | break; |
668 : | Isibaar | 1.1 | |
669 : | h | 1.3 | case DLG_QUANT : |
670 : | SetDlgItemInt(hDlg, IDC_MINIQUANT, config->min_iquant, FALSE); | ||
671 : | SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); | ||
672 : | SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); | ||
673 : | SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); | ||
674 : | break; | ||
675 : | Isibaar | 1.1 | |
676 : | h | 1.3 | case DLG_2PASS : |
677 : | SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); | ||
678 : | CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); | ||
679 : | CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); | ||
680 : | Foxer | 1.15 | // added by koepi for new 2pass curve treatment |
681 : | SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); | ||
682 : | SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); | ||
683 : | // end of koepi's additions | ||
684 : | h | 1.3 | SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
685 : | SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); | ||
686 : | SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); | ||
687 : | CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); | ||
688 : | CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); | ||
689 : | Isibaar | 1.1 | |
690 : | h | 1.6 | CheckDlgButton(hDlg, IDC_HINTEDME, config->hinted_me ? BST_CHECKED : BST_UNCHECKED); |
691 : | SetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile); | ||
692 : | h | 1.3 | SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
693 : | SetDlgItemText(hDlg, IDC_STATS2, config->stats2); | ||
694 : | break; | ||
695 : | Isibaar | 1.1 | |
696 : | h | 1.4 | case DLG_2PASSALT : |
697 : | CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED); | ||
698 : | |||
699 : | SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); | ||
700 : | SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); | ||
701 : | SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); | ||
702 : | SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); | ||
703 : | |||
704 : | CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED); | ||
705 : | SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); | ||
706 : | |||
707 : | CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED); | ||
708 : | SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); | ||
709 : | h | 1.7 | |
710 : | SetDlgItemInt(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate / CONFIG_KBPS, FALSE); | ||
711 : | SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); | ||
712 : | SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); | ||
713 : | h | 1.4 | break; |
714 : | |||
715 : | h | 1.3 | case DLG_CREDITS : |
716 : | CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); | ||
717 : | SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); | ||
718 : | SetDlgItemInt(hDlg, IDC_CREDITS_START_END, config->credits_start_end, FALSE); | ||
719 : | CheckDlgButton(hDlg, IDC_CREDITS_END, config->credits_end ? BST_CHECKED : BST_UNCHECKED); | ||
720 : | SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); | ||
721 : | SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); | ||
722 : | Isibaar | 1.1 | |
723 : | Foxer | 1.18 | // added by koepi for credits greyscale |
724 : | CheckDlgButton(hDlg, IDC_CREDITS_GREYSCALE, config->credits_greyscale ? BST_CHECKED : BST_UNCHECKED); | ||
725 : | // end of koepi's addition | ||
726 : | h | 1.3 | SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
727 : | SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); | ||
728 : | SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); | ||
729 : | SetDlgItemInt(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size, FALSE); | ||
730 : | SetDlgItemInt(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size, FALSE); | ||
731 : | Isibaar | 1.1 | |
732 : | h | 1.3 | if (config->credits_mode == CREDITS_MODE_RATE) |
733 : | { | ||
734 : | CheckDlgButton(hDlg, IDC_CREDITS_RATE_RADIO, BST_CHECKED); | ||
735 : | } | ||
736 : | else if (config->credits_mode == CREDITS_MODE_QUANT) | ||
737 : | { | ||
738 : | CheckDlgButton(hDlg, IDC_CREDITS_QUANT_RADIO, BST_CHECKED); | ||
739 : | } | ||
740 : | else // CREDITS_MODE_SIZE | ||
741 : | { | ||
742 : | CheckDlgButton(hDlg, IDC_CREDITS_SIZE_RADIO, BST_CHECKED); | ||
743 : | } | ||
744 : | break; | ||
745 : | Isibaar | 1.1 | |
746 : | h | 1.3 | case DLG_CPU : |
747 : | CheckDlgButton(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX) ? BST_CHECKED : BST_UNCHECKED); | ||
748 : | CheckDlgButton(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT) ? BST_CHECKED : BST_UNCHECKED); | ||
749 : | CheckDlgButton(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE) ? BST_CHECKED : BST_UNCHECKED); | ||
750 : | CheckDlgButton(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2) ? BST_CHECKED : BST_UNCHECKED); | ||
751 : | CheckDlgButton(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW) ? BST_CHECKED : BST_UNCHECKED); | ||
752 : | CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT) ? BST_CHECKED : BST_UNCHECKED); | ||
753 : | Isibaar | 1.1 | |
754 : | h | 1.3 | CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
755 : | config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); | ||
756 : | h | 1.8 | |
757 : | suxen_drol | 1.13 | #ifdef _SMP |
758 : | SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); | ||
759 : | #endif | ||
760 : | suxen_drol | 1.23 | CheckDlgButton(hDlg, IDC_CHROMA_OPT, (config->chroma_opt) ? BST_CHECKED : BST_UNCHECKED); |
761 : | suxen_drol | 1.14 | SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
762 : | h | 1.8 | SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
763 : | SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); | ||
764 : | SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); | ||
765 : | h | 1.3 | break; |
766 : | Isibaar | 1.1 | } |
767 : | } | ||
768 : | |||
769 : | |||
770 : | h | 1.3 | /* download config data from dialog |
771 : | replaces invalid values instead of alerting user for now | ||
772 : | */ | ||
773 : | |||
774 : | #define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; | ||
775 : | Isibaar | 1.1 | |
776 : | h | 1.3 | void adv_download(HWND hDlg, int page, CONFIG * config) |
777 : | Isibaar | 1.1 | { |
778 : | h | 1.3 | switch (page) |
779 : | { | ||
780 : | case DLG_GLOBAL : | ||
781 : | config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); | ||
782 : | config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); | ||
783 : | config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); | ||
784 : | suxen_drol | 1.23 | config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
785 : | suxen_drol | 1.11 | config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
786 : | config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); | ||
787 : | h | 1.3 | config->lum_masking = ISDLGSET(IDC_LUMMASK); |
788 : | Foxer | 1.18 | config->interlacing = ISDLGSET(IDC_INTERLACING); |
789 : | suxen_drol | 1.23 | |
790 : | config->qpel = ISDLGSET(IDC_QPEL); | ||
791 : | config->gmc = ISDLGSET(IDC_GMC); | ||
792 : | config->chromame = ISDLGSET(IDC_CHROMAME); | ||
793 : | Foxer | 1.18 | // added by koepi for gruel's greyscale_mode |
794 : | config->greyscale = ISDLGSET(IDC_GREYSCALE); | ||
795 : | chl | 1.16 | // end of koepi's addition |
796 : | suxen_drol | 1.11 | config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
797 : | config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); | ||
798 : | suxen_drol | 1.23 | config->bquant_offset = config_get_uint(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
799 : | suxen_drol | 1.11 | config->packed = ISDLGSET(IDC_PACKED); |
800 : | suxen_drol | 1.12 | config->dx50bvop = ISDLGSET(IDC_DX50BVOP); |
801 : | config->debug = ISDLGSET(IDC_DEBUG); | ||
802 : | suxen_drol | 1.23 | config->reduced_resolution = ISDLGSET(IDC_REDUCED); |
803 : | h | 1.3 | break; |
804 : | |||
805 : | case DLG_QUANT : | ||
806 : | suxen_drol | 1.11 | config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
807 : | config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); | ||
808 : | config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); | ||
809 : | config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); | ||
810 : | h | 1.3 | |
811 : | CONSTRAINVAL(config->min_iquant, 1, 31); | ||
812 : | CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); | ||
813 : | CONSTRAINVAL(config->min_pquant, 1, 31); | ||
814 : | CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); | ||
815 : | break; | ||
816 : | |||
817 : | case DLG_2PASS : | ||
818 : | config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); | ||
819 : | Foxer | 1.15 | // added by koepi for the new 2pass curve treatment |
820 : | config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); | ||
821 : | config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); | ||
822 : | //end of koepi's additions | ||
823 : | h | 1.3 | config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
824 : | config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); | ||
825 : | config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); | ||
826 : | config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); | ||
827 : | suxen_drol | 1.11 | config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
828 : | h | 1.3 | config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
829 : | h | 1.6 | config->hinted_me = ISDLGSET(IDC_HINTEDME); |
830 : | h | 1.3 | |
831 : | h | 1.6 | if (GetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile, MAX_PATH) == 0) |
832 : | { | ||
833 : | lstrcpy(config->hintfile, CONFIG_HINTFILE); | ||
834 : | } | ||
835 : | h | 1.3 | if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
836 : | { | ||
837 : | lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); | ||
838 : | } | ||
839 : | if (GetDlgItemText(hDlg, IDC_STATS2, config->stats2, MAX_PATH) == 0) | ||
840 : | { | ||
841 : | lstrcpy(config->stats2, CONFIG_2PASS_2_FILE); | ||
842 : | } | ||
843 : | |||
844 : | CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); | ||
845 : | CONSTRAINVAL(config->keyframe_boost, 0, 1000); | ||
846 : | CONSTRAINVAL(config->curve_compression_high, 0, 100); | ||
847 : | CONSTRAINVAL(config->curve_compression_low, 0, 100); | ||
848 : | break; | ||
849 : | |||
850 : | h | 1.4 | case DLG_2PASSALT : |
851 : | config->use_alt_curve = ISDLGSET(IDC_USEALT); | ||
852 : | |||
853 : | config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); | ||
854 : | suxen_drol | 1.11 | config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
855 : | h | 1.4 | |
856 : | config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); | ||
857 : | suxen_drol | 1.11 | config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
858 : | h | 1.4 | |
859 : | config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); | ||
860 : | suxen_drol | 1.11 | config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
861 : | config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); | ||
862 : | config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); | ||
863 : | h | 1.7 | |
864 : | config->twopass_max_bitrate /= CONFIG_KBPS; | ||
865 : | suxen_drol | 1.11 | config->twopass_max_bitrate = config_get_uint(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
866 : | h | 1.7 | config->twopass_max_bitrate *= CONFIG_KBPS; |
867 : | suxen_drol | 1.11 | config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
868 : | config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); | ||
869 : | h | 1.7 | |
870 : | CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); | ||
871 : | CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); | ||
872 : | h | 1.4 | break; |
873 : | |||
874 : | h | 1.3 | case DLG_CREDITS : |
875 : | config->credits_start = ISDLGSET(IDC_CREDITS_START); | ||
876 : | config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); | ||
877 : | suxen_drol | 1.11 | config->credits_start_end = config_get_uint(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
878 : | h | 1.3 | config->credits_end = ISDLGSET(IDC_CREDITS_END); |
879 : | suxen_drol | 1.11 | config->credits_end_begin = config_get_uint(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
880 : | config->credits_end_end = config_get_uint(hDlg, IDC_CREDITS_END_END, config->credits_end_end); | ||
881 : | h | 1.3 | |
882 : | Foxer | 1.18 | // added by koepi for gruel's greyscale_mode |
883 : | config->credits_greyscale = ISDLGSET(IDC_CREDITS_GREYSCALE); | ||
884 : | // end of koepi's addition | ||
885 : | suxen_drol | 1.11 | config->credits_rate = config_get_uint(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
886 : | config->credits_quant_i = config_get_uint(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); | ||
887 : | config->credits_quant_p = config_get_uint(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); | ||
888 : | config->credits_start_size = config_get_uint(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); | ||
889 : | config->credits_end_size = config_get_uint(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); | ||
890 : | h | 1.3 | |
891 : | config->credits_mode = 0; | ||
892 : | config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; | ||
893 : | config->credits_mode = ISDLGSET(IDC_CREDITS_QUANT_RADIO) ? CREDITS_MODE_QUANT : config->credits_mode; | ||
894 : | config->credits_mode = ISDLGSET(IDC_CREDITS_SIZE_RADIO) ? CREDITS_MODE_SIZE : config->credits_mode; | ||
895 : | |||
896 : | CONSTRAINVAL(config->credits_rate, 1, 100); | ||
897 : | CONSTRAINVAL(config->credits_quant_i, 1, 31); | ||
898 : | CONSTRAINVAL(config->credits_quant_p, 1, 31); | ||
899 : | |||
900 : | if (config->credits_start_begin > config->credits_start_end) | ||
901 : | { | ||
902 : | config->credits_start_begin = config->credits_start_end; | ||
903 : | config->credits_start = 0; | ||
904 : | } | ||
905 : | if (config->credits_end_begin > config->credits_end_end) | ||
906 : | { | ||
907 : | config->credits_end_begin = config->credits_end_end; | ||
908 : | config->credits_end = 0; | ||
909 : | } | ||
910 : | break; | ||
911 : | |||
912 : | case DLG_CPU : | ||
913 : | config->cpu = 0; | ||
914 : | config->cpu |= ISDLGSET(IDC_CPU_MMX) ? XVID_CPU_MMX : 0; | ||
915 : | config->cpu |= ISDLGSET(IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT: 0; | ||
916 : | config->cpu |= ISDLGSET(IDC_CPU_SSE) ? XVID_CPU_SSE: 0; | ||
917 : | config->cpu |= ISDLGSET(IDC_CPU_SSE2) ? XVID_CPU_SSE2: 0; | ||
918 : | config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; | ||
919 : | config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; | ||
920 : | config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; | ||
921 : | h | 1.8 | |
922 : | suxen_drol | 1.13 | #ifdef _SMP |
923 : | config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); | ||
924 : | #endif | ||
925 : | suxen_drol | 1.23 | config->chroma_opt = ISDLGSET(IDC_CHROMA_OPT); |
926 : | suxen_drol | 1.14 | config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
927 : | suxen_drol | 1.11 | config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
928 : | config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); | ||
929 : | config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); | ||
930 : | h | 1.3 | break; |
931 : | } | ||
932 : | } | ||
933 : | |||
934 : | |||
935 : | void quant_upload(HWND hDlg, CONFIG* config) | ||
936 : | { | ||
937 : | int i; | ||
938 : | |||
939 : | for (i=0 ; i<64 ; ++i) | ||
940 : | { | ||
941 : | SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); | ||
942 : | SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); | ||
943 : | } | ||
944 : | } | ||
945 : | |||
946 : | Isibaar | 1.1 | |
947 : | h | 1.3 | void quant_download(HWND hDlg, CONFIG* config) |
948 : | { | ||
949 : | int i; | ||
950 : | Isibaar | 1.1 | |
951 : | h | 1.3 | for (i=0 ; i<64 ; ++i) |
952 : | Isibaar | 1.1 | { |
953 : | h | 1.3 | int temp; |
954 : | |||
955 : | suxen_drol | 1.11 | temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
956 : | h | 1.3 | CONSTRAINVAL(temp, 1, 255); |
957 : | h | 1.10 | config->qmatrix_intra[i] = temp; |
958 : | h | 1.3 | |
959 : | suxen_drol | 1.11 | temp = config_get_uint(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
960 : | h | 1.3 | CONSTRAINVAL(temp, 1, 255); |
961 : | h | 1.10 | config->qmatrix_inter[i] = temp; |
962 : | h | 1.3 | } |
963 : | } | ||
964 : | Isibaar | 1.1 | |
965 : | |||
966 : | h | 1.4 | /* enumerates child windows, assigns tooltips */ |
967 : | Isibaar | 1.1 | |
968 : | h | 1.4 | BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
969 : | h | 1.3 | { |
970 : | h | 1.4 | char help[500]; |
971 : | Isibaar | 1.1 | |
972 : | h | 1.4 | if (LoadString(hInst, GetDlgCtrlID(hWnd), help, 500)) |
973 : | h | 1.3 | { |
974 : | h | 1.4 | TOOLINFO ti; |
975 : | Isibaar | 1.1 | |
976 : | h | 1.4 | ti.cbSize = sizeof(TOOLINFO); |
977 : | ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; | ||
978 : | ti.hwnd = GetParent(hWnd); | ||
979 : | ti.uId = (LPARAM)hWnd; | ||
980 : | ti.lpszText = help; | ||
981 : | Isibaar | 1.1 | |
982 : | h | 1.4 | SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
983 : | h | 1.3 | } |
984 : | |||
985 : | h | 1.4 | return TRUE; |
986 : | h | 1.3 | } |
987 : | |||
988 : | |||
989 : | suxen_drol | 1.23 | |
990 : | /* --- decoder options dialog --- */ | ||
991 : | |||
992 : | #define DEC_DLG_COUNT 1 | ||
993 : | #define DEC_DLG_POSTPROC 0 | ||
994 : | |||
995 : | /* decoder dialog: upload config data */ | ||
996 : | |||
997 : | void dec_upload(HWND hDlg, int page, CONFIG * config) | ||
998 : | { | ||
999 : | switch (page) | ||
1000 : | { | ||
1001 : | case DEC_DLG_POSTPROC : | ||
1002 : | CheckDlgButton(hDlg, IDC_DEBLOCK_Y, config->deblock_y ? BST_CHECKED : BST_UNCHECKED); | ||
1003 : | CheckDlgButton(hDlg, IDC_DEBLOCK_UV, config->deblock_uv ? BST_CHECKED : BST_UNCHECKED); | ||
1004 : | break; | ||
1005 : | } | ||
1006 : | } | ||
1007 : | |||
1008 : | |||
1009 : | /* dec dialog: download config data */ | ||
1010 : | |||
1011 : | void dec_download(HWND hDlg, int page, CONFIG * config) | ||
1012 : | { | ||
1013 : | switch (page) | ||
1014 : | { | ||
1015 : | case DEC_DLG_POSTPROC : | ||
1016 : | config->deblock_y = ISDLGSET(IDC_DEBLOCK_Y); | ||
1017 : | config->deblock_uv = ISDLGSET(IDC_DEBLOCK_UV); | ||
1018 : | break; | ||
1019 : | } | ||
1020 : | } | ||
1021 : | |||
1022 : | /* decoder dialog proc */ | ||
1023 : | |||
1024 : | BOOL CALLBACK dec_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
1025 : | { | ||
1026 : | PROPSHEETINFO *psi; | ||
1027 : | |||
1028 : | psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); | ||
1029 : | |||
1030 : | switch (uMsg) | ||
1031 : | { | ||
1032 : | case WM_INITDIALOG : | ||
1033 : | psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; | ||
1034 : | |||
1035 : | SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); | ||
1036 : | |||
1037 : | if (hTooltip) | ||
1038 : | { | ||
1039 : | EnumChildWindows(hDlg, enum_tooltips, 0); | ||
1040 : | } | ||
1041 : | |||
1042 : | dec_upload(hDlg, psi->page, psi->config); | ||
1043 : | break; | ||
1044 : | |||
1045 : | case WM_NOTIFY : | ||
1046 : | switch (((NMHDR *)lParam)->code) | ||
1047 : | { | ||
1048 : | case PSN_KILLACTIVE : | ||
1049 : | /* validate */ | ||
1050 : | dec_download(hDlg, psi->page, psi->config); | ||
1051 : | SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); | ||
1052 : | break; | ||
1053 : | |||
1054 : | case PSN_APPLY : | ||
1055 : | /* apply */ | ||
1056 : | dec_download(hDlg, psi->page, psi->config); | ||
1057 : | SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); | ||
1058 : | psi->config->save = TRUE; | ||
1059 : | break; | ||
1060 : | } | ||
1061 : | break; | ||
1062 : | |||
1063 : | default : | ||
1064 : | return 0; | ||
1065 : | } | ||
1066 : | |||
1067 : | return 1; | ||
1068 : | } | ||
1069 : | |||
1070 : | |||
1071 : | void dec_dialog(HWND hParent, CONFIG * config) | ||
1072 : | { | ||
1073 : | PROPSHEETINFO psi[DEC_DLG_COUNT]; | ||
1074 : | PROPSHEETPAGE psp[DEC_DLG_COUNT]; | ||
1075 : | PROPSHEETHEADER psh; | ||
1076 : | CONFIG temp; | ||
1077 : | int i; | ||
1078 : | |||
1079 : | config->save = FALSE; | ||
1080 : | memcpy(&temp, config, sizeof(CONFIG)); | ||
1081 : | |||
1082 : | for (i=0 ; i<DEC_DLG_COUNT ; ++i) | ||
1083 : | { | ||
1084 : | psp[i].dwSize = sizeof(PROPSHEETPAGE); | ||
1085 : | psp[i].dwFlags = 0; | ||
1086 : | psp[i].hInstance = hInst; | ||
1087 : | psp[i].pfnDlgProc = dec_proc; | ||
1088 : | psp[i].lParam = (LPARAM)&psi[i]; | ||
1089 : | psp[i].pfnCallback = NULL; | ||
1090 : | |||
1091 : | psi[i].page = i; | ||
1092 : | psi[i].config = &temp; | ||
1093 : | } | ||
1094 : | |||
1095 : | psp[DEC_DLG_POSTPROC].pszTemplate = MAKEINTRESOURCE(IDD_POSTPROC); | ||
1096 : | |||
1097 : | psh.dwSize = sizeof(PROPSHEETHEADER); | ||
1098 : | psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; | ||
1099 : | psh.hwndParent = hParent; | ||
1100 : | psh.hInstance = hInst; | ||
1101 : | psh.pszCaption = (LPSTR) "XviD Configuration"; | ||
1102 : | psh.nPages = DEC_DLG_COUNT; | ||
1103 : | psh.nStartPage = DEC_DLG_POSTPROC; | ||
1104 : | psh.ppsp = (LPCPROPSHEETPAGE)&psp; | ||
1105 : | psh.pfnCallback = NULL; | ||
1106 : | |||
1107 : | PropertySheet(&psh); | ||
1108 : | |||
1109 : | if (temp.save) | ||
1110 : | { | ||
1111 : | memcpy(config, &temp, sizeof(CONFIG)); | ||
1112 : | } | ||
1113 : | } | ||
1114 : | |||
1115 : | |||
1116 : | |||
1117 : | h | 1.3 | /* main dialog proc */ |
1118 : | |||
1119 : | BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
1120 : | { | ||
1121 : | CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); | ||
1122 : | |||
1123 : | switch (uMsg) | ||
1124 : | { | ||
1125 : | case WM_INITDIALOG : | ||
1126 : | SetWindowLong(hDlg, GWL_USERDATA, lParam); | ||
1127 : | |||
1128 : | config = (CONFIG*)lParam; | ||
1129 : | Isibaar | 1.1 | |
1130 : | h | 1.3 | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); |
1131 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); | ||
1132 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); | ||
1133 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); | ||
1134 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); | ||
1135 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); | ||
1136 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); | ||
1137 : | Isibaar | 1.1 | |
1138 : | h | 1.3 | SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1139 : | |||
1140 : | h | 1.4 | InitCommonControls(); |
1141 : | Isibaar | 1.1 | |
1142 : | suxen_drol | 1.22 | if ((hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1143 : | h | 1.4 | CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1144 : | suxen_drol | 1.22 | NULL, NULL, hInst, NULL))) |
1145 : | h | 1.4 | { |
1146 : | SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); | ||
1147 : | SendMessage(hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); | ||
1148 : | SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); | ||
1149 : | Isibaar | 1.1 | |
1150 : | h | 1.4 | EnumChildWindows(hDlg, enum_tooltips, 0); |
1151 : | Isibaar | 1.1 | } |
1152 : | |||
1153 : | h | 1.4 | main_slider(hDlg, config); |
1154 : | main_value(hDlg, config); | ||
1155 : | Isibaar | 1.1 | break; |
1156 : | |||
1157 : | h | 1.3 | case WM_HSCROLL : |
1158 : | if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) | ||
1159 : | { | ||
1160 : | SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); | ||
1161 : | } | ||
1162 : | else | ||
1163 : | Isibaar | 1.1 | { |
1164 : | h | 1.3 | return 0; |
1165 : | Isibaar | 1.1 | } |
1166 : | h | 1.3 | break; |
1167 : | Isibaar | 1.1 | |
1168 : | case WM_COMMAND : | ||
1169 : | if (LOWORD(wParam) == IDC_MODE && HIWORD(wParam) == LBN_SELCHANGE) | ||
1170 : | { | ||
1171 : | h | 1.3 | main_download(hDlg, config); |
1172 : | main_slider(hDlg, config); | ||
1173 : | main_value(hDlg, config); | ||
1174 : | Isibaar | 1.1 | } |
1175 : | h | 1.3 | else if (LOWORD(wParam) == IDC_ADVANCED && HIWORD(wParam) == BN_CLICKED) |
1176 : | Isibaar | 1.1 | { |
1177 : | h | 1.3 | adv_dialog(hDlg, config); |
1178 : | |||
1179 : | if (config->save) | ||
1180 : | { | ||
1181 : | config_reg_set(config); | ||
1182 : | } | ||
1183 : | Isibaar | 1.1 | } |
1184 : | suxen_drol | 1.23 | else if (LOWORD(wParam) == IDC_DECODER && HIWORD(wParam) == BN_CLICKED) |
1185 : | { | ||
1186 : | dec_dialog(hDlg, config); | ||
1187 : | |||
1188 : | if (config->save) | ||
1189 : | { | ||
1190 : | config_reg_set(config); | ||
1191 : | } | ||
1192 : | } | ||
1193 : | h | 1.4 | else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
1194 : | { | ||
1195 : | config_reg_default(config); | ||
1196 : | |||
1197 : | SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); | ||
1198 : | |||
1199 : | main_slider(hDlg, config); | ||
1200 : | main_value(hDlg, config); | ||
1201 : | } | ||
1202 : | Isibaar | 1.1 | else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
1203 : | { | ||
1204 : | suxen_drol | 1.11 | int value = config_get_uint(hDlg, IDC_VALUE, 1); |
1205 : | Isibaar | 1.1 | int max = 1; |
1206 : | |||
1207 : | h | 1.3 | max = (config->mode == DLG_MODE_CBR) ? 10000 : |
1208 : | ((config->mode == DLG_MODE_VBR_QUAL) ? 100 : | ||
1209 : | ((config->mode == DLG_MODE_VBR_QUANT) ? 31 : 1<<30)); | ||
1210 : | Isibaar | 1.1 | |
1211 : | if (value < 1) | ||
1212 : | { | ||
1213 : | value = 1; | ||
1214 : | } | ||
1215 : | if (value > max) | ||
1216 : | { | ||
1217 : | value = max; | ||
1218 : | SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); | ||
1219 : | } | ||
1220 : | |||
1221 : | h | 1.3 | if (config->mode != DLG_MODE_2PASS_2_INT) |
1222 : | Isibaar | 1.1 | { |
1223 : | h | 1.3 | SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
1224 : | Isibaar | 1.1 | } |
1225 : | } | ||
1226 : | h | 1.3 | else if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1227 : | Isibaar | 1.1 | { |
1228 : | h | 1.3 | main_download(hDlg, config); |
1229 : | config->save = TRUE; | ||
1230 : | EndDialog(hDlg, IDOK); | ||
1231 : | Isibaar | 1.1 | } |
1232 : | h | 1.3 | else if (LOWORD(wParam) == IDCANCEL) |
1233 : | Isibaar | 1.1 | { |
1234 : | h | 1.3 | config->save = FALSE; |
1235 : | EndDialog(hDlg, IDCANCEL); | ||
1236 : | Isibaar | 1.1 | } |
1237 : | break; | ||
1238 : | |||
1239 : | default : | ||
1240 : | return 0; | ||
1241 : | } | ||
1242 : | |||
1243 : | return 1; | ||
1244 : | } | ||
1245 : | |||
1246 : | |||
1247 : | h | 1.3 | /* advanced dialog proc */ |
1248 : | Isibaar | 1.1 | |
1249 : | h | 1.3 | BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1250 : | Isibaar | 1.1 | { |
1251 : | h | 1.3 | PROPSHEETINFO *psi; |
1252 : | |||
1253 : | psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); | ||
1254 : | Isibaar | 1.1 | |
1255 : | switch (uMsg) | ||
1256 : | { | ||
1257 : | case WM_INITDIALOG : | ||
1258 : | h | 1.3 | psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
1259 : | Isibaar | 1.1 | |
1260 : | h | 1.3 | SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
1261 : | Isibaar | 1.1 | |
1262 : | h | 1.3 | if (psi->page == DLG_GLOBAL) |
1263 : | Isibaar | 1.1 | { |
1264 : | h | 1.3 | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
1265 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); | ||
1266 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); | ||
1267 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); | ||
1268 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"4 - High"); | ||
1269 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"5 - Very High"); | ||
1270 : | SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"6 - Ultra High"); | ||
1271 : | Isibaar | 1.1 | |
1272 : | h | 1.3 | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
1273 : | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); | ||
1274 : | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); | ||
1275 : | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); | ||
1276 : | suxen_drol | 1.23 | SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"New Modulated HQ"); |
1277 : | Isibaar | 1.1 | |
1278 : | h | 1.3 | SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
1279 : | SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); | ||
1280 : | SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); | ||
1281 : | suxen_drol | 1.11 | |
1282 : | suxen_drol | 1.23 | SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"0 - Off"); |
1283 : | SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"1 - Mode Decision"); | ||
1284 : | SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"2 - Limited Search"); | ||
1285 : | SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"3 - Medium Search"); | ||
1286 : | SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search"); | ||
1287 : | /* XXX: reduced resolution is not ready for prime-time */ | ||
1288 : | ShowWindow(GetDlgItem(hDlg, IDC_REDUCED), SW_HIDE); | ||
1289 : | Isibaar | 1.1 | } |
1290 : | h | 1.4 | else if (psi->page == DLG_2PASSALT) |
1291 : | { | ||
1292 : | SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low"); | ||
1293 : | SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); | ||
1294 : | SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); | ||
1295 : | } | ||
1296 : | suxen_drol | 1.13 | else if (psi->page == DLG_CPU) |
1297 : | { | ||
1298 : | suxen_drol | 1.14 | #ifndef _SMP |
1299 : | suxen_drol | 1.13 | EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
1300 : | EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); | ||
1301 : | suxen_drol | 1.14 | #endif |
1302 : | suxen_drol | 1.13 | } |
1303 : | h | 1.4 | |
1304 : | if (hTooltip) | ||
1305 : | { | ||
1306 : | EnumChildWindows(hDlg, enum_tooltips, 0); | ||
1307 : | } | ||
1308 : | Isibaar | 1.1 | |
1309 : | h | 1.3 | adv_upload(hDlg, psi->page, psi->config); |
1310 : | adv_mode(hDlg, psi->config->mode); | ||
1311 : | Isibaar | 1.1 | break; |
1312 : | |||
1313 : | case WM_COMMAND : | ||
1314 : | h | 1.3 | if (HIWORD(wParam) == BN_CLICKED) |
1315 : | Isibaar | 1.1 | { |
1316 : | switch (LOWORD(wParam)) | ||
1317 : | { | ||
1318 : | h | 1.6 | case IDC_HINTEDME : |
1319 : | h | 1.4 | case IDC_USEALT : |
1320 : | case IDC_USEAUTO : | ||
1321 : | case IDC_USEAUTOBONUS : | ||
1322 : | Isibaar | 1.1 | case IDC_CREDITS_START : |
1323 : | case IDC_CREDITS_END : | ||
1324 : | case IDC_CREDITS_RATE_RADIO : | ||
1325 : | case IDC_CREDITS_QUANT_RADIO : | ||
1326 : | case IDC_CREDITS_SIZE_RADIO : | ||
1327 : | h | 1.3 | case IDC_CPU_AUTO : |
1328 : | case IDC_CPU_FORCE : | ||
1329 : | adv_mode(hDlg, psi->config->mode); | ||
1330 : | Isibaar | 1.1 | break; |
1331 : | h | 1.3 | } |
1332 : | } | ||
1333 : | h | 1.6 | if ((LOWORD(wParam) == IDC_HINT_BROWSE || LOWORD(wParam) == IDC_STATS1_BROWSE || LOWORD(wParam) == IDC_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
1334 : | h | 1.3 | { |
1335 : | OPENFILENAME ofn; | ||
1336 : | char tmp[MAX_PATH]; | ||
1337 : | int hComponent = (LOWORD(wParam) == IDC_STATS1_BROWSE ? IDC_STATS1 : IDC_STATS2); | ||
1338 : | Isibaar | 1.1 | |
1339 : | h | 1.3 | GetDlgItemText(hDlg, hComponent, tmp, MAX_PATH); |
1340 : | Isibaar | 1.1 | |
1341 : | h | 1.3 | memset(&ofn, 0, sizeof(OPENFILENAME)); |
1342 : | ofn.lStructSize = sizeof(OPENFILENAME); | ||
1343 : | Isibaar | 1.1 | |
1344 : | h | 1.3 | ofn.hwndOwner = hDlg; |
1345 : | ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; | ||
1346 : | ofn.lpstrFile = tmp; | ||
1347 : | ofn.nMaxFile = MAX_PATH; | ||
1348 : | ofn.Flags = OFN_PATHMUSTEXIST; | ||
1349 : | Isibaar | 1.1 | |
1350 : | h | 1.6 | if (LOWORD(wParam) == IDC_HINT_BROWSE) |
1351 : | { | ||
1352 : | ofn.lpstrFilter = "motion hints (*.mvh)\0*.mvh\0All files (*.*)\0*.*\0\0"; | ||
1353 : | if (GetOpenFileName(&ofn)) | ||
1354 : | { | ||
1355 : | SetDlgItemText(hDlg, IDC_HINTFILE, tmp); | ||
1356 : | } | ||
1357 : | } | ||
1358 : | else if (LOWORD(wParam) == IDC_STATS1_BROWSE && | ||
1359 : | h | 1.3 | psi->config->mode == DLG_MODE_2PASS_1) |
1360 : | { | ||
1361 : | ofn.Flags |= OFN_OVERWRITEPROMPT; | ||
1362 : | if (GetSaveFileName(&ofn)) | ||
1363 : | Isibaar | 1.1 | { |
1364 : | h | 1.3 | SetDlgItemText(hDlg, hComponent, tmp); |
1365 : | Isibaar | 1.1 | } |
1366 : | h | 1.3 | } |
1367 : | else | ||
1368 : | { | ||
1369 : | ofn.Flags |= OFN_FILEMUSTEXIST; | ||
1370 : | if (GetOpenFileName(&ofn)) { | ||
1371 : | SetDlgItemText(hDlg, hComponent, tmp); | ||
1372 : | Isibaar | 1.1 | } |
1373 : | } | ||
1374 : | } | ||
1375 : | h | 1.3 | else if (LOWORD(wParam) == IDC_QUANTMATRIX && HIWORD(wParam) == BN_CLICKED) |
1376 : | { | ||
1377 : | DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); | ||
1378 : | } | ||
1379 : | Isibaar | 1.1 | break; |
1380 : | |||
1381 : | h | 1.3 | case WM_NOTIFY : |
1382 : | switch (((NMHDR *)lParam)->code) | ||
1383 : | { | ||
1384 : | case PSN_KILLACTIVE : | ||
1385 : | /* validate */ | ||
1386 : | adv_download(hDlg, psi->page, psi->config); | ||
1387 : | SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); | ||
1388 : | break; | ||
1389 : | Isibaar | 1.1 | |
1390 : | h | 1.3 | case PSN_APPLY : |
1391 : | /* apply */ | ||
1392 : | adv_download(hDlg, psi->page, psi->config); | ||
1393 : | SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); | ||
1394 : | psi->config->save = TRUE; | ||
1395 : | break; | ||
1396 : | Isibaar | 1.1 | } |
1397 : | break; | ||
1398 : | |||
1399 : | default : | ||
1400 : | return 0; | ||
1401 : | } | ||
1402 : | |||
1403 : | return 1; | ||
1404 : | } | ||
1405 : | |||
1406 : | |||
1407 : | /* quantization matrix dialog proc */ | ||
1408 : | |||
1409 : | BOOL CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
1410 : | { | ||
1411 : | CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); | ||
1412 : | |||
1413 : | switch (uMsg) | ||
1414 : | { | ||
1415 : | case WM_INITDIALOG : | ||
1416 : | SetWindowLong(hDlg, GWL_USERDATA, lParam); | ||
1417 : | config = (CONFIG*)lParam; | ||
1418 : | quant_upload(hDlg, config); | ||
1419 : | |||
1420 : | h | 1.4 | if (hTooltip) |
1421 : | h | 1.3 | { |
1422 : | h | 1.4 | EnumChildWindows(hDlg, enum_tooltips, 0); |
1423 : | h | 1.3 | } |
1424 : | h | 1.4 | break; |
1425 : | h | 1.3 | |
1426 : | Isibaar | 1.1 | case WM_COMMAND : |
1427 : | if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) | ||
1428 : | { | ||
1429 : | quant_download(hDlg, config); | ||
1430 : | EndDialog(hDlg, IDOK); | ||
1431 : | } | ||
1432 : | else if (LOWORD(wParam) == IDCANCEL) | ||
1433 : | { | ||
1434 : | EndDialog(hDlg, IDCANCEL); | ||
1435 : | } | ||
1436 : | else if ((LOWORD(wParam) == IDC_LOAD || LOWORD(wParam) == IDC_SAVE) && HIWORD(wParam) == BN_CLICKED) | ||
1437 : | { | ||
1438 : | OPENFILENAME ofn; | ||
1439 : | char file[MAX_PATH]; | ||
1440 : | |||
1441 : | HANDLE hFile; | ||
1442 : | DWORD read=128, wrote=0; | ||
1443 : | BYTE quant_data[128]; | ||
1444 : | |||
1445 : | strcpy(file, "\\matrix"); | ||
1446 : | memset(&ofn, 0, sizeof(OPENFILENAME)); | ||
1447 : | ofn.lStructSize = sizeof(OPENFILENAME); | ||
1448 : | |||
1449 : | ofn.hwndOwner = hDlg; | ||
1450 : | ofn.lpstrFilter = "All files (*.*)\0*.*\0\0"; | ||
1451 : | ofn.lpstrFile = file; | ||
1452 : | ofn.nMaxFile = MAX_PATH; | ||
1453 : | ofn.Flags = OFN_PATHMUSTEXIST; | ||
1454 : | |||
1455 : | if (LOWORD(wParam) == IDC_SAVE) | ||
1456 : | { | ||
1457 : | ofn.Flags |= OFN_OVERWRITEPROMPT; | ||
1458 : | if (GetSaveFileName(&ofn)) | ||
1459 : | { | ||
1460 : | hFile = CreateFile(file, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | ||
1461 : | |||
1462 : | quant_download(hDlg, config); | ||
1463 : | memcpy(quant_data, config->qmatrix_intra, 64); | ||
1464 : | memcpy(quant_data+64, config->qmatrix_inter, 64); | ||
1465 : | |||
1466 : | if (hFile == INVALID_HANDLE_VALUE) | ||
1467 : | { | ||
1468 : | h | 1.4 | DEBUGERR("Couldn't save quant matrix"); |
1469 : | Isibaar | 1.1 | } |
1470 : | else | ||
1471 : | { | ||
1472 : | if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) | ||
1473 : | { | ||
1474 : | h | 1.4 | DEBUGERR("Couldnt write quant matrix"); |
1475 : | Isibaar | 1.1 | } |
1476 : | } | ||
1477 : | |||
1478 : | CloseHandle(hFile); | ||
1479 : | } | ||
1480 : | } | ||
1481 : | else | ||
1482 : | { | ||
1483 : | ofn.Flags |= OFN_FILEMUSTEXIST; | ||
1484 : | if (GetOpenFileName(&ofn)) | ||
1485 : | { | ||
1486 : | hFile = CreateFile(file, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); | ||
1487 : | |||
1488 : | if (hFile == INVALID_HANDLE_VALUE) | ||
1489 : | { | ||
1490 : | h | 1.4 | DEBUGERR("Couldn't load quant matrix"); |
1491 : | Isibaar | 1.1 | } |
1492 : | else | ||
1493 : | { | ||
1494 : | if (!ReadFile(hFile, quant_data, 128, &read, 0)) | ||
1495 : | { | ||
1496 : | h | 1.4 | DEBUGERR("Couldnt read quant matrix"); |
1497 : | Isibaar | 1.1 | } |
1498 : | else | ||
1499 : | { | ||
1500 : | memcpy(config->qmatrix_intra, quant_data, 64); | ||
1501 : | memcpy(config->qmatrix_inter, quant_data+64, 64); | ||
1502 : | quant_upload(hDlg, config); | ||
1503 : | } | ||
1504 : | } | ||
1505 : | |||
1506 : | CloseHandle(hFile); | ||
1507 : | } | ||
1508 : | } | ||
1509 : | h | 1.3 | } |
1510 : | break; | ||
1511 : | |||
1512 : | default : | ||
1513 : | return 0; | ||
1514 : | } | ||
1515 : | |||
1516 : | return 1; | ||
1517 : | } | ||
1518 : | |||
1519 : | |||
1520 : | /* about dialog proc */ | ||
1521 : | |||
1522 : | BOOL CALLBACK about_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
1523 : | { | ||
1524 : | switch (uMsg) | ||
1525 : | { | ||
1526 : | case WM_INITDIALOG : | ||
1527 : | { | ||
1528 : | XVID_INIT_PARAM init_param; | ||
1529 : | char core[100]; | ||
1530 : | HFONT hFont; | ||
1531 : | LOGFONT lfData; | ||
1532 : | |||
1533 : | Foxer | 1.18 | SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1534 : | chl | 1.17 | SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
1535 : | h | 1.3 | |
1536 : | suxen_drol | 1.12 | init_param.cpu_flags = XVID_CPU_CHKONLY; |
1537 : | h | 1.3 | xvid_init(NULL, 0, &init_param, 0); |
1538 : | wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); | ||
1539 : | SetDlgItemText(hDlg, IDC_CORE, core); | ||
1540 : | |||
1541 : | hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); | ||
1542 : | |||
1543 : | if (GetObject(hFont, sizeof(LOGFONT), &lfData)) | ||
1544 : | { | ||
1545 : | lfData.lfUnderline = 1; | ||
1546 : | |||
1547 : | hFont = CreateFontIndirect(&lfData); | ||
1548 : | if (hFont) | ||
1549 : | { | ||
1550 : | SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); | ||
1551 : | } | ||
1552 : | } | ||
1553 : | |||
1554 : | SetClassLong(GetDlgItem(hDlg, IDC_WEBSITE), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); | ||
1555 : | SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); | ||
1556 : | } | ||
1557 : | break; | ||
1558 : | |||
1559 : | case WM_CTLCOLORSTATIC : | ||
1560 : | if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) | ||
1561 : | { | ||
1562 : | SetBkMode((HDC)wParam, TRANSPARENT) ; | ||
1563 : | SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0)); | ||
1564 : | return (BOOL)GetStockObject(NULL_BRUSH); | ||
1565 : | } | ||
1566 : | return 0; | ||
1567 : | |||
1568 : | case WM_COMMAND : | ||
1569 : | if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) | ||
1570 : | { | ||
1571 : | ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); | ||
1572 : | } | ||
1573 : | else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) | ||
1574 : | { | ||
1575 : | EndDialog(hDlg, LOWORD(wParam)); | ||
1576 : | Isibaar | 1.1 | } |
1577 : | break; | ||
1578 : | |||
1579 : | default : | ||
1580 : | return 0; | ||
1581 : | } | ||
1582 : | |||
1583 : | return 1; | ||
1584 : | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |