diff options
author | Artem Dyomin <artem.dyomin@qt.io> | 2023-11-09 23:48:41 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-11-10 15:54:55 +0000 |
commit | 8ee1ca1cd402b0908c2391e2110d71660b27512f (patch) | |
tree | 6bc9b532e16e59940f06d5e076e9d44af09c8612 | |
parent | 8acc4e5a92b4acd5607080e2f5e41683e30c81ef (diff) |
Fix dynamic symbols resolving if ffmpeg linked dynamically
* QtMM doesn't use openssl explicitly, loading openssl symbols
should be disabled if ffmpeg is linked dynamically.
* VAAPI-related warning message should be skipped for
dynamically linked ffmpeg as the message doesn't make sense.
Pick-to: 6.5
Change-Id: I89a4c70840f22117d65ef8eed3c40448555c57a0
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit fde8e3e7b9cdfd6b879603b919260f2d66dc7f7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | cmake/FindFFmpeg.cmake | 38 | ||||
-rw-r--r-- | src/plugins/multimedia/ffmpeg/CMakeLists.txt | 8 |
2 files changed, 24 insertions, 22 deletions
diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake index 5cb89c424..554788a31 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -174,10 +174,26 @@ set(FFMPEG_LIBRARIES "") set(FFMPEG_DEFINITIONS "") set(FFMPEG_LIBRARY_DIRS "") -# Apply dynamic symbols resolve for Linux build only. We might add Android and QNX as well. -if (ANDROID OR LINUX) +# Check for all possible component. +find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h) +find_component(AVFORMAT libavformat avformat libavformat/avformat.h) +find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) +find_component(AVUTIL libavutil avutil libavutil/avutil.h) +find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h) +find_component(SWSCALE libswscale swscale libswscale/swscale.h) +find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) +find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) + +# Linking to private FFmpeg libraries is only needed if it was built statically +# Only one of the components needs to be tested +if(AVCODEC_LIBRARY AND ${AVCODEC_LIBRARY} MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") + set(FFMPEG_IS_STATIC TRUE CACHE INTERNAL "") +endif() + +if (FFMPEG_IS_STATIC AND (ANDROID OR LINUX)) set(ENABLE_DYNAMIC_RESOLVE_OPENSSL_SYMBOLS TRUE CACHE INTERNAL "") endif() + set(ENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS ${LINUX} CACHE INTERNAL "") function(__try_add_dynamic_resolve_dependency dep added) @@ -237,22 +253,6 @@ endfunction() # Check for cached results. If there are skip the costly part. #if (NOT FFMPEG_LIBRARIES) - # Check for all possible component. - find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h) - find_component(AVFORMAT libavformat avformat libavformat/avformat.h) - find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) - find_component(AVUTIL libavutil avutil libavutil/avutil.h) - find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h) - find_component(SWSCALE libswscale swscale libswscale/swscale.h) - find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) - find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) - - # Linking to private FFmpeg libraries is only needed if it was built statically - # Only one of the components needs to be tested - if(AVCODEC_LIBRARY AND ${AVCODEC_LIBRARY} MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") - set(__ffmpeg_is_static TRUE) - endif() - # Check if the required components were found and add their stuff to the FFMPEG_* vars. foreach (_component ${FFmpeg_FIND_COMPONENTS}) if (${_component}_FOUND) @@ -274,7 +274,7 @@ endfunction() INTERFACE_LINK_LIBRARIES "${${_component}_LIBRARIES}" INTERFACE_LINK_DIRECTORIES "${${_component}_LIBRARY_DIRS}" ) - if(__ffmpeg_is_static) + if(FFMPEG_IS_STATIC) __ffmpeg_internal_set_dependencies(${_lowerComponent}) endif() target_link_libraries(FFmpeg::${_lowerComponent} INTERFACE "${${_component}_LIBRARY}") diff --git a/src/plugins/multimedia/ffmpeg/CMakeLists.txt b/src/plugins/multimedia/ffmpeg/CMakeLists.txt index 13c621af5..d23afd4e4 100644 --- a/src/plugins/multimedia/ffmpeg/CMakeLists.txt +++ b/src/plugins/multimedia/ffmpeg/CMakeLists.txt @@ -75,9 +75,11 @@ qt_internal_extend_target(QFFmpegMediaPlugin CONDITION DYNAMIC_RESOLVE_OPENSSL_S if (ENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS) if (QT_FEATURE_vaapi AND NOT DYNAMIC_RESOLVE_VAAPI_SYMBOLS) - message(WARNING - "QT_FEATURE_vaapi is found but ffmpeg doesn't include vaapi," - "however dynamic symbols resolve is possible.") + if (FFMPEG_IS_STATIC) + message(WARNING + "QT_FEATURE_vaapi is found but statically built ffmpeg doesn't include vaapi," + "however dynamic symbols resolve is possible.") + endif() set(DYNAMIC_RESOLVE_VAAPI_SYMBOLS TRUE CACHE INTERNAL "") elseif (NOT QT_FEATURE_vaapi AND DYNAMIC_RESOLVE_VAAPI_SYMBOLS) |