Parent Directory | Revision Log
Revision 1382 - (view) (download)
1 : | edgomez | 1382 | /***************************************************************************** |
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 : | * $Id: config.c,v 1.2 2004-03-22 22:36:23 edgomez Exp $ | ||
23 : | * | ||
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 : | 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", g_config.nDering, 0) | ||
50 : | REG_GET_N("FilmEffect", g_config.nFilmEffect, 0) | ||
51 : | REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0) | ||
52 : | REG_GET_N("FlipVideo", g_config.nFlipVideo, 0) | ||
53 : | REG_GET_N("Supported_4CC", g_config.supported_4cc, 0) | ||
54 : | REG_GET_N("Videoinfo_Compat", g_config.videoinfo_compat, 0) | ||
55 : | |||
56 : | RegCloseKey(hKey); | ||
57 : | } | ||
58 : | |||
59 : | void SaveRegistryInfo() | ||
60 : | { | ||
61 : | HKEY hKey; | ||
62 : | DWORD dispo; | ||
63 : | |||
64 : | if (RegCreateKeyEx( | ||
65 : | XVID_REG_KEY, | ||
66 : | XVID_REG_SUBKEY, | ||
67 : | 0, | ||
68 : | XVID_REG_CLASS, | ||
69 : | REG_OPTION_NON_VOLATILE, | ||
70 : | KEY_WRITE, | ||
71 : | 0, | ||
72 : | &hKey, | ||
73 : | &dispo) != ERROR_SUCCESS) | ||
74 : | { | ||
75 : | OutputDebugString("Couldn't create XVID_REG_SUBKEY"); | ||
76 : | return; | ||
77 : | } | ||
78 : | |||
79 : | REG_SET_N("Brightness", g_config.nBrightness); | ||
80 : | REG_SET_N("Deblock_Y", g_config.nDeblock_Y); | ||
81 : | REG_SET_N("Deblock_UV", g_config.nDeblock_UV); | ||
82 : | REG_SET_N("Dering", g_config.nDering); | ||
83 : | REG_SET_N("FilmEffect", g_config.nFilmEffect); | ||
84 : | REG_SET_N("ForceColorspace", g_config.nForceColorspace); | ||
85 : | REG_SET_N("FlipVideo", g_config.nFlipVideo); | ||
86 : | REG_SET_N("Supported_4CC", g_config.supported_4cc); | ||
87 : | REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat); | ||
88 : | |||
89 : | RegCloseKey(hKey); | ||
90 : | } | ||
91 : | |||
92 : | |||
93 : | |||
94 : | BOOL CALLBACK adv_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
95 : | { | ||
96 : | HWND hBrightness; | ||
97 : | |||
98 : | switch ( uMsg ) | ||
99 : | { | ||
100 : | case WM_DESTROY: | ||
101 : | { | ||
102 : | int nForceColorspace; | ||
103 : | nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); | ||
104 : | if ( g_config.nForceColorspace != nForceColorspace ) | ||
105 : | { | ||
106 : | 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); | ||
107 : | } | ||
108 : | g_config.nForceColorspace = nForceColorspace; | ||
109 : | SaveRegistryInfo(); | ||
110 : | } | ||
111 : | break; | ||
112 : | |||
113 : | case WM_INITDIALOG: | ||
114 : | |||
115 : | // Load Force Colorspace Box | ||
116 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force"); | ||
117 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12"); | ||
118 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2"); | ||
119 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24"); | ||
120 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32"); | ||
121 : | |||
122 : | // Select Colorspace | ||
123 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); | ||
124 : | |||
125 : | hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); | ||
126 : | SendMessage(hBrightness, TBM_SETRANGE, (WPARAM) (BOOL) TRUE, (LPARAM) MAKELONG(0, 50)); | ||
127 : | SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) g_config.nBrightness); | ||
128 : | |||
129 : | // Load Buttons | ||
130 : | SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, g_config.nDeblock_Y, 0); | ||
131 : | SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, g_config.nDeblock_UV, 0); | ||
132 : | SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, g_config.nDering, 0); | ||
133 : | SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); | ||
134 : | SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); | ||
135 : | |||
136 : | // 4CC checkbuttons | ||
137 : | SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DIVX, 0); | ||
138 : | SendMessage(GetDlgItem(hwnd, IDC_DX50), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DX50, 0); | ||
139 : | SendMessage(GetDlgItem(hwnd, IDC_MP4V), BM_SETCHECK, g_config.supported_4cc & SUPPORT_MP4V, 0); | ||
140 : | SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0); | ||
141 : | |||
142 : | // Set Date & Time of Compilation | ||
143 : | DPRINTF("(%s %s)", __DATE__, __TIME__); | ||
144 : | break; | ||
145 : | |||
146 : | case WM_COMMAND: | ||
147 : | switch ( wParam ) | ||
148 : | { | ||
149 : | case IDC_RESET: | ||
150 : | ZeroMemory(&g_config, sizeof(CONFIG)); | ||
151 : | g_config.nBrightness = 25; | ||
152 : | hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); | ||
153 : | SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) g_config.nBrightness); | ||
154 : | // 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_DERING), BM_SETCHECK, g_config.nDering, 0); | ||
158 : | SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); | ||
159 : | SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); | ||
160 : | g_config.nForceColorspace = 0; | ||
161 : | SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); | ||
162 : | |||
163 : | break; | ||
164 : | case IDC_DEBLOCK_Y: | ||
165 : | g_config.nDeblock_Y = !g_config.nDeblock_Y; | ||
166 : | break; | ||
167 : | case IDC_DEBLOCK_UV: | ||
168 : | g_config.nDeblock_UV = !g_config.nDeblock_UV; | ||
169 : | break; | ||
170 : | case IDC_DERING: | ||
171 : | g_config.nDering = !g_config.nDering; | ||
172 : | break; | ||
173 : | case IDC_FILMEFFECT: | ||
174 : | g_config.nFilmEffect = !g_config.nFilmEffect; | ||
175 : | break; | ||
176 : | case IDC_FLIPVIDEO: | ||
177 : | g_config.nFlipVideo = !g_config.nFlipVideo; | ||
178 : | break; | ||
179 : | case IDC_DIVX: | ||
180 : | g_config.supported_4cc ^= SUPPORT_DIVX; | ||
181 : | break; | ||
182 : | case IDC_DX50: | ||
183 : | g_config.supported_4cc ^= SUPPORT_DX50; | ||
184 : | break; | ||
185 : | case IDC_MP4V: | ||
186 : | g_config.supported_4cc ^= SUPPORT_MP4V; | ||
187 : | break; | ||
188 : | case IDC_COMPAT: | ||
189 : | g_config.videoinfo_compat = !g_config.videoinfo_compat; | ||
190 : | break; | ||
191 : | default : | ||
192 : | return FALSE; | ||
193 : | } | ||
194 : | SaveRegistryInfo(); | ||
195 : | break; | ||
196 : | case WM_NOTIFY: | ||
197 : | hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); | ||
198 : | g_config.nBrightness = SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); | ||
199 : | SaveRegistryInfo(); | ||
200 : | break; | ||
201 : | default : | ||
202 : | return FALSE; | ||
203 : | } | ||
204 : | |||
205 : | return TRUE; /* ok */ | ||
206 : | } | ||
207 : | |||
208 : | |||
209 : | |||
210 : | |||
211 : |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |