[svn] / branches / release-1_3-branch / xvidcore / dshow / src / config.c Repository:
ViewVC logotype

Diff of /branches/release-1_3-branch/xvidcore/dshow/src/config.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/xvidcore/dshow/src/config.c revision 1382, Mon Mar 22 22:36:25 2004 UTC branches/release-1_3-branch/xvidcore/dshow/src/config.c revision 2059, Wed Feb 22 19:00:26 2012 UTC
# Line 3  Line 3 
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - Configuration processing -   *  - Configuration processing -
5   *   *
6   *  Copyright(C) 2002-2004 Peter Ross <pross@xvid.org>   *  Copyright(C) 2002-2012 Peter Ross <pross@xvid.org>
7   *   *
8   *  This program is free software ; you can redistribute it and/or modify   *  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   *  it under the terms of the GNU General Public License as published by
# Line 19  Line 19 
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$
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
26  #include <windows.h>  #include <windows.h>
27  #include <commctrl.h>  #include <commctrl.h>
28    #include <xvid.h>
29  #include "config.h"  #include "config.h"
30  #include "debug.h"  #include "debug.h"
31  #include "resource.h"  #include "resource.h"
# Line 43  Line 44 
44          RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey);          RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey);
45    
46          // Set the default post-processing settings          // Set the default post-processing settings
47          REG_GET_N("Brightness", g_config.nBrightness, 25)          REG_GET_N("Brightness", g_config.nBrightness, 0)
48          REG_GET_N("Deblock_Y",  g_config.nDeblock_Y, 0)          REG_GET_N("Deblock_Y",  g_config.nDeblock_Y, 0)
49          REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0)          REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0)
50          REG_GET_N("Dering",  g_config.nDering, 0)          REG_GET_N("Dering_Y",  g_config.nDering_Y, 0)
51            REG_GET_N("Dering_UV",  g_config.nDering_UV, 0)
52          REG_GET_N("FilmEffect", g_config.nFilmEffect, 0)          REG_GET_N("FilmEffect", g_config.nFilmEffect, 0)
53          REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0)          REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0)
54          REG_GET_N("FlipVideo",  g_config.nFlipVideo, 0)          REG_GET_N("FlipVideo",  g_config.nFlipVideo, 0)
55          REG_GET_N("Supported_4CC",  g_config.supported_4cc, 0)          REG_GET_N("Supported_4CC",  g_config.supported_4cc, 0)
56          REG_GET_N("Videoinfo_Compat",  g_config.videoinfo_compat, 0)          REG_GET_N("Videoinfo_Compat",  g_config.videoinfo_compat, 0)
57            REG_GET_N("Decoder_Aspect_Ratio",  g_config.aspect_ratio, 0)
58            REG_GET_N("num_threads",  g_config.num_threads, 0)
59            REG_GET_N("cpu_flags", g_config.cpu, 0)
60        REG_GET_N("Tray_Icon", g_config.bTrayIcon, 1);
61    
62          RegCloseKey(hKey);          RegCloseKey(hKey);
63  }  }
# Line 79  Line 85 
85          REG_SET_N("Brightness", g_config.nBrightness);          REG_SET_N("Brightness", g_config.nBrightness);
86          REG_SET_N("Deblock_Y",  g_config.nDeblock_Y);          REG_SET_N("Deblock_Y",  g_config.nDeblock_Y);
87          REG_SET_N("Deblock_UV", g_config.nDeblock_UV);          REG_SET_N("Deblock_UV", g_config.nDeblock_UV);
88          REG_SET_N("Dering", g_config.nDering);          REG_SET_N("Dering_Y", g_config.nDering_Y);
89            REG_SET_N("Dering_UV", g_config.nDering_UV);
90          REG_SET_N("FilmEffect", g_config.nFilmEffect);          REG_SET_N("FilmEffect", g_config.nFilmEffect);
91          REG_SET_N("ForceColorspace", g_config.nForceColorspace);          REG_SET_N("ForceColorspace", g_config.nForceColorspace);
92          REG_SET_N("FlipVideo", g_config.nFlipVideo);          REG_SET_N("FlipVideo", g_config.nFlipVideo);
93          REG_SET_N("Supported_4CC",  g_config.supported_4cc);          REG_SET_N("Supported_4CC",  g_config.supported_4cc);
94          REG_SET_N("Videoinfo_Compat",  g_config.videoinfo_compat);          REG_SET_N("Videoinfo_Compat",  g_config.videoinfo_compat);
95            REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio);
96            REG_SET_N("num_threads",  g_config.num_threads);
97            REG_SET_N("Tray_Icon", g_config.bTrayIcon);
98    
99          RegCloseKey(hKey);          RegCloseKey(hKey);
100  }  }
101    
102    
103    
104  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)
105  {  {
106          HWND hBrightness;          HWND hBrightness;
107    
# Line 99  Line 109 
109          {          {
110          case WM_DESTROY:          case WM_DESTROY:
111                  {                  {
112                          int nForceColorspace;                          LPARAM nForceColorspace;
113                            LPARAM aspect_ratio;
114    
115                          nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0);                          nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0);
116                          if ( g_config.nForceColorspace != nForceColorspace )                          if ( g_config.nForceColorspace != nForceColorspace )
117                          {                          {
118                                  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);
119                            }
120                            g_config.nForceColorspace = (int) nForceColorspace;
121    
122                            aspect_ratio = SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_GETCURSEL, 0, 0);
123                            if ( g_config.aspect_ratio != aspect_ratio )
124                            {
125                                    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);
126                          }                          }
127                          g_config.nForceColorspace = nForceColorspace;                          g_config.aspect_ratio = (int) aspect_ratio;
128                          SaveRegistryInfo();                          SaveRegistryInfo();
129                  }                  }
130                  break;                  break;
131    
132          case WM_INITDIALOG:          case WM_INITDIALOG:
133                    {
134                            xvid_gbl_info_t info;
135                            char core[100];
136                            HINSTANCE m_hdll;
137    
138                            memset(&info, 0, sizeof(info));
139                            info.version = XVID_VERSION;
140    
141                            m_hdll = LoadLibrary(XVID_DLL_NAME);
142                            if (m_hdll != NULL) {
143    
144                                    ((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global"))
145                                            (0, XVID_GBL_INFO, &info, NULL);
146    
147                                    wsprintf(core, "Xvid MPEG-4 Video Codec v%d.%d.%d",
148                                            XVID_VERSION_MAJOR(info.actual_version),
149                                            XVID_VERSION_MINOR(info.actual_version),
150                                            XVID_VERSION_PATCH(info.actual_version));
151    
152                                    FreeLibrary(m_hdll);
153                            } else {
154                                    wsprintf(core, "xvidcore.dll not found!");
155                            }
156    
157                            SetDlgItemText(hwnd, IDC_CORE, core);
158                    }
159    
160                  // Load Force Colorspace Box                  // Load Force Colorspace Box
161                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force");                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force");
# Line 123  Line 168 
168                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0);                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0);
169    
170                  hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);                  hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
171                  SendMessage(hBrightness, TBM_SETRANGE, (WPARAM) (BOOL) TRUE, (LPARAM) MAKELONG(0, 50));                  SendMessage(hBrightness, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(-96, 96));
172                  SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) g_config.nBrightness);                  SendMessage(hBrightness, TBM_SETTICFREQ, (WPARAM)16, (LPARAM)0);
173                    SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness);
174    
175                    // Load Aspect Ratio Box
176                    SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (MPEG-4 first)");
177                    SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (external first)");
178                    SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"4:3");
179                    SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"16:9");
180                    SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"2.35:1");
181    
182                    // Select Aspect Ratio
183                    SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0);
184    
185    
186                  // Load Buttons                  // Load Buttons
187                  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);
188                  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);
189                  SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, g_config.nDering, 0);                  SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0);
190                    SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0);
191                  SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0);                  SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0);
192                  SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0);                  SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0);
193    
194                  // 4CC checkbuttons                  // 4CC checkbuttons
195                  SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DIVX, 0);                  SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DIVX, 0);
196                  SendMessage(GetDlgItem(hwnd, IDC_DX50), BM_SETCHECK, g_config.supported_4cc & SUPPORT_DX50, 0);                  SendMessage(GetDlgItem(hwnd, IDC_3IVX), BM_SETCHECK, g_config.supported_4cc & SUPPORT_3IVX, 0);
197                  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);
198                  SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0);                  SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0);
199    
200    
201                    // TrayIcon
202                    SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), BM_SETCHECK, g_config.bTrayIcon, 0);
203    
204                    EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y);
205                    EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV);
206    
207                    EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat);
208    
209                  // Set Date & Time of Compilation                  // Set Date & Time of Compilation
210                  DPRINTF("(%s %s)", __DATE__, __TIME__);                  DPRINTF("(%s %s)", __DATE__, __TIME__);
211                  break;                  break;
# Line 148  Line 215 
215                  {                  {
216                  case IDC_RESET:                  case IDC_RESET:
217                          ZeroMemory(&g_config, sizeof(CONFIG));                          ZeroMemory(&g_config, sizeof(CONFIG));
218                          g_config.nBrightness = 25;                          g_config.bTrayIcon = 1;
219    
220                          hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);                          hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
221                          SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) g_config.nBrightness);                          SendMessage(hBrightness, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) g_config.nBrightness);
222    
223                          // Load Buttons                          // Load Buttons
224                          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);
225                          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);
226                          SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, g_config.nDering, 0);                          SendMessage(GetDlgItem(hwnd, IDC_DERINGY), BM_SETCHECK, g_config.nDering_Y, 0);
227                            SendMessage(GetDlgItem(hwnd, IDC_DERINGUV), BM_SETCHECK, g_config.nDering_UV, 0);
228                          SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0);                          SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, g_config.nFilmEffect, 0);
229                          SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0);                          SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, g_config.nFlipVideo, 0);
230                          g_config.nForceColorspace = 0;                          g_config.nForceColorspace = 0;
231                          SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0);                          SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0);
232                            g_config.aspect_ratio = 0;
233                            SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0);
234                            SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), CB_SETCURSEL, g_config.bTrayIcon, 0);
235                          break;                          break;
236                  case IDC_DEBLOCK_Y:                  case IDC_DEBLOCK_Y:
237                          g_config.nDeblock_Y = !g_config.nDeblock_Y;                          g_config.nDeblock_Y = !g_config.nDeblock_Y;
# Line 167  Line 239 
239                  case IDC_DEBLOCK_UV:                  case IDC_DEBLOCK_UV:
240                          g_config.nDeblock_UV = !g_config.nDeblock_UV;                          g_config.nDeblock_UV = !g_config.nDeblock_UV;
241                          break;                          break;
242                  case IDC_DERING:                  case IDC_DERINGY:
243                          g_config.nDering = !g_config.nDering;                          g_config.nDering_Y = !g_config.nDering_Y;
244                            break;
245                    case IDC_DERINGUV:
246                            g_config.nDering_UV = !g_config.nDering_UV;
247                          break;                          break;
248                  case IDC_FILMEFFECT:                  case IDC_FILMEFFECT:
249                          g_config.nFilmEffect = !g_config.nFilmEffect;                          g_config.nFilmEffect = !g_config.nFilmEffect;
# Line 179  Line 254 
254                  case IDC_DIVX:                  case IDC_DIVX:
255                          g_config.supported_4cc ^= SUPPORT_DIVX;                          g_config.supported_4cc ^= SUPPORT_DIVX;
256                          break;                          break;
257                  case IDC_DX50:                  case IDC_3IVX:
258                          g_config.supported_4cc ^= SUPPORT_DX50;                          g_config.supported_4cc ^= SUPPORT_3IVX;
259                          break;                          break;
260                  case IDC_MP4V:                  case IDC_MP4V:
261                          g_config.supported_4cc ^= SUPPORT_MP4V;                          g_config.supported_4cc ^= SUPPORT_MP4V;
# Line 188  Line 263 
263                  case IDC_COMPAT:                  case IDC_COMPAT:
264                          g_config.videoinfo_compat = !g_config.videoinfo_compat;                          g_config.videoinfo_compat = !g_config.videoinfo_compat;
265                          break;                          break;
266                    case IDC_TRAYICON:
267                            g_config.bTrayIcon = !g_config.bTrayIcon;
268                            break;
269                  default :                  default :
270                          return FALSE;                          return FALSE;
271                  }                  }
272                    EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y);
273                    EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV);
274    
275                    EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat);
276    
277                  SaveRegistryInfo();                  SaveRegistryInfo();
278    
279    
280                  break;                  break;
281          case WM_NOTIFY:          case WM_NOTIFY:
282                  hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);                  hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
283                  g_config.nBrightness = SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL);                  g_config.nBrightness = (int) SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL);
284                  SaveRegistryInfo();                  SaveRegistryInfo();
285                  break;                  break;
286          default :          default :

Legend:
Removed from v.1382  
changed lines
  Added in v.2059

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