23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
26 |
* ... ??? |
* 15.06.2002 added bframes options |
27 |
* 05.03.2002 Version 0.01; Min Chen <chenm001@163.com> |
* 21.04.2002 fixed custom matrix support, tried to get dll size down |
28 |
|
* 17.04.2002 re-enabled lumi masking in 1st pass |
29 |
|
* 15.04.2002 updated cbr support |
30 |
|
* 07.04.2002 min keyframe interval checkbox |
31 |
|
* 2-pass max bitrate and overflow customization |
32 |
|
* 04.04.2002 interlacing support |
33 |
|
* hinted ME support |
34 |
|
* 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 |
|
* 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 |
|
* 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 |
* Add Core version display to about box |
|
* |
|
53 |
* 01.12.2001 inital version; (c)2001 peter ross <suxen_drol@hotmail.com> |
* 01.12.2001 inital version; (c)2001 peter ross <suxen_drol@hotmail.com> |
54 |
* |
* |
55 |
*************************************************************************/ |
*************************************************************************/ |
56 |
|
|
57 |
|
|
58 |
#include <windows.h> |
#include <windows.h> |
59 |
|
#include <commctrl.h> |
60 |
#include <shlobj.h> |
#include <shlobj.h> |
61 |
#include <prsht.h> |
#include <prsht.h> |
62 |
|
#ifdef _SMP |
63 |
|
#include <pthread.h> |
64 |
|
#endif |
65 |
|
|
66 |
#include "codec.h" |
#include "codec.h" |
67 |
#include "config.h" |
#include "config.h" |
|
#include "resource.h" |
|
68 |
#include "xvid.h" // cpu masks |
#include "xvid.h" // cpu masks |
69 |
#include <stdio.h> // sprintf() |
#include "resource.h" |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
/* registry info structs */ |
74 |
|
|
75 |
|
CONFIG reg; |
76 |
|
|
77 |
|
REG_INT const reg_ints[] = { |
78 |
|
{"mode", ®.mode, DLG_MODE_CBR}, |
79 |
|
{"quality", ®.quality, 85}, |
80 |
|
{"quant", ®.quant, 5}, |
81 |
|
{"rc_bitrate", ®.rc_bitrate, 900000}, |
82 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
83 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
84 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
85 |
|
|
86 |
|
{"motion_search", ®.motion_search, 5}, |
87 |
|
{"quant_type", ®.quant_type, 0}, |
88 |
|
{"fourcc_used", ®.fourcc_used, 0}, |
89 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
90 |
|
{"min_key_interval", ®.min_key_interval, 1}, |
91 |
|
{"lum_masking", ®.lum_masking, 0}, |
92 |
|
{"interlacing", ®.interlacing, 0}, |
93 |
|
#ifdef BFRAMES |
94 |
|
{"max_bframes", ®.max_bframes, -1}, |
95 |
|
{"bquant_ratio", ®.bquant_ratio, 200}, |
96 |
|
{"packed", ®.packed, 0}, |
97 |
|
{"dx50bvop", ®.dx50bvop, 0}, |
98 |
|
{"debug", ®.debug, 0}, |
99 |
|
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
100 |
|
#endif |
101 |
|
|
102 |
|
{"min_iquant", ®.min_iquant, 1}, |
103 |
|
{"max_iquant", ®.max_iquant, 31}, |
104 |
|
{"min_pquant", ®.min_pquant, 1}, |
105 |
|
{"max_pquant", ®.max_pquant, 31}, |
106 |
|
|
107 |
|
{"desired_size", ®.desired_size, 570000}, |
108 |
|
{"keyframe_boost", ®.keyframe_boost, 20}, |
109 |
|
{"discard1pass", ®.discard1pass, 1}, |
110 |
|
{"dummy2pass", ®.dummy2pass, 0}, |
111 |
|
{"curve_compression_high", ®.curve_compression_high, 25}, |
112 |
|
{"curve_compression_low", ®.curve_compression_low, 10}, |
113 |
|
{"use_alt_curve", ®.use_alt_curve, 0}, |
114 |
|
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
115 |
|
{"alt_curve_auto_str", ®.alt_curve_auto_str, 50}, |
116 |
|
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
117 |
|
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
118 |
|
{"alt_curve_type", ®.alt_curve_type, 1}, |
119 |
|
{"alt_curve_high_dist", ®.alt_curve_high_dist, 300}, |
120 |
|
{"alt_curve_low_dist", ®.alt_curve_low_dist, 300}, |
121 |
|
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
122 |
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 240}, |
123 |
|
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
124 |
|
{"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
125 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
126 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
127 |
|
{"hinted_me", ®.hinted_me, 0}, |
128 |
|
|
129 |
|
{"credits_start", ®.credits_start, 0}, |
130 |
|
{"credits_start_begin", ®.credits_start_begin, 0}, |
131 |
|
{"credits_start_end", ®.credits_start_end, 0}, |
132 |
|
{"credits_end", ®.credits_end, 0}, |
133 |
|
{"credits_end_begin", ®.credits_end_begin, 0}, |
134 |
|
{"credits_end_end", ®.credits_end_end, 0}, |
135 |
|
|
136 |
|
{"credits_mode", ®.credits_mode, 0}, |
137 |
|
{"credits_rate", ®.credits_rate, 20}, |
138 |
|
{"credits_quant_i", ®.credits_quant_i, 20}, |
139 |
|
{"credits_quant_p", ®.credits_quant_p, 20}, |
140 |
|
{"credits_start_size", ®.credits_start_size, 10000}, |
141 |
|
{"credits_end_size", ®.credits_end_size, 10000} |
142 |
|
}; |
143 |
|
|
144 |
|
REG_STR const reg_strs[] = { |
145 |
|
{"hintfile", reg.hintfile, CONFIG_HINTFILE}, |
146 |
|
{"stats1", reg.stats1, CONFIG_2PASS_1_FILE}, |
147 |
|
{"stats2", reg.stats2, CONFIG_2PASS_2_FILE} |
148 |
|
// {"build", reg.build, XVID_BUILD} |
149 |
|
}; |
150 |
|
|
151 |
/* get config settings from registry */ |
/* get config settings from registry */ |
152 |
|
|
|
#define REG_GET_N(X, Y, Z) size=sizeof(int);if(RegQueryValueEx(hKey, X, 0, 0, (LPBYTE)&Y, &size) != ERROR_SUCCESS) {Y=Z;} |
|
|
#define REG_GET_S(X, Y, Z) size=MAX_PATH;if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {lstrcpy(Y, Z);} |
|
153 |
#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)));} |
#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)));} |
154 |
|
|
155 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
157 |
HKEY hKey; |
HKEY hKey; |
158 |
DWORD size; |
DWORD size; |
159 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
160 |
|
int i; |
161 |
|
|
162 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = XVID_CPU_CHKONLY; |
163 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
164 |
config->cpu = init_param.cpu_flags; |
reg.cpu = init_param.cpu_flags; |
165 |
|
|
166 |
|
#ifdef _SMP |
167 |
|
reg.num_threads = pthread_num_processors_np(); |
168 |
|
#endif |
169 |
|
|
170 |
|
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
171 |
|
|
172 |
|
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
173 |
|
{ |
174 |
|
size = sizeof(int); |
175 |
|
|
176 |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); |
if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS) |
177 |
|
{ |
178 |
|
*reg_ints[i].config_int = reg_ints[i].def; |
179 |
|
} |
180 |
|
} |
181 |
|
|
182 |
REG_GET_N("mode", config->mode, DLG_MODE_CBR) |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
183 |
REG_GET_N("bitrate", config->bitrate, 900000) |
{ |
184 |
REG_GET_N("quality", config->quality, 85) |
size = MAX_PATH; |
|
REG_GET_N("quant", config->quant, 5) |
|
|
|
|
|
REG_GET_S("stats1", config->stats1, CONFIG_2PASS_1_FILE) |
|
|
REG_GET_S("stats2", config->stats2, CONFIG_2PASS_2_FILE) |
|
|
REG_GET_N("discard1pass", config->discard1pass, 1) |
|
|
REG_GET_N("dummy2pass", config->dummy2pass, 0) |
|
|
REG_GET_N("desired_size", config->desired_size, 570000) |
|
|
|
|
|
REG_GET_N("min_iquant", config->min_iquant, 1) |
|
|
REG_GET_N("max_iquant", config->max_iquant, 31) |
|
|
|
|
|
REG_GET_N("keyframe_boost", config->keyframe_boost, 20) |
|
|
REG_GET_N("min_key_interval", config->min_key_interval, 6) |
|
|
REG_GET_N("bitrate_payback_delay", config->bitrate_payback_delay, 240) |
|
|
REG_GET_N("bitrate_payback_method", config->bitrate_payback_method, 0) |
|
|
REG_GET_N("curve_compression_high", config->curve_compression_high, 25) |
|
|
REG_GET_N("curve_compression_low", config->curve_compression_low, 15) |
|
|
|
|
|
REG_GET_N("credits_start", config->credits_start, 0) |
|
|
REG_GET_N("credits_start_begin", config->credits_start_begin, 0) |
|
|
REG_GET_N("credits_start_end", config->credits_start_end, 0) |
|
|
REG_GET_N("credits_end", config->credits_end, 0) |
|
|
REG_GET_N("credits_end_begin", config->credits_end_begin, 0) |
|
|
REG_GET_N("credits_end_end", config->credits_end_end, 0) |
|
|
|
|
|
REG_GET_N("credits_mode", config->credits_mode, 0) |
|
|
REG_GET_N("credits_rate", config->credits_rate, 10) |
|
|
REG_GET_N("credits_quant_i", config->credits_quant_i, 20) |
|
|
REG_GET_N("credits_quant_p", config->credits_quant_p, 20) |
|
|
REG_GET_N("credits_start_size", config->credits_start_size, 10000) |
|
|
REG_GET_N("credits_end_size", config->credits_end_size, 10000) |
|
|
|
|
|
REG_GET_N("motion_search", config->motion_search, 5) |
|
|
REG_GET_N("quant_type", config->quant_type, 0) |
|
|
REG_GET_N("max_key_interval", config->max_key_interval, 300) |
|
|
|
|
|
REG_GET_N("rc_buffersize", config->rc_buffersize, 2048000) |
|
|
|
|
|
REG_GET_N("max_quant", config->max_quant, 31) |
|
|
REG_GET_N("min_quant", config->min_quant, 1) |
|
|
REG_GET_N("lum_masking", config->lum_masking, 0) |
|
185 |
|
|
186 |
REG_GET_N("fourcc_used", config->fourcc_used, 0) |
if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS) |
187 |
|
{ |
188 |
|
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
189 |
|
} |
190 |
|
} |
191 |
|
|
192 |
{ |
{ |
193 |
BYTE default_qmatrix_intra[] = { |
BYTE default_qmatrix_intra[] = { |
212 |
23,24,25,27,28,30,31,33 |
23,24,25,27,28,30,31,33 |
213 |
}; |
}; |
214 |
|
|
215 |
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra) |
REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra); |
216 |
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter) |
REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter); |
217 |
} |
} |
218 |
|
|
219 |
|
memcpy(config, ®, sizeof(CONFIG)); |
220 |
|
|
221 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
222 |
} |
} |
223 |
|
|
224 |
|
|
225 |
/* put config settings in registry */ |
/* put config settings in registry */ |
226 |
|
|
|
#define REG_SET_N(X, Y) RegSetValueEx(hKey, X, 0, REG_DWORD, (LPBYTE)&Y, sizeof(int)) |
|
|
#define REG_SET_S(X, Y) RegSetValueEx(hKey, X, 0, REG_SZ, Y, lstrlen(Y)+1) |
|
227 |
#define REG_SET_B(X, Y) RegSetValueEx(hKey, X, 0, REG_BINARY, Y, sizeof((Y))) |
#define REG_SET_B(X, Y) RegSetValueEx(hKey, X, 0, REG_BINARY, Y, sizeof((Y))) |
228 |
|
|
229 |
void config_reg_set(CONFIG * config) |
void config_reg_set(CONFIG * config) |
230 |
{ |
{ |
231 |
HKEY hKey; |
HKEY hKey; |
232 |
DWORD dispo; |
DWORD dispo; |
233 |
|
int i; |
234 |
|
|
235 |
if (RegCreateKeyEx( |
if (RegCreateKeyEx( |
236 |
XVID_REG_KEY, |
XVID_REG_KEY, |
237 |
XVID_REG_SUBKEY, |
XVID_REG_PARENT "\\" XVID_REG_CHILD, |
238 |
0, |
0, |
239 |
XVID_REG_CLASS, |
XVID_REG_CLASS, |
240 |
REG_OPTION_NON_VOLATILE, |
REG_OPTION_NON_VOLATILE, |
247 |
return; |
return; |
248 |
} |
} |
249 |
|
|
250 |
REG_SET_N("mode", config->mode); |
memcpy(®, config, sizeof(CONFIG)); |
251 |
REG_SET_N("bitrate", config->bitrate); |
|
252 |
REG_SET_N("quality", config->quality); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
253 |
REG_SET_N("quant", config->quant); |
{ |
254 |
|
RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int)); |
255 |
REG_SET_S("stats1", config->stats1); |
} |
|
REG_SET_S("stats2", config->stats2); |
|
|
REG_SET_N("discard1pass", config->discard1pass); |
|
|
REG_SET_N("dummy2pass", config->dummy2pass); |
|
|
REG_SET_N("desired_size", config->desired_size); |
|
|
|
|
|
REG_SET_N("min_iquant", config->min_iquant); |
|
|
REG_SET_N("max_iquant", config->max_iquant); |
|
|
|
|
|
REG_SET_N("keyframe_boost", config->keyframe_boost); |
|
|
REG_SET_N("min_key_interval", config->min_key_interval); |
|
|
REG_SET_N("bitrate_payback_delay", config->bitrate_payback_delay); |
|
|
REG_SET_N("bitrate_payback_method", config->bitrate_payback_method); |
|
|
REG_SET_N("curve_compression_high", config->curve_compression_high); |
|
|
REG_SET_N("curve_compression_low", config->curve_compression_low); |
|
|
|
|
|
REG_SET_N("credits_start", config->credits_start); |
|
|
REG_SET_N("credits_start_begin", config->credits_start_begin); |
|
|
REG_SET_N("credits_start_end", config->credits_start_end); |
|
|
REG_SET_N("credits_end", config->credits_end); |
|
|
REG_SET_N("credits_end_begin", config->credits_end_begin); |
|
|
REG_SET_N("credits_end_end", config->credits_end_end); |
|
|
|
|
|
REG_SET_N("credits_mode", config->credits_mode); |
|
|
REG_SET_N("credits_rate", config->credits_rate); |
|
|
REG_SET_N("credits_quant_i", config->credits_quant_i); |
|
|
REG_SET_N("credits_quant_p", config->credits_quant_p); |
|
|
REG_SET_N("credits_start_size", config->credits_start_size); |
|
|
REG_SET_N("credits_end_size", config->credits_end_size); |
|
|
|
|
|
REG_SET_N("motion_search", config->motion_search); |
|
|
REG_SET_N("quant_type", config->quant_type); |
|
|
REG_SET_N("max_key_interval", config->max_key_interval); |
|
|
|
|
|
REG_SET_N("rc_buffersize", config->rc_buffersize); |
|
|
|
|
|
REG_SET_N("max_quant", config->max_quant); |
|
|
REG_SET_N("min_quant", config->min_quant); |
|
|
REG_SET_N("lum_masking", config->lum_masking); |
|
256 |
|
|
257 |
REG_SET_N("fourcc_used", config->fourcc_used); |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
258 |
|
{ |
259 |
|
RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1); |
260 |
|
} |
261 |
|
|
262 |
REG_SET_B("qmatrix_intra", config->qmatrix_intra); |
REG_SET_B("qmatrix_intra", reg.qmatrix_intra); |
263 |
REG_SET_B("qmatrix_inter", config->qmatrix_inter); |
REG_SET_B("qmatrix_inter", reg.qmatrix_inter); |
264 |
|
|
265 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
266 |
} |
} |
267 |
|
|
268 |
|
|
269 |
/* enable/disable dialog controls based on encoder mode */ |
/* clear XviD registry key, load defaults */ |
|
|
|
|
#define ENABLE(X) EnableWindow(GetDlgItem(hDlg, (X)), TRUE); |
|
|
#define DISABLE(X) EnableWindow(GetDlgItem(hDlg, (X)), FALSE); |
|
|
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
|
270 |
|
|
271 |
void config_mode(HWND hDlg) |
void config_reg_default(CONFIG * config) |
272 |
{ |
{ |
273 |
XVID_INIT_PARAM init_param; |
HKEY hKey; |
|
LONG mode; |
|
|
|
|
|
mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
|
274 |
|
|
275 |
if (mode == DLG_MODE_VBR_QUAL || mode == DLG_MODE_VBR_QUANT || |
if (RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT, 0, KEY_ALL_ACCESS, &hKey)) |
|
mode == DLG_MODE_2PASS_1 || mode == DLG_MODE_2PASS_2_INT) |
|
|
{ |
|
|
ENABLE(IDC_CREDITS); |
|
|
} |
|
|
else |
|
276 |
{ |
{ |
277 |
DISABLE(IDC_CREDITS); |
DEBUG1("Couldn't open registry key for deletion - ", GetLastError()); |
278 |
|
return; |
279 |
} |
} |
280 |
|
|
281 |
if (mode == DLG_MODE_VBR_QUAL || mode == DLG_MODE_VBR_QUANT || mode == DLG_MODE_CBR) |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) |
|
{ |
|
|
ENABLE(IDC_VALUE_STATIC); |
|
|
ENABLE(IDC_VALUE); |
|
|
ENABLE(IDC_SLIDER_STATIC); |
|
|
ENABLE(IDC_SLIDER); |
|
|
} |
|
|
else |
|
282 |
{ |
{ |
283 |
DISABLE(IDC_VALUE_STATIC); |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
284 |
DISABLE(IDC_VALUE); |
return; |
|
DISABLE(IDC_SLIDER_STATIC); |
|
|
DISABLE(IDC_SLIDER); |
|
285 |
} |
} |
286 |
|
|
287 |
if (mode == DLG_MODE_2PASS_1 || mode == DLG_MODE_2PASS_2_EXT || mode == DLG_MODE_2PASS_2_INT) |
RegCloseKey(hKey); |
288 |
{ |
config_reg_get(config); |
289 |
ENABLE(IDC_2PASS_STATS1_STATIC); |
config_reg_set(config); |
|
ENABLE(IDC_2PASS_STATS1); |
|
|
ENABLE(IDC_2PASS_STATS1_BROWSE); |
|
|
ENABLE(IDC_2PASS_INT); |
|
|
} |
|
|
else |
|
|
{ |
|
|
DISABLE(IDC_2PASS_STATS1_STATIC); |
|
|
DISABLE(IDC_2PASS_STATS1); |
|
|
DISABLE(IDC_2PASS_STATS1_BROWSE); |
|
|
DISABLE(IDC_2PASS_INT); |
|
290 |
} |
} |
291 |
|
|
|
if (mode == DLG_MODE_2PASS_1) |
|
|
{ |
|
|
ENABLE(IDC_DISCARD1PASS); |
|
|
} |
|
|
else |
|
|
{ |
|
|
DISABLE(IDC_DISCARD1PASS); |
|
|
} |
|
292 |
|
|
293 |
if (mode == DLG_MODE_2PASS_2_EXT) |
/* leaves current config value if dialog item is empty */ |
294 |
{ |
|
295 |
ENABLE(IDC_2PASS_STATS1_STATIC); |
int config_get_int(HWND hDlg, INT item, int config) |
|
ENABLE(IDC_2PASS_STATS2); |
|
|
ENABLE(IDC_2PASS_STATS2_BROWSE); |
|
|
} |
|
|
else |
|
296 |
{ |
{ |
297 |
DISABLE(IDC_2PASS_STATS1_STATIC); |
BOOL success = FALSE; |
|
DISABLE(IDC_2PASS_STATS2); |
|
|
DISABLE(IDC_2PASS_STATS2_BROWSE); |
|
|
} |
|
298 |
|
|
299 |
if (ISDLGSET(IDC_CPU_FORCE)) { |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
|
ENABLE(IDC_CPU_MMX); |
|
|
ENABLE(IDC_CPU_MMXEXT); |
|
|
ENABLE(IDC_CPU_SSE); |
|
|
ENABLE(IDC_CPU_SSE2); |
|
|
ENABLE(IDC_CPU_3DNOW); |
|
|
ENABLE(IDC_CPU_3DNOWEXT); |
|
|
} else { |
|
|
xvid_init(0, 0, &init_param, NULL); |
|
300 |
|
|
301 |
CheckDlgButton(hDlg, IDC_CPU_MMX, init_param.cpu_flags & XVID_CPU_MMX ? BST_CHECKED : BST_UNCHECKED); |
return (success) ? tmp : config; |
|
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, init_param.cpu_flags & XVID_CPU_MMXEXT ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_SSE, init_param.cpu_flags & XVID_CPU_SSE ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_SSE2, init_param.cpu_flags & XVID_CPU_SSE2 ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_3DNOW, init_param.cpu_flags & XVID_CPU_3DNOW ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, init_param.cpu_flags & XVID_CPU_3DNOWEXT ? BST_CHECKED : BST_UNCHECKED); |
|
|
|
|
|
DISABLE(IDC_CPU_MMX); |
|
|
DISABLE(IDC_CPU_MMXEXT); |
|
|
DISABLE(IDC_CPU_SSE); |
|
|
DISABLE(IDC_CPU_SSE2); |
|
|
DISABLE(IDC_CPU_3DNOW); |
|
|
DISABLE(IDC_CPU_3DNOWEXT); |
|
302 |
} |
} |
|
} |
|
|
|
|
303 |
|
|
|
/* upload config data into dialog */ |
|
304 |
|
|
305 |
void config_upload(HWND hDlg, int page, CONFIG * config) |
int config_get_uint(HWND hDlg, UINT item, int config) |
|
{ |
|
|
switch (page) |
|
306 |
{ |
{ |
307 |
case DLG_MAIN : |
BOOL success = FALSE; |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
|
|
config_mode(hDlg); |
|
308 |
|
|
309 |
config_slider(hDlg, config); |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
|
config_value(hDlg, config); |
|
310 |
|
|
311 |
SetDlgItemText(hDlg, IDC_2PASS_STATS1, config->stats1); |
return (success) ? tmp : config; |
312 |
SetDlgItemText(hDlg, IDC_2PASS_STATS2, config->stats2); |
} |
|
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
|
|
break; |
|
313 |
|
|
|
case DLG_ADV : |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
|
|
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_SETCURSEL, config->quant_type, 0); |
|
|
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
|
314 |
|
|
315 |
SetDlgItemInt(hDlg, IDC_MINQ, config->min_quant, FALSE); |
/* downloads data from main dialog */ |
|
SetDlgItemInt(hDlg, IDC_MAXQ, config->max_quant, FALSE); |
|
|
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
|
316 |
|
|
317 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
void main_download(HWND hDlg, CONFIG * config) |
318 |
|
{ |
319 |
|
switch(config->mode) |
320 |
|
{ |
321 |
|
default : |
322 |
|
case DLG_MODE_CBR : |
323 |
|
config->rc_bitrate = config_get_uint(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
324 |
break; |
break; |
325 |
|
|
326 |
case DLG_DEBUG : |
case DLG_MODE_VBR_QUAL : |
327 |
SetDlgItemInt(hDlg, IDC_RC_BUFFERSIZE, config->rc_buffersize, FALSE); |
config->quality = config_get_uint(hDlg, IDC_VALUE, config->quality); |
|
|
|
|
SetDlgItemInt(hDlg, IDC_IMINQ, config->min_iquant, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_IMAXQ, config->max_iquant, FALSE); |
|
|
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
|
328 |
break; |
break; |
329 |
|
|
330 |
case DLG_CPU : |
case DLG_MODE_VBR_QUANT : |
331 |
CheckDlgButton(hDlg, IDC_CPU_MMX, config->cpu & XVID_CPU_MMX ? BST_CHECKED : BST_UNCHECKED); |
config->quant = config_get_uint(hDlg, IDC_VALUE, config->quant); |
332 |
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, config->cpu & XVID_CPU_MMXEXT ? BST_CHECKED : BST_UNCHECKED); |
break; |
|
CheckDlgButton(hDlg, IDC_CPU_SSE, config->cpu & XVID_CPU_SSE ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_SSE2, config->cpu & XVID_CPU_SSE2 ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_3DNOW, config->cpu & XVID_CPU_3DNOW ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, config->cpu & XVID_CPU_3DNOWEXT ? BST_CHECKED : BST_UNCHECKED); |
|
333 |
|
|
334 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
case DLG_MODE_2PASS_2_INT : |
335 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->desired_size = config_get_uint(hDlg, IDC_VALUE, config->desired_size); |
336 |
break; |
break; |
337 |
} |
} |
|
} |
|
338 |
|
|
339 |
|
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
340 |
|
} |
341 |
|
|
|
/* download config data from dialog |
|
|
replaces invalid values instead of alerting user for now |
|
|
*/ |
|
342 |
|
|
343 |
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
/* updates the edit box */ |
344 |
|
|
345 |
void config_download(HWND hDlg, int page, CONFIG * config) |
void main_value(HWND hDlg, CONFIG* config) |
346 |
{ |
{ |
347 |
|
char* text; |
348 |
int value; |
int value; |
349 |
|
int enabled = TRUE; |
350 |
|
|
351 |
switch (page) |
switch (config->mode) |
352 |
{ |
{ |
353 |
case DLG_MAIN : |
default : |
354 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
enabled = FALSE; |
|
|
|
|
value = config_get_int(hDlg, IDC_VALUE, 2); |
|
355 |
|
|
356 |
switch (SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_GETRANGEMAX, 0, 0)) |
case DLG_MODE_CBR : |
357 |
{ |
text = "Bitrate (Kbps):"; |
358 |
case 10000 : |
value = config->rc_bitrate / CONFIG_KBPS; |
|
CONSTRAINVAL(value, 1, 10000) |
|
|
config->bitrate = value * CONFIG_KBPS; |
|
359 |
break; |
break; |
360 |
|
|
361 |
case 100 : |
case DLG_MODE_VBR_QUAL : |
362 |
CONSTRAINVAL(value, 0, 100) |
text = "Quality:"; |
363 |
config->quality = value; |
value = config->quality; |
364 |
break; |
break; |
365 |
|
|
366 |
case 31 : |
case DLG_MODE_VBR_QUANT : |
367 |
CONSTRAINVAL(value, 1, 31) |
text = "Quantizer:"; |
368 |
config->quant = value; |
value = config->quant; |
369 |
break; |
break; |
|
} |
|
370 |
|
|
371 |
GetDlgItemText(hDlg, IDC_2PASS_STATS1, config->stats1, MAX_PATH); |
case DLG_MODE_2PASS_2_INT : |
372 |
if (config->stats1[0] == '\0') |
text = "Desired size (Kbtyes):"; |
373 |
{ |
value = config->desired_size; |
|
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
|
|
} |
|
|
GetDlgItemText(hDlg, IDC_2PASS_STATS2, config->stats2, MAX_PATH); |
|
|
if (config->stats2[0] == '\0') |
|
|
{ |
|
|
lstrcpy(config->stats2, CONFIG_2PASS_2_FILE); |
|
|
} |
|
|
|
|
|
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
|
374 |
break; |
break; |
|
|
|
|
case DLG_ADV : |
|
|
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
|
|
config->quant_type = SendDlgItemMessage(hDlg, IDC_QTYPE, CB_GETCURSEL, 0, 0); |
|
|
config->max_key_interval = config_get_int(hDlg, IDC_MAXKEY, config->max_key_interval); |
|
|
|
|
|
config->min_quant = config_get_int(hDlg, IDC_MINQ, config->min_quant); |
|
|
config->max_quant = config_get_int(hDlg, IDC_MAXQ, config->max_quant); |
|
|
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
|
|
|
|
|
CONSTRAINVAL(config->min_quant, 1, 31) |
|
|
CONSTRAINVAL(config->max_quant, 1, 31) |
|
|
if(config->max_quant < config->min_quant) |
|
|
{ |
|
|
config->max_quant = config->min_quant; |
|
375 |
} |
} |
376 |
|
|
377 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); |
378 |
break; |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
|
|
|
|
case DLG_DEBUG: |
|
|
config->rc_buffersize = config_get_int(hDlg, IDC_RC_BUFFERSIZE, config->rc_buffersize); |
|
|
|
|
|
config->min_iquant = config_get_int(hDlg, IDC_IMINQ, config->min_iquant); |
|
|
config->max_iquant = config_get_int(hDlg, IDC_IMAXQ, config->max_iquant); |
|
|
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
|
|
|
|
|
CONSTRAINVAL(config->min_iquant, 1, 31) |
|
|
CONSTRAINVAL(config->min_iquant, 1, 31) |
|
|
if(config->max_iquant < config->min_iquant) |
|
|
{ |
|
|
config->max_iquant = config->min_iquant; |
|
|
} |
|
|
break; |
|
379 |
|
|
380 |
case DLG_CPU : |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
381 |
config->cpu = 0; |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE), enabled); |
|
config->cpu |= ISDLGSET(IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_SSE) ? XVID_CPU_SSE: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_SSE2) ? XVID_CPU_SSE2: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
|
|
break; |
|
|
} |
|
382 |
} |
} |
383 |
|
|
384 |
|
|
385 |
/* updates the slider */ |
/* updates the slider */ |
386 |
|
|
387 |
void config_slider(HWND hDlg, CONFIG* config) |
void main_slider(HWND hDlg, CONFIG * config) |
388 |
{ |
{ |
389 |
char* text; |
char* text; |
390 |
long range; |
long range; |
391 |
int pos; |
int pos; |
392 |
|
int enabled = TRUE; |
393 |
|
|
394 |
switch (config->mode) |
switch (config->mode) |
395 |
{ |
{ |
396 |
default : |
default : |
397 |
|
enabled = FALSE; |
398 |
|
|
399 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
400 |
text = "Bitrate (Kbps):"; |
text = "Bitrate (Kbps):"; |
401 |
range = MAKELONG(0,10000); |
range = MAKELONG(0,10000); |
402 |
pos = config->bitrate / CONFIG_KBPS; |
pos = config->rc_bitrate / CONFIG_KBPS; |
403 |
break; |
break; |
404 |
|
|
405 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
418 |
SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); |
SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); |
419 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); |
420 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); |
421 |
|
|
422 |
|
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER_STATIC), enabled); |
423 |
|
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER), enabled); |
424 |
} |
} |
425 |
|
|
426 |
|
|
427 |
/* updates the edit box */ |
/* load advanced options property sheet */ |
428 |
|
|
429 |
void config_value(HWND hDlg, CONFIG* config) |
void adv_dialog(HWND hParent, CONFIG * config) |
430 |
{ |
{ |
431 |
char* text; |
PROPSHEETINFO psi[DLG_COUNT]; |
432 |
int value; |
PROPSHEETPAGE psp[DLG_COUNT]; |
433 |
|
PROPSHEETHEADER psh; |
434 |
|
CONFIG temp; |
435 |
|
int i; |
436 |
|
|
437 |
switch (config->mode) |
config->save = FALSE; |
438 |
{ |
memcpy(&temp, config, sizeof(CONFIG)); |
|
default : |
|
|
case DLG_MODE_CBR : |
|
|
text = "Bitrate (Kbps):"; |
|
|
value = config->bitrate / CONFIG_KBPS; |
|
|
break; |
|
439 |
|
|
440 |
case DLG_MODE_VBR_QUAL : |
for (i=0 ; i<DLG_COUNT ; ++i) |
441 |
text = "Quality:"; |
{ |
442 |
value = config->quality; |
psp[i].dwSize = sizeof(PROPSHEETPAGE); |
443 |
break; |
psp[i].dwFlags = 0; |
444 |
|
psp[i].hInstance = hInst; |
445 |
|
psp[i].pfnDlgProc = adv_proc; |
446 |
|
psp[i].lParam = (LPARAM)&psi[i]; |
447 |
|
psp[i].pfnCallback = NULL; |
448 |
|
|
449 |
case DLG_MODE_VBR_QUANT : |
psi[i].page = i; |
450 |
text = "Quantizer:"; |
psi[i].config = &temp; |
|
value = config->quant; |
|
|
break; |
|
451 |
} |
} |
452 |
|
|
453 |
SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
454 |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
455 |
} |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
456 |
|
psp[DLG_2PASSALT].pszTemplate = MAKEINTRESOURCE(IDD_2PASSALT); |
457 |
|
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
458 |
|
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
459 |
|
|
460 |
|
psh.dwSize = sizeof(PROPSHEETHEADER); |
461 |
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
462 |
|
psh.hwndParent = hParent; |
463 |
|
psh.hInstance = hInst; |
464 |
|
psh.pszCaption = (LPSTR) "XviD Configuration"; |
465 |
|
psh.nPages = DLG_COUNT; |
466 |
|
psh.nStartPage = DLG_GLOBAL; |
467 |
|
psh.ppsp = (LPCPROPSHEETPAGE)&psp; |
468 |
|
psh.pfnCallback = NULL; |
469 |
|
|
470 |
/* leaves current config value if dialog item is empty */ |
PropertySheet(&psh); |
471 |
|
|
472 |
int config_get_int(HWND hDlg, UINT item, int config) |
if (temp.save) |
473 |
{ |
{ |
474 |
BOOL success = FALSE; |
memcpy(config, &temp, sizeof(CONFIG)); |
|
|
|
|
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
|
|
|
|
|
if(success) { |
|
|
return tmp; |
|
|
} else { |
|
|
return config; |
|
475 |
} |
} |
476 |
} |
} |
477 |
|
|
478 |
|
|
479 |
/* configure credits dialog controls */ |
/* enable/disable advanced controls based on encoder mode */ |
480 |
|
|
481 |
|
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
482 |
|
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
483 |
|
|
484 |
|
#define MOD_CBR |
485 |
|
|
486 |
void credits_controls(HWND hDlg) |
void adv_mode(HWND hDlg, int mode) |
487 |
{ |
{ |
488 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_START_BEGIN), ISDLGSET(IDC_CREDITS_START)); |
// create arrays of controls to be disabled for each mode |
489 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_START_END), ISDLGSET(IDC_CREDITS_START)); |
const short twopass_disable[] = { |
490 |
|
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
491 |
|
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
492 |
|
IDC_STATS2, IDC_STATS2_BROWSE, |
493 |
|
}; |
494 |
|
|
495 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_END_BEGIN), ISDLGSET(IDC_CREDITS_END)); |
const short cbr_disable[] = { |
496 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_END_END), ISDLGSET(IDC_CREDITS_END)); |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
497 |
|
IDC_CREDITS_START, IDC_CREDITS_END, IDC_CREDITS_START_BEGIN, IDC_CREDITS_START_END, |
498 |
|
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
499 |
|
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
500 |
|
IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, |
501 |
|
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
502 |
|
}; |
503 |
|
|
504 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_RATE), ISDLGSET(IDC_CREDITS_RATE_RADIO)); |
const short qual_disable[] = { |
505 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_QUANTI), ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
506 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_QUANTP), ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
507 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_START_SIZE), ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
508 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_END_SIZE), ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
}; |
|
} |
|
509 |
|
|
510 |
|
const short quant_disable[] = { |
511 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
512 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
513 |
|
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
514 |
|
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
515 |
|
}; |
516 |
|
|
517 |
void quant_upload(HWND hDlg, CONFIG* config) |
const short twopass1_disable[] = { |
518 |
{ |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
519 |
int i; |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
520 |
|
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_RATE, IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, |
521 |
|
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
522 |
|
}; |
523 |
|
|
524 |
for (i=0 ; i<64 ; ++i) |
const short twopass2_ext_disable[] = { |
525 |
{ |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
526 |
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, |
527 |
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
528 |
} |
IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
529 |
} |
}; |
530 |
|
|
531 |
|
const short twopass2_int_disable[] = { |
532 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
533 |
|
IDC_STATS2, IDC_STATS2_BROWSE |
534 |
|
}; |
535 |
|
|
536 |
void quant_download(HWND hDlg, CONFIG* config) |
// store pointers in order so we can lookup using config->mode |
537 |
{ |
const short* modes[] = { |
538 |
int i; |
cbr_disable, qual_disable, quant_disable, |
539 |
|
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
540 |
|
}; |
541 |
|
|
542 |
for (i=0 ; i<64 ; ++i) |
// ditto modes[] |
543 |
|
const int lengths[] = { |
544 |
|
sizeof(cbr_disable)/sizeof(short), sizeof(qual_disable)/sizeof(short), |
545 |
|
sizeof(quant_disable)/sizeof(short), sizeof(twopass1_disable)/sizeof(short), |
546 |
|
sizeof(twopass2_ext_disable)/sizeof(short), sizeof(twopass2_int_disable)/sizeof(short), 0 |
547 |
|
}; |
548 |
|
|
549 |
|
int i; |
550 |
|
int hinted_me, use_alt, use_alt_auto, use_alt_auto_bonus; |
551 |
|
int credits_start, credits_end, credits_rate, credits_quant, credits_size; |
552 |
|
int cpu_force; |
553 |
|
|
554 |
|
// first perform checkbox-based enable/disable |
555 |
|
hinted_me = ISDLGSET(IDC_HINTEDME); |
556 |
|
CONTROLDLG(IDC_HINTFILE, hinted_me); |
557 |
|
CONTROLDLG(IDC_HINT_BROWSE, hinted_me); |
558 |
|
|
559 |
|
use_alt = ISDLGSET(IDC_USEALT) && (mode == DLG_MODE_2PASS_2_EXT || mode == DLG_MODE_2PASS_2_INT); |
560 |
|
use_alt_auto = ISDLGSET(IDC_USEAUTO); |
561 |
|
use_alt_auto_bonus = ISDLGSET(IDC_USEAUTOBONUS); |
562 |
|
CONTROLDLG(IDC_USEAUTO, use_alt); |
563 |
|
CONTROLDLG(IDC_AUTOSTR, use_alt && use_alt_auto); |
564 |
|
CONTROLDLG(IDC_USEAUTOBONUS, use_alt); |
565 |
|
CONTROLDLG(IDC_BONUSBIAS, use_alt && !use_alt_auto_bonus); |
566 |
|
CONTROLDLG(IDC_CURVETYPE, use_alt); |
567 |
|
CONTROLDLG(IDC_ALTCURVEHIGH, use_alt); |
568 |
|
CONTROLDLG(IDC_ALTCURVELOW, use_alt); |
569 |
|
CONTROLDLG(IDC_MINQUAL, use_alt && !use_alt_auto); |
570 |
|
|
571 |
|
credits_start = ISDLGSET(IDC_CREDITS_START); |
572 |
|
CONTROLDLG(IDC_CREDITS_START_BEGIN, credits_start); |
573 |
|
CONTROLDLG(IDC_CREDITS_START_END, credits_start); |
574 |
|
|
575 |
|
credits_end = ISDLGSET(IDC_CREDITS_END); |
576 |
|
CONTROLDLG(IDC_CREDITS_END_BEGIN, credits_end); |
577 |
|
CONTROLDLG(IDC_CREDITS_END_END, credits_end); |
578 |
|
|
579 |
|
credits_rate = ISDLGSET(IDC_CREDITS_RATE_RADIO); |
580 |
|
credits_quant = ISDLGSET(IDC_CREDITS_QUANT_RADIO); |
581 |
|
credits_size = ISDLGSET(IDC_CREDITS_SIZE_RADIO); |
582 |
|
CONTROLDLG(IDC_CREDITS_RATE, credits_rate); |
583 |
|
CONTROLDLG(IDC_CREDITS_QUANTI, credits_quant); |
584 |
|
CONTROLDLG(IDC_CREDITS_QUANTP, credits_quant); |
585 |
|
CONTROLDLG(IDC_CREDITS_START_SIZE, credits_size); |
586 |
|
CONTROLDLG(IDC_CREDITS_END_SIZE, credits_size); |
587 |
|
|
588 |
|
cpu_force = ISDLGSET(IDC_CPU_FORCE); |
589 |
|
CONTROLDLG(IDC_CPU_MMX, cpu_force); |
590 |
|
CONTROLDLG(IDC_CPU_MMXEXT, cpu_force); |
591 |
|
CONTROLDLG(IDC_CPU_SSE, cpu_force); |
592 |
|
CONTROLDLG(IDC_CPU_SSE2, cpu_force); |
593 |
|
CONTROLDLG(IDC_CPU_3DNOW, cpu_force); |
594 |
|
CONTROLDLG(IDC_CPU_3DNOWEXT, cpu_force); |
595 |
|
|
596 |
|
// now perform codec mode enable/disable |
597 |
|
for (i=0 ; i<lengths[mode] ; ++i) |
598 |
{ |
{ |
599 |
config->qmatrix_intra[i] = config_get_int(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
600 |
CONSTRAINVAL(config->qmatrix_intra[i], 1, 255) |
} |
601 |
|
|
602 |
config->qmatrix_inter[i] = config_get_int(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
if (mode != DLG_MODE_2PASS_2_EXT && mode != DLG_MODE_2PASS_2_INT) |
603 |
CONSTRAINVAL(config->qmatrix_inter[i], 1, 255) |
{ |
604 |
|
for (i=0 ; i<sizeof(twopass_disable)/sizeof(short) ; ++i) |
605 |
|
{ |
606 |
|
EnableWindow(GetDlgItem(hDlg, twopass_disable[i]), FALSE); |
607 |
|
} |
608 |
} |
} |
609 |
} |
} |
610 |
|
|
611 |
|
|
612 |
/* dialog proc */ |
/* upload config data into dialog */ |
|
|
|
|
BOOL CALLBACK config_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
|
{ |
|
|
PROPSHEETINFO *psi; |
|
|
|
|
|
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
|
613 |
|
|
614 |
switch (uMsg) |
void adv_upload(HWND hDlg, int page, CONFIG * config) |
615 |
{ |
{ |
616 |
case WM_INITDIALOG : |
switch (page) |
|
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
|
|
|
|
|
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
|
|
|
|
|
switch (psi->page) |
|
617 |
{ |
{ |
618 |
case DLG_MAIN : |
case DLG_GLOBAL : |
619 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
620 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
621 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
622 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
623 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
624 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
625 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
626 |
|
#ifdef BFRAMES |
627 |
|
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
628 |
|
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
629 |
|
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
630 |
|
CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); |
631 |
|
CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); |
632 |
|
#endif |
633 |
|
break; |
634 |
|
|
635 |
|
case DLG_QUANT : |
636 |
|
SetDlgItemInt(hDlg, IDC_MINIQUANT, config->min_iquant, FALSE); |
637 |
|
SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); |
638 |
|
SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); |
639 |
|
SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); |
640 |
break; |
break; |
641 |
|
|
642 |
case DLG_ADV : |
case DLG_2PASS : |
643 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
644 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
645 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"4 - High"); |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"5 - Very High"); |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"6 - Ultra High"); |
|
646 |
|
|
647 |
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
648 |
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
649 |
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
650 |
|
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
651 |
|
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
652 |
|
|
653 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
CheckDlgButton(hDlg, IDC_HINTEDME, config->hinted_me ? BST_CHECKED : BST_UNCHECKED); |
654 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile); |
655 |
|
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
656 |
|
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
657 |
break; |
break; |
658 |
|
|
659 |
case DLG_ABOUT : |
case DLG_2PASSALT : |
660 |
{ |
CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED); |
|
HFONT hFont; |
|
|
LOGFONT lfData; |
|
661 |
|
|
662 |
SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); |
663 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); |
664 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); |
665 |
|
SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); |
666 |
|
|
667 |
// |
CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED); |
668 |
{ |
SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); |
|
char chTemp[64]; |
|
|
sprintf(chTemp,"Core Version %d.%d",(API_VERSION>>16),(API_VERSION&0xFFFFU)); |
|
|
SetDlgItemText(hDlg, IDC_CORE_VERSION, chTemp); |
|
|
} |
|
669 |
|
|
670 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED); |
671 |
|
SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); |
672 |
|
|
673 |
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) |
SetDlgItemInt(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate / CONFIG_KBPS, FALSE); |
674 |
{ |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
675 |
lfData.lfUnderline = 1; |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
676 |
|
break; |
677 |
|
|
678 |
hFont = CreateFontIndirect(&lfData); |
case DLG_CREDITS : |
679 |
if (hFont) |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
680 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
681 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_END, config->credits_start_end, FALSE); |
682 |
|
CheckDlgButton(hDlg, IDC_CREDITS_END, config->credits_end ? BST_CHECKED : BST_UNCHECKED); |
683 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
684 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
685 |
|
|
686 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
687 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
688 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
689 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size, FALSE); |
690 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size, FALSE); |
691 |
|
|
692 |
|
if (config->credits_mode == CREDITS_MODE_RATE) |
693 |
{ |
{ |
694 |
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
CheckDlgButton(hDlg, IDC_CREDITS_RATE_RADIO, BST_CHECKED); |
695 |
|
} |
696 |
|
else if (config->credits_mode == CREDITS_MODE_QUANT) |
697 |
|
{ |
698 |
|
CheckDlgButton(hDlg, IDC_CREDITS_QUANT_RADIO, BST_CHECKED); |
699 |
} |
} |
700 |
|
else // CREDITS_MODE_SIZE |
701 |
|
{ |
702 |
|
CheckDlgButton(hDlg, IDC_CREDITS_SIZE_RADIO, BST_CHECKED); |
703 |
} |
} |
704 |
|
break; |
705 |
|
|
706 |
SetClassLong(GetDlgItem(hDlg, IDC_WEBSITE), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
case DLG_CPU : |
707 |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
CheckDlgButton(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX) ? BST_CHECKED : BST_UNCHECKED); |
708 |
|
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT) ? BST_CHECKED : BST_UNCHECKED); |
709 |
|
CheckDlgButton(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE) ? BST_CHECKED : BST_UNCHECKED); |
710 |
|
CheckDlgButton(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2) ? BST_CHECKED : BST_UNCHECKED); |
711 |
|
CheckDlgButton(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW) ? BST_CHECKED : BST_UNCHECKED); |
712 |
|
CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT) ? BST_CHECKED : BST_UNCHECKED); |
713 |
|
|
714 |
|
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
715 |
|
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
716 |
|
|
717 |
|
#ifdef _SMP |
718 |
|
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
719 |
|
#endif |
720 |
|
|
721 |
|
#ifdef BFRAMES |
722 |
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
723 |
|
#endif |
724 |
|
|
725 |
|
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
726 |
|
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
727 |
|
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
728 |
|
break; |
729 |
} |
} |
730 |
} |
} |
731 |
|
|
|
config_upload(hDlg, psi->page, psi->config); |
|
|
config_mode(hDlg); |
|
|
break; |
|
732 |
|
|
733 |
case WM_CTLCOLORSTATIC : |
/* download config data from dialog |
734 |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
replaces invalid values instead of alerting user for now |
735 |
|
*/ |
736 |
|
|
737 |
|
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
738 |
|
|
739 |
|
void adv_download(HWND hDlg, int page, CONFIG * config) |
740 |
{ |
{ |
741 |
SetBkMode((HDC)wParam, TRANSPARENT) ; |
switch (page) |
742 |
SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0)); |
{ |
743 |
return (BOOL)GetStockObject(NULL_BRUSH); |
case DLG_GLOBAL : |
744 |
} |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
745 |
return FALSE; |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
746 |
|
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
747 |
|
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
748 |
|
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
749 |
|
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
750 |
|
config->interlacing = ISDLGSET(IDC_INTERLACING); |
751 |
|
#ifdef BFRAMES |
752 |
|
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
753 |
|
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
754 |
|
config->packed = ISDLGSET(IDC_PACKED); |
755 |
|
config->dx50bvop = ISDLGSET(IDC_DX50BVOP); |
756 |
|
config->debug = ISDLGSET(IDC_DEBUG); |
757 |
|
#endif |
758 |
|
break; |
759 |
|
|
760 |
|
case DLG_QUANT : |
761 |
|
config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
762 |
|
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
763 |
|
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
764 |
|
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
765 |
|
|
766 |
|
CONSTRAINVAL(config->min_iquant, 1, 31); |
767 |
|
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
768 |
|
CONSTRAINVAL(config->min_pquant, 1, 31); |
769 |
|
CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); |
770 |
|
break; |
771 |
|
|
772 |
case WM_COMMAND : |
case DLG_2PASS : |
773 |
if (LOWORD(wParam) == IDC_MODE && HIWORD(wParam) == LBN_SELCHANGE) |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
774 |
|
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
775 |
|
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
776 |
|
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
777 |
|
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
778 |
|
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
779 |
|
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
780 |
|
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
781 |
|
|
782 |
|
if (GetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile, MAX_PATH) == 0) |
783 |
{ |
{ |
784 |
config_mode(hDlg); |
lstrcpy(config->hintfile, CONFIG_HINTFILE); |
|
config_download(hDlg, psi->page, psi->config); |
|
|
config_value(hDlg, psi->config); |
|
|
config_slider(hDlg, psi->config); |
|
785 |
} |
} |
786 |
else if ((LOWORD(wParam) == IDC_CPU_AUTO || LOWORD(wParam) == IDC_CPU_FORCE) && HIWORD(wParam) == BN_CLICKED) |
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
787 |
{ |
{ |
788 |
config_mode(hDlg); |
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
789 |
} |
} |
790 |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
if (GetDlgItemText(hDlg, IDC_STATS2, config->stats2, MAX_PATH) == 0) |
791 |
{ |
{ |
792 |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
lstrcpy(config->stats2, CONFIG_2PASS_2_FILE); |
793 |
int max = 1; |
} |
794 |
|
|
795 |
switch (SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0)) |
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
796 |
{ |
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
797 |
default : |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
798 |
case DLG_MODE_CBR : |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
|
max = 10000; |
|
799 |
break; |
break; |
800 |
|
|
801 |
case DLG_MODE_VBR_QUAL : |
case DLG_2PASSALT : |
802 |
max = 100; |
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
|
break; |
|
803 |
|
|
804 |
case DLG_MODE_VBR_QUANT : |
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
805 |
max = 31; |
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
|
break; |
|
|
} |
|
806 |
|
|
807 |
if (value < 1) |
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
808 |
{ |
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
|
value = 1; |
|
|
} |
|
|
if (value > max) |
|
|
{ |
|
|
value = max; |
|
|
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
|
|
} |
|
809 |
|
|
810 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
811 |
} |
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
812 |
else if ((LOWORD(wParam) == IDC_2PASS_STATS1_BROWSE || LOWORD(wParam) == IDC_2PASS_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
813 |
{ |
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
|
OPENFILENAME ofn; |
|
|
char tmp[MAX_PATH]; |
|
|
int hComponent = (LOWORD(wParam) == IDC_2PASS_STATS1_BROWSE ? IDC_2PASS_STATS1 : IDC_2PASS_STATS2 ); |
|
814 |
|
|
815 |
GetDlgItemText(hDlg, hComponent, tmp, MAX_PATH); |
config->twopass_max_bitrate /= CONFIG_KBPS; |
816 |
|
config->twopass_max_bitrate = config_get_uint(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
817 |
|
config->twopass_max_bitrate *= CONFIG_KBPS; |
818 |
|
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
819 |
|
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
820 |
|
|
821 |
memset(&ofn, 0, sizeof(OPENFILENAME)); |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
822 |
ofn.lStructSize = sizeof(OPENFILENAME); |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
823 |
|
break; |
824 |
|
|
825 |
ofn.hwndOwner = hDlg; |
case DLG_CREDITS : |
826 |
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
827 |
ofn.lpstrFile = tmp; |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
828 |
ofn.nMaxFile = MAX_PATH; |
config->credits_start_end = config_get_uint(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
829 |
ofn.Flags = OFN_PATHMUSTEXIST; |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
830 |
|
config->credits_end_begin = config_get_uint(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
831 |
|
config->credits_end_end = config_get_uint(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
832 |
|
|
833 |
// display save box for stats1 using 1st-pass |
config->credits_rate = config_get_uint(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
834 |
if (LOWORD(wParam) == IDC_2PASS_STATS1_BROWSE && |
config->credits_quant_i = config_get_uint(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
835 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0) == DLG_MODE_2PASS_1) |
config->credits_quant_p = config_get_uint(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
836 |
{ |
config->credits_start_size = config_get_uint(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
837 |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
config->credits_end_size = config_get_uint(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
838 |
if (GetSaveFileName(&ofn)) |
|
839 |
|
config->credits_mode = 0; |
840 |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; |
841 |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_QUANT_RADIO) ? CREDITS_MODE_QUANT : config->credits_mode; |
842 |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_SIZE_RADIO) ? CREDITS_MODE_SIZE : config->credits_mode; |
843 |
|
|
844 |
|
CONSTRAINVAL(config->credits_rate, 1, 100); |
845 |
|
CONSTRAINVAL(config->credits_quant_i, 1, 31); |
846 |
|
CONSTRAINVAL(config->credits_quant_p, 1, 31); |
847 |
|
|
848 |
|
if (config->credits_start_begin > config->credits_start_end) |
849 |
{ |
{ |
850 |
SetDlgItemText(hDlg, hComponent, tmp); |
config->credits_start_begin = config->credits_start_end; |
851 |
} |
config->credits_start = 0; |
852 |
} |
} |
853 |
else |
if (config->credits_end_begin > config->credits_end_end) |
854 |
{ |
{ |
855 |
ofn.Flags |= OFN_FILEMUSTEXIST; |
config->credits_end_begin = config->credits_end_end; |
856 |
if (GetOpenFileName(&ofn)) { |
config->credits_end = 0; |
|
SetDlgItemText(hDlg, hComponent, tmp); |
|
857 |
} |
} |
858 |
|
break; |
859 |
|
|
860 |
|
case DLG_CPU : |
861 |
|
config->cpu = 0; |
862 |
|
config->cpu |= ISDLGSET(IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
863 |
|
config->cpu |= ISDLGSET(IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT: 0; |
864 |
|
config->cpu |= ISDLGSET(IDC_CPU_SSE) ? XVID_CPU_SSE: 0; |
865 |
|
config->cpu |= ISDLGSET(IDC_CPU_SSE2) ? XVID_CPU_SSE2: 0; |
866 |
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
867 |
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
868 |
|
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
869 |
|
|
870 |
|
#ifdef _SMP |
871 |
|
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
872 |
|
#endif |
873 |
|
#ifdef BFRAMES |
874 |
|
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
875 |
|
#endif |
876 |
|
|
877 |
|
config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
878 |
|
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
879 |
|
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
880 |
|
break; |
881 |
} |
} |
882 |
} |
} |
883 |
else if (LOWORD(wParam) == IDC_CREDITS && HIWORD(wParam) == BN_CLICKED) |
|
884 |
|
|
885 |
|
void quant_upload(HWND hDlg, CONFIG* config) |
886 |
{ |
{ |
887 |
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CREDITS), hDlg, credits_proc, (LPARAM)psi->config); |
int i; |
888 |
} |
|
889 |
else if (LOWORD(wParam) == IDC_2PASS_INT && HIWORD(wParam) == BN_CLICKED) |
for (i=0 ; i<64 ; ++i) |
890 |
{ |
{ |
891 |
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_2PASS), hDlg, twopass_proc, (LPARAM)psi->config); |
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
892 |
|
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
893 |
} |
} |
|
else if (LOWORD(wParam) == IDC_QUANTMATRIX && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
|
894 |
} |
} |
895 |
else if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) |
|
896 |
|
|
897 |
|
void quant_download(HWND hDlg, CONFIG* config) |
898 |
{ |
{ |
899 |
ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); |
int i; |
|
} |
|
|
break; |
|
900 |
|
|
901 |
case WM_HSCROLL: |
for (i=0 ; i<64 ; ++i) |
|
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) |
|
902 |
{ |
{ |
903 |
SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
int temp; |
904 |
|
|
905 |
|
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
906 |
|
CONSTRAINVAL(temp, 1, 255); |
907 |
|
config->qmatrix_intra[i] = temp; |
908 |
|
|
909 |
|
temp = config_get_uint(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
910 |
|
CONSTRAINVAL(temp, 1, 255); |
911 |
|
config->qmatrix_inter[i] = temp; |
912 |
} |
} |
|
else |
|
|
{ |
|
|
return 0; |
|
913 |
} |
} |
|
break; |
|
914 |
|
|
915 |
case WM_NOTIFY : |
|
916 |
switch (((NMHDR *)lParam)->code) |
/* enumerates child windows, assigns tooltips */ |
917 |
|
|
918 |
|
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
919 |
{ |
{ |
920 |
case PSN_KILLACTIVE : |
char help[500]; |
|
/* validate */ |
|
|
config_download(hDlg, psi->page, psi->config); |
|
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
|
|
break; |
|
921 |
|
|
922 |
case PSN_APPLY : |
if (LoadString(hInst, GetDlgCtrlID(hWnd), help, 500)) |
923 |
/* apply */ |
{ |
924 |
config_download(hDlg, psi->page, psi->config); |
TOOLINFO ti; |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
|
|
config_reg_set(psi->config); |
|
|
psi->config->save = TRUE; |
|
|
break; |
|
|
} |
|
|
break; |
|
925 |
|
|
926 |
default : |
ti.cbSize = sizeof(TOOLINFO); |
927 |
return 0; |
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; |
928 |
|
ti.hwnd = GetParent(hWnd); |
929 |
|
ti.uId = (LPARAM)hWnd; |
930 |
|
ti.lpszText = help; |
931 |
|
|
932 |
|
SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
933 |
} |
} |
934 |
|
|
935 |
return 1; |
return TRUE; |
936 |
} |
} |
937 |
|
|
938 |
|
|
939 |
/* credits dialog proc */ |
/* main dialog proc */ |
940 |
|
|
941 |
BOOL CALLBACK credits_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
942 |
{ |
{ |
943 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
944 |
|
|
949 |
|
|
950 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
951 |
|
|
952 |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); |
953 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); |
954 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_END, config->credits_start_end, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); |
955 |
CheckDlgButton(hDlg, IDC_CREDITS_END, config->credits_end ? BST_CHECKED : BST_UNCHECKED); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); |
956 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); |
957 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); |
958 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
959 |
|
|
960 |
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size, FALSE); |
|
961 |
|
|
962 |
switch (config->credits_mode) |
InitCommonControls(); |
|
{ |
|
|
case CREDITS_MODE_RATE : |
|
|
CheckDlgButton(hDlg, IDC_CREDITS_RATE_RADIO, BST_CHECKED); |
|
|
break; |
|
963 |
|
|
964 |
case CREDITS_MODE_QUANT : |
if (hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
965 |
CheckDlgButton(hDlg, IDC_CREDITS_QUANT_RADIO, BST_CHECKED); |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
966 |
break; |
NULL, NULL, hInst, NULL)) |
967 |
|
{ |
968 |
|
SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); |
969 |
|
SendMessage(hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
970 |
|
SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
971 |
|
|
972 |
case CREDITS_MODE_SIZE : |
EnumChildWindows(hDlg, enum_tooltips, 0); |
|
CheckDlgButton(hDlg, IDC_CREDITS_SIZE_RADIO, BST_CHECKED); |
|
|
break; |
|
973 |
} |
} |
974 |
|
|
975 |
credits_controls(hDlg); |
main_slider(hDlg, config); |
976 |
|
main_value(hDlg, config); |
977 |
break; |
break; |
978 |
|
|
979 |
case WM_COMMAND : |
case WM_HSCROLL : |
980 |
if (LOWORD(wParam) == IDCANCEL) |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) |
981 |
{ |
{ |
982 |
EndDialog(hDlg, IDCANCEL); |
SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
983 |
} |
} |
984 |
else if (HIWORD(wParam) == BN_CLICKED) |
else |
|
{ |
|
|
switch (LOWORD(wParam)) |
|
985 |
{ |
{ |
986 |
case IDC_CREDITS_START : |
return 0; |
987 |
case IDC_CREDITS_END : |
} |
|
case IDC_CREDITS_RATE_RADIO : |
|
|
case IDC_CREDITS_QUANT_RADIO : |
|
|
case IDC_CREDITS_SIZE_RADIO : |
|
|
credits_controls(hDlg); |
|
988 |
break; |
break; |
989 |
|
|
990 |
case IDOK : |
case WM_COMMAND : |
991 |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
if (LOWORD(wParam) == IDC_MODE && HIWORD(wParam) == LBN_SELCHANGE) |
|
config->credits_start_begin = config_get_int(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin); |
|
|
config->credits_start_end = config_get_int(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
|
|
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
|
|
config->credits_end_begin = config_get_int(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
|
|
config->credits_end_end = config_get_int(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
|
|
|
|
|
config->credits_rate = config_get_int(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
|
|
config->credits_quant_i = config_get_int(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
|
|
config->credits_quant_p = config_get_int(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
|
|
config->credits_start_size = config_get_int(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
|
|
config->credits_end_size = config_get_int(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
|
|
|
|
|
if (ISDLGSET(IDC_CREDITS_RATE_RADIO)) |
|
992 |
{ |
{ |
993 |
config->credits_mode = CREDITS_MODE_RATE; |
main_download(hDlg, config); |
994 |
|
main_slider(hDlg, config); |
995 |
|
main_value(hDlg, config); |
996 |
} |
} |
997 |
if (ISDLGSET(IDC_CREDITS_QUANT_RADIO)) |
else if (LOWORD(wParam) == IDC_ADVANCED && HIWORD(wParam) == BN_CLICKED) |
998 |
|
{ |
999 |
|
adv_dialog(hDlg, config); |
1000 |
|
|
1001 |
|
if (config->save) |
1002 |
{ |
{ |
1003 |
config->credits_mode = CREDITS_MODE_QUANT; |
config_reg_set(config); |
1004 |
} |
} |
1005 |
if (ISDLGSET(IDC_CREDITS_SIZE_RADIO)) |
} |
1006 |
|
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
1007 |
{ |
{ |
1008 |
config->credits_mode = CREDITS_MODE_SIZE; |
config_reg_default(config); |
1009 |
|
|
1010 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1011 |
|
|
1012 |
|
main_slider(hDlg, config); |
1013 |
|
main_value(hDlg, config); |
1014 |
} |
} |
1015 |
|
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
1016 |
|
{ |
1017 |
|
int value = config_get_uint(hDlg, IDC_VALUE, 1); |
1018 |
|
int max = 1; |
1019 |
|
|
1020 |
CONSTRAINVAL(config->credits_rate, 1, 100) |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
1021 |
CONSTRAINVAL(config->credits_quant_i, 1, 31) |
((config->mode == DLG_MODE_VBR_QUAL) ? 100 : |
1022 |
CONSTRAINVAL(config->credits_quant_p, 1, 31) |
((config->mode == DLG_MODE_VBR_QUANT) ? 31 : 1<<30)); |
1023 |
|
|
1024 |
if (config->credits_start_begin > config->credits_start_end) |
if (value < 1) |
1025 |
{ |
{ |
1026 |
config->credits_start_begin = config->credits_start_end; |
value = 1; |
|
config->credits_start = 0; |
|
1027 |
} |
} |
1028 |
if (config->credits_end_begin > config->credits_end_end) |
if (value > max) |
1029 |
{ |
{ |
1030 |
config->credits_end_begin = config->credits_end_end; |
value = max; |
1031 |
config->credits_end = 0; |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
1032 |
} |
} |
1033 |
|
|
1034 |
|
if (config->mode != DLG_MODE_2PASS_2_INT) |
1035 |
|
{ |
1036 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
1037 |
|
} |
1038 |
|
} |
1039 |
|
else if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1040 |
|
{ |
1041 |
|
main_download(hDlg, config); |
1042 |
|
config->save = TRUE; |
1043 |
EndDialog(hDlg, IDOK); |
EndDialog(hDlg, IDOK); |
|
break; |
|
1044 |
} |
} |
1045 |
|
else if (LOWORD(wParam) == IDCANCEL) |
1046 |
|
{ |
1047 |
|
config->save = FALSE; |
1048 |
|
EndDialog(hDlg, IDCANCEL); |
1049 |
} |
} |
1050 |
break; |
break; |
1051 |
|
|
1057 |
} |
} |
1058 |
|
|
1059 |
|
|
1060 |
/* 2-pass dialog proc */ |
/* advanced dialog proc */ |
1061 |
|
|
1062 |
BOOL CALLBACK twopass_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1063 |
{ |
{ |
1064 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
PROPSHEETINFO *psi; |
1065 |
|
|
1066 |
|
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
1067 |
|
|
1068 |
switch (uMsg) |
switch (uMsg) |
1069 |
{ |
{ |
1070 |
case WM_INITDIALOG : |
case WM_INITDIALOG : |
1071 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
1072 |
|
|
1073 |
config = (CONFIG*)lParam; |
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
1074 |
|
|
1075 |
SetDlgItemInt(hDlg, IDC_DESIRED, config->desired_size, FALSE); |
if (psi->page == DLG_GLOBAL) |
1076 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
{ |
1077 |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
1078 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); |
1079 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); |
1080 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); |
1081 |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"4 - High"); |
1082 |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"5 - Very High"); |
1083 |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"6 - Ultra High"); |
1084 |
|
|
1085 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
1086 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
1087 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
1088 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); |
1089 |
|
|
1090 |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
1091 |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
1092 |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
1093 |
|
|
1094 |
|
#ifndef BFRAMES |
1095 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC1), FALSE); |
1096 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC2), FALSE); |
1097 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC3), FALSE); |
1098 |
|
EnableWindow(GetDlgItem(hDlg, IDC_MAXBFRAMES), FALSE); |
1099 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BQUANTRATIO), FALSE); |
1100 |
|
EnableWindow(GetDlgItem(hDlg, IDC_PACKED), FALSE); |
1101 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DX50BVOP), FALSE); |
1102 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DEBUG), FALSE); |
1103 |
|
#endif |
1104 |
|
} |
1105 |
|
else if (psi->page == DLG_2PASSALT) |
1106 |
|
{ |
1107 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low"); |
1108 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
1109 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
1110 |
|
} |
1111 |
|
else if (psi->page == DLG_CPU) |
1112 |
|
{ |
1113 |
|
#ifndef _SMP |
1114 |
|
|
1115 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
1116 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
1117 |
|
#endif |
1118 |
|
#ifndef BFRAMES |
1119 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP_STATIC), FALSE); |
1120 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP), FALSE); |
1121 |
|
#endif |
1122 |
|
} |
1123 |
|
|
1124 |
|
if (hTooltip) |
1125 |
|
{ |
1126 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1127 |
|
} |
1128 |
|
|
1129 |
|
adv_upload(hDlg, psi->page, psi->config); |
1130 |
|
adv_mode(hDlg, psi->config->mode); |
1131 |
break; |
break; |
1132 |
|
|
1133 |
case WM_COMMAND : |
case WM_COMMAND : |
1134 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (HIWORD(wParam) == BN_CLICKED) |
1135 |
{ |
{ |
1136 |
config->desired_size = config_get_int(hDlg, IDC_DESIRED, config->desired_size); |
switch (LOWORD(wParam)) |
1137 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
{ |
1138 |
config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->max_key_interval); |
case IDC_HINTEDME : |
1139 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
case IDC_USEALT : |
1140 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
case IDC_USEAUTO : |
1141 |
config->bitrate_payback_delay = config_get_int(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
case IDC_USEAUTOBONUS : |
1142 |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
case IDC_CREDITS_START : |
1143 |
|
case IDC_CREDITS_END : |
1144 |
|
case IDC_CREDITS_RATE_RADIO : |
1145 |
|
case IDC_CREDITS_QUANT_RADIO : |
1146 |
|
case IDC_CREDITS_SIZE_RADIO : |
1147 |
|
case IDC_CPU_AUTO : |
1148 |
|
case IDC_CPU_FORCE : |
1149 |
|
adv_mode(hDlg, psi->config->mode); |
1150 |
|
break; |
1151 |
|
} |
1152 |
|
} |
1153 |
|
if ((LOWORD(wParam) == IDC_HINT_BROWSE || LOWORD(wParam) == IDC_STATS1_BROWSE || LOWORD(wParam) == IDC_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
1154 |
|
{ |
1155 |
|
OPENFILENAME ofn; |
1156 |
|
char tmp[MAX_PATH]; |
1157 |
|
int hComponent = (LOWORD(wParam) == IDC_STATS1_BROWSE ? IDC_STATS1 : IDC_STATS2); |
1158 |
|
|
1159 |
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000) |
GetDlgItemText(hDlg, hComponent, tmp, MAX_PATH); |
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000) |
|
|
CONSTRAINVAL(config->curve_compression_high, 0, 100) |
|
|
CONSTRAINVAL(config->curve_compression_low, 0, 100) |
|
1160 |
|
|
1161 |
EndDialog(hDlg, IDOK); |
memset(&ofn, 0, sizeof(OPENFILENAME)); |
1162 |
|
ofn.lStructSize = sizeof(OPENFILENAME); |
1163 |
|
|
1164 |
|
ofn.hwndOwner = hDlg; |
1165 |
|
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
1166 |
|
ofn.lpstrFile = tmp; |
1167 |
|
ofn.nMaxFile = MAX_PATH; |
1168 |
|
ofn.Flags = OFN_PATHMUSTEXIST; |
1169 |
|
|
1170 |
|
if (LOWORD(wParam) == IDC_HINT_BROWSE) |
1171 |
|
{ |
1172 |
|
ofn.lpstrFilter = "motion hints (*.mvh)\0*.mvh\0All files (*.*)\0*.*\0\0"; |
1173 |
|
if (GetOpenFileName(&ofn)) |
1174 |
|
{ |
1175 |
|
SetDlgItemText(hDlg, IDC_HINTFILE, tmp); |
1176 |
} |
} |
1177 |
else if (LOWORD(wParam) == IDCANCEL) |
} |
1178 |
|
else if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
1179 |
|
psi->config->mode == DLG_MODE_2PASS_1) |
1180 |
{ |
{ |
1181 |
EndDialog(hDlg, IDCANCEL); |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
1182 |
|
if (GetSaveFileName(&ofn)) |
1183 |
|
{ |
1184 |
|
SetDlgItemText(hDlg, hComponent, tmp); |
1185 |
|
} |
1186 |
|
} |
1187 |
|
else |
1188 |
|
{ |
1189 |
|
ofn.Flags |= OFN_FILEMUSTEXIST; |
1190 |
|
if (GetOpenFileName(&ofn)) { |
1191 |
|
SetDlgItemText(hDlg, hComponent, tmp); |
1192 |
|
} |
1193 |
|
} |
1194 |
|
} |
1195 |
|
else if (LOWORD(wParam) == IDC_QUANTMATRIX && HIWORD(wParam) == BN_CLICKED) |
1196 |
|
{ |
1197 |
|
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
1198 |
|
} |
1199 |
|
break; |
1200 |
|
|
1201 |
|
case WM_NOTIFY : |
1202 |
|
switch (((NMHDR *)lParam)->code) |
1203 |
|
{ |
1204 |
|
case PSN_KILLACTIVE : |
1205 |
|
/* validate */ |
1206 |
|
adv_download(hDlg, psi->page, psi->config); |
1207 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1208 |
|
break; |
1209 |
|
|
1210 |
|
case PSN_APPLY : |
1211 |
|
/* apply */ |
1212 |
|
adv_download(hDlg, psi->page, psi->config); |
1213 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1214 |
|
psi->config->save = TRUE; |
1215 |
|
break; |
1216 |
} |
} |
1217 |
break; |
break; |
1218 |
|
|
1234 |
{ |
{ |
1235 |
case WM_INITDIALOG : |
case WM_INITDIALOG : |
1236 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
|
|
|
1237 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
|
|
|
1238 |
quant_upload(hDlg, config); |
quant_upload(hDlg, config); |
1239 |
|
|
1240 |
|
if (hTooltip) |
1241 |
|
{ |
1242 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1243 |
|
} |
1244 |
break; |
break; |
1245 |
|
|
1246 |
case WM_COMMAND : |
case WM_COMMAND : |
1247 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1248 |
{ |
{ |
1249 |
quant_download(hDlg, config); |
quant_download(hDlg, config); |
|
|
|
1250 |
EndDialog(hDlg, IDOK); |
EndDialog(hDlg, IDOK); |
1251 |
} |
} |
1252 |
else if (LOWORD(wParam) == IDCANCEL) |
else if (LOWORD(wParam) == IDCANCEL) |
1285 |
|
|
1286 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1287 |
{ |
{ |
1288 |
DEBUG("Couldn't save quant matrix"); |
DEBUGERR("Couldn't save quant matrix"); |
1289 |
} |
} |
1290 |
else |
else |
1291 |
{ |
{ |
1292 |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
1293 |
{ |
{ |
1294 |
DEBUG("Couldnt write quant matrix"); |
DEBUGERR("Couldnt write quant matrix"); |
1295 |
} |
} |
1296 |
} |
} |
1297 |
|
|
1307 |
|
|
1308 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1309 |
{ |
{ |
1310 |
DEBUG("Couldn't load quant matrix"); |
DEBUGERR("Couldn't load quant matrix"); |
1311 |
} |
} |
1312 |
else |
else |
1313 |
{ |
{ |
1314 |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
1315 |
{ |
{ |
1316 |
DEBUG("Couldnt read quant matrix"); |
DEBUGERR("Couldnt read quant matrix"); |
1317 |
} |
} |
1318 |
else |
else |
1319 |
{ |
{ |
1335 |
|
|
1336 |
return 1; |
return 1; |
1337 |
} |
} |
1338 |
|
|
1339 |
|
|
1340 |
|
/* about dialog proc */ |
1341 |
|
|
1342 |
|
BOOL CALLBACK about_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1343 |
|
{ |
1344 |
|
switch (uMsg) |
1345 |
|
{ |
1346 |
|
case WM_INITDIALOG : |
1347 |
|
{ |
1348 |
|
XVID_INIT_PARAM init_param; |
1349 |
|
char core[100]; |
1350 |
|
HFONT hFont; |
1351 |
|
LOGFONT lfData; |
1352 |
|
|
1353 |
|
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1354 |
|
|
1355 |
|
init_param.cpu_flags = XVID_CPU_CHKONLY; |
1356 |
|
xvid_init(NULL, 0, &init_param, 0); |
1357 |
|
wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); |
1358 |
|
SetDlgItemText(hDlg, IDC_CORE, core); |
1359 |
|
|
1360 |
|
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1361 |
|
|
1362 |
|
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) |
1363 |
|
{ |
1364 |
|
lfData.lfUnderline = 1; |
1365 |
|
|
1366 |
|
hFont = CreateFontIndirect(&lfData); |
1367 |
|
if (hFont) |
1368 |
|
{ |
1369 |
|
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
1370 |
|
} |
1371 |
|
} |
1372 |
|
|
1373 |
|
SetClassLong(GetDlgItem(hDlg, IDC_WEBSITE), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
1374 |
|
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
1375 |
|
} |
1376 |
|
break; |
1377 |
|
|
1378 |
|
case WM_CTLCOLORSTATIC : |
1379 |
|
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
1380 |
|
{ |
1381 |
|
SetBkMode((HDC)wParam, TRANSPARENT) ; |
1382 |
|
SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0)); |
1383 |
|
return (BOOL)GetStockObject(NULL_BRUSH); |
1384 |
|
} |
1385 |
|
return 0; |
1386 |
|
|
1387 |
|
case WM_COMMAND : |
1388 |
|
if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) |
1389 |
|
{ |
1390 |
|
ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); |
1391 |
|
} |
1392 |
|
else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) |
1393 |
|
{ |
1394 |
|
EndDialog(hDlg, LOWORD(wParam)); |
1395 |
|
} |
1396 |
|
break; |
1397 |
|
|
1398 |
|
default : |
1399 |
|
return 0; |
1400 |
|
} |
1401 |
|
|
1402 |
|
return 1; |
1403 |
|
} |