From bf4f1626e991148b38a8c5b7b3e4c8ba54aea231 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sun, 10 Mar 2013 20:32:22 +0100 Subject: [PATCH 1/7] xbmc: add PR2387 Signed-off-by: Stephan Raue --- .../xbmc/patches/xbmc-990.29-PR2387.patch | 1517 +++++++++++++++++ 1 file changed, 1517 insertions(+) create mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch b/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch new file mode 100644 index 0000000000..2e85748d70 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch @@ -0,0 +1,1517 @@ +From 9d0695f2ae5f2a4d98c4ec6882fecd8209a425bc Mon Sep 17 00:00:00 2001 +From: Lars Op den Kamp +Date: Thu, 28 Feb 2013 20:41:38 +0100 +Subject: [PATCH] [cec] rebased PR1794 + fixes for Frodo + +--- + XBMC.xcodeproj/project.pbxproj | 13 +++ + configure.in | 40 +------ + project/BuildDependencies/scripts/libcec_d.txt | 2 +- + project/VS2010Express/XBMC.vcxproj | 2 + + project/VS2010Express/XBMC.vcxproj.filters | 6 + + system/peripherals.xml | 31 ++---- + tools/android/depends/libcec/Makefile | 4 +- + tools/darwin/depends/libcec/Makefile | 2 +- + xbmc/peripherals/PeripheralTypes.h | 76 ++++++++++++- + xbmc/peripherals/Peripherals.cpp | 62 +++++------ + xbmc/peripherals/Peripherals.h | 7 +- + xbmc/peripherals/bus/Makefile.in | 4 +- + xbmc/peripherals/bus/PeripheralBus.cpp | 81 +++----------- + xbmc/peripherals/bus/PeripheralBus.h | 23 +--- + xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp | 69 ------------ + xbmc/peripherals/bus/linux/PeripheralBusRPi.h | 40 ------- + .../bus/linux/PeripheralBusUSBLibUSB.cpp | 3 +- + .../bus/linux/PeripheralBusUSBLibUdev.cpp | 4 +- + xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp | 1 + + xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp | 116 ++++++++++++++++++++ + xbmc/peripherals/bus/virtual/PeripheralBusCEC.h | 57 ++++++++++ + xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp | 5 +- + xbmc/peripherals/devices/Peripheral.cpp | 50 ++++----- + xbmc/peripherals/devices/Peripheral.h | 6 +- + xbmc/peripherals/devices/PeripheralBluetooth.cpp | 4 +- + xbmc/peripherals/devices/PeripheralBluetooth.h | 2 +- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 52 ++------- + xbmc/peripherals/devices/PeripheralCecAdapter.h | 4 +- + xbmc/peripherals/devices/PeripheralDisk.cpp | 5 +- + xbmc/peripherals/devices/PeripheralDisk.h | 2 +- + xbmc/peripherals/devices/PeripheralHID.cpp | 5 +- + xbmc/peripherals/devices/PeripheralHID.h | 2 +- + xbmc/peripherals/devices/PeripheralImon.cpp | 4 +- + xbmc/peripherals/devices/PeripheralImon.h | 2 +- + xbmc/peripherals/devices/PeripheralNIC.cpp | 5 +- + xbmc/peripherals/devices/PeripheralNIC.h | 2 +- + xbmc/peripherals/devices/PeripheralNyxboard.cpp | 4 +- + xbmc/peripherals/devices/PeripheralNyxboard.h | 2 +- + xbmc/peripherals/devices/PeripheralTuner.cpp | 4 +- + xbmc/peripherals/devices/PeripheralTuner.h | 2 +- + 40 files changed, 404 insertions(+), 401 deletions(-) + delete mode 100644 xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp + delete mode 100644 xbmc/peripherals/bus/linux/PeripheralBusRPi.h + create mode 100644 xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp + create mode 100644 xbmc/peripherals/bus/virtual/PeripheralBusCEC.h + +diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj +index bf4a009..fbcd662 100644 +diff --git a/configure.in b/configure.in +index 4769315..4472e3e 100644 +--- a/configure.in ++++ b/configure.in +@@ -157,8 +157,6 @@ libusb_disabled="== libusb disabled. Plug and play USB device support will not b + libusb_disabled_udev_found="== libusb disabled. ==" + libcec_enabled="== libcec enabled. ==" + libcec_disabled="== libcec disabled. CEC adapter support will not be available. ==" +-libcec_disabled_missing_libs="== libcec disabled because it either needs libudev, or libusb a compatible version of the RPi API. CEC adapter support will not be available. ==" +-cec_rpi_api_missing="== no compatible RPi API found ==" + + # External library message strings + external_libraries_enabled="== Use of all supported external libraries enabled. ==" +@@ -1455,46 +1453,18 @@ fi + + # libcec + USE_LIBCEC=0 +-USE_CEC_RPI_API=0 +-use_rpi_cec_api="auto" + if test "x$use_libcec" != "xno"; then +- case "${host_cpu}" in +- arm*) +- echo "will check for RPi support" +- AC_CHECK_HEADER(interface/vmcs_host/vc_cec.h,,use_rpi_cec_api="no") +- ;; +- *) +- echo "will not check for RPi support (unsupported cpu: ${host_cpu})" +- use_rpi_cec_api="no" +- ;; +- esac +- +- # libcec needs libudev, libusb or the RPi API under linux, or the device will never be detected. +- if test "$host_vendor" != "apple" && test "$use_libusb" = "no" && test "$use_libudev" = "no" && test "$use_rpi_cec_api" = "no"; then +- if test "x$use_libcec" != "xauto"; then +- AC_MSG_ERROR($libcec_disabled_missing_libs) +- else +- use_libcec="no" +- AC_MSG_NOTICE($libcec_disabled_missing_libs) +- fi +- fi +- + # libcec is dyloaded, so we need to check for its headers and link any depends. + if test "x$use_libcec" != "xno"; then + if test "x$use_libcec" != "xauto"; then +- PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)]) ++ PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)]) + else +- PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) ++ PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) + fi + + if test "x$use_libcec" != "xno"; then + INCLUDES="$INCLUDES $CEC_CFLAGS" + USE_LIBCEC=1;AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libcec is installed"]) +- if test "x$use_rpi_cec_api" != "xno"; then +- LIBS+=" -lvcos -lvchiq_arm" +- AC_DEFINE([HAVE_CEC_RPI_API],[1],["Define to 1 if the CEC RPi API is installed"]) +- USE_CEC_RPI_API=1 +- fi + XB_FIND_SONAME([LIBCEC],[cec],[use_libcec]) + AC_MSG_NOTICE($libcec_enabled) + else +@@ -2255,11 +2225,6 @@ fi + + if test "x$use_libcec" != "xno"; then + final_message="$final_message\n libcec support:\tYes" +- if test "x$use_rpi_cec_api" != "xno"; then +- final_message="$final_message\n libcec RPi support:\tYes" +- else +- final_message="$final_message\n libcec RPi support:\tNo" +- fi + else + final_message="$final_message\n libcec support:\tNo" + fi +@@ -2451,7 +2416,6 @@ AC_SUBST(USE_AIRTUNES) + AC_SUBST(USE_LIBUDEV) + AC_SUBST(USE_LIBUSB) + AC_SUBST(USE_LIBCEC) +-AC_SUBST(USE_CEC_RPI_API) + AC_SUBST(USE_MYSQL) + AC_SUBST(USE_WEB_SERVER) + AC_SUBST(USE_UPNP) +diff --git a/project/BuildDependencies/scripts/libcec_d.txt b/project/BuildDependencies/scripts/libcec_d.txt +index c1419b5..2c7d495 100644 +diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj +index fb0947e..7e32ccc 100644 +diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters +index 53a6c97..52a5373 100644 +diff --git a/system/peripherals.xml b/system/peripherals.xml +index 967b96c..68205df 100644 +--- a/system/peripherals.xml ++++ b/system/peripherals.xml +@@ -7,30 +7,7 @@ + + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ + + + +@@ -54,6 +31,12 @@ + + + ++ ++ ++ ++ + + + +diff --git a/tools/android/depends/libcec/Makefile b/tools/android/depends/libcec/Makefile +index 7d9b6b8..0147147 100644 +--- a/tools/android/depends/libcec/Makefile ++++ b/tools/android/depends/libcec/Makefile +@@ -3,7 +3,7 @@ DEPS= ../Makefile.include Makefile + + # lib name, version + LIBNAME=libcec +-VERSION=2.0.5-3 ++VERSION=2.1.0 + SOURCE=$(LIBNAME)-$(VERSION) + ARCHIVE=$(SOURCE).tar.gz + +@@ -11,7 +11,7 @@ ARCHIVE=$(SOURCE).tar.gz + CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST) \ + ac_cv_search_dlopen=yes + +-LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.0 ++LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.1 + + all: .installed-$(PLATFORM) + +diff --git a/tools/darwin/depends/libcec/Makefile b/tools/darwin/depends/libcec/Makefile +index 3e84bff..b7970dd 100644 +--- a/tools/darwin/depends/libcec/Makefile ++++ b/tools/darwin/depends/libcec/Makefile +@@ -3,7 +3,7 @@ include ../config.site.mk + + # lib name, version + LIBNAME=libcec +-VERSION=2.0.5-3 ++VERSION=2.1.0 + SOURCE=$(LIBNAME)-$(VERSION) + ARCHIVE=$(SOURCE).tar.gz + +diff --git a/xbmc/peripherals/PeripheralTypes.h b/xbmc/peripherals/PeripheralTypes.h +index 3cd7691..03030d4 100644 +--- a/xbmc/peripherals/PeripheralTypes.h ++++ b/xbmc/peripherals/PeripheralTypes.h +@@ -35,7 +35,8 @@ + PERIPHERAL_BUS_UNKNOWN = 0, + PERIPHERAL_BUS_USB, + PERIPHERAL_BUS_PCI, +- PERIPHERAL_BUS_RPI ++ PERIPHERAL_BUS_RPI, ++ PERIPHERAL_BUS_CEC + }; + + enum PeripheralFeature +@@ -143,6 +144,8 @@ + return "pci"; + case PERIPHERAL_BUS_RPI: + return "rpi"; ++ case PERIPHERAL_BUS_CEC: ++ return "cec"; + default: + return "unknown"; + } +@@ -159,6 +162,8 @@ + return PERIPHERAL_BUS_PCI; + else if (strTypeLowerCase.Equals("rpi")) + return PERIPHERAL_BUS_RPI; ++ else if (strTypeLowerCase.Equals("cec")) ++ return PERIPHERAL_BUS_CEC; + + return PERIPHERAL_BUS_UNKNOWN; + }; +@@ -180,4 +185,73 @@ + strHexString.Format("%04X", iVal); + }; + }; ++ ++ class PeripheralScanResult ++ { ++ public: ++ PeripheralScanResult(const PeripheralBusType busType) : ++ m_type(PERIPHERAL_UNKNOWN), ++ m_iVendorId(0), ++ m_iProductId(0), ++ m_mappedType(PERIPHERAL_UNKNOWN), ++ m_busType(busType), ++ m_mappedBusType(busType), ++ m_iSequence(0) {} ++ ++ PeripheralScanResult(void) : ++ m_type(PERIPHERAL_UNKNOWN), ++ m_iVendorId(0), ++ m_iProductId(0), ++ m_mappedType(PERIPHERAL_UNKNOWN), ++ m_busType(PERIPHERAL_BUS_UNKNOWN), ++ m_mappedBusType(PERIPHERAL_BUS_UNKNOWN), ++ m_iSequence(0) {} ++ ++ bool operator ==(const PeripheralScanResult& right) const ++ { ++ return m_iVendorId == right.m_iVendorId && ++ m_iProductId == right.m_iProductId && ++ m_type == right.m_type && ++ m_busType == right.m_busType && ++ m_strLocation.Equals(right.m_strLocation); ++ } ++ ++ bool operator !=(const PeripheralScanResult& right) const ++ { ++ return !(*this == right); ++ } ++ ++ PeripheralType m_type; ++ CStdString m_strLocation; ++ int m_iVendorId; ++ int m_iProductId; ++ PeripheralType m_mappedType; ++ CStdString m_strDeviceName; ++ PeripheralBusType m_busType; ++ PeripheralBusType m_mappedBusType; ++ unsigned int m_iSequence; // when more than one adapter of the same type is found ++ }; ++ ++ struct PeripheralScanResults ++ { ++ bool GetDeviceOnLocation(const CStdString& strLocation, PeripheralScanResult* result) const ++ { ++ for (std::vector::const_iterator it = m_results.begin(); it != m_results.end(); it++) ++ { ++ if ((*it).m_strLocation == strLocation) ++ { ++ *result = *it; ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ bool ContainsResult(const PeripheralScanResult& result) const ++ { ++ return std::find(m_results.begin(), m_results.end(), result) != m_results.end(); ++ } ++ ++ std::vector m_results; ++ }; + } +diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp +index 3ce8c07..c5fadd9 100644 +--- a/xbmc/peripherals/Peripherals.cpp ++++ b/xbmc/peripherals/Peripherals.cpp +@@ -31,8 +31,8 @@ + #include "bus/PeripheralBusUSB.h" + #include "dialogs/GUIDialogPeripheralManager.h" + +-#ifdef HAVE_CEC_RPI_API +-#include "bus/linux/PeripheralBusRPi.h" ++#if defined(HAVE_LIBCEC) ++#include "bus/virtual/PeripheralBusCEC.h" + #endif + + #include "threads/SingleLock.h" +@@ -84,8 +84,8 @@ void CPeripherals::Initialise(void) + #if defined(HAVE_PERIPHERAL_BUS_USB) + m_busses.push_back(new CPeripheralBusUSB(this)); + #endif +-#ifdef HAVE_CEC_RPI_API +- m_busses.push_back(new CPeripheralBusRPi(this)); ++#if defined(HAVE_LIBCEC) ++ m_busses.push_back(new CPeripheralBusCEC(this)); + #endif + + /* initialise all known busses */ +@@ -229,54 +229,50 @@ bool CPeripherals::HasPeripheralWithFeature(const PeripheralFeature feature, Per + return (GetPeripheralsWithFeature(dummy, feature, busType) > 0); + } + +-CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const PeripheralType type, const CStdString &strLocation, int iVendorId /* = 0 */, int iProductId /* = 0 */) ++CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const PeripheralScanResult& result) + { + CPeripheral *peripheral = NULL; ++ PeripheralScanResult mappedResult = result; ++ if (mappedResult.m_busType == PERIPHERAL_BUS_UNKNOWN) ++ mappedResult.m_busType = bus.Type(); ++ + /* check whether there's something mapped in peripherals.xml */ +- PeripheralType mappedType = type; +- CStdString strDeviceName; +- int iMappingPtr = GetMappingForDevice(bus, type, iVendorId, iProductId); +- bool bHasMapping(iMappingPtr >= 0); +- if (bHasMapping) +- { +- mappedType = m_mappings[iMappingPtr].m_mappedTo; +- strDeviceName = m_mappings[iMappingPtr].m_strDeviceName; +- } +- else ++ if (!GetMappingForDevice(bus, mappedResult)) + { + /* don't create instances for devices that aren't mapped in peripherals.xml */ + return NULL; + } + +- switch(mappedType) ++ switch(mappedResult.m_mappedType) + { + case PERIPHERAL_HID: +- peripheral = new CPeripheralHID(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); ++ peripheral = new CPeripheralHID(mappedResult); + break; + + case PERIPHERAL_NIC: +- peripheral = new CPeripheralNIC(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); ++ peripheral = new CPeripheralNIC(mappedResult); + break; + + case PERIPHERAL_DISK: +- peripheral = new CPeripheralDisk(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); ++ peripheral = new CPeripheralDisk(mappedResult); + break; + + case PERIPHERAL_NYXBOARD: +- peripheral = new CPeripheralNyxboard(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); ++ peripheral = new CPeripheralNyxboard(mappedResult); + break; + + case PERIPHERAL_TUNER: +- peripheral = new CPeripheralTuner(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); ++ peripheral = new CPeripheralTuner(mappedResult); + break; + + case PERIPHERAL_BLUETOOTH: +- peripheral = new CPeripheralBluetooth(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); ++ peripheral = new CPeripheralBluetooth(mappedResult); + break; + + case PERIPHERAL_CEC: + #if defined(HAVE_LIBCEC) +- peripheral = new CPeripheralCecAdapter(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); ++ if (bus.Type() == PERIPHERAL_BUS_CEC) ++ peripheral = new CPeripheralCecAdapter(mappedResult); + #else + if (!m_bMissingLibCecWarningDisplayed) + { +@@ -288,7 +284,7 @@ CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const Periphera + break; + + case PERIPHERAL_IMON: +- peripheral = new CPeripheralImon(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); ++ peripheral = new CPeripheralImon(mappedResult); + break; + + default: +@@ -305,7 +301,7 @@ CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const Periphera + } + else + { +- CLog::Log(LOGDEBUG, "%s - failed to initialise peripheral on '%s'", __FUNCTION__, strLocation.c_str()); ++ CLog::Log(LOGDEBUG, "%s - failed to initialise peripheral on '%s'", __FUNCTION__, mappedResult.m_strLocation.c_str()); + delete peripheral; + peripheral = NULL; + } +@@ -340,7 +336,7 @@ void CPeripherals::OnDeviceDeleted(const CPeripheralBus &bus, const CPeripheral + CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(35006), peripheral.DeviceName()); + } + +-int CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, const PeripheralType classType, int iVendorId, int iProductId) const ++bool CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, PeripheralScanResult& result) const + { + /* check all mappings in the order in which they are defined in peripherals.xml */ + for (unsigned int iMappingPtr = 0; iMappingPtr < m_mappings.size(); iMappingPtr++) +@@ -355,24 +351,26 @@ int CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, const Periphera + else + { + for (unsigned int i = 0; i < mapping.m_PeripheralID.size(); i++) +- if (mapping.m_PeripheralID[i].m_iVendorId == iVendorId && mapping.m_PeripheralID[i].m_iProductId == iProductId) ++ if (mapping.m_PeripheralID[i].m_iVendorId == result.m_iVendorId && mapping.m_PeripheralID[i].m_iProductId == result.m_iProductId) + bProductMatch = true; + } + + bool bBusMatch = (mapping.m_busType == PERIPHERAL_BUS_UNKNOWN || mapping.m_busType == bus.Type()); +- bool bClassMatch = (mapping.m_class == PERIPHERAL_UNKNOWN || mapping.m_class == classType); ++ bool bClassMatch = (mapping.m_class == PERIPHERAL_UNKNOWN || mapping.m_class == result.m_type); + + if (bProductMatch && bBusMatch && bClassMatch) + { + CStdString strVendorId, strProductId; +- PeripheralTypeTranslator::FormatHexString(iVendorId, strVendorId); +- PeripheralTypeTranslator::FormatHexString(iProductId, strProductId); ++ PeripheralTypeTranslator::FormatHexString(result.m_iVendorId, strVendorId); ++ PeripheralTypeTranslator::FormatHexString(result.m_iProductId, strProductId); + CLog::Log(LOGDEBUG, "%s - device (%s:%s) mapped to %s (type = %s)", __FUNCTION__, strVendorId.c_str(), strProductId.c_str(), mapping.m_strDeviceName.c_str(), PeripheralTypeTranslator::TypeToString(mapping.m_mappedTo)); +- return iMappingPtr; ++ result.m_mappedType = m_mappings[iMappingPtr].m_mappedTo; ++ result.m_strDeviceName = m_mappings[iMappingPtr].m_strDeviceName; ++ return true; + } + } + +- return -1; ++ return false; + } + + void CPeripherals::GetSettingsFromMapping(CPeripheral &peripheral) const +diff --git a/xbmc/peripherals/Peripherals.h b/xbmc/peripherals/Peripherals.h +index ac94699..9594ff8 100644 +--- a/xbmc/peripherals/Peripherals.h ++++ b/xbmc/peripherals/Peripherals.h +@@ -111,11 +111,10 @@ + /*! + * @brief Creates a new instance of a peripheral. + * @param bus The bus on which this peripheral is present. +- * @param type The type of the new peripheral. +- * @param strLocation The location on the bus. ++ * @param result The scan result from the device scanning code. + * @return The new peripheral or NULL if it could not be created. + */ +- CPeripheral *CreatePeripheral(CPeripheralBus &bus, const PeripheralType type, const CStdString &strLocation, int iVendorId = 0, int iProductId = 0); ++ CPeripheral *CreatePeripheral(CPeripheralBus &bus, const PeripheralScanResult& result); + + /*! + * @brief Add the settings that are defined in the mappings file to the peripheral (if there is anything defined). +@@ -200,7 +199,7 @@ + private: + CPeripherals(void); + bool LoadMappings(void); +- int GetMappingForDevice(const CPeripheralBus &bus, const PeripheralType classType, int iVendorId, int iProductId) const; ++ bool GetMappingForDevice(const CPeripheralBus &bus, PeripheralScanResult& result) const; + static void GetSettingsFromMappingsFile(TiXmlElement *xmlNode, std::map &m_settings); + + bool m_bInitialised; +diff --git a/xbmc/peripherals/bus/Makefile.in b/xbmc/peripherals/bus/Makefile.in +index 01fa4e2..2262e4a 100644 +--- a/xbmc/peripherals/bus/Makefile.in ++++ b/xbmc/peripherals/bus/Makefile.in +@@ -12,8 +12,8 @@ ifeq ($(findstring osx,@ARCH@),osx) + SRCS += osx/PeripheralBusUSB.cpp + endif + +-ifeq (@USE_CEC_RPI_API@,1) +-SRCS += linux/PeripheralBusRPi.cpp ++ifeq (@USE_LIBCEC@,1) ++SRCS += virtual/PeripheralBusCEC.cpp + endif + + LIB = peripheral-bus.a +diff --git a/xbmc/peripherals/bus/PeripheralBus.cpp b/xbmc/peripherals/bus/PeripheralBus.cpp +index 727f7c9..b17a9f1 100644 +--- a/xbmc/peripherals/bus/PeripheralBus.cpp ++++ b/xbmc/peripherals/bus/PeripheralBus.cpp +@@ -29,65 +29,6 @@ + + #define PERIPHERAL_DEFAULT_RESCAN_INTERVAL 1000 + +-bool PeripheralScanResult::operator ==(const PeripheralScanResult &right) const +-{ +- return m_iVendorId == right.m_iVendorId && +- m_iProductId == right.m_iProductId && +- m_type == right.m_type && +- m_strLocation.Equals(right.m_strLocation); +-} +- +-bool PeripheralScanResult::operator !=(const PeripheralScanResult &right) const +-{ +- return !(*this == right); +-} +- +-bool PeripheralScanResult::operator ==(const CPeripheral &right) const +-{ +- return m_iVendorId == right.VendorId() && +- m_iProductId == right.ProductId() && +- m_type == right.Type() && +- m_strLocation.Equals(right.Location()); +-} +- +-bool PeripheralScanResult::operator !=(const CPeripheral &right) const +-{ +- return !(*this == right); +-} +- +-bool PeripheralScanResults::GetDeviceOnLocation(const CStdString &strLocation, PeripheralScanResult *result) const +-{ +- bool bReturn(false); +- +- for (unsigned int iDevicePtr = 0; iDevicePtr < m_results.size(); iDevicePtr++) +- { +- if (m_results.at(iDevicePtr).m_strLocation == strLocation) +- { +- *result = m_results.at(iDevicePtr); +- bReturn = true; +- break; +- } +- } +- +- return bReturn; +-} +- +-bool PeripheralScanResults::ContainsResult(const PeripheralScanResult &result) const +-{ +- bool bReturn(false); +- +- for (unsigned int iDevicePtr = 0; iDevicePtr < m_results.size(); iDevicePtr++) +- { +- if (m_results.at(iDevicePtr) == result) +- { +- bReturn = true; +- break; +- } +- } +- +- return bReturn; +-} +- + CPeripheralBus::CPeripheralBus(CPeripherals *manager, PeripheralBusType type) : + CThread("XBMC Peripherals"), + m_iRescanTime(PERIPHERAL_DEFAULT_RESCAN_INTERVAL), +@@ -137,9 +78,9 @@ void CPeripheralBus::UnregisterRemovedDevices(const PeripheralScanResults &resul + for (int iDevicePtr = (int) m_peripherals.size() - 1; iDevicePtr >= 0; iDevicePtr--) + { + CPeripheral *peripheral = m_peripherals.at(iDevicePtr); +- PeripheralScanResult updatedDevice; ++ PeripheralScanResult updatedDevice(m_type); + if (!results.GetDeviceOnLocation(peripheral->Location(), &updatedDevice) || +- updatedDevice != *peripheral) ++ *peripheral != updatedDevice) + { + /* device removed */ + removedPeripherals.push_back(peripheral); +@@ -170,9 +111,9 @@ void CPeripheralBus::RegisterNewDevices(const PeripheralScanResults &results) + CSingleLock lock(m_critSection); + for (unsigned int iResultPtr = 0; iResultPtr < results.m_results.size(); iResultPtr++) + { +- PeripheralScanResult result = results.m_results.at(iResultPtr); ++ const PeripheralScanResult& result = results.m_results.at(iResultPtr); + if (!HasPeripheral(result.m_strLocation)) +- g_peripherals.CreatePeripheral(*this, result.m_type, result.m_strLocation, result.m_iVendorId, result.m_iProductId); ++ g_peripherals.CreatePeripheral(*this, result); + } + } + +@@ -246,6 +187,20 @@ int CPeripheralBus::GetPeripheralsWithFeature(vector &results, co + return iReturn; + } + ++size_t CPeripheralBus::GetNumberOfPeripheralsWithId(const int iVendorId, const int iProductId) const ++{ ++ int iReturn(0); ++ CSingleLock lock(m_critSection); ++ for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < m_peripherals.size(); iPeripheralPtr++) ++ { ++ if (m_peripherals.at(iPeripheralPtr)->VendorId() == iVendorId && ++ m_peripherals.at(iPeripheralPtr)->ProductId() == iProductId) ++ iReturn++; ++ } ++ ++ return iReturn; ++} ++ + void CPeripheralBus::Process(void) + { + while (!m_bStop) +diff --git a/xbmc/peripherals/bus/PeripheralBus.h b/xbmc/peripherals/bus/PeripheralBus.h +index 96426a9..29ff7d7 100644 +--- a/xbmc/peripherals/bus/PeripheralBus.h ++++ b/xbmc/peripherals/bus/PeripheralBus.h +@@ -31,28 +31,6 @@ + { + class CPeripherals; + +- struct PeripheralScanResult +- { +- bool operator ==(const PeripheralScanResult &right) const; +- bool operator !=(const PeripheralScanResult &right) const; +- +- bool operator ==(const CPeripheral &right) const; +- bool operator !=(const CPeripheral &right) const; +- +- PeripheralType m_type; +- CStdString m_strLocation; +- int m_iVendorId; +- int m_iProductId; +- }; +- +- struct PeripheralScanResults +- { +- bool GetDeviceOnLocation(const CStdString &strLocation, PeripheralScanResult *result) const; +- bool ContainsResult(const PeripheralScanResult &result) const; +- +- std::vector m_results; +- }; +- + /*! + * @class CPeripheralBus + * This represents a bus on the system. By default, this bus instance will scan for changes every second. +@@ -100,6 +78,7 @@ + virtual int GetPeripheralsWithFeature(std::vector &results, const PeripheralFeature feature) const; + + virtual size_t GetNumberOfPeripherals() const; ++ virtual size_t GetNumberOfPeripheralsWithId(const int iVendorId, const int iProductId) const; + + /*! + * @brief Get all features that are supported by devices on this bus. +diff --git a/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp b/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp +deleted file mode 100644 +index 8a436e4..0000000 +--- a/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp ++++ /dev/null +@@ -1,69 +0,0 @@ +-/* +- * Copyright (C) 2005-2012 Team XBMC +- * http://xbmc.org +- * +- * This Program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2, or (at your option) +- * any later version. +- * +- * This Program 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 General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with XBMC; see the file COPYING. If not, see +- * . +- * +- */ +- +-#include "PeripheralBusRPi.h" +-#include +- +-extern "C" { +-#include +-#include +-} +- +-using namespace PERIPHERALS; +- +-#define RPI_PERIPHERAL_BUS_VID 0x2708 +-#define RPI_PERIPHERAL_CEC_PID 0x1001 +- +-CPeripheralBusRPi::CPeripheralBusRPi(CPeripherals *manager) : +- CPeripheralBus(manager, PERIPHERAL_BUS_RPI) +-{ +- m_bNeedsPolling = false; +-} +- +-bool CPeripheralBusRPi::PerformDeviceScan(PeripheralScanResults &results) +-{ +- if (FindAdapter()) +- { +- PeripheralScanResult result; +- result.m_iVendorId = RPI_PERIPHERAL_BUS_VID; +- result.m_iProductId = RPI_PERIPHERAL_CEC_PID; +- result.m_type = PERIPHERAL_CEC; +- result.m_strLocation = CEC_RPI_VIRTUAL_COM; +- +- if (!results.ContainsResult(result)) +- results.m_results.push_back(result); +- } +- +- return true; +-} +- +-bool CPeripheralBusRPi::FindAdapter(void) +-{ +- uint8_t iResult; +- +- VCHI_INSTANCE_T vchiq_instance; +- if ((iResult = vchi_initialise(&vchiq_instance)) != VCHIQ_SUCCESS) +- return false; +- +- if ((iResult = vchi_connect(NULL, 0, vchiq_instance)) != VCHIQ_SUCCESS) +- return false; +- +- return true; +-} +diff --git a/xbmc/peripherals/bus/linux/PeripheralBusRPi.h b/xbmc/peripherals/bus/linux/PeripheralBusRPi.h +deleted file mode 100644 +index e660401..0000000 +--- a/xbmc/peripherals/bus/linux/PeripheralBusRPi.h ++++ /dev/null +@@ -1,40 +0,0 @@ +-#pragma once +-/* +- * Copyright (C) 2005-2012 Team XBMC +- * http://xbmc.org +- * +- * This Program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2, or (at your option) +- * any later version. +- * +- * This Program 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 General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with XBMC; see the file COPYING. If not, see +- * . +- * +- */ +- +-#include "peripherals/bus/PeripheralBus.h" +-#include "peripherals/devices/Peripheral.h" +- +-namespace PERIPHERALS +-{ +- class CPeripherals; +- +- class CPeripheralBusRPi : public CPeripheralBus +- { +- public: +- CPeripheralBusRPi(CPeripherals *manager); +- virtual ~CPeripheralBusRPi(void) {}; +- +- bool PerformDeviceScan(PeripheralScanResults &results); +- +- private: +- bool FindAdapter(void); +- }; +-} +diff --git a/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp b/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp +index 659ebf0..563c96e 100644 +--- a/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp ++++ b/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp +@@ -43,7 +43,7 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results) + struct usb_device *dev; + for (dev = bus->devices; dev; dev = dev->next) + { +- PeripheralScanResult result; ++ PeripheralScanResult result(m_type); + result.m_iVendorId = dev->descriptor.idVendor; + result.m_iProductId = dev->descriptor.idProduct; + result.m_type = (dev->descriptor.bDeviceClass == USB_CLASS_PER_INTERFACE && dev->descriptor.bNumConfigurations > 0 && +@@ -55,6 +55,7 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results) + #else + result.m_strLocation.Format("/bus%s/dev%s", bus->dirname, dev->filename); + #endif ++ result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId); + if (!results.ContainsResult(result)) + results.m_results.push_back(result); + } +diff --git a/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUdev.cpp b/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUdev.cpp +index b7a0061..ca21e06 100644 +--- a/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUdev.cpp ++++ b/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUdev.cpp +@@ -152,12 +152,12 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results) + iClass = USB_CLASS_HID; + } + +- PeripheralScanResult result; ++ PeripheralScanResult result(m_type); + result.m_iVendorId = PeripheralTypeTranslator::HexStringToInt(udev_device_get_sysattr_value(dev, "idVendor")); + result.m_iProductId = PeripheralTypeTranslator::HexStringToInt(udev_device_get_sysattr_value(dev, "idProduct")); + result.m_type = GetType(iClass); + result.m_strLocation = udev_device_get_syspath(dev); +- ++ result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId); + if (!results.ContainsResult(result)) + results.m_results.push_back(result); + } +diff --git a/xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp b/xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp +index b0e3617..78bd224 100644 +--- a/xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp ++++ b/xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp +@@ -266,6 +266,7 @@ void CPeripheralBusUSB::DeviceAttachCallback(CPeripheralBusUSB* refCon, io_itera + else + privateDataRef->result.m_type = refCon->GetType(bDeviceClass); + ++ privateDataRef->result.m_iSequence = refCon->GetNumberOfPeripheralsWithId(privateDataRef->result.m_iVendorId, privateDataRef->result.m_iProductId); + if (!refCon->m_scan_results.ContainsResult(privateDataRef->result)) + { + // register this usb device for an interest notification callback. +diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp +new file mode 100644 +index 0000000..da169c1 +--- /dev/null ++++ b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp +@@ -0,0 +1,116 @@ ++/* ++ * Copyright (C) 2005-2012 Team XBMC ++ * http://xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * . ++ * ++ */ ++ ++#include "system.h" ++#if defined(HAVE_LIBCEC) ++#include "PeripheralBusCEC.h" ++#include "peripherals/Peripherals.h" ++#include "utils/log.h" ++#include "DynamicDll.h" ++ ++#include ++ ++using namespace PERIPHERALS; ++using namespace CEC; ++using namespace std; ++ ++class DllLibCECInterface ++{ ++public: ++ virtual ~DllLibCECInterface() {} ++ virtual ICECAdapter* CECInitialise(libcec_configuration *configuration)=0; ++ virtual void* CECDestroy(ICECAdapter *adapter)=0; ++}; ++ ++class PERIPHERALS::DllLibCEC : public DllDynamic, DllLibCECInterface ++{ ++ DECLARE_DLL_WRAPPER(DllLibCEC, DLL_PATH_LIBCEC) ++ ++ DEFINE_METHOD1(ICECAdapter*, CECInitialise, (libcec_configuration *p1)) ++ DEFINE_METHOD1(void* , CECDestroy, (ICECAdapter *p1)) ++ ++ BEGIN_METHOD_RESOLVE() ++ RESOLVE_METHOD_RENAME(CECInitialise, CECInitialise) ++ RESOLVE_METHOD_RENAME(CECDestroy, CECDestroy) ++ END_METHOD_RESOLVE() ++}; ++ ++CPeripheralBusCEC::CPeripheralBusCEC(CPeripherals *manager) : ++ CPeripheralBus(manager, PERIPHERAL_BUS_CEC), ++ m_dll(new DllLibCEC), ++ m_cecAdapter(NULL) ++{ ++ m_iRescanTime = 1000; ++ if (!m_dll->Load() || !m_dll->IsLoaded()) ++ { ++ delete m_dll; ++ m_dll = NULL; ++ } ++ else ++ { ++ m_cecAdapter = m_dll->CECInitialise(&m_configuration); ++ } ++} ++ ++CPeripheralBusCEC::~CPeripheralBusCEC(void) ++{ ++ if (m_dll && m_cecAdapter) ++ m_dll->CECDestroy(m_cecAdapter); ++ delete m_dll; ++} ++ ++bool CPeripheralBusCEC::PerformDeviceScan(PeripheralScanResults &results) ++{ ++ if (!m_dll || !m_cecAdapter) ++ return false; ++ ++ cec_adapter_descriptor deviceList[10]; ++ int8_t iFound = m_cecAdapter->DetectAdapters(deviceList, 10, NULL, true); ++ ++ for (uint8_t iDevicePtr = 0; iDevicePtr < iFound; iDevicePtr++) ++ { ++ PeripheralScanResult result(m_type); ++ result.m_iVendorId = deviceList[iDevicePtr].iVendorId; ++ result.m_iProductId = deviceList[iDevicePtr].iProductId; ++ result.m_strLocation = deviceList[iDevicePtr].strComName; ++ result.m_type = PERIPHERAL_CEC; ++ ++ // override the bus type, so users don't have to reconfigure their adapters ++ switch(deviceList[iDevicePtr].adapterType) ++ { ++ case ADAPTERTYPE_P8_EXTERNAL: ++ case ADAPTERTYPE_P8_DAUGHTERBOARD: ++ result.m_mappedBusType = PERIPHERAL_BUS_USB; ++ break; ++ case ADAPTERTYPE_RPI: ++ result.m_mappedBusType = PERIPHERAL_BUS_RPI; ++ break; ++ default: ++ break; ++ } ++ ++ result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId); ++ if (!results.ContainsResult(result)) ++ results.m_results.push_back(result); ++ } ++ return true; ++} ++ ++#endif +diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h +new file mode 100644 +index 0000000..acba01a +--- /dev/null ++++ b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h +@@ -0,0 +1,57 @@ ++#pragma once ++/* ++ * Copyright (C) 2005-2013 Team XBMC ++ * http://xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program 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 General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * . ++ * ++ */ ++ ++#include "peripherals/bus/PeripheralBus.h" ++#include "peripherals/devices/Peripheral.h" ++ ++// undefine macro isset, it collides with function in cectypes.h ++#ifdef isset ++#undef isset ++#endif ++#include ++ ++namespace CEC ++{ ++ class ICECAdapter; ++} ++ ++namespace PERIPHERALS ++{ ++ class CPeripherals; ++ class DllLibCEC; ++ ++ class CPeripheralBusCEC : public CPeripheralBus ++ { ++ public: ++ CPeripheralBusCEC(CPeripherals *manager); ++ virtual ~CPeripheralBusCEC(void); ++ ++ /*! ++ * @see PeripheralBus::PerformDeviceScan() ++ */ ++ bool PerformDeviceScan(PeripheralScanResults &results); ++ ++ private: ++ DllLibCEC* m_dll; ++ CEC::ICECAdapter* m_cecAdapter; ++ CEC::libcec_configuration m_configuration; ++ }; ++} +diff --git a/xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp b/xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp +index 811e0d1..fb55561 100644 +--- a/xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp ++++ b/xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp +@@ -104,14 +104,15 @@ bool CPeripheralBusUSB::PerformDeviceScan(const GUID *guid, const PeripheralType + + if ((strTmp.Find("&mi_") < 0) || (strTmp.Find("&mi_00") >= 0)) + { +- PeripheralScanResult prevDevice; ++ PeripheralScanResult prevDevice(m_type); + if (!results.GetDeviceOnLocation(devicedetailData->DevicePath, &prevDevice)) + { +- PeripheralScanResult result; ++ PeripheralScanResult result(m_type); + result.m_strLocation = devicedetailData->DevicePath; + result.m_type = type; + result.m_iVendorId = PeripheralTypeTranslator::HexStringToInt(strVendorId.c_str()); + result.m_iProductId = PeripheralTypeTranslator::HexStringToInt(strProductId.c_str()); ++ result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId); + + if (!results.ContainsResult(result)) + results.m_results.push_back(result); +diff --git a/xbmc/peripherals/devices/Peripheral.cpp b/xbmc/peripherals/devices/Peripheral.cpp +index e9cde30..ad2227a 100644 +--- a/xbmc/peripherals/devices/Peripheral.cpp ++++ b/xbmc/peripherals/devices/Peripheral.cpp +@@ -38,39 +38,23 @@ struct SortBySettingsOrder + } + }; + +-CPeripheral::CPeripheral(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : +- m_type(type), +- m_busType(busType), +- m_strLocation(strLocation), +- m_strDeviceName(strDeviceName), ++CPeripheral::CPeripheral(const PeripheralScanResult& scanResult) : ++ m_type(scanResult.m_mappedType), ++ m_busType(scanResult.m_busType), ++ m_mappedBusType(scanResult.m_mappedBusType), ++ m_strLocation(scanResult.m_strLocation), ++ m_strDeviceName(scanResult.m_strDeviceName), + m_strFileLocation(StringUtils::EmptyString), +- m_iVendorId(iVendorId), +- m_iProductId(iProductId), +- m_strVersionInfo(g_localizeStrings.Get(13205)), // "unknown" +- m_bInitialised(false), +- m_bHidden(false), +- m_bError(false) +-{ +- PeripheralTypeTranslator::FormatHexString(iVendorId, m_strVendorId); +- PeripheralTypeTranslator::FormatHexString(iProductId, m_strProductId); +- m_strFileLocation.Format("peripherals://%s/%s.dev", PeripheralTypeTranslator::BusTypeToString(busType), strLocation.c_str()); +-} +- +-CPeripheral::CPeripheral(void) : +- m_type(PERIPHERAL_UNKNOWN), +- m_busType(PERIPHERAL_BUS_UNKNOWN), +- m_strLocation(StringUtils::EmptyString), +- m_strDeviceName(StringUtils::EmptyString), +- m_strFileLocation(StringUtils::EmptyString), +- m_iVendorId(0), +- m_strVendorId("0000"), +- m_iProductId(0), +- m_strProductId("0000"), ++ m_iVendorId(scanResult.m_iVendorId), ++ m_iProductId(scanResult.m_iProductId), + m_strVersionInfo(g_localizeStrings.Get(13205)), // "unknown" + m_bInitialised(false), + m_bHidden(false), + m_bError(false) + { ++ PeripheralTypeTranslator::FormatHexString(scanResult.m_iVendorId, m_strVendorId); ++ PeripheralTypeTranslator::FormatHexString(scanResult.m_iProductId, m_strProductId); ++ m_strFileLocation.Format(scanResult.m_iSequence > 0 ? "peripherals://%s/%s_%d.dev" : "peripherals://%s/%s.dev", PeripheralTypeTranslator::BusTypeToString(scanResult.m_busType), scanResult.m_strLocation.c_str(), scanResult.m_iSequence); + } + + CPeripheral::~CPeripheral(void) +@@ -146,7 +130,7 @@ bool CPeripheral::Initialise(void) + return bReturn; + + g_peripherals.GetSettingsFromMapping(*this); +- m_strSettingsFile.Format("special://profile/peripheral_data/%s_%s_%s.xml", PeripheralTypeTranslator::BusTypeToString(m_busType), m_strVendorId.c_str(), m_strProductId.c_str()); ++ m_strSettingsFile.Format("special://profile/peripheral_data/%s_%s_%s.xml", PeripheralTypeTranslator::BusTypeToString(m_mappedBusType), m_strVendorId.c_str(), m_strProductId.c_str()); + LoadPersistedSettings(); + + for (unsigned int iFeaturePtr = 0; iFeaturePtr < m_features.size(); iFeaturePtr++) +@@ -535,3 +519,13 @@ void CPeripheral::ClearSettings(void) + } + m_settings.clear(); + } ++ ++bool CPeripheral::operator ==(const PeripheralScanResult& right) const ++{ ++ return m_strLocation.Equals(right.m_strLocation); ++} ++ ++bool CPeripheral::operator !=(const PeripheralScanResult& right) const ++{ ++ return !(*this == right); ++} +diff --git a/xbmc/peripherals/devices/Peripheral.h b/xbmc/peripherals/devices/Peripheral.h +index d42e83e..64cf64e 100644 +--- a/xbmc/peripherals/devices/Peripheral.h ++++ b/xbmc/peripherals/devices/Peripheral.h +@@ -34,12 +34,13 @@ + friend class CGUIDialogPeripheralSettings; + + public: +- CPeripheral(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); +- CPeripheral(void); ++ CPeripheral(const PeripheralScanResult& scanResult); + virtual ~CPeripheral(void); + + bool operator ==(const CPeripheral &right) const; + bool operator !=(const CPeripheral &right) const; ++ bool operator ==(const PeripheralScanResult& right) const; ++ bool operator !=(const PeripheralScanResult& right) const; + + const CStdString &FileLocation(void) const { return m_strFileLocation; } + const CStdString &Location(void) const { return m_strLocation; } +@@ -158,6 +159,7 @@ + + PeripheralType m_type; + PeripheralBusType m_busType; ++ PeripheralBusType m_mappedBusType; + CStdString m_strLocation; + CStdString m_strDeviceName; + CStdString m_strSettingsFile; +diff --git a/xbmc/peripherals/devices/PeripheralBluetooth.cpp b/xbmc/peripherals/devices/PeripheralBluetooth.cpp +index a2f4e06..4785f7b 100644 +--- a/xbmc/peripherals/devices/PeripheralBluetooth.cpp ++++ b/xbmc/peripherals/devices/PeripheralBluetooth.cpp +@@ -23,8 +23,8 @@ + + using namespace PERIPHERALS; + +-CPeripheralBluetooth::CPeripheralBluetooth(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : +- CPeripheral(type, busType, strLocation, strDeviceName, iVendorId, iProductId) ++CPeripheralBluetooth::CPeripheralBluetooth(const PeripheralScanResult& scanResult) : ++ CPeripheral(scanResult) + { + m_features.push_back(FEATURE_BLUETOOTH); + } +diff --git a/xbmc/peripherals/devices/PeripheralBluetooth.h b/xbmc/peripherals/devices/PeripheralBluetooth.h +index 6b79be9..a1be1ff 100644 +--- a/xbmc/peripherals/devices/PeripheralBluetooth.h ++++ b/xbmc/peripherals/devices/PeripheralBluetooth.h +@@ -26,7 +26,7 @@ + class CPeripheralBluetooth : public CPeripheral + { + public: +- CPeripheralBluetooth(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); ++ CPeripheralBluetooth(const PeripheralScanResult& scanResult); + virtual ~CPeripheralBluetooth(void) {}; + }; + } +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index e578dc3..983e1a7 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -80,14 +80,15 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface + 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), ++CPeripheralCecAdapter::CPeripheralCecAdapter(const PeripheralScanResult& scanResult) : ++ CPeripheralHID(scanResult), + CThread("CEC Adapter"), + m_dll(NULL), + m_cecAdapter(NULL) + { + ResetMembers(); + m_features.push_back(FEATURE_CEC); ++ m_strComPort = scanResult.m_strLocation; + } + + CPeripheralCecAdapter::~CPeripheralCecAdapter(void) +@@ -98,6 +99,7 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface + m_bStop = true; + } + ++ SAFE_DELETE(m_queryThread); + StopThread(true); + + if (m_dll && m_cecAdapter) +@@ -302,38 +304,6 @@ void CPeripheralCecAdapter::SetVersionInfo(const libcec_configuration &configura + } + } + +-CStdString CPeripheralCecAdapter::GetComPort(void) +-{ +- CStdString strPort = GetSettingString("port"); +- if (strPort.IsEmpty()) +- { +- strPort = m_strFileLocation; +- cec_adapter deviceList[10]; +- TranslateComPort(strPort); +- uint8_t iFound = m_cecAdapter->FindAdapters(deviceList, 10, strPort.c_str()); +- +- if (iFound <= 0) +- { +- CLog::Log(LOGWARNING, "%s - no CEC adapters found on %s", __FUNCTION__, strPort.c_str()); +- // display warning: couldn't set up com port +- CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(36000), g_localizeStrings.Get(36011)); +- strPort = ""; +- } +- else +- { +- cec_adapter *dev = &deviceList[0]; +- if (iFound > 1) +- CLog::Log(LOGDEBUG, "%s - multiple com ports found for device. taking the first one", __FUNCTION__); +- else +- CLog::Log(LOGDEBUG, "%s - autodetect com port '%s'", __FUNCTION__, dev->comm); +- +- strPort = dev->comm; +- } +- } +- +- return strPort; +-} +- + bool CPeripheralCecAdapter::OpenConnection(void) + { + bool bIsOpen(false); +@@ -345,12 +315,8 @@ bool CPeripheralCecAdapter::OpenConnection(void) + return bIsOpen; + } + +- CStdString strPort = GetComPort(); +- if (strPort.empty()) +- return bIsOpen; +- + // open the CEC adapter +- CLog::Log(LOGDEBUG, "%s - opening a connection to the CEC adapter: %s", __FUNCTION__, strPort.c_str()); ++ CLog::Log(LOGDEBUG, "%s - opening a connection to the CEC adapter: %s", __FUNCTION__, m_strComPort.c_str()); + + // scanning the CEC bus takes about 5 seconds, so display a notification to inform users that we're busy + CStdString strMessage; +@@ -361,7 +327,7 @@ bool CPeripheralCecAdapter::OpenConnection(void) + + while (!m_bStop && !bIsOpen) + { +- if ((bIsOpen = m_cecAdapter->Open(strPort.c_str(), 10000)) == false) ++ if ((bIsOpen = m_cecAdapter->Open(m_strComPort.c_str(), 10000)) == false) + { + // display warning: couldn't initialise libCEC + CLog::Log(LOGERROR, "%s - could not opening a connection to the CEC adapter", __FUNCTION__); +@@ -430,8 +396,7 @@ void CPeripheralCecAdapter::Process(void) + Sleep(5); + } + +- delete m_queryThread; +- m_queryThread = NULL; ++ SAFE_DELETE(m_queryThread); + + bool bSendStandbyCommands(false); + { +@@ -1255,8 +1220,7 @@ int CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message me + + bool CPeripheralCecAdapter::TranslateComPort(CStdString &strLocation) + { +- if ((strLocation.Left(18).Equals("peripherals://usb/") || +- strLocation.Left(18).Equals("peripherals://rpi/")) && ++ if ((strLocation.Left(18).Equals("peripherals://cec/")) && + strLocation.Right(4).Equals(".dev")) + { + strLocation = strLocation.Right(strLocation.length() - 18); +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h +index 23cd99e..c681e60 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.h ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h +@@ -86,7 +86,7 @@ + friend class CPeripheralCecAdapterUpdateThread; + + public: +- CPeripheralCecAdapter(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); ++ CPeripheralCecAdapter(const PeripheralScanResult& scanResult); + virtual ~CPeripheralCecAdapter(void); + + void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data); +@@ -106,7 +106,6 @@ + int GetButton(void); + unsigned int GetHoldTime(void); + void ResetButton(void); +- CStdString GetComPort(void); + + void PushCecKeypress(const CEC::cec_keypress &key); + +@@ -171,6 +170,7 @@ + bool m_bActiveSourceBeforeStandby; + bool m_bOnPlayReceived; + bool m_bPlaybackPaused; ++ CStdString m_strComPort; + }; + + class CPeripheralCecAdapterUpdateThread : public CThread +diff --git a/xbmc/peripherals/devices/PeripheralDisk.cpp b/xbmc/peripherals/devices/PeripheralDisk.cpp +index 96d7fcf..b5507fc 100644 +--- a/xbmc/peripherals/devices/PeripheralDisk.cpp ++++ b/xbmc/peripherals/devices/PeripheralDisk.cpp +@@ -23,8 +23,9 @@ + + using namespace PERIPHERALS; + +-CPeripheralDisk::CPeripheralDisk(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : +- CPeripheral(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35003) : strDeviceName, iVendorId, iProductId) ++CPeripheralDisk::CPeripheralDisk(const PeripheralScanResult& scanResult) : ++ CPeripheral(scanResult) + { ++ m_strDeviceName = scanResult.m_strDeviceName.IsEmpty() ? g_localizeStrings.Get(35003) : scanResult.m_strDeviceName; + m_features.push_back(FEATURE_DISK); + } +diff --git a/xbmc/peripherals/devices/PeripheralDisk.h b/xbmc/peripherals/devices/PeripheralDisk.h +index 4fab920..fc44ff6 100644 +--- a/xbmc/peripherals/devices/PeripheralDisk.h ++++ b/xbmc/peripherals/devices/PeripheralDisk.h +@@ -26,7 +26,7 @@ + class CPeripheralDisk : public CPeripheral + { + public: +- CPeripheralDisk(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); ++ CPeripheralDisk(const PeripheralScanResult& scanResult); + virtual ~CPeripheralDisk(void) {}; + }; + } +diff --git a/xbmc/peripherals/devices/PeripheralHID.cpp b/xbmc/peripherals/devices/PeripheralHID.cpp +index fe1f355..27152f1 100644 +--- a/xbmc/peripherals/devices/PeripheralHID.cpp ++++ b/xbmc/peripherals/devices/PeripheralHID.cpp +@@ -27,10 +27,11 @@ + using namespace PERIPHERALS; + using namespace std; + +-CPeripheralHID::CPeripheralHID(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : +- CPeripheral(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35001) : strDeviceName, iVendorId, iProductId), ++CPeripheralHID::CPeripheralHID(const PeripheralScanResult& scanResult) : ++ CPeripheral(scanResult), + m_bInitialised(false) + { ++ m_strDeviceName = scanResult.m_strDeviceName.IsEmpty() ? g_localizeStrings.Get(35001) : scanResult.m_strDeviceName; + m_features.push_back(FEATURE_HID); + } + +diff --git a/xbmc/peripherals/devices/PeripheralHID.h b/xbmc/peripherals/devices/PeripheralHID.h +index ac60dcf..fb8bf44 100644 +--- a/xbmc/peripherals/devices/PeripheralHID.h ++++ b/xbmc/peripherals/devices/PeripheralHID.h +@@ -27,7 +27,7 @@ + class CPeripheralHID : public CPeripheral + { + public: +- CPeripheralHID(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); ++ CPeripheralHID(const PeripheralScanResult& scanResult); + virtual ~CPeripheralHID(void); + virtual bool InitialiseFeature(const PeripheralFeature feature); + virtual bool LookupSymAndUnicode(XBMC_keysym &keysym, uint8_t *key, char *unicode) { return false; } +diff --git a/xbmc/peripherals/devices/PeripheralImon.cpp b/xbmc/peripherals/devices/PeripheralImon.cpp +index 6fbbb33..b0474a1 100644 +--- a/xbmc/peripherals/devices/PeripheralImon.cpp ++++ b/xbmc/peripherals/devices/PeripheralImon.cpp +@@ -37,8 +37,8 @@ + volatile long CPeripheralImon::m_lCountOfImonsConflictWithDInput = 0; + + +-CPeripheralImon::CPeripheralImon(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : +- CPeripheralHID(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35001) : strDeviceName, iVendorId, iProductId) ++CPeripheralImon::CPeripheralImon(const PeripheralScanResult& scanResult) : ++ CPeripheralHID(scanResult) + { + m_features.push_back(FEATURE_IMON); + m_bImonConflictsWithDInput = false; +diff --git a/xbmc/peripherals/devices/PeripheralImon.h b/xbmc/peripherals/devices/PeripheralImon.h +index 8444906..87905b4 100644 +--- a/xbmc/peripherals/devices/PeripheralImon.h ++++ b/xbmc/peripherals/devices/PeripheralImon.h +@@ -26,7 +26,7 @@ + class CPeripheralImon : public CPeripheralHID + { + public: +- CPeripheralImon(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); ++ CPeripheralImon(const PeripheralScanResult& scanResult); + virtual ~CPeripheralImon(void) {} + virtual bool InitialiseFeature(const PeripheralFeature feature); + virtual void OnSettingChanged(const CStdString &strChangedSetting); +diff --git a/xbmc/peripherals/devices/PeripheralNIC.cpp b/xbmc/peripherals/devices/PeripheralNIC.cpp +index 747c2f7..ee950e8 100644 +--- a/xbmc/peripherals/devices/PeripheralNIC.cpp ++++ b/xbmc/peripherals/devices/PeripheralNIC.cpp +@@ -25,8 +25,9 @@ + using namespace PERIPHERALS; + using namespace std; + +-CPeripheralNIC::CPeripheralNIC(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : +- CPeripheral(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35002) : strDeviceName, iVendorId, iProductId) ++CPeripheralNIC::CPeripheralNIC(const PeripheralScanResult& scanResult) : ++ CPeripheral(scanResult) + { ++ m_strDeviceName = scanResult.m_strDeviceName.IsEmpty() ? g_localizeStrings.Get(35002) : scanResult.m_strDeviceName; + m_features.push_back(FEATURE_NIC); + } +diff --git a/xbmc/peripherals/devices/PeripheralNIC.h b/xbmc/peripherals/devices/PeripheralNIC.h +index 49abc2b..fc12302 100644 +--- a/xbmc/peripherals/devices/PeripheralNIC.h ++++ b/xbmc/peripherals/devices/PeripheralNIC.h +@@ -26,7 +26,7 @@ + class CPeripheralNIC : public CPeripheral + { + public: +- CPeripheralNIC(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); ++ CPeripheralNIC(const PeripheralScanResult& scanResult); + virtual ~CPeripheralNIC(void) {}; + }; + } +diff --git a/xbmc/peripherals/devices/PeripheralNyxboard.cpp b/xbmc/peripherals/devices/PeripheralNyxboard.cpp +index 5e3f649..df9c290 100644 +--- a/xbmc/peripherals/devices/PeripheralNyxboard.cpp ++++ b/xbmc/peripherals/devices/PeripheralNyxboard.cpp +@@ -27,8 +27,8 @@ + using namespace PERIPHERALS; + using namespace std; + +-CPeripheralNyxboard::CPeripheralNyxboard(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : +- CPeripheralHID(type, busType, strLocation, strDeviceName, iVendorId, iProductId) ++CPeripheralNyxboard::CPeripheralNyxboard(const PeripheralScanResult& scanResult) : ++ CPeripheralHID(scanResult) + { + m_features.push_back(FEATURE_NYXBOARD); + } +diff --git a/xbmc/peripherals/devices/PeripheralNyxboard.h b/xbmc/peripherals/devices/PeripheralNyxboard.h +index 346d555..254c6c6 100644 +--- a/xbmc/peripherals/devices/PeripheralNyxboard.h ++++ b/xbmc/peripherals/devices/PeripheralNyxboard.h +@@ -26,7 +26,7 @@ + class CPeripheralNyxboard : public CPeripheralHID + { + public: +- CPeripheralNyxboard(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); ++ CPeripheralNyxboard(const PeripheralScanResult& scanResult); + virtual ~CPeripheralNyxboard(void) {}; + virtual bool LookupSymAndUnicode(XBMC_keysym &keysym, uint8_t *key, char *unicode); + }; +diff --git a/xbmc/peripherals/devices/PeripheralTuner.cpp b/xbmc/peripherals/devices/PeripheralTuner.cpp +index ef5630c..8937598 100644 +--- a/xbmc/peripherals/devices/PeripheralTuner.cpp ++++ b/xbmc/peripherals/devices/PeripheralTuner.cpp +@@ -23,8 +23,8 @@ + + using namespace PERIPHERALS; + +-CPeripheralTuner::CPeripheralTuner(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : +- CPeripheral(type, busType, strLocation, strDeviceName, iVendorId, iProductId) ++CPeripheralTuner::CPeripheralTuner(const PeripheralScanResult& scanResult) : ++ CPeripheral(scanResult) + { + m_features.push_back(FEATURE_TUNER); + } +diff --git a/xbmc/peripherals/devices/PeripheralTuner.h b/xbmc/peripherals/devices/PeripheralTuner.h +index b4b15f8..7130130 100644 +--- a/xbmc/peripherals/devices/PeripheralTuner.h ++++ b/xbmc/peripherals/devices/PeripheralTuner.h +@@ -26,7 +26,7 @@ + class CPeripheralTuner : public CPeripheral + { + public: +- CPeripheralTuner(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); ++ CPeripheralTuner(const PeripheralScanResult& scanResult); + virtual ~CPeripheralTuner(void) {}; + }; + } +-- +1.7.10 + From 69258d33bfc7004aa9a76a8c7bafc89f06ccb1ba Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Sun, 10 Mar 2013 23:12:36 +0200 Subject: [PATCH 2/7] iperf: move to debug tools --- .../networking/testing/iperf/changelog.txt | 5 ---- .../networking/testing/iperf/icon/icon.png | Bin 2360 -> 0 bytes .../testing/iperf/source/default.py | 23 ------------------ .../networking/testing => debug}/iperf/build | 0 .../iperf/addon => debug/iperf/install} | 4 +-- .../networking/testing => debug}/iperf/meta | 5 ++-- packages/debug/meta | 2 +- 7 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 packages/addons/networking/testing/iperf/changelog.txt delete mode 100644 packages/addons/networking/testing/iperf/icon/icon.png delete mode 100644 packages/addons/networking/testing/iperf/source/default.py rename packages/{addons/networking/testing => debug}/iperf/build (100%) rename packages/{addons/networking/testing/iperf/addon => debug/iperf/install} (91%) rename packages/{addons/networking/testing => debug}/iperf/meta (95%) diff --git a/packages/addons/networking/testing/iperf/changelog.txt b/packages/addons/networking/testing/iperf/changelog.txt deleted file mode 100644 index 353ab309e7..0000000000 --- a/packages/addons/networking/testing/iperf/changelog.txt +++ /dev/null @@ -1,5 +0,0 @@ -3.0.1 -- bump addon version - -2.1.1 -- initial addon based on iperf-2.0.5 diff --git a/packages/addons/networking/testing/iperf/icon/icon.png b/packages/addons/networking/testing/iperf/icon/icon.png deleted file mode 100644 index 9f8063f8858e71cd245625a9067be902588d51cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2360 zcmeHH{WsHl9RGZ6v#dPatcaslN+S6Vj9*{LW> zrCj78?hp5e-sil|>vdk|ykF;iUO&7K(}KvRC>s<2 zz?2f;w-o@$AR#adW*|;wXt06cdwc?Y0H{7O`&%Re02rWc4)!tS+}z5_%GTD_ z&d$!>-rmvC(Z$6DkH@>ayL)AFTX6EGN6crVTM53~?vhwosii(Pwnwt9h`i6#v z#>U2`rlyvb7O`0T@ZrN}&z`+{^=e>XKq8UIWU|4*LAhM6P$-m2<>=_BN~Ibb8&j** z6B83Uoo;%1TCdj|j{h~k8u*z8#O~=j!@fyk!1g2nX3zZr==qz2-wY;_PYLu#N{wNr z&Q_wKNDqVM!}ky6leqEm>;yg_@z{}k_HImSEI$Sl9K*(tDSB9fDK2+QG`GH=t z0Fjold0U8l5fdSxW}$oC{$UIC+nY~+`TeU#-|9VrRlIkypGQLquW_zrs17>KY5Ooe zG|V9gmr|y)owD-4$+A>yZFL9AT01tvW_SGoE$uo(x;;GqQSROSE0^G4psSe5NP8hM~UB!jDf^>_8~ zEv6+e|LHV@%cXxp$M$EjTmmHkk!cuI%zMk*6-xuKHv$ zl6k>ceIfjH&yl`+`HMeG$2(gsC(((lB^%NhZ%D~vkg&Gri2Un`b_-#*i)DzycXuf; z&iASvB8zha;z6ozaaH`&zqh#Sps1bCbD=4nB1U@VV%cy!QIPHR=G;5e+c&xP6|Ic) zwzIBfS5Nae$HkcQsa<>Vz0e38*N%4omP~-k2AvdL0Wi0NchTQCk;v2h%3#9kA>gRJG0c; zE2^wdLD=3?V#f+L{jC^Xz;v@s|5}y%513R8)pkZuce(91QlvnBihHEpDWfexa1hmo!7me;QB|flP zW^e9Wr-rW}pG`z#VFgU7+rrbAiMB$XedSDf_7(EGl+Y5MLwz3os&J^gxT9bF!MH?R z$LS_ Date: Mon, 11 Mar 2013 00:29:37 +0100 Subject: [PATCH 3/7] slang: only build libslang, this fixes some crosscompiling issues with building the unneeded 'slsh' tool. thanks to 'unforgiven512' Signed-off-by: Stephan Raue --- packages/devel/slang/build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/devel/slang/build b/packages/devel/slang/build index f79f129022..c2844e153d 100755 --- a/packages/devel/slang/build +++ b/packages/devel/slang/build @@ -38,5 +38,5 @@ cd $PKG_BUILD --without-z \ --without-x \ -make -$MAKEINSTALL +make -C src +$MAKEINSTALL -C src From f94e159ff50f219f852c3a4d48911723f7203e74 Mon Sep 17 00:00:00 2001 From: Gerad Munsch Date: Mon, 11 Mar 2013 00:05:28 -0400 Subject: [PATCH 4/7] Fix the build: PR2387 attempted to patch some files that do not exist in the OpenELEC XBMC tarballs. The lines were removed from the patch. --- .../mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch b/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch index 2e85748d70..7a0301aaee 100644 --- a/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch +++ b/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch @@ -6,9 +6,6 @@ Subject: [PATCH] [cec] rebased PR1794 + fixes for Frodo --- XBMC.xcodeproj/project.pbxproj | 13 +++ configure.in | 40 +------ - project/BuildDependencies/scripts/libcec_d.txt | 2 +- - project/VS2010Express/XBMC.vcxproj | 2 + - project/VS2010Express/XBMC.vcxproj.filters | 6 + system/peripherals.xml | 31 ++---- tools/android/depends/libcec/Makefile | 4 +- tools/darwin/depends/libcec/Makefile | 2 +- @@ -134,12 +131,6 @@ index 4769315..4472e3e 100644 AC_SUBST(USE_MYSQL) AC_SUBST(USE_WEB_SERVER) AC_SUBST(USE_UPNP) -diff --git a/project/BuildDependencies/scripts/libcec_d.txt b/project/BuildDependencies/scripts/libcec_d.txt -index c1419b5..2c7d495 100644 -diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj -index fb0947e..7e32ccc 100644 -diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters -index 53a6c97..52a5373 100644 diff --git a/system/peripherals.xml b/system/peripherals.xml index 967b96c..68205df 100644 --- a/system/peripherals.xml From 07b8b99b94c858c1e7222e4e1f4f51ae2ed6847a Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Mon, 11 Mar 2013 14:08:22 +0100 Subject: [PATCH 5/7] xbmc: add PR2252 Signed-off-by: Stephan Raue --- .../xbmc/patches/xbmc-990.30-PR2252.patch | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.30-PR2252.patch diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.30-PR2252.patch b/packages/mediacenter/xbmc/patches/xbmc-990.30-PR2252.patch new file mode 100644 index 0000000000..b757a9fb23 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/xbmc-990.30-PR2252.patch @@ -0,0 +1,51 @@ +From 80a8ad68567f89b3f6810c07daaf42d2edddee87 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 18 Feb 2013 23:49:43 +0000 +Subject: [PATCH] [rbp] Fix for audiotoggledigital on Pi. + +Pi only has two audio output modes so the three way toggle gets stuck. This fix corresponds to Pi specific settings code: +https://github.com/xbmc/xbmc/blob/master/xbmc/settings/GUISettings.cpp#L458 +--- + xbmc/Application.cpp | 12 ++++++++---- + xbmc/settings/GUISettings.h | 1 + + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp +index d6e663b..5e9d979 100644 +--- a/xbmc/Application.cpp ++++ b/xbmc/Application.cpp +@@ -2863,11 +2863,15 @@ bool CApplication::OnAction(const CAction &action) + + if (action.GetID() == ACTION_TOGGLE_DIGITAL_ANALOG) + { +- switch(g_guiSettings.GetInt("audiooutput.mode")) ++ // we are only allowed to SetInt to a value supported in GUISettings, so we keep trying until it sticks ++ int mode = g_guiSettings.GetInt("audiooutput.mode"); ++ for (int i = 0; i < AUDIO_COUNT; i++) + { +- case AUDIO_ANALOG: g_guiSettings.SetInt("audiooutput.mode", AUDIO_IEC958); break; +- case AUDIO_IEC958: g_guiSettings.SetInt("audiooutput.mode", AUDIO_HDMI ); break; +- case AUDIO_HDMI : g_guiSettings.SetInt("audiooutput.mode", AUDIO_ANALOG); break; ++ if (++mode == AUDIO_COUNT) ++ mode = 0; ++ g_guiSettings.SetInt("audiooutput.mode", mode); ++ if (g_guiSettings.GetInt("audiooutput.mode") == mode) ++ break; + } + + g_application.Restart(); +diff --git a/xbmc/settings/GUISettings.h b/xbmc/settings/GUISettings.h +index b48ba35..98f9836 100644 +--- a/xbmc/settings/GUISettings.h ++++ b/xbmc/settings/GUISettings.h +@@ -84,6 +84,7 @@ + #define AUDIO_ANALOG 0 + #define AUDIO_IEC958 1 + #define AUDIO_HDMI 2 ++#define AUDIO_COUNT 3 + #define AUDIO_IS_BITSTREAM(x) ((x) == AUDIO_IEC958 || (x) == AUDIO_HDMI) + + #define VIDEO_NORMAL 0 +-- +1.7.10 + From 74283a83e647677e54418c5cee9d22d5d4cddf22 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Mon, 11 Mar 2013 14:09:34 +0100 Subject: [PATCH 6/7] xbmc: remove broken PRs Signed-off-by: Stephan Raue --- .../xbmc/patches/xbmc-990.17-PR2320.patch | 144 ------------------ .../xbmc/patches/xbmc-990.19-PR2382.patch | 46 ------ 2 files changed, 190 deletions(-) delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.17-PR2320.patch delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.19-PR2382.patch diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.17-PR2320.patch b/packages/mediacenter/xbmc/patches/xbmc-990.17-PR2320.patch deleted file mode 100644 index c800347443..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.17-PR2320.patch +++ /dev/null @@ -1,144 +0,0 @@ -From f2faaa846e03cbcc1ba11f09baad690c792035c5 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Thu, 28 Feb 2013 00:17:03 +0100 -Subject: [PATCH] AE: Revisit Device Opening. Try to set periodSize of 100 ms - and BufferSize of 800 ms - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 98 ++++++++++++++++----------- - 1 file changed, 59 insertions(+), 39 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index fe40d17..821bd2e 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -38,7 +38,6 @@ - #endif - - #define ALSA_OPTIONS (SND_PCM_NONBLOCK | SND_PCM_NO_AUTO_FORMAT | SND_PCM_NO_AUTO_CHANNELS | SND_PCM_NO_AUTO_RESAMPLE) --#define ALSA_PERIODS 16 - - #define ALSA_MAX_CHANNELS 16 - static enum AEChannel ALSAChannelMap[ALSA_MAX_CHANNELS + 1] = { -@@ -328,59 +327,80 @@ bool CAESinkALSA::InitializeHW(AEAudioFormat &format) - } - } - -- unsigned int periods; -- - snd_pcm_uframes_t periodSize, bufferSize; - snd_pcm_hw_params_get_buffer_size_max(hw_params, &bufferSize); -+ snd_pcm_hw_params_get_period_size_max(hw_params, &periodSize, NULL); -+ -+ /* -+ We want to make sure, that we have approx 500 to 800 ms Buffer with -+ a periodSize of approx 100 ms. -+ It is calced: -+ periodSize = sampleRate / 10 -+ buffersize = periodSize * 1 frame * 8. -+ */ -+ periodSize = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 10); -+ bufferSize = std::min(bufferSize, (snd_pcm_uframes_t) periodSize * 8); -+ -+ /* -+ According to upstream we should set buffer size first - so make sure it is always at least -+ double of period size to not get underruns -+ */ -+ periodSize = std::min(periodSize, bufferSize / 2); - -- bufferSize = std::min(bufferSize, (snd_pcm_uframes_t)8192); -- periodSize = bufferSize / ALSA_PERIODS; -- periods = ALSA_PERIODS; -- -- CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Request: periodSize %lu, periods %u, bufferSize %lu", periodSize, periods, bufferSize); -+ CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Request: periodSize %lu, bufferSize %lu", periodSize, bufferSize); - -- /* work on a copy of the hw params */ - snd_pcm_hw_params_t *hw_params_copy; - snd_pcm_hw_params_alloca(&hw_params_copy); -- -- /* try to set the buffer size then the period size */ -- snd_pcm_hw_params_copy(hw_params_copy, hw_params); -- snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize); -- snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL); -- snd_pcm_hw_params_set_periods_near (m_pcm, hw_params_copy, &periods , NULL); -- if (snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) -+ snd_pcm_hw_params_copy(hw_params_copy, hw_params); // copy what we have and is already working -+ -+ // first trying bufferSize, PeriodSize -+ // for more info see here: -+ // http://mailman.alsa-project.org/pipermail/alsa-devel/2009-September/021069.html -+ // the last three tries are done as within pulseaudio -+ -+ // backup periodSize and bufferSize first. Restore them after every failed try -+ snd_pcm_uframes_t periodSizeTemp, bufferSizeTemp; -+ periodSizeTemp = periodSize; -+ bufferSizeTemp = bufferSize; -+ if (snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize) != 0 -+ || snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL) != 0 -+ || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) - { -- /* try to set the period size then the buffer size */ -- snd_pcm_hw_params_copy(hw_params_copy, hw_params); -- snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL); -- snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize); -- snd_pcm_hw_params_set_periods_near (m_pcm, hw_params_copy, &periods , NULL); -- if (snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) -+ bufferSize = bufferSizeTemp; -+ periodSize = periodSizeTemp; -+ // retry with PeriodSize, bufferSize -+ snd_pcm_hw_params_copy(hw_params_copy, hw_params); // restore working copy -+ if (snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL) != 0 -+ || snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize) != 0 -+ || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) - { -- /* try to just set the buffer size */ -- snd_pcm_hw_params_copy(hw_params_copy, hw_params); -- snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize); -- snd_pcm_hw_params_set_periods_near (m_pcm, hw_params_copy, &periods , NULL); -- if (snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) -+ // try only periodSize -+ periodSize = periodSizeTemp; -+ snd_pcm_hw_params_copy(hw_params_copy, hw_params); // restore working copy -+ if(snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL) != 0 -+ || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) - { -- /* try to just set the period size */ -- snd_pcm_hw_params_copy(hw_params_copy, hw_params); -- snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL); -- snd_pcm_hw_params_set_periods_near (m_pcm, hw_params_copy, &periods , NULL); -- if (snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) -+ // try only BufferSize -+ bufferSize = bufferSizeTemp; -+ snd_pcm_hw_params_copy(hw_params_copy, hw_params); // restory working copy -+ if (snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize) != 0 -+ || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0) - { -- CLog::Log(LOGERROR, "CAESinkALSA::InitializeHW - Failed to set the parameters"); -- return false; -+ // set default that Alsa would choose -+ CLog::Log(LOGWARNING, "CAESinkAlsa::IntializeHW - Using default alsa values - set failed"); -+ if (snd_pcm_hw_params(m_pcm, hw_params) != 0) -+ { -+ CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Could not init a valid sink"); -+ return false; -+ } - } - } -+ // reread values when alsa default was kept -+ snd_pcm_get_params(m_pcm, &bufferSize, &periodSize); - } - } -- -- snd_pcm_hw_params_get_period_size(hw_params_copy, &periodSize, NULL); -- snd_pcm_hw_params_get_buffer_size(hw_params_copy, &bufferSize); - -- -- CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Got: periodSize %lu, periods %u, bufferSize %lu", periodSize, periods, bufferSize); -+ CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Got: periodSize %lu, bufferSize %lu", periodSize, bufferSize); - - /* set the format parameters */ - format.m_sampleRate = sampleRate; --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.19-PR2382.patch b/packages/mediacenter/xbmc/patches/xbmc-990.19-PR2382.patch deleted file mode 100644 index 988377325b..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.19-PR2382.patch +++ /dev/null @@ -1,46 +0,0 @@ -From eb4ae32119a83716d7fb930381d2848c02383cea Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Wed, 6 Mar 2013 07:52:59 +0100 -Subject: [PATCH] AE: Fix menu sounds by decreasing buffer(max 200 ms) and - periodSize(50 ms) - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 19 ++++++++++--------- - 1 file changed, 10 insertions(+), 9 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 821bd2e..21891a5 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -332,18 +332,19 @@ bool CAESinkALSA::InitializeHW(AEAudioFormat &format) - snd_pcm_hw_params_get_period_size_max(hw_params, &periodSize, NULL); - - /* -- We want to make sure, that we have approx 500 to 800 ms Buffer with -- a periodSize of approx 100 ms. -- It is calced: -- periodSize = sampleRate / 10 -- buffersize = periodSize * 1 frame * 8. -+ We want to make sure, that we have max 200 ms Buffer with -+ a periodSize of approx 50 ms. Choosing a higher bufferSize -+ will cause problems with menu sounds. Buffer will be increased -+ after those are fixed. -+ periodSize = sampleRate / 20 -+ bufferSize = periodSize * 1 frame * 4. - */ -- periodSize = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 10); -- bufferSize = std::min(bufferSize, (snd_pcm_uframes_t) periodSize * 8); -+ periodSize = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 20); -+ bufferSize = std::min(bufferSize, (snd_pcm_uframes_t) periodSize * 4); - - /* -- According to upstream we should set buffer size first - so make sure it is always at least -- double of period size to not get underruns -+ According to upstream we should set buffer size first - so make sure it is always at least -+ double of period size to not get underruns - */ - periodSize = std::min(periodSize, bufferSize / 2); - --- -1.7.10 - From 14f40f50fed720050d1ae0ab47b9bc841c67327f Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Mon, 11 Mar 2013 15:43:38 +0100 Subject: [PATCH 7/7] xbmc: update to xbmc-12.0.5 Signed-off-by: Stephan Raue --- .../mediacenter/xbmc-theme-Confluence/meta | 2 +- packages/mediacenter/xbmc/meta | 2 +- .../xbmc/patches/xbmc-990.18-PR2368.patch | 156 -- .../xbmc/patches/xbmc-990.20-PR2286.patch | 520 ------ .../xbmc/patches/xbmc-990.23-PR2363.patch | 202 --- .../xbmc/patches/xbmc-990.24-PR2375.patch | 31 - .../xbmc/patches/xbmc-990.27-PR2388.patch | 25 - .../xbmc/patches/xbmc-990.27-fix-build.patch | 34 + .../xbmc/patches/xbmc-990.28-PR2395.patch | 31 - .../xbmc/patches/xbmc-990.29-PR2387.patch | 1508 ----------------- .../xbmc/patches/xbmc-990.30-PR2252.patch | 51 - tools/mkpkg/mkpkg_xbmc-frodo | 2 +- 12 files changed, 37 insertions(+), 2527 deletions(-) delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.18-PR2368.patch delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.20-PR2286.patch delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.23-PR2363.patch delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.24-PR2375.patch delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.27-PR2388.patch create mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.27-fix-build.patch delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.28-PR2395.patch delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch delete mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.30-PR2252.patch diff --git a/packages/mediacenter/xbmc-theme-Confluence/meta b/packages/mediacenter/xbmc-theme-Confluence/meta index e9d4da29c1..8601e6b110 100644 --- a/packages/mediacenter/xbmc-theme-Confluence/meta +++ b/packages/mediacenter/xbmc-theme-Confluence/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="xbmc-theme-Confluence" -PKG_VERSION="12.0.4" +PKG_VERSION="12.0.5" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/xbmc/meta b/packages/mediacenter/xbmc/meta index 9c0a4a8655..03ae526c9d 100644 --- a/packages/mediacenter/xbmc/meta +++ b/packages/mediacenter/xbmc/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="xbmc" -PKG_VERSION="12.0.4" +PKG_VERSION="12.0.5" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.18-PR2368.patch b/packages/mediacenter/xbmc/patches/xbmc-990.18-PR2368.patch deleted file mode 100644 index d9c9c1f634..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.18-PR2368.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 632825b71a2bc248eb5705666debc5f7653d6878 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 24 Feb 2013 15:25:49 +0000 -Subject: [PATCH] [rbp] Fix for stuttery video when seeking before zero - -There are a few issues with seeking I found. -We weren't correctly setting OMX_BUFFERFLAG_TIME_UNKNOWN on the first frame after a seek which could make the GPU think video was at 0 and audio at a much larger offset. -A full video fifo (to GPU) stops any higher priority messages from being received which can stall a seek and the flush message doesn't get through. Use m_flush to discard the video packet that doesn't fit. -We get an audio frame through with unknown pts/dts after the flush, but before the GENERAL_RESYNC when seeking. This was given to GPU and was perhaps 30 seconds out from the following packets and that throws off the timing between audio and video streams. Keeping m_flush true until the GENERAL_RESYNC discards this frame. Hopefully that is safe. ---- - xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 13 ++----------- - xbmc/cores/omxplayer/OMXPlayerAudio.h | 1 - - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 7 +++++++ - xbmc/cores/omxplayer/OMXPlayerVideo.h | 1 + - xbmc/cores/omxplayer/OMXVideo.cpp | 11 +++-------- - 5 files changed, 13 insertions(+), 20 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index 58c3a4f..16ea6c3 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -@@ -369,13 +369,9 @@ bool OMXPlayerAudio::Decode(DemuxPacket *pkt, bool bDropPacket) - - while(!m_bStop) - { -+ // discard if flushing as clocks may be stopped and we'll never submit it - if(m_flush) -- { -- CSingleLock lock(m_flushLock); -- m_flush = false; -- lock.Leave(); - break; -- } - - if(m_omxAudio.GetSpace() < (unsigned int)pkt->iSize) - { -@@ -420,12 +416,7 @@ bool OMXPlayerAudio::Decode(DemuxPacket *pkt, bool bDropPacket) - while(!m_bStop) - { - if(m_flush) -- { -- CSingleLock lock(m_flushLock); -- m_flush = false; -- lock.Leave(); - break; -- } - - if(m_omxAudio.GetSpace() < (unsigned int)pkt->iSize) - { -@@ -544,6 +535,7 @@ void OMXPlayerAudio::Process() - } - else - CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, 0)", m_audioClock); -+ m_flush = false; - } - else if (pMsg->IsType(CDVDMsg::GENERAL_RESET)) - { -@@ -627,7 +619,6 @@ void OMXPlayerAudio::Process() - - void OMXPlayerAudio::Flush() - { -- CSingleLock lock(m_flushLock); - m_flush = true; - m_messageQueue.Flush(); - m_messageQueue.Put( new CDVDMsg(CDVDMsg::GENERAL_FLUSH), 1); -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.h b/xbmc/cores/omxplayer/OMXPlayerAudio.h -index d10133e..d6083e9 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.h -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.h -@@ -42,7 +42,6 @@ - class OMXPlayerAudio : public CThread - { - protected: -- CCriticalSection m_flushLock; - CDVDMessageQueue m_messageQueue; - CDVDMessageQueue &m_messageParent; - -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 5a6e31e..5dd908b 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -122,6 +122,7 @@ bool OMXPlayerVideo::OpenStream(CDVDStreamInfo &hints) - m_Deinterlace = ( g_settings.m_currentVideoSettings.m_DeinterlaceMode == VS_DEINTERLACEMODE_OFF ) ? false : true; - m_hdmi_clock_sync = (g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF); - m_started = false; -+ m_flush = false; - m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0; - m_autosync = 1; - m_iSleepEndTime = DVD_NOPTS_VALUE; -@@ -593,6 +594,7 @@ void OMXPlayerVideo::Process() - m_omxVideo.Reset(); - m_av_clock->OMXReset(false); - m_av_clock->UnLock(); -+ m_flush = false; - } - else if (pMsg->IsType(CDVDMsg::PLAYER_SETSPEED)) - { -@@ -633,6 +635,10 @@ void OMXPlayerVideo::Process() - - while (!m_bStop) - { -+ // discard if flushing as clocks may be stopped and we'll never submit it -+ if (m_flush) -+ break; -+ - if((int)m_omxVideo.GetFreeSpace() < pPacket->iSize) - { - Sleep(10); -@@ -697,6 +703,7 @@ void OMXPlayerVideo::Process() - - void OMXPlayerVideo::Flush() - { -+ m_flush = true; - m_messageQueue.Flush(); - m_messageQueue.Put(new CDVDMsg(CDVDMsg::GENERAL_FLUSH), 1); - } -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.h b/xbmc/cores/omxplayer/OMXPlayerVideo.h -index cf05c1f..7df1b0b 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.h -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.h -@@ -61,6 +61,7 @@ class OMXPlayerVideo : public CThread - int m_audio_count; - bool m_stalled; - bool m_started; -+ bool m_flush; - std::string m_codecname; - double m_droptime; - double m_dropbase; -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 3417286..4f11ff8 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -809,17 +809,12 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) - // only send dts on first frame to get nearly correct starttime - if(pts == DVD_NOPTS_VALUE) - pts = dts; -- if(pts == DVD_NOPTS_VALUE) -- omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; -- omx_buffer->nFlags = OMX_BUFFERFLAG_STARTTIME; -+ omx_buffer->nFlags |= OMX_BUFFERFLAG_STARTTIME; - CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); - m_av_clock->VideoStart(false); - } -- else -- { -- if(pts == DVD_NOPTS_VALUE) -- omx_buffer->nFlags = OMX_BUFFERFLAG_TIME_UNKNOWN; -- } -+ if(pts == DVD_NOPTS_VALUE) -+ omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; - - omx_buffer->nTimeStamp = ToOMXTime((uint64_t)(pts == DVD_NOPTS_VALUE) ? 0 : pts); - omx_buffer->nFilledLen = (demuxer_bytes > omx_buffer->nAllocLen) ? omx_buffer->nAllocLen : demuxer_bytes; --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.20-PR2286.patch b/packages/mediacenter/xbmc/patches/xbmc-990.20-PR2286.patch deleted file mode 100644 index 373c7963de..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.20-PR2286.patch +++ /dev/null @@ -1,520 +0,0 @@ -From dac7871e3440b9d4235fcd91af1c2d41a931d69d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 18 Feb 2013 23:04:28 +0000 -Subject: [PATCH] [rbp] Handle resolution changes during video stream. - -When the resolution changes, GPU sends a port settings changed message. Host has to acknowledge it by disabling and enabling the affected ports. ---- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 229 ++++++++++++------------------- - xbmc/cores/omxplayer/OMXPlayerVideo.h | 7 +- - xbmc/cores/omxplayer/OMXVideo.cpp | 95 ++++++++----- - xbmc/cores/omxplayer/OMXVideo.h | 7 +- - 4 files changed, 151 insertions(+), 187 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 5a6e31e..a033c78 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -83,9 +83,6 @@ class COMXMsgVideoCodecChange : public CDVDMsg - m_iSubtitleDelay = 0; - m_FlipTimeStamp = 0.0; - m_bRenderSubs = false; -- m_width = 0; -- m_height = 0; -- m_fps = 0.0f; - m_flags = 0; - m_bAllowFullscreen = false; - m_iCurrentPts = DVD_NOPTS_VALUE; -@@ -98,12 +95,7 @@ class COMXMsgVideoCodecChange : public CDVDMsg - m_messageQueue.SetMaxDataSize(10 * 1024 * 1024); - m_messageQueue.SetMaxTimeSize(8.0); - -- RESOLUTION res = g_graphicsContext.GetVideoResolution(); -- m_video_width = g_settings.m_ResInfo[res].iScreenWidth; -- m_video_height = g_settings.m_ResInfo[res].iScreenHeight; -- - m_dst_rect.SetRect(0, 0, 0, 0); -- - } - - OMXPlayerVideo::~OMXPlayerVideo() -@@ -125,6 +117,8 @@ bool OMXPlayerVideo::OpenStream(CDVDStreamInfo &hints) - m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0; - m_autosync = 1; - m_iSleepEndTime = DVD_NOPTS_VALUE; -+ // force SetVideoRect to be called initially -+ m_dst_rect.SetRect(0, 0, 0, 0); - - m_audio_count = m_av_clock->HasAudio(); - -@@ -220,154 +214,45 @@ void OMXPlayerVideo::ProcessOverlays(int iGroupId, double pts) - if (m_started) - m_pOverlayContainer->CleanUp(pts - m_iSubtitleDelay); - -- enum EOverlay -- { OVERLAY_AUTO // select mode auto -- , OVERLAY_GPU // render osd using gpu -- , OVERLAY_BUF // render osd on buffer -- } render = OVERLAY_AUTO; -- -- /* -- if(m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SPU) -- || m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_IMAGE) -- || m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SSA) ) -- render = OVERLAY_BUF; -- */ -- -- if(render == OVERLAY_BUF) -- { -- // rendering spu overlay types directly on video memory costs a lot of processing power. -- // thus we allocate a temp picture, copy the original to it (needed because the same picture can be used more than once). -- // then do all the rendering on that temp picture and finaly copy it to video memory. -- // In almost all cases this is 5 or more times faster!. -- -- if(m_pTempOverlayPicture && ( m_pTempOverlayPicture->iWidth != m_width -- || m_pTempOverlayPicture->iHeight != m_height)) -- { -- CDVDCodecUtils::FreePicture(m_pTempOverlayPicture); -- m_pTempOverlayPicture = NULL; -- } -- -- if(!m_pTempOverlayPicture) -- m_pTempOverlayPicture = CDVDCodecUtils::AllocatePicture(m_width, m_height); -- if(!m_pTempOverlayPicture) -- return; -- m_pTempOverlayPicture->format = RENDER_FMT_YUV420P; -- } -- -- if(render == OVERLAY_AUTO) -- render = OVERLAY_GPU; -- - VecOverlays overlays; - -- { -- CSingleLock lock(*m_pOverlayContainer); -+ CSingleLock lock(*m_pOverlayContainer); - -- VecOverlays* pVecOverlays = m_pOverlayContainer->GetOverlays(); -- VecOverlaysIter it = pVecOverlays->begin(); -- -- //Check all overlays and render those that should be rendered, based on time and forced -- //Both forced and subs should check timeing, pts == 0 in the stillframe case -- while (it != pVecOverlays->end()) -- { -- CDVDOverlay* pOverlay = *it++; -- if(!pOverlay->bForced && !m_bRenderSubs) -- continue; -- -- if(pOverlay->iGroupId != iGroupId) -- continue; -+ VecOverlays* pVecOverlays = m_pOverlayContainer->GetOverlays(); -+ VecOverlaysIter it = pVecOverlays->begin(); - -- double pts2 = pOverlay->bForced ? pts : pts - m_iSubtitleDelay; -+ //Check all overlays and render those that should be rendered, based on time and forced -+ //Both forced and subs should check timeing, pts == 0 in the stillframe case -+ while (it != pVecOverlays->end()) -+ { -+ CDVDOverlay* pOverlay = *it++; -+ if(!pOverlay->bForced && !m_bRenderSubs) -+ continue; - -- if((pOverlay->iPTSStartTime <= pts2 && (pOverlay->iPTSStopTime > pts2 || pOverlay->iPTSStopTime == 0LL)) || pts == 0) -- { -- if(pOverlay->IsOverlayType(DVDOVERLAY_TYPE_GROUP)) -- overlays.insert(overlays.end(), static_cast(pOverlay)->m_overlays.begin() -- , static_cast(pOverlay)->m_overlays.end()); -- else -- overlays.push_back(pOverlay); -+ if(pOverlay->iGroupId != iGroupId) -+ continue; - -- } -- } -+ double pts2 = pOverlay->bForced ? pts : pts - m_iSubtitleDelay; - -- for(it = overlays.begin(); it != overlays.end(); ++it) -+ if((pOverlay->iPTSStartTime <= pts2 && (pOverlay->iPTSStopTime > pts2 || pOverlay->iPTSStopTime == 0LL)) || pts == 0) - { -- double pts2 = (*it)->bForced ? pts : pts - m_iSubtitleDelay; -- -- if (render == OVERLAY_GPU) -- g_renderManager.AddOverlay(*it, pts2); -- -- /* -- printf("subtitle : DVDOVERLAY_TYPE_SPU %d DVDOVERLAY_TYPE_IMAGE %d DVDOVERLAY_TYPE_SSA %d\n", -- m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SPU), -- m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_IMAGE), -- m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SSA) ); -- */ -- -- if (render == OVERLAY_BUF) -- CDVDOverlayRenderer::Render(m_pTempOverlayPicture, *it, pts2); -+ if(pOverlay->IsOverlayType(DVDOVERLAY_TYPE_GROUP)) -+ overlays.insert(overlays.end(), static_cast(pOverlay)->m_overlays.begin() -+ , static_cast(pOverlay)->m_overlays.end()); -+ else -+ overlays.push_back(pOverlay); - } - } --} -- --void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket) --{ - -- if (!g_renderManager.IsConfigured() -- || m_video_width != m_width -- || m_video_height != m_height -- || m_fps != m_fFrameRate) -+ for(it = overlays.begin(); it != overlays.end(); ++it) - { -- m_width = m_video_width; -- m_height = m_video_height; -- m_fps = m_fFrameRate; -- -- unsigned flags = 0; -- ERenderFormat format = RENDER_FMT_BYPASS; -- -- if(m_bAllowFullscreen) -- { -- flags |= CONF_FLAGS_FULLSCREEN; -- m_bAllowFullscreen = false; // only allow on first configure -- } -- -- if(m_flags & CONF_FLAGS_FORMAT_SBS) -- { -- if(g_Windowing.Support3D(m_video_width, m_video_height, D3DPRESENTFLAG_MODE3DSBS)) -- { -- CLog::Log(LOGNOTICE, "3DSBS movie found"); -- flags |= CONF_FLAGS_FORMAT_SBS; -- } -- } -- else if(m_flags & CONF_FLAGS_FORMAT_TB) -- { -- if(g_Windowing.Support3D(m_video_width, m_video_height, D3DPRESENTFLAG_MODE3DTB)) -- { -- CLog::Log(LOGNOTICE, "3DTB movie found"); -- flags |= CONF_FLAGS_FORMAT_TB; -- } -- } -- -- unsigned int iDisplayWidth = m_hints.width; -- unsigned int iDisplayHeight = m_hints.height; -- -- /* use forced aspect if any */ -- if( m_fForcedAspectRatio != 0.0f ) -- iDisplayWidth = (int) (iDisplayHeight * m_fForcedAspectRatio); -- -- CLog::Log(LOGDEBUG,"%s - change configuration. %dx%d. framerate: %4.2f. %dx%x format: BYPASS", -- __FUNCTION__, m_width, m_height, m_fps, iDisplayWidth, iDisplayHeight); -- -- if(!g_renderManager.Configure(m_hints.width, m_hints.height, -- iDisplayWidth, iDisplayHeight, m_fps, flags, format, 0, -- m_hints.orientation)) -- { -- CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__); -- return; -- } -- -- g_renderManager.RegisterRenderUpdateCallBack((const void*)this, RenderUpdateCallBack); -+ double pts2 = (*it)->bForced ? pts : pts - m_iSubtitleDelay; -+ g_renderManager.AddOverlay(*it, pts2); - } -+} - -+void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket) -+{ - if (!g_renderManager.IsStarted()) { - CLog::Log(LOGERROR, "%s - renderer not started", __FUNCTION__); - return; -@@ -724,6 +609,7 @@ bool OMXPlayerVideo::OpenDecoder() - m_av_clock->OMXStop(false); - - bool bVideoDecoderOpen = m_omxVideo.Open(m_hints, m_av_clock, m_Deinterlace, m_hdmi_clock_sync); -+ m_omxVideo.RegisterResolutionUpdateCallBack((void *)this, ResolutionUpdateCallBack); - - if(!bVideoDecoderOpen) - { -@@ -859,3 +745,62 @@ void OMXPlayerVideo::RenderUpdateCallBack(const void *ctx, const CRect &SrcRect, - player->SetVideoRect(SrcRect, DestRect); - } - -+void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height) -+{ -+ RESOLUTION res = g_graphicsContext.GetVideoResolution(); -+ uint32_t video_width = g_settings.m_ResInfo[res].iScreenWidth; -+ uint32_t video_height = g_settings.m_ResInfo[res].iScreenHeight; -+ -+ unsigned flags = 0; -+ ERenderFormat format = RENDER_FMT_BYPASS; -+ -+ if(m_bAllowFullscreen) -+ { -+ flags |= CONF_FLAGS_FULLSCREEN; -+ m_bAllowFullscreen = false; // only allow on first configure -+ } -+ -+ if(m_flags & CONF_FLAGS_FORMAT_SBS) -+ { -+ if(g_Windowing.Support3D(video_width, video_height, D3DPRESENTFLAG_MODE3DSBS)) -+ { -+ CLog::Log(LOGNOTICE, "3DSBS movie found"); -+ flags |= CONF_FLAGS_FORMAT_SBS; -+ } -+ } -+ else if(m_flags & CONF_FLAGS_FORMAT_TB) -+ { -+ if(g_Windowing.Support3D(video_width, video_height, D3DPRESENTFLAG_MODE3DTB)) -+ { -+ CLog::Log(LOGNOTICE, "3DTB movie found"); -+ flags |= CONF_FLAGS_FORMAT_TB; -+ } -+ } -+ -+ unsigned int iDisplayWidth = width; -+ unsigned int iDisplayHeight = height; -+ -+ /* use forced aspect if any */ -+ if( m_fForcedAspectRatio != 0.0f ) -+ iDisplayWidth = (int) (iDisplayHeight * m_fForcedAspectRatio); -+ -+ CLog::Log(LOGDEBUG,"%s - change configuration. video:%dx%d. framerate: %4.2f. %dx%d format: BYPASS", -+ __FUNCTION__, video_width, video_height, m_fFrameRate, iDisplayWidth, iDisplayHeight); -+ -+ if(!g_renderManager.Configure(width, height, -+ iDisplayWidth, iDisplayHeight, m_fFrameRate, flags, format, 0, -+ m_hints.orientation)) -+ { -+ CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__); -+ return; -+ } -+ -+ g_renderManager.RegisterRenderUpdateCallBack((const void*)this, RenderUpdateCallBack); -+} -+ -+void OMXPlayerVideo::ResolutionUpdateCallBack(void *ctx, uint32_t width, uint32_t height) -+{ -+ OMXPlayerVideo *player = static_cast(ctx); -+ player->ResolutionUpdateCallBack(width, height); -+} -+ -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.h b/xbmc/cores/omxplayer/OMXPlayerVideo.h -index cf05c1f..95a691b 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.h -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.h -@@ -70,12 +70,7 @@ class OMXPlayerVideo : public CThread - bool m_bAllowFullscreen; - - float m_fForcedAspectRatio; -- unsigned int m_width; -- unsigned int m_height; -- unsigned int m_video_width; -- unsigned int m_video_height; - unsigned m_flags; -- float m_fps; - - CRect m_dst_rect; - int m_view_mode; -@@ -133,5 +128,7 @@ class OMXPlayerVideo : public CThread - int GetFreeSpace(); - void SetVideoRect(const CRect &SrcRect, const CRect &DestRect); - static void RenderUpdateCallBack(const void *ctx, const CRect &SrcRect, const CRect &DestRect); -+ void ResolutionUpdateCallBack(uint32_t width, uint32_t height); -+ static void ResolutionUpdateCallBack(void *ctx, uint32_t width, uint32_t height); - }; - #endif -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 3417286..b6b42e7 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -86,7 +86,6 @@ - m_video_codec_name = ""; - m_deinterlace = false; - m_hdmi_clock_sync = false; -- m_first_frame = true; - } - - COMXVideo::~COMXVideo() -@@ -154,6 +153,9 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool deinterlace, b - OMX_ERRORTYPE omx_err = OMX_ErrorNone; - std::string decoder_name; - -+ m_res_ctx = NULL; -+ m_res_callback = NULL; -+ - m_video_codec_name = ""; - m_codingType = OMX_VIDEO_CodingUnused; - -@@ -697,7 +699,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool deinterlace, b - CLASSNAME, __func__, m_omx_decoder.GetComponent(), m_omx_decoder.GetInputPort(), m_omx_decoder.GetOutputPort(), - m_deinterlace, m_hdmi_clock_sync); - -- m_first_frame = true; - // start from assuming all recent frames had valid pts - m_history_valid_pts = ~0; - -@@ -736,8 +737,10 @@ void COMXVideo::Close() - m_video_convert = false; - m_video_codec_name = ""; - m_deinterlace = false; -- m_first_frame = true; - m_av_clock = NULL; -+ -+ m_res_ctx = NULL; -+ m_res_callback = NULL; - } - - void COMXVideo::SetDropState(bool bDrop) -@@ -851,57 +854,74 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) - } - } - -- if(m_first_frame && m_deinterlace) -+ omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged, 0); -+ if (omx_err == OMX_ErrorNone) - { - OMX_PARAM_PORTDEFINITIONTYPE port_image; - OMX_INIT_STRUCTURE(port_image); - port_image.nPortIndex = m_omx_decoder.GetOutputPort(); -- - omx_err = m_omx_decoder.GetParameter(OMX_IndexParamPortDefinition, &port_image); - if(omx_err != OMX_ErrorNone) -- CLog::Log(LOGERROR, "%s::%s - error OMX_IndexParamPortDefinition 1 omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); -+ { -+ CLog::Log(LOGERROR, "%s::%s - error m_omx_decoder.GetParameter(OMX_IndexParamPortDefinition) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); -+ } -+ // let OMXPlayerVideo know about resolution so it can inform RenderManager -+ if (m_res_callback) -+ m_res_callback(m_res_ctx, port_image.format.video.nFrameWidth, port_image.format.video.nFrameHeight); -+ -+ m_omx_decoder.DisablePort(m_omx_decoder.GetOutputPort(), true); -+ m_omx_sched.DisablePort(m_omx_sched.GetInputPort(), true); - -- /* we assume when the sizes equal we have the first decoded frame */ -- if(port_image.format.video.nFrameWidth == m_decoded_width && port_image.format.video.nFrameHeight == m_decoded_height) -+ OMX_CONFIG_INTERLACETYPE interlace; -+ OMX_INIT_STRUCTURE(interlace); -+ interlace.nPortIndex = m_omx_decoder.GetOutputPort(); -+ omx_err = m_omx_decoder.GetConfig(OMX_IndexConfigCommonInterlace, &interlace); -+ if(omx_err != OMX_ErrorNone) - { -- m_first_frame = false; -+ CLog::Log(LOGERROR, "%s::%s - error m_omx_decoder.GetConfig(OMX_IndexConfigCommonInterlace) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); -+ } - -- omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged); -- if(omx_err == OMX_ErrorStreamCorrupt) -+ if (m_deinterlace) -+ { -+ m_omx_image_fx.DisablePort(m_omx_image_fx.GetInputPort(), true); -+ port_image.nPortIndex = m_omx_image_fx.GetInputPort(); -+ omx_err = m_omx_image_fx.SetParameter(OMX_IndexParamPortDefinition, &port_image); -+ if(omx_err != OMX_ErrorNone) - { -- CLog::Log(LOGERROR, "%s::%s - image not unsupported\n", CLASSNAME, __func__); -- return false; -+ CLog::Log(LOGERROR, "%s::%s - error m_omx_image_fx.SetParameter(OMX_IndexParamPortDefinition) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); - } -- -- m_omx_decoder.DisablePort(m_omx_decoder.GetOutputPort(), false); -- m_omx_sched.DisablePort(m_omx_sched.GetInputPort(), false); -- -- if(m_deinterlace) -+ omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged); -+ if(omx_err != OMX_ErrorNone) - { -- m_omx_image_fx.DisablePort(m_omx_image_fx.GetOutputPort(), false); -- m_omx_image_fx.DisablePort(m_omx_image_fx.GetInputPort(), false); -- -- port_image.nPortIndex = m_omx_image_fx.GetInputPort(); -- omx_err = m_omx_image_fx.SetParameter(OMX_IndexParamPortDefinition, &port_image); -- if(omx_err != OMX_ErrorNone) -- CLog::Log(LOGERROR, "%s::%s - error OMX_IndexParamPortDefinition 2 omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); -- -- port_image.nPortIndex = m_omx_image_fx.GetOutputPort(); -- omx_err = m_omx_image_fx.SetParameter(OMX_IndexParamPortDefinition, &port_image); -- if(omx_err != OMX_ErrorNone) -- CLog::Log(LOGERROR, "%s::%s - error OMX_IndexParamPortDefinition 3 omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); -+ CLog::Log(LOGERROR, "%s::%s - error m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); - } -- -- m_omx_decoder.EnablePort(m_omx_decoder.GetOutputPort(), false); -- -- if(m_deinterlace) -+ port_image.nPortIndex = m_omx_image_fx.GetOutputPort(); -+ omx_err = m_omx_image_fx.GetParameter(OMX_IndexParamPortDefinition, &port_image); -+ if(omx_err != OMX_ErrorNone) - { -- m_omx_image_fx.EnablePort(m_omx_image_fx.GetOutputPort(), false); -- m_omx_image_fx.EnablePort(m_omx_image_fx.GetInputPort(), false); -+ CLog::Log(LOGERROR, "%s::%s - error m_omx_image_fx.GetParameter(OMX_IndexParamPortDefinition) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); - } -+ m_omx_image_fx.EnablePort(m_omx_image_fx.GetInputPort(), true); - -- m_omx_sched.EnablePort(m_omx_sched.GetInputPort(), false); -+ m_omx_image_fx.DisablePort(m_omx_image_fx.GetOutputPort(), true); -+ } -+ port_image.nPortIndex = m_omx_sched.GetInputPort(); -+ omx_err = m_omx_sched.SetParameter(OMX_IndexParamPortDefinition, &port_image); -+ if(omx_err != OMX_ErrorNone) -+ { -+ CLog::Log(LOGERROR, "%s::%s - error m_omx_sched.SetParameter(OMX_IndexParamPortDefinition) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); -+ } -+ omx_err = m_omx_sched.WaitForEvent(OMX_EventPortSettingsChanged); -+ if(omx_err != OMX_ErrorNone) -+ { -+ CLog::Log(LOGERROR, "%s::%s - error m_omx_sched.WaitForEvent(OMX_EventPortSettingsChanged) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); -+ } -+ if (m_deinterlace) -+ { -+ m_omx_image_fx.EnablePort(m_omx_image_fx.GetOutputPort(), true); - } -+ m_omx_decoder.EnablePort(m_omx_decoder.GetOutputPort(), true); -+ m_omx_sched.EnablePort(m_omx_sched.GetInputPort(), true); - } - } - -@@ -932,7 +952,6 @@ void COMXVideo::Reset(void) - - SendDecoderConfig(); - -- m_first_frame = true; - */ - } - -diff --git a/xbmc/cores/omxplayer/OMXVideo.h b/xbmc/cores/omxplayer/OMXVideo.h -index 0afa56d..037f155 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.h -+++ b/xbmc/cores/omxplayer/OMXVideo.h -@@ -36,6 +36,8 @@ - - #define CLASSNAME "COMXVideo" - -+typedef void (*ResolutionUpdateCallBackFn)(void *ctx, uint32_t width, uint32_t height); -+ - class COMXVideo - { - public: -@@ -45,6 +47,7 @@ class COMXVideo - // Required overrides - bool SendDecoderConfig(); - bool Open(CDVDStreamInfo &hints, OMXClock *clock, bool deinterlace = false, bool hdmi_clock_sync = false); -+ void RegisterResolutionUpdateCallBack(void *ctx, ResolutionUpdateCallBackFn callback) { m_res_ctx = ctx; m_res_callback = callback; } - void Close(void); - unsigned int GetFreeSpace(); - unsigned int GetSize(); -@@ -89,9 +92,9 @@ class COMXVideo - - bool m_deinterlace; - bool m_hdmi_clock_sync; -- bool m_first_frame; - uint32_t m_history_valid_pts; -- -+ ResolutionUpdateCallBackFn m_res_callback; -+ void *m_res_ctx; - bool NaluFormatStartCodes(enum CodecID codec, uint8_t *in_extradata, int in_extrasize); - }; - --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.23-PR2363.patch b/packages/mediacenter/xbmc/patches/xbmc-990.23-PR2363.patch deleted file mode 100644 index 11ccd5224c..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.23-PR2363.patch +++ /dev/null @@ -1,202 +0,0 @@ -From 3d1005fdd34e72f81aff9034f8d30a0d33a780a8 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 4 Mar 2013 08:30:47 +0100 -Subject: [PATCH] Always copy overlays from file parser - Fixes stuck hw - resources on render - ---- - .../cores/dvdplayer/DVDCodecs/Overlay/DVDOverlay.h | 6 +++ - .../dvdplayer/DVDCodecs/Overlay/DVDOverlayImage.h | 6 +++ - .../dvdplayer/DVDCodecs/Overlay/DVDOverlaySSA.h | 11 ++++++ - .../dvdplayer/DVDCodecs/Overlay/DVDOverlayText.h | 41 ++++++++++++++++++++ - xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp | 1 + - .../dvdplayer/DVDSubtitles/DVDSubtitleParser.h | 8 +++- - 6 files changed, 72 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlay.h b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlay.h -index 8c87bc4..da8de1f 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlay.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlay.h -@@ -103,6 +103,12 @@ class CDVDOverlay - - bool IsOverlayType(DVDOverlayType type) { return (m_type == type); } - -+ /** -+ * return a copy to DVDPlayerSubtitle in order to have hw resources cleared -+ * after rendering -+ */ -+ virtual CDVDOverlay* Clone() { return Acquire(); } -+ - double iPTSStartTime; - double iPTSStopTime; - bool bForced; // display, no matter what -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayImage.h b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayImage.h -index bc90d68..e1cdf59 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayImage.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayImage.h -@@ -20,6 +20,7 @@ - * - */ - -+#include "PlatformDefs.h" - #include "DVDOverlay.h" - #include - #include -@@ -117,6 +118,11 @@ class CDVDOverlayImage : public CDVDOverlay - if(palette) free(palette); - } - -+ virtual CDVDOverlayImage* Clone() -+ { -+ return new CDVDOverlayImage(*this); -+ } -+ - BYTE* data_at(int sub_x, int sub_y) const - { - int bpp; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlaySSA.h b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlaySSA.h -index 31deba1..f42c571 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlaySSA.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlaySSA.h -@@ -37,10 +37,21 @@ class CDVDOverlaySSA : public CDVDOverlay - libass->Acquire(); - } - -+ CDVDOverlaySSA(CDVDOverlaySSA& src) -+ : CDVDOverlay(src) -+ , m_libass(src.m_libass) -+ { -+ m_libass->Acquire(); -+ } -+ - ~CDVDOverlaySSA() - { - if(m_libass) - SAFE_RELEASE(m_libass); - } - -+ virtual CDVDOverlaySSA* Clone() -+ { -+ return new CDVDOverlaySSA(*this); -+ } - }; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayText.h b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayText.h -index 849a6e3..54e3bfa 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayText.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayText.h -@@ -46,6 +46,12 @@ class CDVDOverlayText : public CDVDOverlay - m_type = type; - } - -+ CElement(CElement& src) -+ { -+ pNext = NULL; -+ m_type = src.m_type; -+ } -+ - virtual ~CElement() - { - } -@@ -71,6 +77,12 @@ class CDVDOverlayText : public CDVDOverlay - } - } - -+ CElementText(CElementText& src) -+ : CElement(src) -+ { -+ m_text = strdup(src.m_text); -+ } -+ - virtual ~CElementText() - { - if (m_text) free(m_text); -@@ -81,12 +93,20 @@ class CDVDOverlayText : public CDVDOverlay - - class CElementProperty : public CElement - { -+ public: - CElementProperty() : CElement(ELEMENT_TYPE_PROPERTY) - { - bItalic = false; - bBold = false; - } - -+ CElementProperty(CElementProperty& src) -+ : CElement(src) -+ { -+ bItalic = src.bItalic; -+ bBold = src.bBold; -+ } -+ - public: - bool bItalic; - bool bBold; -@@ -99,6 +119,22 @@ class CDVDOverlayText : public CDVDOverlay - m_pEnd = NULL; - } - -+ CDVDOverlayText(CDVDOverlayText& src) -+ : CDVDOverlay(src) -+ { -+ m_pHead = NULL; -+ m_pEnd = NULL; -+ for(CElement* e = src.m_pHead; e; e = e->pNext) -+ { -+ if(e->IsElementType(ELEMENT_TYPE_TEXT)) -+ AddElement(new CElementText(*static_cast(e))); -+ else if(e->IsElementType(ELEMENT_TYPE_PROPERTY)) -+ AddElement(new CElementProperty(*static_cast(e))); -+ else -+ AddElement(new CElement(*static_cast(e))); -+ } -+ } -+ - virtual ~CDVDOverlayText() - { - CElement* pTemp; -@@ -110,6 +146,11 @@ class CDVDOverlayText : public CDVDOverlay - } - } - -+ virtual CDVDOverlayText* Clone() -+ { -+ return new CDVDOverlayText(*this); -+ } -+ - void AddElement(CDVDOverlayText::CElement* pElement) - { - pElement->pNext = NULL; -diff --git a/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp b/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp -index 29c8d57..540d890 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp -@@ -222,6 +222,7 @@ void CDVDPlayerSubtitle::Process(double pts) - while(pOverlay) - { - m_pOverlayContainer->Add(pOverlay); -+ pOverlay->Release(); - pOverlay = m_pSubtitleFileParser->Parse(pts); - } - -diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParser.h b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParser.h -index 944bf06..3cd1e95 100644 ---- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParser.h -+++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParser.h -@@ -47,7 +47,13 @@ class CDVDSubtitleParserCollection - m_filename = strFile; - } - virtual ~CDVDSubtitleParserCollection() { } -- virtual CDVDOverlay* Parse(double iPts) { return m_collection.Get(iPts); } -+ virtual CDVDOverlay* Parse(double iPts) -+ { -+ CDVDOverlay* o = m_collection.Get(iPts); -+ if(o == NULL) -+ return o; -+ return o->Clone(); -+ } - virtual void Reset() { m_collection.Reset(); } - virtual void Dispose() { m_collection.Clear(); } - --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.24-PR2375.patch b/packages/mediacenter/xbmc/patches/xbmc-990.24-PR2375.patch deleted file mode 100644 index ddf3dd7e81..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.24-PR2375.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 8717c162b8c5092d77672351ce3bfa2d4e7e32d8 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Tue, 5 Mar 2013 22:17:15 +0100 -Subject: [PATCH] AE: Fix resample of e.g. 192 khz to 48 khz audio by scaling - the usual suspects with the src sampleRate - ---- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -index 258dcac..a64beb1 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -@@ -196,6 +196,13 @@ void CSoftAEStream::Initialize() - m_ssrcData.data_out = (float*)_aligned_malloc(m_format.m_frameSamples * (int)std::ceil(m_ssrcData.src_ratio) * sizeof(float), 16); - m_ssrcData.output_frames = m_format.m_frames * (long)std::ceil(m_ssrcData.src_ratio); - m_ssrcData.end_of_input = 0; -+ // we must buffer the same amount as before but taking the source sample rate into account -+ // there is no reason to decrease the buffer for upsampling -+ if (m_internalRatio < 1) -+ { -+ m_waterLevel *= (1.0 / m_internalRatio); -+ m_refillBuffer = m_waterLevel; -+ } - } - - m_limiter.SetSamplerate(AE.GetSampleRate()); --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.27-PR2388.patch b/packages/mediacenter/xbmc/patches/xbmc-990.27-PR2388.patch deleted file mode 100644 index 2b158d1f20..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.27-PR2388.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 249cccc2da097917995571b123ac22e30ed3f686 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 7 Mar 2013 12:50:57 +0000 -Subject: [PATCH] [rbp] Enable Vsync as a default - ---- - xbmc/settings/Settings.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h -index fd44a0f..5ba1d36 100644 ---- a/xbmc/settings/Settings.h -+++ b/xbmc/settings/Settings.h -@@ -36,7 +36,7 @@ - #ifdef MID - #define DEFAULT_VSYNC VSYNC_DISABLED - #else // MID --#if defined(TARGET_DARWIN) || defined(_WIN32) -+#if defined(TARGET_DARWIN) || defined(_WIN32) || defined(TARGET_RASPBERRY_PI) - #define DEFAULT_VSYNC VSYNC_ALWAYS - #else - #define DEFAULT_VSYNC VSYNC_DRIVER --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.27-fix-build.patch b/packages/mediacenter/xbmc/patches/xbmc-990.27-fix-build.patch new file mode 100644 index 0000000000..b17ea63d81 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/xbmc-990.27-fix-build.patch @@ -0,0 +1,34 @@ +From 88e250d43dcb13ec2a05f64994c57a3d96b024b4 Mon Sep 17 00:00:00 2001 +From: Jim Carroll +Date: Mon, 11 Mar 2013 03:19:46 -0400 +Subject: [PATCH] [fix] build issue with std::min on some platforms. + +--- + xbmc/interfaces/legacy/File.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/xbmc/interfaces/legacy/File.h b/xbmc/interfaces/legacy/File.h +index d8b5d26..d3c17b3 100644 +--- a/xbmc/interfaces/legacy/File.h ++++ b/xbmc/interfaces/legacy/File.h +@@ -27,6 +27,8 @@ + #include "LanguageHook.h" + #include "commons/Buffer.h" + ++#include ++ + namespace XBMCAddon + { + +@@ -70,7 +72,7 @@ + inline String read(unsigned long numBytes = 0) + { + XbmcCommons::Buffer b = readBytes(numBytes); +- return b.getString(numBytes == 0 ? b.remaining() : std::min(b.remaining(),numBytes)); ++ return b.getString(numBytes == 0 ? b.remaining() : std::min((unsigned long)b.remaining(),numBytes)); + } + + /** +-- +1.7.10 + diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.28-PR2395.patch b/packages/mediacenter/xbmc/patches/xbmc-990.28-PR2395.patch deleted file mode 100644 index e5cc23d133..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.28-PR2395.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 7a9939f714bcafe8d6616bfbdeb87d2e4b1f24e8 Mon Sep 17 00:00:00 2001 -From: pitpompej -Date: Fri, 8 Mar 2013 21:05:31 +0100 -Subject: [PATCH] Prevent timeout error because of waiting for port settings - change event on the wrong pipeline object when using - deinterlace mode - ---- - xbmc/cores/omxplayer/OMXVideo.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index d4b8fbf..15bc8fa 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -885,10 +885,10 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) - { - CLog::Log(LOGERROR, "%s::%s - error m_omx_image_fx.SetParameter(OMX_IndexParamPortDefinition) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); - } -- omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged); -+ omx_err = m_omx_image_fx.WaitForEvent(OMX_EventPortSettingsChanged); - if(omx_err != OMX_ErrorNone) - { -- CLog::Log(LOGERROR, "%s::%s - error m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); -+ CLog::Log(LOGERROR, "%s::%s - error m_omx_image_fx.WaitForEvent(OMX_EventPortSettingsChanged) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err); - } - port_image.nPortIndex = m_omx_image_fx.GetOutputPort(); - omx_err = m_omx_image_fx.GetParameter(OMX_IndexParamPortDefinition, &port_image); --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch b/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch deleted file mode 100644 index 7a0301aaee..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.29-PR2387.patch +++ /dev/null @@ -1,1508 +0,0 @@ -From 9d0695f2ae5f2a4d98c4ec6882fecd8209a425bc Mon Sep 17 00:00:00 2001 -From: Lars Op den Kamp -Date: Thu, 28 Feb 2013 20:41:38 +0100 -Subject: [PATCH] [cec] rebased PR1794 + fixes for Frodo - ---- - XBMC.xcodeproj/project.pbxproj | 13 +++ - configure.in | 40 +------ - system/peripherals.xml | 31 ++---- - tools/android/depends/libcec/Makefile | 4 +- - tools/darwin/depends/libcec/Makefile | 2 +- - xbmc/peripherals/PeripheralTypes.h | 76 ++++++++++++- - xbmc/peripherals/Peripherals.cpp | 62 +++++------ - xbmc/peripherals/Peripherals.h | 7 +- - xbmc/peripherals/bus/Makefile.in | 4 +- - xbmc/peripherals/bus/PeripheralBus.cpp | 81 +++----------- - xbmc/peripherals/bus/PeripheralBus.h | 23 +--- - xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp | 69 ------------ - xbmc/peripherals/bus/linux/PeripheralBusRPi.h | 40 ------- - .../bus/linux/PeripheralBusUSBLibUSB.cpp | 3 +- - .../bus/linux/PeripheralBusUSBLibUdev.cpp | 4 +- - xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp | 1 + - xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp | 116 ++++++++++++++++++++ - xbmc/peripherals/bus/virtual/PeripheralBusCEC.h | 57 ++++++++++ - xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp | 5 +- - xbmc/peripherals/devices/Peripheral.cpp | 50 ++++----- - xbmc/peripherals/devices/Peripheral.h | 6 +- - xbmc/peripherals/devices/PeripheralBluetooth.cpp | 4 +- - xbmc/peripherals/devices/PeripheralBluetooth.h | 2 +- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 52 ++------- - xbmc/peripherals/devices/PeripheralCecAdapter.h | 4 +- - xbmc/peripherals/devices/PeripheralDisk.cpp | 5 +- - xbmc/peripherals/devices/PeripheralDisk.h | 2 +- - xbmc/peripherals/devices/PeripheralHID.cpp | 5 +- - xbmc/peripherals/devices/PeripheralHID.h | 2 +- - xbmc/peripherals/devices/PeripheralImon.cpp | 4 +- - xbmc/peripherals/devices/PeripheralImon.h | 2 +- - xbmc/peripherals/devices/PeripheralNIC.cpp | 5 +- - xbmc/peripherals/devices/PeripheralNIC.h | 2 +- - xbmc/peripherals/devices/PeripheralNyxboard.cpp | 4 +- - xbmc/peripherals/devices/PeripheralNyxboard.h | 2 +- - xbmc/peripherals/devices/PeripheralTuner.cpp | 4 +- - xbmc/peripherals/devices/PeripheralTuner.h | 2 +- - 40 files changed, 404 insertions(+), 401 deletions(-) - delete mode 100644 xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp - delete mode 100644 xbmc/peripherals/bus/linux/PeripheralBusRPi.h - create mode 100644 xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp - create mode 100644 xbmc/peripherals/bus/virtual/PeripheralBusCEC.h - -diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj -index bf4a009..fbcd662 100644 -diff --git a/configure.in b/configure.in -index 4769315..4472e3e 100644 ---- a/configure.in -+++ b/configure.in -@@ -157,8 +157,6 @@ libusb_disabled="== libusb disabled. Plug and play USB device support will not b - libusb_disabled_udev_found="== libusb disabled. ==" - libcec_enabled="== libcec enabled. ==" - libcec_disabled="== libcec disabled. CEC adapter support will not be available. ==" --libcec_disabled_missing_libs="== libcec disabled because it either needs libudev, or libusb a compatible version of the RPi API. CEC adapter support will not be available. ==" --cec_rpi_api_missing="== no compatible RPi API found ==" - - # External library message strings - external_libraries_enabled="== Use of all supported external libraries enabled. ==" -@@ -1455,46 +1453,18 @@ fi - - # libcec - USE_LIBCEC=0 --USE_CEC_RPI_API=0 --use_rpi_cec_api="auto" - if test "x$use_libcec" != "xno"; then -- case "${host_cpu}" in -- arm*) -- echo "will check for RPi support" -- AC_CHECK_HEADER(interface/vmcs_host/vc_cec.h,,use_rpi_cec_api="no") -- ;; -- *) -- echo "will not check for RPi support (unsupported cpu: ${host_cpu})" -- use_rpi_cec_api="no" -- ;; -- esac -- -- # libcec needs libudev, libusb or the RPi API under linux, or the device will never be detected. -- if test "$host_vendor" != "apple" && test "$use_libusb" = "no" && test "$use_libudev" = "no" && test "$use_rpi_cec_api" = "no"; then -- if test "x$use_libcec" != "xauto"; then -- AC_MSG_ERROR($libcec_disabled_missing_libs) -- else -- use_libcec="no" -- AC_MSG_NOTICE($libcec_disabled_missing_libs) -- fi -- fi -- - # libcec is dyloaded, so we need to check for its headers and link any depends. - if test "x$use_libcec" != "xno"; then - if test "x$use_libcec" != "xauto"; then -- PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)]) -+ PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)]) - else -- PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) -+ PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) - fi - - if test "x$use_libcec" != "xno"; then - INCLUDES="$INCLUDES $CEC_CFLAGS" - USE_LIBCEC=1;AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libcec is installed"]) -- if test "x$use_rpi_cec_api" != "xno"; then -- LIBS+=" -lvcos -lvchiq_arm" -- AC_DEFINE([HAVE_CEC_RPI_API],[1],["Define to 1 if the CEC RPi API is installed"]) -- USE_CEC_RPI_API=1 -- fi - XB_FIND_SONAME([LIBCEC],[cec],[use_libcec]) - AC_MSG_NOTICE($libcec_enabled) - else -@@ -2255,11 +2225,6 @@ fi - - if test "x$use_libcec" != "xno"; then - final_message="$final_message\n libcec support:\tYes" -- if test "x$use_rpi_cec_api" != "xno"; then -- final_message="$final_message\n libcec RPi support:\tYes" -- else -- final_message="$final_message\n libcec RPi support:\tNo" -- fi - else - final_message="$final_message\n libcec support:\tNo" - fi -@@ -2451,7 +2416,6 @@ AC_SUBST(USE_AIRTUNES) - AC_SUBST(USE_LIBUDEV) - AC_SUBST(USE_LIBUSB) - AC_SUBST(USE_LIBCEC) --AC_SUBST(USE_CEC_RPI_API) - AC_SUBST(USE_MYSQL) - AC_SUBST(USE_WEB_SERVER) - AC_SUBST(USE_UPNP) -diff --git a/system/peripherals.xml b/system/peripherals.xml -index 967b96c..68205df 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -7,30 +7,7 @@ - - - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -+ - - - -@@ -54,6 +31,12 @@ - - - -+ -+ -+ -+ - - - -diff --git a/tools/android/depends/libcec/Makefile b/tools/android/depends/libcec/Makefile -index 7d9b6b8..0147147 100644 ---- a/tools/android/depends/libcec/Makefile -+++ b/tools/android/depends/libcec/Makefile -@@ -3,7 +3,7 @@ DEPS= ../Makefile.include Makefile - - # lib name, version - LIBNAME=libcec --VERSION=2.0.5-3 -+VERSION=2.1.0 - SOURCE=$(LIBNAME)-$(VERSION) - ARCHIVE=$(SOURCE).tar.gz - -@@ -11,7 +11,7 @@ ARCHIVE=$(SOURCE).tar.gz - CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST) \ - ac_cv_search_dlopen=yes - --LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.0 -+LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.1 - - all: .installed-$(PLATFORM) - -diff --git a/tools/darwin/depends/libcec/Makefile b/tools/darwin/depends/libcec/Makefile -index 3e84bff..b7970dd 100644 ---- a/tools/darwin/depends/libcec/Makefile -+++ b/tools/darwin/depends/libcec/Makefile -@@ -3,7 +3,7 @@ include ../config.site.mk - - # lib name, version - LIBNAME=libcec --VERSION=2.0.5-3 -+VERSION=2.1.0 - SOURCE=$(LIBNAME)-$(VERSION) - ARCHIVE=$(SOURCE).tar.gz - -diff --git a/xbmc/peripherals/PeripheralTypes.h b/xbmc/peripherals/PeripheralTypes.h -index 3cd7691..03030d4 100644 ---- a/xbmc/peripherals/PeripheralTypes.h -+++ b/xbmc/peripherals/PeripheralTypes.h -@@ -35,7 +35,8 @@ - PERIPHERAL_BUS_UNKNOWN = 0, - PERIPHERAL_BUS_USB, - PERIPHERAL_BUS_PCI, -- PERIPHERAL_BUS_RPI -+ PERIPHERAL_BUS_RPI, -+ PERIPHERAL_BUS_CEC - }; - - enum PeripheralFeature -@@ -143,6 +144,8 @@ - return "pci"; - case PERIPHERAL_BUS_RPI: - return "rpi"; -+ case PERIPHERAL_BUS_CEC: -+ return "cec"; - default: - return "unknown"; - } -@@ -159,6 +162,8 @@ - return PERIPHERAL_BUS_PCI; - else if (strTypeLowerCase.Equals("rpi")) - return PERIPHERAL_BUS_RPI; -+ else if (strTypeLowerCase.Equals("cec")) -+ return PERIPHERAL_BUS_CEC; - - return PERIPHERAL_BUS_UNKNOWN; - }; -@@ -180,4 +185,73 @@ - strHexString.Format("%04X", iVal); - }; - }; -+ -+ class PeripheralScanResult -+ { -+ public: -+ PeripheralScanResult(const PeripheralBusType busType) : -+ m_type(PERIPHERAL_UNKNOWN), -+ m_iVendorId(0), -+ m_iProductId(0), -+ m_mappedType(PERIPHERAL_UNKNOWN), -+ m_busType(busType), -+ m_mappedBusType(busType), -+ m_iSequence(0) {} -+ -+ PeripheralScanResult(void) : -+ m_type(PERIPHERAL_UNKNOWN), -+ m_iVendorId(0), -+ m_iProductId(0), -+ m_mappedType(PERIPHERAL_UNKNOWN), -+ m_busType(PERIPHERAL_BUS_UNKNOWN), -+ m_mappedBusType(PERIPHERAL_BUS_UNKNOWN), -+ m_iSequence(0) {} -+ -+ bool operator ==(const PeripheralScanResult& right) const -+ { -+ return m_iVendorId == right.m_iVendorId && -+ m_iProductId == right.m_iProductId && -+ m_type == right.m_type && -+ m_busType == right.m_busType && -+ m_strLocation.Equals(right.m_strLocation); -+ } -+ -+ bool operator !=(const PeripheralScanResult& right) const -+ { -+ return !(*this == right); -+ } -+ -+ PeripheralType m_type; -+ CStdString m_strLocation; -+ int m_iVendorId; -+ int m_iProductId; -+ PeripheralType m_mappedType; -+ CStdString m_strDeviceName; -+ PeripheralBusType m_busType; -+ PeripheralBusType m_mappedBusType; -+ unsigned int m_iSequence; // when more than one adapter of the same type is found -+ }; -+ -+ struct PeripheralScanResults -+ { -+ bool GetDeviceOnLocation(const CStdString& strLocation, PeripheralScanResult* result) const -+ { -+ for (std::vector::const_iterator it = m_results.begin(); it != m_results.end(); it++) -+ { -+ if ((*it).m_strLocation == strLocation) -+ { -+ *result = *it; -+ return true; -+ } -+ } -+ return false; -+ } -+ -+ bool ContainsResult(const PeripheralScanResult& result) const -+ { -+ return std::find(m_results.begin(), m_results.end(), result) != m_results.end(); -+ } -+ -+ std::vector m_results; -+ }; - } -diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp -index 3ce8c07..c5fadd9 100644 ---- a/xbmc/peripherals/Peripherals.cpp -+++ b/xbmc/peripherals/Peripherals.cpp -@@ -31,8 +31,8 @@ - #include "bus/PeripheralBusUSB.h" - #include "dialogs/GUIDialogPeripheralManager.h" - --#ifdef HAVE_CEC_RPI_API --#include "bus/linux/PeripheralBusRPi.h" -+#if defined(HAVE_LIBCEC) -+#include "bus/virtual/PeripheralBusCEC.h" - #endif - - #include "threads/SingleLock.h" -@@ -84,8 +84,8 @@ void CPeripherals::Initialise(void) - #if defined(HAVE_PERIPHERAL_BUS_USB) - m_busses.push_back(new CPeripheralBusUSB(this)); - #endif --#ifdef HAVE_CEC_RPI_API -- m_busses.push_back(new CPeripheralBusRPi(this)); -+#if defined(HAVE_LIBCEC) -+ m_busses.push_back(new CPeripheralBusCEC(this)); - #endif - - /* initialise all known busses */ -@@ -229,54 +229,50 @@ bool CPeripherals::HasPeripheralWithFeature(const PeripheralFeature feature, Per - return (GetPeripheralsWithFeature(dummy, feature, busType) > 0); - } - --CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const PeripheralType type, const CStdString &strLocation, int iVendorId /* = 0 */, int iProductId /* = 0 */) -+CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const PeripheralScanResult& result) - { - CPeripheral *peripheral = NULL; -+ PeripheralScanResult mappedResult = result; -+ if (mappedResult.m_busType == PERIPHERAL_BUS_UNKNOWN) -+ mappedResult.m_busType = bus.Type(); -+ - /* check whether there's something mapped in peripherals.xml */ -- PeripheralType mappedType = type; -- CStdString strDeviceName; -- int iMappingPtr = GetMappingForDevice(bus, type, iVendorId, iProductId); -- bool bHasMapping(iMappingPtr >= 0); -- if (bHasMapping) -- { -- mappedType = m_mappings[iMappingPtr].m_mappedTo; -- strDeviceName = m_mappings[iMappingPtr].m_strDeviceName; -- } -- else -+ if (!GetMappingForDevice(bus, mappedResult)) - { - /* don't create instances for devices that aren't mapped in peripherals.xml */ - return NULL; - } - -- switch(mappedType) -+ switch(mappedResult.m_mappedType) - { - case PERIPHERAL_HID: -- peripheral = new CPeripheralHID(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); -+ peripheral = new CPeripheralHID(mappedResult); - break; - - case PERIPHERAL_NIC: -- peripheral = new CPeripheralNIC(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); -+ peripheral = new CPeripheralNIC(mappedResult); - break; - - case PERIPHERAL_DISK: -- peripheral = new CPeripheralDisk(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); -+ peripheral = new CPeripheralDisk(mappedResult); - break; - - case PERIPHERAL_NYXBOARD: -- peripheral = new CPeripheralNyxboard(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); -+ peripheral = new CPeripheralNyxboard(mappedResult); - break; - - case PERIPHERAL_TUNER: -- peripheral = new CPeripheralTuner(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); -+ peripheral = new CPeripheralTuner(mappedResult); - break; - - case PERIPHERAL_BLUETOOTH: -- peripheral = new CPeripheralBluetooth(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); -+ peripheral = new CPeripheralBluetooth(mappedResult); - break; - - case PERIPHERAL_CEC: - #if defined(HAVE_LIBCEC) -- peripheral = new CPeripheralCecAdapter(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); -+ if (bus.Type() == PERIPHERAL_BUS_CEC) -+ peripheral = new CPeripheralCecAdapter(mappedResult); - #else - if (!m_bMissingLibCecWarningDisplayed) - { -@@ -288,7 +284,7 @@ CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const Periphera - break; - - case PERIPHERAL_IMON: -- peripheral = new CPeripheralImon(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId); -+ peripheral = new CPeripheralImon(mappedResult); - break; - - default: -@@ -305,7 +301,7 @@ CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const Periphera - } - else - { -- CLog::Log(LOGDEBUG, "%s - failed to initialise peripheral on '%s'", __FUNCTION__, strLocation.c_str()); -+ CLog::Log(LOGDEBUG, "%s - failed to initialise peripheral on '%s'", __FUNCTION__, mappedResult.m_strLocation.c_str()); - delete peripheral; - peripheral = NULL; - } -@@ -340,7 +336,7 @@ void CPeripherals::OnDeviceDeleted(const CPeripheralBus &bus, const CPeripheral - CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(35006), peripheral.DeviceName()); - } - --int CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, const PeripheralType classType, int iVendorId, int iProductId) const -+bool CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, PeripheralScanResult& result) const - { - /* check all mappings in the order in which they are defined in peripherals.xml */ - for (unsigned int iMappingPtr = 0; iMappingPtr < m_mappings.size(); iMappingPtr++) -@@ -355,24 +351,26 @@ int CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, const Periphera - else - { - for (unsigned int i = 0; i < mapping.m_PeripheralID.size(); i++) -- if (mapping.m_PeripheralID[i].m_iVendorId == iVendorId && mapping.m_PeripheralID[i].m_iProductId == iProductId) -+ if (mapping.m_PeripheralID[i].m_iVendorId == result.m_iVendorId && mapping.m_PeripheralID[i].m_iProductId == result.m_iProductId) - bProductMatch = true; - } - - bool bBusMatch = (mapping.m_busType == PERIPHERAL_BUS_UNKNOWN || mapping.m_busType == bus.Type()); -- bool bClassMatch = (mapping.m_class == PERIPHERAL_UNKNOWN || mapping.m_class == classType); -+ bool bClassMatch = (mapping.m_class == PERIPHERAL_UNKNOWN || mapping.m_class == result.m_type); - - if (bProductMatch && bBusMatch && bClassMatch) - { - CStdString strVendorId, strProductId; -- PeripheralTypeTranslator::FormatHexString(iVendorId, strVendorId); -- PeripheralTypeTranslator::FormatHexString(iProductId, strProductId); -+ PeripheralTypeTranslator::FormatHexString(result.m_iVendorId, strVendorId); -+ PeripheralTypeTranslator::FormatHexString(result.m_iProductId, strProductId); - CLog::Log(LOGDEBUG, "%s - device (%s:%s) mapped to %s (type = %s)", __FUNCTION__, strVendorId.c_str(), strProductId.c_str(), mapping.m_strDeviceName.c_str(), PeripheralTypeTranslator::TypeToString(mapping.m_mappedTo)); -- return iMappingPtr; -+ result.m_mappedType = m_mappings[iMappingPtr].m_mappedTo; -+ result.m_strDeviceName = m_mappings[iMappingPtr].m_strDeviceName; -+ return true; - } - } - -- return -1; -+ return false; - } - - void CPeripherals::GetSettingsFromMapping(CPeripheral &peripheral) const -diff --git a/xbmc/peripherals/Peripherals.h b/xbmc/peripherals/Peripherals.h -index ac94699..9594ff8 100644 ---- a/xbmc/peripherals/Peripherals.h -+++ b/xbmc/peripherals/Peripherals.h -@@ -111,11 +111,10 @@ - /*! - * @brief Creates a new instance of a peripheral. - * @param bus The bus on which this peripheral is present. -- * @param type The type of the new peripheral. -- * @param strLocation The location on the bus. -+ * @param result The scan result from the device scanning code. - * @return The new peripheral or NULL if it could not be created. - */ -- CPeripheral *CreatePeripheral(CPeripheralBus &bus, const PeripheralType type, const CStdString &strLocation, int iVendorId = 0, int iProductId = 0); -+ CPeripheral *CreatePeripheral(CPeripheralBus &bus, const PeripheralScanResult& result); - - /*! - * @brief Add the settings that are defined in the mappings file to the peripheral (if there is anything defined). -@@ -200,7 +199,7 @@ - private: - CPeripherals(void); - bool LoadMappings(void); -- int GetMappingForDevice(const CPeripheralBus &bus, const PeripheralType classType, int iVendorId, int iProductId) const; -+ bool GetMappingForDevice(const CPeripheralBus &bus, PeripheralScanResult& result) const; - static void GetSettingsFromMappingsFile(TiXmlElement *xmlNode, std::map &m_settings); - - bool m_bInitialised; -diff --git a/xbmc/peripherals/bus/Makefile.in b/xbmc/peripherals/bus/Makefile.in -index 01fa4e2..2262e4a 100644 ---- a/xbmc/peripherals/bus/Makefile.in -+++ b/xbmc/peripherals/bus/Makefile.in -@@ -12,8 +12,8 @@ ifeq ($(findstring osx,@ARCH@),osx) - SRCS += osx/PeripheralBusUSB.cpp - endif - --ifeq (@USE_CEC_RPI_API@,1) --SRCS += linux/PeripheralBusRPi.cpp -+ifeq (@USE_LIBCEC@,1) -+SRCS += virtual/PeripheralBusCEC.cpp - endif - - LIB = peripheral-bus.a -diff --git a/xbmc/peripherals/bus/PeripheralBus.cpp b/xbmc/peripherals/bus/PeripheralBus.cpp -index 727f7c9..b17a9f1 100644 ---- a/xbmc/peripherals/bus/PeripheralBus.cpp -+++ b/xbmc/peripherals/bus/PeripheralBus.cpp -@@ -29,65 +29,6 @@ - - #define PERIPHERAL_DEFAULT_RESCAN_INTERVAL 1000 - --bool PeripheralScanResult::operator ==(const PeripheralScanResult &right) const --{ -- return m_iVendorId == right.m_iVendorId && -- m_iProductId == right.m_iProductId && -- m_type == right.m_type && -- m_strLocation.Equals(right.m_strLocation); --} -- --bool PeripheralScanResult::operator !=(const PeripheralScanResult &right) const --{ -- return !(*this == right); --} -- --bool PeripheralScanResult::operator ==(const CPeripheral &right) const --{ -- return m_iVendorId == right.VendorId() && -- m_iProductId == right.ProductId() && -- m_type == right.Type() && -- m_strLocation.Equals(right.Location()); --} -- --bool PeripheralScanResult::operator !=(const CPeripheral &right) const --{ -- return !(*this == right); --} -- --bool PeripheralScanResults::GetDeviceOnLocation(const CStdString &strLocation, PeripheralScanResult *result) const --{ -- bool bReturn(false); -- -- for (unsigned int iDevicePtr = 0; iDevicePtr < m_results.size(); iDevicePtr++) -- { -- if (m_results.at(iDevicePtr).m_strLocation == strLocation) -- { -- *result = m_results.at(iDevicePtr); -- bReturn = true; -- break; -- } -- } -- -- return bReturn; --} -- --bool PeripheralScanResults::ContainsResult(const PeripheralScanResult &result) const --{ -- bool bReturn(false); -- -- for (unsigned int iDevicePtr = 0; iDevicePtr < m_results.size(); iDevicePtr++) -- { -- if (m_results.at(iDevicePtr) == result) -- { -- bReturn = true; -- break; -- } -- } -- -- return bReturn; --} -- - CPeripheralBus::CPeripheralBus(CPeripherals *manager, PeripheralBusType type) : - CThread("XBMC Peripherals"), - m_iRescanTime(PERIPHERAL_DEFAULT_RESCAN_INTERVAL), -@@ -137,9 +78,9 @@ void CPeripheralBus::UnregisterRemovedDevices(const PeripheralScanResults &resul - for (int iDevicePtr = (int) m_peripherals.size() - 1; iDevicePtr >= 0; iDevicePtr--) - { - CPeripheral *peripheral = m_peripherals.at(iDevicePtr); -- PeripheralScanResult updatedDevice; -+ PeripheralScanResult updatedDevice(m_type); - if (!results.GetDeviceOnLocation(peripheral->Location(), &updatedDevice) || -- updatedDevice != *peripheral) -+ *peripheral != updatedDevice) - { - /* device removed */ - removedPeripherals.push_back(peripheral); -@@ -170,9 +111,9 @@ void CPeripheralBus::RegisterNewDevices(const PeripheralScanResults &results) - CSingleLock lock(m_critSection); - for (unsigned int iResultPtr = 0; iResultPtr < results.m_results.size(); iResultPtr++) - { -- PeripheralScanResult result = results.m_results.at(iResultPtr); -+ const PeripheralScanResult& result = results.m_results.at(iResultPtr); - if (!HasPeripheral(result.m_strLocation)) -- g_peripherals.CreatePeripheral(*this, result.m_type, result.m_strLocation, result.m_iVendorId, result.m_iProductId); -+ g_peripherals.CreatePeripheral(*this, result); - } - } - -@@ -246,6 +187,20 @@ int CPeripheralBus::GetPeripheralsWithFeature(vector &results, co - return iReturn; - } - -+size_t CPeripheralBus::GetNumberOfPeripheralsWithId(const int iVendorId, const int iProductId) const -+{ -+ int iReturn(0); -+ CSingleLock lock(m_critSection); -+ for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < m_peripherals.size(); iPeripheralPtr++) -+ { -+ if (m_peripherals.at(iPeripheralPtr)->VendorId() == iVendorId && -+ m_peripherals.at(iPeripheralPtr)->ProductId() == iProductId) -+ iReturn++; -+ } -+ -+ return iReturn; -+} -+ - void CPeripheralBus::Process(void) - { - while (!m_bStop) -diff --git a/xbmc/peripherals/bus/PeripheralBus.h b/xbmc/peripherals/bus/PeripheralBus.h -index 96426a9..29ff7d7 100644 ---- a/xbmc/peripherals/bus/PeripheralBus.h -+++ b/xbmc/peripherals/bus/PeripheralBus.h -@@ -31,28 +31,6 @@ - { - class CPeripherals; - -- struct PeripheralScanResult -- { -- bool operator ==(const PeripheralScanResult &right) const; -- bool operator !=(const PeripheralScanResult &right) const; -- -- bool operator ==(const CPeripheral &right) const; -- bool operator !=(const CPeripheral &right) const; -- -- PeripheralType m_type; -- CStdString m_strLocation; -- int m_iVendorId; -- int m_iProductId; -- }; -- -- struct PeripheralScanResults -- { -- bool GetDeviceOnLocation(const CStdString &strLocation, PeripheralScanResult *result) const; -- bool ContainsResult(const PeripheralScanResult &result) const; -- -- std::vector m_results; -- }; -- - /*! - * @class CPeripheralBus - * This represents a bus on the system. By default, this bus instance will scan for changes every second. -@@ -100,6 +78,7 @@ - virtual int GetPeripheralsWithFeature(std::vector &results, const PeripheralFeature feature) const; - - virtual size_t GetNumberOfPeripherals() const; -+ virtual size_t GetNumberOfPeripheralsWithId(const int iVendorId, const int iProductId) const; - - /*! - * @brief Get all features that are supported by devices on this bus. -diff --git a/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp b/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp -deleted file mode 100644 -index 8a436e4..0000000 ---- a/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp -+++ /dev/null -@@ -1,69 +0,0 @@ --/* -- * Copyright (C) 2005-2012 Team XBMC -- * http://xbmc.org -- * -- * This Program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2, or (at your option) -- * any later version. -- * -- * This Program 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 General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#include "PeripheralBusRPi.h" --#include -- --extern "C" { --#include --#include --} -- --using namespace PERIPHERALS; -- --#define RPI_PERIPHERAL_BUS_VID 0x2708 --#define RPI_PERIPHERAL_CEC_PID 0x1001 -- --CPeripheralBusRPi::CPeripheralBusRPi(CPeripherals *manager) : -- CPeripheralBus(manager, PERIPHERAL_BUS_RPI) --{ -- m_bNeedsPolling = false; --} -- --bool CPeripheralBusRPi::PerformDeviceScan(PeripheralScanResults &results) --{ -- if (FindAdapter()) -- { -- PeripheralScanResult result; -- result.m_iVendorId = RPI_PERIPHERAL_BUS_VID; -- result.m_iProductId = RPI_PERIPHERAL_CEC_PID; -- result.m_type = PERIPHERAL_CEC; -- result.m_strLocation = CEC_RPI_VIRTUAL_COM; -- -- if (!results.ContainsResult(result)) -- results.m_results.push_back(result); -- } -- -- return true; --} -- --bool CPeripheralBusRPi::FindAdapter(void) --{ -- uint8_t iResult; -- -- VCHI_INSTANCE_T vchiq_instance; -- if ((iResult = vchi_initialise(&vchiq_instance)) != VCHIQ_SUCCESS) -- return false; -- -- if ((iResult = vchi_connect(NULL, 0, vchiq_instance)) != VCHIQ_SUCCESS) -- return false; -- -- return true; --} -diff --git a/xbmc/peripherals/bus/linux/PeripheralBusRPi.h b/xbmc/peripherals/bus/linux/PeripheralBusRPi.h -deleted file mode 100644 -index e660401..0000000 ---- a/xbmc/peripherals/bus/linux/PeripheralBusRPi.h -+++ /dev/null -@@ -1,40 +0,0 @@ --#pragma once --/* -- * Copyright (C) 2005-2012 Team XBMC -- * http://xbmc.org -- * -- * This Program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2, or (at your option) -- * any later version. -- * -- * This Program 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 General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#include "peripherals/bus/PeripheralBus.h" --#include "peripherals/devices/Peripheral.h" -- --namespace PERIPHERALS --{ -- class CPeripherals; -- -- class CPeripheralBusRPi : public CPeripheralBus -- { -- public: -- CPeripheralBusRPi(CPeripherals *manager); -- virtual ~CPeripheralBusRPi(void) {}; -- -- bool PerformDeviceScan(PeripheralScanResults &results); -- -- private: -- bool FindAdapter(void); -- }; --} -diff --git a/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp b/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp -index 659ebf0..563c96e 100644 ---- a/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp -+++ b/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp -@@ -43,7 +43,7 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results) - struct usb_device *dev; - for (dev = bus->devices; dev; dev = dev->next) - { -- PeripheralScanResult result; -+ PeripheralScanResult result(m_type); - result.m_iVendorId = dev->descriptor.idVendor; - result.m_iProductId = dev->descriptor.idProduct; - result.m_type = (dev->descriptor.bDeviceClass == USB_CLASS_PER_INTERFACE && dev->descriptor.bNumConfigurations > 0 && -@@ -55,6 +55,7 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results) - #else - result.m_strLocation.Format("/bus%s/dev%s", bus->dirname, dev->filename); - #endif -+ result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId); - if (!results.ContainsResult(result)) - results.m_results.push_back(result); - } -diff --git a/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUdev.cpp b/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUdev.cpp -index b7a0061..ca21e06 100644 ---- a/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUdev.cpp -+++ b/xbmc/peripherals/bus/linux/PeripheralBusUSBLibUdev.cpp -@@ -152,12 +152,12 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results) - iClass = USB_CLASS_HID; - } - -- PeripheralScanResult result; -+ PeripheralScanResult result(m_type); - result.m_iVendorId = PeripheralTypeTranslator::HexStringToInt(udev_device_get_sysattr_value(dev, "idVendor")); - result.m_iProductId = PeripheralTypeTranslator::HexStringToInt(udev_device_get_sysattr_value(dev, "idProduct")); - result.m_type = GetType(iClass); - result.m_strLocation = udev_device_get_syspath(dev); -- -+ result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId); - if (!results.ContainsResult(result)) - results.m_results.push_back(result); - } -diff --git a/xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp b/xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp -index b0e3617..78bd224 100644 ---- a/xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp -+++ b/xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp -@@ -266,6 +266,7 @@ void CPeripheralBusUSB::DeviceAttachCallback(CPeripheralBusUSB* refCon, io_itera - else - privateDataRef->result.m_type = refCon->GetType(bDeviceClass); - -+ privateDataRef->result.m_iSequence = refCon->GetNumberOfPeripheralsWithId(privateDataRef->result.m_iVendorId, privateDataRef->result.m_iProductId); - if (!refCon->m_scan_results.ContainsResult(privateDataRef->result)) - { - // register this usb device for an interest notification callback. -diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp -new file mode 100644 -index 0000000..da169c1 ---- /dev/null -+++ b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp -@@ -0,0 +1,116 @@ -+/* -+ * Copyright (C) 2005-2012 Team XBMC -+ * http://xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program 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 General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#include "system.h" -+#if defined(HAVE_LIBCEC) -+#include "PeripheralBusCEC.h" -+#include "peripherals/Peripherals.h" -+#include "utils/log.h" -+#include "DynamicDll.h" -+ -+#include -+ -+using namespace PERIPHERALS; -+using namespace CEC; -+using namespace std; -+ -+class DllLibCECInterface -+{ -+public: -+ virtual ~DllLibCECInterface() {} -+ virtual ICECAdapter* CECInitialise(libcec_configuration *configuration)=0; -+ virtual void* CECDestroy(ICECAdapter *adapter)=0; -+}; -+ -+class PERIPHERALS::DllLibCEC : public DllDynamic, DllLibCECInterface -+{ -+ DECLARE_DLL_WRAPPER(DllLibCEC, DLL_PATH_LIBCEC) -+ -+ DEFINE_METHOD1(ICECAdapter*, CECInitialise, (libcec_configuration *p1)) -+ DEFINE_METHOD1(void* , CECDestroy, (ICECAdapter *p1)) -+ -+ BEGIN_METHOD_RESOLVE() -+ RESOLVE_METHOD_RENAME(CECInitialise, CECInitialise) -+ RESOLVE_METHOD_RENAME(CECDestroy, CECDestroy) -+ END_METHOD_RESOLVE() -+}; -+ -+CPeripheralBusCEC::CPeripheralBusCEC(CPeripherals *manager) : -+ CPeripheralBus(manager, PERIPHERAL_BUS_CEC), -+ m_dll(new DllLibCEC), -+ m_cecAdapter(NULL) -+{ -+ m_iRescanTime = 1000; -+ if (!m_dll->Load() || !m_dll->IsLoaded()) -+ { -+ delete m_dll; -+ m_dll = NULL; -+ } -+ else -+ { -+ m_cecAdapter = m_dll->CECInitialise(&m_configuration); -+ } -+} -+ -+CPeripheralBusCEC::~CPeripheralBusCEC(void) -+{ -+ if (m_dll && m_cecAdapter) -+ m_dll->CECDestroy(m_cecAdapter); -+ delete m_dll; -+} -+ -+bool CPeripheralBusCEC::PerformDeviceScan(PeripheralScanResults &results) -+{ -+ if (!m_dll || !m_cecAdapter) -+ return false; -+ -+ cec_adapter_descriptor deviceList[10]; -+ int8_t iFound = m_cecAdapter->DetectAdapters(deviceList, 10, NULL, true); -+ -+ for (uint8_t iDevicePtr = 0; iDevicePtr < iFound; iDevicePtr++) -+ { -+ PeripheralScanResult result(m_type); -+ result.m_iVendorId = deviceList[iDevicePtr].iVendorId; -+ result.m_iProductId = deviceList[iDevicePtr].iProductId; -+ result.m_strLocation = deviceList[iDevicePtr].strComName; -+ result.m_type = PERIPHERAL_CEC; -+ -+ // override the bus type, so users don't have to reconfigure their adapters -+ switch(deviceList[iDevicePtr].adapterType) -+ { -+ case ADAPTERTYPE_P8_EXTERNAL: -+ case ADAPTERTYPE_P8_DAUGHTERBOARD: -+ result.m_mappedBusType = PERIPHERAL_BUS_USB; -+ break; -+ case ADAPTERTYPE_RPI: -+ result.m_mappedBusType = PERIPHERAL_BUS_RPI; -+ break; -+ default: -+ break; -+ } -+ -+ result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId); -+ if (!results.ContainsResult(result)) -+ results.m_results.push_back(result); -+ } -+ return true; -+} -+ -+#endif -diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h -new file mode 100644 -index 0000000..acba01a ---- /dev/null -+++ b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h -@@ -0,0 +1,57 @@ -+#pragma once -+/* -+ * Copyright (C) 2005-2013 Team XBMC -+ * http://xbmc.org -+ * -+ * This Program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This Program 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 General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#include "peripherals/bus/PeripheralBus.h" -+#include "peripherals/devices/Peripheral.h" -+ -+// undefine macro isset, it collides with function in cectypes.h -+#ifdef isset -+#undef isset -+#endif -+#include -+ -+namespace CEC -+{ -+ class ICECAdapter; -+} -+ -+namespace PERIPHERALS -+{ -+ class CPeripherals; -+ class DllLibCEC; -+ -+ class CPeripheralBusCEC : public CPeripheralBus -+ { -+ public: -+ CPeripheralBusCEC(CPeripherals *manager); -+ virtual ~CPeripheralBusCEC(void); -+ -+ /*! -+ * @see PeripheralBus::PerformDeviceScan() -+ */ -+ bool PerformDeviceScan(PeripheralScanResults &results); -+ -+ private: -+ DllLibCEC* m_dll; -+ CEC::ICECAdapter* m_cecAdapter; -+ CEC::libcec_configuration m_configuration; -+ }; -+} -diff --git a/xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp b/xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp -index 811e0d1..fb55561 100644 ---- a/xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp -+++ b/xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp -@@ -104,14 +104,15 @@ bool CPeripheralBusUSB::PerformDeviceScan(const GUID *guid, const PeripheralType - - if ((strTmp.Find("&mi_") < 0) || (strTmp.Find("&mi_00") >= 0)) - { -- PeripheralScanResult prevDevice; -+ PeripheralScanResult prevDevice(m_type); - if (!results.GetDeviceOnLocation(devicedetailData->DevicePath, &prevDevice)) - { -- PeripheralScanResult result; -+ PeripheralScanResult result(m_type); - result.m_strLocation = devicedetailData->DevicePath; - result.m_type = type; - result.m_iVendorId = PeripheralTypeTranslator::HexStringToInt(strVendorId.c_str()); - result.m_iProductId = PeripheralTypeTranslator::HexStringToInt(strProductId.c_str()); -+ result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId); - - if (!results.ContainsResult(result)) - results.m_results.push_back(result); -diff --git a/xbmc/peripherals/devices/Peripheral.cpp b/xbmc/peripherals/devices/Peripheral.cpp -index e9cde30..ad2227a 100644 ---- a/xbmc/peripherals/devices/Peripheral.cpp -+++ b/xbmc/peripherals/devices/Peripheral.cpp -@@ -38,39 +38,23 @@ struct SortBySettingsOrder - } - }; - --CPeripheral::CPeripheral(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : -- m_type(type), -- m_busType(busType), -- m_strLocation(strLocation), -- m_strDeviceName(strDeviceName), -+CPeripheral::CPeripheral(const PeripheralScanResult& scanResult) : -+ m_type(scanResult.m_mappedType), -+ m_busType(scanResult.m_busType), -+ m_mappedBusType(scanResult.m_mappedBusType), -+ m_strLocation(scanResult.m_strLocation), -+ m_strDeviceName(scanResult.m_strDeviceName), - m_strFileLocation(StringUtils::EmptyString), -- m_iVendorId(iVendorId), -- m_iProductId(iProductId), -- m_strVersionInfo(g_localizeStrings.Get(13205)), // "unknown" -- m_bInitialised(false), -- m_bHidden(false), -- m_bError(false) --{ -- PeripheralTypeTranslator::FormatHexString(iVendorId, m_strVendorId); -- PeripheralTypeTranslator::FormatHexString(iProductId, m_strProductId); -- m_strFileLocation.Format("peripherals://%s/%s.dev", PeripheralTypeTranslator::BusTypeToString(busType), strLocation.c_str()); --} -- --CPeripheral::CPeripheral(void) : -- m_type(PERIPHERAL_UNKNOWN), -- m_busType(PERIPHERAL_BUS_UNKNOWN), -- m_strLocation(StringUtils::EmptyString), -- m_strDeviceName(StringUtils::EmptyString), -- m_strFileLocation(StringUtils::EmptyString), -- m_iVendorId(0), -- m_strVendorId("0000"), -- m_iProductId(0), -- m_strProductId("0000"), -+ m_iVendorId(scanResult.m_iVendorId), -+ m_iProductId(scanResult.m_iProductId), - m_strVersionInfo(g_localizeStrings.Get(13205)), // "unknown" - m_bInitialised(false), - m_bHidden(false), - m_bError(false) - { -+ PeripheralTypeTranslator::FormatHexString(scanResult.m_iVendorId, m_strVendorId); -+ PeripheralTypeTranslator::FormatHexString(scanResult.m_iProductId, m_strProductId); -+ m_strFileLocation.Format(scanResult.m_iSequence > 0 ? "peripherals://%s/%s_%d.dev" : "peripherals://%s/%s.dev", PeripheralTypeTranslator::BusTypeToString(scanResult.m_busType), scanResult.m_strLocation.c_str(), scanResult.m_iSequence); - } - - CPeripheral::~CPeripheral(void) -@@ -146,7 +130,7 @@ bool CPeripheral::Initialise(void) - return bReturn; - - g_peripherals.GetSettingsFromMapping(*this); -- m_strSettingsFile.Format("special://profile/peripheral_data/%s_%s_%s.xml", PeripheralTypeTranslator::BusTypeToString(m_busType), m_strVendorId.c_str(), m_strProductId.c_str()); -+ m_strSettingsFile.Format("special://profile/peripheral_data/%s_%s_%s.xml", PeripheralTypeTranslator::BusTypeToString(m_mappedBusType), m_strVendorId.c_str(), m_strProductId.c_str()); - LoadPersistedSettings(); - - for (unsigned int iFeaturePtr = 0; iFeaturePtr < m_features.size(); iFeaturePtr++) -@@ -535,3 +519,13 @@ void CPeripheral::ClearSettings(void) - } - m_settings.clear(); - } -+ -+bool CPeripheral::operator ==(const PeripheralScanResult& right) const -+{ -+ return m_strLocation.Equals(right.m_strLocation); -+} -+ -+bool CPeripheral::operator !=(const PeripheralScanResult& right) const -+{ -+ return !(*this == right); -+} -diff --git a/xbmc/peripherals/devices/Peripheral.h b/xbmc/peripherals/devices/Peripheral.h -index d42e83e..64cf64e 100644 ---- a/xbmc/peripherals/devices/Peripheral.h -+++ b/xbmc/peripherals/devices/Peripheral.h -@@ -34,12 +34,13 @@ - friend class CGUIDialogPeripheralSettings; - - public: -- CPeripheral(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); -- CPeripheral(void); -+ CPeripheral(const PeripheralScanResult& scanResult); - virtual ~CPeripheral(void); - - bool operator ==(const CPeripheral &right) const; - bool operator !=(const CPeripheral &right) const; -+ bool operator ==(const PeripheralScanResult& right) const; -+ bool operator !=(const PeripheralScanResult& right) const; - - const CStdString &FileLocation(void) const { return m_strFileLocation; } - const CStdString &Location(void) const { return m_strLocation; } -@@ -158,6 +159,7 @@ - - PeripheralType m_type; - PeripheralBusType m_busType; -+ PeripheralBusType m_mappedBusType; - CStdString m_strLocation; - CStdString m_strDeviceName; - CStdString m_strSettingsFile; -diff --git a/xbmc/peripherals/devices/PeripheralBluetooth.cpp b/xbmc/peripherals/devices/PeripheralBluetooth.cpp -index a2f4e06..4785f7b 100644 ---- a/xbmc/peripherals/devices/PeripheralBluetooth.cpp -+++ b/xbmc/peripherals/devices/PeripheralBluetooth.cpp -@@ -23,8 +23,8 @@ - - using namespace PERIPHERALS; - --CPeripheralBluetooth::CPeripheralBluetooth(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : -- CPeripheral(type, busType, strLocation, strDeviceName, iVendorId, iProductId) -+CPeripheralBluetooth::CPeripheralBluetooth(const PeripheralScanResult& scanResult) : -+ CPeripheral(scanResult) - { - m_features.push_back(FEATURE_BLUETOOTH); - } -diff --git a/xbmc/peripherals/devices/PeripheralBluetooth.h b/xbmc/peripherals/devices/PeripheralBluetooth.h -index 6b79be9..a1be1ff 100644 ---- a/xbmc/peripherals/devices/PeripheralBluetooth.h -+++ b/xbmc/peripherals/devices/PeripheralBluetooth.h -@@ -26,7 +26,7 @@ - class CPeripheralBluetooth : public CPeripheral - { - public: -- CPeripheralBluetooth(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); -+ CPeripheralBluetooth(const PeripheralScanResult& scanResult); - virtual ~CPeripheralBluetooth(void) {}; - }; - } -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index e578dc3..983e1a7 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -80,14 +80,15 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface - 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), -+CPeripheralCecAdapter::CPeripheralCecAdapter(const PeripheralScanResult& scanResult) : -+ CPeripheralHID(scanResult), - CThread("CEC Adapter"), - m_dll(NULL), - m_cecAdapter(NULL) - { - ResetMembers(); - m_features.push_back(FEATURE_CEC); -+ m_strComPort = scanResult.m_strLocation; - } - - CPeripheralCecAdapter::~CPeripheralCecAdapter(void) -@@ -98,6 +99,7 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface - m_bStop = true; - } - -+ SAFE_DELETE(m_queryThread); - StopThread(true); - - if (m_dll && m_cecAdapter) -@@ -302,38 +304,6 @@ void CPeripheralCecAdapter::SetVersionInfo(const libcec_configuration &configura - } - } - --CStdString CPeripheralCecAdapter::GetComPort(void) --{ -- CStdString strPort = GetSettingString("port"); -- if (strPort.IsEmpty()) -- { -- strPort = m_strFileLocation; -- cec_adapter deviceList[10]; -- TranslateComPort(strPort); -- uint8_t iFound = m_cecAdapter->FindAdapters(deviceList, 10, strPort.c_str()); -- -- if (iFound <= 0) -- { -- CLog::Log(LOGWARNING, "%s - no CEC adapters found on %s", __FUNCTION__, strPort.c_str()); -- // display warning: couldn't set up com port -- CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(36000), g_localizeStrings.Get(36011)); -- strPort = ""; -- } -- else -- { -- cec_adapter *dev = &deviceList[0]; -- if (iFound > 1) -- CLog::Log(LOGDEBUG, "%s - multiple com ports found for device. taking the first one", __FUNCTION__); -- else -- CLog::Log(LOGDEBUG, "%s - autodetect com port '%s'", __FUNCTION__, dev->comm); -- -- strPort = dev->comm; -- } -- } -- -- return strPort; --} -- - bool CPeripheralCecAdapter::OpenConnection(void) - { - bool bIsOpen(false); -@@ -345,12 +315,8 @@ bool CPeripheralCecAdapter::OpenConnection(void) - return bIsOpen; - } - -- CStdString strPort = GetComPort(); -- if (strPort.empty()) -- return bIsOpen; -- - // open the CEC adapter -- CLog::Log(LOGDEBUG, "%s - opening a connection to the CEC adapter: %s", __FUNCTION__, strPort.c_str()); -+ CLog::Log(LOGDEBUG, "%s - opening a connection to the CEC adapter: %s", __FUNCTION__, m_strComPort.c_str()); - - // scanning the CEC bus takes about 5 seconds, so display a notification to inform users that we're busy - CStdString strMessage; -@@ -361,7 +327,7 @@ bool CPeripheralCecAdapter::OpenConnection(void) - - while (!m_bStop && !bIsOpen) - { -- if ((bIsOpen = m_cecAdapter->Open(strPort.c_str(), 10000)) == false) -+ if ((bIsOpen = m_cecAdapter->Open(m_strComPort.c_str(), 10000)) == false) - { - // display warning: couldn't initialise libCEC - CLog::Log(LOGERROR, "%s - could not opening a connection to the CEC adapter", __FUNCTION__); -@@ -430,8 +396,7 @@ void CPeripheralCecAdapter::Process(void) - Sleep(5); - } - -- delete m_queryThread; -- m_queryThread = NULL; -+ SAFE_DELETE(m_queryThread); - - bool bSendStandbyCommands(false); - { -@@ -1255,8 +1220,7 @@ int CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message me - - bool CPeripheralCecAdapter::TranslateComPort(CStdString &strLocation) - { -- if ((strLocation.Left(18).Equals("peripherals://usb/") || -- strLocation.Left(18).Equals("peripherals://rpi/")) && -+ if ((strLocation.Left(18).Equals("peripherals://cec/")) && - strLocation.Right(4).Equals(".dev")) - { - strLocation = strLocation.Right(strLocation.length() - 18); -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h -index 23cd99e..c681e60 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.h -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h -@@ -86,7 +86,7 @@ - friend class CPeripheralCecAdapterUpdateThread; - - public: -- CPeripheralCecAdapter(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); -+ CPeripheralCecAdapter(const PeripheralScanResult& scanResult); - virtual ~CPeripheralCecAdapter(void); - - void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data); -@@ -106,7 +106,6 @@ - int GetButton(void); - unsigned int GetHoldTime(void); - void ResetButton(void); -- CStdString GetComPort(void); - - void PushCecKeypress(const CEC::cec_keypress &key); - -@@ -171,6 +170,7 @@ - bool m_bActiveSourceBeforeStandby; - bool m_bOnPlayReceived; - bool m_bPlaybackPaused; -+ CStdString m_strComPort; - }; - - class CPeripheralCecAdapterUpdateThread : public CThread -diff --git a/xbmc/peripherals/devices/PeripheralDisk.cpp b/xbmc/peripherals/devices/PeripheralDisk.cpp -index 96d7fcf..b5507fc 100644 ---- a/xbmc/peripherals/devices/PeripheralDisk.cpp -+++ b/xbmc/peripherals/devices/PeripheralDisk.cpp -@@ -23,8 +23,9 @@ - - using namespace PERIPHERALS; - --CPeripheralDisk::CPeripheralDisk(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : -- CPeripheral(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35003) : strDeviceName, iVendorId, iProductId) -+CPeripheralDisk::CPeripheralDisk(const PeripheralScanResult& scanResult) : -+ CPeripheral(scanResult) - { -+ m_strDeviceName = scanResult.m_strDeviceName.IsEmpty() ? g_localizeStrings.Get(35003) : scanResult.m_strDeviceName; - m_features.push_back(FEATURE_DISK); - } -diff --git a/xbmc/peripherals/devices/PeripheralDisk.h b/xbmc/peripherals/devices/PeripheralDisk.h -index 4fab920..fc44ff6 100644 ---- a/xbmc/peripherals/devices/PeripheralDisk.h -+++ b/xbmc/peripherals/devices/PeripheralDisk.h -@@ -26,7 +26,7 @@ - class CPeripheralDisk : public CPeripheral - { - public: -- CPeripheralDisk(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); -+ CPeripheralDisk(const PeripheralScanResult& scanResult); - virtual ~CPeripheralDisk(void) {}; - }; - } -diff --git a/xbmc/peripherals/devices/PeripheralHID.cpp b/xbmc/peripherals/devices/PeripheralHID.cpp -index fe1f355..27152f1 100644 ---- a/xbmc/peripherals/devices/PeripheralHID.cpp -+++ b/xbmc/peripherals/devices/PeripheralHID.cpp -@@ -27,10 +27,11 @@ - using namespace PERIPHERALS; - using namespace std; - --CPeripheralHID::CPeripheralHID(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : -- CPeripheral(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35001) : strDeviceName, iVendorId, iProductId), -+CPeripheralHID::CPeripheralHID(const PeripheralScanResult& scanResult) : -+ CPeripheral(scanResult), - m_bInitialised(false) - { -+ m_strDeviceName = scanResult.m_strDeviceName.IsEmpty() ? g_localizeStrings.Get(35001) : scanResult.m_strDeviceName; - m_features.push_back(FEATURE_HID); - } - -diff --git a/xbmc/peripherals/devices/PeripheralHID.h b/xbmc/peripherals/devices/PeripheralHID.h -index ac60dcf..fb8bf44 100644 ---- a/xbmc/peripherals/devices/PeripheralHID.h -+++ b/xbmc/peripherals/devices/PeripheralHID.h -@@ -27,7 +27,7 @@ - class CPeripheralHID : public CPeripheral - { - public: -- CPeripheralHID(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); -+ CPeripheralHID(const PeripheralScanResult& scanResult); - virtual ~CPeripheralHID(void); - virtual bool InitialiseFeature(const PeripheralFeature feature); - virtual bool LookupSymAndUnicode(XBMC_keysym &keysym, uint8_t *key, char *unicode) { return false; } -diff --git a/xbmc/peripherals/devices/PeripheralImon.cpp b/xbmc/peripherals/devices/PeripheralImon.cpp -index 6fbbb33..b0474a1 100644 ---- a/xbmc/peripherals/devices/PeripheralImon.cpp -+++ b/xbmc/peripherals/devices/PeripheralImon.cpp -@@ -37,8 +37,8 @@ - volatile long CPeripheralImon::m_lCountOfImonsConflictWithDInput = 0; - - --CPeripheralImon::CPeripheralImon(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : -- CPeripheralHID(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35001) : strDeviceName, iVendorId, iProductId) -+CPeripheralImon::CPeripheralImon(const PeripheralScanResult& scanResult) : -+ CPeripheralHID(scanResult) - { - m_features.push_back(FEATURE_IMON); - m_bImonConflictsWithDInput = false; -diff --git a/xbmc/peripherals/devices/PeripheralImon.h b/xbmc/peripherals/devices/PeripheralImon.h -index 8444906..87905b4 100644 ---- a/xbmc/peripherals/devices/PeripheralImon.h -+++ b/xbmc/peripherals/devices/PeripheralImon.h -@@ -26,7 +26,7 @@ - class CPeripheralImon : public CPeripheralHID - { - public: -- CPeripheralImon(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); -+ CPeripheralImon(const PeripheralScanResult& scanResult); - virtual ~CPeripheralImon(void) {} - virtual bool InitialiseFeature(const PeripheralFeature feature); - virtual void OnSettingChanged(const CStdString &strChangedSetting); -diff --git a/xbmc/peripherals/devices/PeripheralNIC.cpp b/xbmc/peripherals/devices/PeripheralNIC.cpp -index 747c2f7..ee950e8 100644 ---- a/xbmc/peripherals/devices/PeripheralNIC.cpp -+++ b/xbmc/peripherals/devices/PeripheralNIC.cpp -@@ -25,8 +25,9 @@ - using namespace PERIPHERALS; - using namespace std; - --CPeripheralNIC::CPeripheralNIC(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : -- CPeripheral(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35002) : strDeviceName, iVendorId, iProductId) -+CPeripheralNIC::CPeripheralNIC(const PeripheralScanResult& scanResult) : -+ CPeripheral(scanResult) - { -+ m_strDeviceName = scanResult.m_strDeviceName.IsEmpty() ? g_localizeStrings.Get(35002) : scanResult.m_strDeviceName; - m_features.push_back(FEATURE_NIC); - } -diff --git a/xbmc/peripherals/devices/PeripheralNIC.h b/xbmc/peripherals/devices/PeripheralNIC.h -index 49abc2b..fc12302 100644 ---- a/xbmc/peripherals/devices/PeripheralNIC.h -+++ b/xbmc/peripherals/devices/PeripheralNIC.h -@@ -26,7 +26,7 @@ - class CPeripheralNIC : public CPeripheral - { - public: -- CPeripheralNIC(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); -+ CPeripheralNIC(const PeripheralScanResult& scanResult); - virtual ~CPeripheralNIC(void) {}; - }; - } -diff --git a/xbmc/peripherals/devices/PeripheralNyxboard.cpp b/xbmc/peripherals/devices/PeripheralNyxboard.cpp -index 5e3f649..df9c290 100644 ---- a/xbmc/peripherals/devices/PeripheralNyxboard.cpp -+++ b/xbmc/peripherals/devices/PeripheralNyxboard.cpp -@@ -27,8 +27,8 @@ - using namespace PERIPHERALS; - using namespace std; - --CPeripheralNyxboard::CPeripheralNyxboard(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : -- CPeripheralHID(type, busType, strLocation, strDeviceName, iVendorId, iProductId) -+CPeripheralNyxboard::CPeripheralNyxboard(const PeripheralScanResult& scanResult) : -+ CPeripheralHID(scanResult) - { - m_features.push_back(FEATURE_NYXBOARD); - } -diff --git a/xbmc/peripherals/devices/PeripheralNyxboard.h b/xbmc/peripherals/devices/PeripheralNyxboard.h -index 346d555..254c6c6 100644 ---- a/xbmc/peripherals/devices/PeripheralNyxboard.h -+++ b/xbmc/peripherals/devices/PeripheralNyxboard.h -@@ -26,7 +26,7 @@ - class CPeripheralNyxboard : public CPeripheralHID - { - public: -- CPeripheralNyxboard(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); -+ CPeripheralNyxboard(const PeripheralScanResult& scanResult); - virtual ~CPeripheralNyxboard(void) {}; - virtual bool LookupSymAndUnicode(XBMC_keysym &keysym, uint8_t *key, char *unicode); - }; -diff --git a/xbmc/peripherals/devices/PeripheralTuner.cpp b/xbmc/peripherals/devices/PeripheralTuner.cpp -index ef5630c..8937598 100644 ---- a/xbmc/peripherals/devices/PeripheralTuner.cpp -+++ b/xbmc/peripherals/devices/PeripheralTuner.cpp -@@ -23,8 +23,8 @@ - - using namespace PERIPHERALS; - --CPeripheralTuner::CPeripheralTuner(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) : -- CPeripheral(type, busType, strLocation, strDeviceName, iVendorId, iProductId) -+CPeripheralTuner::CPeripheralTuner(const PeripheralScanResult& scanResult) : -+ CPeripheral(scanResult) - { - m_features.push_back(FEATURE_TUNER); - } -diff --git a/xbmc/peripherals/devices/PeripheralTuner.h b/xbmc/peripherals/devices/PeripheralTuner.h -index b4b15f8..7130130 100644 ---- a/xbmc/peripherals/devices/PeripheralTuner.h -+++ b/xbmc/peripherals/devices/PeripheralTuner.h -@@ -26,7 +26,7 @@ - class CPeripheralTuner : public CPeripheral - { - public: -- CPeripheralTuner(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId); -+ CPeripheralTuner(const PeripheralScanResult& scanResult); - virtual ~CPeripheralTuner(void) {}; - }; - } --- -1.7.10 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.30-PR2252.patch b/packages/mediacenter/xbmc/patches/xbmc-990.30-PR2252.patch deleted file mode 100644 index b757a9fb23..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-990.30-PR2252.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 80a8ad68567f89b3f6810c07daaf42d2edddee87 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 18 Feb 2013 23:49:43 +0000 -Subject: [PATCH] [rbp] Fix for audiotoggledigital on Pi. - -Pi only has two audio output modes so the three way toggle gets stuck. This fix corresponds to Pi specific settings code: -https://github.com/xbmc/xbmc/blob/master/xbmc/settings/GUISettings.cpp#L458 ---- - xbmc/Application.cpp | 12 ++++++++---- - xbmc/settings/GUISettings.h | 1 + - 2 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index d6e663b..5e9d979 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -2863,11 +2863,15 @@ bool CApplication::OnAction(const CAction &action) - - if (action.GetID() == ACTION_TOGGLE_DIGITAL_ANALOG) - { -- switch(g_guiSettings.GetInt("audiooutput.mode")) -+ // we are only allowed to SetInt to a value supported in GUISettings, so we keep trying until it sticks -+ int mode = g_guiSettings.GetInt("audiooutput.mode"); -+ for (int i = 0; i < AUDIO_COUNT; i++) - { -- case AUDIO_ANALOG: g_guiSettings.SetInt("audiooutput.mode", AUDIO_IEC958); break; -- case AUDIO_IEC958: g_guiSettings.SetInt("audiooutput.mode", AUDIO_HDMI ); break; -- case AUDIO_HDMI : g_guiSettings.SetInt("audiooutput.mode", AUDIO_ANALOG); break; -+ if (++mode == AUDIO_COUNT) -+ mode = 0; -+ g_guiSettings.SetInt("audiooutput.mode", mode); -+ if (g_guiSettings.GetInt("audiooutput.mode") == mode) -+ break; - } - - g_application.Restart(); -diff --git a/xbmc/settings/GUISettings.h b/xbmc/settings/GUISettings.h -index b48ba35..98f9836 100644 ---- a/xbmc/settings/GUISettings.h -+++ b/xbmc/settings/GUISettings.h -@@ -84,6 +84,7 @@ - #define AUDIO_ANALOG 0 - #define AUDIO_IEC958 1 - #define AUDIO_HDMI 2 -+#define AUDIO_COUNT 3 - #define AUDIO_IS_BITSTREAM(x) ((x) == AUDIO_IEC958 || (x) == AUDIO_HDMI) - - #define VIDEO_NORMAL 0 --- -1.7.10 - diff --git a/tools/mkpkg/mkpkg_xbmc-frodo b/tools/mkpkg/mkpkg_xbmc-frodo index 2a4bd460e8..8109893465 100755 --- a/tools/mkpkg/mkpkg_xbmc-frodo +++ b/tools/mkpkg/mkpkg_xbmc-frodo @@ -20,7 +20,7 @@ ################################################################################ PKG_NAME="xbmc" -PKG_VERSION="12.0.4" +PKG_VERSION="12.0.5" GIT_REPO="-b Frodo git://github.com/xbmc/xbmc.git" DEST_DIR="$PKG_NAME-frodo"