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

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

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

revision 1.1.2.4, Mon Jun 9 01:25:19 2003 UTC revision 1.12, Thu Dec 2 06:46:07 2010 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) 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
  *  
  *************************************************************************/  
   
 /**************************************************************************  
21   *   *
22   *      History:   * $Id$
23   *   *
24   *      31.08.2002      Configure() export   ****************************************************************************/
  *      01.12.2001      inital version; (c)2001 peter ross <pross@xvid.org>  
  *  
  *************************************************************************/  
25    
26  #include <windows.h>  #include <windows.h>
27  #include <vfw.h>  #include <vfw.h>
# Line 35  Line 30 
30  #include "debug.h"  #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    static int clean_dll_bindings(CODEC* codec);
37    
38  BOOL WINAPI DllMain(  INT_PTR WINAPI DllMain(
39          HANDLE hModule,          HANDLE hModule,
40          DWORD  ul_reason_for_call,          DWORD  ul_reason_for_call,
41          LPVOID lpReserved)          LPVOID lpReserved)
# Line 47  Line 44 
44      return TRUE;      return TRUE;
45  }  }
46    
   
   
47  /* __declspec(dllexport) */ LRESULT WINAPI DriverProc(  /* __declspec(dllexport) */ LRESULT WINAPI DriverProc(
48          DWORD dwDriverId,          DWORD_PTR dwDriverId,
49          HDRVR hDriver,          HDRVR hDriver,
50          UINT uMsg,          UINT uMsg,
51          LPARAM lParam1,          LPARAM lParam1,
# Line 65  Line 60 
60    
61          case DRV_LOAD :          case DRV_LOAD :
62          case DRV_FREE :          case DRV_FREE :
63                  return DRV_OK;                  return DRVCNF_OK;
64    
65          case DRV_OPEN :          case DRV_OPEN :
66                  DPRINTF("DRV_OPEN");                  DPRINTF("DRV_OPEN");
67    
68                  {                  {
69                          ICOPEN * icopen = (ICOPEN *)lParam2;                          ICOPEN * icopen = (ICOPEN *)lParam2;
70    
71                          if (icopen != NULL && icopen->fccType != ICTYPE_VIDEO)                          if (icopen != NULL && icopen->fccType != ICTYPE_VIDEO)
72                          {                          {
73                                  return DRV_CANCEL;                                  return DRVCNF_CANCEL;
74                          }                          }
75    
76                          codec = malloc(sizeof(CODEC));                          codec = malloc(sizeof(CODEC));
# Line 88  Line 84 
84                                  return 0;                                  return 0;
85                          }                          }
86    
87                            memset(codec, 0, sizeof(CODEC));
88    
89                codec->status.hDlg = NULL;
90              codec->config.ci_valid = 0;              codec->config.ci_valid = 0;
91              codec->ehandle = codec->dhandle = NULL;              codec->ehandle = codec->dhandle = NULL;
92              codec->fbase = 25;              codec->fbase = 25;
# Line 114  Line 113 
113                  /* compress_end/decompress_end don't always get called */                  /* compress_end/decompress_end don't always get called */
114                  compress_end(codec);                  compress_end(codec);
115                  decompress_end(codec);                  decompress_end(codec);
116                    clean_dll_bindings(codec);
117            status_destroy_always(&codec->status);
118                  free(codec);                  free(codec);
119                  return DRV_OK;                  return DRVCNF_OK;
120    
121          case DRV_DISABLE :          case DRV_DISABLE :
122          case DRV_ENABLE :          case DRV_ENABLE :
123                  return DRV_OK;                  return DRVCNF_OK;
124    
125          case DRV_INSTALL :          case DRV_INSTALL :
126          case DRV_REMOVE :          case DRV_REMOVE :
127                  return DRV_OK;                  return DRVCNF_OK;
128    
129          case DRV_QUERYCONFIGURE :          case DRV_QUERYCONFIGURE :
130          case DRV_CONFIGURE :          case DRV_CONFIGURE :
131                  return DRV_CANCEL;                  return DRVCNF_CANCEL;
132    
133    
134          /* info */          /* info */
135    
136          case ICM_GETINFO :          case ICM_GETINFO :
137                  DPRINTF("ICM_GETINFO");                  DPRINTF("ICM_GETINFO");
138                  {  
139                    if (lParam1 && lParam2 >= sizeof(ICINFO)) {
140                          ICINFO *icinfo = (ICINFO *)lParam1;                          ICINFO *icinfo = (ICINFO *)lParam1;
141    
142                          icinfo->fccType = ICTYPE_VIDEO;                          icinfo->fccType = ICTYPE_VIDEO;
# Line 145  Line 147 
147                                  VIDCF_COMPRESSFRAMES;                                  VIDCF_COMPRESSFRAMES;
148    
149                          icinfo->dwVersion = 0;                          icinfo->dwVersion = 0;
150    #if !defined(ICVERSION)
151    #define ICVERSION       0x0104
152    #endif
153                          icinfo->dwVersionICM = ICVERSION;                          icinfo->dwVersionICM = ICVERSION;
154    
155                          wcscpy(icinfo->szName, XVID_NAME_L);                          wcscpy(icinfo->szName, XVID_NAME_L);
# Line 153  Line 158 
158                          return lParam2; /* size of struct */                          return lParam2; /* size of struct */
159                  }                  }
160    
161                    return 0;       /* error */
162    
163                  /* state control */                  /* state control */
164    
165          case ICM_ABOUT :          case ICM_ABOUT :
# Line 292  Line 299 
299          return ICERR_UNSUPPORTED;          return ICERR_UNSUPPORTED;
300    
301          default:          default:
302                    if (uMsg < DRV_USER)
303                  return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);                  return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);
304                    else
305                            return ICERR_UNSUPPORTED;
306          }          }
307  }  }
308    
   
