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_brightness, pp_dy, pp_duv, pp_fe, pp_dry, pp_druv; /* 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 |
{ |
{ |
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 |
|
{ "50.0 (HD PAL)", 50.0F }, |
160 |
|
{ "59.94 (HD NTSC)", 59.940F }, |
161 |
|
{ "60.0", 60.0F }, |
162 |
|
}; |
163 |
|
|
164 |
|
|
165 |
|
typedef struct { |
166 |
|
char * name; |
167 |
|
int avi_interval; /* audio overhead intervals (milliseconds) */ |
168 |
|
float mkv_multiplier; /* mkv multiplier */ |
169 |
|
} named_int_t; |
170 |
|
|
171 |
|
|
172 |
|
#define NO_AUDIO 7 |
173 |
|
static const named_int_t audio_type_list[] = { |
174 |
|
{ "MP3-CBR", 1000, 48000/1152/6 }, |
175 |
|
{ "MP3-VBR", 24, 48000/1152/6 }, |
176 |
|
{ "OGG", /*?*/1000, 48000*(0.7F/1024 + 0.3F/180) }, |
177 |
|
{ "AC3", 64, 48000/1536/6 }, |
178 |
|
{ "DTS", 21, /*?*/48000/1152/6 }, |
179 |
|
{ "AAC", 21, 48000/1024/6 }, |
180 |
|
{ "HE-AAC", 42, 48000/1024/6 }, |
181 |
|
{ "(None)", 0, 0 }, |
182 |
|
}; |
183 |
|
|
184 |
|
|
185 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
186 |
/* REGISTRY ============================================================================ */ |
/* REGISTRY ============================================================================ */ |
187 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
194 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
195 |
{"desired_size", ®.desired_size, 570000}, |
{"desired_size", ®.desired_size, 570000}, |
196 |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
197 |
|
{"desired_quant", ®.desired_quant, DEFAULT_QUANT}, /* 100-base float */ |
198 |
|
|
199 |
/* profile */ |
/* profile */ |
200 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
201 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
202 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
203 |
|
{"tff", ®.tff, 0}, |
204 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
205 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
206 |
{"reduced_resolution", ®.reduced_resolution, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
229 |
|
|
230 |
/* 2pass1 */ |
/* 2pass1 */ |
231 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
232 |
|
{"full1pass", ®.full1pass, 0}, |
233 |
|
|
234 |
/* 2pass2 */ |
/* 2pass2 */ |
235 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
{"keyframe_boost", ®.keyframe_boost, 10}, |
236 |
{"kfreduction", ®.kfreduction, 20}, |
{"kfreduction", ®.kfreduction, 20}, |
237 |
{"kfthreshold", ®.kfthreshold, 1}, |
{"kfthreshold", ®.kfthreshold, 1}, |
238 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
{"curve_compression_high", ®.curve_compression_high, 0}, |
241 |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
242 |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
243 |
|
|
244 |
|
/* bitrate calculator */ |
245 |
|
{"container_type", ®.container_type, 1}, |
246 |
|
{"target_size", ®.target_size, 650 * 1024}, |
247 |
|
{"subtitle_size", ®.subtitle_size, 0}, |
248 |
|
{"hours", ®.hours, 1}, |
249 |
|
{"minutes", ®.minutes, 30}, |
250 |
|
{"seconds", ®.seconds, 0}, |
251 |
|
{"fps", ®.fps, 2}, |
252 |
|
{"audio_mode", ®.audio_mode, 0}, |
253 |
|
{"audio_type", ®.audio_type, 0}, |
254 |
|
{"audio_rate", ®.audio_rate, 128}, |
255 |
|
{"audio_size", ®.audio_size, 0}, |
256 |
|
|
257 |
/* motion */ |
/* motion */ |
258 |
{"motion_search", ®.motion_search, 6}, |
{"motion_search", ®.motion_search, 6}, |
259 |
{"vhq_mode", ®.vhq_mode, 1}, |
{"vhq_mode", ®.vhq_mode, 1}, |
264 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
265 |
|
|
266 |
/* quant */ |
/* quant */ |
267 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 1}, |
268 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
269 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 1}, |
270 |
{"max_pquant", ®.max_pquant, 31}, |
{"max_pquant", ®.max_pquant, 31}, |
271 |
{"min_bquant", ®.min_bquant, 2}, |
{"min_bquant", ®.min_bquant, 1}, |
272 |
{"max_bquant", ®.max_bquant, 31}, |
{"max_bquant", ®.max_bquant, 31}, |
273 |
{"trellis_quant", ®.trellis_quant, 0}, |
{"trellis_quant", ®.trellis_quant, 0}, |
274 |
|
|
277 |
{"debug", ®.debug, 0x0}, |
{"debug", ®.debug, 0x0}, |
278 |
{"vop_debug", ®.vop_debug, 0}, |
{"vop_debug", ®.vop_debug, 0}, |
279 |
{"display_status", ®.display_status, 1}, |
{"display_status", ®.display_status, 1}, |
280 |
|
|
281 |
|
/* decoder, shared with dshow */ |
282 |
|
{"Brightness", &pp_brightness, 0}, |
283 |
|
{"Deblock_Y", &pp_dy, 0}, |
284 |
|
{"Deblock_UV", &pp_duv, 0}, |
285 |
|
{"Dering_Y", &pp_dry, 0}, |
286 |
|
{"Dering_UV", &pp_druv, 0}, |
287 |
|
{"FilmEffect", &pp_fe, 0}, |
288 |
|
|
289 |
}; |
}; |
290 |
|
|
291 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
292 |
{"profile", reg.profile_name, "(unrestricted)"}, |
{"profile", reg.profile_name, "AS @ L5"}, |
293 |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
294 |
}; |
}; |
295 |
|
|
378 |
|
|
379 |
reg.profile = 0; |
reg.profile = 0; |
380 |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
381 |
if (strcmpi(profiles[i].name, reg.profile_name) == 0) { |
if (lstrcmpi(profiles[i].name, reg.profile_name) == 0) { |
382 |
reg.profile = i; |
reg.profile = i; |
383 |
} |
} |
384 |
} |
} |
472 |
|
|
473 |
/* clear XviD registry key, load defaults */ |
/* clear XviD registry key, load defaults */ |
474 |
|
|
475 |
void config_reg_default(CONFIG * config) |
static void config_reg_default(CONFIG * config) |
476 |
{ |
{ |
477 |
HKEY hKey; |
HKEY hKey; |
478 |
|
|
493 |
|
|
494 |
|
|
495 |
/* leaves current config value if dialog item is empty */ |
/* leaves current config value if dialog item is empty */ |
496 |
int config_get_int(HWND hDlg, INT item, int config) |
static int config_get_int(HWND hDlg, INT item, int config) |
497 |
{ |
{ |
498 |
BOOL success = FALSE; |
BOOL success = FALSE; |
499 |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
501 |
} |
} |
502 |
|
|
503 |
|
|
504 |
int config_get_uint(HWND hDlg, UINT item, int config) |
static int config_get_uint(HWND hDlg, UINT item, int config) |
505 |
{ |
{ |
506 |
BOOL success = FALSE; |
BOOL success = FALSE; |
507 |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
508 |
return (success) ? tmp : config; |
return (success) ? tmp : config; |
509 |
} |
} |
510 |
|
|
511 |
|
/* get uint from combobox |
512 |
|
GetDlgItemInt doesnt work properly for cb list items */ |
513 |
|
#define UINT_BUF_SZ 20 |
514 |
|
static int config_get_cbuint(HWND hDlg, UINT item, int def) |
515 |
|
{ |
516 |
|
int sel = SendMessage(GetDlgItem(hDlg, item), CB_GETCURSEL, 0, 0); |
517 |
|
char buf[UINT_BUF_SZ]; |
518 |
|
|
519 |
|
if (sel<0) { |
520 |
|
return config_get_uint(hDlg, item, def); |
521 |
|
} |
522 |
|
|
523 |
|
if (SendMessage(GetDlgItem(hDlg, item), CB_GETLBTEXT, sel, (LPARAM)buf) == CB_ERR) { |
524 |
|
return def; |
525 |
|
} |
526 |
|
|
527 |
|
return atoi(buf); |
528 |
|
} |
529 |
|
|
530 |
|
|
531 |
/* we use "100 base" floats */ |
/* we use "100 base" floats */ |
532 |
|
|
533 |
#define FLOAT_BUF_SZ 20 |
#define FLOAT_BUF_SZ 20 |
534 |
int get_dlgitem_float(HWND hDlg, UINT item, int def) |
static int get_dlgitem_float(HWND hDlg, UINT item, int def) |
535 |
{ |
{ |
536 |
char buf[FLOAT_BUF_SZ]; |
char buf[FLOAT_BUF_SZ]; |
537 |
|
|
541 |
return (int)(atof(buf)*100); |
return (int)(atof(buf)*100); |
542 |
} |
} |
543 |
|
|
544 |
void set_dlgitem_float(HWND hDlg, UINT item, int value) |
static void set_dlgitem_float(HWND hDlg, UINT item, int value) |
545 |
{ |
{ |
546 |
char buf[FLOAT_BUF_SZ]; |
char buf[FLOAT_BUF_SZ]; |
547 |
sprintf(buf, "%.2f", (float)value/100); |
sprintf(buf, "%.2f", (float)value/100); |
550 |
|
|
551 |
|
|
552 |
#define HEX_BUF_SZ 16 |
#define HEX_BUF_SZ 16 |
553 |
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) |
554 |
{ |
{ |
555 |
char buf[HEX_BUF_SZ]; |
char buf[HEX_BUF_SZ]; |
556 |
unsigned int value; |
unsigned int value; |
565 |
return def; |
return def; |
566 |
} |
} |
567 |
|
|
568 |
void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
static void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
569 |
{ |
{ |
570 |
char buf[HEX_BUF_SZ]; |
char buf[HEX_BUF_SZ]; |
571 |
wsprintf(buf, "0x%x", value); |
wsprintf(buf, "0x%x", value); |
576 |
/* QUANT MATRIX DIALOG ================================================================= */ |
/* QUANT MATRIX DIALOG ================================================================= */ |
577 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
578 |
|
|
579 |
void quant_upload(HWND hDlg, CONFIG* config) |
static void quant_upload(HWND hDlg, CONFIG* config) |
580 |
{ |
{ |
581 |
int i; |
int i; |
582 |
|
|
587 |
} |
} |
588 |
|
|
589 |
|
|
590 |
void quant_download(HWND hDlg, CONFIG* config) |
static void quant_download(HWND hDlg, CONFIG* config) |
591 |
{ |
{ |
592 |
int i; |
int i; |
593 |
|
|
605 |
} |
} |
606 |
|
|
607 |
|
|
608 |
void quant_loadsave(HWND hDlg, CONFIG * config, int save) |
static void quant_loadsave(HWND hDlg, CONFIG * config, int save) |
609 |
{ |
{ |
610 |
char file[MAX_PATH]; |
char file[MAX_PATH]; |
611 |
OPENFILENAME ofn; |
OPENFILENAME ofn; |
664 |
|
|
665 |
/* quantization matrix dialog proc */ |
/* quantization matrix dialog proc */ |
666 |
|
|
667 |
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) |
668 |
{ |
{ |
669 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
670 |
|
|
722 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
723 |
|
|
724 |
/* initialise pages */ |
/* initialise pages */ |
725 |
void adv_init(HWND hDlg, int idd, CONFIG * config) |
static void adv_init(HWND hDlg, int idd, CONFIG * config) |
726 |
{ |
{ |
727 |
unsigned int i; |
unsigned int i; |
728 |
|
|
733 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
734 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
735 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
|
|
|
736 |
break; |
break; |
737 |
|
|
738 |
case IDD_AR: |
case IDD_AR: |
739 |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
740 |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
749 |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
750 |
break; |
break; |
751 |
|
|
752 |
|
case IDD_BITRATE : |
753 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-Legacy"); |
754 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-OpenDML"); |
755 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"Matroska"); |
756 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"OGM"); |
757 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"(None)"); |
758 |
|
|
759 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"665600"); |
760 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"716800"); |
761 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"1331200"); |
762 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"1433600"); |
763 |
|
|
764 |
|
for (i=0; i<sizeof(video_fps_list)/sizeof(named_float_t); i++) |
765 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_ADDSTRING, 0, (LPARAM)video_fps_list[i].name); |
766 |
|
|
767 |
|
for (i=0; i<sizeof(audio_type_list)/sizeof(named_int_t); i++) |
768 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_ADDSTRING, 0, (LPARAM)audio_type_list[i].name); |
769 |
|
|
770 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"32"); |
771 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"56"); |
772 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"64"); |
773 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"96"); |
774 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"112"); |
775 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"128"); |
776 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"160"); |
777 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"192"); |
778 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"224"); |
779 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"256"); |
780 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"384"); |
781 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"448"); |
782 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"512"); |
783 |
|
break; |
784 |
|
|
785 |
case IDD_ZONE : |
case IDD_ZONE : |
786 |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
787 |
break; |
break; |
811 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
812 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
813 |
break; |
break; |
814 |
|
|
815 |
|
case IDD_DEC : |
816 |
|
SendDlgItemMessage(hDlg, IDC_DEC_BRIGHTNESS, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(-96, 96)); |
817 |
|
SendDlgItemMessage(hDlg, IDC_DEC_BRIGHTNESS, TBM_SETTICFREQ, (WPARAM)16, (LPARAM)0); |
818 |
|
break; |
819 |
} |
} |
820 |
} |
} |
821 |
|
|
822 |
|
|
823 |
/* enable/disable controls based on encoder-mode or user selection */ |
/* enable/disable controls based on encoder-mode or user selection */ |
824 |
|
|
825 |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
static void adv_mode(HWND hDlg, int idd, CONFIG * config) |
826 |
{ |
{ |
827 |
int profile; |
int profile; |
828 |
int weight_en, quant_en; |
int weight_en, quant_en; |
842 |
EnableDlgWindow(hDlg, IDC_QUANTMATRIX, custom_quant); |
EnableDlgWindow(hDlg, IDC_QUANTMATRIX, custom_quant); |
843 |
EnableDlgWindow(hDlg, IDC_LUMMASK, profiles[profile].flags&PROFILE_ADAPTQUANT); |
EnableDlgWindow(hDlg, IDC_LUMMASK, profiles[profile].flags&PROFILE_ADAPTQUANT); |
844 |
EnableDlgWindow(hDlg, IDC_INTERLACING, profiles[profile].flags&PROFILE_INTERLACE); |
EnableDlgWindow(hDlg, IDC_INTERLACING, profiles[profile].flags&PROFILE_INTERLACE); |
845 |
|
EnableDlgWindow(hDlg, IDC_TFF, IsDlgChecked(hDlg, IDC_INTERLACING)); |
846 |
EnableDlgWindow(hDlg, IDC_QPEL, profiles[profile].flags&PROFILE_QPEL); |
EnableDlgWindow(hDlg, IDC_QPEL, profiles[profile].flags&PROFILE_QPEL); |
847 |
EnableDlgWindow(hDlg, IDC_GMC, profiles[profile].flags&PROFILE_GMC); |
EnableDlgWindow(hDlg, IDC_GMC, profiles[profile].flags&PROFILE_GMC); |
848 |
EnableDlgWindow(hDlg, IDC_REDUCED, profiles[profile].flags&PROFILE_REDUCED); |
EnableDlgWindow(hDlg, IDC_REDUCED, profiles[profile].flags&PROFILE_REDUCED); |
896 |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
897 |
break; |
break; |
898 |
|
|
899 |
|
case IDD_BITRATE : |
900 |
|
{ |
901 |
|
int ctype = SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_GETCURSEL, 0, 0); |
902 |
|
int target_size = config_get_cbuint(hDlg, IDC_BITRATE_TSIZE, 0); |
903 |
|
int subtitle_size = config_get_uint(hDlg, IDC_BITRATE_SSIZE, 0); |
904 |
|
int fps = SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_GETCURSEL, 0, 0); |
905 |
|
|
906 |
|
int duration = |
907 |
|
3600 * config_get_uint(hDlg, IDC_BITRATE_HOURS, 0) + |
908 |
|
60 * config_get_uint(hDlg, IDC_BITRATE_MINUTES, 0) + |
909 |
|
config_get_uint(hDlg, IDC_BITRATE_SECONDS, 0); |
910 |
|
|
911 |
|
int audio_type = SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_GETCURSEL, 0, 0); |
912 |
|
int audio_mode = IsDlgChecked(hDlg, IDC_BITRATE_AMODE_SIZE); |
913 |
|
int audio_rate = config_get_cbuint(hDlg, IDC_BITRATE_ARATE, 0); |
914 |
|
int audio_size = config_get_uint(hDlg, IDC_BITRATE_ASIZE, 0); |
915 |
|
|
916 |
|
int frames; |
917 |
|
int overhead; |
918 |
|
int vsize; |
919 |
|
|
920 |
|
if (duration == 0) |
921 |
|
break; |
922 |
|
|
923 |
|
if (fps < 0 || fps >= sizeof(video_fps_list)/sizeof(named_float_t)) { |
924 |
|
fps = 0; |
925 |
|
} |
926 |
|
if (audio_type < 0 || audio_type >= sizeof(audio_type_list)/sizeof(named_int_t)) { |
927 |
|
audio_type = 0; |
928 |
|
} |
929 |
|
|
930 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_RATE, audio_type!=NO_AUDIO); |
931 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_SIZE, audio_type!=NO_AUDIO); |
932 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ARATE, audio_type!=NO_AUDIO && !audio_mode); |
933 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ASIZE, audio_type!=NO_AUDIO && audio_mode); |
934 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ASELECT, audio_type!=NO_AUDIO && audio_mode); |
935 |
|
|
936 |
|
/* step 1: calculate number of frames */ |
937 |
|
frames = (int)(duration * video_fps_list[fps].value); |
938 |
|
|
939 |
|
/* step 2: calculate audio_size (kbytes)*/ |
940 |
|
if (audio_type!=NO_AUDIO) { |
941 |
|
if (audio_mode==0) { |
942 |
|
audio_size = (int)( (1000.0 * duration * audio_rate) / (8.0*1024) ); |
943 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ASIZE, audio_size, TRUE); |
944 |
|
}else{ |
945 |
|
int tmp_rate = (int)( (audio_size * 8.0 * 1024) / (1000.0 * duration) ); |
946 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ARATE, tmp_rate, TRUE); |
947 |
|
} |
948 |
|
}else{ |
949 |
|
audio_size = 0; |
950 |
|
} |
951 |
|
|
952 |
|
/* step 3: calculate container overhead */ |
953 |
|
|
954 |
|
switch(ctype) { |
955 |
|
case 0 : /* AVI */ |
956 |
|
case 1 : /* AVI-OpenDML */ |
957 |
|
|
958 |
|
overhead = frames; |
959 |
|
|
960 |
|
if (audio_type!=NO_AUDIO) { |
961 |
|
overhead += (duration * 1000) / audio_type_list[audio_type].avi_interval; |
962 |
|
} |
963 |
|
|
964 |
|
overhead *= (ctype==0) ? 24 : 16; |
965 |
|
|
966 |
|
overhead /= 1024; |
967 |
|
break; |
968 |
|
|
969 |
|
case 2 : /* Matroska: gknot formula */ |
970 |
|
|
971 |
|
/* common overhead */ |
972 |
|
overhead = 40 + 12 + 8+ 16*duration + 200 + 100*1/*one audio stream*/ + 11*duration; |
973 |
|
|
974 |
|
/* video overhead */ |
975 |
|
overhead += frames*8 + (int)(frames * 4 * 0.94); |
976 |
|
|
977 |
|
/* cue tables and menu seek entries (300k default) */ |
978 |
|
overhead += 300 * 1024; |
979 |
|
|
980 |
|
/* audio */ |
981 |
|
overhead += (int)(duration * audio_type_list[audio_type].mkv_multiplier); |
982 |
|
|
983 |
|
overhead /= 1024; |
984 |
|
break; |
985 |
|
|
986 |
|
case 3 : /* alexnoe formula */ |
987 |
|
overhead = (int)( (target_size - subtitle_size) * (28.0/4224.0 + (1.0/255.0)) ); |
988 |
|
break; |
989 |
|
|
990 |
|
default : /* (none) */ |
991 |
|
overhead = 0; |
992 |
|
break; |
993 |
|
} |
994 |
|
|
995 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_COVERHEAD, overhead, TRUE); |
996 |
|
|
997 |
|
/* final video bitstream size */ |
998 |
|
vsize = target_size - subtitle_size - audio_size - overhead; |
999 |
|
if (vsize > 0) { |
1000 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_VSIZE, vsize, TRUE); |
1001 |
|
/* convert from kbytes to kbits-per-second */ |
1002 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_VRATE, (vsize * 8 * 128) / (duration * 125), TRUE); |
1003 |
|
}else{ |
1004 |
|
SetDlgItemText(hDlg, IDC_BITRATE_VSIZE, "Overflow"); |
1005 |
|
SetDlgItemText(hDlg, IDC_BITRATE_VRATE, "Overflow"); |
1006 |
|
} |
1007 |
|
|
1008 |
|
} |
1009 |
|
break; |
1010 |
|
|
1011 |
case IDD_ZONE : |
case IDD_ZONE : |
1012 |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
1013 |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
1046 |
|
|
1047 |
|
|
1048 |
/* upload config data into dialog */ |
/* upload config data into dialog */ |
1049 |
void adv_upload(HWND hDlg, int idd, CONFIG * config) |
static void adv_upload(HWND hDlg, int idd, CONFIG * config) |
1050 |
{ |
{ |
1051 |
switch (idd) |
switch (idd) |
1052 |
{ |
{ |
1056 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
1057 |
CheckDlg(hDlg, IDC_LUMMASK, config->lum_masking); |
CheckDlg(hDlg, IDC_LUMMASK, config->lum_masking); |
1058 |
CheckDlg(hDlg, IDC_INTERLACING, config->interlacing); |
CheckDlg(hDlg, IDC_INTERLACING, config->interlacing); |
1059 |
|
CheckDlg(hDlg, IDC_TFF, config->tff); |
1060 |
CheckDlg(hDlg, IDC_QPEL, config->qpel); |
CheckDlg(hDlg, IDC_QPEL, config->qpel); |
1061 |
CheckDlg(hDlg, IDC_GMC, config->gmc); |
CheckDlg(hDlg, IDC_GMC, config->gmc); |
1062 |
CheckDlg(hDlg, IDC_REDUCED, config->reduced_resolution); |
CheckDlg(hDlg, IDC_REDUCED, config->reduced_resolution); |
1089 |
case IDD_RC_2PASS1 : |
case IDD_RC_2PASS1 : |
1090 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
1091 |
CheckDlg(hDlg, IDC_DISCARD1PASS, config->discard1pass); |
CheckDlg(hDlg, IDC_DISCARD1PASS, config->discard1pass); |
1092 |
|
CheckDlg(hDlg, IDC_FULL1PASS, config->full1pass); |
1093 |
break; |
break; |
1094 |
|
|
1095 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
1106 |
SetDlgItemInt(hDlg, IDC_MINKEY, config->kfthreshold, FALSE); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->kfthreshold, FALSE); |
1107 |
break; |
break; |
1108 |
|
|
1109 |
|
case IDD_BITRATE : |
1110 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_SETCURSEL, config->container_type, 0); |
1111 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_TSIZE, config->target_size, FALSE); |
1112 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_SSIZE, config->subtitle_size, FALSE); |
1113 |
|
|
1114 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_HOURS, config->hours, FALSE); |
1115 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_MINUTES, config->minutes, FALSE); |
1116 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_SECONDS, config->seconds, FALSE); |
1117 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_SETCURSEL, config->fps, 0); |
1118 |
|
|
1119 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_SETCURSEL, config->audio_type, 0); |
1120 |
|
CheckRadioButton(hDlg, IDC_BITRATE_AMODE_RATE, IDC_BITRATE_AMODE_SIZE, config->audio_mode == 0 ? IDC_BITRATE_AMODE_RATE : IDC_BITRATE_AMODE_SIZE); |
1121 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ARATE, config->audio_rate, FALSE); |
1122 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ASIZE, config->audio_size, FALSE); |
1123 |
|
break; |
1124 |
|
|
1125 |
case IDD_ZONE : |
case IDD_ZONE : |
1126 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
1127 |
|
|
1176 |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
1177 |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
1178 |
break; |
break; |
1179 |
|
|
1180 |
|
case IDD_DEC : |
1181 |
|
SendDlgItemMessage(hDlg, IDC_DEC_BRIGHTNESS, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)pp_brightness); |
1182 |
|
CheckDlg(hDlg, IDC_DEC_DY, pp_dy); |
1183 |
|
CheckDlg(hDlg, IDC_DEC_DUV, pp_duv); |
1184 |
|
CheckDlg(hDlg, IDC_DEC_DRY, pp_dry); |
1185 |
|
CheckDlg(hDlg, IDC_DEC_DRUV,pp_druv); |
1186 |
|
CheckDlg(hDlg, IDC_DEC_FE, pp_fe); |
1187 |
|
EnableDlgWindow(hDlg, IDC_DEC_DRY, pp_dy); |
1188 |
|
EnableDlgWindow(hDlg, IDC_DEC_DRUV, pp_duv); |
1189 |
|
break; |
1190 |
} |
} |
1191 |
} |
} |
1192 |
|
|
1193 |
|
|
1194 |
/* download config data from dialog */ |
/* download config data from dialog */ |
1195 |
|
|
1196 |
void adv_download(HWND hDlg, int idd, CONFIG * config) |
static void adv_download(HWND hDlg, int idd, CONFIG * config) |
1197 |
{ |
{ |
1198 |
switch (idd) |
switch (idd) |
1199 |
{ |
{ |
1203 |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
1204 |
config->lum_masking = IsDlgChecked(hDlg, IDC_LUMMASK); |
config->lum_masking = IsDlgChecked(hDlg, IDC_LUMMASK); |
1205 |
config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING); |
config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING); |
1206 |
|
config->tff = IsDlgChecked(hDlg, IDC_TFF); |
1207 |
config->qpel = IsDlgChecked(hDlg, IDC_QPEL); |
config->qpel = IsDlgChecked(hDlg, IDC_QPEL); |
1208 |
config->gmc = IsDlgChecked(hDlg, IDC_GMC); |
config->gmc = IsDlgChecked(hDlg, IDC_GMC); |
1209 |
config->reduced_resolution = IsDlgChecked(hDlg, IDC_REDUCED); |
config->reduced_resolution = IsDlgChecked(hDlg, IDC_REDUCED); |
1241 |
if (GetDlgItemText(hDlg, IDC_STATS, config->stats, MAX_PATH) == 0) |
if (GetDlgItemText(hDlg, IDC_STATS, config->stats, MAX_PATH) == 0) |
1242 |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
1243 |
config->discard1pass = IsDlgChecked(hDlg, IDC_DISCARD1PASS); |
config->discard1pass = IsDlgChecked(hDlg, IDC_DISCARD1PASS); |
1244 |
|
config->full1pass = IsDlgChecked(hDlg, IDC_FULL1PASS); |
1245 |
break; |
break; |
1246 |
|
|
1247 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
1268 |
|
|
1269 |
break; |
break; |
1270 |
|
|
1271 |
|
case IDD_BITRATE : |
1272 |
|
config->container_type = SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_GETCURSEL, 0, 0); |
1273 |
|
config->target_size = config_get_uint(hDlg, IDC_BITRATE_TSIZE, config->target_size); |
1274 |
|
config->subtitle_size = config_get_uint(hDlg, IDC_BITRATE_SSIZE, config->subtitle_size); |
1275 |
|
|
1276 |
|
config->hours = config_get_uint(hDlg, IDC_BITRATE_HOURS, config->hours); |
1277 |
|
config->minutes = config_get_uint(hDlg, IDC_BITRATE_MINUTES, config->minutes); |
1278 |
|
config->seconds = config_get_uint(hDlg, IDC_BITRATE_SECONDS, config->seconds); |
1279 |
|
config->fps = SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_GETCURSEL, 0, 0); |
1280 |
|
|
1281 |
|
config->audio_type = SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_GETCURSEL, 0, 0); |
1282 |
|
config->audio_mode = IsDlgChecked(hDlg, IDC_BITRATE_AMODE_SIZE) ? 1 : 0 ; |
1283 |
|
config->audio_rate = config_get_uint(hDlg, IDC_BITRATE_ARATE, config->audio_rate); |
1284 |
|
config->audio_size = config_get_uint(hDlg, IDC_BITRATE_ASIZE, config->audio_size); |
1285 |
|
|
1286 |
|
/* the main window uses "AVI bitrate/filesize" not "video bitrate/filesize", |
1287 |
|
so we have to compensate by frames * 24 bytes */ |
1288 |
|
{ |
1289 |
|
int frame_compensate = 24 * (int)( |
1290 |
|
(3600*config->hours + |
1291 |
|
60*config->minutes + |
1292 |
|
config->seconds) * video_fps_list[config->fps].value) / 1024; |
1293 |
|
|
1294 |
|
int bitrate_compensate = (int)(24 * video_fps_list[config->fps].value) / 125; |
1295 |
|
|
1296 |
|
config->desired_size = |
1297 |
|
config_get_uint(hDlg, IDC_BITRATE_VSIZE, config->desired_size) + frame_compensate; |
1298 |
|
|
1299 |
|
config->bitrate = |
1300 |
|
config_get_uint(hDlg, IDC_BITRATE_VRATE, config->bitrate) + bitrate_compensate; |
1301 |
|
} |
1302 |
|
break; |
1303 |
|
|
1304 |
case IDD_ZONE : |
case IDD_ZONE : |
1305 |
config->zones[config->cur_zone].frame = config_get_uint(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame); |
config->zones[config->cur_zone].frame = config_get_uint(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame); |
1306 |
|
|
1367 |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1368 |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1369 |
break; |
break; |
1370 |
|
|
1371 |
|
case IDD_DEC : |
1372 |
|
pp_brightness = SendDlgItemMessage(hDlg, IDC_DEC_BRIGHTNESS, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); |
1373 |
|
pp_dy = IsDlgChecked(hDlg, IDC_DEC_DY); |
1374 |
|
pp_duv = IsDlgChecked(hDlg, IDC_DEC_DUV); |
1375 |
|
pp_dry = IsDlgChecked(hDlg, IDC_DEC_DRY); |
1376 |
|
pp_druv = IsDlgChecked(hDlg, IDC_DEC_DRUV); |
1377 |
|
pp_fe = IsDlgChecked(hDlg, IDC_DEC_FE); |
1378 |
|
break; |
1379 |
} |
} |
1380 |
} |
} |
1381 |
|
|
1383 |
|
|
1384 |
/* advanced dialog proc */ |
/* advanced dialog proc */ |
1385 |
|
|
1386 |
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) |
1387 |
{ |
{ |
1388 |
PROPSHEETINFO *psi; |
PROPSHEETINFO *psi; |
1389 |
|
|
1406 |
{ |
{ |
1407 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
1408 |
{ |
{ |
1409 |
|
case IDC_INTERLACING : |
1410 |
case IDC_BVOP : |
case IDC_BVOP : |
1411 |
case IDC_ZONE_MODE_WEIGHT : |
case IDC_ZONE_MODE_WEIGHT : |
1412 |
case IDC_ZONE_MODE_QUANT : |
case IDC_ZONE_MODE_QUANT : |
1415 |
case IDC_CPU_FORCE : |
case IDC_CPU_FORCE : |
1416 |
case IDC_AR : |
case IDC_AR : |
1417 |
case IDC_PAR : |
case IDC_PAR : |
1418 |
|
case IDC_BITRATE_AMODE_RATE : |
1419 |
|
case IDC_BITRATE_AMODE_SIZE : |
1420 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1421 |
break; |
break; |
1422 |
|
|
1423 |
|
case IDC_BITRATE_SSELECT : |
1424 |
|
case IDC_BITRATE_ASELECT : |
1425 |
|
{ |
1426 |
|
OPENFILENAME ofn; |
1427 |
|
char filename[MAX_PATH] = ""; |
1428 |
|
|
1429 |
|
memset(&ofn, 0, sizeof(OPENFILENAME)); |
1430 |
|
ofn.lStructSize = sizeof(OPENFILENAME); |
1431 |
|
|
1432 |
|
ofn.hwndOwner = hDlg; |
1433 |
|
if (LOWORD(wParam)==IDC_BITRATE_SSELECT) { |
1434 |
|
ofn.lpstrFilter = "Subtitle files (*.sub, *.ssa, *.txt, *.dat)\0*.sub;*.ssa;*.txt;*.dat\0All files (*.*)\0*.*\0\0"; |
1435 |
|
}else{ |
1436 |
|
ofn.lpstrFilter = "Audio files (*.mp3, *.ac3, *.aac, *.ogg, *.wav)\0*.mp3; *.ac3; *.aac; *.ogg; *.wav\0All files (*.*)\0*.*\0\0"; |
1437 |
|
} |
1438 |
|
|
1439 |
|
ofn.lpstrFile = filename; |
1440 |
|
ofn.nMaxFile = MAX_PATH; |
1441 |
|
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; |
1442 |
|
|
1443 |
|
if (GetOpenFileName(&ofn)) { |
1444 |
|
HANDLE hFile; |
1445 |
|
DWORD filesize; |
1446 |
|
|
1447 |
|
if ((hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) == INVALID_HANDLE_VALUE || |
1448 |
|
(filesize = GetFileSize(hFile, NULL)) == INVALID_FILE_SIZE) { |
1449 |
|
MessageBox(hDlg, "Could not get file size", "Error", 0); |
1450 |
|
}else{ |
1451 |
|
SetDlgItemInt(hDlg, |
1452 |
|
LOWORD(wParam)==IDC_BITRATE_SSELECT? IDC_BITRATE_SSIZE : IDC_BITRATE_ASIZE, |
1453 |
|
filesize / 1024, FALSE); |
1454 |
|
CloseHandle(hFile); |
1455 |
|
} |
1456 |
|
} |
1457 |
|
} |
1458 |
|
break; |
1459 |
|
|
1460 |
case IDC_QUANTMATRIX : |
case IDC_QUANTMATRIX : |
1461 |
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
1462 |
break; |
break; |
1472 |
ofn.lStructSize = sizeof(OPENFILENAME); |
ofn.lStructSize = sizeof(OPENFILENAME); |
1473 |
|
|
1474 |
ofn.hwndOwner = hDlg; |
ofn.hwndOwner = hDlg; |
1475 |
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
ofn.lpstrFilter = "bitrate curve (*.pass)\0*.pass\0All files (*.*)\0*.*\0\0"; |
1476 |
ofn.lpstrFile = tmp; |
ofn.lpstrFile = tmp; |
1477 |
ofn.nMaxFile = MAX_PATH; |
ofn.nMaxFile = MAX_PATH; |
1478 |
ofn.Flags = OFN_PATHMUSTEXIST; |
ofn.Flags = OFN_PATHMUSTEXIST; |
1483 |
ofn.Flags |= OFN_FILEMUSTEXIST; |
ofn.Flags |= OFN_FILEMUSTEXIST; |
1484 |
} |
} |
1485 |
|
|
1486 |
if (GetSaveFileName(&ofn)) |
if ((psi->idd==IDD_RC_2PASS1 && GetSaveFileName(&ofn)) || |
1487 |
{ |
(psi->idd==IDD_RC_2PASS2 && GetOpenFileName(&ofn))) { |
1488 |
SetDlgItemText(hDlg, IDC_STATS, tmp); |
SetDlgItemText(hDlg, IDC_STATS, tmp); |
1489 |
} |
} |
1490 |
} |
} |
1491 |
|
break; |
1492 |
|
|
1493 |
case IDC_ZONE_FETCH : |
case IDC_ZONE_FETCH : |
1494 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
1517 |
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1518 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1519 |
break; |
break; |
1520 |
|
case IDC_DEC_DY: |
1521 |
|
case IDC_DEC_DUV: |
1522 |
|
EnableDlgWindow(hDlg, IDC_DEC_DRY, IsDlgChecked(hDlg, IDC_DEC_DY)); |
1523 |
|
EnableDlgWindow(hDlg, IDC_DEC_DRUV, IsDlgChecked(hDlg, IDC_DEC_DUV)); |
1524 |
|
break; |
1525 |
default : |
default : |
1526 |
return TRUE; |
return TRUE; |
1527 |
} |
} |
1528 |
|
}else if ((HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam)==CBN_SELCHANGE) && |
1529 |
|
(LOWORD(wParam)==IDC_BITRATE_TSIZE || |
1530 |
|
LOWORD(wParam)==IDC_BITRATE_ARATE )) { |
1531 |
|
|
1532 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1533 |
|
|
1534 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1535 |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
1536 |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
1537 |
LOWORD(wParam) == IDC_QUANTTYPE || |
LOWORD(wParam) == IDC_QUANTTYPE || |
1538 |
LOWORD(wParam) == IDC_ASPECT_RATIO)) |
LOWORD(wParam) == IDC_ASPECT_RATIO || |
1539 |
{ |
LOWORD(wParam) == IDC_BITRATE_CFORMAT || |
1540 |
|
LOWORD(wParam) == IDC_BITRATE_AFORMAT || |
1541 |
|
LOWORD(wParam) == IDC_BITRATE_FPS)) { |
1542 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1543 |
}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)) { |
1544 |
|
|
1545 |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
1546 |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
1547 |
|
|
1548 |
} else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_PARX || LOWORD(wParam)==IDC_PARY)) { |
} else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_PARX || LOWORD(wParam)==IDC_PARY)) { |
1549 |
|
|
1550 |
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
1551 |
if(LOWORD(wParam)==IDC_PARX) |
if(LOWORD(wParam)==IDC_PARX) |
1552 |
psi->config->par_x = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_x); |
psi->config->par_x = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_x); |
1553 |
else |
else |
1554 |
psi->config->par_y = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_y); |
psi->config->par_y = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_y); |
1555 |
} |
} |
1556 |
|
} else if (HIWORD(wParam) == EN_UPDATE && |
1557 |
|
(LOWORD(wParam)==IDC_BITRATE_SSIZE || |
1558 |
|
LOWORD(wParam)==IDC_BITRATE_HOURS || |
1559 |
|
LOWORD(wParam)==IDC_BITRATE_MINUTES || |
1560 |
|
LOWORD(wParam)==IDC_BITRATE_SECONDS || |
1561 |
|
LOWORD(wParam)==IDC_BITRATE_ASIZE)) { |
1562 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1563 |
} else |
} else |
1564 |
return 0; |
return 0; |
1565 |
break; |
break; |
1577 |
switch (((NMHDR *)lParam)->code) |
switch (((NMHDR *)lParam)->code) |
1578 |
{ |
{ |
1579 |
case PSN_SETACTIVE : |
case PSN_SETACTIVE : |
1580 |
OutputDebugString("PSN_SET"); |
DPRINTF("PSN_SET"); |
1581 |
adv_upload(hDlg, psi->idd, psi->config); |
adv_upload(hDlg, psi->idd, psi->config); |
1582 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1583 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1584 |
break; |
break; |
1585 |
|
|
1586 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1587 |
OutputDebugString("PSN_KILL"); |
DPRINTF("PSN_KILL"); |
1588 |
adv_download(hDlg, psi->idd, psi->config); |
adv_download(hDlg, psi->idd, psi->config); |
1589 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1590 |
break; |
break; |
1591 |
|
|
1592 |
case PSN_APPLY : |
case PSN_APPLY : |
1593 |
OutputDebugString("PSN_APPLY"); |
DPRINTF("PSN_APPLY"); |
1594 |
psi->config->save = TRUE; |
psi->config->save = TRUE; |
1595 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1596 |
break; |
break; |
1612 |
or fasle if changes were canceled. |
or fasle if changes were canceled. |
1613 |
|
|
1614 |
*/ |
*/ |
1615 |
BOOL adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) |
|
1616 |
|
#ifndef PSH_NOCONTEXTHELP |
1617 |
|
#define PSH_NOCONTEXTHELP 0x02000000 |
1618 |
|
#endif |
1619 |
|
|
1620 |
|
static BOOL adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) |
1621 |
{ |
{ |
1622 |
PROPSHEETINFO psi[6]; |
PROPSHEETINFO psi[6]; |
1623 |
PROPSHEETPAGE psp[6]; |
PROPSHEETPAGE psp[6]; |
1643 |
} |
} |
1644 |
|
|
1645 |
psh.dwSize = sizeof(PROPSHEETHEADER); |
psh.dwSize = sizeof(PROPSHEETHEADER); |
1646 |
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP; |
1647 |
psh.hwndParent = hParent; |
psh.hwndParent = hParent; |
1648 |
psh.hInstance = g_hInst; |
psh.hInstance = g_hInst; |
1649 |
psh.pszCaption = (LPSTR) "XviD Configuration"; |
psh.pszCaption = (LPSTR) "XviD Configuration"; |
1664 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
1665 |
|
|
1666 |
|
|
1667 |
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) |
1668 |
{ |
{ |
1669 |
char tmp[32]; |
char tmp[32]; |
1670 |
|
|
1708 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1709 |
} |
} |
1710 |
|
|
|
static int g_use_bitrate = 1; |
|
1711 |
|
|
1712 |
void main_mode(HWND hDlg, CONFIG * config) |
static void main_mode(HWND hDlg, CONFIG * config) |
1713 |
{ |
{ |
1714 |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1715 |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1716 |
/* enable target rate/size control only for 1pass and 2pass modes*/ |
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1717 |
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; |
1718 |
|
const int target_en_slider = rc_mode==RC_MODE_1PASS || |
1719 |
|
(rc_mode==RC_MODE_2PASS2 && config->use_2pass_bitrate); |
1720 |
|
|
1721 |
char buf[16]; |
char buf[16]; |
1722 |
int max; |
int max; |
1723 |
|
|
1724 |
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
g_use_bitrate = config->use_2pass_bitrate; |
1725 |
|
|
1726 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1727 |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1738 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1739 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1740 |
|
|
1741 |
}else{ |
} else if (rc_mode==RC_MODE_2PASS2) { |
1742 |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1743 |
|
} else if (rc_mode==RC_MODE_1PASS) { |
1744 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target quantizer:"); |
1745 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(100, 3100)); |
1746 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1747 |
|
get_dlgitem_float(hDlg, IDC_BITRATE, DEFAULT_QUANT )); |
1748 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MIN, "1 (maximum quality)"); |
1749 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MAX, "(smallest file) 31"); |
1750 |
|
|
1751 |
} |
} |
1752 |
|
|
1753 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1754 |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1755 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ADV, target_en); |
1756 |
|
|
1757 |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en_slider); |
1758 |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en_slider); |
1759 |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en_slider); |
1760 |
} |
} |
1761 |
|
|
1762 |
|
|
1763 |
|
static void main_upload(HWND hDlg, CONFIG * config) |
|
void main_upload(HWND hDlg, CONFIG * config) |
|
1764 |
{ |
{ |
1765 |
|
|
1766 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1767 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1768 |
|
|
1769 |
|
g_use_bitrate = config->use_2pass_bitrate; |
1770 |
|
|
1771 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1772 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1773 |
}else{ |
} else if (config->mode == RC_MODE_2PASS2) { |
1774 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1775 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1776 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1777 |
} |
} |
1778 |
|
|
1779 |
zones_update(hDlg, config);} |
zones_update(hDlg, config); |
1780 |
|
} |
1781 |
|
|
1782 |
|
|
1783 |
/* downloads data from main dialog */ |
/* downloads data from main dialog */ |
1784 |
void main_download(HWND hDlg, CONFIG * config) |
static void main_download(HWND hDlg, CONFIG * config) |
1785 |
{ |
{ |
1786 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1787 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1788 |
|
|
1789 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1790 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1791 |
}else{ |
} else if (config->mode == RC_MODE_2PASS2) { |
1792 |
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1793 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1794 |
|
config->desired_quant = get_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1795 |
} |
} |
1796 |
} |
} |
1797 |
|
|
1802 |
static const int single_dlgs[] = { IDD_RC_CBR }; |
static const int single_dlgs[] = { IDD_RC_CBR }; |
1803 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1804 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1805 |
|
static const int bitrate_dlgs[] = { IDD_BITRATE }; |
1806 |
static const int zone_dlgs[] = { IDD_ZONE }; |
static const int zone_dlgs[] = { IDD_ZONE }; |
1807 |
static const int bitrate_dlgs[] = { IDD_CALC }; |
static const int decoder_dlgs[] = { IDD_DEC }; |
1808 |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1809 |
|
|
1810 |
|
|
1899 |
break; |
break; |
1900 |
} |
} |
1901 |
|
|
|
if (n->code == NM_RCLICK) { |
|
|
OutputDebugString("Right click"); |
|
|
} |
|
1902 |
break; |
break; |
1903 |
} |
} |
1904 |
|
|
1925 |
} |
} |
1926 |
break; |
break; |
1927 |
|
|
|
|
|
1928 |
case IDC_BITRATE_S : |
case IDC_BITRATE_S : |
1929 |
/* alternate between bitrate/desired_length metrics */ |
/* alternate between bitrate/desired_length metrics */ |
1930 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1933 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1934 |
break; |
break; |
1935 |
|
|
1936 |
case IDC_BITRATE_CALC : |
case IDC_BITRATE_ADV : |
1937 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1938 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1939 |
//SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
main_mode(hDlg, config); |
1940 |
|
main_upload(hDlg, config); |
1941 |
|
break; |
1942 |
|
|
1943 |
|
case IDC_DECODER : |
1944 |
|
main_download(hDlg, config); |
1945 |
|
adv_dialog(hDlg, config, decoder_dlgs, sizeof(decoder_dlgs)/sizeof(int)); |
1946 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1947 |
break; |
break; |
1948 |
|
|
2023 |
|
|
2024 |
case IDC_DEFAULTS : |
case IDC_DEFAULTS : |
2025 |
config_reg_default(config); |
config_reg_default(config); |
2026 |
|
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
2027 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
2028 |
|
main_mode(hDlg, config); |
2029 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
2030 |
break; |
break; |
2031 |
|
|
2043 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
2044 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
2045 |
|
|
2046 |
main_download(hDlg, config); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
2047 |
|
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
2048 |
|
|
2049 |
|
if (!g_use_bitrate) { |
2050 |
|
if (config->mode == RC_MODE_1PASS) |
2051 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
2052 |
|
else if (config->mode == RC_MODE_2PASS2) |
2053 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
2054 |
|
} |
2055 |
|
|
2056 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
2057 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
2058 |
|
|
2061 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
2062 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
2063 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
2064 |
|
} else if (config->mode == RC_MODE_1PASS) { |
2065 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
2066 |
|
get_dlgitem_float(hDlg, IDC_BITRATE, DEFAULT_QUANT) ); |
2067 |
} |
} |
2068 |
|
main_download(hDlg, config); |
2069 |
|
|
2070 |
}else { |
}else { |
2071 |
return 0; |
return 0; |
2074 |
|
|
2075 |
case WM_HSCROLL : |
case WM_HSCROLL : |
2076 |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
2077 |
|
if (g_use_bitrate) |
2078 |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
2079 |
|
else |
2080 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0)); |
2081 |
|
|
2082 |
|
main_download(hDlg, config); |
2083 |
break; |
break; |
2084 |
} |
} |
2085 |
return 0; |
return 0; |
2176 |
return 1; |
return 1; |
2177 |
} |
} |
2178 |
|
|
2179 |
static void |
|
2180 |
|
void |
2181 |
sort_zones(zone_t * zones, int zone_num, int * sel) |
sort_zones(zone_t * zones, int zone_num, int * sel) |
2182 |
{ |
{ |
2183 |
int i, j; |
int i, j; |