[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 2112, Thu Jun 11 09:17:29 2015 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 44  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(TEXT("Brightness"), g_config.nBrightness, 0)          REG_GET_N("Brightness", g_config.nBrightness, 0)
48          REG_GET_N(TEXT("Deblock_Y"),  g_config.nDeblock_Y, 0)          REG_GET_N("Deblock_Y",  g_config.nDeblock_Y, 0)
49          REG_GET_N(TEXT("Deblock_UV"), g_config.nDeblock_UV, 0)          REG_GET_N("Deblock_UV", g_config.nDeblock_UV, 0)
50          REG_GET_N(TEXT("Dering_Y"),  g_config.nDering_Y, 0)          REG_GET_N("Dering_Y",  g_config.nDering_Y, 0)
51          REG_GET_N(TEXT("Dering_UV"),  g_config.nDering_UV, 0)          REG_GET_N("Dering_UV",  g_config.nDering_UV, 0)
52          REG_GET_N(TEXT("FilmEffect"), g_config.nFilmEffect, 0)          REG_GET_N("FilmEffect", g_config.nFilmEffect, 0)
53          REG_GET_N(TEXT("ForceColorspace"), g_config.nForceColorspace, 0)          REG_GET_N("ForceColorspace", g_config.nForceColorspace, 0)
54          REG_GET_N(TEXT("FlipVideo"),  g_config.nFlipVideo, 0)          REG_GET_N("FlipVideo",  g_config.nFlipVideo, 0)
55          REG_GET_N(TEXT("Supported_4CC"),  g_config.supported_4cc, 0)          REG_GET_N("Supported_4CC",  g_config.supported_4cc, 0)
56          REG_GET_N(TEXT("Videoinfo_Compat"),  g_config.videoinfo_compat, 0)          REG_GET_N("Videoinfo_Compat",  g_config.videoinfo_compat, 0)
57          REG_GET_N(TEXT("Decoder_Aspect_Ratio"),  g_config.aspect_ratio, 0)          REG_GET_N("Decoder_Aspect_Ratio",  g_config.aspect_ratio, 0)
58          REG_GET_N(TEXT("num_threads"),  g_config.num_threads, 0)          REG_GET_N("num_threads",  g_config.num_threads, 0)
59          REG_GET_N(TEXT("cpu_flags"), g_config.cpu, 0)          REG_GET_N("cpu_flags", g_config.cpu, 0)
60          REG_GET_N(TEXT("Tray_Icon"), g_config.bTrayIcon, 1);      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 78  Line 78 
78                          &hKey,                          &hKey,
79                          &dispo) != ERROR_SUCCESS)                          &dispo) != ERROR_SUCCESS)
80          {          {
81                  OutputDebugString(TEXT("Couldn't create XVID_REG_SUBKEY"));                  OutputDebugString("Couldn't create XVID_REG_SUBKEY");
82                  return;                  return;
83          }          }
84    
85          REG_SET_N(TEXT("Brightness"), g_config.nBrightness);          if (perfCount > 0) {
86          REG_SET_N(TEXT("Deblock_Y"),  g_config.nDeblock_Y);                  unsigned int updateCount = 0;
87          REG_SET_N(TEXT("Deblock_UV"), g_config.nDeblock_UV);                  HKEY hKey2 = hKey;
88          REG_SET_N(TEXT("Dering_Y"), g_config.nDering_Y);                  DWORD size;
89          REG_SET_N(TEXT("Dering_UV"), g_config.nDering_UV);  
90          REG_SET_N(TEXT("FilmEffect"), g_config.nFilmEffect);                  RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey);
91          REG_SET_N(TEXT("ForceColorspace"), g_config.nForceColorspace);                  REG_GET_N("PerfCount", updateCount, 0);
92          REG_SET_N(TEXT("FlipVideo"), g_config.nFlipVideo);                  RegCloseKey(hKey);
93          REG_SET_N(TEXT("Supported_4CC"),  g_config.supported_4cc);                  hKey = hKey2;
94          REG_SET_N(TEXT("Videoinfo_Compat"),  g_config.videoinfo_compat);                  updateCount += perfCount;
95          REG_SET_N(TEXT("Decoder_Aspect_Ratio"), g_config.aspect_ratio);                  REG_SET_N("PerfCount", updateCount);
96          REG_SET_N(TEXT("num_threads"),  g_config.num_threads);          }
97          REG_SET_N(TEXT("Tray_Icon"), g_config.bTrayIcon);          else {
98                    REG_SET_N("Brightness", g_config.nBrightness);
99                    REG_SET_N("Deblock_Y", g_config.nDeblock_Y);
100                    REG_SET_N("Deblock_UV", g_config.nDeblock_UV);
101                    REG_SET_N("Dering_Y", g_config.nDering_Y);
102                    REG_SET_N("Dering_UV", g_config.nDering_UV);
103                    REG_SET_N("FilmEffect", g_config.nFilmEffect);
104                    REG_SET_N("ForceColorspace", g_config.nForceColorspace);
105                    REG_SET_N("FlipVideo", g_config.nFlipVideo);
106                    REG_SET_N("Supported_4CC", g_config.supported_4cc);
107                    REG_SET_N("Videoinfo_Compat", g_config.videoinfo_compat);
108                    REG_SET_N("Decoder_Aspect_Ratio", g_config.aspect_ratio);
109                    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 105  Line 119 
119  {  {
120          HWND hBrightness;          HWND hBrightness;
121    
         UNREFERENCED_PARAMETER(lParam);  
122          switch ( uMsg )          switch ( uMsg )
123          {          {
124          case WM_DESTROY:          case WM_DESTROY:
# Line 116  Line 129 
129                          nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0);                          nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0);
130                          if ( g_config.nForceColorspace != nForceColorspace )                          if ( g_config.nForceColorspace != nForceColorspace )
131                          {                          {
132                                  MessageBox(0, TEXT("You have changed the output colorspace.\r\nClose the movie and open it for the new colorspace to take effect."), TEXT("Xvid DShow"), MB_TOPMOST);                                  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);
133                          }                          }
134                          g_config.nForceColorspace = (int) nForceColorspace;                          g_config.nForceColorspace = (int) nForceColorspace;
135    
136                          aspect_ratio = SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_GETCURSEL, 0, 0);                          aspect_ratio = SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_GETCURSEL, 0, 0);
137                          if ( g_config.aspect_ratio != aspect_ratio )                          if ( g_config.aspect_ratio != aspect_ratio )
138                          {                          {
139                                  MessageBox(0, TEXT("You have changed the default aspect ratio.\r\nClose the movie and open it for the new aspect ratio to take effect."), TEXT("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 145  Line 158 
158                                  ((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global"))                                  ((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global"))
159                                          (0, XVID_GBL_INFO, &info, NULL);                                          (0, XVID_GBL_INFO, &info, NULL);
160    
161                                  wsprintfA(core, "Xvid MPEG-4 Video Codec v%d.%d.%d",                                  wsprintf(core, "Xvid MPEG-4 Video Codec v%d.%d.%d",
162                                          XVID_VERSION_MAJOR(info.actual_version),                                          XVID_VERSION_MAJOR(info.actual_version),
163                                          XVID_VERSION_MINOR(info.actual_version),                                          XVID_VERSION_MINOR(info.actual_version),
164                                          XVID_VERSION_PATCH(info.actual_version));                                          XVID_VERSION_PATCH(info.actual_version));
165    
166                                  FreeLibrary(m_hdll);                                  FreeLibrary(m_hdll);
167                          } else {                          } else {
168                                  wsprintfA(core, "xvidcore.dll not found!");                                  wsprintf(core, "xvidcore.dll not found!");
169                          }                          }
170    
171                          SetDlgItemTextA(hwnd, IDC_CORE, core);                          SetDlgItemText(hwnd, IDC_CORE, core);
172                  }                  }
173    
174                  // Load Force Colorspace Box                  // Load Force Colorspace Box
175                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("No Force"));                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force");
176                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("YV12"));                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12");
177                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("YUY2"));                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2");
178                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("RGB24"));                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24");
179                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)TEXT("RGB32"));                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32");
180    
181                  // Select Colorspace                  // Select Colorspace
182                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0);                  SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, g_config.nForceColorspace, 0);
# Line 174  Line 187 
187                  SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness);                  SendMessage(hBrightness, TBM_SETPOS, (WPARAM)TRUE, (LPARAM) g_config.nBrightness);
188    
189                  // Load Aspect Ratio Box                  // Load Aspect Ratio Box
190                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("Auto (MPEG-4 first)"));                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (MPEG-4 first)");
191                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("Auto (external first)"));                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"Auto (external first)");
192                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("4:3"));                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"4:3");
193                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("16:9"));                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"16:9");
194                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)TEXT("2.35:1"));                  SendMessage(GetDlgItem(hwnd, IDC_USE_AR), CB_ADDSTRING, 0, (LPARAM)"2.35:1");
195    
196                  // Select Aspect Ratio                  // Select Aspect Ratio
197                  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);
# Line 198  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                  // TrayIcon
216                  SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), BM_SETCHECK, g_config.bTrayIcon, 0);                  SendMessage(GetDlgItem(hwnd, IDC_TRAYICON), BM_SETCHECK, g_config.bTrayIcon, 0);
217    
# Line 274  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.2112  
changed lines
  Added in v.2113

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