diff options
Diffstat (limited to 'xbmc')
25 files changed, 246 insertions, 439 deletions
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp index a7fb55c..247ad52 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp @@ -11,7 +11,9 @@ #include "ServiceBroker.h" #include "cores/AudioEngine/AESinkFactory.h" #include "cores/AudioEngine/Utils/AEUtil.h" +#include "settings/AdvancedSettings.h" #include "settings/Settings.h" +#include "settings/SettingsComponent.h" #include "utils/StringUtils.h" #include "utils/TimeUtils.h" #include "utils/log.h" @@ -421,6 +423,9 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device) } } + m_superviseAudioDelay = + CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_superviseAudioDelay; + int atChannelMask = AEChannelMapToAUDIOTRACKChannelMask(m_format.m_channelLayout); m_format.m_channelLayout = AUDIOTRACKChannelMaskToAEChannelMap(atChannelMask); if (m_encoding == CJNIAudioFormat::ENCODING_IEC61937) @@ -848,7 +853,7 @@ unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t **data, unsigned int frames, const double max_stuck_delay_ms = m_audiotrackbuffer_sec_orig * 2000.0; const double stime_ms = 1000.0 * frames / m_format.m_sampleRate; - if (m_stuckCounter * stime_ms > max_stuck_delay_ms) + if (m_superviseAudioDelay && (m_stuckCounter * stime_ms > max_stuck_delay_ms)) { CLog::Log(LOGERROR, "Sink got stuck with {:f} ms - ask AE for reopening", max_stuck_delay_ms); usleep(max_stuck_delay_ms * 1000); diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h index 6e9ec76..c1d7360 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h +++ b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h @@ -96,6 +96,7 @@ private: double m_hw_delay = 0.0; CJNIAudioTimestamp m_timestamp; XbmcThreads::EndTime<> m_stampTimer; + bool m_superviseAudioDelay = false; std::vector<float> m_floatbuf; std::vector<int16_t> m_shortbuf; diff --git a/xbmc/games/controllers/CMakeLists.txt b/xbmc/games/controllers/CMakeLists.txt index b54f5c0..b00e1ca 100644 --- a/xbmc/games/controllers/CMakeLists.txt +++ b/xbmc/games/controllers/CMakeLists.txt @@ -1,9 +1,7 @@ set(SOURCES Controller.cpp ControllerLayout.cpp ControllerManager.cpp - ControllerTranslator.cpp - DefaultController.cpp -) + ControllerTranslator.cpp) set(HEADERS Controller.h ControllerDefinitions.h @@ -11,8 +9,6 @@ set(HEADERS Controller.h ControllerLayout.h ControllerManager.h ControllerTranslator.h - ControllerTypes.h - DefaultController.h -) + ControllerTypes.h) core_add_library(games_controller) diff --git a/xbmc/games/controllers/DefaultController.cpp b/xbmc/games/controllers/DefaultController.cpp deleted file mode 100644 index 58bb464..0000000 --- a/xbmc/games/controllers/DefaultController.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2024 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#include "DefaultController.h" - -using namespace KODI; -using namespace GAME; - -const char* CDefaultController::FEATURE_A = "a"; -const char* CDefaultController::FEATURE_B = "b"; -const char* CDefaultController::FEATURE_X = "x"; -const char* CDefaultController::FEATURE_Y = "y"; -const char* CDefaultController::FEATURE_START = "start"; -const char* CDefaultController::FEATURE_BACK = "back"; -const char* CDefaultController::FEATURE_GUIDE = "guide"; -const char* CDefaultController::FEATURE_UP = "up"; -const char* CDefaultController::FEATURE_RIGHT = "right"; -const char* CDefaultController::FEATURE_DOWN = "down"; -const char* CDefaultController::FEATURE_LEFT = "left"; -const char* CDefaultController::FEATURE_LEFT_THUMB = "leftthumb"; -const char* CDefaultController::FEATURE_RIGHT_THUMB = "rightthumb"; -const char* CDefaultController::FEATURE_LEFT_BUMPER = "leftbumper"; -const char* CDefaultController::FEATURE_RIGHT_BUMPER = "rightbumper"; -const char* CDefaultController::FEATURE_LEFT_TRIGGER = "lefttrigger"; -const char* CDefaultController::FEATURE_RIGHT_TRIGGER = "righttrigger"; -const char* CDefaultController::FEATURE_LEFT_STICK = "leftstick"; -const char* CDefaultController::FEATURE_RIGHT_STICK = "rightstick"; -const char* CDefaultController::FEATURE_LEFT_MOTOR = "leftmotor"; -const char* CDefaultController::FEATURE_RIGHT_MOTOR = "rightmotor"; diff --git a/xbmc/games/controllers/DefaultController.h b/xbmc/games/controllers/DefaultController.h deleted file mode 100644 index f82ce49..0000000 --- a/xbmc/games/controllers/DefaultController.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2024 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -namespace KODI -{ -namespace GAME -{ -class CDefaultController -{ -public: - // Face buttons - static const char* FEATURE_A; - static const char* FEATURE_B; - static const char* FEATURE_X; - static const char* FEATURE_Y; - static const char* FEATURE_START; - static const char* FEATURE_BACK; - static const char* FEATURE_GUIDE; - static const char* FEATURE_UP; - static const char* FEATURE_RIGHT; - static const char* FEATURE_DOWN; - static const char* FEATURE_LEFT; - static const char* FEATURE_LEFT_THUMB; - static const char* FEATURE_RIGHT_THUMB; - - // Shoulder buttons - static const char* FEATURE_LEFT_BUMPER; - static const char* FEATURE_RIGHT_BUMPER; - - // Triggers - static const char* FEATURE_LEFT_TRIGGER; - static const char* FEATURE_RIGHT_TRIGGER; - - // Analog sticks - static const char* FEATURE_LEFT_STICK; - static const char* FEATURE_RIGHT_STICK; - - // Haptics - static const char* FEATURE_LEFT_MOTOR; - static const char* FEATURE_RIGHT_MOTOR; -}; -} // namespace GAME -} // namespace KODI diff --git a/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp b/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp index c2ac2f5..ff5f8d8 100644 --- a/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp +++ b/xbmc/games/controllers/windows/GUIConfigurationWizard.cpp @@ -290,8 +290,8 @@ bool CGUIConfigurationWizard::MapPrimitive(JOYSTICK::IButtonMap* buttonMap, } else { - CLog::Log(LOGDEBUG, "{}: mapping feature \"{}\" for device {} to \"{}\"", - m_strControllerId, feature.Name(), buttonMap->Location(), primitive.ToString()); + CLog::Log(LOGDEBUG, "{}: mapping feature \"{}\" for device {}", m_strControllerId, + feature.Name(), buttonMap->Location()); switch (feature.Type()) { diff --git a/xbmc/input/joysticks/DriverPrimitive.cpp b/xbmc/input/joysticks/DriverPrimitive.cpp index 166e926..9540dfd 100644 --- a/xbmc/input/joysticks/DriverPrimitive.cpp +++ b/xbmc/input/joysticks/DriverPrimitive.cpp @@ -8,9 +8,6 @@ #include "DriverPrimitive.h" -#include "games/controllers/ControllerTranslator.h" -#include "utils/StringUtils.h" - #include <utility> using namespace KODI; @@ -202,70 +199,3 @@ bool CDriverPrimitive::IsValid(void) const return false; } - -std::string CDriverPrimitive::ToString() const -{ - switch (m_type) - { - case PRIMITIVE_TYPE::BUTTON: - return StringUtils::Format("button {}", m_driverIndex); - case PRIMITIVE_TYPE::MOTOR: - return StringUtils::Format("motor {}", m_driverIndex); - case PRIMITIVE_TYPE::MOUSE_BUTTON: - return StringUtils::Format("mouse button {}", m_driverIndex); - case PRIMITIVE_TYPE::HAT: - { - switch (m_hatDirection) - { - case HAT_DIRECTION::UP: - return StringUtils::Format("hat {} up", m_driverIndex); - case HAT_DIRECTION::DOWN: - return StringUtils::Format("hat {} down", m_driverIndex); - case HAT_DIRECTION::RIGHT: - return StringUtils::Format("hat {} right", m_driverIndex); - case HAT_DIRECTION::LEFT: - return StringUtils::Format("hat {} left", m_driverIndex); - default: - break; - } - break; - } - case PRIMITIVE_TYPE::SEMIAXIS: - { - switch (m_semiAxisDirection) - { - case SEMIAXIS_DIRECTION::POSITIVE: - return StringUtils::Format("semiaxis +{}", m_driverIndex); - case SEMIAXIS_DIRECTION::NEGATIVE: - return StringUtils::Format("semiaxis -{}", m_driverIndex); - default: - break; - } - break; - } - case PRIMITIVE_TYPE::KEY: - return StringUtils::Format("key {}", - GAME::CControllerTranslator::TranslateKeycode(m_keycode)); - case PRIMITIVE_TYPE::RELATIVE_POINTER: - { - switch (m_pointerDirection) - { - case RELATIVE_POINTER_DIRECTION::UP: - return StringUtils::Format("pointer {} up", m_driverIndex); - case RELATIVE_POINTER_DIRECTION::DOWN: - return StringUtils::Format("pointer {} down", m_driverIndex); - case RELATIVE_POINTER_DIRECTION::RIGHT: - return StringUtils::Format("pointer {} right", m_driverIndex); - case RELATIVE_POINTER_DIRECTION::LEFT: - return StringUtils::Format("pointer {} left", m_driverIndex); - default: - break; - } - break; - } - default: - break; - } - - return ""; -} diff --git a/xbmc/input/joysticks/DriverPrimitive.h b/xbmc/input/joysticks/DriverPrimitive.h index 11d391b..abe3724 100644 --- a/xbmc/input/joysticks/DriverPrimitive.h +++ b/xbmc/input/joysticks/DriverPrimitive.h @@ -179,13 +179,6 @@ public: */ bool IsValid(void) const; - /*! - * \brief Convert primitive to a string suitable for logging - * - * \return The primitive as described by a short string, or empty if invalid - */ - std::string ToString() const; - private: PRIMITIVE_TYPE m_type = PRIMITIVE_TYPE::UNKNOWN; unsigned int m_driverIndex = 0; diff --git a/xbmc/input/joysticks/JoystickEasterEgg.cpp b/xbmc/input/joysticks/JoystickEasterEgg.cpp index b0259a6..0c63e66 100644 --- a/xbmc/input/joysticks/JoystickEasterEgg.cpp +++ b/xbmc/input/joysticks/JoystickEasterEgg.cpp @@ -12,7 +12,6 @@ #include "games/GameServices.h" #include "games/GameSettings.h" #include "games/controllers/ControllerIDs.h" -#include "games/controllers/DefaultController.h" #include "guilib/GUIAudioManager.h" #include "guilib/WindowIDs.h" @@ -23,16 +22,16 @@ const std::map<std::string, std::vector<FeatureName>> CJoystickEasterEgg::m_sequ { DEFAULT_CONTROLLER_ID, { - GAME::CDefaultController::FEATURE_UP, - GAME::CDefaultController::FEATURE_UP, - GAME::CDefaultController::FEATURE_DOWN, - GAME::CDefaultController::FEATURE_DOWN, - GAME::CDefaultController::FEATURE_LEFT, - GAME::CDefaultController::FEATURE_RIGHT, - GAME::CDefaultController::FEATURE_LEFT, - GAME::CDefaultController::FEATURE_RIGHT, - GAME::CDefaultController::FEATURE_B, - GAME::CDefaultController::FEATURE_A, + "up", + "up", + "down", + "down", + "left", + "right", + "left", + "right", + "b", + "a", }, }, { diff --git a/xbmc/input/joysticks/generic/ButtonMapping.cpp b/xbmc/input/joysticks/generic/ButtonMapping.cpp index 665a233..af6bf86 100644 --- a/xbmc/input/joysticks/generic/ButtonMapping.cpp +++ b/xbmc/input/joysticks/generic/ButtonMapping.cpp @@ -454,34 +454,31 @@ bool CButtonMapping::MapPrimitive(const CDriverPrimitive& primitive) { bool bHandled = false; - if (m_buttonMap->IsIgnored(primitive)) + auto now = std::chrono::steady_clock::now(); + + bool bTimeoutElapsed = true; + + if (m_buttonMapper->NeedsCooldown()) + bTimeoutElapsed = (now >= m_lastAction + std::chrono::milliseconds(MAPPING_COOLDOWN_MS)); + + if (bTimeoutElapsed) + { + bHandled = m_buttonMapper->MapPrimitive(m_buttonMap, m_keymap, primitive); + + if (bHandled) + m_lastAction = std::chrono::steady_clock::now(); + } + else if (m_buttonMap->IsIgnored(primitive)) { bHandled = true; } else { - auto now = std::chrono::steady_clock::now(); - - bool bTimeoutElapsed = true; - - if (m_buttonMapper->NeedsCooldown()) - bTimeoutElapsed = (now >= m_lastAction + std::chrono::milliseconds(MAPPING_COOLDOWN_MS)); + auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_lastAction); - if (bTimeoutElapsed) - { - bHandled = m_buttonMapper->MapPrimitive(m_buttonMap, m_keymap, primitive); - - if (bHandled) - m_lastAction = std::chrono::steady_clock::now(); - } - else - { - auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_lastAction); - - CLog::Log(LOGDEBUG, "Button mapping: rapid input after {}ms dropped for profile \"{}\"", - duration.count(), m_buttonMapper->ControllerID()); - bHandled = true; - } + CLog::Log(LOGDEBUG, "Button mapping: rapid input after {}ms dropped for profile \"{}\"", + duration.count(), m_buttonMapper->ControllerID()); + bHandled = true; } return bHandled; diff --git a/xbmc/music/tags/TagLibVFSStream.cpp b/xbmc/music/tags/TagLibVFSStream.cpp index 1d2b454..c5f9c24 100644 --- a/xbmc/music/tags/TagLibVFSStream.cpp +++ b/xbmc/music/tags/TagLibVFSStream.cpp @@ -11,6 +11,7 @@ #include <limits.h> +#include <taglib/taglib.h> #include <taglib/tiostream.h> using namespace XFILE; @@ -57,9 +58,17 @@ FileName TagLibVFSStream::name() const /*! * Reads a block of size \a length at the current get pointer. */ +#if (TAGLIB_MAJOR_VERSION >= 2) +ByteVector TagLibVFSStream::readBlock(unsigned long length) +#else ByteVector TagLibVFSStream::readBlock(TagLib::ulong length) +#endif { +#if (TAGLIB_MAJOR_VERSION >= 2) + ByteVector byteVector(static_cast<unsigned int>(length)); +#else ByteVector byteVector(static_cast<TagLib::uint>(length)); +#endif ssize_t read = m_file.Read(byteVector.data(), length); if (read > 0) byteVector.resize(read); @@ -90,7 +99,11 @@ void TagLibVFSStream::writeBlock(const ByteVector &data) * \note This method is slow since it requires rewriting all of the file * after the insertion point. */ +#if (TAGLIB_MAJOR_VERSION >= 2) +void TagLibVFSStream::insert(const ByteVector& data, TagLib::offset_t start, size_t replace) +#else void TagLibVFSStream::insert(const ByteVector &data, TagLib::ulong start, TagLib::ulong replace) +#endif { if (data.size() == replace) { @@ -114,7 +127,11 @@ void TagLibVFSStream::insert(const ByteVector &data, TagLib::ulong start, TagLib // First, make sure that we're working with a buffer that is longer than // the *difference* in the tag sizes. We want to avoid overwriting parts // that aren't yet in memory, so this is necessary. +#if (TAGLIB_MAJOR_VERSION >= 2) + unsigned long bufferLength = bufferSize(); +#else TagLib::ulong bufferLength = bufferSize(); +#endif while (data.size() - replace > bufferLength) bufferLength += bufferSize(); @@ -123,7 +140,11 @@ void TagLibVFSStream::insert(const ByteVector &data, TagLib::ulong start, TagLib long readPosition = start + replace; long writePosition = start; ByteVector buffer; +#if (TAGLIB_MAJOR_VERSION >= 2) + ByteVector aboutToOverwrite(static_cast<unsigned int>(bufferLength)); +#else ByteVector aboutToOverwrite(static_cast<TagLib::uint>(bufferLength)); +#endif // This is basically a special case of the loop below. Here we're just // doing the same steps as below, but since we aren't using the same buffer @@ -158,7 +179,11 @@ void TagLibVFSStream::insert(const ByteVector &data, TagLib::ulong start, TagLib // Check to see if we just read the last block. We need to call clear() // if we did so that the last write succeeds. +#if (TAGLIB_MAJOR_VERSION >= 2) + if (static_cast<unsigned long>(bytesRead) < bufferLength) +#else if (TagLib::ulong(bytesRead) < bufferLength) +#endif clear(); // Seek to the write position and write our buffer. Increment the @@ -180,16 +205,32 @@ void TagLibVFSStream::insert(const ByteVector &data, TagLib::ulong start, TagLib * \note This method is slow since it involves rewriting all of the file * after the removed portion. */ +#if (TAGLIB_MAJOR_VERSION >= 2) +void TagLibVFSStream::removeBlock(TagLib::offset_t start, size_t length) +#else void TagLibVFSStream::removeBlock(TagLib::ulong start, TagLib::ulong length) +#endif { +#if (TAGLIB_MAJOR_VERSION >= 2) + unsigned long bufferLength = bufferSize(); +#else TagLib::ulong bufferLength = bufferSize(); +#endif long readPosition = start + length; long writePosition = start; +#if (TAGLIB_MAJOR_VERSION >= 2) + ByteVector buffer(static_cast<unsigned int>(bufferLength)); +#else ByteVector buffer(static_cast<TagLib::uint>(bufferLength)); +#endif +#if (TAGLIB_MAJOR_VERSION >= 2) + unsigned long bytesRead = 1; +#else TagLib::ulong bytesRead = 1; +#endif while(bytesRead != 0) { @@ -198,7 +239,11 @@ void TagLibVFSStream::removeBlock(TagLib::ulong start, TagLib::ulong length) if (read < 0) return;// explicit error +#if (TAGLIB_MAJOR_VERSION >= 2) + bytesRead = static_cast<unsigned long>(read); +#else bytesRead = static_cast<TagLib::ulong>(read); +#endif readPosition += bytesRead; // Check to see if we just read the last block. We need to call clear() diff --git a/xbmc/music/tags/TagLibVFSStream.h b/xbmc/music/tags/TagLibVFSStream.h index d567055..2302c04 100644 --- a/xbmc/music/tags/TagLibVFSStream.h +++ b/xbmc/music/tags/TagLibVFSStream.h @@ -10,6 +10,7 @@ #include "filesystem/File.h" +#include <taglib/taglib.h> #include <taglib/tiostream.h> namespace MUSIC_INFO @@ -36,7 +37,11 @@ namespace MUSIC_INFO /*! * Reads a block of size \a length at the current get pointer. */ +#if (TAGLIB_MAJOR_VERSION >= 2) + TagLib::ByteVector readBlock(unsigned long length) override; +#else TagLib::ByteVector readBlock(TagLib::ulong length) override; +#endif /*! * Attempts to write the block \a data at the current get pointer. If the @@ -56,7 +61,13 @@ namespace MUSIC_INFO * \note This method is slow since it requires rewriting all of the file * after the insertion point. */ +#if (TAGLIB_MAJOR_VERSION >= 2) + void insert(const TagLib::ByteVector& data, + TagLib::offset_t start = 0, + size_t replace = 0) override; +#else void insert(const TagLib::ByteVector &data, TagLib::ulong start = 0, TagLib::ulong replace = 0) override; +#endif /*! * Removes a block of the file starting a \a start and continuing for @@ -65,7 +76,11 @@ namespace MUSIC_INFO * \note This method is slow since it involves rewriting all of the file * after the removed portion. */ +#if (TAGLIB_MAJOR_VERSION >= 2) + void removeBlock(TagLib::offset_t start = 0, size_t length = 0) override; +#else void removeBlock(TagLib::ulong start = 0, TagLib::ulong length = 0) override; +#endif /*! * Returns true if the file is read only (or if the file can not be opened). @@ -110,7 +125,11 @@ namespace MUSIC_INFO /*! * Returns the buffer size that is used for internal buffering. */ +#if (TAGLIB_MAJOR_VERSION >= 2) + static unsigned int bufferSize() { return 1024; } +#else static TagLib::uint bufferSize() { return 1024; } +#endif private: std::string m_strFileName; diff --git a/xbmc/music/tags/TagLoaderTagLib.cpp b/xbmc/music/tags/TagLoaderTagLib.cpp index 6eb591a..f4f6760 100644 --- a/xbmc/music/tags/TagLoaderTagLib.cpp +++ b/xbmc/music/tags/TagLoaderTagLib.cpp @@ -472,7 +472,11 @@ bool CTagLoaderTagLib::ParseTag(ID3v2::Tag *id3v2, EmbeddedArt *art, MUSIC_INFO: if (picture) { std::string mime = picture->mimeType().to8Bit(true); +#if (TAGLIB_MAJOR_VERSION >= 2) + unsigned int size = picture->picture().size(); +#else TagLib::uint size = picture->picture().size(); +#endif tag.SetCoverArtInfo(size, mime); if (art) art->Set(reinterpret_cast<const uint8_t*>(picture->picture().data()), size, mime); @@ -500,19 +504,19 @@ bool CTagLoaderTagLib::ParseTag(APE::Tag *ape, EmbeddedArt *art, CMusicInfoTag& for (APE::ItemListMap::ConstIterator it = itemListMap.begin(); it != itemListMap.end(); ++it) { if (it->first == "ARTIST") - SetArtist(tag, StringListToVectorString(it->second.toStringList())); + SetArtist(tag, StringListToVectorString(it->second.values())); else if (it->first == "ARTISTSORT") - SetArtistSort(tag, StringListToVectorString(it->second.toStringList())); + SetArtistSort(tag, StringListToVectorString(it->second.values())); else if (it->first == "ARTISTS") - SetArtistHints(tag, StringListToVectorString(it->second.toStringList())); + SetArtistHints(tag, StringListToVectorString(it->second.values())); else if (it->first == "ALBUMARTIST" || it->first == "ALBUM ARTIST") - SetAlbumArtist(tag, StringListToVectorString(it->second.toStringList())); + SetAlbumArtist(tag, StringListToVectorString(it->second.values())); else if (it->first == "ALBUMARTISTSORT") - SetAlbumArtistSort(tag, StringListToVectorString(it->second.toStringList())); + SetAlbumArtistSort(tag, StringListToVectorString(it->second.values())); else if (it->first == "ALBUMARTISTS" || it->first == "ALBUM ARTISTS") - SetAlbumArtistHints(tag, StringListToVectorString(it->second.toStringList())); + SetAlbumArtistHints(tag, StringListToVectorString(it->second.values())); else if (it->first == "COMPOSERSORT") - SetComposerSort(tag, StringListToVectorString(it->second.toStringList())); + SetComposerSort(tag, StringListToVectorString(it->second.values())); else if (it->first == "ALBUM") tag.SetAlbum(it->second.toString().to8Bit(true)); else if (it->first == "TITLE") @@ -528,7 +532,7 @@ bool CTagLoaderTagLib::ParseTag(APE::Tag *ape, EmbeddedArt *art, CMusicInfoTag& else if (it->first == "ORIGINALYEAR") tag.SetOriginalDate(it->second.toString().to8Bit(true)); else if (it->first == "GENRE") - SetGenre(tag, StringListToVectorString(it->second.toStringList())); + SetGenre(tag, StringListToVectorString(it->second.values())); else if (it->first == "MOOD") tag.SetMood(it->second.toString().to8Bit(true)); else if (it->first == "COMMENT") @@ -538,32 +542,32 @@ bool CTagLoaderTagLib::ParseTag(APE::Tag *ape, EmbeddedArt *art, CMusicInfoTag& else if (it->first == "ENCODEDBY") {} else if (it->first == "COMPOSER") - AddArtistRole(tag, "Composer", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Composer", StringListToVectorString(it->second.values())); else if (it->first == "CONDUCTOR") - AddArtistRole(tag, "Conductor", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Conductor", StringListToVectorString(it->second.values())); else if (it->first == "BAND") - AddArtistRole(tag, "Band", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Band", StringListToVectorString(it->second.values())); else if (it->first == "ENSEMBLE") - AddArtistRole(tag, "Ensemble", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Ensemble", StringListToVectorString(it->second.values())); else if (it->first == "LYRICIST") - AddArtistRole(tag, "Lyricist", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Lyricist", StringListToVectorString(it->second.values())); else if (it->first == "WRITER") - AddArtistRole(tag, "Writer", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Writer", StringListToVectorString(it->second.values())); else if ((it->first == "MIXARTIST") || (it->first == "REMIXER")) - AddArtistRole(tag, "Remixer", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Remixer", StringListToVectorString(it->second.values())); else if (it->first == "ARRANGER") - AddArtistRole(tag, "Arranger", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Arranger", StringListToVectorString(it->second.values())); else if (it->first == "ENGINEER") - AddArtistRole(tag, "Engineer", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Engineer", StringListToVectorString(it->second.values())); else if (it->first == "PRODUCER") - AddArtistRole(tag, "Producer", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Producer", StringListToVectorString(it->second.values())); else if (it->first == "DJMIXER") - AddArtistRole(tag, "DJMixer", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "DJMixer", StringListToVectorString(it->second.values())); else if (it->first == "MIXER") - AddArtistRole(tag, "Mixer", StringListToVectorString(it->second.toStringList())); + AddArtistRole(tag, "Mixer", StringListToVectorString(it->second.values())); else if (it->first == "PERFORMER") // Picard uses PERFORMER tag as musician credits list formatted "name (instrument)" - AddArtistInstrument(tag, StringListToVectorString(it->second.toStringList())); + AddArtistInstrument(tag, StringListToVectorString(it->second.values())); else if (it->first == "LABEL") tag.SetRecordLabel(it->second.toString().to8Bit(true)); else if (it->first == "COMPILATION") @@ -579,11 +583,11 @@ bool CTagLoaderTagLib::ParseTag(APE::Tag *ape, EmbeddedArt *art, CMusicInfoTag& else if (it->first == "REPLAYGAIN_ALBUM_PEAK") replayGainInfo.ParsePeak(ReplayGain::ALBUM, it->second.toString().toCString(true)); else if (it->first == "MUSICBRAINZ_ARTISTID") - tag.SetMusicBrainzArtistID(SplitMBID(StringListToVectorString(it->second.toStringList()))); + tag.SetMusicBrainzArtistID(SplitMBID(StringListToVectorString(it->second.values()))); else if (it->first == "MUSICBRAINZ_ALBUMARTISTID") - tag.SetMusicBrainzAlbumArtistID(SplitMBID(StringListToVectorString(it->second.toStringList()))); + tag.SetMusicBrainzAlbumArtistID(SplitMBID(StringListToVectorString(it->second.values()))); else if (it->first == "MUSICBRAINZ_ALBUMARTIST") - SetAlbumArtist(tag, StringListToVectorString(it->second.toStringList())); + SetAlbumArtist(tag, StringListToVectorString(it->second.values())); else if (it->first == "MUSICBRAINZ_ALBUMID") tag.SetMusicBrainzAlbumID(it->second.toString().to8Bit(true)); else if (it->first == "MUSICBRAINZ_RELEASEGROUPID") @@ -591,7 +595,7 @@ bool CTagLoaderTagLib::ParseTag(APE::Tag *ape, EmbeddedArt *art, CMusicInfoTag& else if (it->first == "MUSICBRAINZ_TRACKID") tag.SetMusicBrainzTrackID(it->second.toString().to8Bit(true)); else if (it->first == "MUSICBRAINZ_ALBUMTYPE") - SetReleaseType(tag, StringListToVectorString(it->second.toStringList())); + SetReleaseType(tag, StringListToVectorString(it->second.values())); else if (it->first == "BPM") tag.SetBPM(it->second.toString().toInt()); else if (it->first == "MUSICBRAINZ_ALBUMSTATUS") @@ -789,7 +793,11 @@ bool CTagLoaderTagLib::ParseTag(Ogg::XiphComment *xiph, EmbeddedArt *art, CMusic std::string mime = pictures[i].mimeType().toCString(); if (mime.compare(0, 6, "image/") != 0) continue; +#if (TAGLIB_MAJOR_VERSION >= 2) + unsigned int size = pictures[i].data().size(); +#else TagLib::uint size = pictures[i].data().size(); +#endif tag.SetCoverArtInfo(size, mime); if (art) art->Set(reinterpret_cast<const uint8_t*>(pictures[i].data().data()), size, mime); diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp index c178158..3dc5ca6 100644 --- a/xbmc/peripherals/Peripherals.cpp +++ b/xbmc/peripherals/Peripherals.cpp @@ -915,7 +915,7 @@ void CPeripherals::ResetButtonMaps(const std::string& controllerId) PeripheralAddonPtr addon; if (addonBus->GetAddonWithButtonMap(peripheral.get(), addon)) { - CAddonButtonMap buttonMap(peripheral.get(), addon, controllerId, *this); + CAddonButtonMap buttonMap(peripheral.get(), addon, controllerId); buttonMap.Reset(); } } diff --git a/xbmc/peripherals/addons/AddonButtonMap.cpp b/xbmc/peripherals/addons/AddonButtonMap.cpp index 0d76ec9..f2c894c 100644 --- a/xbmc/peripherals/addons/AddonButtonMap.cpp +++ b/xbmc/peripherals/addons/AddonButtonMap.cpp @@ -10,7 +10,6 @@ #include "PeripheralAddonTranslator.h" #include "input/joysticks/JoystickUtils.h" -#include "peripherals/Peripherals.h" #include "peripherals/devices/Peripheral.h" #include "utils/log.h" @@ -25,9 +24,8 @@ using namespace PERIPHERALS; CAddonButtonMap::CAddonButtonMap(CPeripheral* device, const std::weak_ptr<CPeripheralAddon>& addon, - const std::string& strControllerId, - CPeripherals& manager) - : m_device(device), m_addon(addon), m_strControllerId(strControllerId), m_manager(manager) + const std::string& strControllerId) + : m_device(device), m_addon(addon), m_strControllerId(strControllerId) { auto peripheralAddon = m_addon.lock(); assert(peripheralAddon != nullptr); @@ -60,28 +58,6 @@ bool CAddonButtonMap::Load(void) bSuccess |= addon->GetIgnoredPrimitives(m_device, ignoredPrimitives); } - if (features.empty()) - { - // Check if we can initialize a buttonmap from the peripheral bus - PeripheralBusPtr peripheralBus = m_manager.GetBusByType(m_device->GetBusType()); - if (peripheralBus) - { - CLog::Log(LOGDEBUG, - "Buttonmap not found for {}, attempting to initialize from peripheral bus", - m_device->Location()); - if (peripheralBus->InitializeButtonMap(*m_device, *this)) - { - bSuccess = true; - - if (auto addon = m_addon.lock()) - { - addon->GetFeatures(m_device, m_strControllerId, features); - addon->GetIgnoredPrimitives(m_device, ignoredPrimitives); - } - } - } - } - // GetFeatures() was changed to always return false if no features were // retrieved. Check here, just in case its contract is changed or violated in // the future. diff --git a/xbmc/peripherals/addons/AddonButtonMap.h b/xbmc/peripherals/addons/AddonButtonMap.h index cade54b..b6a629f 100644 --- a/xbmc/peripherals/addons/AddonButtonMap.h +++ b/xbmc/peripherals/addons/AddonButtonMap.h @@ -18,15 +18,13 @@ namespace PERIPHERALS { class CPeripheral; -class CPeripherals; class CAddonButtonMap : public KODI::JOYSTICK::IButtonMap { public: CAddonButtonMap(CPeripheral* device, const std::weak_ptr<CPeripheralAddon>& addon, - const std::string& strControllerId, - CPeripherals& manager); + const std::string& strControllerId); ~CAddonButtonMap(void) override; @@ -132,7 +130,6 @@ private: CPeripheral* const m_device; const std::weak_ptr<CPeripheralAddon> m_addon; const std::string m_strControllerId; - CPeripherals& m_manager; // Button map state std::string m_controllerAppearance; diff --git a/xbmc/peripherals/addons/AddonButtonMapping.cpp b/xbmc/peripherals/addons/AddonButtonMapping.cpp index abf981f..af838aa 100644 --- a/xbmc/peripherals/addons/AddonButtonMapping.cpp +++ b/xbmc/peripherals/addons/AddonButtonMapping.cpp @@ -31,7 +31,7 @@ CAddonButtonMapping::CAddonButtonMapping(CPeripherals& manager, else { const std::string controllerId = mapper->ControllerID(); - m_buttonMap = std::make_unique<CAddonButtonMap>(peripheral, addon, controllerId, manager); + m_buttonMap.reset(new CAddonButtonMap(peripheral, addon, controllerId)); if (m_buttonMap->Load()) { IKeymap* keymap = peripheral->GetKeymap(controllerId); diff --git a/xbmc/peripherals/addons/AddonInputHandling.cpp b/xbmc/peripherals/addons/AddonInputHandling.cpp index 7490b96..644c33e 100644 --- a/xbmc/peripherals/addons/AddonInputHandling.cpp +++ b/xbmc/peripherals/addons/AddonInputHandling.cpp @@ -16,8 +16,8 @@ #include "input/keyboard/interfaces/IKeyboardInputHandler.h" #include "input/mouse/generic/MouseInputHandling.h" #include "input/mouse/interfaces/IMouseInputHandler.h" +#include "peripherals/Peripherals.h" #include "peripherals/addons/AddonButtonMap.h" -#include "peripherals/devices/Peripheral.h" #include "utils/log.h" using namespace KODI; @@ -26,106 +26,105 @@ using namespace PERIPHERALS; CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, CPeripheral* peripheral, - std::shared_ptr<CPeripheralAddon> addon, IInputHandler* handler, IDriverReceiver* receiver) - : m_manager(manager), - m_peripheral(peripheral), - m_addon(std::move(addon)), - m_joystickInputHandler(handler), - m_joystickDriverReceiver(receiver) { + PeripheralAddonPtr addon = manager.GetAddonWithButtonMap(peripheral); + + if (!addon) + { + CLog::Log(LOGDEBUG, "Failed to locate add-on for \"{}\"", peripheral->DeviceName()); + } + else + { + m_buttonMap.reset(new CAddonButtonMap(peripheral, addon, handler->ControllerID())); + if (m_buttonMap->Load()) + { + m_driverHandler.reset(new CInputHandling(handler, m_buttonMap.get())); + + if (receiver) + { + m_inputReceiver.reset(new CDriverReceiving(receiver, m_buttonMap.get())); + + // Interfaces are connected here because they share button map as a common resource + handler->SetInputReceiver(m_inputReceiver.get()); + } + } + else + { + m_buttonMap.reset(); + } + } } CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, CPeripheral* peripheral, - std::shared_ptr<CPeripheralAddon> addon, KEYBOARD::IKeyboardInputHandler* handler) - : m_manager(manager), - m_peripheral(peripheral), - m_addon(std::move(addon)), - m_keyboardInputHandler(handler) { + PeripheralAddonPtr addon = manager.GetAddonWithButtonMap(peripheral); + + if (!addon) + { + CLog::Log(LOGDEBUG, "Failed to locate add-on for \"{}\"", peripheral->DeviceName()); + } + else + { + m_buttonMap.reset(new CAddonButtonMap(peripheral, addon, handler->ControllerID())); + if (m_buttonMap->Load()) + { + m_keyboardHandler.reset(new KEYBOARD::CKeyboardInputHandling(handler, m_buttonMap.get())); + } + else + { + m_buttonMap.reset(); + } + } } CAddonInputHandling::CAddonInputHandling(CPeripherals& manager, CPeripheral* peripheral, - std::shared_ptr<CPeripheralAddon> addon, MOUSE::IMouseInputHandler* handler) - : m_manager(manager), - m_peripheral(peripheral), - m_addon(std::move(addon)), - m_mouseInputHandler(handler) { -} + PeripheralAddonPtr addon = manager.GetAddonWithButtonMap(peripheral); -CAddonInputHandling::~CAddonInputHandling(void) -{ - m_joystickDriverHandler.reset(); - m_joystickInputReceiver.reset(); - m_keyboardDriverHandler.reset(); - m_mouseDriverHandler.reset(); - m_buttonMap.reset(); -} - -bool CAddonInputHandling::Load() -{ - std::string controllerId; - if (m_joystickInputHandler != nullptr) - controllerId = m_joystickInputHandler->ControllerID(); - else if (m_keyboardInputHandler != nullptr) - controllerId = m_keyboardInputHandler->ControllerID(); - else if (m_mouseInputHandler != nullptr) - controllerId = m_mouseInputHandler->ControllerID(); - - if (!controllerId.empty()) - m_buttonMap = std::make_unique<CAddonButtonMap>(m_peripheral, m_addon, controllerId, m_manager); - - if (m_buttonMap && m_buttonMap->Load()) + if (!addon) { - if (m_joystickInputHandler != nullptr) - { - m_joystickDriverHandler = - std::make_unique<CInputHandling>(m_joystickInputHandler, m_buttonMap.get()); - if (m_joystickDriverReceiver != nullptr) - { - m_joystickInputReceiver = - std::make_unique<CDriverReceiving>(m_joystickDriverReceiver, m_buttonMap.get()); - - // Interfaces are connected here because they share button map as a common resource - m_joystickInputHandler->SetInputReceiver(m_joystickInputReceiver.get()); - } - return true; - } - else if (m_keyboardInputHandler != nullptr) + CLog::Log(LOGDEBUG, "Failed to locate add-on for \"{}\"", peripheral->DeviceName()); + } + else + { + m_buttonMap.reset(new CAddonButtonMap(peripheral, addon, handler->ControllerID())); + if (m_buttonMap->Load()) { - m_keyboardDriverHandler = std::make_unique<KEYBOARD::CKeyboardInputHandling>( - m_keyboardInputHandler, m_buttonMap.get()); - return true; + m_mouseHandler.reset(new MOUSE::CMouseInputHandling(handler, m_buttonMap.get())); } - else if (m_mouseInputHandler != nullptr) + else { - m_mouseDriverHandler = - std::make_unique<MOUSE::CMouseInputHandling>(m_mouseInputHandler, m_buttonMap.get()); - return true; + m_buttonMap.reset(); } } +} - return false; +CAddonInputHandling::~CAddonInputHandling(void) +{ + m_driverHandler.reset(); + m_inputReceiver.reset(); + m_keyboardHandler.reset(); + m_buttonMap.reset(); } bool CAddonInputHandling::OnButtonMotion(unsigned int buttonIndex, bool bPressed) { - if (m_joystickDriverHandler) - return m_joystickDriverHandler->OnButtonMotion(buttonIndex, bPressed); + if (m_driverHandler) + return m_driverHandler->OnButtonMotion(buttonIndex, bPressed); return false; } bool CAddonInputHandling::OnHatMotion(unsigned int hatIndex, HAT_STATE state) { - if (m_joystickDriverHandler) - return m_joystickDriverHandler->OnHatMotion(hatIndex, state); + if (m_driverHandler) + return m_driverHandler->OnHatMotion(hatIndex, state); return false; } @@ -135,58 +134,58 @@ bool CAddonInputHandling::OnAxisMotion(unsigned int axisIndex, int center, unsigned int range) { - if (m_joystickDriverHandler) - return m_joystickDriverHandler->OnAxisMotion(axisIndex, position, center, range); + if (m_driverHandler) + return m_driverHandler->OnAxisMotion(axisIndex, position, center, range); return false; } void CAddonInputHandling::OnInputFrame(void) { - if (m_joystickDriverHandler) - m_joystickDriverHandler->OnInputFrame(); + if (m_driverHandler) + m_driverHandler->OnInputFrame(); } bool CAddonInputHandling::OnKeyPress(const CKey& key) { - if (m_keyboardDriverHandler) - return m_keyboardDriverHandler->OnKeyPress(key); + if (m_keyboardHandler) + return m_keyboardHandler->OnKeyPress(key); return false; } void CAddonInputHandling::OnKeyRelease(const CKey& key) { - if (m_keyboardDriverHandler) - m_keyboardDriverHandler->OnKeyRelease(key); + if (m_keyboardHandler) + m_keyboardHandler->OnKeyRelease(key); } bool CAddonInputHandling::OnPosition(int x, int y) { - if (m_mouseDriverHandler) - return m_mouseDriverHandler->OnPosition(x, y); + if (m_mouseHandler) + return m_mouseHandler->OnPosition(x, y); return false; } bool CAddonInputHandling::OnButtonPress(MOUSE::BUTTON_ID button) { - if (m_mouseDriverHandler) - return m_mouseDriverHandler->OnButtonPress(button); + if (m_mouseHandler) + return m_mouseHandler->OnButtonPress(button); return false; } void CAddonInputHandling::OnButtonRelease(MOUSE::BUTTON_ID button) { - if (m_mouseDriverHandler) - m_mouseDriverHandler->OnButtonRelease(button); + if (m_mouseHandler) + m_mouseHandler->OnButtonRelease(button); } bool CAddonInputHandling::SetRumbleState(const JOYSTICK::FeatureName& feature, float magnitude) { - if (m_joystickInputReceiver) - return m_joystickInputReceiver->SetRumbleState(feature, magnitude); + if (m_inputReceiver) + return m_inputReceiver->SetRumbleState(feature, magnitude); return false; } diff --git a/xbmc/peripherals/addons/AddonInputHandling.h b/xbmc/peripherals/addons/AddonInputHandling.h index 295e6d4..2a59162 100644 --- a/xbmc/peripherals/addons/AddonInputHandling.h +++ b/xbmc/peripherals/addons/AddonInputHandling.h @@ -39,7 +39,6 @@ namespace PERIPHERALS { class CPeripheral; class CPeripherals; -class CPeripheralAddon; class CAddonInputHandling : public KODI::JOYSTICK::IDriverHandler, public KODI::JOYSTICK::IInputReceiver, @@ -49,24 +48,19 @@ class CAddonInputHandling : public KODI::JOYSTICK::IDriverHandler, public: CAddonInputHandling(CPeripherals& manager, CPeripheral* peripheral, - std::shared_ptr<CPeripheralAddon> addon, KODI::JOYSTICK::IInputHandler* handler, KODI::JOYSTICK::IDriverReceiver* receiver); CAddonInputHandling(CPeripherals& manager, CPeripheral* peripheral, - std::shared_ptr<CPeripheralAddon> addon, KODI::KEYBOARD::IKeyboardInputHandler* handler); CAddonInputHandling(CPeripherals& manager, CPeripheral* peripheral, - std::shared_ptr<CPeripheralAddon> addon, KODI::MOUSE::IMouseInputHandler* handler); ~CAddonInputHandling(void) override; - bool Load(); - // implementation of IDriverHandler bool OnButtonMotion(unsigned int buttonIndex, bool bPressed) override; bool OnHatMotion(unsigned int hatIndex, KODI::JOYSTICK::HAT_STATE state) override; @@ -89,20 +83,10 @@ public: bool SetRumbleState(const KODI::JOYSTICK::FeatureName& feature, float magnitude) override; private: - // Construction parameters - CPeripherals& m_manager; - CPeripheral* const m_peripheral; - const std::shared_ptr<CPeripheralAddon> m_addon; - KODI::JOYSTICK::IInputHandler* const m_joystickInputHandler{nullptr}; - KODI::JOYSTICK::IDriverReceiver* const m_joystickDriverReceiver{nullptr}; - KODI::KEYBOARD::IKeyboardInputHandler* m_keyboardInputHandler{nullptr}; - KODI::MOUSE::IMouseInputHandler* const m_mouseInputHandler{nullptr}; - - // Input parameters - std::unique_ptr<KODI::JOYSTICK::IDriverHandler> m_joystickDriverHandler; - std::unique_ptr<KODI::JOYSTICK::IInputReceiver> m_joystickInputReceiver; - std::unique_ptr<KODI::KEYBOARD::IKeyboardDriverHandler> m_keyboardDriverHandler; - std::unique_ptr<KODI::MOUSE::IMouseDriverHandler> m_mouseDriverHandler; + std::unique_ptr<KODI::JOYSTICK::IDriverHandler> m_driverHandler; + std::unique_ptr<KODI::JOYSTICK::IInputReceiver> m_inputReceiver; + std::unique_ptr<KODI::KEYBOARD::IKeyboardDriverHandler> m_keyboardHandler; + std::unique_ptr<KODI::MOUSE::IMouseDriverHandler> m_mouseHandler; std::unique_ptr<KODI::JOYSTICK::IButtonMap> m_buttonMap; }; } // namespace PERIPHERALS diff --git a/xbmc/peripherals/bus/PeripheralBus.h b/xbmc/peripherals/bus/PeripheralBus.h index 6b67a7f..c23abff 100644 --- a/xbmc/peripherals/bus/PeripheralBus.h +++ b/xbmc/peripherals/bus/PeripheralBus.h @@ -17,14 +17,6 @@ class CFileItemList; -namespace KODI -{ -namespace JOYSTICK -{ -class IButtonMap; -} // namespace JOYSTICK -} // namespace KODI - namespace PERIPHERALS { class CPeripheral; @@ -66,15 +58,6 @@ public: virtual bool InitializeProperties(CPeripheral& peripheral); /*! - * \brief Initialize a joystick buttonmap, if possible - */ - virtual bool InitializeButtonMap(const CPeripheral& peripheral, - KODI::JOYSTICK::IButtonMap& buttonMap) const - { - return false; - } - - /*! * @brief Get the instance of the peripheral at the given location. * @param strLocation The location. * @return The peripheral or NULL if it wasn't found. diff --git a/xbmc/peripherals/devices/Peripheral.cpp b/xbmc/peripherals/devices/Peripheral.cpp index 6c3f779..2c656a3 100644 --- a/xbmc/peripherals/devices/Peripheral.cpp +++ b/xbmc/peripherals/devices/Peripheral.cpp @@ -588,21 +588,10 @@ void CPeripheral::RegisterInputHandler(IInputHandler* handler, bool bPromiscuous auto it = m_inputHandlers.find(handler); if (it == m_inputHandlers.end()) { - PeripheralAddonPtr addon = m_manager.GetAddonWithButtonMap(this); - if (addon) - { - std::unique_ptr<CAddonInputHandling> addonInput = std::make_unique<CAddonInputHandling>( - m_manager, this, std::move(addon), handler, GetDriverReceiver()); - if (addonInput->Load()) - { - RegisterJoystickDriverHandler(addonInput.get(), bPromiscuous); - m_inputHandlers[handler] = std::move(addonInput); - } - } - else - { - CLog::Log(LOGDEBUG, "Failed to locate add-on for \"{}\"", m_strLocation); - } + CAddonInputHandling* addonInput = + new CAddonInputHandling(m_manager, this, handler, GetDriverReceiver()); + RegisterJoystickDriverHandler(addonInput, bPromiscuous); + m_inputHandlers[handler].reset(addonInput); } } @@ -624,26 +613,10 @@ void CPeripheral::RegisterKeyboardHandler(KEYBOARD::IKeyboardInputHandler* handl auto it = m_keyboardHandlers.find(handler); if (it == m_keyboardHandlers.end()) { - std::unique_ptr<KODI::KEYBOARD::IKeyboardDriverHandler> keyboardDriverHandler; - - PeripheralAddonPtr addon = m_manager.GetAddonWithButtonMap(this); - if (addon) - { - std::unique_ptr<CAddonInputHandling> addonInput = - std::make_unique<CAddonInputHandling>(m_manager, this, std::move(addon), handler); - if (addonInput->Load()) - keyboardDriverHandler = std::move(addonInput); - } - else - { - CLog::Log(LOGDEBUG, "Failed to locate add-on for \"{}\"", m_strLocation); - } - - if (keyboardDriverHandler) - { - RegisterKeyboardDriverHandler(keyboardDriverHandler.get(), bPromiscuous); - m_keyboardHandlers[handler] = std::move(keyboardDriverHandler); - } + std::unique_ptr<CAddonInputHandling> addonInput( + new CAddonInputHandling(m_manager, this, handler)); + RegisterKeyboardDriverHandler(addonInput.get(), bPromiscuous); + m_keyboardHandlers[handler] = std::move(addonInput); } } @@ -662,26 +635,10 @@ void CPeripheral::RegisterMouseHandler(MOUSE::IMouseInputHandler* handler, bool auto it = m_mouseHandlers.find(handler); if (it == m_mouseHandlers.end()) { - std::unique_ptr<KODI::MOUSE::IMouseDriverHandler> mouseDriverHandler; - - PeripheralAddonPtr addon = m_manager.GetAddonWithButtonMap(this); - if (addon) - { - std::unique_ptr<CAddonInputHandling> addonInput = - std::make_unique<CAddonInputHandling>(m_manager, this, std::move(addon), handler); - if (addonInput->Load()) - mouseDriverHandler = std::move(addonInput); - } - else - { - CLog::Log(LOGDEBUG, "Failed to locate add-on for \"{}\"", m_strLocation); - } - - if (mouseDriverHandler) - { - RegisterMouseDriverHandler(mouseDriverHandler.get(), bPromiscuous); - m_mouseHandlers[handler] = std::move(mouseDriverHandler); - } + std::unique_ptr<CAddonInputHandling> addonInput( + new CAddonInputHandling(m_manager, this, handler)); + RegisterMouseDriverHandler(addonInput.get(), bPromiscuous); + m_mouseHandlers[handler] = std::move(addonInput); } } diff --git a/xbmc/peripherals/devices/PeripheralJoystick.cpp b/xbmc/peripherals/devices/PeripheralJoystick.cpp index bccad91..e2087a7 100644 --- a/xbmc/peripherals/devices/PeripheralJoystick.cpp +++ b/xbmc/peripherals/devices/PeripheralJoystick.cpp @@ -98,8 +98,7 @@ bool CPeripheralJoystick::InitialiseFeature(const PeripheralFeature feature) if (bSuccess) { - m_buttonMap = - std::make_unique<CAddonButtonMap>(this, addon, DEFAULT_CONTROLLER_ID, m_manager); + m_buttonMap = std::make_unique<CAddonButtonMap>(this, addon, DEFAULT_CONTROLLER_ID); if (m_buttonMap->Load()) { InitializeDeadzoneFiltering(*m_buttonMap); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp index 4fd93d0..12c8a9e 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -594,6 +594,7 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) XMLUtils::GetFloat(pElement, "limiterrelease", m_limiterRelease, 0.001f, 100.0f); XMLUtils::GetUInt(pElement, "maxpassthroughoffsyncduration", m_maxPassthroughOffSyncDuration, 10, 100); + XMLUtils::GetBoolean(pElement, "superviseaudiodelay", m_superviseAudioDelay); } pElement = pRootElement->FirstChildElement("x11"); diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h index 4ba4e7e..0e5c4fc 100644 --- a/xbmc/settings/AdvancedSettings.h +++ b/xbmc/settings/AdvancedSettings.h @@ -160,6 +160,7 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler float m_videoIgnorePercentAtEnd; float m_audioApplyDrc; unsigned int m_maxPassthroughOffSyncDuration = 10; // when 10 ms off adjust + bool m_superviseAudioDelay = false; // Android only to correct broken audio firmwares int m_videoVDPAUScaling; float m_videoNonLinStretchRatio; diff --git a/xbmc/utils/EGLUtils.cpp b/xbmc/utils/EGLUtils.cpp index 7c5e709..85f889d 100644 --- a/xbmc/utils/EGLUtils.cpp +++ b/xbmc/utils/EGLUtils.cpp @@ -115,7 +115,8 @@ void EglErrorCallback(EGLenum error, typeStr = eglType->second; } - CLog::Log(LOGDEBUG, "EGL Debugging:\nError: {}\nCommand: {}\nType: {}\nMessage: {}", errorStr, command, typeStr, message); + CLog::Log(LOGDEBUG, "EGL Debugging:\nError: {}\nCommand: {}\nType: {}\nMessage: {}", errorStr, + command, typeStr, message ? message : ""); } std::set<std::string> CEGLUtils::GetClientExtensions() |