23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
26 |
* ... ??? |
* 16.03.2002 daniel smith <danielsmith@astroboymail.com> |
27 |
* 11.03.2002 Version 0.02; Min Chen <chenm001@163.com> |
* rewrote/restructured most of file |
28 |
|
* added tooltips (kind of - dirty message hook method) |
29 |
|
* split tabs into a main dialog / advanced prop sheet |
30 |
|
* advanced controls are now enabled/disabled by mode |
31 |
|
* added modulated quantization, DX50 fourcc |
32 |
|
* 11.03.2002 Min Chen <chenm001@163.com> |
33 |
* now get Core Version use xvid_init() |
* now get Core Version use xvid_init() |
34 |
* 05.03.2002 Version 0.01; Min Chen <chenm001@163.com> |
* 05.03.2002 Min Chen <chenm001@163.com> |
35 |
* Add Core version display to about box |
* Add Core version display to about box |
|
* |
|
36 |
* 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> |
37 |
* |
* |
38 |
*************************************************************************/ |
*************************************************************************/ |
39 |
|
|
40 |
|
|
41 |
#include <windows.h> |
#include <windows.h> |
42 |
|
#include <commctrl.h> |
43 |
#include <shlobj.h> |
#include <shlobj.h> |
44 |
#include <prsht.h> |
#include <prsht.h> |
45 |
|
|
46 |
#include "codec.h" |
#include "codec.h" |
47 |
#include "config.h" |
#include "config.h" |
|
#include "resource.h" |
|
48 |
#include "xvid.h" // cpu masks |
#include "xvid.h" // cpu masks |
49 |
#include <stdio.h> // sprintf() |
#include "resource.h" |
50 |
|
|
51 |
|
|
52 |
/* get config settings from registry */ |
/* get config settings from registry */ |
53 |
|
|
65 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
66 |
config->cpu = init_param.cpu_flags; |
config->cpu = init_param.cpu_flags; |
67 |
|
|
68 |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
69 |
|
|
70 |
REG_GET_N("mode", config->mode, DLG_MODE_CBR) |
REG_GET_N("mode", config->mode, DLG_MODE_CBR); |
71 |
REG_GET_N("bitrate", config->bitrate, 900000) |
REG_GET_N("bitrate", config->bitrate, 900000); |
72 |
REG_GET_N("quality", config->quality, 85) |
REG_GET_N("quality", config->quality, 85); |
73 |
REG_GET_N("quant", config->quant, 5) |
REG_GET_N("quant", config->quant, 5); |
74 |
|
REG_GET_N("rc_buffersize", config->rc_buffersize, 2048000); |
75 |
REG_GET_S("stats1", config->stats1, CONFIG_2PASS_1_FILE) |
|
76 |
REG_GET_S("stats2", config->stats2, CONFIG_2PASS_2_FILE) |
REG_GET_N("motion_search", config->motion_search, 5); |
77 |
REG_GET_N("discard1pass", config->discard1pass, 1) |
REG_GET_N("quant_type", config->quant_type, 0); |
78 |
REG_GET_N("dummy2pass", config->dummy2pass, 0) |
REG_GET_N("fourcc_used", config->fourcc_used, 0); |
79 |
REG_GET_N("desired_size", config->desired_size, 570000) |
REG_GET_N("max_key_interval", config->max_key_interval, 300); |
80 |
|
REG_GET_N("lum_masking", config->lum_masking, 0); |
81 |
REG_GET_N("min_iquant", config->min_iquant, 1) |
|
82 |
REG_GET_N("max_iquant", config->max_iquant, 31) |
REG_GET_N("min_iquant", config->min_iquant, 1); |
83 |
|
REG_GET_N("max_iquant", config->max_iquant, 31); |
84 |
REG_GET_N("keyframe_boost", config->keyframe_boost, 20) |
REG_GET_N("min_pquant", config->min_pquant, 1); |
85 |
REG_GET_N("min_key_interval", config->min_key_interval, 6) |
REG_GET_N("max_pquant", config->max_pquant, 31); |
86 |
REG_GET_N("bitrate_payback_delay", config->bitrate_payback_delay, 240) |
|
87 |
REG_GET_N("bitrate_payback_method", config->bitrate_payback_method, 0) |
REG_GET_N("desired_size", config->desired_size, 570000); |
88 |
REG_GET_N("curve_compression_high", config->curve_compression_high, 25) |
REG_GET_N("keyframe_boost", config->keyframe_boost, 20); |
89 |
REG_GET_N("curve_compression_low", config->curve_compression_low, 15) |
REG_GET_N("min_key_interval", config->min_key_interval, 6); |
90 |
|
REG_GET_N("discard1pass", config->discard1pass, 1); |
91 |
REG_GET_N("credits_start", config->credits_start, 0) |
REG_GET_N("dummy2pass", config->dummy2pass, 0); |
92 |
REG_GET_N("credits_start_begin", config->credits_start_begin, 0) |
REG_GET_N("curve_compression_high", config->curve_compression_high, 25); |
93 |
REG_GET_N("credits_start_end", config->credits_start_end, 0) |
REG_GET_N("curve_compression_low", config->curve_compression_low, 10); |
94 |
REG_GET_N("credits_end", config->credits_end, 0) |
REG_GET_N("bitrate_payback_delay", config->bitrate_payback_delay, 240); |
95 |
REG_GET_N("credits_end_begin", config->credits_end_begin, 0) |
REG_GET_N("bitrate_payback_method", config->bitrate_payback_method, 0); |
96 |
REG_GET_N("credits_end_end", config->credits_end_end, 0) |
REG_GET_S("stats1", config->stats1, CONFIG_2PASS_1_FILE); |
97 |
|
REG_GET_S("stats2", config->stats2, CONFIG_2PASS_2_FILE); |
98 |
REG_GET_N("credits_mode", config->credits_mode, 0) |
|
99 |
REG_GET_N("credits_rate", config->credits_rate, 10) |
REG_GET_N("credits_start", config->credits_start, 0); |
100 |
REG_GET_N("credits_quant_i", config->credits_quant_i, 20) |
REG_GET_N("credits_start_begin", config->credits_start_begin, 0); |
101 |
REG_GET_N("credits_quant_p", config->credits_quant_p, 20) |
REG_GET_N("credits_start_end", config->credits_start_end, 0); |
102 |
REG_GET_N("credits_start_size", config->credits_start_size, 10000) |
REG_GET_N("credits_end", config->credits_end, 0); |
103 |
REG_GET_N("credits_end_size", config->credits_end_size, 10000) |
REG_GET_N("credits_end_begin", config->credits_end_begin, 0); |
104 |
|
REG_GET_N("credits_end_end", config->credits_end_end, 0); |
105 |
REG_GET_N("motion_search", config->motion_search, 5) |
|
106 |
REG_GET_N("quant_type", config->quant_type, 0) |
REG_GET_N("credits_mode", config->credits_mode, 0); |
107 |
REG_GET_N("max_key_interval", config->max_key_interval, 300) |
REG_GET_N("credits_rate", config->credits_rate, 20); |
108 |
|
REG_GET_N("credits_quant_i", config->credits_quant_i, 20); |
109 |
REG_GET_N("rc_buffersize", config->rc_buffersize, 2048000) |
REG_GET_N("credits_quant_p", config->credits_quant_p, 20); |
110 |
|
REG_GET_N("credits_start_size", config->credits_start_size, 10000); |
111 |
REG_GET_N("max_quant", config->max_quant, 31) |
REG_GET_N("credits_end_size", config->credits_end_size, 10000); |
|
REG_GET_N("min_quant", config->min_quant, 1) |
|
|
REG_GET_N("lum_masking", config->lum_masking, 0) |
|
|
|
|
|
REG_GET_N("fourcc_used", config->fourcc_used, 0) |
|
112 |
|
|
113 |
{ |
{ |
114 |
BYTE default_qmatrix_intra[] = { |
BYTE default_qmatrix_intra[] = { |
133 |
23,24,25,27,28,30,31,33 |
23,24,25,27,28,30,31,33 |
134 |
}; |
}; |
135 |
|
|
136 |
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra) |
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra); |
137 |
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter) |
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter); |
138 |
} |
} |
139 |
|
|
140 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
154 |
|
|
155 |
if (RegCreateKeyEx( |
if (RegCreateKeyEx( |
156 |
XVID_REG_KEY, |
XVID_REG_KEY, |
157 |
XVID_REG_SUBKEY, |
XVID_REG_PARENT "\\" XVID_REG_CHILD, |
158 |
0, |
0, |
159 |
XVID_REG_CLASS, |
XVID_REG_CLASS, |
160 |
REG_OPTION_NON_VOLATILE, |
REG_OPTION_NON_VOLATILE, |
171 |
REG_SET_N("bitrate", config->bitrate); |
REG_SET_N("bitrate", config->bitrate); |
172 |
REG_SET_N("quality", config->quality); |
REG_SET_N("quality", config->quality); |
173 |
REG_SET_N("quant", config->quant); |
REG_SET_N("quant", config->quant); |
174 |
|
REG_SET_N("rc_buffersize", config->rc_buffersize); |
175 |
|
|
176 |
REG_SET_S("stats1", config->stats1); |
REG_SET_N("motion_search", config->motion_search); |
177 |
REG_SET_S("stats2", config->stats2); |
REG_SET_N("quant_type", config->quant_type); |
178 |
REG_SET_N("discard1pass", config->discard1pass); |
REG_SET_N("fourcc_used", config->fourcc_used); |
179 |
REG_SET_N("dummy2pass", config->dummy2pass); |
REG_SET_N("max_key_interval", config->max_key_interval); |
180 |
REG_SET_N("desired_size", config->desired_size); |
REG_SET_N("lum_masking", config->lum_masking); |
181 |
|
|
182 |
REG_SET_N("min_iquant", config->min_iquant); |
REG_SET_N("min_iquant", config->min_iquant); |
183 |
REG_SET_N("max_iquant", config->max_iquant); |
REG_SET_N("max_iquant", config->max_iquant); |
184 |
|
REG_SET_N("min_pquant", config->min_pquant); |
185 |
|
REG_SET_N("max_pquant", config->max_pquant); |
186 |
|
REG_SET_B("qmatrix_intra", config->qmatrix_intra); |
187 |
|
REG_SET_B("qmatrix_inter", config->qmatrix_inter); |
188 |
|
|
189 |
|
REG_SET_N("desired_size", config->desired_size); |
190 |
REG_SET_N("keyframe_boost", config->keyframe_boost); |
REG_SET_N("keyframe_boost", config->keyframe_boost); |
191 |
REG_SET_N("min_key_interval", config->min_key_interval); |
REG_SET_N("min_key_interval", config->min_key_interval); |
192 |
REG_SET_N("bitrate_payback_delay", config->bitrate_payback_delay); |
REG_SET_N("discard1pass", config->discard1pass); |
193 |
REG_SET_N("bitrate_payback_method", config->bitrate_payback_method); |
REG_SET_N("dummy2pass", config->dummy2pass); |
194 |
REG_SET_N("curve_compression_high", config->curve_compression_high); |
REG_SET_N("curve_compression_high", config->curve_compression_high); |
195 |
REG_SET_N("curve_compression_low", config->curve_compression_low); |
REG_SET_N("curve_compression_low", config->curve_compression_low); |
196 |
|
REG_SET_N("bitrate_payback_delay", config->bitrate_payback_delay); |
197 |
|
REG_SET_N("bitrate_payback_method", config->bitrate_payback_method); |
198 |
|
REG_SET_S("stats1", config->stats1); |
199 |
|
REG_SET_S("stats2", config->stats2); |
200 |
|
|
201 |
REG_SET_N("credits_start", config->credits_start); |
REG_SET_N("credits_start", config->credits_start); |
202 |
REG_SET_N("credits_start_begin", config->credits_start_begin); |
REG_SET_N("credits_start_begin", config->credits_start_begin); |
212 |
REG_SET_N("credits_start_size", config->credits_start_size); |
REG_SET_N("credits_start_size", config->credits_start_size); |
213 |
REG_SET_N("credits_end_size", config->credits_end_size); |
REG_SET_N("credits_end_size", config->credits_end_size); |
214 |
|
|
|
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); |
|
|
|
|
|
REG_SET_N("fourcc_used", config->fourcc_used); |
|
|
|
|
|
REG_SET_B("qmatrix_intra", config->qmatrix_intra); |
|
|
REG_SET_B("qmatrix_inter", config->qmatrix_inter); |
|
|
|
|
215 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
216 |
} |
} |
217 |
|
|
218 |
|
|
219 |
/* enable/disable dialog controls based on encoder mode */ |
/* clear XviD registry key, load defaults */ |
220 |
|
|
221 |
#define ENABLE(X) EnableWindow(GetDlgItem(hDlg, (X)), TRUE); |
void config_reg_default(CONFIG * config) |
|
#define DISABLE(X) EnableWindow(GetDlgItem(hDlg, (X)), FALSE); |
|
|
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
|
|
|
|
|
void config_mode(HWND hDlg) |
|
222 |
{ |
{ |
223 |
XVID_INIT_PARAM init_param; |
HKEY hKey; |
|
LONG mode; |
|
|
|
|
|
mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
|
224 |
|
|
225 |
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 |
|
226 |
{ |
{ |
227 |
DISABLE(IDC_CREDITS); |
DEBUG1("Couldn't open registry key for deletion - ", GetLastError()); |
228 |
|
return; |
229 |
} |
} |
230 |
|
|
231 |
if (mode == DLG_MODE_VBR_QUAL || mode == DLG_MODE_VBR_QUANT || mode == DLG_MODE_CBR) |
if (RegDeleteKey(XVID_REG_KEY, XVID_REG_CHILD)) |
|
{ |
|
|
ENABLE(IDC_VALUE_STATIC); |
|
|
ENABLE(IDC_VALUE); |
|
|
ENABLE(IDC_SLIDER_STATIC); |
|
|
ENABLE(IDC_SLIDER); |
|
|
} |
|
|
else |
|
232 |
{ |
{ |
233 |
DISABLE(IDC_VALUE_STATIC); |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
234 |
DISABLE(IDC_VALUE); |
return; |
|
DISABLE(IDC_SLIDER_STATIC); |
|
|
DISABLE(IDC_SLIDER); |
|
235 |
} |
} |
236 |
|
|
237 |
if (mode == DLG_MODE_2PASS_1 || mode == DLG_MODE_2PASS_2_EXT || mode == DLG_MODE_2PASS_2_INT) |
config_reg_get(config); |
|
{ |
|
|
ENABLE(IDC_2PASS_STATS1_STATIC); |
|
|
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); |
|
238 |
} |
} |
239 |
|
|
|
if (mode == DLG_MODE_2PASS_1) |
|
|
{ |
|
|
ENABLE(IDC_DISCARD1PASS); |
|
|
} |
|
|
else |
|
|
{ |
|
|
DISABLE(IDC_DISCARD1PASS); |
|
|
} |
|
240 |
|
|
241 |
if (mode == DLG_MODE_2PASS_2_EXT) |
/* leaves current config value if dialog item is empty */ |
242 |
{ |
|
243 |
ENABLE(IDC_2PASS_STATS1_STATIC); |
int config_get_int(HWND hDlg, UINT item, int config) |
|
ENABLE(IDC_2PASS_STATS2); |
|
|
ENABLE(IDC_2PASS_STATS2_BROWSE); |
|
|
} |
|
|
else |
|
244 |
{ |
{ |
245 |
DISABLE(IDC_2PASS_STATS1_STATIC); |
BOOL success = FALSE; |
|
DISABLE(IDC_2PASS_STATS2); |
|
|
DISABLE(IDC_2PASS_STATS2_BROWSE); |
|
|
} |
|
246 |
|
|
247 |
if (ISDLGSET(IDC_CPU_FORCE)) { |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
|
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); |
|
248 |
|
|
249 |
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); |
|
|
} |
|
250 |
} |
} |
251 |
|
|
252 |
|
|
253 |
/* upload config data into dialog */ |
/* downloads data from main dialog */ |
254 |
|
|
255 |
void config_upload(HWND hDlg, int page, CONFIG * config) |
void main_download(HWND hDlg, CONFIG * config) |
256 |
{ |
{ |
257 |
switch (page) |
switch(config->mode) |
258 |
{ |
{ |
259 |
case DLG_MAIN : |
default : |
260 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
case DLG_MODE_CBR : |
261 |
config_mode(hDlg); |
config->bitrate = config_get_int(hDlg, IDC_VALUE, config->bitrate) * CONFIG_KBPS; |
|
|
|
|
config_slider(hDlg, config); |
|
|
config_value(hDlg, config); |
|
|
|
|
|
SetDlgItemText(hDlg, IDC_2PASS_STATS1, config->stats1); |
|
|
SetDlgItemText(hDlg, IDC_2PASS_STATS2, config->stats2); |
|
|
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
|
262 |
break; |
break; |
263 |
|
|
264 |
case DLG_ADV : |
case DLG_MODE_VBR_QUAL : |
265 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
config->quality = config_get_int(hDlg, IDC_VALUE, config->quality); |
|
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_SETCURSEL, config->quant_type, 0); |
|
|
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
|
|
|
|
|
SetDlgItemInt(hDlg, IDC_MINQ, config->min_quant, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_MAXQ, config->max_quant, FALSE); |
|
|
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
|
|
|
|
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
|
266 |
break; |
break; |
267 |
|
|
268 |
case DLG_DEBUG : |
case DLG_MODE_VBR_QUANT : |
269 |
SetDlgItemInt(hDlg, IDC_RC_BUFFERSIZE, config->rc_buffersize, FALSE); |
config->quant = config_get_int(hDlg, IDC_VALUE, config->quant); |
|
|
|
|
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); |
|
270 |
break; |
break; |
271 |
|
|
272 |
case DLG_CPU : |
case DLG_MODE_2PASS_2_INT : |
273 |
CheckDlgButton(hDlg, IDC_CPU_MMX, config->cpu & XVID_CPU_MMX ? BST_CHECKED : BST_UNCHECKED); |
config->desired_size = config_get_int(hDlg, IDC_VALUE, config->desired_size); |
|
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, config->cpu & XVID_CPU_MMXEXT ? BST_CHECKED : BST_UNCHECKED); |
|
|
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); |
|
|
|
|
|
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
|
|
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
|
274 |
break; |
break; |
275 |
} |
} |
|
} |
|
276 |
|
|
277 |
|
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
278 |
|
config->rc_buffersize = config_get_int(hDlg, IDC_CBRBUFFER, config->rc_buffersize); |
279 |
|
} |
280 |
|
|
|
/* download config data from dialog |
|
|
replaces invalid values instead of alerting user for now |
|
|
*/ |
|
281 |
|
|
282 |
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
/* updates the edit box */ |
283 |
|
|
284 |
void config_download(HWND hDlg, int page, CONFIG * config) |
void main_value(HWND hDlg, CONFIG* config) |
285 |
{ |
{ |
286 |
|
char* text; |
287 |
int value; |
int value; |
288 |
|
int enabled = TRUE; |
289 |
|
|
290 |
switch (page) |
switch (config->mode) |
291 |
{ |
{ |
292 |
case DLG_MAIN : |
default : |
293 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
enabled = FALSE; |
|
|
|
|
value = config_get_int(hDlg, IDC_VALUE, 2); |
|
294 |
|
|
295 |
switch (SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_GETRANGEMAX, 0, 0)) |
case DLG_MODE_CBR : |
296 |
{ |
text = "Bitrate (Kbps):"; |
297 |
case 10000 : |
value = config->bitrate / CONFIG_KBPS; |
|
CONSTRAINVAL(value, 1, 10000) |
|
|
config->bitrate = value * CONFIG_KBPS; |
|
298 |
break; |
break; |
299 |
|
|
300 |
case 100 : |
case DLG_MODE_VBR_QUAL : |
301 |
CONSTRAINVAL(value, 0, 100) |
text = "Quality:"; |
302 |
config->quality = value; |
value = config->quality; |
303 |
break; |
break; |
304 |
|
|
305 |
case 31 : |
case DLG_MODE_VBR_QUANT : |
306 |
CONSTRAINVAL(value, 1, 31) |
text = "Quantizer:"; |
307 |
config->quant = value; |
value = config->quant; |
308 |
break; |
break; |
|
} |
|
309 |
|
|
310 |
GetDlgItemText(hDlg, IDC_2PASS_STATS1, config->stats1, MAX_PATH); |
case DLG_MODE_2PASS_2_INT : |
311 |
if (config->stats1[0] == '\0') |
text = "Desired size (Kbtyes):"; |
312 |
{ |
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); |
|
313 |
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; |
|
314 |
} |
} |
315 |
|
|
316 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); |
317 |
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; |
|
318 |
|
|
319 |
case DLG_CPU : |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
320 |
config->cpu = 0; |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE), enabled); |
321 |
config->cpu |= ISDLGSET(IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
EnableWindow(GetDlgItem(hDlg, IDC_CBRBUFFER_STATIC), (config->mode == DLG_MODE_CBR)); |
322 |
config->cpu |= ISDLGSET(IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT: 0; |
EnableWindow(GetDlgItem(hDlg, IDC_CBRBUFFER), (config->mode == DLG_MODE_CBR)); |
|
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; |
|
|
} |
|
323 |
} |
} |
324 |
|
|
325 |
|
|
326 |
/* updates the slider */ |
/* updates the slider */ |
327 |
|
|
328 |
void config_slider(HWND hDlg, CONFIG* config) |
void main_slider(HWND hDlg, CONFIG * config) |
329 |
{ |
{ |
330 |
char* text; |
char* text; |
331 |
long range; |
long range; |
332 |
int pos; |
int pos; |
333 |
|
int enabled = TRUE; |
334 |
|
|
335 |
switch (config->mode) |
switch (config->mode) |
336 |
{ |
{ |
337 |
default : |
default : |
338 |
|
enabled = FALSE; |
339 |
|
|
340 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
341 |
text = "Bitrate (Kbps):"; |
text = "Bitrate (Kbps):"; |
342 |
range = MAKELONG(0,10000); |
range = MAKELONG(0,10000); |
359 |
SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); |
SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); |
360 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); |
361 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); |
362 |
|
|
363 |
|
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER_STATIC), enabled); |
364 |
|
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER), enabled); |
365 |
} |
} |
366 |
|
|
367 |
|
|
368 |
/* updates the edit box */ |
/* load advanced options property sheet */ |
369 |
|
|
370 |
void config_value(HWND hDlg, CONFIG* config) |
void adv_dialog(HWND hParent, CONFIG * config) |
371 |
{ |
{ |
372 |
char* text; |
PROPSHEETINFO psi[DLG_COUNT]; |
373 |
int value; |
PROPSHEETPAGE psp[DLG_COUNT]; |
374 |
|
PROPSHEETHEADER psh; |
375 |
|
CONFIG temp; |
376 |
|
int i; |
377 |
|
|
378 |
switch (config->mode) |
config->save = FALSE; |
379 |
{ |
memcpy(&temp, config, sizeof(CONFIG)); |
|
default : |
|
|
case DLG_MODE_CBR : |
|
|
text = "Bitrate (Kbps):"; |
|
|
value = config->bitrate / CONFIG_KBPS; |
|
|
break; |
|
380 |
|
|
381 |
case DLG_MODE_VBR_QUAL : |
for (i=0 ; i<DLG_COUNT ; ++i) |
382 |
text = "Quality:"; |
{ |
383 |
value = config->quality; |
psp[i].dwSize = sizeof(PROPSHEETPAGE); |
384 |
break; |
psp[i].dwFlags = 0; |
385 |
|
psp[i].hInstance = hInst; |
386 |
|
psp[i].pfnDlgProc = adv_proc; |
387 |
|
psp[i].lParam = (LPARAM)&psi[i]; |
388 |
|
psp[i].pfnCallback = NULL; |
389 |
|
|
390 |
case DLG_MODE_VBR_QUANT : |
psi[i].page = i; |
391 |
text = "Quantizer:"; |
psi[i].config = &temp; |
|
value = config->quant; |
|
|
break; |
|
392 |
} |
} |
393 |
|
|
394 |
SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
395 |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
396 |
} |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
397 |
|
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
398 |
|
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
399 |
|
|
400 |
|
psh.dwSize = sizeof(PROPSHEETHEADER); |
401 |
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
402 |
|
psh.hwndParent = hParent; |
403 |
|
psh.hInstance = hInst; |
404 |
|
psh.pszCaption = (LPSTR) "XviD Configuration"; |
405 |
|
psh.nPages = DLG_COUNT; |
406 |
|
psh.nStartPage = DLG_GLOBAL; |
407 |
|
psh.ppsp = (LPCPROPSHEETPAGE)&psp; |
408 |
|
psh.pfnCallback = NULL; |
409 |
|
|
410 |
/* leaves current config value if dialog item is empty */ |
PropertySheet(&psh); |
411 |
|
|
412 |
int config_get_int(HWND hDlg, UINT item, int config) |
if (temp.save) |
413 |
{ |
{ |
414 |
BOOL success = FALSE; |
memcpy(config, &temp, sizeof(CONFIG)); |
|
|
|
|
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
|
|
|
|
|
if(success) { |
|
|
return tmp; |
|
|
} else { |
|
|
return config; |
|
415 |
} |
} |
416 |
} |
} |
417 |
|
|
418 |
|
|
419 |
/* configure credits dialog controls */ |
/* enable/disable advanced controls based on encoder mode */ |
420 |
|
|
421 |
void credits_controls(HWND hDlg) |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
422 |
|
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
423 |
|
|
424 |
|
void adv_mode(HWND hDlg, int mode) |
425 |
{ |
{ |
426 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_START_BEGIN), ISDLGSET(IDC_CREDITS_START)); |
// create arrays of controls to be disabled for each mode |
427 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_START_END), ISDLGSET(IDC_CREDITS_START)); |
const int cbr_disable[] = { |
428 |
|
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
429 |
|
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
430 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
431 |
|
IDC_CREDITS_START, IDC_CREDITS_END, IDC_CREDITS_START_BEGIN, IDC_CREDITS_START_END, |
432 |
|
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
433 |
|
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
434 |
|
IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, |
435 |
|
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
436 |
|
}; |
437 |
|
|
438 |
|
const int qual_disable[] = { |
439 |
|
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
440 |
|
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
441 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
442 |
|
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
443 |
|
}; |
444 |
|
|
445 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_END_BEGIN), ISDLGSET(IDC_CREDITS_END)); |
const int quant_disable[] = { |
446 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_END_END), ISDLGSET(IDC_CREDITS_END)); |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
447 |
|
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
448 |
|
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
449 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
450 |
|
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
451 |
|
}; |
452 |
|
|
453 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_RATE), ISDLGSET(IDC_CREDITS_RATE_RADIO)); |
const int twopass1_disable[] = { |
454 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_QUANTI), ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
IDC_LUMMASK, IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
455 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_QUANTP), ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
IDC_KFBOOST, IDC_DUMMY2PASS, |
456 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_START_SIZE), ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
457 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_END_SIZE), ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
IDC_STATS2, IDC_STATS2_BROWSE, |
458 |
} |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_RATE, IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, |
459 |
|
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
460 |
|
}; |
461 |
|
|
462 |
|
const int twopass2_ext_disable[] = { |
463 |
|
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, |
464 |
|
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
465 |
|
IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
466 |
|
}; |
467 |
|
|
468 |
void quant_upload(HWND hDlg, CONFIG* config) |
const int twopass2_int_disable[] = { |
469 |
{ |
IDC_STATS2, IDC_STATS2_BROWSE |
470 |
int i; |
}; |
471 |
|
|
472 |
for (i=0 ; i<64 ; ++i) |
// store pointers in order so we can lookup using config->mode |
473 |
{ |
const int* modes[] = { |
474 |
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
cbr_disable, qual_disable, quant_disable, |
475 |
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
476 |
} |
}; |
|
} |
|
477 |
|
|
478 |
|
// ditto modes[] |
479 |
|
const int lengths[] = { |
480 |
|
sizeof(cbr_disable)/sizeof(int), sizeof(qual_disable)/sizeof(int), |
481 |
|
sizeof(quant_disable)/sizeof(int), sizeof(twopass1_disable)/sizeof(int), |
482 |
|
sizeof(twopass2_ext_disable)/sizeof(int), sizeof(twopass2_int_disable)/sizeof(int) |
483 |
|
}; |
484 |
|
|
|
void quant_download(HWND hDlg, CONFIG* config) |
|
|
{ |
|
485 |
int i; |
int i; |
486 |
|
|
487 |
for (i=0 ; i<64 ; ++i) |
// first perform checkbox-based enable/disable |
488 |
{ |
CONTROLDLG(IDC_CREDITS_START_BEGIN, ISDLGSET(IDC_CREDITS_START)); |
489 |
config->qmatrix_intra[i] = config_get_int(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
CONTROLDLG(IDC_CREDITS_START_END, ISDLGSET(IDC_CREDITS_START)); |
490 |
CONSTRAINVAL(config->qmatrix_intra[i], 1, 255) |
|
491 |
|
CONTROLDLG(IDC_CREDITS_END_BEGIN, ISDLGSET(IDC_CREDITS_END)); |
492 |
|
CONTROLDLG(IDC_CREDITS_END_END, ISDLGSET(IDC_CREDITS_END)); |
493 |
|
|
494 |
|
CONTROLDLG(IDC_CREDITS_RATE, ISDLGSET(IDC_CREDITS_RATE_RADIO)); |
495 |
|
CONTROLDLG(IDC_CREDITS_QUANTI, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
496 |
|
CONTROLDLG(IDC_CREDITS_QUANTP, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
497 |
|
CONTROLDLG(IDC_CREDITS_START_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
498 |
|
CONTROLDLG(IDC_CREDITS_END_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
499 |
|
|
500 |
|
CONTROLDLG(IDC_CPU_MMX, ISDLGSET(IDC_CPU_FORCE)); |
501 |
|
CONTROLDLG(IDC_CPU_MMXEXT, ISDLGSET(IDC_CPU_FORCE)); |
502 |
|
CONTROLDLG(IDC_CPU_SSE, ISDLGSET(IDC_CPU_FORCE)); |
503 |
|
CONTROLDLG(IDC_CPU_SSE2, ISDLGSET(IDC_CPU_FORCE)); |
504 |
|
CONTROLDLG(IDC_CPU_3DNOW, ISDLGSET(IDC_CPU_FORCE)); |
505 |
|
CONTROLDLG(IDC_CPU_3DNOWEXT, ISDLGSET(IDC_CPU_FORCE)); |
506 |
|
|
507 |
config->qmatrix_inter[i] = config_get_int(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
// now perform codec mode enable/disable |
508 |
CONSTRAINVAL(config->qmatrix_inter[i], 1, 255) |
for (i=0 ; i<lengths[mode] ; ++i) |
509 |
|
{ |
510 |
|
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
511 |
} |
} |
512 |
} |
} |
513 |
|
|
514 |
|
|
515 |
/* dialog proc */ |
/* upload config data into dialog */ |
516 |
|
|
517 |
BOOL CALLBACK config_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
void adv_upload(HWND hDlg, int page, CONFIG * config) |
518 |
{ |
{ |
519 |
PROPSHEETINFO *psi; |
switch (page) |
|
|
|
|
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
|
|
|
|
|
switch (uMsg) |
|
520 |
{ |
{ |
521 |
case WM_INITDIALOG : |
case DLG_GLOBAL : |
522 |
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
523 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
524 |
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
525 |
|
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
526 |
|
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
527 |
|
break; |
528 |
|
|
529 |
switch (psi->page) |
case DLG_QUANT : |
530 |
{ |
SetDlgItemInt(hDlg, IDC_MINIQUANT, config->min_iquant, FALSE); |
531 |
case DLG_MAIN : |
SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); |
532 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); |
SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); |
533 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); |
SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
|
534 |
break; |
break; |
535 |
|
|
536 |
case DLG_ADV : |
case DLG_2PASS : |
537 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
538 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
539 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
540 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
|
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"); |
|
541 |
|
|
542 |
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
543 |
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
544 |
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
545 |
|
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
546 |
|
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
547 |
|
|
548 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
549 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
550 |
break; |
break; |
551 |
|
|
552 |
case DLG_ABOUT : |
case DLG_CREDITS : |
553 |
{ |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
554 |
HFONT hFont; |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
555 |
LOGFONT lfData; |
SetDlgItemInt(hDlg, IDC_CREDITS_START_END, config->credits_start_end, FALSE); |
556 |
|
CheckDlgButton(hDlg, IDC_CREDITS_END, config->credits_end ? BST_CHECKED : BST_UNCHECKED); |
557 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
558 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
559 |
|
|
560 |
SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__); |
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
561 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
562 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
563 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size, FALSE); |
564 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size, FALSE); |
565 |
|
|
566 |
// Add by Chen at 2002-03-05 to display core version at about box |
if (config->credits_mode == CREDITS_MODE_RATE) |
|
// Change by Chen at 2002-03-11 now use xvid_init() to get core version |
|
567 |
{ |
{ |
568 |
char chTemp[64]; |
CheckDlgButton(hDlg, IDC_CREDITS_RATE_RADIO, BST_CHECKED); |
|
// 2002-03-11 Change start |
|
|
XVID_INIT_PARAM xinit; |
|
|
xvid_init(NULL,0,&xinit,NULL); |
|
|
sprintf(chTemp,"Core Version %d.%d",(xinit.api_version>>16),(xinit.api_version&0xFFFFU)); |
|
|
// 2002-03-11 Change End |
|
|
//sprintf(chTemp,"Core Version %d.%d",(API_VERSION>>16),(API_VERSION&0xFFFFU)); |
|
|
SetDlgItemText(hDlg, IDC_CORE_VERSION, chTemp); |
|
569 |
} |
} |
570 |
|
else if (config->credits_mode == CREDITS_MODE_QUANT) |
|
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
|
|
|
|
|
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) |
|
|
{ |
|
|
lfData.lfUnderline = 1; |
|
|
|
|
|
hFont = CreateFontIndirect(&lfData); |
|
|
if (hFont) |
|
571 |
{ |
{ |
572 |
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
CheckDlgButton(hDlg, IDC_CREDITS_QUANT_RADIO, BST_CHECKED); |
573 |
} |
} |
574 |
|
else // CREDITS_MODE_SIZE |
575 |
|
{ |
576 |
|
CheckDlgButton(hDlg, IDC_CREDITS_SIZE_RADIO, BST_CHECKED); |
577 |
} |
} |
578 |
|
break; |
579 |
|
|
580 |
SetClassLong(GetDlgItem(hDlg, IDC_WEBSITE), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
case DLG_CPU : |
581 |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
CheckDlgButton(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX) ? BST_CHECKED : BST_UNCHECKED); |
582 |
|
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT) ? BST_CHECKED : BST_UNCHECKED); |
583 |
|
CheckDlgButton(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE) ? BST_CHECKED : BST_UNCHECKED); |
584 |
|
CheckDlgButton(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2) ? BST_CHECKED : BST_UNCHECKED); |
585 |
|
CheckDlgButton(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW) ? BST_CHECKED : BST_UNCHECKED); |
586 |
|
CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT) ? BST_CHECKED : BST_UNCHECKED); |
587 |
|
|
588 |
|
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
589 |
|
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
590 |
|
break; |
591 |
} |
} |
592 |
} |
} |
593 |
|
|
|
config_upload(hDlg, psi->page, psi->config); |
|
|
config_mode(hDlg); |
|
|
break; |
|
594 |
|
|
595 |
case WM_CTLCOLORSTATIC : |
/* download config data from dialog |
596 |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
replaces invalid values instead of alerting user for now |
597 |
|
*/ |
598 |
|
|
599 |
|
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
600 |
|
|
601 |
|
void adv_download(HWND hDlg, int page, CONFIG * config) |
602 |
{ |
{ |
603 |
SetBkMode((HDC)wParam, TRANSPARENT) ; |
switch (page) |
604 |
SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0)); |
{ |
605 |
return (BOOL)GetStockObject(NULL_BRUSH); |
case DLG_GLOBAL : |
606 |
} |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
607 |
return FALSE; |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
608 |
|
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
609 |
|
config->max_key_interval = config_get_int(hDlg, IDC_MAXKEY, config->max_key_interval); |
610 |
|
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
611 |
|
break; |
612 |
|
|
613 |
case WM_COMMAND : |
case DLG_QUANT : |
614 |
if (LOWORD(wParam) == IDC_MODE && HIWORD(wParam) == LBN_SELCHANGE) |
config->min_iquant = config_get_int(hDlg, IDC_MINIQUANT, config->min_iquant); |
615 |
|
config->max_iquant = config_get_int(hDlg, IDC_MAXIQUANT, config->max_iquant); |
616 |
|
config->min_pquant = config_get_int(hDlg, IDC_MINPQUANT, config->min_pquant); |
617 |
|
config->max_pquant = config_get_int(hDlg, IDC_MAXPQUANT, config->max_pquant); |
618 |
|
|
619 |
|
CONSTRAINVAL(config->min_iquant, 1, 31); |
620 |
|
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
621 |
|
CONSTRAINVAL(config->min_pquant, 1, 31); |
622 |
|
CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); |
623 |
|
break; |
624 |
|
|
625 |
|
case DLG_2PASS : |
626 |
|
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
627 |
|
config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->min_key_interval); |
628 |
|
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
629 |
|
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
630 |
|
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
631 |
|
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
632 |
|
config->bitrate_payback_delay = config_get_int(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
633 |
|
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
634 |
|
|
635 |
|
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
636 |
{ |
{ |
637 |
config_mode(hDlg); |
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
|
config_download(hDlg, psi->page, psi->config); |
|
|
config_value(hDlg, psi->config); |
|
|
config_slider(hDlg, psi->config); |
|
638 |
} |
} |
639 |
else if ((LOWORD(wParam) == IDC_CPU_AUTO || LOWORD(wParam) == IDC_CPU_FORCE) && HIWORD(wParam) == BN_CLICKED) |
if (GetDlgItemText(hDlg, IDC_STATS2, config->stats2, MAX_PATH) == 0) |
640 |
{ |
{ |
641 |
config_mode(hDlg); |
lstrcpy(config->stats2, CONFIG_2PASS_2_FILE); |
642 |
} |
} |
|
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
|
|
{ |
|
|
int value = config_get_int(hDlg, IDC_VALUE, 1); |
|
|
int max = 1; |
|
643 |
|
|
644 |
switch (SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0)) |
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
645 |
{ |
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
646 |
default : |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
647 |
case DLG_MODE_CBR : |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
|
max = 10000; |
|
648 |
break; |
break; |
649 |
|
|
650 |
case DLG_MODE_VBR_QUAL : |
case DLG_CREDITS : |
651 |
max = 100; |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
652 |
break; |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
653 |
|
config->credits_start_end = config_get_int(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
654 |
|
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
655 |
|
config->credits_end_begin = config_get_int(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
656 |
|
config->credits_end_end = config_get_int(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
657 |
|
|
658 |
case DLG_MODE_VBR_QUANT : |
config->credits_rate = config_get_int(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
659 |
max = 31; |
config->credits_quant_i = config_get_int(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
660 |
break; |
config->credits_quant_p = config_get_int(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
661 |
} |
config->credits_start_size = config_get_int(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
662 |
|
config->credits_end_size = config_get_int(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
663 |
|
|
664 |
if (value < 1) |
config->credits_mode = 0; |
665 |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; |
666 |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_QUANT_RADIO) ? CREDITS_MODE_QUANT : config->credits_mode; |
667 |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_SIZE_RADIO) ? CREDITS_MODE_SIZE : config->credits_mode; |
668 |
|
|
669 |
|
CONSTRAINVAL(config->credits_rate, 1, 100); |
670 |
|
CONSTRAINVAL(config->credits_quant_i, 1, 31); |
671 |
|
CONSTRAINVAL(config->credits_quant_p, 1, 31); |
672 |
|
|
673 |
|
if (config->credits_start_begin > config->credits_start_end) |
674 |
{ |
{ |
675 |
value = 1; |
config->credits_start_begin = config->credits_start_end; |
676 |
|
config->credits_start = 0; |
677 |
} |
} |
678 |
if (value > max) |
if (config->credits_end_begin > config->credits_end_end) |
679 |
{ |
{ |
680 |
value = max; |
config->credits_end_begin = config->credits_end_end; |
681 |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
config->credits_end = 0; |
682 |
} |
} |
683 |
|
break; |
684 |
|
|
685 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
case DLG_CPU : |
686 |
|
config->cpu = 0; |
687 |
|
config->cpu |= ISDLGSET(IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
688 |
|
config->cpu |= ISDLGSET(IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT: 0; |
689 |
|
config->cpu |= ISDLGSET(IDC_CPU_SSE) ? XVID_CPU_SSE: 0; |
690 |
|
config->cpu |= ISDLGSET(IDC_CPU_SSE2) ? XVID_CPU_SSE2: 0; |
691 |
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
692 |
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
693 |
|
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
694 |
|
break; |
695 |
|
} |
696 |
} |
} |
|
else if ((LOWORD(wParam) == IDC_2PASS_STATS1_BROWSE || LOWORD(wParam) == IDC_2PASS_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
OPENFILENAME ofn; |
|
|
char tmp[MAX_PATH]; |
|
|
int hComponent = (LOWORD(wParam) == IDC_2PASS_STATS1_BROWSE ? IDC_2PASS_STATS1 : IDC_2PASS_STATS2 ); |
|
|
|
|
|
GetDlgItemText(hDlg, hComponent, tmp, MAX_PATH); |
|
|
|
|
|
memset(&ofn, 0, sizeof(OPENFILENAME)); |
|
|
ofn.lStructSize = sizeof(OPENFILENAME); |
|
697 |
|
|
|
ofn.hwndOwner = hDlg; |
|
|
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
|
|
ofn.lpstrFile = tmp; |
|
|
ofn.nMaxFile = MAX_PATH; |
|
|
ofn.Flags = OFN_PATHMUSTEXIST; |
|
698 |
|
|
699 |
// display save box for stats1 using 1st-pass |
void quant_upload(HWND hDlg, CONFIG* config) |
|
if (LOWORD(wParam) == IDC_2PASS_STATS1_BROWSE && |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0) == DLG_MODE_2PASS_1) |
|
700 |
{ |
{ |
701 |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
int i; |
702 |
if (GetSaveFileName(&ofn)) |
|
703 |
|
for (i=0 ; i<64 ; ++i) |
704 |
{ |
{ |
705 |
SetDlgItemText(hDlg, hComponent, tmp); |
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
706 |
|
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
707 |
} |
} |
708 |
} |
} |
709 |
else |
|
710 |
|
|
711 |
|
void quant_download(HWND hDlg, CONFIG* config) |
712 |
{ |
{ |
713 |
ofn.Flags |= OFN_FILEMUSTEXIST; |
int i; |
714 |
if (GetOpenFileName(&ofn)) { |
|
715 |
SetDlgItemText(hDlg, hComponent, tmp); |
for (i=0 ; i<64 ; ++i) |
716 |
} |
{ |
717 |
|
int temp; |
718 |
|
|
719 |
|
temp = config_get_int(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
720 |
|
CONSTRAINVAL(temp, 1, 255); |
721 |
|
temp = config->qmatrix_intra[i]; |
722 |
|
|
723 |
|
temp = config_get_int(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
724 |
|
CONSTRAINVAL(temp, 1, 255); |
725 |
|
temp = config->qmatrix_inter[i]; |
726 |
} |
} |
727 |
} |
} |
728 |
else if (LOWORD(wParam) == IDC_CREDITS && HIWORD(wParam) == BN_CLICKED) |
|
729 |
|
/* monitor mouse events to dialog controls for help text */ |
730 |
|
|
731 |
|
HHOOK hHook; |
732 |
|
HWND hParent; |
733 |
|
|
734 |
|
LRESULT CALLBACK msg_proc(int nCode, WPARAM wParam, LPARAM lParam) |
735 |
{ |
{ |
736 |
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CREDITS), hDlg, credits_proc, (LPARAM)psi->config); |
MSG* pmsg = (MSG *)lParam; |
737 |
} |
|
738 |
else if (LOWORD(wParam) == IDC_2PASS_INT && HIWORD(wParam) == BN_CLICKED) |
if (pmsg->message == WM_MOUSEMOVE) |
739 |
{ |
{ |
740 |
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_2PASS), hDlg, twopass_proc, (LPARAM)psi->config); |
if (pmsg->hwnd == hParent) |
|
} |
|
|
else if (LOWORD(wParam) == IDC_QUANTMATRIX && HIWORD(wParam) == BN_CLICKED) |
|
741 |
{ |
{ |
742 |
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
SetDlgItemText(hParent, IDC_STATIC_HELP, XVID_HELP); |
743 |
} |
} |
744 |
else if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) |
else if (IsChild(hParent, pmsg->hwnd)) |
745 |
{ |
{ |
746 |
ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); |
char *message; |
747 |
} |
char help[500]; |
|
break; |
|
748 |
|
|
749 |
case WM_HSCROLL: |
int mode = SendDlgItemMessage(hParent, IDC_MODE, CB_GETCURSEL, 0, 0); |
750 |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) |
int item = GetDlgCtrlID(pmsg->hwnd); |
751 |
|
|
752 |
|
if (item == IDC_VALUE || item == IDC_SLIDER) |
753 |
{ |
{ |
754 |
SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
switch (mode) |
|
} |
|
|
else |
|
755 |
{ |
{ |
756 |
return 0; |
case DLG_MODE_2PASS_2_INT : |
757 |
|
if (item == IDC_VALUE) |
758 |
|
{ |
759 |
|
message = "Set the desired video size in Kilobytes"; |
760 |
|
break; |
761 |
} |
} |
762 |
|
default : |
763 |
|
case DLG_MODE_CBR : |
764 |
|
message = "Set the target video bitrate"; |
765 |
break; |
break; |
766 |
|
|
767 |
case WM_NOTIFY : |
case DLG_MODE_VBR_QUAL : |
768 |
switch (((NMHDR *)lParam)->code) |
message = "Set the target video quality"; |
|
{ |
|
|
case PSN_KILLACTIVE : |
|
|
/* validate */ |
|
|
config_download(hDlg, psi->page, psi->config); |
|
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
|
769 |
break; |
break; |
770 |
|
|
771 |
case PSN_APPLY : |
case DLG_MODE_VBR_QUANT : |
772 |
/* apply */ |
message = "Set the fixed quantizer for encoding"; |
|
config_download(hDlg, psi->page, psi->config); |
|
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
|
|
config_reg_set(psi->config); |
|
|
psi->config->save = TRUE; |
|
773 |
break; |
break; |
774 |
} |
} |
775 |
break; |
lstrcpy(help, message); |
776 |
|
} |
777 |
|
else if (!LoadString(hInst, GetDlgCtrlID(pmsg->hwnd), help, 500)) |
778 |
|
{ |
779 |
|
lstrcpy(help, XVID_HELP); |
780 |
|
} |
781 |
|
|
782 |
default : |
SetDlgItemText(hParent, IDC_STATIC_HELP, help); |
783 |
return 0; |
} |
784 |
} |
} |
785 |
|
|
786 |
return 1; |
return (CallNextHookEx(hHook, nCode, wParam, lParam)); |
787 |
} |
} |
788 |
|
|
789 |
|
|
790 |
/* credits dialog proc */ |
/* main dialog proc */ |
791 |
|
|
792 |
BOOL CALLBACK credits_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
793 |
{ |
{ |
794 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
795 |
|
|
800 |
|
|
801 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
802 |
|
|
803 |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); |
804 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); |
805 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_END, config->credits_start_end, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); |
806 |
CheckDlgButton(hDlg, IDC_CREDITS_END, config->credits_end ? BST_CHECKED : BST_UNCHECKED); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); |
807 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); |
808 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); |
809 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
810 |
|
|
811 |
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
812 |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
SetDlgItemInt(hDlg, IDC_CBRBUFFER, config->rc_buffersize, FALSE); |
813 |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); |
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size, FALSE); |
|
814 |
|
|
815 |
switch (config->credits_mode) |
hHook = SetWindowsHookEx(WH_GETMESSAGE, msg_proc, 0, GetCurrentThreadId()); |
|
{ |
|
|
case CREDITS_MODE_RATE : |
|
|
CheckDlgButton(hDlg, IDC_CREDITS_RATE_RADIO, BST_CHECKED); |
|
|
break; |
|
816 |
|
|
817 |
case CREDITS_MODE_QUANT : |
main_slider(hDlg, config); |
818 |
CheckDlgButton(hDlg, IDC_CREDITS_QUANT_RADIO, BST_CHECKED); |
main_value(hDlg, config); |
819 |
break; |
break; |
820 |
|
|
821 |
case CREDITS_MODE_SIZE : |
case WM_ACTIVATE : |
822 |
CheckDlgButton(hDlg, IDC_CREDITS_SIZE_RADIO, BST_CHECKED); |
if (LOWORD(wParam) != WA_INACTIVE) |
823 |
break; |
{ |
824 |
|
hParent = hDlg; |
825 |
} |
} |
826 |
|
return 0; |
827 |
|
|
828 |
credits_controls(hDlg); |
case WM_DESTROY : |
829 |
|
UnhookWindowsHookEx(hHook); |
830 |
break; |
break; |
831 |
|
|
832 |
case WM_COMMAND : |
case WM_HSCROLL : |
833 |
if (LOWORD(wParam) == IDCANCEL) |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) |
834 |
{ |
{ |
835 |
EndDialog(hDlg, IDCANCEL); |
SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
836 |
} |
} |
837 |
else if (HIWORD(wParam) == BN_CLICKED) |
else |
|
{ |
|
|
switch (LOWORD(wParam)) |
|
838 |
{ |
{ |
839 |
case IDC_CREDITS_START : |
return 0; |
840 |
case IDC_CREDITS_END : |
} |
|
case IDC_CREDITS_RATE_RADIO : |
|
|
case IDC_CREDITS_QUANT_RADIO : |
|
|
case IDC_CREDITS_SIZE_RADIO : |
|
|
credits_controls(hDlg); |
|
841 |
break; |
break; |
842 |
|
|
843 |
case IDOK : |
case WM_COMMAND : |
844 |
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)) |
|
845 |
{ |
{ |
846 |
config->credits_mode = CREDITS_MODE_RATE; |
main_download(hDlg, config); |
847 |
|
main_slider(hDlg, config); |
848 |
|
main_value(hDlg, config); |
849 |
} |
} |
850 |
if (ISDLGSET(IDC_CREDITS_QUANT_RADIO)) |
else if (LOWORD(wParam) == IDC_ADVANCED && HIWORD(wParam) == BN_CLICKED) |
851 |
{ |
{ |
852 |
config->credits_mode = CREDITS_MODE_QUANT; |
adv_dialog(hDlg, config); |
853 |
} |
|
854 |
if (ISDLGSET(IDC_CREDITS_SIZE_RADIO)) |
if (config->save) |
855 |
{ |
{ |
856 |
config->credits_mode = CREDITS_MODE_SIZE; |
config_reg_set(config); |
857 |
|
} |
858 |
} |
} |
859 |
|
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
860 |
|
{ |
861 |
|
int value = config_get_int(hDlg, IDC_VALUE, 1); |
862 |
|
int max = 1; |
863 |
|
|
864 |
CONSTRAINVAL(config->credits_rate, 1, 100) |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
865 |
CONSTRAINVAL(config->credits_quant_i, 1, 31) |
((config->mode == DLG_MODE_VBR_QUAL) ? 100 : |
866 |
CONSTRAINVAL(config->credits_quant_p, 1, 31) |
((config->mode == DLG_MODE_VBR_QUANT) ? 31 : 1<<30)); |
867 |
|
|
868 |
if (config->credits_start_begin > config->credits_start_end) |
if (value < 1) |
869 |
{ |
{ |
870 |
config->credits_start_begin = config->credits_start_end; |
value = 1; |
|
config->credits_start = 0; |
|
871 |
} |
} |
872 |
if (config->credits_end_begin > config->credits_end_end) |
if (value > max) |
873 |
{ |
{ |
874 |
config->credits_end_begin = config->credits_end_end; |
value = max; |
875 |
config->credits_end = 0; |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
876 |
} |
} |
877 |
|
|
878 |
|
if (config->mode != DLG_MODE_2PASS_2_INT) |
879 |
|
{ |
880 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
881 |
|
} |
882 |
|
} |
883 |
|
else if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
884 |
|
{ |
885 |
|
main_download(hDlg, config); |
886 |
|
config->save = TRUE; |
887 |
EndDialog(hDlg, IDOK); |
EndDialog(hDlg, IDOK); |
|
break; |
|
888 |
} |
} |
889 |
|
else if (LOWORD(wParam) == IDCANCEL) |
890 |
|
{ |
891 |
|
config->save = FALSE; |
892 |
|
EndDialog(hDlg, IDCANCEL); |
893 |
} |
} |
894 |
break; |
break; |
895 |
|
|
901 |
} |
} |
902 |
|
|
903 |
|
|
904 |
/* 2-pass dialog proc */ |
/* advanced dialog proc */ |
905 |
|
|
906 |
BOOL CALLBACK twopass_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
907 |
{ |
{ |
908 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
PROPSHEETINFO *psi; |
909 |
|
|
910 |
|
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
911 |
|
|
912 |
switch (uMsg) |
switch (uMsg) |
913 |
{ |
{ |
914 |
case WM_INITDIALOG : |
case WM_INITDIALOG : |
915 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
916 |
|
|
917 |
config = (CONFIG*)lParam; |
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
918 |
|
|
919 |
SetDlgItemInt(hDlg, IDC_DESIRED, config->desired_size, FALSE); |
if (psi->page == DLG_GLOBAL) |
920 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
{ |
921 |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
922 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); |
923 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); |
924 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); |
925 |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"4 - High"); |
926 |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"5 - Very High"); |
927 |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"6 - Ultra High"); |
928 |
|
|
929 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
930 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
931 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
932 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); |
933 |
|
|
934 |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
935 |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
936 |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
937 |
|
} |
938 |
|
|
939 |
|
SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); |
940 |
|
adv_upload(hDlg, psi->page, psi->config); |
941 |
|
adv_mode(hDlg, psi->config->mode); |
942 |
break; |
break; |
943 |
|
|
944 |
case WM_COMMAND : |
case WM_COMMAND : |
945 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (HIWORD(wParam) == BN_CLICKED) |
946 |
{ |
{ |
947 |
config->desired_size = config_get_int(hDlg, IDC_DESIRED, config->desired_size); |
switch (LOWORD(wParam)) |
948 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
{ |
949 |
config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->max_key_interval); |
case IDC_CREDITS_START : |
950 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
case IDC_CREDITS_END : |
951 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
case IDC_CREDITS_RATE_RADIO : |
952 |
config->bitrate_payback_delay = config_get_int(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
case IDC_CREDITS_QUANT_RADIO : |
953 |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
case IDC_CREDITS_SIZE_RADIO : |
954 |
|
case IDC_CPU_AUTO : |
955 |
|
case IDC_CPU_FORCE : |
956 |
|
adv_mode(hDlg, psi->config->mode); |
957 |
|
break; |
958 |
|
} |
959 |
|
} |
960 |
|
if ((LOWORD(wParam) == IDC_STATS1_BROWSE || LOWORD(wParam) == IDC_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
961 |
|
{ |
962 |
|
OPENFILENAME ofn; |
963 |
|
char tmp[MAX_PATH]; |
964 |
|
int hComponent = (LOWORD(wParam) == IDC_STATS1_BROWSE ? IDC_STATS1 : IDC_STATS2); |
965 |
|
|
966 |
|
GetDlgItemText(hDlg, hComponent, tmp, MAX_PATH); |
967 |
|
|
968 |
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000) |
memset(&ofn, 0, sizeof(OPENFILENAME)); |
969 |
CONSTRAINVAL(config->keyframe_boost, 0, 1000) |
ofn.lStructSize = sizeof(OPENFILENAME); |
|
CONSTRAINVAL(config->curve_compression_high, 0, 100) |
|
|
CONSTRAINVAL(config->curve_compression_low, 0, 100) |
|
970 |
|
|
971 |
EndDialog(hDlg, IDOK); |
ofn.hwndOwner = hDlg; |
972 |
|
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
973 |
|
ofn.lpstrFile = tmp; |
974 |
|
ofn.nMaxFile = MAX_PATH; |
975 |
|
ofn.Flags = OFN_PATHMUSTEXIST; |
976 |
|
|
977 |
|
// display save box for stats1 using 1st-pass |
978 |
|
if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
979 |
|
psi->config->mode == DLG_MODE_2PASS_1) |
980 |
|
{ |
981 |
|
ofn.Flags |= OFN_OVERWRITEPROMPT; |
982 |
|
if (GetSaveFileName(&ofn)) |
983 |
|
{ |
984 |
|
SetDlgItemText(hDlg, hComponent, tmp); |
985 |
} |
} |
986 |
else if (LOWORD(wParam) == IDCANCEL) |
} |
987 |
|
else |
988 |
{ |
{ |
989 |
EndDialog(hDlg, IDCANCEL); |
ofn.Flags |= OFN_FILEMUSTEXIST; |
990 |
|
if (GetOpenFileName(&ofn)) { |
991 |
|
SetDlgItemText(hDlg, hComponent, tmp); |
992 |
|
} |
993 |
|
} |
994 |
|
} |
995 |
|
else if (LOWORD(wParam) == IDC_QUANTMATRIX && HIWORD(wParam) == BN_CLICKED) |
996 |
|
{ |
997 |
|
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
998 |
|
} |
999 |
|
break; |
1000 |
|
|
1001 |
|
case WM_NOTIFY : |
1002 |
|
switch (((NMHDR *)lParam)->code) |
1003 |
|
{ |
1004 |
|
case PSN_SETACTIVE : |
1005 |
|
hParent = hDlg; |
1006 |
|
break; |
1007 |
|
|
1008 |
|
case PSN_KILLACTIVE : |
1009 |
|
/* validate */ |
1010 |
|
adv_download(hDlg, psi->page, psi->config); |
1011 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1012 |
|
break; |
1013 |
|
|
1014 |
|
case PSN_APPLY : |
1015 |
|
/* apply */ |
1016 |
|
adv_download(hDlg, psi->page, psi->config); |
1017 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1018 |
|
psi->config->save = TRUE; |
1019 |
|
break; |
1020 |
} |
} |
1021 |
break; |
break; |
1022 |
|
|
1038 |
{ |
{ |
1039 |
case WM_INITDIALOG : |
case WM_INITDIALOG : |
1040 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
|
|
|
1041 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
|
|
|
1042 |
quant_upload(hDlg, config); |
quant_upload(hDlg, config); |
1043 |
break; |
break; |
1044 |
|
|
1045 |
|
case WM_ACTIVATE : |
1046 |
|
if (LOWORD(wParam) != WA_INACTIVE) |
1047 |
|
{ |
1048 |
|
hParent = hDlg; |
1049 |
|
} |
1050 |
|
return 0; |
1051 |
|
|
1052 |
case WM_COMMAND : |
case WM_COMMAND : |
1053 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1054 |
{ |
{ |
1055 |
quant_download(hDlg, config); |
quant_download(hDlg, config); |
|
|
|
1056 |
EndDialog(hDlg, IDOK); |
EndDialog(hDlg, IDOK); |
1057 |
} |
} |
1058 |
else if (LOWORD(wParam) == IDCANCEL) |
else if (LOWORD(wParam) == IDCANCEL) |
1141 |
|
|
1142 |
return 1; |
return 1; |
1143 |
} |
} |
1144 |
|
|
1145 |
|
|
1146 |
|
/* about dialog proc */ |
1147 |
|
|
1148 |
|
BOOL CALLBACK about_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1149 |
|
{ |
1150 |
|
switch (uMsg) |
1151 |
|
{ |
1152 |
|
case WM_INITDIALOG : |
1153 |
|
{ |
1154 |
|
XVID_INIT_PARAM init_param; |
1155 |
|
char core[100]; |
1156 |
|
HFONT hFont; |
1157 |
|
LOGFONT lfData; |
1158 |
|
|
1159 |
|
SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__); |
1160 |
|
|
1161 |
|
xvid_init(NULL, 0, &init_param, 0); |
1162 |
|
wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); |
1163 |
|
SetDlgItemText(hDlg, IDC_CORE, core); |
1164 |
|
|
1165 |
|
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1166 |
|
|
1167 |
|
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) |
1168 |
|
{ |
1169 |
|
lfData.lfUnderline = 1; |
1170 |
|
|
1171 |
|
hFont = CreateFontIndirect(&lfData); |
1172 |
|
if (hFont) |
1173 |
|
{ |
1174 |
|
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
1175 |
|
} |
1176 |
|
} |
1177 |
|
|
1178 |
|
SetClassLong(GetDlgItem(hDlg, IDC_WEBSITE), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
1179 |
|
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
1180 |
|
} |
1181 |
|
break; |
1182 |
|
|
1183 |
|
case WM_CTLCOLORSTATIC : |
1184 |
|
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
1185 |
|
{ |
1186 |
|
SetBkMode((HDC)wParam, TRANSPARENT) ; |
1187 |
|
SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0)); |
1188 |
|
return (BOOL)GetStockObject(NULL_BRUSH); |
1189 |
|
} |
1190 |
|
return 0; |
1191 |
|
|
1192 |
|
case WM_COMMAND : |
1193 |
|
if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) |
1194 |
|
{ |
1195 |
|
ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); |
1196 |
|
} |
1197 |
|
else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) |
1198 |
|
{ |
1199 |
|
EndDialog(hDlg, LOWORD(wParam)); |
1200 |
|
} |
1201 |
|
break; |
1202 |
|
|
1203 |
|
default : |
1204 |
|
return 0; |
1205 |
|
} |
1206 |
|
|
1207 |
|
return 1; |
1208 |
|
} |