--- trunk/xvidcore/dshow/src/config.c 2008/11/26 10:11:31 1802 +++ trunk/xvidcore/dshow/src/config.c 2011/07/06 13:50:28 2022 @@ -3,7 +3,7 @@ * XVID MPEG-4 VIDEO CODEC * - Configuration processing - * - * Copyright(C) 2002-2004 Peter Ross + * Copyright(C) 2002-2011 Peter Ross * * This program is free software ; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,12 +19,13 @@ * 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.9 2008-11-26 10:11:31 Isibaar Exp $ + * $Id$ * ****************************************************************************/ #include #include +#include // Xvid API #include "config.h" #include "debug.h" #include "resource.h" @@ -43,17 +44,20 @@ RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); // Set the default post-processing settings - 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_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(TEXT("Brightness"), g_config.nBrightness, 0) + REG_GET_N(TEXT("Deblock_Y"), g_config.nDeblock_Y, 0) + REG_GET_N(TEXT("Deblock_UV"), g_config.nDeblock_UV, 0) + REG_GET_N(TEXT("Dering_Y"), g_config.nDering_Y, 0) + REG_GET_N(TEXT("Dering_UV"), g_config.nDering_UV, 0) + REG_GET_N(TEXT("FilmEffect"), g_config.nFilmEffect, 0) + REG_GET_N(TEXT("ForceColorspace"), g_config.nForceColorspace, 0) + REG_GET_N(TEXT("FlipVideo"), g_config.nFlipVideo, 0) + REG_GET_N(TEXT("Supported_4CC"), g_config.supported_4cc, 0) + REG_GET_N(TEXT("Videoinfo_Compat"), g_config.videoinfo_compat, 0) + REG_GET_N(TEXT("Decoder_Aspect_Ratio"), g_config.aspect_ratio, 0) + REG_GET_N(TEXT("num_threads"), g_config.num_threads, 0) + REG_GET_N(TEXT("cpu_flags"), g_config.cpu, 0) + REG_GET_N(TEXT("Tray_Icon"), g_config.bTrayIcon, 1); RegCloseKey(hKey); } @@ -74,63 +78,92 @@ &hKey, &dispo) != ERROR_SUCCESS) { - OutputDebugString("Couldn't create XVID_REG_SUBKEY"); + OutputDebugString(TEXT("Couldn't create XVID_REG_SUBKEY")); return; } - 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_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(TEXT("Brightness"), g_config.nBrightness); + REG_SET_N(TEXT("Deblock_Y"), g_config.nDeblock_Y); + REG_SET_N(TEXT("Deblock_UV"), g_config.nDeblock_UV); + REG_SET_N(TEXT("Dering_Y"), g_config.nDering_Y); + REG_SET_N(TEXT("Dering_UV"), g_config.nDering_UV); + REG_SET_N(TEXT("FilmEffect"), g_config.nFilmEffect); + REG_SET_N(TEXT("ForceColorspace"), g_config.nForceColorspace); + REG_SET_N(TEXT("FlipVideo"), g_config.nFlipVideo); + REG_SET_N(TEXT("Supported_4CC"), g_config.supported_4cc); + REG_SET_N(TEXT("Videoinfo_Compat"), g_config.videoinfo_compat); + REG_SET_N(TEXT("Decoder_Aspect_Ratio"), g_config.aspect_ratio); + REG_SET_N(TEXT("num_threads"), g_config.num_threads); + REG_SET_N(TEXT("Tray_Icon"), g_config.bTrayIcon); 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; + UNREFERENCED_PARAMETER(lParam); switch ( uMsg ) { case WM_DESTROY: { - int nForceColorspace; - int aspect_ratio; + 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", MB_TOPMOST); + MessageBox(0, TEXT("You have changed the output colorspace.\r\nClose the movie and open it for the new colorspace to take effect."), TEXT("Xvid DShow"), MB_TOPMOST); } - g_config.nForceColorspace = nForceColorspace; + 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); + MessageBox(0, TEXT("You have changed the default aspect ratio.\r\nClose the movie and open it for the new aspect ratio to take effect."), TEXT("Xvid DShow"), MB_TOPMOST); } - g_config.aspect_ratio = aspect_ratio; + g_config.aspect_ratio = (int) aspect_ratio; SaveRegistryInfo(); } break; case WM_INITDIALOG: + { + xvid_gbl_info_t info; + char core[100]; + HINSTANCE m_hdll; + + memset(&info, 0, sizeof(info)); + info.version = XVID_VERSION; + + m_hdll = LoadLibrary(XVID_DLL_NAME); + if (m_hdll != NULL) { + + ((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) + (0, XVID_GBL_INFO, &info, NULL); + + wsprintfA(core, "Xvid MPEG-4 Video Codec v%d.%d.%d", + XVID_VERSION_MAJOR(info.actual_version), + XVID_VERSION_MINOR(info.actual_version), + XVID_VERSION_PATCH(info.actual_version)); + + FreeLibrary(m_hdll); + } else { + wsprintfA(core, "xvidcore.dll not found!"); + } + + SetDlgItemTextA(hwnd, IDC_CORE, core); + } // Load Force Colorspace Box - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force"); - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12"); - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2"); - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24"); - SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32"); + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("No Force")); + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("YV12")); + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("YUY2")); + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("RGB24")); + SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("RGB32")); // Select Colorspace SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); @@ -141,11 +174,11 @@ 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"); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("Auto (MPEG-4 first)")); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("Auto (external first)")); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("4:3")); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("16:9")); + SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("2.35:1")); // Select Aspect Ratio SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); @@ -161,10 +194,13 @@ // 4CC checkbuttons SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DIVX, 0); - SendMessage(GetDlgItem(hwnd, IDC_DX50), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DX50, 0); + SendMessage(GetDlgItem(hwnd, IDC_3IVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_3IVX, 0); 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); + // TrayIcon + SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), BM_SETCHECK, g_config.bTrayIcon, 0); + EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); @@ -179,8 +215,11 @@ { case IDC_RESET: ZeroMemory(&g_config, sizeof(CONFIG)); + g_config.bTrayIcon = 1; + hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); 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); @@ -192,6 +231,7 @@ 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); + SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), CB_SETCURSEL, g_config.bTrayIcon, 0); break; case IDC_DEBLOCK_Y: g_config.nDeblock_Y = !g_config.nDeblock_Y; @@ -214,8 +254,8 @@ case IDC_DIVX: g_config.supported_4cc ^= SUPPORT_DIVX; break; - case IDC_DX50: - g_config.supported_4cc ^= SUPPORT_DX50; + case IDC_3IVX: + g_config.supported_4cc ^= SUPPORT_3IVX; break; case IDC_MP4V: g_config.supported_4cc ^= SUPPORT_MP4V; @@ -223,6 +263,9 @@ case IDC_COMPAT: g_config.videoinfo_compat = !g_config.videoinfo_compat; break; + case IDC_TRAYICON: + g_config.bTrayIcon = !g_config.bTrayIcon; + break; default : return FALSE; } @@ -237,7 +280,7 @@ 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 :