--- branches/dev-api-4/xvidcore/vfw/src/config.c 2004/01/27 10:09:05 1338 +++ branches/dev-api-4/xvidcore/vfw/src/config.c 2004/03/06 01:59:32 1376 @@ -76,6 +76,8 @@ HWND g_hTooltip; static int g_use_bitrate = 1; + + int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */ /* enumerates child windows, assigns tooltips */ @@ -159,17 +161,19 @@ typedef struct { char * name; - int value; + int avi_interval; /* audio overhead intervals (milliseconds) */ + float mkv_multiplier; /* mkv multiplier */ } named_int_t; -/* audio overhead intervals (milliseconds) */ +#define NO_AUDIO 5 static const named_int_t audio_type_list[] = { - { "MP3-CBR", 1000 }, - { "MP3-VBR", 24 }, - { "AC3", 64 }, - { "DTS", 21 }, - { "(None)", 0 }, + { "MP3-CBR", 1000, 48000/1152/6 }, + { "MP3-VBR", 24, 48000/1152/6 }, + { "OGG", /*?*/1000, 48000*(0.7F/1024 + 0.3F/180) }, + { "AC3", 64, 48000/1536/6 }, + { "DTS", 21, /*?*/48000/1152/6 }, + { "(None)", 0, 0 }, }; @@ -219,6 +223,7 @@ /* 2pass1 */ {"discard1pass", ®.discard1pass, 1}, + {"full1pass", ®.full1pass, 0}, /* 2pass2 */ {"keyframe_boost", ®.keyframe_boost, 10}, @@ -365,7 +370,7 @@ reg.profile = 0; for (i=0; istats); CheckDlg(hDlg, IDC_DISCARD1PASS, config->discard1pass); + CheckDlg(hDlg, IDC_FULL1PASS, config->full1pass); break; case IDD_RC_2PASS2 : @@ -1173,6 +1216,7 @@ if (GetDlgItemText(hDlg, IDC_STATS, config->stats, MAX_PATH) == 0) lstrcpy(config->stats, CONFIG_2PASS_FILE); config->discard1pass = IsDlgChecked(hDlg, IDC_DISCARD1PASS); + config->full1pass = IsDlgChecked(hDlg, IDC_FULL1PASS); break; case IDD_RC_2PASS2 : @@ -1214,8 +1258,22 @@ config->audio_rate = config_get_uint(hDlg, IDC_BITRATE_ARATE, config->audio_rate); config->audio_size = config_get_uint(hDlg, IDC_BITRATE_ASIZE, config->audio_size); - config->desired_size = config_get_uint(hDlg, IDC_BITRATE_VSIZE, config->desired_size); - config->bitrate = config_get_uint(hDlg, IDC_BITRATE_VRATE, config->bitrate); + /* the main window uses "AVI bitrate/filesize" not "video bitrate/filesize", + so we have to compensate by frames * 24 bytes */ + { + int frame_compensate = 24 * (int)( + (3600*config->hours + + 60*config->minutes + + config->seconds) * video_fps_list[config->fps].value) / 1024; + + int bitrate_compensate = (int)(24 * video_fps_list[config->fps].value) / 125; + + config->desired_size = + config_get_uint(hDlg, IDC_BITRATE_VSIZE, config->desired_size) - frame_compensate; + + config->bitrate = + config_get_uint(hDlg, IDC_BITRATE_VRATE, config->bitrate) - bitrate_compensate; + } break; case IDD_ZONE : @@ -1362,7 +1420,9 @@ (filesize = GetFileSize(hFile, NULL)) == INVALID_FILE_SIZE) { MessageBox(hDlg, "Could not get file size", "Error", 0); }else{ - SetDlgItemInt(hDlg, IDC_BITRATE_SSIZE, filesize / 1024, FALSE); + SetDlgItemInt(hDlg, + LOWORD(wParam)==IDC_BITRATE_SSELECT? IDC_BITRATE_SSIZE : IDC_BITRATE_ASIZE, + filesize / 1024, FALSE); CloseHandle(hFile); } } @@ -1395,8 +1455,8 @@ ofn.Flags |= OFN_FILEMUSTEXIST; } - if (GetSaveFileName(&ofn)) - { + if ((psi->idd==IDD_RC_2PASS1 && GetSaveFileName(&ofn)) || + (psi->idd==IDD_RC_2PASS2 && GetOpenFileName(&ofn))) { SetDlgItemText(hDlg, IDC_STATS, tmp); } } @@ -1436,7 +1496,9 @@ }else if ((HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam)==CBN_SELCHANGE) && (LOWORD(wParam)==IDC_BITRATE_TSIZE || LOWORD(wParam)==IDC_BITRATE_ARATE )) { + adv_mode(hDlg, psi->idd, psi->config); + }else if (HIWORD(wParam) == LBN_SELCHANGE && (LOWORD(wParam) == IDC_PROFILE_PROFILE || LOWORD(wParam) == IDC_LEVEL_PROFILE || @@ -1483,20 +1545,20 @@ switch (((NMHDR *)lParam)->code) { case PSN_SETACTIVE : - OutputDebugString("PSN_SET"); + DPRINTF("PSN_SET"); adv_upload(hDlg, psi->idd, psi->config); adv_mode(hDlg, psi->idd, psi->config); SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); break; case PSN_KILLACTIVE : - OutputDebugString("PSN_KILL"); + DPRINTF("PSN_KILL"); adv_download(hDlg, psi->idd, psi->config); SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); break; case PSN_APPLY : - OutputDebugString("PSN_APPLY"); + DPRINTF("PSN_APPLY"); psi->config->save = TRUE; SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); break; @@ -1518,6 +1580,11 @@ or fasle if changes were canceled. */ + +#ifndef PSH_NOCONTEXTHELP +#define PSH_NOCONTEXTHELP 0x02000000 +#endif + static BOOL adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) { PROPSHEETINFO psi[6]; @@ -1544,7 +1611,7 @@ } psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP; psh.hwndParent = hParent; psh.hInstance = g_hInst; psh.pszCaption = (LPSTR) "XviD Configuration"; @@ -1653,6 +1720,7 @@ EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); EnableDlgWindow(hDlg, IDC_BITRATE, target_en); + EnableDlgWindow(hDlg, IDC_BITRATE_ADV, target_en); EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en_slider); EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en_slider); @@ -1799,9 +1867,6 @@ break; } - if (n->code == NM_RCLICK) { - OutputDebugString("Right click"); - } break; }