Browse files

changed libcec to be dyloaded like others, also change lib/libcec/Mak…

…efile to be pure convenence make and remove the internal/external bits, libcec is a system lib. treat it that way.
  • Loading branch information...
1 parent 86683ca commit 3a0c3c037de6d02eec47611e5213be815783bfb8 @davilla davilla committed Oct 13, 2011
View
2 .gitignore
@@ -176,8 +176,6 @@ lib/cmyth/Makefile
/lib/cpluff/libcpluff/win32/Release
# /lib/libcec
-/lib/libcec/Makefile
-/lib/libcec/include
/lib/libcec/libcec
# /lib/enca
View
75 configure.in
@@ -123,10 +123,8 @@ libudev_not_found="== Could not find libudev. Will use polling to check for devi
libudev_disabled="== udev support disabled. Will use polling to check for device changes. =="
libusb_not_found="== Could not find libusb. Plug and play USB device support will not be available. =="
libusb_disabled="== libusb disabled. Plug and play USB device support will not be available. =="
-libcec_enabled="== libCEC enabled. =="
-libcec_disabled="== libCEC disabled. CEC adapter support will not be available. =="
-libcec_internal="== Using internal libCEC. =="
-libcec_external_missing="== libCEC was not found on your system. =="
+libcec_enabled="== libcec enabled. =="
+libcec_disabled="== libcec disabled. CEC adapter support will not be available. =="
# External library message strings
external_libraries_enabled="== Use of all supported external libraries enabled. =="
@@ -400,9 +398,9 @@ AC_ARG_ENABLE([libusb],
AC_ARG_ENABLE([libcec],
[AS_HELP_STRING([--enable-libcec],
- [enable libcec support (default is no)])],
+ [enable libcec support (default is auto)])],
[use_libcec=$enableval],
- [use_libcec=no])
+ [use_libcec=auto])
### External libraries options
AC_ARG_ENABLE([external-libraries],
@@ -411,12 +409,6 @@ AC_ARG_ENABLE([external-libraries],
[use_external_libraries=$enableval],
[use_external_libraries=no])
-AC_ARG_ENABLE([external-libcec],
- [AS_HELP_STRING([--enable-external-libcec],
- [external libcec support (default is no) 'Linux only'])],
- [use_external_libcec=$enableval],
- [use_external_libcec=no])
-
AC_ARG_ENABLE([external-ffmpeg],
[AS_HELP_STRING([--enable-external-ffmpeg],
[enable use of external ffmpeg libraries (default is no) 'Linux only'])],
@@ -1101,12 +1093,12 @@ USE_LIBUDEV=0
else
if test "$use_libudev" = "auto"; then
PKG_CHECK_MODULES([UDEV], [libudev],
- use_libudev="yes"; use_libusb="no"; USE_LIBUDEV=1; [INCLUDES="$INCLUDES $UDEV_CFLAGS"; LIBS="$LIBS $UDEV_LIBS"]; \
+ use_libudev="yes"; USE_LIBUDEV=1; [INCLUDES="$INCLUDES $UDEV_CFLAGS"; LIBS="$LIBS $UDEV_LIBS"]; \
AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"]),
AC_MSG_RESULT($libudev_not_found))
elif test "$use_libudev" = "yes" ; then
PKG_CHECK_MODULES([UDEV], [libudev],
- use_libudev="yes"; use_libusb="no"; USE_LIBUDEV=1; [INCLUDES="$INCLUDES $UDEV_CFLAGS"; LIBS="$LIBS $UDEV_LIBS"]; \
+ use_libudev="yes"; USE_LIBUDEV=1; [INCLUDES="$INCLUDES $UDEV_CFLAGS"; LIBS="$LIBS $UDEV_LIBS"]; \
AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"]),
AC_MSG_ERROR($libudev_not_found))
use_libudev="no"
@@ -1116,7 +1108,7 @@ fi
# libusb
USE_LIBUSB=0
-if test "$use_libudev" != "yes"; then
+if test "x$use_libusb" != "xno"; then
if test "$host_vendor" = "apple" ; then
use_libusb="no"
AC_MSG_NOTICE($libusb_disabled)
@@ -1141,29 +1133,25 @@ fi
# libcec
USE_LIBCEC=0
-if test "$use_libcec" = "yes"; then
- USE_LIBCEC=1; AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libCEC is installed"])
- AC_MSG_NOTICE($libcec_enabled)
+if test "x$use_libcec" != "xno" && test "x$use_libusb" != "xno"; then
+ PKG_CHECK_MODULES([CEC], [libcec],
+ [INCLUDES="$INCLUDES $CEC_CFLAGS"; LIBS="$LIBS $CEC_LIBS"],
+ use_libcec=no; AC_MSG_NOTICE($libcec_disabled))
+ if test "x$use_libcec" != "xno"; then
+ if test "x$use_libudev" != "xno"; then
+ USE_LIBUSB=0; use_libusb=no;
+ fi
+ USE_LIBCEC=1; AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libCEC is installed"])
+ XB_FIND_SONAME([LIBCEC], [cec], [use_libcec])
+ AC_MSG_NOTICE($libcec_enabled)
+ fi
else
use_libcec="no"
AC_MSG_NOTICE($libcec_disabled)
fi
### External libraries checks
-# external libcec
-USE_EXTERNAL_LIBCEC=0
-if test "$use_libcec" = "yes"; then
- if test "$use_external_libcec" = "yes"; then
- USE_EXTERNAL_LIBCEC=1; PKG_CHECK_MODULES([CEC], [libcec],
- [INCLUDES="$INCLUDES $CEC_CFLAGS"; LIBS="$LIBS $CEC_LIBS"],
- AC_MSG_ERROR($libcec_external_missing))
- else
- [INCLUDES="$INCLUDES -I\$(abs_top_srcdir)/lib/libcec/include"]
- AC_MSG_NOTICE($libcec_internal)
- fi
-fi
-
# External FFmpeg
if test "$use_external_ffmpeg" = "yes"; then
FFMPEG_LIBNAMES="libavcodec libavfilter libavformat libavutil libpostproc libswscale"
@@ -1798,18 +1786,13 @@ else
final_message="$final_message\n libusb support:\tNo"
fi
-if test "$use_libcec" = "yes"; then
- final_message="$final_message\n libCEC support:\tYes"
+if test "x$use_libcec" != "xno"; then
+ final_message="$final_message\n libcec support:\tYes"
else
- final_message="$final_message\n libCEC support:\tNo"
+ final_message="$final_message\n libcec support:\tNo"
fi
### External libraries messages
-if test "$use_external_libcec" = "yes"; then
- final_message="$final_message\n External libCEC:\tYes"
-else
- final_message="$final_message\n External libCEC:\tNo"
-fi
if test "$use_external_ffmpeg" = "yes"; then
final_message="$final_message\n External FFmpeg:\tYes"
@@ -1876,8 +1859,7 @@ OUTPUT_FILES="Makefile \
tools/TexturePacker/Makefile \
tools/EventClients/Clients/OSXRemote/Makefile \
xbmc/peripherals/bus/Makefile \
- xbmc/peripherals/devices/Makefile \
- lib/libcec/Makefile"
+ xbmc/peripherals/devices/Makefile"
if test "$use_skin_touched" = "yes"; then
OUTPUT_FILES+=" addons/skin.touched/media/Makefile"
@@ -1937,7 +1919,6 @@ AC_SUBST(USE_AIRTUNES)
AC_SUBST(USE_LIBUDEV)
AC_SUBST(USE_LIBUSB)
AC_SUBST(USE_LIBCEC)
-AC_SUBST(USE_EXTERNAL_LIBCEC)
# pushd and popd are not available in other shells besides bash, so implement
@@ -2207,16 +2188,6 @@ XB_CONFIG_MODULE([lib/cpluff], [
#LDFLAGS="$LDFLAGS -Wl,-read_only_relocs,suppress"
], [0])
-XB_CONFIG_MODULE([lib/libcec], [
- if test "$use_libcec" = "yes" && test "$use_external_libcec" = "no" ; then
- cd libcec ; ./configure \
- --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
- --host=$host_alias \
- --build=$build_alias \
- --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
- fi
-], [0])
-
AC_OUTPUT
final_message="$final_message\n prefix:\t$prefix\n$dashes"
View
54 lib/libcec/Makefile
@@ -0,0 +1,54 @@
+# Download and build libCEC
+#
+# Usage:
+# make
+# sudo make install
+# make clean
+
+# lib name, version
+LIBNAME=libcec
+VERSION=0.6
+SOURCE=$(LIBNAME)-$(VERSION)
+
+# download location and format
+BASE_URL=http://mirrors.xbmc.org/build-deps/darwin-libs
+ARCHIVE=$(SOURCE).tar.gz
+TARBALLS_LOCATION=.
+RETRIEVE_TOOL=/usr/bin/curl
+RETRIEVE_TOOL_FLAGS=-Ls --create-dirs --output $(TARBALLS_LOCATION)/$(ARCHIVE)
+ARCHIVE_TOOL=tar
+ARCHIVE_TOOL_FLAGS=xf
+
+PREFIX ?= /usr/local
+LIBCEC_CONFIGOPTS ?= --prefix=$(PREFIX)
+
+# configuration settings
+CONFIGURE=./configure CFLAGS=-D_FILE_OFFSET_BITS=64 $(LIBCEC_CONFIGOPTS)
+
+SO_NAME=$(SOURCE)/.libs/$(LIBNAME).so
+
+all: $(SO_NAME)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); autoreconf -vif
+ cd $(SOURCE); $(CONFIGURE)
+
+$(SO_NAME): $(SOURCE)
+ make -j 1 -C $(SOURCE)
+
+install:
+ make -C $(SOURCE) install
+ ldconfig
+
+clean:
+ rm -rf $(SOURCE)
+
+distclean::
+ rm -rf $(SOURCE)
+
View
51 lib/libcec/Makefile.in
@@ -1,51 +0,0 @@
-# Download and build libCEC
-#
-# Usage:
-# make download
-# make bootstrap
-# make configure
-# make
-
-# lib name, version
-LIBNAME=libcec
-VERSION=0.6
-ARCHIVE=$(LIBNAME)-$(VERSION)
-
-# download location and format
-ARCHIVE_BASE_URL=http://github.com/Pulse-Eight/$(LIBNAME)/tarball/
-ARCHIVE_EXTRACTED_DIR=Pulse-Eight-libcec-d9ba5be
-ARCHIVE_URL=$(ARCHIVE_BASE_URL)$(ARCHIVE)
-ARCHIVE_TOOL=tar
-ARCHIVE_TOOL_FLAGS=xf
-ARCHIVE_ADD_EXTENSION=.tar.gz
-RETRIEVE_TOOL=/usr/bin/curl
-RETRIEVE_TOOL_FLAGS=-Ls --create-dirs --output $(ARCHIVE)$(ARCHIVE_ADD_EXTENSION)
-
-# configuration
-PREFIX ?= @abs_top_srcdir@/lib/libcec
-LIBCEC_CONFIGOPTS ?= --prefix=$(PREFIX)
-CONFIGURE=./configure CFLAGS=-D_FILE_OFFSET_BITS=64 $(LIBCEC_CONFIGOPTS)
-
-all: libcec.a
-
-download: distclean
- $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(ARCHIVE_URL)
- $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(ARCHIVE)$(ARCHIVE_ADD_EXTENSION)
- rm -f $(ARCHIVE)$(ARCHIVE_ADD_EXTENSION)
- mv $(ARCHIVE_EXTRACTED_DIR) $(LIBNAME)
- mkdir -p include/libcec
- cp $(LIBNAME)/include/* include/libcec
-
-libcec.a:
- make -C $(LIBNAME)
- cp $(LIBNAME)/src/lib/.libs/libcec.a libcec.a
-
-clean:
- rm -f libcec.a
- make -C $(LIBNAME) clean
-
-distclean:
- rm -f $(ARCHIVE) libcec.a Makefile
- rm -rf include
- rm -rf $(LIBNAME)
- rm -rf $(ARCHIVE_DIR)
View
1 xbmc/DllPaths_generated.h.in
@@ -39,6 +39,7 @@
#define DLL_PATH_LIBAFP "@AFPCLIENT_SONAME@"
#define DLL_PATH_LIBPLIST "@PLIST_SONAME@"
#define DLL_PATH_LIBSHAIRPORT "@SHAIRPORT_SONAME@"
+#define DLL_PATH_LIBCEC "@LIBCEC_SONAME@"
#ifndef DLL_PATH_LIBCURL
#define DLL_PATH_LIBCURL "@CURL_SONAME@"
View
1 xbmc/DllPaths_win32.h
@@ -33,6 +33,7 @@
#define DLL_PATH_LIBMICROHTTP "special://xbmcbin/system/webserver/libmicrohttpd-5.dll"
#define DLL_PATH_LIBNFS "special://xbmcbin/system/libnfs.dll"
#define DLL_PATH_LIBPLIST "special://xbmcbin/system/airplay/libplist.dll"
+#define DLL_PATH_LIBCEC "special://xbmcbin/system/libcec.dll"
/* paplayer */
#define DLL_PATH_ADPCM_CODEC "special://xbmcbin/system/players/paplayer/adpcm.dll"
View
38 xbmc/peripherals/devices/PeripheralCecAdapter.cpp
@@ -24,6 +24,7 @@
#include "PeripheralCecAdapter.h"
#include "input/XBIRRemote.h"
#include "Application.h"
+#include "DynamicDll.h"
#include "threads/SingleLock.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "guilib/LocalizeStrings.h"
@@ -39,14 +40,40 @@ using namespace CEC;
#define CEC_LIB_SUPPORTED_VERSION 6
+class DllLibCECInterface
+{
+public:
+ virtual ~DllLibCECInterface() {}
+ virtual ICECAdapter* CECCreate(const char *interfaceName, uint8_t logicalAddress, uint16_t physicalAddress)=0;
+ virtual void* CECDestroy(ICECAdapter *adapter)=0;
+};
+
+class DllLibCEC : public DllDynamic, DllLibCECInterface
+{
+ DECLARE_DLL_WRAPPER(DllLibCEC, DLL_PATH_LIBCEC)
+
+ DEFINE_METHOD3(ICECAdapter*, CECCreate, (const char *p1, uint8_t p2, uint16_t p3))
+ DEFINE_METHOD1(void* , CECDestroy, (ICECAdapter *p1))
+
+ BEGIN_METHOD_RESOLVE()
+ RESOLVE_METHOD_RENAME(CECCreate, CECCreate)
+ RESOLVE_METHOD_RENAME(CECDestroy, CECDestroy)
+ END_METHOD_RESOLVE()
+};
+
CPeripheralCecAdapter::CPeripheralCecAdapter(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
CPeripheralHID(type, busType, strLocation, strDeviceName, iVendorId, iProductId),
CThread("CEC Adapter"),
m_bStarted(false),
m_bHasButton(false),
m_bIsReady(false)
{
- m_cecAdapter = LoadLibCec("XBMC", CECDEVICE_PLAYBACKDEVICE1);
+ m_dll = new DllLibCEC;
+ if (m_dll->Load() && m_dll->IsLoaded())
+ m_cecAdapter = m_dll->CECCreate("XBMC", CECDEVICE_PLAYBACKDEVICE1, CEC_DEFAULT_PHYSICAL_ADDRESS);
+ else
+ m_cecAdapter = NULL;
+
if (!m_cecAdapter || m_cecAdapter->GetMinVersion() > CEC_LIB_SUPPORTED_VERSION)
{
/* unsupported libcec version */
@@ -56,7 +83,8 @@ CPeripheralCecAdapter::CPeripheralCecAdapter(const PeripheralType type, const Pe
strMessage.Format(g_localizeStrings.Get(36013).c_str(), CEC_LIB_SUPPORTED_VERSION, m_cecAdapter ? m_cecAdapter->GetMinVersion() : -1);
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(36000), strMessage);
m_bError = true;
- UnloadLibCec(m_cecAdapter);
+ if (m_cecAdapter)
+ m_dll->CECDestroy(m_cecAdapter);
m_cecAdapter = NULL;
}
else
@@ -72,11 +100,13 @@ CPeripheralCecAdapter::~CPeripheralCecAdapter(void)
m_bStop = true;
StopThread(true);
- if (m_cecAdapter)
+ if (m_dll && m_cecAdapter)
{
FlushLog();
- UnloadLibCec(m_cecAdapter);
+ m_dll->CECDestroy(m_cecAdapter);
m_cecAdapter = NULL;
+ delete m_dll;
+ m_dll = NULL;
}
}
View
3 xbmc/peripherals/devices/PeripheralCecAdapter.h
@@ -26,6 +26,8 @@
#include "threads/CriticalSection.h"
#include <queue>
+class DllLibCEC;
+
namespace CEC
{
class ICECAdapter;
@@ -69,6 +71,7 @@ namespace PERIPHERALS
static bool FindConfigLocation(CStdString &strString);
static bool TranslateComPort(CStdString &strPort);
+ DllLibCEC* m_dll;
CEC::ICECAdapter* m_cecAdapter;
bool m_bStarted;
bool m_bHasButton;

0 comments on commit 3a0c3c0

Please sign in to comment.