[svn] / branches / dev-api-4 / xvidcore / vfw / src / driverproc.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/vfw/src/driverproc.c

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

revision 889, Sat Feb 22 08:24:01 2003 UTC revision 1393, Wed Mar 31 11:55:34 2004 UTC
# Line 1  Line 1 
1  /**************************************************************************  /*****************************************************************************
2   *   *
3   *      XVID VFW FRONTEND   *      XVID MPEG-4 VFW FRONTEND
4   *      driverproc main   *      - driverproc main -
5     *
6     *  Copyright(C) 2001-2003 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 15  Line 17 
17   *   *
18   *      You should have received a copy of the GNU General Public License   *      You should have received a copy of the GNU General Public License
19   *      along with this program; if not, write to the Free Software   *      along with this program; if not, write to the Free Software
20   *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *  
  *************************************************************************/  
   
 /**************************************************************************  
  *  
  *      History:  
21   *   *
22   *      31.08.2002      Configure() export   * $Id: driverproc.c,v 1.1.2.8 2004-03-31 11:55:34 syskin Exp $
  *      01.12.2001      inital version; (c)2001 peter ross <pross@xvid.org>  
23   *   *
24   *************************************************************************/   ****************************************************************************/
25    
26  #include <windows.h>  #include <windows.h>
27  #include <vfw.h>  #include <vfw.h>
28    #include "vfwext.h"
29    
30    #include "debug.h"
31  #include "codec.h"  #include "codec.h"
32  #include "config.h"  #include "config.h"
33    #include "status.h"
34  #include "resource.h"  #include "resource.h"
35    
36    
# Line 41  Line 39 
39          DWORD  ul_reason_for_call,          DWORD  ul_reason_for_call,
40          LPVOID lpReserved)          LPVOID lpReserved)
41  {  {
42          hInst = (HINSTANCE) hModule;          g_hInst = (HINSTANCE) hModule;
43      return TRUE;      return TRUE;
44  }  }
45    
   
   
46  /* __declspec(dllexport) */ LRESULT WINAPI DriverProc(  /* __declspec(dllexport) */ LRESULT WINAPI DriverProc(
47          DWORD dwDriverId,          DWORD dwDriverId,
48          HDRVR hDriver,          HDRVR hDriver,
# Line 66  Line 62 
62                  return DRV_OK;                  return DRV_OK;
63    
64          case DRV_OPEN :          case DRV_OPEN :
65                  DEBUG("DRV_OPEN");                  DPRINTF("DRV_OPEN");
66    
67                  {                  {
68                          ICOPEN * icopen = (ICOPEN *)lParam2;                          ICOPEN * icopen = (ICOPEN *)lParam2;
69    
# Line 86  Line 83 
83                                  return 0;                                  return 0;
84                          }                          }
85    
86                            memset(codec, 0, sizeof(CODEC));
87    
88                codec->status.hDlg = NULL;
89                codec->config.ci_valid = 0;
90                          codec->ehandle = codec->dhandle = NULL;                          codec->ehandle = codec->dhandle = NULL;
91                          codec->fbase = 25;                          codec->fbase = 25;
92                          codec->fincr = 1;                          codec->fincr = 1;
93                          config_reg_get(&codec->config);                          config_reg_get(&codec->config);
94    
95                          /* bad things happen if this is uncommented  #if 0
96                            /* bad things happen if this piece of code is activated */
97                          if (lstrcmp(XVID_BUILD, codec->config.build))                          if (lstrcmp(XVID_BUILD, codec->config.build))
98                          {                          {
99                                  config_reg_default(&codec->config);                                  config_reg_default(&codec->config);
100                          }                          }
101                          */  #endif
102    
103                          if (icopen != NULL)                          if (icopen != NULL)
104                          {                          {
# Line 106  Line 108 
108                  }                  }
109    
110          case DRV_CLOSE :          case DRV_CLOSE :
111                  DEBUG("DRV_CLOSE");                  DPRINTF("DRV_CLOSE");
112                  // compress_end/decompress_end don't always get called                  /* compress_end/decompress_end don't always get called */
113                  compress_end(codec);                  compress_end(codec);
114                  decompress_end(codec);                  decompress_end(codec);
115            status_destroy_always(&codec->status);
116                  free(codec);                  free(codec);
117                  return DRV_OK;                  return DRV_OK;
118    
# Line 129  Line 132 
132          /* info */          /* info */
133    
134          case ICM_GETINFO :          case ICM_GETINFO :
135                  DEBUG("ICM_GETINFO");                  DPRINTF("ICM_GETINFO");
136                  {                  {
137                          ICINFO *icinfo = (ICINFO *)lParam1;                          ICINFO *icinfo = (ICINFO *)lParam1;
138    
# Line 152  Line 155 
155                  /* state control */                  /* state control */
156    
157          case ICM_ABOUT :          case ICM_ABOUT :
158                  DEBUG("ICM_ABOUT");                  DPRINTF("ICM_ABOUT");
159                  DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0);                  DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, about_proc, 0);
160                  return ICERR_OK;                  return ICERR_OK;
161    
162          case ICM_CONFIGURE :          case ICM_CONFIGURE :
163                  DEBUG("ICM_CONFIGURE");                  DPRINTF("ICM_CONFIGURE");
164                  if (lParam1 != -1)                  if (lParam1 != -1)
165                  {                  {
166                          CONFIG temp;                          CONFIG temp;
# Line 165  Line 168 
168                          codec->config.save = FALSE;                          codec->config.save = FALSE;
169                          memcpy(&temp, &codec->config, sizeof(CONFIG));                          memcpy(&temp, &codec->config, sizeof(CONFIG));
170    
171                          DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_MAIN), (HWND)lParam1, main_proc, (LPARAM)&temp);                          DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_MAIN), (HWND)lParam1, main_proc, (LPARAM)&temp);
172    
173                          if (temp.save)                          if (temp.save)
174                          {                          {
# Line 176  Line 179 
179                  return ICERR_OK;                  return ICERR_OK;
180    
181          case ICM_GETSTATE :          case ICM_GETSTATE :
182                  DEBUG("ICM_GETSTATE");                  DPRINTF("ICM_GETSTATE");
183                  if ((void*)lParam1 == NULL)                  if ((void*)lParam1 == NULL)
184                  {                  {
185                          return sizeof(CONFIG);                          return sizeof(CONFIG);
# Line 185  Line 188 
188                  return ICERR_OK;                  return ICERR_OK;
189    
190          case ICM_SETSTATE :          case ICM_SETSTATE :
191                  DEBUG("ICM_SETSTATE");                  DPRINTF("ICM_SETSTATE");
192                  if ((void*)lParam1 == NULL)                  if ((void*)lParam1 == NULL)
193                  {                  {
194                          DEBUG("ICM_SETSTATE : DEFAULT");                          DPRINTF("ICM_SETSTATE : DEFAULT");
195                          config_reg_get(&codec->config);                          config_reg_get(&codec->config);
196                          return 0;                          return 0;
197                  }                  }
198                  memcpy(&codec->config,(void*)lParam1, sizeof(CONFIG));                  memcpy(&codec->config,(void*)lParam1, sizeof(CONFIG));
199                  return 0; // sizeof(CONFIG);                  return 0; /* sizeof(CONFIG); */
200    
201          /* not sure the difference, private/public data? */          /* not sure the difference, private/public data? */
202    
# Line 215  Line 218 
218          /* compressor */          /* compressor */
219    
220          case ICM_COMPRESS_QUERY :          case ICM_COMPRESS_QUERY :
221                  DEBUG("ICM_COMPRESS_QUERY");                  DPRINTF("ICM_COMPRESS_QUERY");
222                  return compress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);                  return compress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
223    
224          case ICM_COMPRESS_GET_FORMAT :          case ICM_COMPRESS_GET_FORMAT :
225                  DEBUG("ICM_COMPRESS_GET_FORMAT");                  DPRINTF("ICM_COMPRESS_GET_FORMAT");
226                  return compress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);                  return compress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
227    
228          case ICM_COMPRESS_GET_SIZE :          case ICM_COMPRESS_GET_SIZE :
229                  DEBUG("ICM_COMPRESS_GET_SIZE");                  DPRINTF("ICM_COMPRESS_GET_SIZE");
230                  return compress_get_size(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);                  return compress_get_size(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
231    
232          case ICM_COMPRESS_FRAMES_INFO :          case ICM_COMPRESS_FRAMES_INFO :
233                  DEBUG("ICM_COMPRESS_FRAMES_INFO");                  DPRINTF("ICM_COMPRESS_FRAMES_INFO");
234                  return compress_frames_info(codec, (ICCOMPRESSFRAMES *)lParam1);                  return compress_frames_info(codec, (ICCOMPRESSFRAMES *)lParam1);
235    
236          case ICM_COMPRESS_BEGIN :          case ICM_COMPRESS_BEGIN :
237                  DEBUG("ICM_COMPRESS_BEGIN");                  DPRINTF("ICM_COMPRESS_BEGIN");
238                  return compress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);                  return compress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
239    
240          case ICM_COMPRESS_END :          case ICM_COMPRESS_END :
241                  DEBUG("ICM_COMPRESS_END");                  DPRINTF("ICM_COMPRESS_END");
242                  return compress_end(codec);                  return compress_end(codec);
243    
244          case ICM_COMPRESS :          case ICM_COMPRESS :
245                  DEBUG("ICM_COMPRESS");                  DPRINTF("ICM_COMPRESS");
246                  return compress(codec, (ICCOMPRESS *)lParam1);                  return compress(codec, (ICCOMPRESS *)lParam1);
247    
248          /* decompressor */          /* decompressor */
249    
250          case ICM_DECOMPRESS_QUERY :          case ICM_DECOMPRESS_QUERY :
251                  DEBUG("ICM_DECOMPRESS_QUERY");                  DPRINTF("ICM_DECOMPRESS_QUERY");
252                  return decompress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);                  return decompress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
253    
254          case ICM_DECOMPRESS_GET_FORMAT :          case ICM_DECOMPRESS_GET_FORMAT :
255                  DEBUG("ICM_DECOMPRESS_GET_FORMAT");                  DPRINTF("ICM_DECOMPRESS_GET_FORMAT");
256                  return decompress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);                  return decompress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
257    
258          case ICM_DECOMPRESS_BEGIN :          case ICM_DECOMPRESS_BEGIN :
259                  DEBUG("ICM_DECOMPRESS_BEGIN");                  DPRINTF("ICM_DECOMPRESS_BEGIN");
260                  return decompress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);                  return decompress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
261    
262          case ICM_DECOMPRESS_END :          case ICM_DECOMPRESS_END :
263                  DEBUG("ICM_DECOMPRESS_END");                  DPRINTF("ICM_DECOMPRESS_END");
264                  return decompress_end(codec);                  return decompress_end(codec);
265    
266          case ICM_DECOMPRESS :          case ICM_DECOMPRESS :
267                  DEBUG("ICM_DECOMPRESS");                  DPRINTF("ICM_DECOMPRESS");
268                  return decompress(codec, (ICDECOMPRESS *)lParam1);                  return decompress(codec, (ICDECOMPRESS *)lParam1);
269    
270          case ICM_DECOMPRESS_GET_PALETTE :          case ICM_DECOMPRESS_GET_PALETTE :
# Line 272  Line 275 
275          case ICM_DECOMPRESSEX:          case ICM_DECOMPRESSEX:
276                  return ICERR_UNSUPPORTED;                  return ICERR_UNSUPPORTED;
277    
278        /* VFWEXT entry point */
279        case ICM_USER+0x0fff :
280            if (lParam1 == VFWEXT_CONFIGURE_INFO) {
281                VFWEXT_CONFIGURE_INFO_T * info = (VFWEXT_CONFIGURE_INFO_T*)lParam2;
282                DPRINTF("%i %i %i %i %i %i",
283                    info->ciWidth, info->ciHeight,
284                    info->ciRate, info->ciScale,
285                    info->ciActiveFrame, info->ciFrameCount);
286    
287                codec->config.ci_valid = 1;
288                memcpy(&codec->config.ci, (void*)lParam2, sizeof(VFWEXT_CONFIGURE_INFO_T));
289                return ICERR_OK;
290            }
291            return ICERR_UNSUPPORTED;
292    
293          default:          default:
294                  return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);                  return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);
295          }          }
# Line 285  Line 303 
303          dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0);          dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0);
304          if (dwDriverId != (DWORD)NULL)          if (dwDriverId != (DWORD)NULL)
305          {          {
306                  DriverProc(dwDriverId, 0, ICM_CONFIGURE, 0, 0);                  DriverProc(dwDriverId, 0, ICM_CONFIGURE, (LPARAM)GetDesktopWindow(), 0);
307                  DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0);                  DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0);
308          }          }
309  }  }

Legend:
Removed from v.889  
changed lines
  Added in v.1393

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