Parent Directory | Revision Log
Revision 1.8 - (view) (download)
1 : | edgomez | 1.2 | /***************************************************************************** |
2 : | * | ||
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * - Configuration processing - | ||
5 : | * | ||
6 : | * Copyright(C) 2002-2004 Peter Ross <pross@xvid.org> | ||
7 : | * | ||
8 : | * 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 | ||
10 : | * the Free Software Foundation ; either version 2 of the License, or | ||
11 : | * (at your option) any later version. | ||
12 : | * | ||
13 : | * This program is distributed in the hope that it will be useful, | ||
14 : | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
15 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 : | * GNU General Public License for more details. | ||
17 : | * | ||
18 : | * You should have received a copy of the GNU General Public License | ||
19 : | * along with this program ; if not, write to the Free Software | ||
20 : | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 : | * | ||
22 : | suxen_drol | 1.8 | * $Id: config.c,v 1.7 2004/11/22 05:47:26 syskin Exp $ |
23 : | edgomez | 1.2 | * |
24 : | ****************************************************************************/ | ||
25 : | |||
26 : | #include <windows.h> | ||
27 : | #include <commctrl.h> | ||
28 : | #include "config.h" | ||
29 : | #include "debug.h" | ||
30 : | #include "resource.h" | ||
31 : | |||
32 : | |||
33 : | // ----------------------------------------- | ||
34 : | // global config structure | ||
35 : | CONFIG g_config; | ||
36 : | |||
37 : | |||
38 : | |||
39 : | void LoadRegistryInfo() | ||
40 : | { | ||
41 : | HKEY hKey; | ||
42 : | DWORD size; | ||
43 : | RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); | ||
44 : | |||
45 : | // Set the default post-processing settings | ||
46 : | syskin | 1.7 | REG_GET_N("Brightness", g_config.nBrightness, 0) |
47 : | edgomez | 1.2 | REG_GET_N("Deblock_Y", g_config.nDeblock_Y, 0) |
48 : | REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0) | ||
49 : | syskin | 1.4 | REG_GET_N("Dering_Y", g_config.nDering_Y, 0) |
50 : | REG_GET_N("Dering_UV", g_config.nDering_UV, 0) | ||
51 : | edgomez | 1.2 | REG_GET_N("FilmEffect", g_config.nFilmEffect, 0) |
52 : | REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0) | ||
53 : | REG_GET_N("FlipVideo", g_config.nFlipVideo, 0) | ||
54 : | REG_GET_N("Supported_4CC", g_config.supported_4cc, 0) | ||
55 : | REG_GET_N("Videoinfo_Compat", g_config.videoinfo_compat, 0) | ||
56 : | suxen_drol | 1.8 | REG_GET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio, 0) |
57 : | edgomez | 1.2 | |
58 : | RegCloseKey(hKey); | ||
59 : | } | ||
60 : | |||
61 : | void SaveRegistryInfo() | ||
62 : | { | ||
63 : | HKEY hKey; | ||
64 : | DWORD dispo; | ||
65 : | |||
66 : | if (RegCreateKeyEx( | ||
67 : | XVID_REG_KEY, | ||
68 : | XVID_REG_SUBKEY, | ||
69 : | 0, | ||
70 : | XVID_REG_CLASS, | ||
71 : | REG_OPTION_NON_VOLATILE, | ||
72 : | KEY_WRITE, | ||
73 : | 0, | ||
74 : | &hKey, | ||
75 : | &dispo) != ERROR_SUCCESS) | ||
76 : | { | ||
77 : | OutputDebugString("Couldn't create XVID_REG_SUBKEY"); | ||
78 : | return; | ||
79 : | } | ||
80 : | |||
81 : | REG_SET_N("Brightness", g_config.nBrightness); | ||
82 : | REG_SET_N("Deblock_Y", g_config.nDeblock_Y); | ||
83 : | REG_SET_N("Deblock_UV", g_config.nDeblock_UV); | ||
84 : | syskin | 1.4 | REG_SET_N("Dering_Y", g_config.nDering_Y); |
85 : | REG_SET_N("Dering_UV", g_config.nDering_UV); | ||
86 : | edgomez | 1.2 | REG_SET_N("FilmEffect", g_config.nFilmEffect); |
87 : | REG_SET_N("ForceColorspace", g_config.nForceColorspace); | ||
88 : | REG_SET_N("FlipVideo", g_config.nFlipVideo); | ||
89 : | REG_SET_N("Supported_4CC", g_config.supported_4cc); | ||
90 : | REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat); | ||
91 : | suxen_drol | 1.8 | REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio); |
92 : | edgomez | 1.2 | |
93 : | RegCloseKey(hKey); | ||
94 : | } | ||
95 : | |||
96 : | |||
97 : | |||
98 : | BOOL CALLBACK adv_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
99 : | { | ||
100 : | HWND hBrightness; | ||
101 : | |||
102 : | switch ( uMsg ) | ||
103 : | { | ||
104 : | case WM_DESTROY: | ||
105 : | { | ||
106 : | int nForceColorspace; | ||
107 : | syskin | 1.5 | int aspect_ratio; |
108 : | |||
109 : | edgomez | 1.2 | nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); |
110 : | if ( g_config.nForceColorspace != nForceColorspace ) | ||
111 : | { | ||
112 : | syskin | 1.5 | 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); |
113 : | edgomez | 1.2 | } |
114 : | g_config.nForceColorspace = nForceColorspace; | ||
115 : | syskin | 1.5 | |
116 : | aspect_ratio = SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_GETCURSEL, 0, 0); | ||
117 : | if ( g_config.aspect_ratio != aspect_ratio ) | ||
118 : | { | ||
119 : | 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); | ||
120 : | } | ||
121 : | g_config.aspect_ratio = aspect_ratio; | ||
122 : | edgomez | 1.2 | SaveRegistryInfo(); |
123 : | } | ||
124 : | break; | ||
125 : | |||
126 : | case WM_INITDIALOG: | ||
127 : | |||
128 : | // Load Force Colorspace Box | ||
129 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force"); | ||
130 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12"); | ||
131 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2"); | ||
132 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24"); | ||
133 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32"); | ||
134 : | |||
135 : | // Select Colorspace | ||
136 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); | ||
137 : | |||
138 : | hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); | ||
139 : | suxen_drol | 1.3 | SendMessage(hBrightness, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(-96, 96)); |
140 : | SendMessage(hBrightness, TBM_SETTICFREQ, (WPARAM)16, (LPARAM)0); | ||
141 : | SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness); | ||
142 : | edgomez | 1.2 | |
143 : | syskin | 1.5 | // Load Aspect Ratio Box |
144 : | syskin | 1.6 | SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (mpeg-4 first)"); |
145 : | SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (external first)"); | ||
146 : | syskin | 1.5 | SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"4:3"); |
147 : | SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"16:9"); | ||
148 : | SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"2.35:1"); | ||
149 : | |||
150 : | // Select Aspect Ratio | ||
151 : | SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); | ||
152 : | |||
153 : | |||
154 : | edgomez | 1.2 | // Load Buttons |
155 : | SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); | ||
156 : | SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); | ||
157 : | syskin | 1.4 | SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); |
158 : | SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); | ||
159 : | edgomez | 1.2 | SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); |
160 : | SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); | ||
161 : | |||
162 : | // 4CC checkbuttons | ||
163 : | SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DIVX, 0); | ||
164 : | SendMessage(GetDlgItem(hwnd, IDC_DX50), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DX50, 0); | ||
165 : | SendMessage(GetDlgItem(hwnd, IDC_MP4V), BM_SETCHECK, g_config.supported_4cc & SUPPORT_MP4V, 0); | ||
166 : | SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0); | ||
167 : | |||
168 : | syskin | 1.4 | EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
169 : | EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); | ||
170 : | |||
171 : | syskin | 1.6 | EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); |
172 : | syskin | 1.5 | |
173 : | edgomez | 1.2 | // Set Date & Time of Compilation |
174 : | DPRINTF("(%s %s)", __DATE__, __TIME__); | ||
175 : | break; | ||
176 : | |||
177 : | case WM_COMMAND: | ||
178 : | switch ( wParam ) | ||
179 : | { | ||
180 : | case IDC_RESET: | ||
181 : | ZeroMemory(&g_config, sizeof(CONFIG)); | ||
182 : | hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); | ||
183 : | suxen_drol | 1.3 | SendMessage(hBrightness, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) g_config.nBrightness); |
184 : | edgomez | 1.2 | // Load Buttons |
185 : | 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); | ||
187 : | syskin | 1.4 | SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); |
188 : | SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); | ||
189 : | edgomez | 1.2 | SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); |
190 : | SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); | ||
191 : | g_config.nForceColorspace = 0; | ||
192 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); | ||
193 : | syskin | 1.5 | g_config.aspect_ratio = 0; |
194 : | SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); | ||
195 : | edgomez | 1.2 | break; |
196 : | case IDC_DEBLOCK_Y: | ||
197 : | g_config.nDeblock_Y = !g_config.nDeblock_Y; | ||
198 : | break; | ||
199 : | case IDC_DEBLOCK_UV: | ||
200 : | g_config.nDeblock_UV = !g_config.nDeblock_UV; | ||
201 : | break; | ||
202 : | syskin | 1.4 | case IDC_DERINGY: |
203 : | g_config.nDering_Y = !g_config.nDering_Y; | ||
204 : | break; | ||
205 : | case IDC_DERINGUV: | ||
206 : | g_config.nDering_UV = !g_config.nDering_UV; | ||
207 : | edgomez | 1.2 | break; |
208 : | case IDC_FILMEFFECT: | ||
209 : | g_config.nFilmEffect = !g_config.nFilmEffect; | ||
210 : | break; | ||
211 : | case IDC_FLIPVIDEO: | ||
212 : | g_config.nFlipVideo = !g_config.nFlipVideo; | ||
213 : | break; | ||
214 : | case IDC_DIVX: | ||
215 : | g_config.supported_4cc ^= SUPPORT_DIVX; | ||
216 : | break; | ||
217 : | case IDC_DX50: | ||
218 : | g_config.supported_4cc ^= SUPPORT_DX50; | ||
219 : | break; | ||
220 : | case IDC_MP4V: | ||
221 : | g_config.supported_4cc ^= SUPPORT_MP4V; | ||
222 : | break; | ||
223 : | case IDC_COMPAT: | ||
224 : | g_config.videoinfo_compat = !g_config.videoinfo_compat; | ||
225 : | break; | ||
226 : | default : | ||
227 : | return FALSE; | ||
228 : | } | ||
229 : | syskin | 1.4 | EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
230 : | EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); | ||
231 : | syskin | 1.6 | |
232 : | EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); | ||
233 : | |||
234 : | edgomez | 1.2 | SaveRegistryInfo(); |
235 : | syskin | 1.4 | |
236 : | |||
237 : | edgomez | 1.2 | break; |
238 : | case WM_NOTIFY: | ||
239 : | hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); | ||
240 : | g_config.nBrightness = SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); | ||
241 : | SaveRegistryInfo(); | ||
242 : | break; | ||
243 : | default : | ||
244 : | return FALSE; | ||
245 : | } | ||
246 : | |||
247 : | return TRUE; /* ok */ | ||
248 : | } | ||
249 : | |||
250 : | |||
251 : | |||
252 : | |||
253 : |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |