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

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

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

revision 1994, Wed May 18 16:12:47 2011 UTC revision 2113, Sun Jun 14 19:17:57 2015 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-2011 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 25  Line 25 
25    
26  #include <windows.h>  #include <windows.h>
27  #include <commctrl.h>  #include <commctrl.h>
28  #include <xvid.h>               // Xvid API  #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 57  Line 57 
57          REG_GET_N("Decoder_Aspect_Ratio",  g_config.aspect_ratio, 0)          REG_GET_N("Decoder_Aspect_Ratio",  g_config.aspect_ratio, 0)
58          REG_GET_N("num_threads",  g_config.num_threads, 0)          REG_GET_N("num_threads",  g_config.num_threads, 0)
59          REG_GET_N("cpu_flags", g_config.cpu, 0)          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  }  }
64    
65  void SaveRegistryInfo()  void SaveRegistryInfo(int perfCount)
66  {  {
67          HKEY hKey;          HKEY hKey;
68          DWORD dispo;          DWORD dispo;
# Line 81  Line 82 
82                  return;                  return;
83          }          }
84    
85            if (perfCount > 0) {
86                    unsigned int updateCount = 0;
87                    HKEY hKey2 = hKey;
88                    DWORD size;
89    
90                    RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey);
91                    REG_GET_N("PerfCount", updateCount, 0);
92                    RegCloseKey(hKey);
93                    hKey = hKey2;
94                    updateCount += perfCount;
95                    REG_SET_N("PerfCount", updateCount);
96            }
97            else {
98          REG_SET_N("Brightness", g_config.nBrightness);          REG_SET_N("Brightness", g_config.nBrightness);
99          REG_SET_N("Deblock_Y",  g_config.nDeblock_Y);          REG_SET_N("Deblock_Y",  g_config.nDeblock_Y);
100          REG_SET_N("Deblock_UV", g_config.nDeblock_UV);          REG_SET_N("Deblock_UV", g_config.nDeblock_UV);
# Line 93  Line 107 
107          REG_SET_N("Videoinfo_Compat",  g_config.videoinfo_compat);          REG_SET_N("Videoinfo_Compat",  g_config.videoinfo_compat);
108          REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio);          REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio);
109          REG_SET_N("num_threads",  g_config.num_threads);          REG_SET_N("num_threads",  g_config.num_threads);
110                    REG_SET_N("Tray_Icon", g_config.bTrayIcon);
111            }
112    
113          RegCloseKey(hKey);          RegCloseKey(hKey);
114  }  }
# Line 123  Line 139 
139                                  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);                                  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);
140                          }                          }
141                          g_config.aspect_ratio = (int) aspect_ratio;                          g_config.aspect_ratio = (int) aspect_ratio;
142                          SaveRegistryInfo();                          SaveRegistryInfo(0);
143                  }                  }
144                  break;                  break;
145    
# Line 195  Line 211 
211                  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);
212                  SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0);                  SendMessage(GetDlgItem(hwnd, IDC_COMPAT), BM_SETCHECK, g_config.videoinfo_compat, 0);
213    
214    
215                    // TrayIcon
216                    SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), BM_SETCHECK, g_config.bTrayIcon, 0);
217    
218                  EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y);                  EnableWindow(GetDlgItem(hwnd,IDC_DERINGY),g_config.nDeblock_Y);
219                  EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV);                  EnableWindow(GetDlgItem(hwnd,IDC_DERINGUV),g_config.nDeblock_UV);
220    
# Line 209  Line 229 
229                  {                  {
230                  case IDC_RESET:                  case IDC_RESET:
231                          ZeroMemory(&g_config, sizeof(CONFIG));                          ZeroMemory(&g_config, sizeof(CONFIG));
232                            g_config.bTrayIcon = 1;
233    
234                          hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);                          hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
235                          SendMessage(hBrightness, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) g_config.nBrightness);                          SendMessage(hBrightness, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) g_config.nBrightness);
236    
237                          // Load Buttons                          // Load Buttons
238                          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);
239                          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);
# Line 222  Line 245 
245                          SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0);                          SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0);
246                          g_config.aspect_ratio = 0;                          g_config.aspect_ratio = 0;
247                          SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0);                          SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_SETCURSEL, g_config.aspect_ratio, 0);
248                            SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), CB_SETCURSEL, g_config.bTrayIcon, 0);
249                          break;                          break;
250                  case IDC_DEBLOCK_Y:                  case IDC_DEBLOCK_Y:
251                          g_config.nDeblock_Y = !g_config.nDeblock_Y;                          g_config.nDeblock_Y = !g_config.nDeblock_Y;
# Line 253  Line 277 
277                  case IDC_COMPAT:                  case IDC_COMPAT:
278                          g_config.videoinfo_compat = !g_config.videoinfo_compat;                          g_config.videoinfo_compat = !g_config.videoinfo_compat;
279                          break;                          break;
280                    case IDC_TRAYICON:
281                            g_config.bTrayIcon = !g_config.bTrayIcon;
282                            break;
283                  default :                  default :
284                          return FALSE;                          return FALSE;
285                  }                  }
# Line 261  Line 288 
288    
289                  EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat);                  EnableWindow(GetDlgItem(hwnd, IDC_USE_AR), !g_config.videoinfo_compat);
290    
291                  SaveRegistryInfo();                  SaveRegistryInfo(0);
292    
293    
294                  break;                  break;
295          case WM_NOTIFY:          case WM_NOTIFY:
296                  hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);                  hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
297                  g_config.nBrightness = (int) SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL);                  g_config.nBrightness = (int) SendMessage(hBrightness, TBM_GETPOS, (WPARAM)NULL, (LPARAM)NULL);
298                  SaveRegistryInfo();                  SaveRegistryInfo(0);
299                  break;                  break;
300          default :          default :
301                  return FALSE;                  return FALSE;

Legend:
Removed from v.1994  
changed lines
  Added in v.2113

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