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

Diff of /vfw/src/driverproc.c

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

revision 1.1.1.1, Fri Mar 8 02:46:10 2002 UTC revision 1.7, Sun Feb 16 05:02:02 2003 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                            codec->fbase = 25;
91                            codec->fincr = 1;
92                          config_reg_get(&codec->config);                          config_reg_get(&codec->config);
93    
94                          if (icopen != NULL) {                          /* bad things happen if this is uncommented
95                            if (lstrcmp(XVID_BUILD, codec->config.build))
96                            {
97                                    config_reg_default(&codec->config);
98                            }
99                            */
100    
101                            if (icopen != NULL)
102                            {
103                                  icopen->dwError = ICERR_OK;                                  icopen->dwError = ICERR_OK;
104                          }                          }
105                          return (LRESULT)codec;                          return (LRESULT)codec;
# Line 135  Line 149 
149                          return lParam2; /* size of struct */                          return lParam2; /* size of struct */
150                  }                  }
151    
   
152                  /* state control */                  /* state control */
153    
154          case ICM_ABOUT :          case ICM_ABOUT :
155          case ICM_CONFIGURE :                  DEBUG("ICM_ABOUT");
156                    DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0);
157                    return ICERR_OK;
158    
159            case ICM_CONFIGURE :
160                  DEBUG("ICM_CONFIGURE");                  DEBUG("ICM_CONFIGURE");
161                    if (lParam1 != -1)
162                    {
163                            CONFIG temp;
164    
165                  codec->config.save = FALSE;                  codec->config.save = FALSE;
166                  memcpy(&temp, &codec->config, sizeof(CONFIG));                  memcpy(&temp, &codec->config, sizeof(CONFIG));
167    
168                  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);  
169    
170                          if(temp.save) {                          if (temp.save)
171                            {
172                                  memcpy(&codec->config, &temp, sizeof(CONFIG));                                  memcpy(&codec->config, &temp, sizeof(CONFIG));
173                                    config_reg_set(&codec->config);
174                          }                          }
175                  }                  }
176                  return ICERR_OK;                  return ICERR_OK;
177    
178          case ICM_GETSTATE :          case ICM_GETSTATE :
179                  DEBUG("ICM_GETSTATE");                  DEBUG("ICM_GETSTATE");
180                  if ((void*)lParam1 == NULL) {                  if ((void*)lParam1 == NULL)
181                    {
182                          return sizeof(CONFIG);                          return sizeof(CONFIG);
183                  }                  }
184                  memcpy((void*)lParam1, &codec->config, sizeof(CONFIG));                  memcpy((void*)lParam1, &codec->config, sizeof(CONFIG));
# Line 229  Line 186 
186    
187          case ICM_SETSTATE :          case ICM_SETSTATE :
188                  DEBUG("ICM_SETSTATE");                  DEBUG("ICM_SETSTATE");
189                  if ((void*)lParam1 == NULL) {                  if ((void*)lParam1 == NULL)
190                    {
191                          DEBUG("ICM_SETSTATE : DEFAULT");                          DEBUG("ICM_SETSTATE : DEFAULT");
192                          config_reg_get(&codec->config);                          config_reg_get(&codec->config);
193                          return 0;                          return 0;
# Line 318  Line 276 
276                  return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);                  return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);
277          }          }
278  }  }
279    
280    
281    void WINAPI Configure(HWND hwnd, HINSTANCE hinst, LPTSTR lpCmdLine, int nCmdShow)
282    {
283            DWORD dwDriverId;
284    
285            dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0);
286            if (dwDriverId != (DWORD)NULL)
287            {
288                    DriverProc(dwDriverId, 0, ICM_CONFIGURE, 0, 0);
289                    DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0);
290            }
291    }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.7

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