--- trunk/xvidcore/dshow/src/config.c 2004/03/22 22:36:25 1382 +++ trunk/xvidcore/dshow/src/config.c 2010/12/22 15:21:13 1916 @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: config.c,v 1.2 2004-03-22 22:36:23 edgomez Exp $ + * $Id: config.c,v 1.12 2010-12-22 15:21:13 Isibaar Exp $ * ****************************************************************************/ @@ -43,15 +43,19 @@ RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); // Set the default post-processing settings - REG_GET_N("Brightness", g_config.nBrightness, 25) + REG_GET_N("Brightness", g_config.nBrightness, 0) REG_GET_N("Deblock_Y", g_config.nDeblock_Y, 0) REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0) - REG_GET_N("Dering", g_config.nDering, 0) + REG_GET_N("Dering_Y", g_config.nDering_Y, 0) + REG_GET_N("Dering_UV", g_config.nDering_UV, 0) REG_GET_N("FilmEffect", g_config.nFilmEffect, 0) REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0) REG_GET_N("FlipVideo", g_config.nFlipVideo, 0) REG_GET_N("Supported_4CC", g_config.supported_4cc, 0) REG_GET_N("Videoinfo_Compat", g_config.videoinfo_compat, 0) + REG_GET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio, 0) + REG_GET_N("num_threads", g_config.num_threads, 0) + REG_GET_N("cpu_flags", g_config.cpu, 0) RegCloseKey(hKey); } @@ -79,19 +83,22 @@ REG_SET_N("Brightness", g_config.nBrightness); REG_SET_N("Deblock_Y", g_config.nDeblock_Y); REG_SET_N("Deblock_UV", g_config.nDeblock_UV); - REG_SET_N("Dering", g_config.nDering); + REG_SET_N("Dering_Y", g_config.nDering_Y); + REG_SET_N("Dering_UV", g_config.nDering_UV); REG_SET_N("FilmEffect", g_config.nFilmEffect); REG_SET_N("ForceColorspace", g_config.nForceColorspace); REG_SET_N("FlipVideo", g_config.nFlipVideo); REG_SET_N("Supported_4CC", g_config.supported_4cc); REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat); + REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio); + REG_SET_N("num_threads", g_config.num_threads); RegCloseKey(hKey); } -BOOL CALLBACK adv_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK adv_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { HWND hBrightness; @@ -99,13 +106,22 @@ { case WM_DESTROY: { - int nForceColorspace; + LPARAM nForceColorspace; + LPARAM aspect_ratio; + nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); if ( g_config.nForceColorspace != nForceColorspace ) { - MessageBox(0, "You have changed the output colorspace.\r\nClose the movie and open it for the new colorspace to take effect.", "XviD DShow", 0); + MessageBox(0, "You have changed the output colorspace.\r\nClose the movie and open it for the new colorspace to take effect.", "Xvid DShow", MB_TOPMOST); + } + g_config.nForceColorspace = (int) nForceColorspace; + + aspect_ratio = SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_GETCURSEL, 0, 0); + if ( g_config.aspect_ratio != aspect_ratio ) + { + MessageBox(0, "You have changed the default aspect ratio.\r\nClose the movie and open it for the new aspect ratio to take effect.", "Xvid DShow", MB_TOPMOST); } - g_config.nForceColorspace = nForceColorspace; + g_config.aspect_ratio = (int) aspect_ratio; SaveRegistryInfo(); } break; @@ -123,13 +139,26 @@ SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); - SendMessage(hBrightness, TBM_SETRANGE, (WPARAM) (BOOL) TRUE, (LPARAM) MAKELONG(0, 50)); - SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) g_config.nBrightness); + SendMessage(hBrightness, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(-96, 96)); + SendMessage(hBrightness, TBM_SETTICFREQ, (WPARAM)16, (LPARAM)0); + SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness); + + // Load Aspect Ratio Box + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (mpeg-4 first)"); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (external first)"); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"4:3"); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"16:9"); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"2.35:1"); + + // Select Aspect Ratio + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); + // Load Buttons SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); - SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, g_config.nDering, 0); + SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); + SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); @@ -139,6 +168,11 @@ SendMessage(GetDlgItem(hwnd, IDC_MP4V), BM_SETCHECK, g_config.supported_4cc & SUPPORT_MP4V, 0); SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0); + EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); + EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); + + EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); + // Set Date & Time of Compilation DPRINTF("(%s %s)", __DATE__, __TIME__); break; @@ -148,18 +182,19 @@ { case IDC_RESET: ZeroMemory(&g_config, sizeof(CONFIG)); - g_config.nBrightness = 25; hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); - SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) g_config.nBrightness); + SendMessage(hBrightness, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) g_config.nBrightness); // Load Buttons SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); - SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, g_config.nDering, 0); + SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); + SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); g_config.nForceColorspace = 0; SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); - + g_config.aspect_ratio = 0; + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); break; case IDC_DEBLOCK_Y: g_config.nDeblock_Y = !g_config.nDeblock_Y; @@ -167,8 +202,11 @@ case IDC_DEBLOCK_UV: g_config.nDeblock_UV = !g_config.nDeblock_UV; break; - case IDC_DERING: - g_config.nDering = !g_config.nDering; + case IDC_DERINGY: + g_config.nDering_Y = !g_config.nDering_Y; + break; + case IDC_DERINGUV: + g_config.nDering_UV = !g_config.nDering_UV; break; case IDC_FILMEFFECT: g_config.nFilmEffect = !g_config.nFilmEffect; @@ -191,11 +229,18 @@ default : return FALSE; } + EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); + EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); + + EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); + SaveRegistryInfo(); + + break; case WM_NOTIFY: hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); - g_config.nBrightness = SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); + g_config.nBrightness = (int) SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); SaveRegistryInfo(); break; default :