23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
|
* ... ??? |
|
26 |
* 01.12.2001 inital version; (c)2001 peter ross <suxen_drol@hotmail.com> |
* 01.12.2001 inital version; (c)2001 peter ross <suxen_drol@hotmail.com> |
27 |
* |
* |
28 |
*************************************************************************/ |
*************************************************************************/ |
54 |
LPARAM lParam2) |
LPARAM lParam2) |
55 |
{ |
{ |
56 |
CODEC * codec = (CODEC *)dwDriverId; |
CODEC * codec = (CODEC *)dwDriverId; |
|
CONFIG temp; |
|
57 |
|
|
58 |
switch(uMsg) |
switch(uMsg) |
59 |
{ |
{ |
62 |
|
|
63 |
case DRV_LOAD : |
case DRV_LOAD : |
64 |
case DRV_FREE : |
case DRV_FREE : |
65 |
DRV_OK; |
return DRV_OK; |
66 |
|
|
67 |
case DRV_OPEN : |
case DRV_OPEN : |
68 |
DEBUG("DRV_OPEN"); |
DEBUG("DRV_OPEN"); |
69 |
{ |
{ |
70 |
ICOPEN * icopen = (ICOPEN *)lParam2; |
ICOPEN * icopen = (ICOPEN *)lParam2; |
71 |
|
|
72 |
if (icopen != NULL && icopen->fccType != ICTYPE_VIDEO) { |
if (icopen != NULL && icopen->fccType != ICTYPE_VIDEO) |
73 |
|
{ |
74 |
return DRV_CANCEL; |
return DRV_CANCEL; |
75 |
} |
} |
76 |
|
|
77 |
codec = malloc(sizeof(CODEC)); |
codec = malloc(sizeof(CODEC)); |
78 |
|
|
79 |
if (codec == NULL) |
if (codec == NULL) |
80 |
{ |
{ |
81 |
if (icopen != NULL) { |
if (icopen != NULL) |
82 |
|
{ |
83 |
icopen->dwError = ICERR_MEMORY; |
icopen->dwError = ICERR_MEMORY; |
84 |
} |
} |
85 |
return 0; |
return 0; |
86 |
} |
} |
87 |
|
|
88 |
codec->ehandle = codec->dhandle = NULL; |
codec->ehandle = codec->dhandle = NULL; |
89 |
config_reg_get(&codec->config); |
config_reg_get(&codec->config); |
90 |
|
|
91 |
if (icopen != NULL) { |
/* bad things happen if this is uncommented |
92 |
|
if (lstrcmp(XVID_BUILD, codec->config.build)) |
93 |
|
{ |
94 |
|
config_reg_default(&codec->config); |
95 |
|
} |
96 |
|
*/ |
97 |
|
|
98 |
|
if (icopen != NULL) |
99 |
|
{ |
100 |
icopen->dwError = ICERR_OK; |
icopen->dwError = ICERR_OK; |
101 |
} |
} |
102 |
return (LRESULT)codec; |
return (LRESULT)codec; |
146 |
return lParam2; /* size of struct */ |
return lParam2; /* size of struct */ |
147 |
} |
} |
148 |
|
|
|
|
|
149 |
/* state control */ |
/* state control */ |
150 |
|
|
151 |
case ICM_ABOUT : |
case ICM_ABOUT : |
152 |
case ICM_CONFIGURE : |
DEBUG("ICM_ABOUT"); |
153 |
|
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0); |
154 |
|
return ICERR_OK; |
155 |
|
|
156 |
|
case ICM_CONFIGURE : |
157 |
DEBUG("ICM_CONFIGURE"); |
DEBUG("ICM_CONFIGURE"); |
158 |
|
if (lParam1 != -1) |
159 |
|
{ |
160 |
|
CONFIG temp; |
161 |
|
|
162 |
codec->config.save = FALSE; |
codec->config.save = FALSE; |
163 |
memcpy(&temp, &codec->config, sizeof(CONFIG)); |
memcpy(&temp, &codec->config, sizeof(CONFIG)); |
164 |
|
|
165 |
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); |
|
166 |
|
|
167 |
if(temp.save) { |
if (temp.save) |
168 |
|
{ |
169 |
memcpy(&codec->config, &temp, sizeof(CONFIG)); |
memcpy(&codec->config, &temp, sizeof(CONFIG)); |
170 |
|
config_reg_set(&codec->config); |
171 |
} |
} |
172 |
} |
} |
173 |
return ICERR_OK; |
return ICERR_OK; |
174 |
|
|
175 |
case ICM_GETSTATE : |
case ICM_GETSTATE : |
176 |
DEBUG("ICM_GETSTATE"); |
DEBUG("ICM_GETSTATE"); |
177 |
if ((void*)lParam1 == NULL) { |
if ((void*)lParam1 == NULL) |
178 |
|
{ |
179 |
return sizeof(CONFIG); |
return sizeof(CONFIG); |
180 |
} |
} |
181 |
memcpy((void*)lParam1, &codec->config, sizeof(CONFIG)); |
memcpy((void*)lParam1, &codec->config, sizeof(CONFIG)); |
183 |
|
|
184 |
case ICM_SETSTATE : |
case ICM_SETSTATE : |
185 |
DEBUG("ICM_SETSTATE"); |
DEBUG("ICM_SETSTATE"); |
186 |
if ((void*)lParam1 == NULL) { |
if ((void*)lParam1 == NULL) |
187 |
|
{ |
188 |
DEBUG("ICM_SETSTATE : DEFAULT"); |
DEBUG("ICM_SETSTATE : DEFAULT"); |
189 |
config_reg_get(&codec->config); |
config_reg_get(&codec->config); |
190 |
return 0; |
return 0; |