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 |
|
|
76 |
HWND g_hTooltip; |
HWND g_hTooltip; |
77 |
|
|
78 |
static int g_use_bitrate = 1; |
static int g_use_bitrate = 1; |
79 |
|
|
80 |
|
|
81 |
int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */ |
int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */ |
82 |
|
|
83 |
/* enumerates child windows, assigns tooltips */ |
/* enumerates child windows, assigns tooltips */ |
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 5 |
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 |
|
{ "(None)", 0, 0 }, |
180 |
|
}; |
181 |
|
|
182 |
|
|
183 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
184 |
/* REGISTRY ============================================================================ */ |
/* REGISTRY ============================================================================ */ |
185 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
226 |
|
|
227 |
/* 2pass1 */ |
/* 2pass1 */ |
228 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
229 |
|
{"full1pass", ®.full1pass, 0}, |
230 |
|
|
231 |
/* 2pass2 */ |
/* 2pass2 */ |
232 |
{"keyframe_boost", ®.keyframe_boost, 10}, |
{"keyframe_boost", ®.keyframe_boost, 10}, |
238 |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
239 |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
240 |
|
|
241 |
|
/* bitrate calculator */ |
242 |
|
{"container_type", ®.container_type, 1}, |
243 |
|
{"target_size", ®.target_size, 650 * 1024}, |
244 |
|
{"subtitle_size", ®.subtitle_size, 0}, |
245 |
|
{"hours", ®.hours, 1}, |
246 |
|
{"minutes", ®.minutes, 30}, |
247 |
|
{"seconds", ®.seconds, 0}, |
248 |
|
{"fps", ®.fps, 2}, |
249 |
|
{"audio_mode", ®.audio_mode, 0}, |
250 |
|
{"audio_type", ®.audio_type, 0}, |
251 |
|
{"audio_rate", ®.audio_rate, 128}, |
252 |
|
{"audio_size", ®.audio_size, 0}, |
253 |
|
|
254 |
/* motion */ |
/* motion */ |
255 |
{"motion_search", ®.motion_search, 6}, |
{"motion_search", ®.motion_search, 6}, |
256 |
{"vhq_mode", ®.vhq_mode, 1}, |
{"vhq_mode", ®.vhq_mode, 1}, |
261 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
262 |
|
|
263 |
/* quant */ |
/* quant */ |
264 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 1}, |
265 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
266 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 1}, |
267 |
{"max_pquant", ®.max_pquant, 31}, |
{"max_pquant", ®.max_pquant, 31}, |
268 |
{"min_bquant", ®.min_bquant, 2}, |
{"min_bquant", ®.min_bquant, 1}, |
269 |
{"max_bquant", ®.max_bquant, 31}, |
{"max_bquant", ®.max_bquant, 31}, |
270 |
{"trellis_quant", ®.trellis_quant, 0}, |
{"trellis_quant", ®.trellis_quant, 0}, |
271 |
|
|
373 |
|
|
374 |
reg.profile = 0; |
reg.profile = 0; |
375 |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
376 |
if (strcmpi(profiles[i].name, reg.profile_name) == 0) { |
if (lstrcmpi(profiles[i].name, reg.profile_name) == 0) { |
377 |
reg.profile = i; |
reg.profile = i; |
378 |
} |
} |
379 |
} |
} |
467 |
|
|
468 |
/* clear XviD registry key, load defaults */ |
/* clear XviD registry key, load defaults */ |
469 |
|
|
470 |
void config_reg_default(CONFIG * config) |
static void config_reg_default(CONFIG * config) |
471 |
{ |
{ |
472 |
HKEY hKey; |
HKEY hKey; |
473 |
|
|
488 |
|
|
489 |
|
|
490 |
/* leaves current config value if dialog item is empty */ |
/* leaves current config value if dialog item is empty */ |
491 |
int config_get_int(HWND hDlg, INT item, int config) |
static int config_get_int(HWND hDlg, INT item, int config) |
492 |
{ |
{ |
493 |
BOOL success = FALSE; |
BOOL success = FALSE; |
494 |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
496 |
} |
} |
497 |
|
|
498 |
|
|
499 |
int config_get_uint(HWND hDlg, UINT item, int config) |
static int config_get_uint(HWND hDlg, UINT item, int config) |
500 |
{ |
{ |
501 |
BOOL success = FALSE; |
BOOL success = FALSE; |
502 |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
503 |
return (success) ? tmp : config; |
return (success) ? tmp : config; |
504 |
} |
} |
505 |
|
|
506 |
|
/* get uint from combobox |
507 |
|
GetDlgItemInt doesnt work properly for cb list items */ |
508 |
|
#define UINT_BUF_SZ 20 |
509 |
|
static int config_get_cbuint(HWND hDlg, UINT item, int def) |
510 |
|
{ |
511 |
|
int sel = SendMessage(GetDlgItem(hDlg, item), CB_GETCURSEL, 0, 0); |
512 |
|
char buf[UINT_BUF_SZ]; |
513 |
|
|
514 |
|
if (sel<0) { |
515 |
|
return config_get_uint(hDlg, item, def); |
516 |
|
} |
517 |
|
|
518 |
|
if (SendMessage(GetDlgItem(hDlg, item), CB_GETLBTEXT, sel, (LPARAM)buf) == CB_ERR) { |
519 |
|
return def; |
520 |
|
} |
521 |
|
|
522 |
|
return atoi(buf); |
523 |
|
} |
524 |
|
|
525 |
|
|
526 |
/* we use "100 base" floats */ |
/* we use "100 base" floats */ |
527 |
|
|
528 |
#define FLOAT_BUF_SZ 20 |
#define FLOAT_BUF_SZ 20 |
529 |
int get_dlgitem_float(HWND hDlg, UINT item, int def) |
static int get_dlgitem_float(HWND hDlg, UINT item, int def) |
530 |
{ |
{ |
531 |
char buf[FLOAT_BUF_SZ]; |
char buf[FLOAT_BUF_SZ]; |
532 |
|
|
536 |
return (int)(atof(buf)*100); |
return (int)(atof(buf)*100); |
537 |
} |
} |
538 |
|
|
539 |
void set_dlgitem_float(HWND hDlg, UINT item, int value) |
static void set_dlgitem_float(HWND hDlg, UINT item, int value) |
540 |
{ |
{ |
541 |
char buf[FLOAT_BUF_SZ]; |
char buf[FLOAT_BUF_SZ]; |
542 |
sprintf(buf, "%.2f", (float)value/100); |
sprintf(buf, "%.2f", (float)value/100); |
545 |
|
|
546 |
|
|
547 |
#define HEX_BUF_SZ 16 |
#define HEX_BUF_SZ 16 |
548 |
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) |
549 |
{ |
{ |
550 |
char buf[HEX_BUF_SZ]; |
char buf[HEX_BUF_SZ]; |
551 |
unsigned int value; |
unsigned int value; |
560 |
return def; |
return def; |
561 |
} |
} |
562 |
|
|
563 |
void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
static void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
564 |
{ |
{ |
565 |
char buf[HEX_BUF_SZ]; |
char buf[HEX_BUF_SZ]; |
566 |
wsprintf(buf, "0x%x", value); |
wsprintf(buf, "0x%x", value); |
571 |
/* QUANT MATRIX DIALOG ================================================================= */ |
/* QUANT MATRIX DIALOG ================================================================= */ |
572 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
573 |
|
|
574 |
void quant_upload(HWND hDlg, CONFIG* config) |
static void quant_upload(HWND hDlg, CONFIG* config) |
575 |
{ |
{ |
576 |
int i; |
int i; |
577 |
|
|
582 |
} |
} |
583 |
|
|
584 |
|
|
585 |
void quant_download(HWND hDlg, CONFIG* config) |
static void quant_download(HWND hDlg, CONFIG* config) |
586 |
{ |
{ |
587 |
int i; |
int i; |
588 |
|
|
600 |
} |
} |
601 |
|
|
602 |
|
|
603 |
void quant_loadsave(HWND hDlg, CONFIG * config, int save) |
static void quant_loadsave(HWND hDlg, CONFIG * config, int save) |
604 |
{ |
{ |
605 |
char file[MAX_PATH]; |
char file[MAX_PATH]; |
606 |
OPENFILENAME ofn; |
OPENFILENAME ofn; |
659 |
|
|
660 |
/* quantization matrix dialog proc */ |
/* quantization matrix dialog proc */ |
661 |
|
|
662 |
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) |
663 |
{ |
{ |
664 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
665 |
|
|
717 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
718 |
|
|
719 |
/* initialise pages */ |
/* initialise pages */ |
720 |
void adv_init(HWND hDlg, int idd, CONFIG * config) |
static void adv_init(HWND hDlg, int idd, CONFIG * config) |
721 |
{ |
{ |
722 |
unsigned int i; |
unsigned int i; |
723 |
|
|
728 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
729 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
730 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
|
|
|
731 |
break; |
break; |
732 |
|
|
733 |
case IDD_AR: |
case IDD_AR: |
734 |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
735 |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
744 |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
745 |
break; |
break; |
746 |
|
|
747 |
|
case IDD_BITRATE : |
748 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-Legacy"); |
749 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-OpenDML"); |
750 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"Matroska"); |
751 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"OGM"); |
752 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"(None)"); |
753 |
|
|
754 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"665600"); |
755 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"716800"); |
756 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"1331200"); |
757 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"1433600"); |
758 |
|
|
759 |
|
for (i=0; i<sizeof(video_fps_list)/sizeof(named_float_t); i++) |
760 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_ADDSTRING, 0, (LPARAM)video_fps_list[i].name); |
761 |
|
|
762 |
|
for (i=0; i<sizeof(audio_type_list)/sizeof(named_int_t); i++) |
763 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_ADDSTRING, 0, (LPARAM)audio_type_list[i].name); |
764 |
|
|
765 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"32"); |
766 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"56"); |
767 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"64"); |
768 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"96"); |
769 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"112"); |
770 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"128"); |
771 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"160"); |
772 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"192"); |
773 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"224"); |
774 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"256"); |
775 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"384"); |
776 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"448"); |
777 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_ARATE, CB_ADDSTRING, 0, (LPARAM)"512"); |
778 |
|
break; |
779 |
|
|
780 |
case IDD_ZONE : |
case IDD_ZONE : |
781 |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
782 |
break; |
break; |
812 |
|
|
813 |
/* enable/disable controls based on encoder-mode or user selection */ |
/* enable/disable controls based on encoder-mode or user selection */ |
814 |
|
|
815 |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
static void adv_mode(HWND hDlg, int idd, CONFIG * config) |
816 |
{ |
{ |
817 |
int profile; |
int profile; |
818 |
int weight_en, quant_en; |
int weight_en, quant_en; |
885 |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
886 |
break; |
break; |
887 |
|
|
888 |
|
case IDD_BITRATE : |
889 |
|
{ |
890 |
|
int ctype = SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_GETCURSEL, 0, 0); |
891 |
|
int target_size = config_get_cbuint(hDlg, IDC_BITRATE_TSIZE, 0); |
892 |
|
int subtitle_size = config_get_uint(hDlg, IDC_BITRATE_SSIZE, 0); |
893 |
|
int fps = SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_GETCURSEL, 0, 0); |
894 |
|
|
895 |
|
int duration = |
896 |
|
3600 * config_get_uint(hDlg, IDC_BITRATE_HOURS, 0) + |
897 |
|
60 * config_get_uint(hDlg, IDC_BITRATE_MINUTES, 0) + |
898 |
|
config_get_uint(hDlg, IDC_BITRATE_SECONDS, 0); |
899 |
|
|
900 |
|
int audio_type = SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_GETCURSEL, 0, 0); |
901 |
|
int audio_mode = IsDlgChecked(hDlg, IDC_BITRATE_AMODE_SIZE); |
902 |
|
int audio_rate = config_get_cbuint(hDlg, IDC_BITRATE_ARATE, 0); |
903 |
|
int audio_size = config_get_uint(hDlg, IDC_BITRATE_ASIZE, 0); |
904 |
|
|
905 |
|
int frames; |
906 |
|
int overhead; |
907 |
|
int vsize; |
908 |
|
|
909 |
|
if (duration == 0) |
910 |
|
break; |
911 |
|
|
912 |
|
if (fps < 0 || fps >= sizeof(video_fps_list)/sizeof(named_float_t)) { |
913 |
|
fps = 0; |
914 |
|
} |
915 |
|
if (audio_type < 0 || audio_type >= sizeof(audio_type_list)/sizeof(named_int_t)) { |
916 |
|
audio_type = 0; |
917 |
|
} |
918 |
|
|
919 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_RATE, audio_type!=NO_AUDIO); |
920 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_SIZE, audio_type!=NO_AUDIO); |
921 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ARATE, audio_type!=NO_AUDIO && !audio_mode); |
922 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ASIZE, audio_type!=NO_AUDIO && audio_mode); |
923 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ASELECT, audio_type!=NO_AUDIO && audio_mode); |
924 |
|
|
925 |
|
/* step 1: calculate number of frames */ |
926 |
|
frames = (int)(duration * video_fps_list[fps].value); |
927 |
|
|
928 |
|
/* step 2: calculate audio_size (kbytes)*/ |
929 |
|
if (audio_type!=NO_AUDIO) { |
930 |
|
if (audio_mode==0) { |
931 |
|
audio_size = (duration * audio_rate) / 8; |
932 |
|
} |
933 |
|
}else{ |
934 |
|
audio_size = 0; |
935 |
|
} |
936 |
|
|
937 |
|
/* step 3: calculate container overhead */ |
938 |
|
|
939 |
|
switch(ctype) { |
940 |
|
case 0 : /* AVI */ |
941 |
|
case 1 : /* AVI-OpenDML */ |
942 |
|
|
943 |
|
overhead = frames; |
944 |
|
|
945 |
|
if (audio_type!=NO_AUDIO) { |
946 |
|
overhead += (duration * 1000) / audio_type_list[audio_type].avi_interval; |
947 |
|
} |
948 |
|
|
949 |
|
overhead *= (ctype==0) ? 24 : 16; |
950 |
|
|
951 |
|
overhead /= 1024; |
952 |
|
break; |
953 |
|
|
954 |
|
case 2 : /* Matroska: gknot formula */ |
955 |
|
|
956 |
|
/* common overhead */ |
957 |
|
overhead = 40 + 12 + 8+ 16*duration + 200 + 100*1/*one audio stream*/ + 11*duration; |
958 |
|
|
959 |
|
/* video overhead */ |
960 |
|
overhead += frames*8 + (int)(frames * 4 * 0.94); |
961 |
|
|
962 |
|
/* cue tables and menu seek entries (300k default) */ |
963 |
|
overhead += 300 * 1024; |
964 |
|
|
965 |
|
/* audio */ |
966 |
|
overhead += (int)(duration * audio_type_list[audio_type].mkv_multiplier); |
967 |
|
|
968 |
|
overhead /= 1024; |
969 |
|
break; |
970 |
|
|
971 |
|
case 3 : /* OGM: inaccurate model */ |
972 |
|
overhead = (int)(0.0039F * (target_size - subtitle_size)); |
973 |
|
break; |
974 |
|
|
975 |
|
default : /* (none) */ |
976 |
|
overhead = 0; |
977 |
|
break; |
978 |
|
} |
979 |
|
|
980 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_COVERHEAD, overhead, TRUE); |
981 |
|
|
982 |
|
/* final video bitstream size */ |
983 |
|
vsize = target_size - subtitle_size - audio_size - overhead; |
984 |
|
if (vsize > 0) { |
985 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_VSIZE, vsize, TRUE); |
986 |
|
/* convert from kbytes to kbits-per-second */ |
987 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_VRATE, (vsize * 8 * 128) / (duration * 125), TRUE); |
988 |
|
}else{ |
989 |
|
SetDlgItemText(hDlg, IDC_BITRATE_VSIZE, "Overflow"); |
990 |
|
SetDlgItemText(hDlg, IDC_BITRATE_VRATE, "Overflow"); |
991 |
|
} |
992 |
|
|
993 |
|
} |
994 |
|
break; |
995 |
|
|
996 |
case IDD_ZONE : |
case IDD_ZONE : |
997 |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
998 |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
1031 |
|
|
1032 |
|
|
1033 |
/* upload config data into dialog */ |
/* upload config data into dialog */ |
1034 |
void adv_upload(HWND hDlg, int idd, CONFIG * config) |
static void adv_upload(HWND hDlg, int idd, CONFIG * config) |
1035 |
{ |
{ |
1036 |
switch (idd) |
switch (idd) |
1037 |
{ |
{ |
1073 |
case IDD_RC_2PASS1 : |
case IDD_RC_2PASS1 : |
1074 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
1075 |
CheckDlg(hDlg, IDC_DISCARD1PASS, config->discard1pass); |
CheckDlg(hDlg, IDC_DISCARD1PASS, config->discard1pass); |
1076 |
|
CheckDlg(hDlg, IDC_FULL1PASS, config->full1pass); |
1077 |
break; |
break; |
1078 |
|
|
1079 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
1090 |
SetDlgItemInt(hDlg, IDC_MINKEY, config->kfthreshold, FALSE); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->kfthreshold, FALSE); |
1091 |
break; |
break; |
1092 |
|
|
1093 |
|
case IDD_BITRATE : |
1094 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_SETCURSEL, config->container_type, 0); |
1095 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_TSIZE, config->target_size, FALSE); |
1096 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_SSIZE, config->subtitle_size, FALSE); |
1097 |
|
|
1098 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_HOURS, config->hours, FALSE); |
1099 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_MINUTES, config->minutes, FALSE); |
1100 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_SECONDS, config->seconds, FALSE); |
1101 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_SETCURSEL, config->fps, 0); |
1102 |
|
|
1103 |
|
SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_SETCURSEL, config->audio_type, 0); |
1104 |
|
CheckRadioButton(hDlg, IDC_BITRATE_AMODE_RATE, IDC_BITRATE_AMODE_SIZE, config->audio_mode == 0 ? IDC_BITRATE_AMODE_RATE : IDC_BITRATE_AMODE_SIZE); |
1105 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ARATE, config->audio_rate, FALSE); |
1106 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ASIZE, config->audio_size, FALSE); |
1107 |
|
break; |
1108 |
|
|
1109 |
case IDD_ZONE : |
case IDD_ZONE : |
1110 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
1111 |
|
|
1173 |
|
|
1174 |
/* download config data from dialog */ |
/* download config data from dialog */ |
1175 |
|
|
1176 |
void adv_download(HWND hDlg, int idd, CONFIG * config) |
static void adv_download(HWND hDlg, int idd, CONFIG * config) |
1177 |
{ |
{ |
1178 |
switch (idd) |
switch (idd) |
1179 |
{ |
{ |
1220 |
if (GetDlgItemText(hDlg, IDC_STATS, config->stats, MAX_PATH) == 0) |
if (GetDlgItemText(hDlg, IDC_STATS, config->stats, MAX_PATH) == 0) |
1221 |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
1222 |
config->discard1pass = IsDlgChecked(hDlg, IDC_DISCARD1PASS); |
config->discard1pass = IsDlgChecked(hDlg, IDC_DISCARD1PASS); |
1223 |
|
config->full1pass = IsDlgChecked(hDlg, IDC_FULL1PASS); |
1224 |
break; |
break; |
1225 |
|
|
1226 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
1247 |
|
|
1248 |
break; |
break; |
1249 |
|
|
1250 |
|
case IDD_BITRATE : |
1251 |
|
config->container_type = SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_GETCURSEL, 0, 0); |
1252 |
|
config->target_size = config_get_uint(hDlg, IDC_BITRATE_TSIZE, config->target_size); |
1253 |
|
config->subtitle_size = config_get_uint(hDlg, IDC_BITRATE_SSIZE, config->subtitle_size); |
1254 |
|
|
1255 |
|
config->hours = config_get_uint(hDlg, IDC_BITRATE_HOURS, config->hours); |
1256 |
|
config->minutes = config_get_uint(hDlg, IDC_BITRATE_MINUTES, config->minutes); |
1257 |
|
config->seconds = config_get_uint(hDlg, IDC_BITRATE_SECONDS, config->seconds); |
1258 |
|
config->fps = SendDlgItemMessage(hDlg, IDC_BITRATE_FPS, CB_GETCURSEL, 0, 0); |
1259 |
|
|
1260 |
|
config->audio_type = SendDlgItemMessage(hDlg, IDC_BITRATE_AFORMAT, CB_GETCURSEL, 0, 0); |
1261 |
|
config->audio_mode = IsDlgChecked(hDlg, IDC_BITRATE_AMODE_SIZE) ? 1 : 0 ; |
1262 |
|
config->audio_rate = config_get_uint(hDlg, IDC_BITRATE_ARATE, config->audio_rate); |
1263 |
|
config->audio_size = config_get_uint(hDlg, IDC_BITRATE_ASIZE, config->audio_size); |
1264 |
|
|
1265 |
|
/* the main window uses "AVI bitrate/filesize" not "video bitrate/filesize", |
1266 |
|
so we have to compensate by frames * 24 bytes */ |
1267 |
|
{ |
1268 |
|
int frame_compensate = 24 * (int)( |
1269 |
|
(3600*config->hours + |
1270 |
|
60*config->minutes + |
1271 |
|
config->seconds) * video_fps_list[config->fps].value) / 1024; |
1272 |
|
|
1273 |
|
int bitrate_compensate = (int)(24 * video_fps_list[config->fps].value) / 125; |
1274 |
|
|
1275 |
|
config->desired_size = |
1276 |
|
config_get_uint(hDlg, IDC_BITRATE_VSIZE, config->desired_size) + frame_compensate; |
1277 |
|
|
1278 |
|
config->bitrate = |
1279 |
|
config_get_uint(hDlg, IDC_BITRATE_VRATE, config->bitrate) + bitrate_compensate; |
1280 |
|
} |
1281 |
|
break; |
1282 |
|
|
1283 |
case IDD_ZONE : |
case IDD_ZONE : |
1284 |
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); |
1285 |
|
|
1360 |
|
|
1361 |
/* advanced dialog proc */ |
/* advanced dialog proc */ |
1362 |
|
|
1363 |
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) |
1364 |
{ |
{ |
1365 |
PROPSHEETINFO *psi; |
PROPSHEETINFO *psi; |
1366 |
|
|
1391 |
case IDC_CPU_FORCE : |
case IDC_CPU_FORCE : |
1392 |
case IDC_AR : |
case IDC_AR : |
1393 |
case IDC_PAR : |
case IDC_PAR : |
1394 |
|
case IDC_BITRATE_AMODE_RATE : |
1395 |
|
case IDC_BITRATE_AMODE_SIZE : |
1396 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1397 |
break; |
break; |
1398 |
|
|
1399 |
|
case IDC_BITRATE_SSELECT : |
1400 |
|
case IDC_BITRATE_ASELECT : |
1401 |
|
{ |
1402 |
|
OPENFILENAME ofn; |
1403 |
|
char filename[MAX_PATH] = ""; |
1404 |
|
|
1405 |
|
memset(&ofn, 0, sizeof(OPENFILENAME)); |
1406 |
|
ofn.lStructSize = sizeof(OPENFILENAME); |
1407 |
|
|
1408 |
|
ofn.hwndOwner = hDlg; |
1409 |
|
if (LOWORD(wParam)==IDC_BITRATE_SSELECT) { |
1410 |
|
ofn.lpstrFilter = "Subtitle files (*.sub, *.ssa)\0*.sub;*.ssa\0All files (*.*)\0*.*\0\0"; |
1411 |
|
}else{ |
1412 |
|
ofn.lpstrFilter = "Audio files (*.mp3, *.ac3)\0*.mp3; *.ac3\0All files (*.*)\0*.*\0\0"; |
1413 |
|
} |
1414 |
|
|
1415 |
|
ofn.lpstrFile = filename; |
1416 |
|
ofn.nMaxFile = MAX_PATH; |
1417 |
|
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; |
1418 |
|
|
1419 |
|
if (GetOpenFileName(&ofn)) { |
1420 |
|
HANDLE hFile; |
1421 |
|
DWORD filesize; |
1422 |
|
|
1423 |
|
if ((hFile = CreateFile(filename, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) == INVALID_HANDLE_VALUE || |
1424 |
|
(filesize = GetFileSize(hFile, NULL)) == INVALID_FILE_SIZE) { |
1425 |
|
MessageBox(hDlg, "Could not get file size", "Error", 0); |
1426 |
|
}else{ |
1427 |
|
SetDlgItemInt(hDlg, |
1428 |
|
LOWORD(wParam)==IDC_BITRATE_SSELECT? IDC_BITRATE_SSIZE : IDC_BITRATE_ASIZE, |
1429 |
|
filesize / 1024, FALSE); |
1430 |
|
CloseHandle(hFile); |
1431 |
|
} |
1432 |
|
} |
1433 |
|
} |
1434 |
|
break; |
1435 |
|
|
1436 |
case IDC_QUANTMATRIX : |
case IDC_QUANTMATRIX : |
1437 |
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
1438 |
break; |
break; |
1459 |
ofn.Flags |= OFN_FILEMUSTEXIST; |
ofn.Flags |= OFN_FILEMUSTEXIST; |
1460 |
} |
} |
1461 |
|
|
1462 |
if (GetSaveFileName(&ofn)) |
if ((psi->idd==IDD_RC_2PASS1 && GetSaveFileName(&ofn)) || |
1463 |
{ |
(psi->idd==IDD_RC_2PASS2 && GetOpenFileName(&ofn))) { |
1464 |
SetDlgItemText(hDlg, IDC_STATS, tmp); |
SetDlgItemText(hDlg, IDC_STATS, tmp); |
1465 |
} |
} |
1466 |
} |
} |
1467 |
|
break; |
1468 |
|
|
1469 |
case IDC_ZONE_FETCH : |
case IDC_ZONE_FETCH : |
1470 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
1497 |
default : |
default : |
1498 |
return TRUE; |
return TRUE; |
1499 |
} |
} |
1500 |
|
}else if ((HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam)==CBN_SELCHANGE) && |
1501 |
|
(LOWORD(wParam)==IDC_BITRATE_TSIZE || |
1502 |
|
LOWORD(wParam)==IDC_BITRATE_ARATE )) { |
1503 |
|
|
1504 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1505 |
|
|
1506 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1507 |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
1508 |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
1509 |
LOWORD(wParam) == IDC_QUANTTYPE || |
LOWORD(wParam) == IDC_QUANTTYPE || |
1510 |
LOWORD(wParam) == IDC_ASPECT_RATIO)) |
LOWORD(wParam) == IDC_ASPECT_RATIO || |
1511 |
{ |
LOWORD(wParam) == IDC_BITRATE_CFORMAT || |
1512 |
|
LOWORD(wParam) == IDC_BITRATE_AFORMAT || |
1513 |
|
LOWORD(wParam) == IDC_BITRATE_FPS)) { |
1514 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1515 |
}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)) { |
1516 |
|
|
1517 |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
1518 |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
1519 |
|
|
1520 |
} 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)) { |
1521 |
|
|
1522 |
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
1523 |
if(LOWORD(wParam)==IDC_PARX) |
if(LOWORD(wParam)==IDC_PARX) |
1524 |
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); |
1525 |
else |
else |
1526 |
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); |
1527 |
} |
} |
1528 |
|
} else if (HIWORD(wParam) == EN_UPDATE && |
1529 |
|
(LOWORD(wParam)==IDC_BITRATE_SSIZE || |
1530 |
|
LOWORD(wParam)==IDC_BITRATE_HOURS || |
1531 |
|
LOWORD(wParam)==IDC_BITRATE_MINUTES || |
1532 |
|
LOWORD(wParam)==IDC_BITRATE_SECONDS || |
1533 |
|
LOWORD(wParam)==IDC_BITRATE_ASIZE)) { |
1534 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1535 |
} else |
} else |
1536 |
return 0; |
return 0; |
1537 |
break; |
break; |
1549 |
switch (((NMHDR *)lParam)->code) |
switch (((NMHDR *)lParam)->code) |
1550 |
{ |
{ |
1551 |
case PSN_SETACTIVE : |
case PSN_SETACTIVE : |
1552 |
OutputDebugString("PSN_SET"); |
DPRINTF("PSN_SET"); |
1553 |
adv_upload(hDlg, psi->idd, psi->config); |
adv_upload(hDlg, psi->idd, psi->config); |
1554 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1555 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1556 |
break; |
break; |
1557 |
|
|
1558 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1559 |
OutputDebugString("PSN_KILL"); |
DPRINTF("PSN_KILL"); |
1560 |
adv_download(hDlg, psi->idd, psi->config); |
adv_download(hDlg, psi->idd, psi->config); |
1561 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1562 |
break; |
break; |
1563 |
|
|
1564 |
case PSN_APPLY : |
case PSN_APPLY : |
1565 |
OutputDebugString("PSN_APPLY"); |
DPRINTF("PSN_APPLY"); |
1566 |
psi->config->save = TRUE; |
psi->config->save = TRUE; |
1567 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1568 |
break; |
break; |
1584 |
or fasle if changes were canceled. |
or fasle if changes were canceled. |
1585 |
|
|
1586 |
*/ |
*/ |
1587 |
BOOL adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) |
|
1588 |
|
#ifndef PSH_NOCONTEXTHELP |
1589 |
|
#define PSH_NOCONTEXTHELP 0x02000000 |
1590 |
|
#endif |
1591 |
|
|
1592 |
|
static BOOL adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) |
1593 |
{ |
{ |
1594 |
PROPSHEETINFO psi[6]; |
PROPSHEETINFO psi[6]; |
1595 |
PROPSHEETPAGE psp[6]; |
PROPSHEETPAGE psp[6]; |
1615 |
} |
} |
1616 |
|
|
1617 |
psh.dwSize = sizeof(PROPSHEETHEADER); |
psh.dwSize = sizeof(PROPSHEETHEADER); |
1618 |
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP; |
1619 |
psh.hwndParent = hParent; |
psh.hwndParent = hParent; |
1620 |
psh.hInstance = g_hInst; |
psh.hInstance = g_hInst; |
1621 |
psh.pszCaption = (LPSTR) "XviD Configuration"; |
psh.pszCaption = (LPSTR) "XviD Configuration"; |
1636 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
1637 |
|
|
1638 |
|
|
1639 |
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) |
1640 |
{ |
{ |
1641 |
char tmp[32]; |
char tmp[32]; |
1642 |
|
|
1680 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1681 |
} |
} |
1682 |
|
|
1683 |
void main_mode(HWND hDlg, CONFIG * config) |
|
1684 |
|
static void main_mode(HWND hDlg, CONFIG * config) |
1685 |
{ |
{ |
1686 |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1687 |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1724 |
|
|
1725 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1726 |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1727 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_ADV, target_en); |
1728 |
|
|
1729 |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en_slider); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en_slider); |
1730 |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en_slider); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en_slider); |
1732 |
} |
} |
1733 |
|
|
1734 |
|
|
1735 |
|
static void main_upload(HWND hDlg, CONFIG * config) |
|
void main_upload(HWND hDlg, CONFIG * config) |
|
1736 |
{ |
{ |
1737 |
|
|
1738 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1748 |
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1749 |
} |
} |
1750 |
|
|
1751 |
zones_update(hDlg, config);} |
zones_update(hDlg, config); |
1752 |
|
} |
1753 |
|
|
1754 |
|
|
1755 |
/* downloads data from main dialog */ |
/* downloads data from main dialog */ |
1756 |
void main_download(HWND hDlg, CONFIG * config) |
static void main_download(HWND hDlg, CONFIG * config) |
1757 |
{ |
{ |
1758 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1759 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1774 |
static const int single_dlgs[] = { IDD_RC_CBR }; |
static const int single_dlgs[] = { IDD_RC_CBR }; |
1775 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1776 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1777 |
|
static const int bitrate_dlgs[] = { IDD_BITRATE }; |
1778 |
static const int zone_dlgs[] = { IDD_ZONE }; |
static const int zone_dlgs[] = { IDD_ZONE }; |
1779 |
static const int decoder_dlgs[] = { IDD_DEC }; |
static const int decoder_dlgs[] = { IDD_DEC }; |
1780 |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1871 |
break; |
break; |
1872 |
} |
} |
1873 |
|
|
|
if (n->code == NM_RCLICK) { |
|
|
OutputDebugString("Right click"); |
|
|
} |
|
1874 |
break; |
break; |
1875 |
} |
} |
1876 |
|
|
1897 |
} |
} |
1898 |
break; |
break; |
1899 |
|
|
|
|
|
1900 |
case IDC_BITRATE_S : |
case IDC_BITRATE_S : |
1901 |
/* alternate between bitrate/desired_length metrics */ |
/* alternate between bitrate/desired_length metrics */ |
1902 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1905 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1906 |
break; |
break; |
1907 |
|
|
1908 |
|
case IDC_BITRATE_ADV : |
1909 |
|
main_download(hDlg, config); |
1910 |
|
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1911 |
|
main_mode(hDlg, config); |
1912 |
|
main_upload(hDlg, config); |
1913 |
|
break; |
1914 |
|
|
1915 |
case IDC_DECODER : |
case IDC_DECODER : |
1916 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1917 |
adv_dialog(hDlg, config, decoder_dlgs, sizeof(decoder_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, decoder_dlgs, sizeof(decoder_dlgs)/sizeof(int)); |
2044 |
|
|
2045 |
case WM_HSCROLL : |
case WM_HSCROLL : |
2046 |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
2047 |
if (config->mode == RC_MODE_2PASS2) |
if (g_use_bitrate) |
2048 |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
2049 |
else |
else |
2050 |
set_dlgitem_float(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0)); |
set_dlgitem_float(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0)); |
2146 |
return 1; |
return 1; |
2147 |
} |
} |
2148 |
|
|
2149 |
|
|
2150 |
void |
void |
2151 |
sort_zones(zone_t * zones, int zone_num, int * sel) |
sort_zones(zone_t * zones, int zone_num, int * sel) |
2152 |
{ |
{ |