Showing the changes to codec/encoder/core/src/wels_preprocess.cpp (1 of 11 files). Show all
Unified · Split
| @@ -50,11 +50,16 @@ · 49 unmodified lines | ||
| 50 | 50 | #include "encoder_context.h" |
| 51 | 51 | #include "utils.h" |
| 52 | 52 | |
| 53 | +#ifdef NO_DYNAMIC_VP | |
| 54 | +EResult WELSAPI CreateVpInterface (void **ppCtx, int iVersion); | |
| 55 | +EResult WELSAPI DestroyVpInterface (void **ppCtx, int iVersion); | |
| 56 | +#endif | |
| 53 | 57 | |
| 54 | 58 | namespace WelsSVCEnc { |
| 55 | 59 | |
| 56 | 60 | #define WelsSafeDelete(p) if(p){ delete (p); (p) = NULL; } |
| 57 | 61 | |
| 62 | + | |
| 58 | 63 | //***** entry API declaration ************************************************************************// |
| 59 | 64 | typedef EResult (WELSAPI *pfnCreateVpInterface) (void **, int ); |
| 60 | 65 | typedef EResult (WELSAPI *pfnDestroyVpInterface) (void * , int ); |
| @@ -87,6 +92,8 @@ inline void WelsUpdateSpatialIdxMap(sWelsEncCtx * pEncCtx, int32_t iPos, SPic · 26 unmodified lines | ||
| 87 | 92 | CWelsLib::CWelsLib(void *pEncCtx) |
| 88 | 93 | { |
| 89 | 94 | m_pInterface[0] = m_pInterface[1] = NULL; |
| 95 | + | |
| 96 | +#ifndef NO_DYNAMIC_VP | |
| 90 | 97 | #if defined(WIN32) |
| 91 | 98 | const str_t WelsVPLib[] = "welsvp.dll"; |
| 92 | 99 | HMODULE shModule = LoadLibrary(WelsVPLib); |
| @@ -111,6 +118,7 @@ CWelsLib::CWelsLib(void *pEncCtx) · 18 unmodified lines | ||
| 111 | 118 | #endif |
| 112 | 119 | |
| 113 | 120 | m_pVpLib = (void *)shModule; |
| 121 | +#endif | |
| 114 | 122 | } |
| 115 | 123 | |
| 116 | 124 | CWelsLib::~CWelsLib() |
| @@ -136,6 +144,7 @@ CWelsLib::~CWelsLib() · 19 unmodified lines | ||
| 136 | 144 | void* CWelsLib::QueryFunction(const str_t *pName) |
| 137 | 145 | { |
| 138 | 146 | void *pFunc = NULL; |
| 147 | + | |
| 139 | 148 | if (m_pVpLib) |
| 140 | 149 | { |
| 141 | 150 | #if defined(WIN32) |
| @@ -158,23 +167,34 @@ void* CWelsLib::QueryFunction(const str_t *pName) · 16 unmodified lines | ||
| 158 | 167 | |
| 159 | 168 | int32_t CWelsLib::CreateIface(void **ppEncCtx) |
| 160 | 169 | { |
| 170 | +#ifndef NO_DYNAMIC_VP | |
| 161 | 171 | if (m_pVpLib) |
| 162 | 172 | { |
| 173 | + | |
| 174 | +#endif | |
| 163 | 175 | pfnCreateVpInterface pCreateVpInterface = NULL; |
| 164 | 176 | pfnDestroyVpInterface pDestroyVpInterface = NULL; |
| 165 | 177 | |
| 178 | +#ifndef NO_DYNAMIC_VP | |
| 166 | 179 | pCreateVpInterface = (pfnCreateVpInterface) QueryFunction("CreateVpInterface"); |
| 167 | 180 | pDestroyVpInterface = (pfnDestroyVpInterface) QueryFunction("DestroyVpInterface"); |
| 181 | +#else | |
| 182 | + pCreateVpInterface = CreateVpInterface; | |
| 183 | + // TODO(ekr@rtfm.com): This cast corrects a signature difference... This is a potential real problem | |
| 184 | + pDestroyVpInterface = (pfnDestroyVpInterface)DestroyVpInterface; | |
| 185 | +#endif | |
| 168 | 186 | |
| 169 | 187 | m_pInterface[0] = (void *)pCreateVpInterface; |
| 170 | 188 | m_pInterface[1] = (void *)pDestroyVpInterface; |
| 171 | 189 | |
| 172 | 190 | if (m_pInterface[0] && m_pInterface[1]) |
| 173 | 191 | pCreateVpInterface(ppEncCtx, WELSVP_INTERFACE_VERION); |
| 192 | +#ifndef NO_DYNAMIC_VP | |
| 174 | 193 | } |
| 175 | 194 | else |
| 176 | 195 | { |
| 177 | 196 | } |
| 197 | +#endif | |
| 178 | 198 | |
| 179 | 199 | return ppEncCtx ? 0 : 1; |
| 180 | 200 | } |