[svn] / trunk / xvidcore / dshow / src / config.c Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/dshow/src/config.c

Parent Directory Parent Directory | Revision Log Revision Log


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

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4