From: Lars Op den Kamp Date: Thu, 10 Nov 2011 19:34:34 +0000 (+0100) Subject: win32: added win32 version of LibCecInit() X-Git-Tag: upstream/2.2.0~1^2~64 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d2eadc31a366703224b1488c2c65a6f54fb2f18b;p=deb_libcec.git win32: added win32 version of LibCecInit() --- diff --git a/include/cecloader.h b/include/cecloader.h index d20ca2f..0440501 100644 --- a/include/cecloader.h +++ b/include/cecloader.h @@ -54,6 +54,21 @@ CEC::ICECAdapter *LoadLibCec(const char *strName, CEC::cec_logical_address iLogi return static_cast< CEC::ICECAdapter* > (CreateLibCec(strName, (uint8_t) iLogicalAddress, iPhysicalAddress)); } +CEC::ICECAdapter *LibCecInit(const char *strDeviceName, CEC::cec_device_type_list types, const char *strLib = NULL) +{ + if (!g_libCEC) + g_libCEC = LoadLibrary(strLib ? strLib : "libcec.dll"); + if (!g_libCEC) + return NULL; + + typedef void* (__cdecl*_LibCecInit)(const char *, CEC::cec_device_type_list); + _LibCecInit LibCecInit; + LibCecInit = (_LibCecInit) (GetProcAddress(g_libCEC, "CECInit")); + if (!LibCecInit) + return NULL; + return static_cast< CEC::ICECAdapter* > (LibCecInit(strDeviceName, types)); +} + void UnloadLibCec(CEC::ICECAdapter *device) { typedef void (__cdecl*_DestroyLibCec)(void * device);