📄 dllentry.c
字号:
/* * DllEntry point functions for ffmpeg encoder and decoder * Copyright (c) 2004 Andrew Ivanov <jho@nata-info.ru>. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *//** * @file dllentry.c */#include <windows.h>#include <winbase.h>#include "libavcodec/avcodec.h"#include "../compiler.h"CRITICAL_SECTION g_csStaticDataLock;static int g_nEntryCount = 0;void g_InitLock(){ if (0 == g_nEntryCount) { InitializeCriticalSection( &g_csStaticDataLock ); } g_nEntryCount ++; }void g_UnInitLock(){ g_nEntryCount --; if (g_nEntryCount <= 0) { //av_free_static(); DeleteCriticalSection( &g_csStaticDataLock ); } }void g_Lock(){ EnterCriticalSection( &g_csStaticDataLock );}void g_UnLock(){ LeaveCriticalSection( &g_csStaticDataLock );}// --- standard WIN32 entrypoints --------------------------------------BOOL WINAPI DllEntryPoint(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved){ static int count=0; char pomS[40]; switch (dwReason) { case DLL_PROCESS_ATTACH: count++; //snprintf(pomS,40,"libavcodec: %i %i\n",count,hInstance);OutputDebugString(pomS); DisableThreadLibraryCalls(hInstance); g_InitLock(); break; case DLL_PROCESS_DETACH: count--; //snprintf(pomS,40,"libavcodec: %i %i\n",count,hInstance);OutputDebugString(pomS); /*if (count<=0) av_free_static(); DeleteCriticalSection( &g_csStaticDataLock );*/ g_UnInitLock(); break; } return TRUE;}static char av_datetime[]=__DATE__" "__TIME__;void getVersion(char **version,char **build,char **datetime,const char* *license){ if (version) *version=AV_STRINGIFY(LIBAVCODEC_VERSION)", "COMPILER; if (build) *build=AV_STRINGIFY(LIBAVCODEC_BUILD); if (datetime) *datetime=av_datetime; if (license) *license="";}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -