57 |
|
|
58 |
#include <windows.h> |
#include <windows.h> |
59 |
#include <commctrl.h> |
#include <commctrl.h> |
|
#include <shlobj.h> |
|
|
#include <prsht.h> |
|
|
|
|
60 |
#include <stdio.h> /* sprintf */ |
#include <stdio.h> /* sprintf */ |
61 |
#include <xvid.h> /* XviD API */ |
#include <xvid.h> /* XviD API */ |
62 |
|
|
70 |
#define CheckDlg(hwnd,idc,value) CheckDlgButton(hwnd,idc, value?BST_CHECKED:BST_UNCHECKED) |
#define CheckDlg(hwnd,idc,value) CheckDlgButton(hwnd,idc, value?BST_CHECKED:BST_UNCHECKED) |
71 |
#define EnableDlgWindow(hwnd,idc,state) EnableWindow(GetDlgItem(hwnd,idc),state) |
#define EnableDlgWindow(hwnd,idc,state) EnableWindow(GetDlgItem(hwnd,idc),state) |
72 |
|
|
73 |
|
static void zones_update(HWND hDlg, CONFIG * config); |
74 |
|
|
75 |
HINSTANCE g_hInst; |
HINSTANCE g_hInst; |
76 |
HWND g_hTooltip; |
HWND g_hTooltip; |
77 |
|
|
78 |
|
static int g_use_bitrate = 1; |
79 |
|
|
80 |
|
|
81 |
|
int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */ |
82 |
|
|
83 |
/* enumerates child windows, assigns tooltips */ |
/* enumerates child windows, assigns tooltips */ |
84 |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
85 |
{ |
{ |
112 |
{ |
{ |
113 |
/* name p@l, w h fps obj Tvmv vmv vcv ac% vbv pkt kbps flags */ |
/* name p@l, w h fps obj Tvmv vmv vcv ac% vbv pkt kbps flags */ |
114 |
{ "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100, 10*16368, 2048, 64, 0 }, |
{ "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100, 10*16368, 2048, 64, 0 }, |
115 |
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 |
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */ |
116 |
/* if ac preidition is used, adaptive quantization must not be used */ |
/* if ac preidition is used, adaptive quantization must not be used */ |
117 |
/* <=qcif must be used */ |
/* <=qcif must be used */ |
118 |
{ "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, PROFILE_ADAPTQUANT }, |
{ "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, PROFILE_ADAPTQUANT }, |
132 |
{ "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, |
{ "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, |
133 |
{ "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
{ "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
134 |
|
|
135 |
|
#ifdef DXN_PROFILES |
136 |
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
137 |
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
138 |
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
139 |
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
140 |
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
141 |
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
142 |
|
#endif |
143 |
|
|
144 |
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
145 |
}; |
}; |
146 |
|
|
147 |
|
|
148 |
|
typedef struct { |
149 |
|
char * name; |
150 |
|
float value; |
151 |
|
} named_float_t; |
152 |
|
|
153 |
|
static const named_float_t video_fps_list[] = { |
154 |
|
{ "15.0", 15.0F }, |
155 |
|
{ "23.976 (FILM)", 23.976F }, |
156 |
|
{ "25.0 (PAL)", 25.0F }, |
157 |
|
{ "29.97 (NTSC)", 29.970F }, |
158 |
|
{ "30.0", 30.0F } |
159 |
|
}; |
160 |
|
|
161 |
|
|
162 |
|
typedef struct { |
163 |
|
char * name; |
164 |
|
int avi_interval; /* audio overhead intervals (milliseconds) */ |
165 |
|
float mkv_multiplier; /* mkv multiplier */ |
166 |
|
} named_int_t; |
167 |
|
|
168 |
|
|
169 |
|
#define NO_AUDIO 5 |
170 |
|
static const named_int_t audio_type_list[] = { |
171 |
|
{ "MP3-CBR", 1000, 48000/1152/6 }, |
172 |
|
{ "MP3-VBR", 24, 48000/1152/6 }, |
173 |
|
{ "OGG", /*?*/1000, 48000*(0.7F/1024 + 0.3F/180) }, |
174 |
|
{ "AC3", 64, 48000/1536/6 }, |
175 |
|
{ "DTS", 21, /*?*/48000/1152/6 }, |
176 |
|
{ "(None)", 0, 0 }, |
177 |
|
}; |
178 |
|
|
179 |
|
|
180 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
181 |
/* REGISTRY ============================================================================ */ |
/* REGISTRY ============================================================================ */ |
182 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
189 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
190 |
{"desired_size", ®.desired_size, 570000}, |
{"desired_size", ®.desired_size, 570000}, |
191 |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
192 |
|
{"desired_quant", ®.desired_quant, DEFAULT_QUANT}, /* 100-base float */ |
193 |
|
|
194 |
/* profile */ |
/* profile */ |
195 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
198 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
199 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
200 |
{"reduced_resolution", ®.reduced_resolution, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
201 |
{"use_bvop", ®.use_bvop, 0}, |
{"use_bvop", ®.use_bvop, 1}, |
202 |
{"max_bframes", ®.max_bframes, 2}, |
{"max_bframes", ®.max_bframes, 2}, |
203 |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
204 |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
205 |
{"packed", ®.packed, 0}, |
{"packed", ®.packed, 1}, |
206 |
{"closed_gov", ®.closed_gov, 1}, |
{"closed_gov", ®.closed_gov, 1}, |
207 |
|
|
208 |
|
/* aspect ratio */ |
209 |
|
{"ar_mode", ®.ar_mode, 0}, |
210 |
|
{"aspect_ratio", ®.display_aspect_ratio, 0}, |
211 |
|
{"par_x", ®.par_x, 1}, |
212 |
|
{"par_y", ®.par_y, 1}, |
213 |
|
{"ar_x", ®.ar_x, 4}, |
214 |
|
{"ar_y", ®.ar_y, 3}, |
215 |
|
|
216 |
/* zones */ |
/* zones */ |
217 |
{"num_zones", ®.num_zones, 1}, |
{"num_zones", ®.num_zones, 1}, |
218 |
|
|
223 |
|
|
224 |
/* 2pass1 */ |
/* 2pass1 */ |
225 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
226 |
|
{"full1pass", ®.full1pass, 0}, |
227 |
|
|
228 |
/* 2pass2 */ |
/* 2pass2 */ |
229 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
{"keyframe_boost", ®.keyframe_boost, 10}, |
|
{"kftreshold", ®.kftreshold, 10}, |
|
230 |
{"kfreduction", ®.kfreduction, 20}, |
{"kfreduction", ®.kfreduction, 20}, |
231 |
|
{"kfthreshold", ®.kfthreshold, 1}, |
232 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
{"curve_compression_high", ®.curve_compression_high, 0}, |
233 |
{"curve_compression_low", ®.curve_compression_low, 0}, |
{"curve_compression_low", ®.curve_compression_low, 0}, |
234 |
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
{"overflow_control_strength", ®.overflow_control_strength, 5}, |
235 |
{"bitrate_payback_method", ®.bitrate_payback_method, XVID_PAYBACK_BIAS }, |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
236 |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
237 |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
|
238 |
|
/* bitrate calculator */ |
239 |
|
{"container_type", ®.container_type, 1}, |
240 |
|
{"target_size", ®.target_size, 650 * 1024}, |
241 |
|
{"subtitle_size", ®.subtitle_size, 0}, |
242 |
|
{"hours", ®.hours, 1}, |
243 |
|
{"minutes", ®.minutes, 30}, |
244 |
|
{"seconds", ®.seconds, 0}, |
245 |
|
{"fps", ®.fps, 2}, |
246 |
|
{"audio_mode", ®.audio_mode, 0}, |
247 |
|
{"audio_type", ®.audio_type, 0}, |
248 |
|
{"audio_rate", ®.audio_rate, 128}, |
249 |
|
{"audio_size", ®.audio_size, 0}, |
250 |
|
|
251 |
/* motion */ |
/* motion */ |
252 |
{"motion_search", ®.motion_search, 6}, |
{"motion_search", ®.motion_search, 6}, |
253 |
{"vhq_mode", ®.vhq_mode, 0}, |
{"vhq_mode", ®.vhq_mode, 1}, |
254 |
{"chromame", ®.chromame, 0}, |
{"chromame", ®.chromame, 1}, |
255 |
|
{"cartoon_mode", ®.cartoon_mode, 0}, |
256 |
|
{"turbo", ®.turbo, 0}, |
257 |
{"max_key_interval", ®.max_key_interval, 300}, |
{"max_key_interval", ®.max_key_interval, 300}, |
|
{"min_key_interval", ®.min_key_interval, 1}, |
|
258 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
259 |
|
|
260 |
/* quant */ |
/* quant */ |
261 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 1}, |
262 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
263 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 1}, |
264 |
{"max_pquant", ®.max_pquant, 31}, |
{"max_pquant", ®.max_pquant, 31}, |
265 |
{"min_bquant", ®.min_bquant, 2}, |
{"min_bquant", ®.min_bquant, 1}, |
266 |
{"max_bquant", ®.max_bquant, 31}, |
{"max_bquant", ®.max_bquant, 31}, |
267 |
{"trellis_quant", ®.trellis_quant, 0}, |
{"trellis_quant", ®.trellis_quant, 0}, |
268 |
|
|
271 |
{"debug", ®.debug, 0x0}, |
{"debug", ®.debug, 0x0}, |
272 |
{"vop_debug", ®.vop_debug, 0}, |
{"vop_debug", ®.vop_debug, 0}, |
273 |
{"display_status", ®.display_status, 1}, |
{"display_status", ®.display_status, 1}, |
274 |
|
|
275 |
|
/* decoder, shared with dshow */ |
276 |
|
{"Deblock_Y", &pp_dy, 0}, |
277 |
|
{"Deblock_UV", &pp_duv, 0}, |
278 |
|
{"Dering", &pp_dr, 0}, |
279 |
|
{"FilmEffect", &pp_fe, 0}, |
280 |
|
|
281 |
}; |
}; |
282 |
|
|
283 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
284 |
{"profile", reg.profile_name, "(unrestricted)"}, |
{"profile", reg.profile_name, "AS @ L5"}, |
285 |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
286 |
}; |
}; |
287 |
|
|
324 |
|
|
325 |
#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)));} |
326 |
|
|
327 |
|
#define XVID_DLL_NAME "xvidcore.dll" |
328 |
|
|
329 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
330 |
{ |
{ |
331 |
char tmp[32]; |
char tmp[32]; |
333 |
DWORD size; |
DWORD size; |
334 |
int i,j; |
int i,j; |
335 |
xvid_gbl_info_t info; |
xvid_gbl_info_t info; |
336 |
|
HINSTANCE m_hdll; |
337 |
|
|
338 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
339 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
340 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
341 |
|
m_hdll = LoadLibrary(XVID_DLL_NAME); |
342 |
|
if (m_hdll != NULL) { |
343 |
|
|
344 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
345 |
|
(0, XVID_GBL_INFO, &info, NULL); |
346 |
|
|
347 |
|
FreeLibrary(m_hdll); |
348 |
|
} |
349 |
|
|
350 |
reg.cpu = info.cpu_flags; |
reg.cpu = info.cpu_flags; |
351 |
reg.num_threads = info.num_threads; |
reg.num_threads = info.num_threads; |
352 |
|
|
370 |
|
|
371 |
reg.profile = 0; |
reg.profile = 0; |
372 |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
373 |
if (strcmpi(profiles[i].name, reg.profile_name) == 0) { |
if (lstrcmpi(profiles[i].name, reg.profile_name) == 0) { |
374 |
reg.profile = i; |
reg.profile = i; |
375 |
} |
} |
376 |
} |
} |
464 |
|
|
465 |
/* clear XviD registry key, load defaults */ |
/* clear XviD registry key, load defaults */ |
466 |
|
|
467 |
void config_reg_default(CONFIG * config) |
static void config_reg_default(CONFIG * config) |
468 |
{ |
{ |
469 |
HKEY hKey; |
HKEY hKey; |
470 |
|
|
485 |
|
|
486 |
|
|
487 |
/* leaves current config value if dialog item is empty */ |
/* leaves current config value if dialog item is empty */ |
488 |
int config_get_int(HWND hDlg, INT item, int config) |
static int config_get_int(HWND hDlg, INT item, int config) |
489 |
{ |
{ |
490 |
BOOL success = FALSE; |
BOOL success = FALSE; |
491 |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
493 |
} |
} |
494 |
|
|
495 |
|
|
496 |
int config_get_uint(HWND hDlg, UINT item, int config) |
static int config_get_uint(HWND hDlg, UINT item, int config) |
497 |
{ |
{ |
498 |
BOOL success = FALSE; |
BOOL success = FALSE; |
499 |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
500 |
return (success) ? tmp : config; |
return (success) ? tmp : config; |
501 |
} |
} |
502 |
|
|
503 |
|
/* get uint from combobox |
504 |
|
GetDlgItemInt doesnt work properly for cb list items */ |
505 |
|
#define UINT_BUF_SZ 20 |
506 |
|
static int config_get_cbuint(HWND hDlg, UINT item, int def) |
507 |
|
{ |
508 |
|
int sel = SendMessage(GetDlgItem(hDlg, item), CB_GETCURSEL, 0, 0); |
509 |
|
char buf[UINT_BUF_SZ]; |
510 |
|
|
511 |
|
if (sel<0) { |
512 |
|
return config_get_uint(hDlg, item, def); |
513 |
|
} |
514 |
|
|
515 |
|
if (SendMessage(GetDlgItem(hDlg, item), CB_GETLBTEXT, sel, (LPARAM)buf) == CB_ERR) { |
516 |
|
return def; |
517 |
|
} |
518 |
|
|
519 |
|
return atoi(buf); |
520 |
|
} |
521 |
|
|
522 |
|
|
523 |
/* we use "100 base" floats */ |
/* we use "100 base" floats */ |
524 |
|
|
525 |
#define FLOAT_BUF_SZ 20 |
#define FLOAT_BUF_SZ 20 |
526 |
int get_dlgitem_float(HWND hDlg, UINT item, int def) |
static int get_dlgitem_float(HWND hDlg, UINT item, int def) |
527 |
{ |
{ |
528 |
char buf[FLOAT_BUF_SZ]; |
char buf[FLOAT_BUF_SZ]; |
529 |
|
|
533 |
return (int)(atof(buf)*100); |
return (int)(atof(buf)*100); |
534 |
} |
} |
535 |
|
|
536 |
void set_dlgitem_float(HWND hDlg, UINT item, int value) |
static void set_dlgitem_float(HWND hDlg, UINT item, int value) |
537 |
{ |
{ |
538 |
char buf[FLOAT_BUF_SZ]; |
char buf[FLOAT_BUF_SZ]; |
539 |
sprintf(buf, "%.2f", (float)value/100); |
sprintf(buf, "%.2f", (float)value/100); |
542 |
|
|
543 |
|
|
544 |
#define HEX_BUF_SZ 16 |
#define HEX_BUF_SZ 16 |
545 |
unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def) |
static unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def) |
546 |
{ |
{ |
547 |
char buf[HEX_BUF_SZ]; |
char buf[HEX_BUF_SZ]; |
548 |
unsigned int value; |
unsigned int value; |
557 |
return def; |
return def; |
558 |
} |
} |
559 |
|
|
560 |
void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
static void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
561 |
{ |
{ |
562 |
char buf[HEX_BUF_SZ]; |
char buf[HEX_BUF_SZ]; |
563 |
wsprintf(buf, "0x%x", value); |
wsprintf(buf, "0x%x", value); |
568 |
/* QUANT MATRIX DIALOG ================================================================= */ |
/* QUANT MATRIX DIALOG ================================================================= */ |
569 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
570 |
|
|
571 |
void quant_upload(HWND hDlg, CONFIG* config) |
static void quant_upload(HWND hDlg, CONFIG* config) |
572 |
{ |
{ |
573 |
int i; |
int i; |
574 |
|
|
579 |
} |
} |
580 |
|
|
581 |
|
|
582 |
void quant_download(HWND hDlg, CONFIG* config) |
static void quant_download(HWND hDlg, CONFIG* config) |
583 |
{ |
{ |
584 |
int i; |
int i; |
585 |
|
|
597 |
} |
} |
598 |
|
|
599 |
|
|
600 |
void quant_loadsave(HWND hDlg, CONFIG * config, int save) |
static void quant_loadsave(HWND hDlg, CONFIG * config, int save) |
601 |
{ |
{ |
602 |
char file[MAX_PATH]; |
char file[MAX_PATH]; |
603 |
OPENFILENAME ofn; |
OPENFILENAME ofn; |
656 |
|
|
657 |
/* quantization matrix dialog proc */ |
/* quantization matrix dialog proc */ |
658 |
|
|
659 |
BOOL CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
static BOOL CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
660 |
{ |
{ |
661 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
662 |
|
|
714 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
715 |
|
|
716 |
/* initialise pages */ |
/* initialise pages */ |
717 |
void adv_init(HWND hDlg, int idd, CONFIG * config) |
static void adv_init(HWND hDlg, int idd, CONFIG * config) |
718 |
{ |
{ |
719 |
unsigned int i; |
unsigned int i; |
720 |
|
|
727 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
728 |
break; |
break; |
729 |
|
|
730 |
|
case IDD_AR: |
731 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
732 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
733 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 NTSC"); |
734 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 PAL"); |
735 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 NTSC"); |
736 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Custom..."); |
737 |
|
break; |
738 |
|
|
739 |
case IDD_LEVEL : |
case IDD_LEVEL : |
740 |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
741 |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
742 |
break; |
break; |
743 |
|
|
744 |
|
case IDD_BITRATE : |
745 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-Legacy"); |
746 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-OpenDML"); |
747 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"Matroska"); |
748 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"OGM"); |
749 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"(None)"); |
750 |
|
|
751 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"665600"); |
752 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"716800"); |
753 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"1331200"); |
754 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"1433600"); |
755 |
|
|
756 |
|
for (i=0; i<sizeof(video_fps_list)/sizeof(named_float_t); i++) |
757 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_ADDSTRING, 0, (LPARAM)video_fps_list[i].name); |
758 |
|
|
759 |
|
for (i=0; i<sizeof(audio_type_list)/sizeof(named_int_t); i++) |
760 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_ADDSTRING, 0, (LPARAM)audio_type_list[i].name); |
761 |
|
|
762 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"32"); |
763 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"56"); |
764 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"64"); |
765 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"96"); |
766 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"112"); |
767 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"128"); |
768 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"160"); |
769 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"192"); |
770 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"224"); |
771 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"256"); |
772 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"384"); |
773 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"512"); |
774 |
|
break; |
775 |
|
|
776 |
case IDD_ZONE : |
case IDD_ZONE : |
777 |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
778 |
break; |
break; |
808 |
|
|
809 |
/* enable/disable controls based on encoder-mode or user selection */ |
/* enable/disable controls based on encoder-mode or user selection */ |
810 |
|
|
811 |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
static void adv_mode(HWND hDlg, int idd, CONFIG * config) |
812 |
{ |
{ |
813 |
int profile; |
int profile; |
814 |
int weight_en, quant_en; |
int weight_en, quant_en; |
815 |
int cpu_force; |
int cpu_force; |
816 |
int custom_quant, bvops; |
int custom_quant, bvops; |
817 |
|
int ar_mode, ar_par; |
818 |
|
|
819 |
switch(idd) { |
switch(idd) { |
820 |
case IDD_PROFILE : |
case IDD_PROFILE : |
841 |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
842 |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
843 |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
844 |
|
break; |
845 |
|
|
846 |
|
case IDD_AR: |
847 |
|
ar_mode = IsDlgChecked(hDlg, IDC_PAR); |
848 |
|
EnableDlgWindow(hDlg, IDC_ASPECT_RATIO, ar_mode); |
849 |
|
|
850 |
|
ar_par = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
851 |
|
if (ar_par == 5) { /* custom par */ |
852 |
|
SetDlgItemInt(hDlg, IDC_PARY, config->par_y, FALSE); |
853 |
|
SetDlgItemInt(hDlg, IDC_PARX, config->par_x, FALSE); |
854 |
|
|
855 |
|
EnableDlgWindow(hDlg, IDC_PARX, ar_mode); |
856 |
|
EnableDlgWindow(hDlg, IDC_PARY, ar_mode); |
857 |
|
} else { |
858 |
|
SetDlgItemInt(hDlg, IDC_PARX, PARS[ar_par][0], FALSE); |
859 |
|
SetDlgItemInt(hDlg, IDC_PARY, PARS[ar_par][1], FALSE); |
860 |
|
EnableDlgWindow(hDlg, IDC_PARX, FALSE); |
861 |
|
EnableDlgWindow(hDlg, IDC_PARY, FALSE); |
862 |
|
} |
863 |
|
|
864 |
|
ar_mode = IsDlgChecked(hDlg, IDC_AR); |
865 |
|
|
866 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
867 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
868 |
|
|
869 |
|
EnableDlgWindow(hDlg, IDC_ARX, ar_mode); |
870 |
|
EnableDlgWindow(hDlg, IDC_ARY, ar_mode); |
871 |
|
break; |
872 |
|
|
873 |
case IDD_LEVEL : |
case IDD_LEVEL : |
874 |
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
881 |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
882 |
break; |
break; |
883 |
|
|
884 |
|
case IDD_BITRATE : |
885 |
|
{ |
886 |
|
int ctype = SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_GETCURSEL, 0, 0); |
887 |
|
int target_size = config_get_cbuint(hDlg, IDC_BITRATE_TSIZE, 0); |
888 |
|
int subtitle_size = config_get_uint(hDlg, IDC_BITRATE_SSIZE, 0); |
889 |
|
int fps = SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_GETCURSEL, 0, 0); |
890 |
|
|
891 |
|
int duration = |
892 |
|
3600 * config_get_uint(hDlg, IDC_BITRATE_HOURS, 0) + |
893 |
|
60 * config_get_uint(hDlg, IDC_BITRATE_MINUTES, 0) + |
894 |
|
config_get_uint(hDlg, IDC_BITRATE_SECONDS, 0); |
895 |
|
|
896 |
|
int audio_type = SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_GETCURSEL, 0, 0); |
897 |
|
int audio_mode = IsDlgChecked(hDlg, IDC_BITRATE_AMODE_SIZE); |
898 |
|
int audio_rate = config_get_cbuint(hDlg, IDC_BITRATE_ARATE, 0); |
899 |
|
int audio_size = config_get_uint(hDlg, IDC_BITRATE_ASIZE, 0); |
900 |
|
|
901 |
|
int frames; |
902 |
|
int overhead; |
903 |
|
int vsize; |
904 |
|
|
905 |
|
if (duration == 0) |
906 |
|
break; |
907 |
|
|
908 |
|
if (fps < 0 || fps >= sizeof(video_fps_list)/sizeof(named_float_t)) { |
909 |
|
fps = 0; |
910 |
|
} |
911 |
|
if (audio_type < 0 || audio_type >= sizeof(audio_type_list)/sizeof(named_int_t)) { |
912 |
|
audio_type = 0; |
913 |
|
} |
914 |
|
|
915 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_RATE, audio_type!=NO_AUDIO); |
916 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_SIZE, audio_type!=NO_AUDIO); |
917 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ARATE, audio_type!=NO_AUDIO && !audio_mode); |
918 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ASIZE, audio_type!=NO_AUDIO && audio_mode); |
919 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ASELECT, audio_type!=NO_AUDIO && audio_mode); |
920 |
|
|
921 |
|
/* step 1: calculate number of frames */ |
922 |
|
frames = (int)(duration * video_fps_list[fps].value); |
923 |
|
|
924 |
|
/* step 2: calculate audio_size (kbytes)*/ |
925 |
|
if (audio_type!=NO_AUDIO) { |
926 |
|
if (audio_mode==0) { |
927 |
|
audio_size = (duration * audio_rate) / 8; |
928 |
|
} |
929 |
|
}else{ |
930 |
|
audio_size = 0; |
931 |
|
} |
932 |
|
|
933 |
|
/* step 3: calculate container overhead */ |
934 |
|
|
935 |
|
switch(ctype) { |
936 |
|
case 0 : /* AVI */ |
937 |
|
case 1 : /* AVI-OpenDML */ |
938 |
|
|
939 |
|
overhead = frames; |
940 |
|
|
941 |
|
if (audio_type!=NO_AUDIO) { |
942 |
|
overhead += (duration * 1000) / audio_type_list[audio_type].avi_interval; |
943 |
|
} |
944 |
|
|
945 |
|
overhead *= (ctype==0) ? 24 : 16; |
946 |
|
|
947 |
|
overhead /= 1024; |
948 |
|
break; |
949 |
|
|
950 |
|
case 2 : /* Matroska: gknot formula */ |
951 |
|
|
952 |
|
/* common overhead */ |
953 |
|
overhead = 40 + 12 + 8+ 16*duration + 200 + 100*1/*one audio stream*/ + 11*duration; |
954 |
|
|
955 |
|
/* video overhead */ |
956 |
|
overhead += frames*8 + (int)(frames * 4 * 0.94); |
957 |
|
|
958 |
|
/* cue tables and menu seek entries (300k default) */ |
959 |
|
overhead += 300 * 1024; |
960 |
|
|
961 |
|
/* audio */ |
962 |
|
overhead += (int)(duration * audio_type_list[audio_type].mkv_multiplier); |
963 |
|
|
964 |
|
overhead /= 1024; |
965 |
|
break; |
966 |
|
|
967 |
|
case 3 : /* OGM: inaccurate model */ |
968 |
|
overhead = (int)(0.0039F * (target_size - subtitle_size)); |
969 |
|
break; |
970 |
|
|
971 |
|
default : /* (none) */ |
972 |
|
overhead = 0; |
973 |
|
break; |
974 |
|
} |
975 |
|
|
976 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_COVERHEAD, overhead, TRUE); |
977 |
|
|
978 |
|
/* final video bitstream size */ |
979 |
|
vsize = target_size - subtitle_size - audio_size - overhead; |
980 |
|
if (vsize > 0) { |
981 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_VSIZE, vsize, TRUE); |
982 |
|
/* convert from kbytes to kbits-per-second */ |
983 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_VRATE, (vsize * 8 * 128) / (duration * 125), TRUE); |
984 |
|
}else{ |
985 |
|
SetDlgItemText(hDlg, IDC_BITRATE_VSIZE, "Overflow"); |
986 |
|
SetDlgItemText(hDlg, IDC_BITRATE_VRATE, "Overflow"); |
987 |
|
} |
988 |
|
|
989 |
|
} |
990 |
|
break; |
991 |
|
|
992 |
case IDD_ZONE : |
case IDD_ZONE : |
993 |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
994 |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
1027 |
|
|
1028 |
|
|
1029 |
/* upload config data into dialog */ |
/* upload config data into dialog */ |
1030 |
void adv_upload(HWND hDlg, int idd, CONFIG * config) |
static void adv_upload(HWND hDlg, int idd, CONFIG * config) |
1031 |
{ |
{ |
1032 |
switch (idd) |
switch (idd) |
1033 |
{ |
{ |
1047 |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
1048 |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
1049 |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
1050 |
|
|
1051 |
|
break; |
1052 |
|
case IDD_AR: |
1053 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, config->ar_mode == 0 ? IDC_PAR : IDC_AR); |
1054 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, (config->display_aspect_ratio), 0); |
1055 |
|
SetDlgItemInt(hDlg, IDC_ARX, config->ar_x, FALSE); |
1056 |
|
SetDlgItemInt(hDlg, IDC_ARY, config->ar_y, FALSE); |
1057 |
break; |
break; |
1058 |
|
|
1059 |
case IDD_LEVEL : |
case IDD_LEVEL : |
1069 |
case IDD_RC_2PASS1 : |
case IDD_RC_2PASS1 : |
1070 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
1071 |
CheckDlg(hDlg, IDC_DISCARD1PASS, config->discard1pass); |
CheckDlg(hDlg, IDC_DISCARD1PASS, config->discard1pass); |
1072 |
|
CheckDlg(hDlg, IDC_FULL1PASS, config->full1pass); |
1073 |
break; |
break; |
1074 |
|
|
1075 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
1076 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
1077 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
|
1078 |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
1079 |
|
|
1080 |
|
SetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, config->overflow_control_strength, FALSE); |
1081 |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
1082 |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
1083 |
|
|
1084 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
1085 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
1086 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->kfthreshold, FALSE); |
1087 |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == XVID_PAYBACK_BIAS)); |
break; |
1088 |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == XVID_PAYBACK_PROP)); |
|
1089 |
|
case IDD_BITRATE : |
1090 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_SETCURSEL, config->container_type, 0); |
1091 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_TSIZE, config->target_size, FALSE); |
1092 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_SSIZE, config->subtitle_size, FALSE); |
1093 |
|
|
1094 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_HOURS, config->hours, FALSE); |
1095 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_MINUTES, config->minutes, FALSE); |
1096 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_SECONDS, config->seconds, FALSE); |
1097 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_SETCURSEL, config->fps, 0); |
1098 |
|
|
1099 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_SETCURSEL, config->audio_type, 0); |
1100 |
|
CheckRadioButton(hDlg, IDC_BITRATE_AMODE_RATE, IDC_BITRATE_AMODE_SIZE, config->audio_mode == 0 ? IDC_BITRATE_AMODE_RATE : IDC_BITRATE_AMODE_SIZE); |
1101 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ARATE, config->audio_rate, FALSE); |
1102 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ASIZE, config->audio_size, FALSE); |
1103 |
break; |
break; |
1104 |
|
|
1105 |
case IDD_ZONE : |
case IDD_ZONE : |
1122 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
1123 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
1124 |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
1125 |
|
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
1126 |
|
CheckDlg(hDlg, IDC_TURBO, config->turbo); |
1127 |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
1128 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
|
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
|
1129 |
break; |
break; |
1130 |
|
|
1131 |
case IDD_QUANT : |
case IDD_QUANT : |
1156 |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
1157 |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
1158 |
break; |
break; |
1159 |
|
|
1160 |
|
case IDD_DEC : |
1161 |
|
CheckDlg(hDlg, IDC_DEC_DY, pp_dy); |
1162 |
|
CheckDlg(hDlg, IDC_DEC_DUV, pp_duv); |
1163 |
|
CheckDlg(hDlg, IDC_DEC_DR, pp_dr); |
1164 |
|
CheckDlg(hDlg, IDC_DEC_FE, pp_fe); |
1165 |
|
break; |
1166 |
} |
} |
1167 |
} |
} |
1168 |
|
|
1169 |
|
|
1170 |
/* download config data from dialog */ |
/* download config data from dialog */ |
1171 |
|
|
1172 |
void adv_download(HWND hDlg, int idd, CONFIG * config) |
static void adv_download(HWND hDlg, int idd, CONFIG * config) |
1173 |
{ |
{ |
1174 |
switch (idd) |
switch (idd) |
1175 |
{ |
{ |
1191 |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
1192 |
break; |
break; |
1193 |
|
|
1194 |
|
case IDD_AR: |
1195 |
|
config->ar_mode = IsDlgChecked(hDlg, IDC_PAR) ? 0:1; |
1196 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
1197 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
1198 |
|
config->display_aspect_ratio = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
1199 |
|
if (config->display_aspect_ratio == 5) { |
1200 |
|
config->par_x = config_get_uint(hDlg, IDC_PARX, config->par_x); |
1201 |
|
config->par_y = config_get_uint(hDlg, IDC_PARY, config->par_y); |
1202 |
|
} |
1203 |
|
break; |
1204 |
|
|
1205 |
case IDD_LEVEL : |
case IDD_LEVEL : |
1206 |
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
1207 |
break; |
break; |
1216 |
if (GetDlgItemText(hDlg, IDC_STATS, config->stats, MAX_PATH) == 0) |
if (GetDlgItemText(hDlg, IDC_STATS, config->stats, MAX_PATH) == 0) |
1217 |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
1218 |
config->discard1pass = IsDlgChecked(hDlg, IDC_DISCARD1PASS); |
config->discard1pass = IsDlgChecked(hDlg, IDC_DISCARD1PASS); |
1219 |
|
config->full1pass = IsDlgChecked(hDlg, IDC_FULL1PASS); |
1220 |
break; |
break; |
1221 |
|
|
1222 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
1224 |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
1225 |
|
|
1226 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
|
1227 |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
1228 |
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
1229 |
|
|
1230 |
|
config->overflow_control_strength = GetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, NULL, FALSE); |
1231 |
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
1232 |
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
1233 |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
1234 |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
1235 |
|
CONSTRAINVAL(config->overflow_control_strength, 0, 100); |
1236 |
|
|
1237 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
1238 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
|
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
|
|
config->bitrate_payback_method = IsDlgChecked(hDlg, IDC_PAYBACKPROP) ? XVID_PAYBACK_PROP : XVID_PAYBACK_BIAS; |
|
|
|
|
|
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
|
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
|
1239 |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
1240 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
1241 |
|
|
1242 |
|
config->kfthreshold = config_get_uint(hDlg, IDC_MINKEY, config->kfthreshold); |
1243 |
|
|
1244 |
|
break; |
1245 |
|
|
1246 |
|
case IDD_BITRATE : |
1247 |
|
config->container_type = SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_GETCURSEL, 0, 0); |
1248 |
|
config->target_size = config_get_uint(hDlg, IDC_BITRATE_TSIZE, config->target_size); |
1249 |
|
config->subtitle_size = config_get_uint(hDlg, IDC_BITRATE_SSIZE, config->subtitle_size); |
1250 |
|
|
1251 |
|
config->hours = config_get_uint(hDlg, IDC_BITRATE_HOURS, config->hours); |
1252 |
|
config->minutes = config_get_uint(hDlg, IDC_BITRATE_MINUTES, config->minutes); |
1253 |
|
config->seconds = config_get_uint(hDlg, IDC_BITRATE_SECONDS, config->seconds); |
1254 |
|
config->fps = SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_GETCURSEL, 0, 0); |
1255 |
|
|
1256 |
|
config->audio_type = SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_GETCURSEL, 0, 0); |
1257 |
|
config->audio_mode = IsDlgChecked(hDlg, IDC_BITRATE_AMODE_SIZE) ? 1 : 0 ; |
1258 |
|
config->audio_rate = config_get_uint(hDlg, IDC_BITRATE_ARATE, config->audio_rate); |
1259 |
|
config->audio_size = config_get_uint(hDlg, IDC_BITRATE_ASIZE, config->audio_size); |
1260 |
|
|
1261 |
|
/* the main window uses "AVI bitrate/filesize" not "video bitrate/filesize", |
1262 |
|
so we have to compensate by frames * 24 bytes */ |
1263 |
|
{ |
1264 |
|
int frame_compensate = 24 * (int)( |
1265 |
|
(3600*config->hours + |
1266 |
|
60*config->minutes + |
1267 |
|
config->seconds) * video_fps_list[config->fps].value) / 1024; |
1268 |
|
|
1269 |
|
int bitrate_compensate = (int)(24 * video_fps_list[config->fps].value) / 125; |
1270 |
|
|
1271 |
|
config->desired_size = |
1272 |
|
config_get_uint(hDlg, IDC_BITRATE_VSIZE, config->desired_size) - frame_compensate; |
1273 |
|
|
1274 |
|
config->bitrate = |
1275 |
|
config_get_uint(hDlg, IDC_BITRATE_VRATE, config->bitrate) - bitrate_compensate; |
1276 |
|
} |
1277 |
break; |
break; |
1278 |
|
|
1279 |
case IDD_ZONE : |
case IDD_ZONE : |
1299 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
1300 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
1301 |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
1302 |
|
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
1303 |
|
config->turbo = IsDlgChecked(hDlg, IDC_TURBO); |
1304 |
|
|
1305 |
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
1306 |
|
|
1307 |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
|
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
|
1308 |
break; |
break; |
1309 |
|
|
1310 |
case IDD_QUANT : |
case IDD_QUANT : |
1342 |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1343 |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1344 |
break; |
break; |
1345 |
|
|
1346 |
|
case IDD_DEC : |
1347 |
|
pp_dy = IsDlgChecked(hDlg, IDC_DEC_DY); |
1348 |
|
pp_duv = IsDlgChecked(hDlg, IDC_DEC_DUV); |
1349 |
|
pp_dr = IsDlgChecked(hDlg, IDC_DEC_DR); |
1350 |
|
pp_fe = IsDlgChecked(hDlg, IDC_DEC_FE); |
1351 |
|
break; |
1352 |
} |
} |
1353 |
} |
} |
1354 |
|
|
1356 |
|
|
1357 |
/* advanced dialog proc */ |
/* advanced dialog proc */ |
1358 |
|
|
1359 |
BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
static BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1360 |
{ |
{ |
1361 |
PROPSHEETINFO *psi; |
PROPSHEETINFO *psi; |
1362 |
|
|
1385 |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
1386 |
case IDC_CPU_AUTO : |
case IDC_CPU_AUTO : |
1387 |
case IDC_CPU_FORCE : |
case IDC_CPU_FORCE : |
1388 |
|
case IDC_AR : |
1389 |
|
case IDC_PAR : |
1390 |
|
case IDC_BITRATE_AMODE_RATE : |
1391 |
|
case IDC_BITRATE_AMODE_SIZE : |
1392 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1393 |
break; |
break; |
1394 |
|
|
1395 |
|
case IDC_BITRATE_SSELECT : |
1396 |
|
case IDC_BITRATE_ASELECT : |
1397 |
|
{ |
1398 |
|
OPENFILENAME ofn; |
1399 |
|
char filename[MAX_PATH] = ""; |
1400 |
|
|
1401 |
|
memset(&ofn, 0, sizeof(OPENFILENAME)); |
1402 |
|
ofn.lStructSize = sizeof(OPENFILENAME); |
1403 |
|
|
1404 |
|
ofn.hwndOwner = hDlg; |
1405 |
|
if (LOWORD(wParam)==IDC_BITRATE_SSELECT) { |
1406 |
|
ofn.lpstrFilter = "Subtitle files (*.sub, *.ssa)\0*.sub;*.ssa\0All files (*.*)\0*.*\0\0"; |
1407 |
|
}else{ |
1408 |
|
ofn.lpstrFilter = "Audio files (*.mp3, *.ac3)\0*.mp3; *.ac3\0All files (*.*)\0*.*\0\0"; |
1409 |
|
} |
1410 |
|
|
1411 |
|
ofn.lpstrFile = filename; |
1412 |
|
ofn.nMaxFile = MAX_PATH; |
1413 |
|
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; |
1414 |
|
|
1415 |
|
if (GetOpenFileName(&ofn)) { |
1416 |
|
HANDLE hFile; |
1417 |
|
DWORD filesize; |
1418 |
|
|
1419 |
|
if ((hFile = CreateFile(filename, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) == INVALID_HANDLE_VALUE || |
1420 |
|
(filesize = GetFileSize(hFile, NULL)) == INVALID_FILE_SIZE) { |
1421 |
|
MessageBox(hDlg, "Could not get file size", "Error", 0); |
1422 |
|
}else{ |
1423 |
|
SetDlgItemInt(hDlg, |
1424 |
|
LOWORD(wParam)==IDC_BITRATE_SSELECT? IDC_BITRATE_SSIZE : IDC_BITRATE_ASIZE, |
1425 |
|
filesize / 1024, FALSE); |
1426 |
|
CloseHandle(hFile); |
1427 |
|
} |
1428 |
|
} |
1429 |
|
} |
1430 |
|
break; |
1431 |
|
|
1432 |
case IDC_QUANTMATRIX : |
case IDC_QUANTMATRIX : |
1433 |
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
1434 |
break; |
break; |
1444 |
ofn.lStructSize = sizeof(OPENFILENAME); |
ofn.lStructSize = sizeof(OPENFILENAME); |
1445 |
|
|
1446 |
ofn.hwndOwner = hDlg; |
ofn.hwndOwner = hDlg; |
1447 |
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
ofn.lpstrFilter = "bitrate curve (*.pass)\0*.pass\0All files (*.*)\0*.*\0\0"; |
1448 |
ofn.lpstrFile = tmp; |
ofn.lpstrFile = tmp; |
1449 |
ofn.nMaxFile = MAX_PATH; |
ofn.nMaxFile = MAX_PATH; |
1450 |
ofn.Flags = OFN_PATHMUSTEXIST; |
ofn.Flags = OFN_PATHMUSTEXIST; |
1455 |
ofn.Flags |= OFN_FILEMUSTEXIST; |
ofn.Flags |= OFN_FILEMUSTEXIST; |
1456 |
} |
} |
1457 |
|
|
1458 |
if (GetSaveFileName(&ofn)) |
if ((psi->idd==IDD_RC_2PASS1 && GetSaveFileName(&ofn)) || |
1459 |
{ |
(psi->idd==IDD_RC_2PASS2 && GetOpenFileName(&ofn))) { |
1460 |
SetDlgItemText(hDlg, IDC_STATS, tmp); |
SetDlgItemText(hDlg, IDC_STATS, tmp); |
1461 |
} |
} |
1462 |
} |
} |
1463 |
|
break; |
1464 |
|
|
1465 |
case IDC_ZONE_FETCH : |
case IDC_ZONE_FETCH : |
1466 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
1467 |
break; |
break; |
1468 |
|
|
1469 |
|
case IDC_AR_DEFAULT: |
1470 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_PAR); |
1471 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, 0, 0); |
1472 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1473 |
|
break; |
1474 |
|
case IDC_AR_4_3: |
1475 |
|
SetDlgItemInt(hDlg, IDC_ARX, 4, FALSE); |
1476 |
|
SetDlgItemInt(hDlg, IDC_ARY, 3, FALSE); |
1477 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1478 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1479 |
|
break; |
1480 |
|
case IDC_AR_16_9: |
1481 |
|
SetDlgItemInt(hDlg, IDC_ARX, 16, FALSE); |
1482 |
|
SetDlgItemInt(hDlg, IDC_ARY, 9, FALSE); |
1483 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1484 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1485 |
|
break; |
1486 |
|
case IDC_AR_235_100: |
1487 |
|
SetDlgItemInt(hDlg, IDC_ARX, 235, FALSE); |
1488 |
|
SetDlgItemInt(hDlg, IDC_ARY, 100, FALSE); |
1489 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1490 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1491 |
|
break; |
1492 |
|
|
1493 |
default : |
default : |
1494 |
return TRUE; |
return TRUE; |
1495 |
} |
} |
1496 |
|
}else if ((HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam)==CBN_SELCHANGE) && |
1497 |
|
(LOWORD(wParam)==IDC_BITRATE_TSIZE || |
1498 |
|
LOWORD(wParam)==IDC_BITRATE_ARATE )) { |
1499 |
|
|
1500 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1501 |
|
|
1502 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1503 |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
1504 |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
1505 |
LOWORD(wParam) == IDC_QUANTTYPE)) |
LOWORD(wParam) == IDC_QUANTTYPE || |
1506 |
{ |
LOWORD(wParam) == IDC_ASPECT_RATIO || |
1507 |
|
LOWORD(wParam) == IDC_BITRATE_CFORMAT || |
1508 |
|
LOWORD(wParam) == IDC_BITRATE_AFORMAT || |
1509 |
|
LOWORD(wParam) == IDC_BITRATE_FPS)) { |
1510 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1511 |
}else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_ZONE_WEIGHT || LOWORD(wParam)==IDC_ZONE_QUANT)) { |
}else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_ZONE_WEIGHT || LOWORD(wParam)==IDC_ZONE_QUANT)) { |
1512 |
|
|
1513 |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
1514 |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
1515 |
}else { |
|
1516 |
|
} else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_PARX || LOWORD(wParam)==IDC_PARY)) { |
1517 |
|
|
1518 |
|
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
1519 |
|
if(LOWORD(wParam)==IDC_PARX) |
1520 |
|
psi->config->par_x = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_x); |
1521 |
|
else |
1522 |
|
psi->config->par_y = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_y); |
1523 |
|
} |
1524 |
|
} else if (HIWORD(wParam) == EN_UPDATE && |
1525 |
|
(LOWORD(wParam)==IDC_BITRATE_SSIZE || |
1526 |
|
LOWORD(wParam)==IDC_BITRATE_HOURS || |
1527 |
|
LOWORD(wParam)==IDC_BITRATE_MINUTES || |
1528 |
|
LOWORD(wParam)==IDC_BITRATE_SECONDS || |
1529 |
|
LOWORD(wParam)==IDC_BITRATE_ASIZE)) { |
1530 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1531 |
|
} else |
1532 |
return 0; |
return 0; |
|
} |
|
1533 |
break; |
break; |
1534 |
|
|
1535 |
case WM_HSCROLL : |
case WM_HSCROLL : |
1545 |
switch (((NMHDR *)lParam)->code) |
switch (((NMHDR *)lParam)->code) |
1546 |
{ |
{ |
1547 |
case PSN_SETACTIVE : |
case PSN_SETACTIVE : |
1548 |
OutputDebugString("PSN_SET"); |
DPRINTF("PSN_SET"); |
1549 |
adv_upload(hDlg, psi->idd, psi->config); |
adv_upload(hDlg, psi->idd, psi->config); |
1550 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1551 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1552 |
break; |
break; |
1553 |
|
|
1554 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1555 |
OutputDebugString("PSN_KILL"); |
DPRINTF("PSN_KILL"); |
1556 |
adv_download(hDlg, psi->idd, psi->config); |
adv_download(hDlg, psi->idd, psi->config); |
1557 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1558 |
break; |
break; |
1559 |
|
|
1560 |
case PSN_APPLY : |
case PSN_APPLY : |
1561 |
OutputDebugString("PSN_APPLY"); |
DPRINTF("PSN_APPLY"); |
1562 |
psi->config->save = TRUE; |
psi->config->save = TRUE; |
1563 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1564 |
break; |
break; |
1580 |
or fasle if changes were canceled. |
or fasle if changes were canceled. |
1581 |
|
|
1582 |
*/ |
*/ |
1583 |
BOOL adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) |
|
1584 |
|
#ifndef PSH_NOCONTEXTHELP |
1585 |
|
#define PSH_NOCONTEXTHELP 0x02000000 |
1586 |
|
#endif |
1587 |
|
|
1588 |
|
static BOOL adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) |
1589 |
{ |
{ |
1590 |
PROPSHEETINFO psi[6]; |
PROPSHEETINFO psi[6]; |
1591 |
PROPSHEETPAGE psp[6]; |
PROPSHEETPAGE psp[6]; |
1611 |
} |
} |
1612 |
|
|
1613 |
psh.dwSize = sizeof(PROPSHEETHEADER); |
psh.dwSize = sizeof(PROPSHEETHEADER); |
1614 |
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP; |
1615 |
psh.hwndParent = hParent; |
psh.hwndParent = hParent; |
1616 |
psh.hInstance = g_hInst; |
psh.hInstance = g_hInst; |
1617 |
psh.pszCaption = (LPSTR) "XviD Configuration"; |
psh.pszCaption = (LPSTR) "XviD Configuration"; |
1632 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
1633 |
|
|
1634 |
|
|
1635 |
void main_insert_zone(HWND hDlg, zone_t * s, int i, BOOL insert) |
static void main_insert_zone(HWND hDlg, zone_t * s, int i, BOOL insert) |
1636 |
{ |
{ |
1637 |
char tmp[32]; |
char tmp[32]; |
1638 |
|
|
1655 |
} |
} |
1656 |
|
|
1657 |
if (s->mode == RC_ZONE_WEIGHT) { |
if (s->mode == RC_ZONE_WEIGHT) { |
1658 |
sprintf(tmp,"%.2f",(float)s->weight/100); |
sprintf(tmp,"W %.2f",(float)s->weight/100); |
1659 |
}else if (s->mode == RC_ZONE_QUANT) { |
}else if (s->mode == RC_ZONE_QUANT) { |
1660 |
sprintf(tmp,"( %.2f )",(float)s->quant/100); |
sprintf(tmp,"Q %.2f",(float)s->quant/100); |
1661 |
}else { |
}else { |
1662 |
strcpy(tmp,"EXT"); |
strcpy(tmp,"EXT"); |
1663 |
} |
} |
1676 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1677 |
} |
} |
1678 |
|
|
|
static int g_use_bitrate = 1; |
|
1679 |
|
|
1680 |
void main_mode(HWND hDlg, CONFIG * config) |
static void main_mode(HWND hDlg, CONFIG * config) |
1681 |
{ |
{ |
1682 |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1683 |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1684 |
/* enable target rate/size control only for 1pass and 2pass modes*/ |
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1685 |
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1686 |
|
const int target_en_slider = rc_mode==RC_MODE_1PASS || |
1687 |
|
(rc_mode==RC_MODE_2PASS2 && config->use_2pass_bitrate); |
1688 |
|
|
1689 |
char buf[16]; |
char buf[16]; |
1690 |
int max; |
int max; |
1691 |
|
|
1692 |
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
g_use_bitrate = config->use_2pass_bitrate; |
1693 |
|
|
1694 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1695 |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1706 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1707 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1708 |
|
|
1709 |
}else{ |
} else if (rc_mode==RC_MODE_2PASS2) { |
1710 |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1711 |
|
} else if (rc_mode==RC_MODE_1PASS) { |
1712 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target quantizer:"); |
1713 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(100, 3100)); |
1714 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1715 |
|
get_dlgitem_float(hDlg, IDC_BITRATE, DEFAULT_QUANT )); |
1716 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MIN, "1 (maximum quality)"); |
1717 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MAX, "(smallest file) 31"); |
1718 |
|
|
1719 |
} |
} |
1720 |
|
|
1721 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1722 |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1723 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ADV, target_en); |
1724 |
|
|
1725 |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en_slider); |
1726 |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en_slider); |
1727 |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en_slider); |
1728 |
} |
} |
1729 |
|
|
1730 |
|
|
1731 |
|
static void main_upload(HWND hDlg, CONFIG * config) |
|
void main_upload(HWND hDlg, CONFIG * config) |
|
1732 |
{ |
{ |
|
int i; |
|
1733 |
|
|
1734 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1735 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1736 |
|
|
1737 |
|
g_use_bitrate = config->use_2pass_bitrate; |
1738 |
|
|
1739 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1740 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1741 |
}else{ |
} else if (config->mode == RC_MODE_2PASS2) { |
1742 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1743 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1744 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1745 |
} |
} |
1746 |
|
|
1747 |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
zones_update(hDlg, config); |
|
for (i=0; i < config->num_zones; i++) { |
|
|
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
|
|
} |
|
1748 |
} |
} |
1749 |
|
|
1750 |
|
|
1751 |
/* downloads data from main dialog */ |
/* downloads data from main dialog */ |
1752 |
void main_download(HWND hDlg, CONFIG * config) |
static void main_download(HWND hDlg, CONFIG * config) |
1753 |
{ |
{ |
1754 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1755 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1756 |
|
|
1757 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1758 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1759 |
}else{ |
} else if (config->mode == RC_MODE_2PASS2) { |
1760 |
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1761 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1762 |
|
config->desired_quant = get_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1763 |
} |
} |
1764 |
} |
} |
1765 |
|
|
1766 |
|
|
1767 |
/* main dialog proc */ |
/* main dialog proc */ |
1768 |
|
|
1769 |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL }; |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL, IDD_AR }; |
1770 |
static const int single_dlgs[] = { IDD_RC_CBR }; |
static const int single_dlgs[] = { IDD_RC_CBR }; |
1771 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1772 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1773 |
|
static const int bitrate_dlgs[] = { IDD_BITRATE }; |
1774 |
static const int zone_dlgs[] = { IDD_ZONE }; |
static const int zone_dlgs[] = { IDD_ZONE }; |
1775 |
static const int bitrate_dlgs[] = { IDD_CALC }; |
static const int decoder_dlgs[] = { IDD_DEC }; |
1776 |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1777 |
|
|
1778 |
|
|
1826 |
|
|
1827 |
const static char_int_t columns[] = { |
const static char_int_t columns[] = { |
1828 |
{"Frame #", 64}, |
{"Frame #", 64}, |
1829 |
{"Weight (Q)", 72}, |
{"Weight/Quant", 82}, |
1830 |
{"Modifiers", 120}}; |
{"Modifiers", 120}}; |
1831 |
|
|
1832 |
LVCOLUMN lvc; |
LVCOLUMN lvc; |
1855 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1856 |
{ |
{ |
1857 |
NMHDR * n = (NMHDR*)lParam; |
NMHDR * n = (NMHDR*)lParam; |
|
int idc = (int)wParam; |
|
1858 |
|
|
1859 |
if (n->code == NM_DBLCLK) { |
if (n->code == NM_DBLCLK) { |
1860 |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
1862 |
|
|
1863 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1864 |
if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1865 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1866 |
} |
} |
1867 |
break; |
break; |
1868 |
} |
} |
1869 |
|
|
|
if (n->code == NM_RCLICK) { |
|
|
OutputDebugString("Right click"); |
|
|
} |
|
1870 |
break; |
break; |
1871 |
} |
} |
1872 |
|
|
1893 |
} |
} |
1894 |
break; |
break; |
1895 |
|
|
|
|
|
1896 |
case IDC_BITRATE_S : |
case IDC_BITRATE_S : |
1897 |
/* alternate between bitrate/desired_length metrics */ |
/* alternate between bitrate/desired_length metrics */ |
1898 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1901 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1902 |
break; |
break; |
1903 |
|
|
1904 |
case IDC_BITRATE_CALC : |
case IDC_BITRATE_ADV : |
1905 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1906 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1907 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
main_mode(hDlg, config); |
1908 |
|
main_upload(hDlg, config); |
1909 |
|
break; |
1910 |
|
|
1911 |
|
case IDC_DECODER : |
1912 |
|
main_download(hDlg, config); |
1913 |
|
adv_dialog(hDlg, config, decoder_dlgs, sizeof(decoder_dlgs)/sizeof(int)); |
1914 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1915 |
break; |
break; |
1916 |
|
|
1952 |
config->zones[sel+1].bvop_threshold = 0; |
config->zones[sel+1].bvop_threshold = 0; |
1953 |
|
|
1954 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
1955 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[sel+1], sel+1, TRUE); |
zones_update(hDlg, config); |
1956 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
1957 |
break; |
break; |
1958 |
} |
} |
1962 |
int i, sel; |
int i, sel; |
1963 |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1964 |
|
|
1965 |
if (sel == -1) { |
if (sel == -1 || config->num_zones < 1) { |
1966 |
MessageBox(hDlg, "Nothing selected", "Warning", 0); |
/*MessageBox(hDlg, "Nothing selected", "Warning", 0);*/ |
1967 |
break; |
break; |
1968 |
} |
} |
1969 |
|
|
1970 |
for (i=sel; i<config->num_zones-1; i++) { |
for (i=sel; i<config->num_zones-1; i++) |
1971 |
config->zones[i] = config->zones[i+1]; |
config->zones[i] = config->zones[i+1]; |
1972 |
} |
|
1973 |
config->num_zones--; |
config->num_zones--; |
|
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
|
1974 |
|
|
1975 |
sel--; |
zones_update(hDlg, config); |
|
if (sel==0 && config->num_zones>1) { |
|
|
sel=1; |
|
|
} |
|
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
|
1976 |
break; |
break; |
1977 |
} |
} |
1978 |
|
|
1980 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1981 |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1982 |
if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1983 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1984 |
} |
} |
1985 |
break; |
break; |
1986 |
|
|
1991 |
|
|
1992 |
case IDC_DEFAULTS : |
case IDC_DEFAULTS : |
1993 |
config_reg_default(config); |
config_reg_default(config); |
1994 |
|
main_mode(hDlg, config); |
1995 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1996 |
break; |
break; |
1997 |
|
|
2009 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
2010 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
2011 |
|
|
2012 |
main_download(hDlg, config); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
2013 |
|
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
2014 |
|
|
2015 |
|
if (!g_use_bitrate) { |
2016 |
|
if (config->mode == RC_MODE_1PASS) |
2017 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
2018 |
|
else if (config->mode == RC_MODE_2PASS2) |
2019 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
2020 |
|
} |
2021 |
|
|
2022 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
2023 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
2024 |
|
|
2027 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
2028 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
2029 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
2030 |
|
} else if (config->mode == RC_MODE_1PASS) { |
2031 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
2032 |
|
get_dlgitem_float(hDlg, IDC_BITRATE, DEFAULT_QUANT) ); |
2033 |
} |
} |
2034 |
|
main_download(hDlg, config); |
2035 |
|
|
2036 |
}else { |
}else { |
2037 |
return 0; |
return 0; |
2040 |
|
|
2041 |
case WM_HSCROLL : |
case WM_HSCROLL : |
2042 |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
2043 |
|
if (g_use_bitrate) |
2044 |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
2045 |
|
else |
2046 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0)); |
2047 |
|
|
2048 |
|
main_download(hDlg, config); |
2049 |
break; |
break; |
2050 |
} |
} |
2051 |
return 0; |
return 0; |
2073 |
char core[100]; |
char core[100]; |
2074 |
HFONT hFont; |
HFONT hFont; |
2075 |
LOGFONT lfData; |
LOGFONT lfData; |
2076 |
|
HINSTANCE m_hdll; |
2077 |
|
|
2078 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
2079 |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
2080 |
|
|
2081 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
2082 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
2083 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
2084 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
2085 |
XVID_MAJOR(info.actual_version), |
if (m_hdll != NULL) { |
2086 |
XVID_MINOR(info.actual_version), |
|
2087 |
XVID_PATCH(info.actual_version), |
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
2088 |
|
(0, XVID_GBL_INFO, &info, NULL); |
2089 |
|
|
2090 |
|
wsprintf(core, "xvidcore.dll version %d.%d.%d (\"%s\")", |
2091 |
|
XVID_VERSION_MAJOR(info.actual_version), |
2092 |
|
XVID_VERSION_MINOR(info.actual_version), |
2093 |
|
XVID_VERSION_PATCH(info.actual_version), |
2094 |
info.build); |
info.build); |
2095 |
|
|
2096 |
|
FreeLibrary(m_hdll); |
2097 |
|
} else { |
2098 |
|
wsprintf(core, "xvidcore.dll not found!"); |
2099 |
|
} |
2100 |
|
|
2101 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |
2102 |
|
|
2103 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
2115 |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
2116 |
} |
} |
2117 |
break; |
break; |
|
|
|
2118 |
case WM_CTLCOLORSTATIC : |
case WM_CTLCOLORSTATIC : |
2119 |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
2120 |
{ |
{ |
2141 |
|
|
2142 |
return 1; |
return 1; |
2143 |
} |
} |
2144 |
|
|
2145 |
|
|
2146 |
|
void |
2147 |
|
sort_zones(zone_t * zones, int zone_num, int * sel) |
2148 |
|
{ |
2149 |
|
int i, j; |
2150 |
|
zone_t tmp; |
2151 |
|
for (i = 0; i < zone_num; i++) { |
2152 |
|
int cur = i; |
2153 |
|
int min_f = zones[i].frame; |
2154 |
|
for (j = i + 1; j < zone_num; j++) { |
2155 |
|
if (zones[j].frame < min_f) { |
2156 |
|
min_f = zones[j].frame; |
2157 |
|
cur = j; |
2158 |
|
} |
2159 |
|
} |
2160 |
|
if (cur != i) { |
2161 |
|
tmp = zones[i]; |
2162 |
|
zones[i] = zones[cur]; |
2163 |
|
zones[cur] = tmp; |
2164 |
|
if (i == *sel) *sel = cur; |
2165 |
|
else if (cur == *sel) *sel = i; |
2166 |
|
} |
2167 |
|
} |
2168 |
|
} |
2169 |
|
|
2170 |
|
|
2171 |
|
static void |
2172 |
|
zones_update(HWND hDlg, CONFIG * config) |
2173 |
|
{ |
2174 |
|
int i, sel; |
2175 |
|
|
2176 |
|
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
2177 |
|
|
2178 |
|
sort_zones(config->zones, config->num_zones, &sel); |
2179 |
|
|
2180 |
|
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
2181 |
|
|
2182 |
|
for (i = 0; i < config->num_zones; i++) |
2183 |
|
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
2184 |
|
|
2185 |
|
if (sel == -1 && config->num_zones > 0) sel = 0; |
2186 |
|
if (sel >= config->num_zones) sel = config->num_zones-1; |
2187 |
|
|
2188 |
|
config->cur_zone = sel; |
2189 |
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
2190 |
|
} |