Parent Directory | Revision Log
Revision 1497 - (view) (download)
1 : | syskin | 1497 | /***************************************************************************** |
2 : | edgomez | 1382 | * |
3 : | syskin | 1497 | * XVID MPEG-4 VIDEO CODEC |
4 : | * - Configuration processing - | ||
5 : | edgomez | 1382 | * |
6 : | syskin | 1497 | * Copyright(C) 2002-2004 Peter Ross <pross@xvid.org> |
7 : | edgomez | 1382 | * |
8 : | syskin | 1497 | * 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 : | edgomez | 1382 | * |
13 : | syskin | 1497 | * 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 : | edgomez | 1382 | * |
18 : | syskin | 1497 | * 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 : | edgomez | 1382 | * |
22 : | syskin | 1497 | * $Id: config.c,v 1.11 2004-07-16 13:52:18 syskin Exp $ |
23 : | edgomez | 1382 | * |
24 : | syskin | 1497 | ****************************************************************************/ |
25 : | edgomez | 1382 | |
26 : | #include <windows.h> | ||
27 : | #include <commctrl.h> | ||
28 : | #include "config.h" | ||
29 : | syskin | 1497 | #include "debug.h" |
30 : | edgomez | 1382 | #include "resource.h" |
31 : | |||
32 : | |||
33 : | syskin | 1497 | // ----------------------------------------- |
34 : | // global config structure | ||
35 : | CONFIG g_config; | ||
36 : | edgomez | 1382 | |
37 : | |||
38 : | |||
39 : | syskin | 1497 | void LoadRegistryInfo() |
40 : | edgomez | 1382 | { |
41 : | HKEY hKey; | ||
42 : | DWORD size; | ||
43 : | syskin | 1497 | RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); |
44 : | edgomez | 1382 | |
45 : | syskin | 1497 | // Set the default post-processing settings |
46 : | REG_GET_N("Brightness", g_config.nBrightness, 25) | ||
47 : | REG_GET_N("Deblock_Y", g_config.nDeblock_Y, 0) | ||
48 : | REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0) | ||
49 : | REG_GET_N("Dering_Y", g_config.nDering_Y, 0) | ||
50 : | REG_GET_N("Dering_UV", g_config.nDering_UV, 0) | ||
51 : | 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 : | REG_GET_N("Aspect_Ratio", g_config.aspect_ratio, 0) | ||
57 : | edgomez | 1382 | |
58 : | RegCloseKey(hKey); | ||
59 : | } | ||
60 : | |||
61 : | syskin | 1497 | void SaveRegistryInfo() |
62 : | edgomez | 1382 | { |
63 : | HKEY hKey; | ||
64 : | DWORD dispo; | ||
65 : | |||
66 : | if (RegCreateKeyEx( | ||
67 : | XVID_REG_KEY, | ||
68 : | syskin | 1497 | XVID_REG_SUBKEY, |
69 : | edgomez | 1382 | 0, |
70 : | XVID_REG_CLASS, | ||
71 : | REG_OPTION_NON_VOLATILE, | ||
72 : | KEY_WRITE, | ||
73 : | syskin | 1497 | 0, |
74 : | &hKey, | ||
75 : | edgomez | 1382 | &dispo) != ERROR_SUCCESS) |
76 : | { | ||
77 : | syskin | 1497 | OutputDebugString("Couldn't create XVID_REG_SUBKEY"); |
78 : | edgomez | 1382 | return; |
79 : | } | ||
80 : | |||
81 : | syskin | 1497 | 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 : | REG_SET_N("Dering_Y", g_config.nDering_Y); | ||
85 : | REG_SET_N("Dering_UV", g_config.nDering_UV); | ||
86 : | 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 : | REG_SET_N("Aspect_Ratio", g_config.aspect_ratio); | ||
92 : | edgomez | 1382 | |
93 : | RegCloseKey(hKey); | ||
94 : | } | ||
95 : | |||
96 : | |||
97 : | |||
98 : | syskin | 1497 | BOOL CALLBACK adv_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
99 : | edgomez | 1382 | { |
100 : | syskin | 1497 | HWND hBrightness; |
101 : | edgomez | 1382 | |
102 : | syskin | 1497 | switch ( uMsg ) |
103 : | edgomez | 1382 | { |
104 : | syskin | 1497 | case WM_DESTROY: |
105 : | edgomez | 1382 | { |
106 : | syskin | 1497 | int nForceColorspace; |
107 : | int aspect_ratio; | ||
108 : | edgomez | 1382 | |
109 : | syskin | 1497 | nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); |
110 : | if ( g_config.nForceColorspace != nForceColorspace ) | ||
111 : | { | ||
112 : | 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 | 1382 | } |
114 : | syskin | 1497 | g_config.nForceColorspace = nForceColorspace; |
115 : | edgomez | 1382 | |
116 : | syskin | 1497 | 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 : | edgomez | 1382 | } |
121 : | syskin | 1497 | g_config.aspect_ratio = aspect_ratio; |
122 : | SaveRegistryInfo(); | ||
123 : | edgomez | 1382 | } |
124 : | break; | ||
125 : | |||
126 : | syskin | 1497 | case WM_INITDIALOG: |
127 : | edgomez | 1382 | |
128 : | syskin | 1497 | // 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 : | edgomez | 1382 | |
135 : | syskin | 1497 | // Select Colorspace |
136 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); | ||
137 : | edgomez | 1382 | |
138 : | syskin | 1497 | hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
139 : | 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 | 1382 | |
143 : | syskin | 1497 | // Load Aspect Ratio Box |
144 : | 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 : | 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 : | edgomez | 1382 | |
150 : | syskin | 1497 | // Select Aspect Ratio |
151 : | SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); | ||
152 : | edgomez | 1382 | |
153 : | |||
154 : | syskin | 1497 | // 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 : | 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 : | SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); | ||
160 : | SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); | ||
161 : | edgomez | 1382 | |
162 : | syskin | 1497 | // 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 : | edgomez | 1382 | |
168 : | syskin | 1497 | EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
169 : | EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); | ||
170 : | edgomez | 1382 | |
171 : | syskin | 1497 | EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); |
172 : | edgomez | 1382 | |
173 : | syskin | 1497 | // Set Date & Time of Compilation |
174 : | DPRINTF("(%s %s)", __DATE__, __TIME__); | ||
175 : | edgomez | 1382 | break; |
176 : | |||
177 : | syskin | 1497 | case WM_COMMAND: |
178 : | switch ( wParam ) | ||
179 : | edgomez | 1382 | { |
180 : | syskin | 1497 | case IDC_RESET: |
181 : | ZeroMemory(&g_config, sizeof(CONFIG)); | ||
182 : | hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); | ||
183 : | SendMessage(hBrightness, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) g_config.nBrightness); | ||
184 : | // 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 : | 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 : | 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 : | g_config.aspect_ratio = 0; | ||
194 : | SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); | ||
195 : | edgomez | 1382 | break; |
196 : | syskin | 1497 | case IDC_DEBLOCK_Y: |
197 : | g_config.nDeblock_Y = !g_config.nDeblock_Y; | ||
198 : | edgomez | 1382 | break; |
199 : | syskin | 1497 | case IDC_DEBLOCK_UV: |
200 : | g_config.nDeblock_UV = !g_config.nDeblock_UV; | ||
201 : | edgomez | 1382 | break; |
202 : | syskin | 1497 | case IDC_DERINGY: |
203 : | g_config.nDering_Y = !g_config.nDering_Y; | ||
204 : | edgomez | 1382 | break; |
205 : | syskin | 1497 | case IDC_DERINGUV: |
206 : | g_config.nDering_UV = !g_config.nDering_UV; | ||
207 : | edgomez | 1382 | break; |
208 : | syskin | 1497 | 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 : | edgomez | 1382 | } |
229 : | syskin | 1497 | EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
230 : | EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); | ||
231 : | edgomez | 1382 | |
232 : | syskin | 1497 | EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); |
233 : | edgomez | 1382 | |
234 : | syskin | 1497 | SaveRegistryInfo(); |
235 : | |||
236 : | edgomez | 1382 | |
237 : | break; | ||
238 : | syskin | 1497 | case WM_NOTIFY: |
239 : | hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); | ||
240 : | g_config.nBrightness = SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); | ||
241 : | SaveRegistryInfo(); | ||
242 : | edgomez | 1382 | break; |
243 : | default : | ||
244 : | syskin | 1497 | return FALSE; |
245 : | edgomez | 1382 | } |
246 : | syskin | 1497 | |
247 : | return TRUE; /* ok */ | ||
248 : | edgomez | 1382 | } |
249 : | |||
250 : | |||
251 : | |||
252 : | |||
253 : |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |