23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
26 |
|
* 23.03.2002 daniel smith <danielsmith@astroboymail.com> |
27 |
|
* added load defaults button |
28 |
|
* merged foxer's alternative 2-pass code (2-pass alt tab) |
29 |
|
* added proper tooltips |
30 |
|
* moved registry data into reg_ints/reg_strs arrays |
31 |
|
* added DEBUGERR output on errors instead of returning |
32 |
* 16.03.2002 daniel smith <danielsmith@astroboymail.com> |
* 16.03.2002 daniel smith <danielsmith@astroboymail.com> |
33 |
* rewrote/restructured most of file |
* rewrote/restructured most of file |
34 |
* added tooltips (kind of - dirty message hook method) |
* added tooltips (kind of - dirty message hook method) |
55 |
#include "resource.h" |
#include "resource.h" |
56 |
|
|
57 |
|
|
58 |
|
/* registry info structs */ |
59 |
|
|
60 |
|
CONFIG reg; |
61 |
|
|
62 |
|
REG_INT const reg_ints[] = { |
63 |
|
{"mode", ®.mode, DLG_MODE_CBR}, |
64 |
|
{"bitrate", ®.bitrate, 900000}, |
65 |
|
{"quality", ®.quality, 85}, |
66 |
|
{"quant", ®.quant, 5}, |
67 |
|
{"rc_buffersize", ®.rc_buffersize, 2048000}, |
68 |
|
|
69 |
|
{"motion_search", ®.motion_search, 5}, |
70 |
|
{"quant_type", ®.quant_type, 0}, |
71 |
|
{"fourcc_used", ®.fourcc_used, 0}, |
72 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
73 |
|
{"lum_masking", ®.lum_masking, 0}, |
74 |
|
|
75 |
|
{"min_iquant", ®.min_iquant, 1}, |
76 |
|
{"max_iquant", ®.max_iquant, 31}, |
77 |
|
{"min_pquant", ®.min_pquant, 1}, |
78 |
|
{"max_pquant", ®.max_pquant, 31}, |
79 |
|
|
80 |
|
{"desired_size", ®.desired_size, 570000}, |
81 |
|
{"keyframe_boost", ®.keyframe_boost, 20}, |
82 |
|
{"min_key_interval", ®.min_key_interval, 6}, |
83 |
|
{"discard1pass", ®.discard1pass, 1}, |
84 |
|
{"dummy2pass", ®.dummy2pass, 0}, |
85 |
|
{"curve_compression_high", ®.curve_compression_high, 25}, |
86 |
|
{"curve_compression_low", ®.curve_compression_low, 10}, |
87 |
|
{"use_alt_curve", ®.use_alt_curve, 0}, |
88 |
|
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
89 |
|
{"alt_curve_auto_str", ®.alt_curve_auto_str, 50}, |
90 |
|
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
91 |
|
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
92 |
|
{"alt_curve_type", ®.alt_curve_type, 1}, |
93 |
|
{"alt_curve_high_dist", ®.alt_curve_high_dist, 300}, |
94 |
|
{"alt_curve_low_dist", ®.alt_curve_low_dist, 300}, |
95 |
|
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
96 |
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 240}, |
97 |
|
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
98 |
|
|
99 |
|
{"credits_start", ®.credits_start, 0}, |
100 |
|
{"credits_start_begin", ®.credits_start_begin, 0}, |
101 |
|
{"credits_start_end", ®.credits_start_end, 0}, |
102 |
|
{"credits_end", ®.credits_end, 0}, |
103 |
|
{"credits_end_begin", ®.credits_end_begin, 0}, |
104 |
|
{"credits_end_end", ®.credits_end_end, 0}, |
105 |
|
|
106 |
|
{"credits_mode", ®.credits_mode, 0}, |
107 |
|
{"credits_rate", ®.credits_rate, 20}, |
108 |
|
{"credits_quant_i", ®.credits_quant_i, 20}, |
109 |
|
{"credits_quant_p", ®.credits_quant_p, 20}, |
110 |
|
{"credits_start_size", ®.credits_start_size, 10000}, |
111 |
|
{"credits_end_size", ®.credits_end_size, 10000} |
112 |
|
}; |
113 |
|
|
114 |
|
REG_STR const reg_strs[] = { |
115 |
|
{"stats1", reg.stats1, CONFIG_2PASS_1_FILE}, |
116 |
|
{"stats2", reg.stats2, CONFIG_2PASS_2_FILE} |
117 |
|
// {"build", reg.build, XVID_BUILD} |
118 |
|
}; |
119 |
|
|
120 |
/* get config settings from registry */ |
/* get config settings from registry */ |
121 |
|
|
|
#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);} |
|
122 |
#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)));} |
123 |
|
|
124 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
126 |
HKEY hKey; |
HKEY hKey; |
127 |
DWORD size; |
DWORD size; |
128 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
129 |
|
int i; |
130 |
|
|
131 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = 0; |
132 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
134 |
|
|
135 |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
136 |
|
|
137 |
REG_GET_N("mode", config->mode, DLG_MODE_CBR); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
138 |
REG_GET_N("bitrate", config->bitrate, 900000); |
{ |
139 |
REG_GET_N("quality", config->quality, 85); |
size = sizeof(int); |
140 |
REG_GET_N("quant", config->quant, 5); |
|
141 |
REG_GET_N("rc_buffersize", config->rc_buffersize, 2048000); |
if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS) |
142 |
|
{ |
143 |
REG_GET_N("motion_search", config->motion_search, 5); |
*reg_ints[i].config_int = reg_ints[i].def; |
144 |
REG_GET_N("quant_type", config->quant_type, 0); |
} |
145 |
REG_GET_N("fourcc_used", config->fourcc_used, 0); |
} |
146 |
REG_GET_N("max_key_interval", config->max_key_interval, 300); |
|
147 |
REG_GET_N("lum_masking", config->lum_masking, 0); |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
148 |
|
{ |
149 |
REG_GET_N("min_iquant", config->min_iquant, 1); |
size = MAX_PATH; |
150 |
REG_GET_N("max_iquant", config->max_iquant, 31); |
|
151 |
REG_GET_N("min_pquant", config->min_pquant, 1); |
if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS) |
152 |
REG_GET_N("max_pquant", config->max_pquant, 31); |
{ |
153 |
|
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
154 |
REG_GET_N("desired_size", config->desired_size, 570000); |
} |
155 |
REG_GET_N("keyframe_boost", config->keyframe_boost, 20); |
} |
|
REG_GET_N("min_key_interval", config->min_key_interval, 6); |
|
|
REG_GET_N("discard1pass", config->discard1pass, 1); |
|
|
REG_GET_N("dummy2pass", config->dummy2pass, 0); |
|
|
REG_GET_N("curve_compression_high", config->curve_compression_high, 25); |
|
|
REG_GET_N("curve_compression_low", config->curve_compression_low, 10); |
|
|
REG_GET_N("bitrate_payback_delay", config->bitrate_payback_delay, 240); |
|
|
REG_GET_N("bitrate_payback_method", config->bitrate_payback_method, 0); |
|
|
REG_GET_S("stats1", config->stats1, CONFIG_2PASS_1_FILE); |
|
|
REG_GET_S("stats2", config->stats2, CONFIG_2PASS_2_FILE); |
|
|
|
|
|
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, 20); |
|
|
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); |
|
156 |
|
|
157 |
{ |
{ |
158 |
BYTE default_qmatrix_intra[] = { |
BYTE default_qmatrix_intra[] = { |
177 |
23,24,25,27,28,30,31,33 |
23,24,25,27,28,30,31,33 |
178 |
}; |
}; |
179 |
|
|
180 |
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra); |
REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra); |
181 |
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter); |
REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter); |
182 |
} |
} |
183 |
|
|
184 |
|
memcpy(config, ®, sizeof(CONFIG)); |
185 |
|
|
186 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
187 |
} |
} |
188 |
|
|
189 |
|
|
190 |
/* put config settings in registry */ |
/* put config settings in registry */ |
191 |
|
|
|
#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) |
|
192 |
#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))) |
193 |
|
|
194 |
void config_reg_set(CONFIG * config) |
void config_reg_set(CONFIG * config) |
195 |
{ |
{ |
196 |
HKEY hKey; |
HKEY hKey; |
197 |
DWORD dispo; |
DWORD dispo; |
198 |
|
int i; |
199 |
|
|
200 |
if (RegCreateKeyEx( |
if (RegCreateKeyEx( |
201 |
XVID_REG_KEY, |
XVID_REG_KEY, |
212 |
return; |
return; |
213 |
} |
} |
214 |
|
|
215 |
REG_SET_N("mode", config->mode); |
memcpy(®, config, sizeof(CONFIG)); |
216 |
REG_SET_N("bitrate", config->bitrate); |
|
217 |
REG_SET_N("quality", config->quality); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
218 |
REG_SET_N("quant", config->quant); |
{ |
219 |
REG_SET_N("rc_buffersize", config->rc_buffersize); |
RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int)); |
220 |
|
} |
221 |
REG_SET_N("motion_search", config->motion_search); |
|
222 |
REG_SET_N("quant_type", config->quant_type); |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
223 |
REG_SET_N("fourcc_used", config->fourcc_used); |
{ |
224 |
REG_SET_N("max_key_interval", config->max_key_interval); |
RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1); |
225 |
REG_SET_N("lum_masking", config->lum_masking); |
} |
226 |
|
|
227 |
REG_SET_N("min_iquant", config->min_iquant); |
REG_SET_B("qmatrix_intra", reg.qmatrix_intra); |
228 |
REG_SET_N("max_iquant", config->max_iquant); |
REG_SET_B("qmatrix_inter", reg.qmatrix_inter); |
|
REG_SET_N("min_pquant", config->min_pquant); |
|
|
REG_SET_N("max_pquant", config->max_pquant); |
|
|
REG_SET_B("qmatrix_intra", config->qmatrix_intra); |
|
|
REG_SET_B("qmatrix_inter", config->qmatrix_inter); |
|
|
|
|
|
REG_SET_N("desired_size", config->desired_size); |
|
|
REG_SET_N("keyframe_boost", config->keyframe_boost); |
|
|
REG_SET_N("min_key_interval", config->min_key_interval); |
|
|
REG_SET_N("discard1pass", config->discard1pass); |
|
|
REG_SET_N("dummy2pass", config->dummy2pass); |
|
|
REG_SET_N("curve_compression_high", config->curve_compression_high); |
|
|
REG_SET_N("curve_compression_low", config->curve_compression_low); |
|
|
REG_SET_N("bitrate_payback_delay", config->bitrate_payback_delay); |
|
|
REG_SET_N("bitrate_payback_method", config->bitrate_payback_method); |
|
|
REG_SET_S("stats1", config->stats1); |
|
|
REG_SET_S("stats2", config->stats2); |
|
|
|
|
|
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); |
|
229 |
|
|
230 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
231 |
} |
} |
243 |
return; |
return; |
244 |
} |
} |
245 |
|
|
246 |
if (RegDeleteKey(XVID_REG_KEY, XVID_REG_CHILD)) |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) |
247 |
{ |
{ |
248 |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
249 |
return; |
return; |
250 |
} |
} |
251 |
|
|
252 |
|
RegCloseKey(hKey); |
253 |
config_reg_get(config); |
config_reg_get(config); |
254 |
|
config_reg_set(config); |
255 |
} |
} |
256 |
|
|
257 |
|
|
411 |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
412 |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
413 |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
414 |
|
psp[DLG_2PASSALT].pszTemplate = MAKEINTRESOURCE(IDD_2PASSALT); |
415 |
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
416 |
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
417 |
|
|
439 |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
440 |
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
441 |
|
|
442 |
|
#define MOD_CBR |
443 |
|
|
444 |
void adv_mode(HWND hDlg, int mode) |
void adv_mode(HWND hDlg, int mode) |
445 |
{ |
{ |
446 |
// create arrays of controls to be disabled for each mode |
// create arrays of controls to be disabled for each mode |
505 |
int i; |
int i; |
506 |
|
|
507 |
// first perform checkbox-based enable/disable |
// first perform checkbox-based enable/disable |
508 |
|
CONTROLDLG(IDC_USEAUTO, ISDLGSET(IDC_USEALT)); |
509 |
|
CONTROLDLG(IDC_AUTOSTR, ISDLGSET(IDC_USEALT) && ISDLGSET(IDC_USEAUTO)); |
510 |
|
CONTROLDLG(IDC_USEAUTOBONUS, ISDLGSET(IDC_USEALT)); |
511 |
|
CONTROLDLG(IDC_BONUSBIAS, (ISDLGSET(IDC_USEALT) && !(ISDLGSET(IDC_USEAUTOBONUS)))); |
512 |
|
CONTROLDLG(IDC_CURVETYPE, ISDLGSET(IDC_USEALT)); |
513 |
|
CONTROLDLG(IDC_ALTCURVEHIGH, ISDLGSET(IDC_USEALT)); |
514 |
|
CONTROLDLG(IDC_ALTCURVELOW, ISDLGSET(IDC_USEALT)); |
515 |
|
CONTROLDLG(IDC_MINQUAL, ISDLGSET(IDC_USEALT) && !(ISDLGSET(IDC_USEAUTO))); |
516 |
|
|
517 |
CONTROLDLG(IDC_CREDITS_START_BEGIN, ISDLGSET(IDC_CREDITS_START)); |
CONTROLDLG(IDC_CREDITS_START_BEGIN, ISDLGSET(IDC_CREDITS_START)); |
518 |
CONTROLDLG(IDC_CREDITS_START_END, ISDLGSET(IDC_CREDITS_START)); |
CONTROLDLG(IDC_CREDITS_START_END, ISDLGSET(IDC_CREDITS_START)); |
519 |
|
|
578 |
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
579 |
break; |
break; |
580 |
|
|
581 |
|
case DLG_2PASSALT : |
582 |
|
CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED); |
583 |
|
|
584 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); |
585 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); |
586 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); |
587 |
|
SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); |
588 |
|
|
589 |
|
CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED); |
590 |
|
SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); |
591 |
|
|
592 |
|
CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED); |
593 |
|
SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); |
594 |
|
break; |
595 |
|
|
596 |
case DLG_CREDITS : |
case DLG_CREDITS : |
597 |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
598 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
691 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
692 |
break; |
break; |
693 |
|
|
694 |
|
case DLG_2PASSALT : |
695 |
|
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
696 |
|
|
697 |
|
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
698 |
|
config->alt_curve_auto_str = config_get_int(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
699 |
|
|
700 |
|
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
701 |
|
config->alt_curve_bonus_bias = config_get_int(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
702 |
|
|
703 |
|
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
704 |
|
config->alt_curve_high_dist = config_get_int(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
705 |
|
config->alt_curve_low_dist = config_get_int(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
706 |
|
config->alt_curve_min_rel_qual = config_get_int(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
707 |
|
break; |
708 |
|
|
709 |
case DLG_CREDITS : |
case DLG_CREDITS : |
710 |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
711 |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
785 |
} |
} |
786 |
} |
} |
787 |
|
|
|
/* monitor mouse events to dialog controls for help text */ |
|
788 |
|
|
789 |
HHOOK hHook; |
/* enumerates child windows, assigns tooltips */ |
|
HWND hParent; |
|
790 |
|
|
791 |
LRESULT CALLBACK msg_proc(int nCode, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
|
{ |
|
|
MSG* pmsg = (MSG *)lParam; |
|
|
|
|
|
if (pmsg->message == WM_MOUSEMOVE) |
|
|
{ |
|
|
if (pmsg->hwnd == hParent) |
|
|
{ |
|
|
SetDlgItemText(hParent, IDC_STATIC_HELP, XVID_HELP); |
|
|
} |
|
|
else if (IsChild(hParent, pmsg->hwnd)) |
|
792 |
{ |
{ |
|
char *message; |
|
793 |
char help[500]; |
char help[500]; |
794 |
|
|
795 |
int mode = SendDlgItemMessage(hParent, IDC_MODE, CB_GETCURSEL, 0, 0); |
if (LoadString(hInst, GetDlgCtrlID(hWnd), help, 500)) |
|
int item = GetDlgCtrlID(pmsg->hwnd); |
|
|
|
|
|
if (item == IDC_VALUE || item == IDC_SLIDER) |
|
|
{ |
|
|
switch (mode) |
|
|
{ |
|
|
case DLG_MODE_2PASS_2_INT : |
|
|
if (item == IDC_VALUE) |
|
796 |
{ |
{ |
797 |
message = "Set the desired video size in Kilobytes"; |
TOOLINFO ti; |
|
break; |
|
|
} |
|
|
default : |
|
|
case DLG_MODE_CBR : |
|
|
message = "Set the target video bitrate"; |
|
|
break; |
|
798 |
|
|
799 |
case DLG_MODE_VBR_QUAL : |
ti.cbSize = sizeof(TOOLINFO); |
800 |
message = "Set the target video quality"; |
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; |
801 |
break; |
ti.hwnd = GetParent(hWnd); |
802 |
|
ti.uId = (LPARAM)hWnd; |
803 |
|
ti.lpszText = help; |
804 |
|
|
805 |
case DLG_MODE_VBR_QUANT : |
SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
|
message = "Set the fixed quantizer for encoding"; |
|
|
break; |
|
|
} |
|
|
lstrcpy(help, message); |
|
|
} |
|
|
else if (!LoadString(hInst, GetDlgCtrlID(pmsg->hwnd), help, 500)) |
|
|
{ |
|
|
lstrcpy(help, XVID_HELP); |
|
806 |
} |
} |
807 |
|
|
808 |
SetDlgItemText(hParent, IDC_STATIC_HELP, help); |
return TRUE; |
|
} |
|
|
} |
|
|
|
|
|
return (CallNextHookEx(hHook, nCode, wParam, lParam)); |
|
809 |
} |
} |
810 |
|
|
811 |
|
|
832 |
|
|
833 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
834 |
SetDlgItemInt(hDlg, IDC_CBRBUFFER, config->rc_buffersize, FALSE); |
SetDlgItemInt(hDlg, IDC_CBRBUFFER, config->rc_buffersize, FALSE); |
|
SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); |
|
|
|
|
|
hHook = SetWindowsHookEx(WH_GETMESSAGE, msg_proc, 0, GetCurrentThreadId()); |
|
835 |
|
|
836 |
main_slider(hDlg, config); |
InitCommonControls(); |
|
main_value(hDlg, config); |
|
|
break; |
|
837 |
|
|
838 |
case WM_ACTIVATE : |
if (hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
839 |
if (LOWORD(wParam) != WA_INACTIVE) |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
840 |
|
NULL, NULL, hInst, NULL)) |
841 |
{ |
{ |
842 |
hParent = hDlg; |
SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); |
843 |
|
SendMessage(hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
844 |
|
SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
845 |
|
|
846 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
847 |
} |
} |
|
return 0; |
|
848 |
|
|
849 |
case WM_DESTROY : |
main_slider(hDlg, config); |
850 |
UnhookWindowsHookEx(hHook); |
main_value(hDlg, config); |
851 |
break; |
break; |
852 |
|
|
853 |
case WM_HSCROLL : |
case WM_HSCROLL : |
877 |
config_reg_set(config); |
config_reg_set(config); |
878 |
} |
} |
879 |
} |
} |
880 |
|
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
881 |
|
{ |
882 |
|
config_reg_default(config); |
883 |
|
|
884 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
885 |
|
SetDlgItemInt(hDlg, IDC_CBRBUFFER, config->rc_buffersize, FALSE); |
886 |
|
|
887 |
|
main_slider(hDlg, config); |
888 |
|
main_value(hDlg, config); |
889 |
|
} |
890 |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
891 |
{ |
{ |
892 |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
966 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
967 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
968 |
} |
} |
969 |
|
else if (psi->page == DLG_2PASSALT) |
970 |
|
{ |
971 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low"); |
972 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
973 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
974 |
|
} |
975 |
|
|
976 |
|
if (hTooltip) |
977 |
|
{ |
978 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
979 |
|
} |
980 |
|
|
|
SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); |
|
981 |
adv_upload(hDlg, psi->page, psi->config); |
adv_upload(hDlg, psi->page, psi->config); |
982 |
adv_mode(hDlg, psi->config->mode); |
adv_mode(hDlg, psi->config->mode); |
983 |
break; |
break; |
987 |
{ |
{ |
988 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
989 |
{ |
{ |
990 |
|
case IDC_USEALT : |
991 |
|
case IDC_USEAUTO : |
992 |
|
case IDC_USEAUTOBONUS : |
993 |
case IDC_CREDITS_START : |
case IDC_CREDITS_START : |
994 |
case IDC_CREDITS_END : |
case IDC_CREDITS_END : |
995 |
case IDC_CREDITS_RATE_RADIO : |
case IDC_CREDITS_RATE_RADIO : |
1045 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1046 |
switch (((NMHDR *)lParam)->code) |
switch (((NMHDR *)lParam)->code) |
1047 |
{ |
{ |
|
case PSN_SETACTIVE : |
|
|
hParent = hDlg; |
|
|
break; |
|
|
|
|
1048 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1049 |
/* validate */ |
/* validate */ |
1050 |
adv_download(hDlg, psi->page, psi->config); |
adv_download(hDlg, psi->page, psi->config); |
1080 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
1081 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
1082 |
quant_upload(hDlg, config); |
quant_upload(hDlg, config); |
|
break; |
|
1083 |
|
|
1084 |
case WM_ACTIVATE : |
if (hTooltip) |
|
if (LOWORD(wParam) != WA_INACTIVE) |
|
1085 |
{ |
{ |
1086 |
hParent = hDlg; |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1087 |
} |
} |
1088 |
return 0; |
break; |
1089 |
|
|
1090 |
case WM_COMMAND : |
case WM_COMMAND : |
1091 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1129 |
|
|
1130 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1131 |
{ |
{ |
1132 |
DEBUG("Couldn't save quant matrix"); |
DEBUGERR("Couldn't save quant matrix"); |
1133 |
} |
} |
1134 |
else |
else |
1135 |
{ |
{ |
1136 |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
1137 |
{ |
{ |
1138 |
DEBUG("Couldnt write quant matrix"); |
DEBUGERR("Couldnt write quant matrix"); |
1139 |
} |
} |
1140 |
} |
} |
1141 |
|
|
1151 |
|
|
1152 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1153 |
{ |
{ |
1154 |
DEBUG("Couldn't load quant matrix"); |
DEBUGERR("Couldn't load quant matrix"); |
1155 |
} |
} |
1156 |
else |
else |
1157 |
{ |
{ |
1158 |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
1159 |
{ |
{ |
1160 |
DEBUG("Couldnt read quant matrix"); |
DEBUGERR("Couldnt read quant matrix"); |
1161 |
} |
} |
1162 |
else |
else |
1163 |
{ |
{ |
1194 |
HFONT hFont; |
HFONT hFont; |
1195 |
LOGFONT lfData; |
LOGFONT lfData; |
1196 |
|
|
1197 |
SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1198 |
|
|
1199 |
xvid_init(NULL, 0, &init_param, 0); |
xvid_init(NULL, 0, &init_param, 0); |
1200 |
wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); |
wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); |