73 |
#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) |
74 |
#define EnableDlgWindow(hwnd,idc,state) EnableWindow(GetDlgItem(hwnd,idc),state) |
#define EnableDlgWindow(hwnd,idc,state) EnableWindow(GetDlgItem(hwnd,idc),state) |
75 |
|
|
76 |
|
static void zones_update(HWND hDlg, CONFIG * config); |
77 |
|
|
78 |
HINSTANCE g_hInst; |
HINSTANCE g_hInst; |
79 |
HWND g_hTooltip; |
HWND g_hTooltip; |
80 |
|
|
81 |
|
static int g_use_bitrate = 1; |
82 |
|
int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */ |
83 |
|
|
84 |
/* enumerates child windows, assigns tooltips */ |
/* enumerates child windows, assigns tooltips */ |
85 |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
86 |
{ |
{ |
158 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
159 |
{"desired_size", ®.desired_size, 570000}, |
{"desired_size", ®.desired_size, 570000}, |
160 |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
161 |
|
{"desired_quant", ®.desired_quant, DEFAULT_QUANT}, /* 100-base float */ |
162 |
|
|
163 |
/* profile */ |
/* profile */ |
164 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
194 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
195 |
|
|
196 |
/* 2pass2 */ |
/* 2pass2 */ |
197 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
{"keyframe_boost", ®.keyframe_boost, 10}, |
198 |
{"kfreduction", ®.kfreduction, 20}, |
{"kfreduction", ®.kfreduction, 20}, |
199 |
{"kfthreshold", ®.kfthreshold, 1}, |
{"kfthreshold", ®.kfthreshold, 1}, |
200 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
{"curve_compression_high", ®.curve_compression_high, 0}, |
208 |
{"vhq_mode", ®.vhq_mode, 1}, |
{"vhq_mode", ®.vhq_mode, 1}, |
209 |
{"chromame", ®.chromame, 1}, |
{"chromame", ®.chromame, 1}, |
210 |
{"cartoon_mode", ®.cartoon_mode, 0}, |
{"cartoon_mode", ®.cartoon_mode, 0}, |
211 |
|
{"turbo", ®.turbo, 0}, |
212 |
{"max_key_interval", ®.max_key_interval, 300}, |
{"max_key_interval", ®.max_key_interval, 300}, |
213 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
214 |
|
|
215 |
/* quant */ |
/* quant */ |
216 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 1}, |
217 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
218 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 1}, |
219 |
{"max_pquant", ®.max_pquant, 31}, |
{"max_pquant", ®.max_pquant, 31}, |
220 |
{"min_bquant", ®.min_bquant, 2}, |
{"min_bquant", ®.min_bquant, 1}, |
221 |
{"max_bquant", ®.max_bquant, 31}, |
{"max_bquant", ®.max_bquant, 31}, |
222 |
{"trellis_quant", ®.trellis_quant, 0}, |
{"trellis_quant", ®.trellis_quant, 0}, |
223 |
|
|
226 |
{"debug", ®.debug, 0x0}, |
{"debug", ®.debug, 0x0}, |
227 |
{"vop_debug", ®.vop_debug, 0}, |
{"vop_debug", ®.vop_debug, 0}, |
228 |
{"display_status", ®.display_status, 1}, |
{"display_status", ®.display_status, 1}, |
229 |
|
|
230 |
|
/* decoder, shared with dshow */ |
231 |
|
{"Deblock_Y", &pp_dy, 0}, |
232 |
|
{"Deblock_UV", &pp_duv, 0}, |
233 |
|
{"Dering", &pp_dr, 0}, |
234 |
|
{"FilmEffect", &pp_fe, 0}, |
235 |
|
|
236 |
}; |
}; |
237 |
|
|
238 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
239 |
{"profile", reg.profile_name, "(unrestricted)"}, |
{"profile", reg.profile_name, "AS @ L5"}, |
240 |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
241 |
}; |
}; |
242 |
|
|
279 |
|
|
280 |
#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)));} |
281 |
|
|
282 |
|
#define XVID_DLL_NAME "xvidcore.dll" |
283 |
|
|
284 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
285 |
{ |
{ |
286 |
char tmp[32]; |
char tmp[32]; |
288 |
DWORD size; |
DWORD size; |
289 |
int i,j; |
int i,j; |
290 |
xvid_gbl_info_t info; |
xvid_gbl_info_t info; |
291 |
|
HINSTANCE m_hdll; |
292 |
|
|
293 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
294 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
295 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
296 |
|
m_hdll = LoadLibrary(XVID_DLL_NAME); |
297 |
|
if (m_hdll != NULL) { |
298 |
|
|
299 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
300 |
|
(0, XVID_GBL_INFO, &info, NULL); |
301 |
|
|
302 |
|
FreeLibrary(m_hdll); |
303 |
|
} |
304 |
|
|
305 |
reg.cpu = info.cpu_flags; |
reg.cpu = info.cpu_flags; |
306 |
reg.num_threads = info.num_threads; |
reg.num_threads = info.num_threads; |
307 |
|
|
718 |
int weight_en, quant_en; |
int weight_en, quant_en; |
719 |
int cpu_force; |
int cpu_force; |
720 |
int custom_quant, bvops; |
int custom_quant, bvops; |
721 |
int ar_mode, ar_par, ar_select; |
int ar_mode, ar_par; |
722 |
|
|
723 |
switch(idd) { |
switch(idd) { |
724 |
case IDD_PROFILE : |
case IDD_PROFILE : |
902 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
903 |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
904 |
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
905 |
|
CheckDlg(hDlg, IDC_TURBO, config->turbo); |
906 |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
907 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
908 |
break; |
break; |
935 |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
936 |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
937 |
break; |
break; |
938 |
|
|
939 |
|
case IDD_DEC : |
940 |
|
CheckDlg(hDlg, IDC_DEC_DY, pp_dy); |
941 |
|
CheckDlg(hDlg, IDC_DEC_DUV, pp_duv); |
942 |
|
CheckDlg(hDlg, IDC_DEC_DR, pp_dr); |
943 |
|
CheckDlg(hDlg, IDC_DEC_FE, pp_fe); |
944 |
|
break; |
945 |
} |
} |
946 |
} |
} |
947 |
|
|
1045 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
1046 |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
1047 |
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
1048 |
|
config->turbo = IsDlgChecked(hDlg, IDC_TURBO); |
1049 |
|
|
1050 |
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); |
1051 |
|
|
1087 |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1088 |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1089 |
break; |
break; |
1090 |
|
|
1091 |
|
case IDD_DEC : |
1092 |
|
pp_dy = IsDlgChecked(hDlg, IDC_DEC_DY); |
1093 |
|
pp_duv = IsDlgChecked(hDlg, IDC_DEC_DUV); |
1094 |
|
pp_dr = IsDlgChecked(hDlg, IDC_DEC_DR); |
1095 |
|
pp_fe = IsDlgChecked(hDlg, IDC_DEC_FE); |
1096 |
|
break; |
1097 |
} |
} |
1098 |
} |
} |
1099 |
|
|
1150 |
ofn.lStructSize = sizeof(OPENFILENAME); |
ofn.lStructSize = sizeof(OPENFILENAME); |
1151 |
|
|
1152 |
ofn.hwndOwner = hDlg; |
ofn.hwndOwner = hDlg; |
1153 |
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
ofn.lpstrFilter = "bitrate curve (*.pass)\0*.pass\0All files (*.*)\0*.*\0\0"; |
1154 |
ofn.lpstrFile = tmp; |
ofn.lpstrFile = tmp; |
1155 |
ofn.nMaxFile = MAX_PATH; |
ofn.nMaxFile = MAX_PATH; |
1156 |
ofn.Flags = OFN_PATHMUSTEXIST; |
ofn.Flags = OFN_PATHMUSTEXIST; |
1338 |
} |
} |
1339 |
|
|
1340 |
if (s->mode == RC_ZONE_WEIGHT) { |
if (s->mode == RC_ZONE_WEIGHT) { |
1341 |
sprintf(tmp,"%.2f",(float)s->weight/100); |
sprintf(tmp,"W %.2f",(float)s->weight/100); |
1342 |
}else if (s->mode == RC_ZONE_QUANT) { |
}else if (s->mode == RC_ZONE_QUANT) { |
1343 |
sprintf(tmp,"( %.2f )",(float)s->quant/100); |
sprintf(tmp,"Q %.2f",(float)s->quant/100); |
1344 |
}else { |
}else { |
1345 |
strcpy(tmp,"EXT"); |
strcpy(tmp,"EXT"); |
1346 |
} |
} |
1359 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1360 |
} |
} |
1361 |
|
|
|
static int g_use_bitrate = 1; |
|
|
|
|
1362 |
void main_mode(HWND hDlg, CONFIG * config) |
void main_mode(HWND hDlg, CONFIG * config) |
1363 |
{ |
{ |
1364 |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1365 |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1366 |
/* enable target rate/size control only for 1pass and 2pass modes*/ |
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1367 |
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; |
1368 |
|
const int target_en_slider = rc_mode==RC_MODE_1PASS || |
1369 |
|
(rc_mode==RC_MODE_2PASS2 && config->use_2pass_bitrate); |
1370 |
|
|
1371 |
char buf[16]; |
char buf[16]; |
1372 |
int max; |
int max; |
1373 |
|
|
1374 |
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
g_use_bitrate = config->use_2pass_bitrate; |
1375 |
|
|
1376 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1377 |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1388 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1389 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1390 |
|
|
1391 |
}else{ |
} else if (rc_mode==RC_MODE_2PASS2) { |
1392 |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1393 |
|
} else if (rc_mode==RC_MODE_1PASS) { |
1394 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target quantizer:"); |
1395 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(100, 3100)); |
1396 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1397 |
|
get_dlgitem_float(hDlg, IDC_BITRATE, DEFAULT_QUANT )); |
1398 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MIN, "1 (maximum quality)"); |
1399 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MAX, "(smallest file) 31"); |
1400 |
|
|
1401 |
} |
} |
1402 |
|
|
1403 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1404 |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1405 |
|
|
1406 |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en_slider); |
1407 |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en_slider); |
1408 |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en_slider); |
1409 |
} |
} |
1410 |
|
|
1411 |
|
|
1412 |
|
|
1413 |
void main_upload(HWND hDlg, CONFIG * config) |
void main_upload(HWND hDlg, CONFIG * config) |
1414 |
{ |
{ |
|
int i; |
|
1415 |
|
|
1416 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1417 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1418 |
|
|
1419 |
|
g_use_bitrate = config->use_2pass_bitrate; |
1420 |
|
|
1421 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1422 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1423 |
}else{ |
} else if (config->mode == RC_MODE_2PASS2) { |
1424 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1425 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1426 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1427 |
} |
} |
1428 |
|
|
1429 |
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); |
|
|
} |
|
|
} |
|
1430 |
|
|
1431 |
|
|
1432 |
/* downloads data from main dialog */ |
/* downloads data from main dialog */ |
1437 |
|
|
1438 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1439 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1440 |
}else{ |
} else if (config->mode == RC_MODE_2PASS2) { |
1441 |
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1442 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1443 |
|
config->desired_quant = get_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1444 |
} |
} |
1445 |
} |
} |
1446 |
|
|
1452 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1453 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1454 |
static const int zone_dlgs[] = { IDD_ZONE }; |
static const int zone_dlgs[] = { IDD_ZONE }; |
1455 |
static const int bitrate_dlgs[] = { IDD_CALC }; |
static const int decoder_dlgs[] = { IDD_DEC }; |
1456 |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1457 |
|
|
1458 |
|
|
1506 |
|
|
1507 |
const static char_int_t columns[] = { |
const static char_int_t columns[] = { |
1508 |
{"Frame #", 64}, |
{"Frame #", 64}, |
1509 |
{"Weight (Q)", 72}, |
{"Weight/Quant", 82}, |
1510 |
{"Modifiers", 120}}; |
{"Modifiers", 120}}; |
1511 |
|
|
1512 |
LVCOLUMN lvc; |
LVCOLUMN lvc; |
1542 |
|
|
1543 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1544 |
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))) { |
1545 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1546 |
} |
} |
1547 |
break; |
break; |
1548 |
} |
} |
1585 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1586 |
break; |
break; |
1587 |
|
|
1588 |
case IDC_BITRATE_CALC : |
case IDC_DECODER : |
1589 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1590 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, decoder_dlgs, sizeof(decoder_dlgs)/sizeof(int)); |
|
//SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
|
1591 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1592 |
break; |
break; |
1593 |
|
|
1629 |
config->zones[sel+1].bvop_threshold = 0; |
config->zones[sel+1].bvop_threshold = 0; |
1630 |
|
|
1631 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
1632 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[sel+1], sel+1, TRUE); |
zones_update(hDlg, config); |
1633 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
1634 |
break; |
break; |
1635 |
} |
} |
1639 |
int i, sel; |
int i, sel; |
1640 |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1641 |
|
|
1642 |
if (sel == -1) { |
if (sel == -1 || config->num_zones < 1) { |
1643 |
MessageBox(hDlg, "Nothing selected", "Warning", 0); |
/*MessageBox(hDlg, "Nothing selected", "Warning", 0);*/ |
1644 |
break; |
break; |
1645 |
} |
} |
1646 |
|
|
1647 |
for (i=sel; i<config->num_zones-1; i++) { |
for (i=sel; i<config->num_zones-1; i++) |
1648 |
config->zones[i] = config->zones[i+1]; |
config->zones[i] = config->zones[i+1]; |
1649 |
} |
|
1650 |
config->num_zones--; |
config->num_zones--; |
|
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
|
1651 |
|
|
1652 |
sel--; |
zones_update(hDlg, config); |
|
if (sel==0 && config->num_zones>1) { |
|
|
sel=1; |
|
|
} |
|
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
|
1653 |
break; |
break; |
1654 |
} |
} |
1655 |
|
|
1657 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1658 |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1659 |
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))) { |
1660 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1661 |
} |
} |
1662 |
break; |
break; |
1663 |
|
|
1668 |
|
|
1669 |
case IDC_DEFAULTS : |
case IDC_DEFAULTS : |
1670 |
config_reg_default(config); |
config_reg_default(config); |
1671 |
|
main_mode(hDlg, config); |
1672 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1673 |
break; |
break; |
1674 |
|
|
1686 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1687 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
1688 |
|
|
1689 |
main_download(hDlg, config); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1690 |
|
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1691 |
|
|
1692 |
|
if (!g_use_bitrate) { |
1693 |
|
if (config->mode == RC_MODE_1PASS) |
1694 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1695 |
|
else if (config->mode == RC_MODE_2PASS2) |
1696 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1697 |
|
} |
1698 |
|
|
1699 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1700 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1701 |
|
|
1704 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1705 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1706 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1707 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1708 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1709 |
|
get_dlgitem_float(hDlg, IDC_BITRATE, DEFAULT_QUANT) ); |
1710 |
} |
} |
1711 |
|
main_download(hDlg, config); |
1712 |
|
|
1713 |
}else { |
}else { |
1714 |
return 0; |
return 0; |
1717 |
|
|
1718 |
case WM_HSCROLL : |
case WM_HSCROLL : |
1719 |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
1720 |
|
if (g_use_bitrate) |
1721 |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
1722 |
|
else |
1723 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0)); |
1724 |
|
|
1725 |
|
main_download(hDlg, config); |
1726 |
break; |
break; |
1727 |
} |
} |
1728 |
return 0; |
return 0; |
1750 |
char core[100]; |
char core[100]; |
1751 |
HFONT hFont; |
HFONT hFont; |
1752 |
LOGFONT lfData; |
LOGFONT lfData; |
1753 |
|
HINSTANCE m_hdll; |
1754 |
|
|
1755 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1756 |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
1757 |
|
|
1758 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
1759 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1760 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
1761 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
1762 |
|
if (m_hdll != NULL) { |
1763 |
|
|
1764 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
1765 |
|
(0, XVID_GBL_INFO, &info, NULL); |
1766 |
|
|
1767 |
|
wsprintf(core, "xvidcore.dll version %d.%d.%d (\"%s\")", |
1768 |
XVID_VERSION_MAJOR(info.actual_version), |
XVID_VERSION_MAJOR(info.actual_version), |
1769 |
XVID_VERSION_MINOR(info.actual_version), |
XVID_VERSION_MINOR(info.actual_version), |
1770 |
XVID_VERSION_PATCH(info.actual_version), |
XVID_VERSION_PATCH(info.actual_version), |
1771 |
info.build); |
info.build); |
1772 |
|
|
1773 |
|
FreeLibrary(m_hdll); |
1774 |
|
} else { |
1775 |
|
wsprintf(core, "xvidcore.dll not found!"); |
1776 |
|
} |
1777 |
|
|
1778 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |
1779 |
|
|
1780 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1792 |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
1793 |
} |
} |
1794 |
break; |
break; |
|
|
|
1795 |
case WM_CTLCOLORSTATIC : |
case WM_CTLCOLORSTATIC : |
1796 |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
1797 |
{ |
{ |
1818 |
|
|
1819 |
return 1; |
return 1; |
1820 |
} |
} |
1821 |
|
|
1822 |
|
void |
1823 |
|
sort_zones(zone_t * zones, int zone_num, int * sel) |
1824 |
|
{ |
1825 |
|
int i, j; |
1826 |
|
zone_t tmp; |
1827 |
|
for (i = 0; i < zone_num; i++) { |
1828 |
|
int cur = i; |
1829 |
|
int min_f = zones[i].frame; |
1830 |
|
for (j = i + 1; j < zone_num; j++) { |
1831 |
|
if (zones[j].frame < min_f) { |
1832 |
|
min_f = zones[j].frame; |
1833 |
|
cur = j; |
1834 |
|
} |
1835 |
|
} |
1836 |
|
if (cur != i) { |
1837 |
|
tmp = zones[i]; |
1838 |
|
zones[i] = zones[cur]; |
1839 |
|
zones[cur] = tmp; |
1840 |
|
if (i == *sel) *sel = cur; |
1841 |
|
else if (cur == *sel) *sel = i; |
1842 |
|
} |
1843 |
|
} |
1844 |
|
} |
1845 |
|
|
1846 |
|
|
1847 |
|
static void |
1848 |
|
zones_update(HWND hDlg, CONFIG * config) |
1849 |
|
{ |
1850 |
|
int i, sel; |
1851 |
|
|
1852 |
|
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1853 |
|
|
1854 |
|
sort_zones(config->zones, config->num_zones, &sel); |
1855 |
|
|
1856 |
|
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1857 |
|
|
1858 |
|
for (i = 0; i < config->num_zones; i++) |
1859 |
|
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
1860 |
|
|
1861 |
|
if (sel == -1 && config->num_zones > 0) sel = 0; |
1862 |
|
if (sel >= config->num_zones) sel = config->num_zones-1; |
1863 |
|
|
1864 |
|
config->cur_zone = sel; |
1865 |
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
1866 |
|
} |