diff options
45 files changed, 444 insertions, 196 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e137c447c..defd8e7769 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -412,6 +412,7 @@ else() endif() # These are skins that are copied into place from the source tree +set(XBT_SOURCE_FILELIST "") foreach(skin ${SKINS}) list(GET skin 0 dir) list(GET skin 1 relative) @@ -430,11 +431,20 @@ add_custom_target(gen_system_addons WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) # Pack skins and copy to correct build dir (MultiConfig Generator aware) -add_custom_target(gen_skin_pack - COMMAND ${CMAKE_COMMAND} -DBUNDLEDIR=${_bundle_dir} - -DTEXTUREPACKER_EXECUTABLE=$<TARGET_FILE:TexturePacker::TexturePacker::Executable> - -P ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/GeneratedPackSkins.cmake - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/$<CONFIG>/gen_skin.timestamp + COMMAND ${CMAKE_COMMAND} -DBUNDLEDIR=${_bundle_dir} + -DTEXTUREPACKER_EXECUTABLE=$<TARGET_FILE:TexturePacker::TexturePacker::Executable> + -P ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/GeneratedPackSkins.cmake + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/$<CONFIG> + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/$<CONFIG>/gen_skin.timestamp + DEPENDS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/GeneratedPackSkins.cmake + ${XBT_SOURCE_FILELIST} + BYPRODUCTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/$<CONFIG>/gen_skin.timestamp + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Generating skin xbt" +) +add_custom_target(gen_skin_pack DEPENDS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/$<CONFIG>/gen_skin.timestamp) # Packaging target. This generates system addon, xbt creation, copy files to build tree add_custom_target(generate-packaging ALL diff --git a/cmake/modules/FindCrossGUID.cmake b/cmake/modules/FindCrossGUID.cmake index 59d0cebc6a..f7ae5aff1e 100644 --- a/cmake/modules/FindCrossGUID.cmake +++ b/cmake/modules/FindCrossGUID.cmake @@ -41,11 +41,11 @@ if(NOT TARGET CrossGUID::CrossGUID) endif() find_path(CROSSGUID_INCLUDE_DIR NAMES crossguid/guid.hpp guid.h - PATHS ${PC_CROSSGUID_INCLUDEDIR}) + HINTS ${DEPENDS_PATH}/include ${PC_CROSSGUID_INCLUDEDIR}) find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid - HINTS ${PC_CROSSGUID_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_CROSSGUID_LIBDIR}) find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd crossguid-dgb - HINTS ${PC_CROSSGUID_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_CROSSGUID_LIBDIR}) # NEW_CROSSGUID >= 0.2.0 release if(EXISTS "${CROSSGUID_INCLUDE_DIR}/crossguid/guid.hpp") diff --git a/cmake/modules/FindDav1d.cmake b/cmake/modules/FindDav1d.cmake index 160a53226b..f4312d27af 100644 --- a/cmake/modules/FindDav1d.cmake +++ b/cmake/modules/FindDav1d.cmake @@ -40,11 +40,11 @@ if(NOT TARGET dav1d::dav1d) endif() find_library(DAV1D_LIBRARY NAMES dav1d libdav1d - PATHS ${PC_DAV1D_LIBDIR} + HINTS ${DEPENDS_PATH}/lib ${PC_DAV1D_LIBDIR} NO_CACHE) find_path(DAV1D_INCLUDE_DIR NAMES dav1d/dav1d.h - PATHS ${PC_DAV1D_INCLUDEDIR} + HINTS ${DEPENDS_PATH}/include ${PC_DAV1D_INCLUDEDIR} NO_CACHE) set(DAV1D_VERSION ${PC_DAV1D_VERSION}) diff --git a/cmake/modules/FindFlatBuffers.cmake b/cmake/modules/FindFlatBuffers.cmake index 924bcd28c1..6ddfa389c1 100644 --- a/cmake/modules/FindFlatBuffers.cmake +++ b/cmake/modules/FindFlatBuffers.cmake @@ -34,7 +34,10 @@ if(NOT TARGET flatbuffers::flatbuffers) BUILD_DEP_TARGET() else() - find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h) + find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h + HINTS ${DEPENDS_PATH}/include + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} + NO_CACHE) endif() include(FindPackageHandleStandardArgs) diff --git a/cmake/modules/FindFmt.cmake b/cmake/modules/FindFmt.cmake index 223445c595..a403a03ce5 100644 --- a/cmake/modules/FindFmt.cmake +++ b/cmake/modules/FindFmt.cmake @@ -24,7 +24,9 @@ if(NOT TARGET fmt::fmt OR Fmt_FIND_REQUIRED) SETUP_BUILD_VARS() # Check for existing FMT. If version >= FMT-VERSION file version, dont build - find_package(FMT CONFIG QUIET) + find_package(FMT CONFIG QUIET + HINTS ${DEPENDS_PATH}/lib + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG}) # Build if ENABLE_INTERNAL_FMT, or if required version in find_package call is greater # than already found FMT_VERSION from a previous find_package call @@ -83,12 +85,18 @@ if(NOT TARGET fmt::fmt OR Fmt_FIND_REQUIRED) endif() find_path(FMT_INCLUDE_DIR NAMES fmt/format.h - PATHS ${PC_FMT_INCLUDEDIR}) + HINTS ${DEPENDS_PATH}/include ${PC_FMT_INCLUDEDIR} + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(FMT_LIBRARY_RELEASE NAMES fmt - PATHS ${PC_FMT_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_FMT_LIBDIR} + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(FMT_LIBRARY_DEBUG NAMES fmtd - PATHS ${PC_FMT_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_FMT_LIBDIR} + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} + NO_CACHE) endif() add_library(fmt::fmt UNKNOWN IMPORTED) diff --git a/cmake/modules/FindHarfBuzz.cmake b/cmake/modules/FindHarfBuzz.cmake index 6691136bbb..44b291c9b8 100644 --- a/cmake/modules/FindHarfBuzz.cmake +++ b/cmake/modules/FindHarfBuzz.cmake @@ -3,44 +3,37 @@ # ------------ # Finds the HarfBuzz library # -# This will define the following variables:: -# -# HARFBUZZ_FOUND - system has HarfBuzz -# HARFBUZZ_INCLUDE_DIRS - the HarfBuzz include directory -# HARFBUZZ_LIBRARIES - the HarfBuzz libraries -# -# and the following imported targets:: +# This will define the following target: # # HarfBuzz::HarfBuzz - The HarfBuzz library -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_HARFBUZZ harfbuzz QUIET) -endif() - -find_path(HARFBUZZ_INCLUDE_DIR NAMES harfbuzz/hb-ft.h hb-ft.h - PATHS ${PC_HARFBUZZ_INCLUDEDIR} - ${PC_HARFBUZZ_INCLUDE_DIRS} - PATH_SUFFIXES harfbuzz) -find_library(HARFBUZZ_LIBRARY NAMES harfbuzz harfbuzz - PATHS ${PC_HARFBUZZ_LIBDIR}) +if(NOT TARGET HarfBuzz::HarfBuzz) + find_package(PkgConfig) + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_HARFBUZZ harfbuzz QUIET) + endif() -set(HARFBUZZ_VERSION ${PC_HARFBUZZ_VERSION}) + find_path(HARFBUZZ_INCLUDE_DIR NAMES harfbuzz/hb-ft.h hb-ft.h + HINTS ${PC_HARFBUZZ_INCLUDEDIR} + ${PC_HARFBUZZ_INCLUDE_DIRS} + PATH_SUFFIXES harfbuzz + NO_CACHE) + find_library(HARFBUZZ_LIBRARY NAMES harfbuzz + HINTS ${PC_HARFBUZZ_LIBDIR} + NO_CACHE) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(HarfBuzz - REQUIRED_VARS HARFBUZZ_LIBRARY HARFBUZZ_INCLUDE_DIR - VERSION_VAR HARFBUZZ_VERSION) + set(HARFBUZZ_VERSION ${PC_HARFBUZZ_VERSION}) -if(HARFBUZZ_FOUND) - set(HARFBUZZ_LIBRARIES ${HARFBUZZ_LIBRARY}) - set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_INCLUDE_DIR}) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(HarfBuzz + REQUIRED_VARS HARFBUZZ_LIBRARY HARFBUZZ_INCLUDE_DIR + VERSION_VAR HARFBUZZ_VERSION) - if(NOT TARGET HarfBuzz::HarfBuzz) + if(HARFBUZZ_FOUND) add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED) set_target_properties(HarfBuzz::HarfBuzz PROPERTIES IMPORTED_LOCATION "${HARFBUZZ_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIR}") + set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP HarfBuzz::HarfBuzz) endif() endif() - -mark_as_advanced(HARFBUZZ_INCLUDE_DIR HARFBUZZ_LIBRARY) diff --git a/cmake/modules/FindLCMS2.cmake b/cmake/modules/FindLCMS2.cmake index d02515815d..73075d8997 100644 --- a/cmake/modules/FindLCMS2.cmake +++ b/cmake/modules/FindLCMS2.cmake @@ -3,46 +3,36 @@ # ----------- # Finds the LCMS Color Management library # -# This will define the following variables:: +# This will define the following target: # -# LCMS2_FOUND - system has LCMS Color Management -# LCMS2_INCLUDE_DIRS - the LCMS Color Management include directory -# LCMS2_LIBRARIES - the LCMS Color Management libraries -# LCMS2_DEFINITIONS - the LCMS Color Management definitions -# -# and the following imported targets:: -# -# LCMS2::LCMS2 - The LCMS Color Management library - -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_LCMS2 lcms2>=2.10 QUIET) -endif() +# LCMS2::LCMS2 - The LCMS Color Management library -find_path(LCMS2_INCLUDE_DIR NAMES lcms2.h - PATHS ${PC_LCMS2_INCLUDEDIR}) -find_library(LCMS2_LIBRARY NAMES lcms2 liblcms2 - PATHS ${PC_LCMS2_LIBDIR}) +if(NOT TARGET LCMS2::LCMS2) + find_package(PkgConfig) + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LCMS2 lcms2>=2.10 QUIET) + endif() -set(LCMS2_VERSION ${PC_LCMS2_VERSION}) + find_path(LCMS2_INCLUDE_DIR NAMES lcms2.h + HINTS ${PC_LCMS2_INCLUDEDIR} + NO_CACHE) + find_library(LCMS2_LIBRARY NAMES lcms2 liblcms2 + HINTS ${PC_LCMS2_LIBDIR} + NO_CACHE) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LCMS2 - REQUIRED_VARS LCMS2_LIBRARY LCMS2_INCLUDE_DIR - VERSION_VAR LCMS2_VERSION) + set(LCMS2_VERSION ${PC_LCMS2_VERSION}) -if(LCMS2_FOUND) - set(LCMS2_LIBRARIES ${LCMS2_LIBRARY}) - set(LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR}) - set(LCMS2_DEFINITIONS -DHAVE_LCMS2=1 -DCMS_NO_REGISTER_KEYWORD=1) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(LCMS2 + REQUIRED_VARS LCMS2_LIBRARY LCMS2_INCLUDE_DIR + VERSION_VAR LCMS2_VERSION) - if(NOT TARGET LCMS2::LCMS2) + if(LCMS2_FOUND) add_library(LCMS2::LCMS2 UNKNOWN IMPORTED) set_target_properties(LCMS2::LCMS2 PROPERTIES IMPORTED_LOCATION "${LCMS2_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${LCMS2_INCLUDE_DIR}" - INTERFACE_COMPILE_DEFINITIONS HAVE_LCMS2=1) + INTERFACE_COMPILE_DEFINITIONS "HAVE_LCMS2=1;CMS_NO_REGISTER_KEYWORD=1") + set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP LCMS2::LCMS2) endif() endif() - -mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY) - diff --git a/cmake/modules/FindLibZip.cmake b/cmake/modules/FindLibZip.cmake index 6423c29be1..ccbc4e38a6 100644 --- a/cmake/modules/FindLibZip.cmake +++ b/cmake/modules/FindLibZip.cmake @@ -19,7 +19,9 @@ set(MODULE_LC libzip) SETUP_BUILD_VARS() # Check for existing lib -find_package(LIBZIP CONFIG QUIET) +find_package(LIBZIP CONFIG QUIET + HINTS ${DEPENDS_PATH}/lib + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG}) if(NOT LIBZIP_FOUND OR LIBZIP_VERSION VERSION_LESS ${${MODULE}_VER}) # Check for dependencies @@ -39,9 +41,13 @@ if(NOT LIBZIP_FOUND OR LIBZIP_VERSION VERSION_LESS ${${MODULE}_VER}) BUILD_DEP_TARGET() else() - find_path(LIBZIP_INCLUDE_DIR NAMES zip.h) + find_path(LIBZIP_INCLUDE_DIR NAMES zip.h + HINTS ${DEPENDS_PATH}/include + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG}) - find_library(LIBZIP_LIBRARY NAMES zip) + find_library(LIBZIP_LIBRARY NAMES zip + HINTS ${DEPENDS_PATH}/lib + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG}) endif() include(FindPackageHandleStandardArgs) diff --git a/cmake/modules/FindNFS.cmake b/cmake/modules/FindNFS.cmake index 8608571d62..c81f2e02ae 100644 --- a/cmake/modules/FindNFS.cmake +++ b/cmake/modules/FindNFS.cmake @@ -16,7 +16,9 @@ if(NOT TARGET libnfs::nfs) SETUP_BUILD_VARS() # Search for cmake config. Suitable for all platforms including windows - find_package(libnfs CONFIG QUIET) + find_package(libnfs CONFIG QUIET + HINTS ${DEPENDS_PATH}/lib + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG}) # Check for existing LIBNFS. If version >= LIBNFS-VERSION file version, dont build # A corner case, but if a linux/freebsd user WANTS to build internal libnfs, build anyway @@ -42,12 +44,16 @@ if(NOT TARGET libnfs::nfs) find_library(LIBNFS_LIBRARY_RELEASE NAMES nfs libnfs HINTS ${DEPENDS_PATH}/lib - ${PC_LIBNFS_LIBDIR}) + ${PC_LIBNFS_LIBDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) set(LIBNFS_VERSION ${PC_LIBNFS_VERSION}) endif() find_path(LIBNFS_INCLUDE_DIR nfsc/libnfs.h HINTS ${PC_LIBNFS_INCLUDEDIR} - ${DEPENDS_PATH}/include) + ${DEPENDS_PATH}/include + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) endif() if(TARGET libnfs::nfs) diff --git a/cmake/modules/FindPCRE.cmake b/cmake/modules/FindPCRE.cmake index f4c54aea8a..0b7e0c3203 100644 --- a/cmake/modules/FindPCRE.cmake +++ b/cmake/modules/FindPCRE.cmake @@ -17,7 +17,9 @@ if(NOT PCRE::pcre) SETUP_BUILD_VARS() # Check for existing PCRE. If version >= PCRE-VERSION file version, dont build - find_package(PCRE CONFIG QUIET) + find_package(PCRE CONFIG QUIET + HINTS ${DEPENDS_PATH}/lib + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG}) if((PCRE_VERSION VERSION_LESS ${${MODULE}_VER} AND ENABLE_INTERNAL_PCRE) OR ((CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd) AND ENABLE_INTERNAL_PCRE)) @@ -76,15 +78,25 @@ if(NOT PCRE::pcre) endif() find_path(PCRE_INCLUDE_DIR pcrecpp.h - PATHS ${PC_PCRE_INCLUDEDIR}) + HINTS ${DEPENDS_PATH}/include ${PC_PCRE_INCLUDEDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(PCRECPP_LIBRARY_RELEASE NAMES pcrecpp - PATHS ${PC_PCRE_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_PCRE_LIBDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(PCRE_LIBRARY_RELEASE NAMES pcre - PATHS ${PC_PCRE_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_PCRE_LIBDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(PCRECPP_LIBRARY_DEBUG NAMES pcrecppd - PATHS ${PC_PCRE_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_PCRE_LIBDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(PCRE_LIBRARY_DEBUG NAMES pcred - PATHS ${PC_PCRE_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_PCRE_LIBDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) set(PCRE_VERSION ${PC_PCRE_VERSION}) else() @@ -113,7 +125,9 @@ if(NOT PCRE::pcre) # ToDo: patch PCRE cmake to include includedir in config file find_path(PCRE_INCLUDE_DIR pcrecpp.h - PATHS ${PC_PCRE_INCLUDEDIR}) + HINTS ${DEPENDS_PATH}/include ${PC_PCRE_INCLUDEDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) set_target_properties(PCRE::pcre PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PCRE_INCLUDE_DIR}") diff --git a/cmake/modules/FindRapidJSON.cmake b/cmake/modules/FindRapidJSON.cmake index bfa8af00c4..19405867bd 100644 --- a/cmake/modules/FindRapidJSON.cmake +++ b/cmake/modules/FindRapidJSON.cmake @@ -3,10 +3,9 @@ # ----------- # Finds the RapidJSON library # -# This will define the following variables:: +# This will define the following target: # -# RapidJSON_FOUND - system has RapidJSON parser -# RapidJSON_INCLUDE_DIRS - the RapidJSON parser include directory +# RapidJSON::RapidJSON - The RapidJSON library # if(NOT TARGET RapidJSON::RapidJSON) @@ -47,12 +46,16 @@ if(NOT TARGET RapidJSON::RapidJSON) if(PC_RapidJSON_VERSION) set(RapidJSON_VERSION ${PC_RapidJSON_VERSION}) else() - find_package(RapidJSON 1.1.0 CONFIG REQUIRED QUIET) + find_package(RapidJSON 1.1.0 CONFIG REQUIRED + QUIET + HINTS ${DEPENDS_PATH}/lib + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG}) endif() endif() find_path(RAPIDJSON_INCLUDE_DIRS NAMES rapidjson/rapidjson.h - PATHS ${PC_RapidJSON_INCLUDEDIR} + HINTS ${DEPENDS_PATH}/include ${PC_RapidJSON_INCLUDEDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} NO_CACHE) endif() diff --git a/cmake/modules/FindSpdlog.cmake b/cmake/modules/FindSpdlog.cmake index b1beabea3b..f8e8e998b9 100644 --- a/cmake/modules/FindSpdlog.cmake +++ b/cmake/modules/FindSpdlog.cmake @@ -24,14 +24,10 @@ if(NOT TARGET spdlog::spdlog) set(MODULE_LC spdlog) SETUP_BUILD_VARS() - # Darwin systems we want to avoid system packages. We are entirely self sufficient - # Avoids homebrew populating rubbish we cant control - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(_spdlog_find_option NO_SYSTEM_ENVIRONMENT_PATH) - endif() - # Check for existing SPDLOG. If version >= SPDLOG-VERSION file version, dont build - find_package(SPDLOG ${_spdlog_find_option} CONFIG QUIET) + find_package(SPDLOG CONFIG QUIET + HINTS ${DEPENDS_PATH}/lib + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG}) if((SPDLOG_VERSION VERSION_LESS ${${MODULE}_VER} AND ENABLE_INTERNAL_SPDLOG) OR ((CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd) AND ENABLE_INTERNAL_SPDLOG) OR @@ -83,14 +79,17 @@ if(NOT TARGET spdlog::spdlog) endif() find_path(SPDLOG_INCLUDE_DIR NAMES spdlog/spdlog.h - PATHS ${PC_SPDLOG_INCLUDEDIR} + HINTS ${DEPENDS_PATH}/include ${PC_SPDLOG_INCLUDEDIR} + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} NO_CACHE) find_library(SPDLOG_LIBRARY_RELEASE NAMES spdlog - PATHS ${PC_SPDLOG_LIBDIR} + HINTS ${DEPENDS_PATH}/lib ${PC_SPDLOG_LIBDIR} + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} NO_CACHE) find_library(SPDLOG_LIBRARY_DEBUG NAMES spdlogd - PATHS ${PC_SPDLOG_LIBDIR} + HINTS ${DEPENDS_PATH}/lib ${PC_SPDLOG_LIBDIR} + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} NO_CACHE) # Only add -D definitions. Skip -I include as we do a find_path for the header anyway diff --git a/cmake/modules/FindTagLib.cmake b/cmake/modules/FindTagLib.cmake index e1b8745e4a..e455a58cb5 100644 --- a/cmake/modules/FindTagLib.cmake +++ b/cmake/modules/FindTagLib.cmake @@ -61,11 +61,18 @@ if(NOT TARGET TagLib::TagLib) pkg_check_modules(PC_TAGLIB taglib>=1.9.0 QUIET) endif() - find_path(TAGLIB_INCLUDE_DIR taglib/tag.h PATHS ${PC_TAGLIB_INCLUDEDIR}) + find_path(TAGLIB_INCLUDE_DIR NAMES taglib/tag.h + HINTS ${DEPENDS_PATH}/include ${PC_TAGLIB_INCLUDEDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(TAGLIB_LIBRARY_RELEASE NAMES tag - PATHS ${PC_TAGLIB_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_TAGLIB_LIBDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(TAGLIB_LIBRARY_DEBUG NAMES tagd - PATHS ${PC_TAGLIB_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_TAGLIB_LIBDIR} + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} + NO_CACHE) set(TAGLIB_VERSION ${PC_TAGLIB_VERSION}) set(TAGLIB_LINK_LIBS ${PC_TAGLIB_LIBRARIES}) diff --git a/cmake/modules/FindTinyXML2.cmake b/cmake/modules/FindTinyXML2.cmake index d95a7343b6..ba11a47a3f 100644 --- a/cmake/modules/FindTinyXML2.cmake +++ b/cmake/modules/FindTinyXML2.cmake @@ -14,14 +14,9 @@ if(NOT TARGET tinyxml2::tinyxml2) SETUP_BUILD_VARS() - # Darwin systems we want to avoid system packages. We are entirely self sufficient - # Avoids homebrew populating rubbish we cant control - # Do we want to set this for all except LINUX/FREEBSD possibly? - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(_tinyxml2_find_option NO_SYSTEM_ENVIRONMENT_PATH) - endif() - - find_package(TINYXML2 ${_tinyxml2_find_option} CONFIG QUIET) + find_package(TINYXML2 CONFIG QUIET + HINTS ${DEPENDS_PATH}/lib + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG}) # Check for existing TINYXML2. If version >= TINYXML2-VERSION file version, dont build # A corner case, but if a linux/freebsd user WANTS to build internal tinyxml2, build anyway @@ -68,12 +63,18 @@ if(NOT TARGET tinyxml2::tinyxml2) pkg_check_modules(PC_TINYXML2 tinyxml2 QUIET) endif() - find_path(TINYXML2_INCLUDE_DIR tinyxml2.h - PATHS ${PC_TINYXML2_INCLUDEDIR}) + find_path(TINYXML2_INCLUDE_DIR NAMES tinyxml2.h + HINTS ${DEPENDS_PATH}/include ${PC_TINYXML2_INCLUDEDIR} + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(TINYXML2_LIBRARY_RELEASE NAMES tinyxml2 - PATHS ${PC_TINYXML2_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_TINYXML2_LIBDIR} + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} + NO_CACHE) find_library(TINYXML2_LIBRARY_DEBUG NAMES tinyxml2d - PATHS ${PC_TINYXML2_LIBDIR}) + HINTS ${DEPENDS_PATH}/lib ${PC_TINYXML2_LIBDIR} + ${${CORE_PLATFORM_LC}_SEARCH_CONFIG} + NO_CACHE) set(TINYXML2_VERSION ${PC_TINYXML2_VERSION}) endif() diff --git a/cmake/modules/FindWaylandProtocolsWebOS.cmake b/cmake/modules/FindWaylandProtocolsWebOS.cmake index 979c34d660..041ea2bffa 100644 --- a/cmake/modules/FindWaylandProtocolsWebOS.cmake +++ b/cmake/modules/FindWaylandProtocolsWebOS.cmake @@ -4,24 +4,15 @@ # # This will define the following variables:: # -# WAYLANDPROTOCOLSWEBOS_FOUND - systm has wayland-webos-client # WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR - directory containing the additional webOS Wayland protocols # from the webos-wayland-extensions package -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_WAYLAND_WEBOS_CLIENT wayland-webos-client>=1.0.0) -endif() -find_path(WAYLAND_PROTOCOLS_WEBOS_PROTOCOLDIR NAMES wayland-webos/webos-shell.xml - PATHS ${DEPENDS_PATH}/share) +find_path(WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR NAMES webos-shell.xml + PATH_SUFFIXES wayland-webos + PATHS ${DEPENDS_PATH}/share + REQUIRED) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(WaylandProtocolsWebOS - REQUIRED_VARS WAYLAND_PROTOCOLS_WEBOS_PROTOCOLDIR - VERSION_VAR WAYLAND_WEBOS_SERVER_VERSION) - -if(WAYLANDPROTOCOLSWEBOS_FOUND) - # Promote to cache variables so all code can access it - set(WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR "${WAYLAND_PROTOCOLS_WEBOS_PROTOCOLDIR}/wayland-webos" CACHE INTERNAL "") -endif() +include(FindPackageMessage) +find_package_message(WaylandProtocolsWebOS "Found WaylandProtocols-WebOS: ${WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR}" "[${WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR}]") mark_as_advanced(WAYLANDPROTOCOLSWEBOS_PROTOCOLSDIR) diff --git a/cmake/platform/android/android.cmake b/cmake/platform/android/android.cmake index ca3fad9dce..07fa72c746 100644 --- a/cmake/platform/android/android.cmake +++ b/cmake/platform/android/android.cmake @@ -6,3 +6,5 @@ list(APPEND PLATFORM_OPTIONAL_DEPS LibDovi) set(TARGET_SDK 33) # Minimum supported SDK version set(TARGET_MINSDK 21) + +set(${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG NO_DEFAULT_PATH CACHE STRING "") diff --git a/cmake/platform/darwin_embedded/ios.cmake b/cmake/platform/darwin_embedded/ios.cmake index 55d7c4a008..aff02ecfc6 100644 --- a/cmake/platform/darwin_embedded/ios.cmake +++ b/cmake/platform/darwin_embedded/ios.cmake @@ -1 +1,3 @@ list(APPEND ARCH_DEFINES -DTARGET_DARWIN_IOS) +set(${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG NO_DEFAULT_PATH CACHE STRING "") + diff --git a/cmake/platform/darwin_embedded/tvos.cmake b/cmake/platform/darwin_embedded/tvos.cmake index 8d2538cdff..62e16f5c06 100644 --- a/cmake/platform/darwin_embedded/tvos.cmake +++ b/cmake/platform/darwin_embedded/tvos.cmake @@ -1,2 +1,3 @@ list(APPEND ARCH_DEFINES -DTARGET_DARWIN_TVOS) set(ENABLE_AIRTUNES OFF CACHE BOOL "" FORCE) +set(${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG NO_DEFAULT_PATH CACHE STRING "") diff --git a/cmake/platform/osx/osx.cmake b/cmake/platform/osx/osx.cmake index cd3a996ded..c46bfbb12e 100644 --- a/cmake/platform/osx/osx.cmake +++ b/cmake/platform/osx/osx.cmake @@ -18,3 +18,5 @@ elseif(APP_WINDOW_SYSTEM STREQUAL native) else() message(SEND_ERROR "Only SDL or native windowing options are supported.") endif() + +set(${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG NO_DEFAULT_PATH CACHE STRING "") diff --git a/cmake/scripts/common/ProjectMacros.cmake b/cmake/scripts/common/ProjectMacros.cmake index 015cc3db94..e3d9a58a6d 100644 --- a/cmake/scripts/common/ProjectMacros.cmake +++ b/cmake/scripts/common/ProjectMacros.cmake @@ -8,6 +8,8 @@ # xbt is added to ${XBT_FILES} function(pack_xbt input output) file(GLOB_RECURSE MEDIA_FILES ${input}/*) + list(APPEND XBT_SOURCE_FILELIST ${MEDIA_FILES}) + set(XBT_SOURCE_FILELIST ${XBT_SOURCE_FILELIST} PARENT_SCOPE) get_filename_component(dir ${output} DIRECTORY) if(${CORE_SYSTEM_NAME} MATCHES "windows") @@ -45,6 +47,7 @@ function(copy_skin_to_buildtree skin) endforeach() set(XBT_FILES ${XBT_FILES} PARENT_SCOPE) + set(XBT_SOURCE_FILELIST ${XBT_SOURCE_FILELIST} PARENT_SCOPE) set(install_data ${install_data} PARENT_SCOPE) endfunction() diff --git a/cmake/scripts/linux/Install.cmake b/cmake/scripts/linux/Install.cmake index 3f6c7ac6da..1564083b7c 100644 --- a/cmake/scripts/linux/Install.cmake +++ b/cmake/scripts/linux/Install.cmake @@ -188,7 +188,7 @@ install(FILES ${CMAKE_SOURCE_DIR}/cmake/scripts/common/AddonHelpers.cmake ${CMAKE_SOURCE_DIR}/cmake/scripts/common/ArchSetup.cmake ${CMAKE_SOURCE_DIR}/cmake/scripts/common/CheckCommits.cmake ${CMAKE_SOURCE_DIR}/cmake/scripts/common/CheckTargetPlatform.cmake - ${CMAKE_SOURCE_DIR}/cmake/scripts/common/GenerateVersionedFiles.cmake + ${CMAKE_SOURCE_DIR}/cmake/scripts/common/GenerateCompileInfo.cmake ${CMAKE_SOURCE_DIR}/cmake/scripts/common/GeneratorSetup.cmake ${CMAKE_SOURCE_DIR}/cmake/scripts/common/HandleDepends.cmake ${CMAKE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake diff --git a/tools/android/packaging/Makefile.in b/tools/android/packaging/Makefile.in index 2b82c8d780..514b655efb 100644 --- a/tools/android/packaging/Makefile.in +++ b/tools/android/packaging/Makefile.in @@ -47,7 +47,7 @@ shared: cp -rfp $(DEPENDS_PATH)/share/kodi/* ./assets || true find `pwd`/assets/ -depth -name ".git" -exec rm -rf {} \; find `pwd`/assets/ -name "*.so" -exec rm {} \; - find `pwd`/assets/addons/skin.*/media/* -depth -not -iname "Textures.xbt" -exec rm -rf {} \; + find `pwd`/assets/addons/skin.*/media/* -depth -not -iname "*.xbt" -exec rm -rf {} \; cd `pwd`/assets/addons; rm -rf $(EXCLUDED_ADDONS) cp $(CMAKE_SOURCE_DIR)/privacy-policy.txt assets diff --git a/tools/depends/native/rustup/Makefile b/tools/depends/native/rustup/Makefile index 13d145cccd..0c699b952d 100644 --- a/tools/depends/native/rustup/Makefile +++ b/tools/depends/native/rustup/Makefile @@ -26,7 +26,7 @@ $(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE) cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) $(APP): $(PLATFORM) - bash $(PLATFORM)/rustup-init.sh -y --no-modify-path \ + ./$(PLATFORM)/rustup-init.sh -y --no-modify-path \ --profile minimal \ --default-toolchain=$(RUST_TOOLCHAIN_VERSION) diff --git a/tools/depends/target/webos-wayland-extensions/Makefile b/tools/depends/target/webos-wayland-extensions/Makefile index 64d975bd78..90022df192 100644 --- a/tools/depends/target/webos-wayland-extensions/Makefile +++ b/tools/depends/target/webos-wayland-extensions/Makefile @@ -17,12 +17,6 @@ $(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE) .installed-$(PLATFORM): $(PLATFORM) mkdir -p $(PREFIX)/share/wayland-webos $(PREFIX)/lib/pkgconfig - rm -f ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - echo 'includedir=$(PREFIX)/include' >> ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - echo 'Name: wayland-webos-client' >> ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - echo 'Description: wayland-webos-client' >> ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - echo 'Version: 1.0.0' >> ${PREFIX}/lib/pkgconfig/wayland-webos-client.pc - cp $(PLATFORM)/protocol/webos-shell.xml $(PREFIX)/share/wayland-webos cp $(PLATFORM)/protocol/webos-foreign.xml $(PREFIX)/share/wayland-webos touch $@ diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index ac4e0f7d41..32666e4ebc 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -6857,9 +6857,17 @@ const infomap container_str[] = {{ "property", CONTAINER_PROPERTY }, /// <p><hr> /// @skinning_v20 **[New Infolabel]** \link ListItem_HdrType `ListItem.HdrType`\endlink /// } +/// \table_row3{ <b>`ListItem.SongVideoURL`</b>, +/// \anchor ListItem_SongVideoURL +/// _string_, +/// @return Link to a video of a song +/// <p><hr> +/// @skinning_v21 **[New Infolabel]** \link ListItem_SongVideoURL `ListItem.SongVideoURL`\endlink +/// } /// \table_end /// /// ----------------------------------------------------------------------------- +// clang-format off const infomap listitem_labels[]= {{ "thumb", LISTITEM_THUMB }, { "icon", LISTITEM_ICON }, { "actualicon", LISTITEM_ACTUAL_ICON }, @@ -7069,7 +7077,9 @@ const infomap listitem_labels[]= {{ "thumb", LISTITEM_THUMB }, { "albumstatus", LISTITEM_ALBUMSTATUS }, { "isautoupdateable", LISTITEM_ISAUTOUPDATEABLE }, { "hdrtype", LISTITEM_VIDEO_HDR_TYPE }, + { "songvideourl", LISTITEM_SONG_VIDEO_URL }, }; +// clang-format on /// \page modules__infolabels_boolean_conditions /// \subsection modules__infolabels_boolean_conditions_Visualisation Visualisation diff --git a/xbmc/addons/Scraper.cpp b/xbmc/addons/Scraper.cpp index 30c22473af..ad7b251052 100644 --- a/xbmc/addons/Scraper.cpp +++ b/xbmc/addons/Scraper.cpp @@ -816,6 +816,23 @@ void DetailsFromFileItem<CArtist>(const CFileItem &item, CArtist &artist) artist.discography.emplace_back(discoAlbum); } + const int numvideolinks = item.GetProperty("artist.videolinks").asInteger32(); + if (numvideolinks > 0) + { + artist.videolinks.reserve(numvideolinks); + for (int i = 1; i <= numvideolinks; ++i) + { + std::stringstream prefix; + prefix << "artist.videolink" << i; + ArtistVideoLinks videoLink; + videoLink.title = FromString(item, prefix.str() + ".title"); + videoLink.mbTrackID = FromString(item, prefix.str() + ".mbtrackid"); + videoLink.videoURL = FromString(item, prefix.str() + ".url"); + videoLink.thumbURL = FromString(item, prefix.str() + ".thumb"); + artist.videolinks.emplace_back(std::move(videoLink)); + } + } + int nThumbs = item.GetProperty("artist.thumbs").asInteger32(); ParseThumbs(artist.thumbURL, item, nThumbs, "artist.thumb"); diff --git a/xbmc/cores/AudioEngine/Sinks/pipewire/PipewireGlobal.h b/xbmc/cores/AudioEngine/Sinks/pipewire/PipewireGlobal.h index 7b1021ae38..67f40c7220 100644 --- a/xbmc/cores/AudioEngine/Sinks/pipewire/PipewireGlobal.h +++ b/xbmc/cores/AudioEngine/Sinks/pipewire/PipewireGlobal.h @@ -29,21 +29,21 @@ public: CPipewireGlobal() = default; ~CPipewireGlobal(); - CPipewireGlobal& SetName(std::string_view name) + CPipewireGlobal& SetName(const std::string& name) { m_name = name; return *this; } - std::string_view GetName() const { return m_name; } + std::string GetName() const { return m_name; } - CPipewireGlobal& SetDescription(std::string_view description) + CPipewireGlobal& SetDescription(const std::string& description) { m_description = description; return *this; } - std::string_view GetDescription() const { return m_description; } + std::string GetDescription() const { return m_description; } CPipewireGlobal& SetID(uint32_t id) { @@ -61,13 +61,13 @@ public: uint32_t GetPermissions() const { return m_permissions; } - CPipewireGlobal& SetType(std::string_view type) + CPipewireGlobal& SetType(const std::string& type) { m_type = type; return *this; } - std::string_view GetType() const { return m_type; } + std::string GetType() const { return m_type; } CPipewireGlobal& SetVersion(uint32_t version) { @@ -95,11 +95,11 @@ public: CPipewireNode& GetNode() const { return *m_node; } private: - std::string_view m_name; - std::string_view m_description; + std::string m_name; + std::string m_description; uint32_t m_id; uint32_t m_permissions; - std::string_view m_type; + std::string m_type; uint32_t m_version; std::unique_ptr<pw_properties, PipewirePropertiesDeleter> m_properties; std::unique_ptr<CPipewireNode> m_node; diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 72419823d8..c4590feca7 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -1871,7 +1871,10 @@ void CVideoPlayer::HandlePlaySpeed() CGUIDialogKaiToast::QueueNotification(g_localizeStrings.Get(21454), g_localizeStrings.Get(21455)); SetCaching(CACHESTATE_INIT); } - if (cache.level >= 1.0) + // Note: Previously used cache.level >= 1 would keep video stalled + // event after cache was full + // Talk link: https://github.com/xbmc/xbmc/pull/23760 + if (cache.time > 8.0) SetCaching(CACHESTATE_INIT); } else diff --git a/xbmc/guilib/guiinfo/GUIInfoLabels.h b/xbmc/guilib/guiinfo/GUIInfoLabels.h index 5d186bc2ef..dfb5b7f422 100644 --- a/xbmc/guilib/guiinfo/GUIInfoLabels.h +++ b/xbmc/guilib/guiinfo/GUIInfoLabels.h @@ -962,6 +962,7 @@ #define LISTITEM_ALBUMSTATUS (LISTITEM_START + 206) #define LISTITEM_ISAUTOUPDATEABLE (LISTITEM_START + 207) #define LISTITEM_VIDEO_HDR_TYPE (LISTITEM_START + 208) +#define LISTITEM_SONG_VIDEO_URL (LISTITEM_START + 209) #define LISTITEM_END (LISTITEM_START + 2500) diff --git a/xbmc/guilib/guiinfo/MusicGUIInfo.cpp b/xbmc/guilib/guiinfo/MusicGUIInfo.cpp index f58a9ae3c4..ca79c2c8de 100644 --- a/xbmc/guilib/guiinfo/MusicGUIInfo.cpp +++ b/xbmc/guilib/guiinfo/MusicGUIInfo.cpp @@ -403,6 +403,9 @@ bool CMusicGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont return true; } break; + case LISTITEM_SONG_VIDEO_URL: + value = tag->GetSongVideoURL(); + return true; } } diff --git a/xbmc/interfaces/json-rpc/AudioLibrary.cpp b/xbmc/interfaces/json-rpc/AudioLibrary.cpp index 3521a3a8ae..813c4c85c4 100644 --- a/xbmc/interfaces/json-rpc/AudioLibrary.cpp +++ b/xbmc/interfaces/json-rpc/AudioLibrary.cpp @@ -991,6 +991,8 @@ JSONRPC_STATUS CAudioLibrary::SetSongDetails(const std::string &method, ITranspo song.strOrigReleaseDate = parameterObject["originaldate"].asString(); if (ParameterNotNull(parameterObject, "albumreleasedate")) song.strReleaseDate = parameterObject["albumreleasedate"].asString(); + if (ParameterNotNull(parameterObject, "songvideourl")) + song.songVideoURL = parameterObject["songvideourl"].asString(); // Update existing art. Any existing artwork that isn't specified in this request stays as is. // If the value is null then the existing art with that type is removed. diff --git a/xbmc/interfaces/json-rpc/schema/methods.json b/xbmc/interfaces/json-rpc/schema/methods.json index 4d396cf6ba..c33e23ea31 100644 --- a/xbmc/interfaces/json-rpc/schema/methods.json +++ b/xbmc/interfaces/json-rpc/schema/methods.json @@ -1220,7 +1220,8 @@ { "name": "disctitle", "$ref": "Optional.String" }, { "name": "releasedate", "$ref": "Optional.String" }, { "name": "originaldate", "$ref": "Optional.String" }, - { "name": "bpm", "$ref": "Optional.Integer" } + { "name": "bpm", "$ref": "Optional.Integer" }, + { "name": "songvideourl", "$ref": "Optional.String" } ], "returns": "string" }, diff --git a/xbmc/interfaces/json-rpc/schema/types.json b/xbmc/interfaces/json-rpc/schema/types.json index 86e8b22961..7310ddf55b 100644 --- a/xbmc/interfaces/json-rpc/schema/types.json +++ b/xbmc/interfaces/json-rpc/schema/types.json @@ -545,7 +545,8 @@ "votes", "userrating", "mood", "contributors", "displaycomposer", "displayconductor", "displayorchestra", "displaylyricist", "sortartist", "art", "sourceid", "disctitle", "releasedate", "originaldate", - "bpm", "samplerate", "bitrate", "channels", "datemodified", "datenew" ] + "bpm", "samplerate", "bitrate", "channels", "datemodified", "datenew", + "songvideourl" ] } }, "Audio.Album.ReleaseType": { @@ -692,7 +693,8 @@ "bpm": { "type": "Integer" }, "samplerate": { "type": "Integer" }, "bitrate": { "type": "Integer"}, - "channels": { "type": "Integer"} + "channels": { "type": "Integer"}, + "songvideourl": { "type": "string" } } }, "Audio.Property.Name": { @@ -1572,7 +1574,8 @@ "samplerate": { "type": "integer" }, "channels": { "type": "integer"}, "albumstatus": { "type": "string" }, - "customproperties": { "$ref": "Item.CustomProperties" } + "customproperties": { "$ref": "Item.CustomProperties" }, + "songvideourl": { "type": "string" } } }, "List.Fields.All": { @@ -1597,7 +1600,7 @@ "musicbrainzreleasegroupid", "mediapath", "dynpath", "isboxset", "totaldiscs", "disctitle", "releasedate", "originaldate", "bpm", "bitrate", "samplerate", "channels", "albumstatus", "datemodified", "datenew", "customproperties", - "albumduration"] + "albumduration", "songvideourl"] } }, "List.Item.All": { @@ -1631,7 +1634,7 @@ "specialsortseason", "specialsortepisode", "sortartist", "musicbrainzreleasegroupid", "isboxset", "totaldiscs", "disctitle", "releasedate", "originaldate", "bpm", "bitrate", "samplerate", "channels", "datemodified", "datenew", "customproperties", - "albumduration", "userrating"] + "albumduration", "userrating", "songvideourl" ] } }, "List.Item.File": { diff --git a/xbmc/interfaces/json-rpc/schema/version.txt b/xbmc/interfaces/json-rpc/schema/version.txt index 3f74ab3e4c..998f113d61 100644 --- a/xbmc/interfaces/json-rpc/schema/version.txt +++ b/xbmc/interfaces/json-rpc/schema/version.txt @@ -1 +1 @@ -JSONRPC_VERSION 13.2.1 +JSONRPC_VERSION 13.3.0 diff --git a/xbmc/music/Artist.cpp b/xbmc/music/Artist.cpp index 786f7a737b..c5626c58eb 100644 --- a/xbmc/music/Artist.cpp +++ b/xbmc/music/Artist.cpp @@ -62,6 +62,7 @@ void CArtist::MergeScrapedArtist(const CArtist& source, bool override /* = true art = source.art; discography = source.discography; + videolinks = source.videolinks; } @@ -133,6 +134,24 @@ bool CArtist::Load(const TiXmlElement *artist, bool append, bool prioritise) node = node->NextSiblingElement("album"); } + //song video links + const TiXmlElement* songurls = artist->FirstChildElement("videourl"); + if (songurls) + videolinks.clear(); + while (songurls) + { + if (songurls->FirstChild()) + { + ArtistVideoLinks videoLink; + XMLUtils::GetString(songurls, "title", videoLink.title); + XMLUtils::GetString(songurls, "musicbrainztrackid", videoLink.mbTrackID); + XMLUtils::GetString(songurls, "url", videoLink.videoURL); + XMLUtils::GetString(songurls, "thumburl", videoLink.thumbURL); + videolinks.emplace_back(std::move(videoLink)); + } + songurls = songurls->NextSiblingElement("videourl"); + } + // Support old style <fanart></fanart> for backwards compatibility of old nfo files and scrapers const TiXmlElement *fanart2 = artist->FirstChildElement("fanart"); if (fanart2) @@ -218,6 +237,16 @@ bool CArtist::Save(TiXmlNode *node, const std::string &tag, const std::string& s XMLUtils::SetString(node, "year", it.strYear); XMLUtils::SetString(node, "musicbrainzreleasegroupid", it.strReleaseGroupMBID); } + // song video links + for (const auto& it : videolinks) + { + TiXmlElement videolinkElement("videourl"); + TiXmlNode* node = artist->InsertEndChild(videolinkElement); + XMLUtils::SetString(node, "title", it.title); + XMLUtils::SetString(node, "musicbrainztrackid", it.mbTrackID); + XMLUtils::SetString(node, "url", it.videoURL); + XMLUtils::SetString(node, "thumburl", it.thumbURL); + } return true; } diff --git a/xbmc/music/Artist.h b/xbmc/music/Artist.h index 2ec77a8254..8791288f26 100644 --- a/xbmc/music/Artist.h +++ b/xbmc/music/Artist.h @@ -29,6 +29,14 @@ public: std::string strReleaseGroupMBID; }; +struct ArtistVideoLinks +{ + std::string title; + std::string mbTrackID; + std::string videoURL; + std::string thumbURL; +}; + class CArtist { public: @@ -76,6 +84,7 @@ public: dateNew.Reset(); bScrapedMBID = false; strLastScraped.clear(); + videolinks.clear(); } /*! \brief Load artist information from an XML file. @@ -117,6 +126,7 @@ public: CDateTime dateNew; // Time db record created bool bScrapedMBID = false; std::string strLastScraped; + std::vector<ArtistVideoLinks> videolinks; }; class CArtistCredit diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index 69819a98e4..dd54a6379a 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -203,6 +203,7 @@ void CMusicDatabase::CreateTables() " comment text, mood text, iBPM INTEGER NOT NULL DEFAULT 0, " " iBitRate INTEGER NOT NULL DEFAULT 0, " " iSampleRate INTEGER NOT NULL DEFAULT 0, iChannels INTEGER NOT NULL DEFAULT 0, " + " strVideoURL TEXT, " " strReplayGain text, " " dateAdded TEXT, dateNew TEXT, dateModified TEXT)"); CLog::Log(LOGINFO, "create song_artist table"); @@ -452,6 +453,7 @@ void CMusicDatabase::CreateViews() " iBitRate, " " iSampleRate, " " iChannels, " + " song.strVideoURL as strVideoURL, " " album.iAlbumDuration AS iAlbumDuration, " " album.iDiscTotal as iDiscTotal, " " song.dateAdded as dateAdded, " @@ -769,6 +771,7 @@ bool CMusicDatabase::AddAlbum(CAlbum& album, int idSource) song->userrating, // song->votes, // song->iBPM, song->iBitRate, song->iSampleRate, song->iChannels, // + song->songVideoURL, // song->replayGain); // Song must have at least one artist so set artist to [Missing] @@ -1019,6 +1022,7 @@ int CMusicDatabase::AddSong(const int idSong, int iBitRate, int iSampleRate, int iChannels, + const std::string& songVideoURL, const ReplayGain& replayGain) { int idNew = -1; @@ -1146,7 +1150,7 @@ int CMusicDatabase::AddSong(const int idSong, dtLastPlayed, // rating, userrating, votes, // replayGain, // - iBPM, iBitRate, iSampleRate, iChannels); + iBPM, iBitRate, iSampleRate, iChannels, songVideoURL); } if (!strThumb.empty()) SetArtForItem(idNew, MediaTypeSong, "thumb", strThumb); @@ -1238,7 +1242,8 @@ bool CMusicDatabase::UpdateSong(CSong& song, bool bArtists /*= true*/, bool bArt song.lastPlayed, // song.rating, song.userrating, song.votes, // song.replayGain, // - song.iBPM, song.iBitRate, song.iSampleRate, song.iChannels); + song.iBPM, song.iBitRate, song.iSampleRate, song.iChannels, // + song.songVideoURL); if (result < 0) return false; @@ -1297,7 +1302,8 @@ int CMusicDatabase::UpdateSong(int idSong, int iBPM, int iBitRate, int iSampleRate, - int iChannels) + int iChannels, + const std::string& songVideoURL) { if (idSong < 0) return -1; @@ -1319,7 +1325,7 @@ int CMusicDatabase::UpdateSong(int idSong, " strTitle = '%s', iTrack = %i, iDuration = %i, " "strReleaseDate = '%s', strOrigReleaseDate = '%s', strDiscSubtitle = '%s', " "strFileName = '%s', iBPM = %i, iBitrate = %i, iSampleRate = %i, iChannels = %i, " - "dateAdded = '%s'", + "dateAdded = '%s', strVideoURL = '%s'", idPath, artistDisp.c_str(), StringUtils::Join( genres, @@ -1327,7 +1333,7 @@ int CMusicDatabase::UpdateSong(int idSong, .c_str(), strTitle.c_str(), iTrack, iDuration, strRelease.c_str(), strOriginal.c_str(), strDiscSubtitle.c_str(), strFileName.c_str(), iBPM, iBitRate, iSampleRate, iChannels, - strDateMedia.c_str()); + strDateMedia.c_str(), songVideoURL.c_str()); if (strMusicBrainzTrackID.empty()) strSQL += PrepareSQL(", strMusicBrainzTrackID = NULL"); else @@ -1756,6 +1762,11 @@ bool CMusicDatabase::UpdateArtist(const CArtist& artist) AddArtistDiscography(artist.idArtist, disc); } + if (!DeleteArtistVideoLinks(artist.idArtist)) + CLog::Log(LOGERROR, "MusicDatabase: Error deleting ArtistVideoLinks"); + + AddArtistVideoLinks(artist); + // Set current artwork (held in art table) if (!artist.art.empty()) SetArtForItem(artist.idArtist, MediaTypeArtist, artist.art); @@ -2037,6 +2048,8 @@ bool CMusicDatabase::GetArtist(int idArtist, CArtist& artist, bool fetchAll /* = return false; if (nullptr == m_pDS) return false; + if (nullptr == m_pDS2) + return false; if (idArtist == -1) return false; // not in the database @@ -2057,7 +2070,7 @@ bool CMusicDatabase::GetArtist(int idArtist, CArtist& artist, bool fetchAll /* = m_pDS->close(); return false; } - + std::string debugSQL = strSQL + " - "; int discographyOffset = artist_enumCount; artist.discography.clear(); @@ -2077,12 +2090,36 @@ bool CMusicDatabase::GetArtist(int idArtist, CArtist& artist, bool fetchAll /* = } m_pDS->close(); // cleanup recordset data + artist.videolinks.clear(); + if (fetchAll) + { + strSQL = PrepareSQL("SELECT idSong, strTitle, strMusicBrainzTrackID, strVideoURL, url " + "FROM song JOIN album_artist ON song.idAlbum = album_artist.idAlbum " + "LEFT JOIN art ON art.media_id = song.idSong AND art.type = 'videothumb' " + "WHERE album_artist.idArtist = %i AND " + "song.strVideoURL is not NULL GROUP by song.strVideoURL ORDER BY idSong", + idArtist); + debugSQL += strSQL; + m_pDS->query(strSQL); + while (!m_pDS->eof()) + { + const dbiplus::sql_record* const record = m_pDS->get_sql_record(); + ArtistVideoLinks videoLink; + videoLink.title = record->at(1).get_asString(); + videoLink.mbTrackID = record->at(2).get_asString(); + videoLink.videoURL = record->at(3).get_asString(); + videoLink.thumbURL = record->at(4).get_asString(); + + artist.videolinks.emplace_back(std::move(videoLink)); + m_pDS->next(); + } + m_pDS->close(); + } + auto end = std::chrono::steady_clock::now(); auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); - CLog::Log(LOGDEBUG, LOGDATABASE, "{0}({1}) - took {2} ms", __FUNCTION__, strSQL, - duration.count()); - + CLog::LogF(LOGDEBUG, "{} - took {} ms", debugSQL, duration.count()); return true; } catch (...) @@ -2180,6 +2217,92 @@ bool CMusicDatabase::ClearArtistLastScrapedTime(int idArtist) return ExecuteQuery(strSQL); } +bool CMusicDatabase::AddArtistVideoLinks(const CArtist& artist) +{ + auto start = std::chrono::steady_clock::now(); + std::string dbSong; + + try + { + if (nullptr == m_pDB || nullptr == m_pDS || nullptr == m_pDS2) + return false; + + for (const auto& videoURL : artist.videolinks) + { + dbSong = videoURL.title; + std::string strSQL = PrepareSQL( + "SELECT idSong, strTitle FROM song WHERE strMusicBrainzTrackID = '%s' OR (EXISTS " + "(SELECT 1 FROM album_artist WHERE album_artist.idAlbum = song.idAlbum AND " + "album_artist.idArtist = '%i' AND song.strTitle LIKE '%%%s%%'))", + videoURL.mbTrackID.c_str(), artist.idArtist, videoURL.title.c_str()); + + if (!m_pDS->query(strSQL)) + return false; + if (m_pDS->num_rows() == 0) + continue; + + while (!m_pDS->eof()) + { + const int songId = m_pDS->fv(0).get_asInt(); + std::string strSQL2 = PrepareSQL("UPDATE song SET strVideoURL='%s' WHERE idSong = %i", + videoURL.videoURL.c_str(), songId); + CLog::Log(LOGDEBUG, "Adding videolink for song {} with id {}", dbSong.c_str(), songId); + m_pDS2->exec(strSQL2); + + if (!videoURL.thumbURL.empty()) + { // already have a videothumb for this song ? + strSQL2 = PrepareSQL("SELECT art_id FROM art " + "WHERE media_id=%i AND media_type='%s' AND type='videothumb'", + songId, MediaTypeSong); + m_pDS2->query(strSQL2); + if (!m_pDS2->eof()) + { // update existing thumb + const int artId = m_pDS2->fv(0).get_asInt(); + m_pDS2->close(); + strSQL2 = PrepareSQL("UPDATE art SET url='%s' where art_id=%d", + videoURL.thumbURL.c_str(), artId); + m_pDS2->exec(strSQL2); + } + else + { // insert new thumb + m_pDS2->close(); + strSQL2 = PrepareSQL("INSERT INTO art(media_id, media_type, type, url) " + "VALUES (%d, '%s', '%s', '%s')", + songId, MediaTypeSong, "videothumb", videoURL.thumbURL.c_str()); + m_pDS2->exec(strSQL2); + } + m_pDS2->close(); + } + m_pDS->next(); + } + m_pDS->close(); + } + auto end = std::chrono::steady_clock::now(); + auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); + CLog::LogF(LOGDEBUG, "Time to store videolinks {}ms ", duration.count()); + return true; + } + catch (...) + { + CLog::Log(LOGERROR, "MusicDatabase: Unable to add videolink for song ({})", dbSong.c_str()); + return false; + } +} + +bool CMusicDatabase::DeleteArtistVideoLinks(const int idArtist) +{ + std::string strSQL = PrepareSQL("UPDATE song SET strVideoURL = NULL WHERE idAlbum IN " + "(SELECT idAlbum FROM album_artist WHERE idArtist = %i)", + idArtist); + if (!ExecuteQuery(strSQL)) + return false; + strSQL = PrepareSQL( + "DELETE FROM art WHERE art.type = 'videothumb' AND art.media_id IN (SELECT idSong FROM song " + "JOIN album_artist ON song.idAlbum = album_artist.idAlbum WHERE album_artist.idArtist = %i)", + idArtist); + return ExecuteQuery(strSQL); +} + int CMusicDatabase::AddArtistDiscography(int idArtist, const CDiscoAlbum& discoAlbum) { std::string strSQL = PrepareSQL("INSERT INTO discography " @@ -2994,6 +3117,7 @@ CSong CMusicDatabase::GetSongFromDataset(const dbiplus::sql_record* const record song.iBitRate = record->at(offset + song_iBitRate).get_asInt(); song.iSampleRate = record->at(offset + song_iSampleRate).get_asInt(); song.iChannels = record->at(offset + song_iChannels).get_asInt(); + song.songVideoURL = record->at(offset + song_songVideoURL).get_asString(); return song; } @@ -3056,6 +3180,7 @@ void CMusicDatabase::GetFileItemFromDataset(const dbiplus::sql_record* const rec replaygain.Set(record->at(song_strReplayGain).get_asString()); item->GetMusicInfoTag()->SetReplayGain(replaygain); item->GetMusicInfoTag()->SetTotalDiscs(record->at(song_iDiscTotal).get_asInt()); + item->GetMusicInfoTag()->SetSongVideoURL(record->at(song_songVideoURL).get_asString()); item->GetMusicInfoTag()->SetLoaded(true); // Get filename with full path @@ -7578,6 +7703,7 @@ static const translateJSONField JSONtoDBSong[] = { { "bitrate", "integer", true, "iBitRate", "" }, { "samplerate", "integer", true, "iSampleRate", "" }, { "channels", "integer", true, "iChannels", "" }, + { "songvideourl", "string", true, "strVideoURL", "" }, // JOIN fields (multivalue), same order as _JoinToSongFields { "albumartistid", "array", false, "idAlbumArtist", "album_artist.idArtist AS idAlbumArtist" }, @@ -9288,6 +9414,10 @@ void CMusicDatabase::UpdateTables(int version) m_pDS->exec("DROP TABLE artist"); m_pDS->exec("ALTER TABLE artist_new RENAME TO artist"); } + + if (version < 83) + m_pDS->exec("ALTER TABLE song ADD strVideoURL TEXT"); + // Set the version of tag scanning required. // Not every schema change requires the tags to be rescanned, set to the highest schema version // that needs this. Forced rescanning (of music files that have not changed since they were @@ -9308,7 +9438,7 @@ void CMusicDatabase::UpdateTables(int version) int CMusicDatabase::GetSchemaVersion() const { - return 82; + return 83; } int CMusicDatabase::GetMusicNeedsTagScan() diff --git a/xbmc/music/MusicDatabase.h b/xbmc/music/MusicDatabase.h index 8544eb297d..791ff3d9cd 100644 --- a/xbmc/music/MusicDatabase.h +++ b/xbmc/music/MusicDatabase.h @@ -140,6 +140,7 @@ public: \param rating [in] a rating for the song \param userrating [in] a userrating (my rating) for the song \param votes [in] a vote counter for the song rating + \param songVideoURL [in] url to video of the song \param replayGain [in] album and track replaygain and peak values \return the id of the song */ @@ -171,6 +172,7 @@ public: int iBitRate, int iSampleRate, int iChannels, + const std::string& songVideoURL, const ReplayGain& replayGain); bool GetSong(int idSong, CSong& song); @@ -210,6 +212,7 @@ public: \param iBitRate [in] the bitrate of the song file \param iSampleRate [in] the sample rate of the song file \param iChannels [in] the number of audio channels in the song file + \param songVideoURL [in] url link to a video of the song \return the id of the song */ int UpdateSong(int idSong, @@ -238,7 +241,8 @@ public: int iBPM, int iBitRate, int iSampleRate, - int iChannels); + int iChannels, + const std::string& songVideoURL); //// Misc Song bool GetSongByFileName(const std::string& strFileName, CSong& song, int64_t startOffset = 0); @@ -405,6 +409,8 @@ public: int AddArtistDiscography(int idArtist, const CDiscoAlbum& discoAlbum); bool DeleteArtistDiscography(int idArtist); bool GetArtistDiscography(int idArtist, CFileItemList& items); + bool AddArtistVideoLinks(const CArtist& artist); + bool DeleteArtistVideoLinks(const int idArtist); std::string GetArtistById(int id); int GetArtistByName(const std::string& strArtist); @@ -1017,6 +1023,7 @@ private: song_iBitRate, song_iSampleRate, song_iChannels, + song_songVideoURL, song_iAlbumDuration, song_iDiscTotal, song_dateAdded, diff --git a/xbmc/music/Song.cpp b/xbmc/music/Song.cpp index 165889ca92..93b2156d7b 100644 --- a/xbmc/music/Song.cpp +++ b/xbmc/music/Song.cpp @@ -75,6 +75,7 @@ CSong::CSong(CFileItem& item) iSampleRate = tag.GetSampleRate(); iBitRate = tag.GetBitRate(); iChannels = tag.GetNoOfChannels(); + songVideoURL = tag.GetSongVideoURL(); } CSong::CSong() @@ -239,6 +240,7 @@ void CSong::Serialize(CVariant& value) const value["bitrate"] = iBitRate; value["samplerate"] = iSampleRate; value["channels"] = iChannels; + value["songvideourl"] = songVideoURL; } void CSong::Clear() @@ -279,6 +281,7 @@ void CSong::Clear() iBitRate = 0; iSampleRate = 0; iChannels = 0; + songVideoURL.clear(); replayGain = ReplayGain(); } diff --git a/xbmc/music/Song.h b/xbmc/music/Song.h index 3fc127a60f..737ba46eed 100644 --- a/xbmc/music/Song.h +++ b/xbmc/music/Song.h @@ -194,6 +194,7 @@ public: int iChannels; std::string strRecordLabel; // Record label from tag for album processing by CMusicInfoScanner::FileItemsToAlbums std::string strAlbumType; // (Musicbrainz release type) album type from tag for album processing by CMusicInfoScanner::FileItemsToAlbums + std::string songVideoURL; // url to song video ReplayGain replayGain; private: diff --git a/xbmc/music/tags/MusicInfoTag.cpp b/xbmc/music/tags/MusicInfoTag.cpp index 62548bf5d5..50c7ae773b 100644 --- a/xbmc/music/tags/MusicInfoTag.cpp +++ b/xbmc/music/tags/MusicInfoTag.cpp @@ -323,6 +323,11 @@ const std::string& CMusicInfoTag::GetStationArt() const return m_stationArt; } +const std::string& CMusicInfoTag::GetSongVideoURL() const +{ + return m_songVideoURL; +} + void CMusicInfoTag::SetURL(const std::string& strURL) { m_strURL = strURL; @@ -774,6 +779,11 @@ void CMusicInfoTag::SetStationArt(const std::string& strStationArt) m_stationArt = strStationArt; } +void CMusicInfoTag::SetSongVideoURL(const std::string& songVideoURL) +{ + m_songVideoURL = songVideoURL; +} + void CMusicInfoTag::SetArtist(const CArtist& artist) { SetArtist(artist.strArtist); @@ -882,6 +892,7 @@ void CMusicInfoTag::SetSong(const CSong& song) SetBitRate(song.iBitRate); SetSampleRate(song.iSampleRate); SetNoOfChannels(song.iChannels); + SetSongVideoURL(song.songVideoURL); if (song.replayGain.Get(ReplayGain::TRACK).Valid()) m_replayGain.Set(ReplayGain::TRACK, song.replayGain.Get(ReplayGain::TRACK)); @@ -970,6 +981,7 @@ void CMusicInfoTag::Serialize(CVariant& value) const value["bitrate"] = m_bitrate; value["samplerate"] = m_samplerate; value["channels"] = m_channels; + value["songvideourl"] = m_songVideoURL; } void CMusicInfoTag::ToSortable(SortItem& sortable, Field field) const @@ -1071,6 +1083,7 @@ void CMusicInfoTag::Archive(CArchive& ar) ar << m_samplerate; ar << m_bitrate; ar << m_channels; + ar << m_songVideoURL; } else { @@ -1138,6 +1151,7 @@ void CMusicInfoTag::Archive(CArchive& ar) ar >> m_samplerate; ar >> m_bitrate; ar >> m_channels; + ar >> m_songVideoURL; } } @@ -1193,6 +1207,7 @@ void CMusicInfoTag::Clear() m_channels = 0; m_stationName.clear(); m_stationArt.clear(); + m_songVideoURL.clear(); } void CMusicInfoTag::AppendArtist(const std::string &artist) diff --git a/xbmc/music/tags/MusicInfoTag.h b/xbmc/music/tags/MusicInfoTag.h index 3c1b994425..0b264a9301 100644 --- a/xbmc/music/tags/MusicInfoTag.h +++ b/xbmc/music/tags/MusicInfoTag.h @@ -85,6 +85,7 @@ public: const std::string& GetAlbumReleaseStatus() const; const std::string& GetStationName() const; const std::string& GetStationArt() const; + const std::string& GetSongVideoURL() const; const EmbeddedArtInfo &GetCoverArtInfo() const; const ReplayGain& GetReplayGain() const; CAlbum::ReleaseType GetAlbumReleaseType() const; @@ -157,6 +158,7 @@ public: void SetAlbumReleaseStatus(const std::string& strReleaseStatus); void SetStationName(const std::string& strStationName); // name of online radio station void SetStationArt(const std::string& strStationArt); + void SetSongVideoURL(const std::string& songVideoURL); // link to video of song /*! \brief Append a unique artist to the artist list Checks if we have this artist already added, and if not adds it to the songs artist list. @@ -255,6 +257,7 @@ protected: int m_bitrate; std::string m_stationName; std::string m_stationArt; // Used to fetch thumb URL for Shoutcasts + std::string m_songVideoURL; // link to a video for a song EmbeddedArtInfo m_coverArt; ///< art information diff --git a/xbmc/rendering/dx/DeviceResources.cpp b/xbmc/rendering/dx/DeviceResources.cpp index 8cfe5cf62c..103809d591 100644 --- a/xbmc/rendering/dx/DeviceResources.cpp +++ b/xbmc/rendering/dx/DeviceResources.cpp @@ -729,7 +729,6 @@ void DX::DeviceResources::ResizeBuffers() ComPtr<IDXGIDevice1> dxgiDevice; hr = m_d3dDevice.As(&dxgiDevice); CHECK_ERR(); dxgiDevice->SetMaximumFrameLatency(1); - m_usedSwapChain = false; if (m_IsHDROutput) SetHdrColorSpace(DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020); @@ -960,7 +959,6 @@ void DX::DeviceResources::HandleDeviceLost(bool removed) bool DX::DeviceResources::Begin() { HRESULT hr = m_swapChain->Present(0, DXGI_PRESENT_TEST); - m_usedSwapChain = true; // If the device was removed either by a disconnection or a driver upgrade, we // must recreate all device resources. @@ -992,7 +990,6 @@ void DX::DeviceResources::Present() // frames that will never be displayed to the screen. DXGI_PRESENT_PARAMETERS parameters = {}; HRESULT hr = m_swapChain->Present1(1, 0, ¶meters); - m_usedSwapChain = true; // If the device was removed either by a disconnection or a driver upgrade, we // must recreate all device resources. @@ -1311,23 +1308,6 @@ void DX::DeviceResources::SetHdrColorSpace(const DXGI_COLOR_SPACE_TYPE colorSpac if (SUCCEEDED(m_swapChain.As(&swapChain3))) { - // Set the color space on a new swap chain - not mandated by MS documentation but needed - // at least for some AMD on Windows 10, at least up to driver 31.0.21001.45002 - // Applying to AMD only because it breaks refresh rate switching in Windows 11 for Intel and - // nVidia and they don't need the workaround. - if (m_usedSwapChain && - m_IsTransferPQ != (colorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020)) - { - if (GetAdapterDesc().VendorId == PCIV_AMD) - { - // Temporary release, can't hold references during swap chain re-creation - swapChain3 = nullptr; - DestroySwapChain(); - CreateWindowSizeDependentResources(); - m_swapChain.As(&swapChain3); - } - } - if (SUCCEEDED(swapChain3->SetColorSpace1(colorSpace))) { m_IsTransferPQ = (colorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020); diff --git a/xbmc/rendering/dx/DeviceResources.h b/xbmc/rendering/dx/DeviceResources.h index 01fa76a659..8d325ee6dc 100644 --- a/xbmc/rendering/dx/DeviceResources.h +++ b/xbmc/rendering/dx/DeviceResources.h @@ -188,7 +188,6 @@ namespace DX bool m_NV12SharedTexturesSupport{false}; bool m_DXVA2SharedDecoderSurfaces{false}; bool m_DXVASuperResolutionSupport{false}; - bool m_usedSwapChain{false}; bool m_DXVA2UseFence{false}; }; } diff --git a/xbmc/video/tags/VideoTagExtractionHelper.cpp b/xbmc/video/tags/VideoTagExtractionHelper.cpp index 5ce567aed9..b331305fc4 100644 --- a/xbmc/video/tags/VideoTagExtractionHelper.cpp +++ b/xbmc/video/tags/VideoTagExtractionHelper.cpp @@ -21,10 +21,9 @@ using namespace VIDEO::TAGS; bool CVideoTagExtractionHelper::IsExtractionSupportedFor(const CFileItem& item) { - const std::string fileNameAndPath = item.GetVideoInfoTag()->m_strFileNameAndPath; return CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool( CSettings::SETTING_MYVIDEOS_USETAGS) && - URIUtils::HasExtension(fileNameAndPath, ".mkv|.mp4|.avi|.m4v"); + URIUtils::HasExtension(item.GetDynPath(), ".mkv|.mp4|.avi|.m4v"); } std::string CVideoTagExtractionHelper::ExtractEmbeddedArtFor(const CFileItem& item, @@ -36,10 +35,7 @@ std::string CVideoTagExtractionHelper::ExtractEmbeddedArtFor(const CFileItem& it for (const auto& it : tag.m_coverArt) { if (it.m_type == artType) - { - return CTextureUtils::GetWrappedImageURL(item.GetVideoInfoTag()->m_strFileNameAndPath, - "video_" + artType); - } + return CTextureUtils::GetWrappedImageURL(item.GetDynPath(), "video_" + artType); } return {}; } |