3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Configuration processing - |
* - Configuration processing - |
5 |
* |
* |
6 |
* Copyright(C) 2002-2004 Peter Ross <pross@xvid.org> |
* Copyright(C) 2002-2011 Peter Ross <pross@xvid.org> |
7 |
* |
* |
8 |
* This program is free software ; you can redistribute it and/or modify |
* This program is free software ; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: config.c,v 1.4 2004-04-18 07:55:11 syskin Exp $ |
* $Id$ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
26 |
#include <windows.h> |
#include <windows.h> |
27 |
#include <commctrl.h> |
#include <commctrl.h> |
28 |
|
#include <xvid.h> |
29 |
#include "config.h" |
#include "config.h" |
30 |
#include "debug.h" |
#include "debug.h" |
31 |
#include "resource.h" |
#include "resource.h" |
44 |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); |
45 |
|
|
46 |
// Set the default post-processing settings |
// Set the default post-processing settings |
47 |
REG_GET_N("Brightness", g_config.nBrightness, 25) |
REG_GET_N("Brightness", g_config.nBrightness, 0) |
48 |
REG_GET_N("Deblock_Y", g_config.nDeblock_Y, 0) |
REG_GET_N("Deblock_Y", g_config.nDeblock_Y, 0) |
49 |
REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0) |
REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0) |
50 |
REG_GET_N("Dering_Y", g_config.nDering_Y, 0) |
REG_GET_N("Dering_Y", g_config.nDering_Y, 0) |
54 |
REG_GET_N("FlipVideo", g_config.nFlipVideo, 0) |
REG_GET_N("FlipVideo", g_config.nFlipVideo, 0) |
55 |
REG_GET_N("Supported_4CC", g_config.supported_4cc, 0) |
REG_GET_N("Supported_4CC", g_config.supported_4cc, 0) |
56 |
REG_GET_N("Videoinfo_Compat", g_config.videoinfo_compat, 0) |
REG_GET_N("Videoinfo_Compat", g_config.videoinfo_compat, 0) |
57 |
|
REG_GET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio, 0) |
58 |
|
REG_GET_N("num_threads", g_config.num_threads, 0) |
59 |
|
REG_GET_N("cpu_flags", g_config.cpu, 0) |
60 |
|
|
61 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
62 |
} |
} |
91 |
REG_SET_N("FlipVideo", g_config.nFlipVideo); |
REG_SET_N("FlipVideo", g_config.nFlipVideo); |
92 |
REG_SET_N("Supported_4CC", g_config.supported_4cc); |
REG_SET_N("Supported_4CC", g_config.supported_4cc); |
93 |
REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat); |
REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat); |
94 |
|
REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio); |
95 |
|
REG_SET_N("num_threads", g_config.num_threads); |
96 |
|
|
97 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
98 |
} |
} |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
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) |
103 |
{ |
{ |
104 |
HWND hBrightness; |
HWND hBrightness; |
105 |
|
|
107 |
{ |
{ |
108 |
case WM_DESTROY: |
case WM_DESTROY: |
109 |
{ |
{ |
110 |
int nForceColorspace; |
LPARAM nForceColorspace; |
111 |
|
LPARAM aspect_ratio; |
112 |
|
|
113 |
nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); |
nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); |
114 |
if ( g_config.nForceColorspace != nForceColorspace ) |
if ( g_config.nForceColorspace != nForceColorspace ) |
115 |
{ |
{ |
116 |
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); |
117 |
|
} |
118 |
|
g_config.nForceColorspace = (int) nForceColorspace; |
119 |
|
|
120 |
|
aspect_ratio = SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_GETCURSEL, 0, 0); |
121 |
|
if ( g_config.aspect_ratio != aspect_ratio ) |
122 |
|
{ |
123 |
|
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); |
124 |
} |
} |
125 |
g_config.nForceColorspace = nForceColorspace; |
g_config.aspect_ratio = (int) aspect_ratio; |
126 |
SaveRegistryInfo(); |
SaveRegistryInfo(); |
127 |
} |
} |
128 |
break; |
break; |
129 |
|
|
130 |
case WM_INITDIALOG: |
case WM_INITDIALOG: |
131 |
|
{ |
132 |
|
xvid_gbl_info_t info; |
133 |
|
char core[100]; |
134 |
|
HINSTANCE m_hdll; |
135 |
|
|
136 |
|
memset(&info, 0, sizeof(info)); |
137 |
|
info.version = XVID_VERSION; |
138 |
|
|
139 |
|
m_hdll = LoadLibrary(XVID_DLL_NAME); |
140 |
|
if (m_hdll != NULL) { |
141 |
|
|
142 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
143 |
|
(0, XVID_GBL_INFO, &info, NULL); |
144 |
|
|
145 |
|
wsprintf(core, "Xvid MPEG-4 Video Codec v%d.%d.%d", |
146 |
|
XVID_VERSION_MAJOR(info.actual_version), |
147 |
|
XVID_VERSION_MINOR(info.actual_version), |
148 |
|
XVID_VERSION_PATCH(info.actual_version)); |
149 |
|
|
150 |
|
FreeLibrary(m_hdll); |
151 |
|
} else { |
152 |
|
wsprintf(core, "xvidcore.dll not found!"); |
153 |
|
} |
154 |
|
|
155 |
|
SetDlgItemText(hwnd, IDC_CORE, core); |
156 |
|
} |
157 |
|
|
158 |
// Load Force Colorspace Box |
// Load Force Colorspace Box |
159 |
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force"); |
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force"); |
170 |
SendMessage(hBrightness, TBM_SETTICFREQ, (WPARAM)16, (LPARAM)0); |
SendMessage(hBrightness, TBM_SETTICFREQ, (WPARAM)16, (LPARAM)0); |
171 |
SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness); |
SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness); |
172 |
|
|
173 |
|
// Load Aspect Ratio Box |
174 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (MPEG-4 first)"); |
175 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (external first)"); |
176 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"4:3"); |
177 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"16:9"); |
178 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"2.35:1"); |
179 |
|
|
180 |
|
// Select Aspect Ratio |
181 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); |
182 |
|
|
183 |
|
|
184 |
// Load Buttons |
// Load Buttons |
185 |
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); |
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); |
186 |
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); |
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); |
191 |
|
|
192 |
// 4CC checkbuttons |
// 4CC checkbuttons |
193 |
SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DIVX, 0); |
SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DIVX, 0); |
194 |
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); |
195 |
SendMessage(GetDlgItem(hwnd, IDC_MP4V), BM_SETCHECK, g_config.supported_4cc & SUPPORT_MP4V, 0); |
SendMessage(GetDlgItem(hwnd, IDC_MP4V), BM_SETCHECK, g_config.supported_4cc & SUPPORT_MP4V, 0); |
196 |
SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0); |
SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0); |
197 |
|
|
198 |
EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
199 |
EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); |
EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); |
200 |
|
|
201 |
|
EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); |
202 |
|
|
203 |
// Set Date & Time of Compilation |
// Set Date & Time of Compilation |
204 |
DPRINTF("(%s %s)", __DATE__, __TIME__); |
DPRINTF("(%s %s)", __DATE__, __TIME__); |
205 |
break; |
break; |
220 |
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); |
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); |
221 |
g_config.nForceColorspace = 0; |
g_config.nForceColorspace = 0; |
222 |
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); |
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); |
223 |
|
g_config.aspect_ratio = 0; |
224 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); |
225 |
break; |
break; |
226 |
case IDC_DEBLOCK_Y: |
case IDC_DEBLOCK_Y: |
227 |
g_config.nDeblock_Y = !g_config.nDeblock_Y; |
g_config.nDeblock_Y = !g_config.nDeblock_Y; |
244 |
case IDC_DIVX: |
case IDC_DIVX: |
245 |
g_config.supported_4cc ^= SUPPORT_DIVX; |
g_config.supported_4cc ^= SUPPORT_DIVX; |
246 |
break; |
break; |
247 |
case IDC_DX50: |
case IDC_3IVX: |
248 |
g_config.supported_4cc ^= SUPPORT_DX50; |
g_config.supported_4cc ^= SUPPORT_3IVX; |
249 |
break; |
break; |
250 |
case IDC_MP4V: |
case IDC_MP4V: |
251 |
g_config.supported_4cc ^= SUPPORT_MP4V; |
g_config.supported_4cc ^= SUPPORT_MP4V; |
258 |
} |
} |
259 |
EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
260 |
EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); |
EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); |
261 |
|
|
262 |
|
EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); |
263 |
|
|
264 |
SaveRegistryInfo(); |
SaveRegistryInfo(); |
265 |
|
|
266 |
|
|
267 |
break; |
break; |
268 |
case WM_NOTIFY: |
case WM_NOTIFY: |
269 |
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
270 |
g_config.nBrightness = SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); |
g_config.nBrightness = (int) SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); |
271 |
SaveRegistryInfo(); |
SaveRegistryInfo(); |
272 |
break; |
break; |
273 |
default : |
default : |