Skip to content

Commit

Permalink
Decouple ffmpeg video encoder/decoder support from WITH_FFMPEG
Browse files Browse the repository at this point in the history
It may be diesirable to only use FFMPEG for audio. Allow disabling
video decoding by introducing a new variable responsible for that.
  • Loading branch information
akallabeth committed Jul 5, 2022
1 parent 168117e commit c71cc67
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion channels/tsmf/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions channels/tsmf/client/tsmf_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions cmake/ConfigOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion include/config/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libfreerdp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion libfreerdp/codec/h264.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion libfreerdp/codec/h264.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c71cc67

Please sign in to comment.