win32: added win32 version of LibCecInit()
authorLars Op den Kamp <lars.opdenkamp@pulse-eight.com>
Thu, 10 Nov 2011 19:34:34 +0000 (20:34 +0100)
committerLars Op den Kamp <lars.opdenkamp@pulse-eight.com>
Thu, 10 Nov 2011 19:34:34 +0000 (20:34 +0100)
include/cecloader.h

index d20ca2ff22e22007f0a41fd2e3886e10f9e219e6..0440501dad4f9630ae1dd5211b4bf5def64e67c2 100644 (file)
@@ -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);