[svn] / trunk / vfw / src / driverproc.c Repository:
ViewVC logotype

Diff of /trunk/vfw/src/driverproc.c

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

revision 3, Fri Mar 8 02:46:11 2002 UTC revision 499, Sat Sep 21 03:11:36 2002 UTC
# Line 23  Line 23 
23   *   *
24   *      History:   *      History:
25   *   *
26   *      ... ???   *      31.08.2002      Configure() export
27   *      01.12.2001      inital version; (c)2001 peter ross <suxen_drol@hotmail.com>   *      01.12.2001      inital version; (c)2001 peter ross <pross@xvid.org>
28   *   *
29   *************************************************************************/   *************************************************************************/
30    
# Line 36  Line 36 
36  #include "resource.h"  #include "resource.h"
37    
38    
39  BOOL APIENTRY DllMain(  BOOL WINAPI DllMain(
40          HANDLE hModule,          HANDLE hModule,
41          DWORD  ul_reason_for_call,          DWORD  ul_reason_for_call,
42          LPVOID lpReserved)          LPVOID lpReserved)
# Line 47  Line 47 
47    
48    
49    
50  __declspec(dllexport) LRESULT WINAPI DriverProc(  /* __declspec(dllexport) */ LRESULT WINAPI DriverProc(
51          DWORD dwDriverId,          DWORD dwDriverId,
52          HDRVR hDriver,          HDRVR hDriver,
53          UINT uMsg,          UINT uMsg,
# Line 55  Line 55 
55          LPARAM lParam2)          LPARAM lParam2)
56  {  {
57          CODEC * codec = (CODEC *)dwDriverId;          CODEC * codec = (CODEC *)dwDriverId;
         CONFIG temp;  
58    
59          switch(uMsg)          switch(uMsg)
60          {          {
# Line 64  Line 63 
63    
64          case DRV_LOAD :          case DRV_LOAD :
65          case DRV_FREE :          case DRV_FREE :
66                  DRV_OK;                  return DRV_OK;
67    
68          case DRV_OPEN :          case DRV_OPEN :
69                  DEBUG("DRV_OPEN");                  DEBUG("DRV_OPEN");
70                  {                  {
71                          ICOPEN * icopen = (ICOPEN *)lParam2;                          ICOPEN * icopen = (ICOPEN *)lParam2;
72    
73                          if (icopen != NULL && icopen->fccType != ICTYPE_VIDEO) {                          if (icopen != NULL && icopen->fccType != ICTYPE_VIDEO)
74                            {
75                                  return DRV_CANCEL;                                  return DRV_CANCEL;
76                          }                          }
77    
78                          codec = malloc(sizeof(CODEC));                          codec = malloc(sizeof(CODEC));
79    
80                          if (codec == NULL)                          if (codec == NULL)
81                          {                          {
82                                  if (icopen != NULL) {                                  if (icopen != NULL)
83                                    {
84                                          icopen->dwError = ICERR_MEMORY;                                          icopen->dwError = ICERR_MEMORY;
85                                  }                                  }
86                                  return 0;                                  return 0;
87                          }                          }
88    
89                          codec->ehandle = codec->dhandle = NULL;                          codec->ehandle = codec->dhandle = NULL;
90                          config_reg_get(&codec->config);                          config_reg_get(&codec->config);
91    
92                          if (icopen != NULL) {                          /* bad things happen if this is uncommented
93                            if (lstrcmp(XVID_BUILD, codec->config.build))
94                            {
95                                    config_reg_default(&codec->config);
96                            }
97                            */
98    
99                            if (icopen != NULL)
100                            {
101                                  icopen->dwError = ICERR_OK;                                  icopen->dwError = ICERR_OK;
102                          }                          }
103                          return (LRESULT)codec;                          return (LRESULT)codec;
# Line 135  Line 147 
147                          return lParam2; /* size of struct */                          return lParam2; /* size of struct */
148                  }                  }
149    
   
150                  /* state control */                  /* state control */
151    
152          case ICM_ABOUT :          case ICM_ABOUT :
153          case ICM_CONFIGURE :                  DEBUG("ICM_ABOUT");
154                    DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0);
155                    return ICERR_OK;
156    
157            case ICM_CONFIGURE :
158                  DEBUG("ICM_CONFIGURE");                  DEBUG("ICM_CONFIGURE");
159                    if (lParam1 != -1)
160                    {
161                            CONFIG temp;
162    
163                  codec->config.save = FALSE;                  codec->config.save = FALSE;
164                  memcpy(&temp, &codec->config, sizeof(CONFIG));                  memcpy(&temp, &codec->config, sizeof(CONFIG));
165    
166                  if (lParam1 != -1) {                          DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_MAIN), (HWND)lParam1, main_proc, (LPARAM)&temp);
                         PROPSHEETINFO psi[DLG_COUNT];  
                         PROPSHEETPAGE psp[DLG_COUNT];  
                         PROPSHEETHEADER psh;  
   
                         psp[DLG_MAIN].dwSize = sizeof(PROPSHEETPAGE);  
                         psp[DLG_MAIN].dwFlags = 0;  
                         psp[DLG_MAIN].hInstance = hInst;  
                         psp[DLG_MAIN].pszTemplate = MAKEINTRESOURCE(IDD_MAIN);  
                         psp[DLG_MAIN].pfnDlgProc = config_proc;  
                                 psi[DLG_MAIN].page = DLG_MAIN;  
                                 psi[DLG_MAIN].config = &temp;  
                         psp[DLG_MAIN].lParam = (LPARAM)&psi[DLG_MAIN];  
                         psp[DLG_MAIN].pfnCallback = NULL;  
   
                         psp[DLG_ADV].dwSize = sizeof(PROPSHEETPAGE);  
                         psp[DLG_ADV].dwFlags = 0;  
                         psp[DLG_ADV].hInstance = hInst;  
                         psp[DLG_ADV].pszTemplate = MAKEINTRESOURCE(IDD_ADV);  
                         psp[DLG_ADV].pfnDlgProc = config_proc;  
                                 psi[DLG_ADV].page = DLG_ADV;  
                                 psi[DLG_ADV].config = &temp;  
                         psp[DLG_ADV].lParam = (LPARAM)&psi[DLG_ADV];  
                         psp[DLG_ADV].pfnCallback = NULL;  
   
                         psp[DLG_DEBUG].dwSize = sizeof(PROPSHEETPAGE);  
                         psp[DLG_DEBUG].dwFlags = 0;  
                         psp[DLG_DEBUG].hInstance = hInst;  
                         psp[DLG_DEBUG].pszTemplate = MAKEINTRESOURCE(IDD_DEBUG);  
                         psp[DLG_DEBUG].pfnDlgProc = config_proc;  
                                 psi[DLG_DEBUG].page = DLG_DEBUG;  
                                 psi[DLG_DEBUG].config = &temp;  
                         psp[DLG_DEBUG].lParam = (LPARAM)&psi[DLG_DEBUG];  
                         psp[DLG_DEBUG].pfnCallback = NULL;  
   
                         psp[DLG_CPU].dwSize = sizeof(PROPSHEETPAGE);  
                         psp[DLG_CPU].dwFlags = 0;  
                         psp[DLG_CPU].hInstance = hInst;  
                         psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU);  
                         psp[DLG_CPU].pfnDlgProc = config_proc;  
                                 psi[DLG_CPU].page = DLG_CPU;  
                                 psi[DLG_CPU].config = &temp;  
                         psp[DLG_CPU].lParam = (LPARAM)&psi[DLG_CPU];  
                         psp[DLG_CPU].pfnCallback = NULL;  
   
                         psp[DLG_ABOUT].dwSize = sizeof(PROPSHEETPAGE);  
                         psp[DLG_ABOUT].dwFlags = 0;  
                         psp[DLG_ABOUT].hInstance = hInst;  
                         psp[DLG_ABOUT].pszTemplate = MAKEINTRESOURCE(IDD_ABOUT);  
                         psp[DLG_ABOUT].pfnDlgProc = config_proc;  
                                 psi[DLG_ABOUT].page = DLG_ABOUT;  
                                 psi[DLG_ABOUT].config = &temp;  
                         psp[DLG_ABOUT].lParam = (LPARAM)&psi[DLG_ABOUT];  
                         psp[DLG_ABOUT].pfnCallback = NULL;  
   
                         psh.dwSize = sizeof(PROPSHEETHEADER);  
                         psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;  
                         psh.hwndParent = (HWND)lParam1;  
                         psh.hInstance = hInst;  
                         psh.pszCaption = (LPSTR) "XviD Configuration";  
                         psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);  
                         psh.nStartPage = (uMsg == ICM_CONFIGURE ? DLG_MAIN : DLG_ABOUT);  
                         psh.ppsp = (LPCPROPSHEETPAGE)&psp;  
                         psh.pfnCallback = NULL;  
   
                         PropertySheet(&psh);  
167    
168                          if(temp.save) {                          if (temp.save)
169                            {
170                                  memcpy(&codec->config, &temp, sizeof(CONFIG));                                  memcpy(&codec->config, &temp, sizeof(CONFIG));
171                                    config_reg_set(&codec->config);
172                          }                          }
173                  }                  }
174                  return ICERR_OK;                  return ICERR_OK;
175    
176          case ICM_GETSTATE :          case ICM_GETSTATE :
177                  DEBUG("ICM_GETSTATE");                  DEBUG("ICM_GETSTATE");
178                  if ((void*)lParam1 == NULL) {                  if ((void*)lParam1 == NULL)
179                    {
180                          return sizeof(CONFIG);                          return sizeof(CONFIG);
181                  }                  }
182                  memcpy((void*)lParam1, &codec->config, sizeof(CONFIG));                  memcpy((void*)lParam1, &codec->config, sizeof(CONFIG));
# Line 229  Line 184 
184    
185          case ICM_SETSTATE :          case ICM_SETSTATE :
186                  DEBUG("ICM_SETSTATE");                  DEBUG("ICM_SETSTATE");
187                  if ((void*)lParam1 == NULL) {                  if ((void*)lParam1 == NULL)
188                    {
189                          DEBUG("ICM_SETSTATE : DEFAULT");                          DEBUG("ICM_SETSTATE : DEFAULT");
190                          config_reg_get(&codec->config);                          config_reg_get(&codec->config);
191                          return 0;                          return 0;
# Line 318  Line 274 
274                  return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);                  return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);
275          }          }
276  }  }
277    
278    
279    void WINAPI Configure(HWND hwnd, HINSTANCE hinst, LPTSTR lpCmdLine, int nCmdShow)
280    {
281            DWORD dwDriverId;
282    
283            dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0);
284            if (dwDriverId != (DWORD)NULL)
285            {
286                    DriverProc(dwDriverId, 0, ICM_CONFIGURE, 0, 0);
287                    DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0);
288            }
289    }

Legend:
Removed from v.3  
changed lines
  Added in v.499

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