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.2 2004-03-22 22:36:23 edgomez Exp $ |
* $Id: config.c,v 1.11 2010-12-18 10:16:46 Isibaar Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
43 |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); |
44 |
|
|
45 |
// Set the default post-processing settings |
// Set the default post-processing settings |
46 |
REG_GET_N("Brightness", g_config.nBrightness, 25) |
REG_GET_N("Brightness", g_config.nBrightness, 0) |
47 |
REG_GET_N("Deblock_Y", g_config.nDeblock_Y, 0) |
REG_GET_N("Deblock_Y", g_config.nDeblock_Y, 0) |
48 |
REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0) |
REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0) |
49 |
REG_GET_N("Dering", g_config.nDering, 0) |
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) |
REG_GET_N("FilmEffect", g_config.nFilmEffect, 0) |
52 |
REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0) |
REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0) |
53 |
REG_GET_N("FlipVideo", g_config.nFlipVideo, 0) |
REG_GET_N("FlipVideo", g_config.nFlipVideo, 0) |
54 |
REG_GET_N("Supported_4CC", g_config.supported_4cc, 0) |
REG_GET_N("Supported_4CC", g_config.supported_4cc, 0) |
55 |
REG_GET_N("Videoinfo_Compat", g_config.videoinfo_compat, 0) |
REG_GET_N("Videoinfo_Compat", g_config.videoinfo_compat, 0) |
56 |
|
REG_GET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio, 0) |
57 |
|
REG_GET_N("num_threads", g_config.num_threads, 0) |
58 |
|
|
59 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
60 |
} |
} |
82 |
REG_SET_N("Brightness", g_config.nBrightness); |
REG_SET_N("Brightness", g_config.nBrightness); |
83 |
REG_SET_N("Deblock_Y", g_config.nDeblock_Y); |
REG_SET_N("Deblock_Y", g_config.nDeblock_Y); |
84 |
REG_SET_N("Deblock_UV", g_config.nDeblock_UV); |
REG_SET_N("Deblock_UV", g_config.nDeblock_UV); |
85 |
REG_SET_N("Dering", g_config.nDering); |
REG_SET_N("Dering_Y", g_config.nDering_Y); |
86 |
|
REG_SET_N("Dering_UV", g_config.nDering_UV); |
87 |
REG_SET_N("FilmEffect", g_config.nFilmEffect); |
REG_SET_N("FilmEffect", g_config.nFilmEffect); |
88 |
REG_SET_N("ForceColorspace", g_config.nForceColorspace); |
REG_SET_N("ForceColorspace", g_config.nForceColorspace); |
89 |
REG_SET_N("FlipVideo", g_config.nFlipVideo); |
REG_SET_N("FlipVideo", g_config.nFlipVideo); |
90 |
REG_SET_N("Supported_4CC", g_config.supported_4cc); |
REG_SET_N("Supported_4CC", g_config.supported_4cc); |
91 |
REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat); |
REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat); |
92 |
|
REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio); |
93 |
|
|
94 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
95 |
} |
} |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
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) |
100 |
{ |
{ |
101 |
HWND hBrightness; |
HWND hBrightness; |
102 |
|
|
104 |
{ |
{ |
105 |
case WM_DESTROY: |
case WM_DESTROY: |
106 |
{ |
{ |
107 |
int nForceColorspace; |
LPARAM nForceColorspace; |
108 |
|
LPARAM aspect_ratio; |
109 |
|
|
110 |
nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); |
nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); |
111 |
if ( g_config.nForceColorspace != nForceColorspace ) |
if ( g_config.nForceColorspace != nForceColorspace ) |
112 |
{ |
{ |
113 |
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); |
114 |
|
} |
115 |
|
g_config.nForceColorspace = (int) nForceColorspace; |
116 |
|
|
117 |
|
aspect_ratio = SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_GETCURSEL, 0, 0); |
118 |
|
if ( g_config.aspect_ratio != aspect_ratio ) |
119 |
|
{ |
120 |
|
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); |
121 |
} |
} |
122 |
g_config.nForceColorspace = nForceColorspace; |
g_config.aspect_ratio = (int) aspect_ratio; |
123 |
SaveRegistryInfo(); |
SaveRegistryInfo(); |
124 |
} |
} |
125 |
break; |
break; |
137 |
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); |
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); |
138 |
|
|
139 |
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
140 |
SendMessage(hBrightness, TBM_SETRANGE, (WPARAM) (BOOL) TRUE, (LPARAM) MAKELONG(0, 50)); |
SendMessage(hBrightness, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(-96, 96)); |
141 |
SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) g_config.nBrightness); |
SendMessage(hBrightness, TBM_SETTICFREQ, (WPARAM)16, (LPARAM)0); |
142 |
|
SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness); |
143 |
|
|
144 |
|
// Load Aspect Ratio Box |
145 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (mpeg-4 first)"); |
146 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (external first)"); |
147 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"4:3"); |
148 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"16:9"); |
149 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"2.35:1"); |
150 |
|
|
151 |
|
// Select Aspect Ratio |
152 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); |
153 |
|
|
154 |
|
|
155 |
// Load Buttons |
// Load Buttons |
156 |
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); |
157 |
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); |
158 |
SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, g_config.nDering, 0); |
SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); |
159 |
|
SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); |
160 |
SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); |
SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); |
161 |
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); |
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); |
162 |
|
|
166 |
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); |
167 |
SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0); |
SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0); |
168 |
|
|
169 |
|
EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
170 |
|
EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); |
171 |
|
|
172 |
|
EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); |
173 |
|
|
174 |
// Set Date & Time of Compilation |
// Set Date & Time of Compilation |
175 |
DPRINTF("(%s %s)", __DATE__, __TIME__); |
DPRINTF("(%s %s)", __DATE__, __TIME__); |
176 |
break; |
break; |
180 |
{ |
{ |
181 |
case IDC_RESET: |
case IDC_RESET: |
182 |
ZeroMemory(&g_config, sizeof(CONFIG)); |
ZeroMemory(&g_config, sizeof(CONFIG)); |
|
g_config.nBrightness = 25; |
|
183 |
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
184 |
SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) g_config.nBrightness); |
SendMessage(hBrightness, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) g_config.nBrightness); |
185 |
// Load Buttons |
// Load Buttons |
186 |
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); |
187 |
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); |
188 |
SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, g_config.nDering, 0); |
SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0); |
189 |
|
SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0); |
190 |
SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); |
SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0); |
191 |
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); |
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0); |
192 |
g_config.nForceColorspace = 0; |
g_config.nForceColorspace = 0; |
193 |
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); |
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0); |
194 |
|
g_config.aspect_ratio = 0; |
195 |
|
SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0); |
196 |
break; |
break; |
197 |
case IDC_DEBLOCK_Y: |
case IDC_DEBLOCK_Y: |
198 |
g_config.nDeblock_Y = !g_config.nDeblock_Y; |
g_config.nDeblock_Y = !g_config.nDeblock_Y; |
200 |
case IDC_DEBLOCK_UV: |
case IDC_DEBLOCK_UV: |
201 |
g_config.nDeblock_UV = !g_config.nDeblock_UV; |
g_config.nDeblock_UV = !g_config.nDeblock_UV; |
202 |
break; |
break; |
203 |
case IDC_DERING: |
case IDC_DERINGY: |
204 |
g_config.nDering = !g_config.nDering; |
g_config.nDering_Y = !g_config.nDering_Y; |
205 |
|
break; |
206 |
|
case IDC_DERINGUV: |
207 |
|
g_config.nDering_UV = !g_config.nDering_UV; |
208 |
break; |
break; |
209 |
case IDC_FILMEFFECT: |
case IDC_FILMEFFECT: |
210 |
g_config.nFilmEffect = !g_config.nFilmEffect; |
g_config.nFilmEffect = !g_config.nFilmEffect; |
227 |
default : |
default : |
228 |
return FALSE; |
return FALSE; |
229 |
} |
} |
230 |
|
EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y); |
231 |
|
EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV); |
232 |
|
|
233 |
|
EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat); |
234 |
|
|
235 |
SaveRegistryInfo(); |
SaveRegistryInfo(); |
236 |
|
|
237 |
|
|
238 |
break; |
break; |
239 |
case WM_NOTIFY: |
case WM_NOTIFY: |
240 |
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
241 |
g_config.nBrightness = SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); |
g_config.nBrightness = (int) SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL); |
242 |
SaveRegistryInfo(); |
SaveRegistryInfo(); |
243 |
break; |
break; |
244 |
default : |
default : |