From d3b135e3872ab5e9ad3baf456326b43a959ebefb Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 8 Nov 2021 17:58:36 +0100 Subject: [PATCH] Set the FFmpeg video player HW decoding as disabled by default. --- CMakeLists.txt | 26 +++++++------------ es-core/src/Settings.cpp | 4 +-- .../src/components/VideoFFmpegComponent.cpp | 6 ++--- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eafc59c04..1c20cee8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,13 +29,13 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Packages) # Define the options. -option(GLES "Set to ON if targeting Embedded OpenGL" ${GLES}) option(GL "Set to ON if targeting Desktop OpenGL" ${GL}) +option(GLES "Set to ON if targeting Embedded OpenGL" ${GLES}) option(RPI "Set to ON to enable Raspberry Pi specific build" ${RPI}) option(CEC "Set to ON to enable CEC" ${CEC}) +option(VIDEO_HW_DECODING "Set to ON to enable FFmpeg HW decoding" ${VIDEO_HW_DECODING}) option(VLC_PLAYER "Set to ON to build the VLC-based video player" ${VLC_PLAYER}) option(CLANG_TIDY "Set to ON to build using the clang-tidy static analyzer" ${CLANG_TIDY}) -option(VIDEO_HW_DECODING "Set to OFF to disable FFmpeg HW decoding" ON) if(CLANG_TIDY) find_program(CLANG_TIDY_BINARY NAMES clang-tidy) @@ -70,17 +70,11 @@ set_property(CACHE GLSYSTEM PROPERTY STRINGS "Desktop OpenGL" "Embedded OpenGL") #--------------------------------------------------------------------------------------------------- # Raspberry Pi setup. -# If manually set to RPI (used for testing purposes). -if(RPI) - set(VIDEO_HW_DECODING OFF) -endif() - # Raspberry Pi OS 32-bit (armv7l) if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h") set(RPI ON) set(RPI_32 ON) - set(VIDEO_HW_DECODING OFF) - set(BCMHOST found) + set(BCMHOST ON) message("-- Building on a Raspberry Pi (32-bit OS)") endif() @@ -88,8 +82,7 @@ endif() if(EXISTS "/usr/include/bcm_host.h") set(RPI ON) set(RPI_64 ON) - set(VIDEO_HW_DECODING OFF) - set(BCMHOST found) + set(BCMHOST ON) message("-- Building on a Raspberry Pi (64-bit OS)") endif() @@ -220,10 +213,6 @@ if(RPI) add_definitions(-D_RPI_) endif() -if(VLC_PLAYER) - add_definitions(-DBUILD_VLC_PLAYER) -endif() - if(DEFINED libCEC_FOUND) add_definitions(-DHAVE_LIBCEC) endif() @@ -232,6 +221,10 @@ if(VIDEO_HW_DECODING) add_definitions(-DVIDEO_HW_DECODING) endif() +if(VLC_PLAYER) + add_definitions(-DBUILD_VLC_PLAYER) +endif() + # GLM library options. add_definitions(-DGLM_FORCE_CXX17) add_definitions(-DGLM_FORCE_XYZW_ONLY) @@ -272,6 +265,7 @@ set(COMMON_INCLUDE_DIRS ${CURL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/external/nanosvg/src ${CMAKE_CURRENT_SOURCE_DIR}/external/rapidjson/include ${CMAKE_CURRENT_SOURCE_DIR}/es-core/src) + if(VLC_PLAYER) set(COMMON_INCLUDE_DIRS ${COMMON_INCLUDE_DIRS} ${VLC_INCLUDE_DIR}) endif() @@ -391,7 +385,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") endif() # Raspberry Pi. -if(DEFINED BCMHOST) +if(BCMHOST) list(APPEND COMMON_LIBRARIES bcm_host vchiq_arm) if(RPI_32) link_directories("${CMAKE_FIND_ROOT_PATH}/opt/vc/lib") diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index f066a4f76..211ac1465 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -229,7 +229,7 @@ void Settings::setDefaults() // Other settings. mStringMap["MediaDirectory"] = {"", ""}; #if defined(_RPI_) - mIntMap["MaxVRAM"] = {180, 180}; + mIntMap["MaxVRAM"] = {184, 184}; #else mIntMap["MaxVRAM"] = {256, 256}; #endif @@ -249,7 +249,7 @@ void Settings::setDefaults() #if defined(_WIN64) mBoolMap["LaunchWorkaround"] = {true, true}; #endif -#if !defined(VIDEO_HW_DECODING) +#if defined(VIDEO_HW_DECODING) mBoolMap["VideoHardwareDecoding"] = {false, false}; #endif mBoolMap["VideoUpscaleFrameRate"] = {false, false}; diff --git a/es-core/src/components/VideoFFmpegComponent.cpp b/es-core/src/components/VideoFFmpegComponent.cpp index 9bb31a8f3..5cb0ca94f 100644 --- a/es-core/src/components/VideoFFmpegComponent.cpp +++ b/es-core/src/components/VideoFFmpegComponent.cpp @@ -1227,10 +1227,10 @@ void VideoFFmpegComponent::startVideo() // Video stream setup. -#if !defined(VIDEO_HW_DECODING) - bool hwDecoding = false; -#else +#if defined(VIDEO_HW_DECODING) bool hwDecoding = Settings::getInstance()->getBool("VideoHardwareDecoding"); +#else + bool hwDecoding = false; #endif mVideoStreamIndex =