--- trunk/xvidcore/vfw/src/driverproc.c 2004/03/22 22:36:25 1382 +++ trunk/xvidcore/vfw/src/driverproc.c 2004/04/05 20:39:49 1413 @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: driverproc.c,v 1.2 2004-03-22 22:36:25 edgomez Exp $ + * $Id: driverproc.c,v 1.4 2004-04-05 20:36:37 edgomez Exp $ * ****************************************************************************/ @@ -33,6 +33,7 @@ #include "status.h" #include "resource.h" +static int clean_dll_bindings(CODEC* codec); BOOL WINAPI DllMain( HANDLE hModule, @@ -43,8 +44,6 @@ return TRUE; } -extern HINSTANCE m_hdll; - /* __declspec(dllexport) */ LRESULT WINAPI DriverProc( DWORD dwDriverId, HDRVR hDriver, @@ -65,7 +64,7 @@ case DRV_OPEN : DPRINTF("DRV_OPEN"); - m_hdll = NULL; + { ICOPEN * icopen = (ICOPEN *)lParam2; @@ -85,6 +84,7 @@ return 0; } + memset(codec, 0, sizeof(CODEC)); codec->status.hDlg = NULL; codec->config.ci_valid = 0; @@ -113,6 +113,7 @@ /* compress_end/decompress_end don't always get called */ compress_end(codec); decompress_end(codec); + clean_dll_bindings(codec); status_destroy_always(&codec->status); free(codec); return DRV_OK; @@ -296,7 +297,6 @@ } } - void WINAPI Configure(HWND hwnd, HINSTANCE hinst, LPTSTR lpCmdLine, int nCmdShow) { DWORD dwDriverId; @@ -308,3 +308,21 @@ DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0); } } + +static int clean_dll_bindings(CODEC* codec) +{ + if(codec->m_hdll) + { + FreeLibrary(codec->m_hdll); + codec->m_hdll = NULL; + codec->xvid_global_func = NULL; + codec->xvid_encore_func = NULL; + codec->xvid_decore_func = NULL; + codec->xvid_plugin_single_func = NULL; + codec->xvid_plugin_2pass1_func = NULL; + codec->xvid_plugin_2pass2_func = NULL; + codec->xvid_plugin_lumimasking_func = NULL; + codec->xvid_plugin_psnr_func = NULL; + } + return 0; +}