309  void WINAPI Configure(HWND hwnd, HINSTANCE hinst, LPTSTR lpCmdLine, int nCmdShow)  void WINAPI Configure(HWND hwnd, HINSTANCE hinst, LPTSTR lpCmdLine, int nCmdShow)
310  {  {
311          DWORD dwDriverId;          LRESULT dwDriverId;
312    
313          dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0);          dwDriverId = (LRESULT) DriverProc(0, 0, DRV_OPEN, 0, 0);
314          if (dwDriverId != (DWORD)NULL)          if (dwDriverId != (LRESULT)NULL)
315          {          {
316                  DriverProc(dwDriverId, 0, ICM_CONFIGURE, 0, 0);                  if (lstrcmpi(lpCmdLine, "about")==0) {
317                            DriverProc(dwDriverId, 0, ICM_ABOUT, (LPARAM)GetDesktopWindow(), 0);
318                    }else{
319                            DriverProc(dwDriverId, 0, ICM_CONFIGURE, (LPARAM)GetDesktopWindow(), 0);
320                    }
321                  DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0);                  DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0);
322          }          }
323  }  }
324    
325    static int clean_dll_bindings(CODEC* codec)
326    {
327            if(codec->m_hdll)
328            {
329                    FreeLibrary(codec->m_hdll);
330                    codec->m_hdll = NULL;
331                    codec->xvid_global_func = NULL;
332                    codec->xvid_encore_func = NULL;
333                    codec->xvid_decore_func = NULL;
334                    codec->xvid_plugin_single_func = NULL;
335                    codec->xvid_plugin_2pass1_func = NULL;
336                    codec->xvid_plugin_2pass2_func = NULL;
337                    codec->xvid_plugin_lumimasking_func = NULL;
338                    codec->xvid_plugin_psnr_func = NULL;
339            }
340            return 0;
341    }

Legend:
Removed from v.1.1.2.4  
changed lines
  Added in v.1.12

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