Decouple ffmpeg video encoder/decoder support from WITH_FFMPEG

It may be diesirable to only use FFMPEG for audio. Allow disabling
video decoding by introducing a new variable responsible for that.
This commit is contained in:
akallabeth 2022-07-05 17:30:35 +02:00 committed by akallabeth
parent 168117e85b
commit c71cc672f9
8 changed files with 20 additions and 17 deletions

View File

@ -736,6 +736,10 @@ find_feature(Pulse ${PULSE_FEATURE_TYPE} ${PULSE_FEATURE_PURPOSE} ${PULSE_FEATUR
find_feature(Cups ${CUPS_FEATURE_TYPE} ${CUPS_FEATURE_PURPOSE} ${CUPS_FEATURE_DESCRIPTION})
find_feature(PCSC ${PCSC_FEATURE_TYPE} ${PCSC_FEATURE_PURPOSE} ${PCSC_FEATURE_DESCRIPTION})
if (WITH_DSP_FFMPEG OR WITH_VIDEO_FFMPEG OR WITH_FFMPEG)
set(FFMPEG_FEATURE_TYPE "REQUIRED" )
endif()
find_feature(FFmpeg ${FFMPEG_FEATURE_TYPE} ${FFMPEG_FEATURE_PURPOSE} ${FFMPEG_FEATURE_DESCRIPTION})
find_feature(JPEG ${JPEG_FEATURE_TYPE} ${JPEG_FEATURE_PURPOSE} ${JPEG_FEATURE_DESCRIPTION})
@ -752,11 +756,6 @@ if (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING)
option(WITH_OPENH264_LOADING "Use LoadLibrary to load openh264 at runtime" OFF)
endif (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING)
if ((WITH_FFMPEG OR WITH_DSP_FFMPEG) AND NOT FFMPEG_FOUND)
message(FATAL_ERROR "FFMPEG support requested but not detected")
endif()
set(WITH_FFMPEG ${FFMPEG_FOUND})
# Version check, if we have detected FFMPEG but the version is too old
# deactivate it as sound backend.
if (WITH_DSP_FFMPEG)
@ -806,7 +805,7 @@ if(MBEDTLS_FOUND)
add_definitions("-DWITH_MBEDTLS")
endif()
if (WITH_OPENH264 OR WITH_MEDIA_FOUNDATION OR WITH_FFMPEG OR WITH_MEDIACODEC)
if (WITH_OPENH264 OR WITH_MEDIA_FOUNDATION OR WITH_VIDEO_FFMPEG OR WITH_MEDIACODEC)
set(WITH_GFX_H264 ON)
else()
set(WITH_GFX_H264 OFF)

View File

@ -81,7 +81,7 @@ target_link_libraries(${MODULE_NAME} freerdp winpr)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client")
if(WITH_FFMPEG)
if(WITH_VIDEO_FFMPEG)
add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "ffmpeg" "decoder")
endif()

View File

@ -73,7 +73,7 @@ ITSMFDecoder* tsmf_load_decoder(const char* name, TS_AM_MEDIA_TYPE* media_type)
decoder = tsmf_load_decoder_by_name("gstreamer");
#endif
#if defined(WITH_FFMPEG)
#if defined(WITH_VIDEO_FFMPEG)
if (!decoder)
decoder = tsmf_load_decoder_by_name("ffmpeg");
#endif
@ -104,7 +104,7 @@ BOOL tsmf_check_decoder_available(const char* name)
decoder = tsmf_load_decoder_by_name("gstreamer");
#endif
#if defined(WITH_FFMPEG)
#if defined(WITH_VIDEO_FFMPEG)
if (!decoder)
decoder = tsmf_load_decoder_by_name("ffmpeg");
#endif

View File

@ -149,10 +149,14 @@ option(WITH_CCACHE "Use ccache support if available" ON)
option(WITH_CLANG_FORMAT "Detect clang-format. run 'cmake --build . --target clangformat' to format." ON)
option(WITH_DSP_EXPERIMENTAL "Enable experimental sound encoder/decoder formats" OFF)
if (WITH_FFMPEG)
option(WITH_DSP_FFMPEG "Use FFMPEG for audio encoding/decoding" OFF)
option(WITH_VAAPI "Use FFMPEG VAAPI" OFF)
endif(WITH_FFMPEG)
option(WITH_FFMPEG "Enable FFMPEG for audio/video encoding/decoding" OFF)
CMAKE_DEPENDENT_OPTION(WITH_DSP_FFMPEG "Use FFMPEG for audio encoding/decoding" OFF
"WITH_FFMPEG" OFF)
CMAKE_DEPENDENT_OPTION(WITH_VIDEO_FFMPEG "Use FFMPEG for video encoding/decoding" ON
"WITH_FFMPEG" OFF)
CMAKE_DEPENDENT_OPTION(WITH_VAAPI "Use FFMPEG VAAPI" OFF
"WITH_VIDEO_FFMPEG" OFF)
option(USE_VERSION_FROM_GIT_TAG "Extract FreeRDP version from git tag." ON)

View File

@ -40,7 +40,7 @@
#cmakedefine WITH_GFX_H264
#cmakedefine WITH_OPENH264
#cmakedefine WITH_OPENH264_LOADING
#cmakedefine WITH_FFMPEG
#cmakedefine WITH_VIDEO_FFMPEG
#cmakedefine WITH_DSP_EXPERIMENTAL
#cmakedefine WITH_DSP_FFMPEG
#cmakedefine WITH_OPENCL

View File

@ -241,7 +241,7 @@ if(WITH_OPENH264)
endif (NOT WITH_OPENH264_LOADING)
endif()
if(WITH_FFMPEG)
if(WITH_VIDEO_FFMPEG)
set(CODEC_SRCS ${CODEC_SRCS} codec/h264_ffmpeg.c)
freerdp_include_directory_add(${FFMPEG_INCLUDE_DIRS})
freerdp_library_add(${FFMPEG_LIBRARIES})

View File

@ -605,7 +605,7 @@ static BOOL CALLBACK h264_register_subsystems(PINIT_ONCE once, PVOID param, PVOI
i++;
}
#endif
#ifdef WITH_FFMPEG
#ifdef WITH_VIDEO_FFMPEG
{
subSystems[i] = &g_Subsystem_libavcodec;
i++;

View File

@ -60,7 +60,7 @@ extern "C"
#ifdef WITH_OPENH264
extern const H264_CONTEXT_SUBSYSTEM g_Subsystem_OpenH264;
#endif
#ifdef WITH_FFMPEG
#ifdef WITH_VIDEO_FFMPEG
extern const H264_CONTEXT_SUBSYSTEM g_Subsystem_libavcodec;
#endif