Commit 4a78ccd8 authored by Ghislain MARY's avatar Ghislain MARY

Merge branch 'feature/h26x-build-cleaning'

parents 0c875b0a ab6fea06
Pipeline #349 failed with stage
in 0 seconds
......@@ -106,8 +106,6 @@ cmake_dependent_option(ENABLE_THEORA "Enable theora video codec support." YES "E
cmake_dependent_option(ENABLE_VPX "Build mediastreamer2 with VPX codec." YES "ENABLE_VIDEO" NO)
option(ENABLE_MKV "Enable support of MKV files reading and writing." YES)
cmake_dependent_option(ENABLE_QNX "Build medistreamer2 with BB10 filters." NO "ENABLE_VIDEO" NO)
cmake_dependent_option(ENABLE_VT_H264 "Build mediastreamer2 with H264 encoder/decoder based on VirtualToolbox (Apple only)" YES "ENABLE_VIDEO" NO)
cmake_dependent_option(ENABLE_VT_H265 "Build mediastreamer2 with H265 encoder/decoder based on VirtualToolbox (Apple only)" YES "ENABLE_VIDEO" NO)
option(ENABLE_JPEG "Enable JPEG support" YES)
option(ENABLE_QRCODE "Enable QRCode support" YES)
......@@ -539,10 +537,7 @@ if(APPLE)
if(IOS) # Necessary for Mediastreamer's tools and testers
list(APPEND LINK_FLAGS "-framework Foundation" "-framework QuartzCore" "-framework OpenGLES" "-framework UIKit" "-framework AVFoundation")
if(ENABLE_VIDEO)
list(APPEND LINK_FLAGS "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo")
if(ENABLE_VT_H264 OR ENABLE_VT_H265) # Necessary on iOS for Mediastreamer's tools and testers
list(APPEND LINK_FLAGS "-framework VideoToolbox")
endif()
list(APPEND LINK_FLAGS "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework VideoToolbox")
endif()
else()
list(APPEND LINK_FLAGS "-framework AppKit")
......@@ -550,10 +545,7 @@ if(APPLE)
list(APPEND LINK_FLAGS "-framework Carbon" "-framework AudioUnit")
endif()
if(ENABLE_VIDEO)
list(APPEND LINK_FLAGS "-framework Cocoa" "-framework OpenGL" "-framework QuartzCore" "-framework AVFoundation")
if(ENABLE_VT_H264 OR ENABLE_VT_H265)
list(APPEND LINK_FLAGS "-framework VideoToolbox -framework CoreMedia")
endif()
list(APPEND LINK_FLAGS "-framework Cocoa" "-framework OpenGL" "-framework QuartzCore" "-framework AVFoundation" "-framework VideoToolbox" "-framework CoreMedia")
endif()
add_definitions("-DTARGET_OS_MAC=1")
endif()
......
......@@ -505,7 +505,7 @@ if(APPLE OR ANDROID OR OPENGL_FOUND OR GLX_FOUND OR QTANGLE_FOUND)
)
endif()
if (ENABLE_VT_H264 OR ENALBLE_VT_H265 OR ANDROID)
if(ENABLE_VIDEO)
add_subdirectory(voip/h26x)
endif()
......@@ -514,13 +514,6 @@ bc_apply_compile_flags(VOIP_SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_
if(VOIP_SOURCE_FILES_CXX)
set_source_files_properties(${VOIP_SOURCE_FILES_CXX} PROPERTIES LANGUAGE CXX)
bc_apply_compile_flags(VOIP_SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
if (APPLE AND ENABLE_VT_H265 AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"))
set_source_files_properties(
voip/h26x/videotoolbox-utils.cpp
voip/h26x/videotoolbox.cpp
PROPERTIES COMPILE_DEFINITIONS "ENABLE_H265"
)
endif()
endif()
......
############################################################################
# CMakeLists.txt
# Copyright (C) 2018 Belledonne Communications, Grenoble France
# Copyright (C) 2010-2018 Belledonne Communications, Grenoble France
#
############################################################################
#
......@@ -35,26 +35,18 @@ list(APPEND VOIP_SOURCE_FILES_CXX
${CMAKE_CURRENT_SOURCE_DIR}/rfc3984.cpp
)
if (APPLE)
if(APPLE)
list(APPEND VOIP_SOURCE_FILES_CXX
${CMAKE_CURRENT_SOURCE_DIR}/videotoolbox.cpp
${CMAKE_CURRENT_SOURCE_DIR}/videotoolbox-decoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/videotoolbox-encoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/videotoolbox-utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/videotoolbox-h264-utilities.cpp
${CMAKE_CURRENT_SOURCE_DIR}/videotoolbox-h265-utilities.cpp
)
if (ENABLE_VT_H264)
list(APPEND VOIP_SOURCE_FILES_CXX
${CMAKE_CURRENT_SOURCE_DIR}/videotoolbox-h264-utilities.cpp
)
endif()
if(ENABLE_VT_H265 AND APPLE AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"))
list(APPEND VOIP_SOURCE_FILES_CXX
${CMAKE_CURRENT_SOURCE_DIR}/videotoolbox-h265-utilities.cpp
)
endif()
endif()
if (ANDROID)
if(ANDROID)
list(APPEND VOIP_SOURCE_FILES_CXX
${CMAKE_CURRENT_SOURCE_DIR}/media-codec-decoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/media-codec-encoder.cpp
......@@ -66,3 +58,4 @@ if (ANDROID)
endif()
set(VOIP_SOURCE_FILES_CXX ${VOIP_SOURCE_FILES_CXX} PARENT_SCOPE)
......@@ -21,9 +21,7 @@
#include <unordered_map>
#include "videotoolbox-h264-utilities.h"
#ifdef ENABLE_H265
#include "videotoolbox-h265-utilities.h"
#endif
#include "videotoolbox-utils.h"
......@@ -120,13 +118,9 @@ CMFormatDescriptionRef VideoToolboxUtilities::createFormatDescription(const H26x
VideoToolboxUtilities *VideoToolboxUtilities::create(const std::string &mime) {
if (mime == "video/avc") {
return new VideoToolboxH264Utilities();
}
#ifdef ENABLE_H265
else if (mime == "video/hevc") {
} else if (mime == "video/hevc") {
return new VideoToolboxH265Utilities();
}
#endif
else {
} else {
throw invalid_argument(mime + " not supported");
}
}
......
......@@ -52,7 +52,6 @@ public:
VideoToolboxH264DecoderFilterImpl(MSFilter *f): H26xDecoderFilter(f, new VideoToolboxDecoder("video/avc")) {}
};
#ifdef ENABLE_H265
class VideoToolboxH265EncoderFilterImpl: public H26xEncoderFilter {
public:
VideoToolboxH265EncoderFilterImpl(MSFilter *f): H26xEncoderFilter(f, new VideoToolboxEncoder("video/hevc"), vth264enc_video_confs) {}
......@@ -62,7 +61,6 @@ class VideoToolboxH265DecoderFilterImpl: public H26xDecoderFilter {
public:
VideoToolboxH265DecoderFilterImpl(MSFilter *f): H26xDecoderFilter(f, new VideoToolboxDecoder("video/hevc")) {}
};
#endif
} // namespace mediastreamer
......@@ -74,13 +72,11 @@ MS_ENCODING_FILTER_WRAPPER_DESCRIPTION_DECLARATION(VideoToolboxH264Encoder, MS_V
MS_DECODING_FILTER_WRAPPER_METHODS_DECLARATION(VideoToolboxH264Decoder);
MS_DECODING_FILTER_WRAPPER_DESCRIPTION_DECLARATION(VideoToolboxH264Decoder, MS_VT_H264_DEC_ID, "H264 hardware decoder for iOS and MacOSX", "H264", MS_FILTER_IS_PUMP);
#ifdef ENABLE_H265
MS_ENCODING_FILTER_WRAPPER_METHODS_DECLARATION(VideoToolboxH265Encoder);
MS_ENCODING_FILTER_WRAPPER_DESCRIPTION_DECLARATION(VideoToolboxH265Encoder, MS_VT_H265_ENC_ID, "H265 hardware encoder for iOS and MacOSX", "H265", MS_FILTER_IS_PUMP);
MS_DECODING_FILTER_WRAPPER_METHODS_DECLARATION(VideoToolboxH265Decoder);
MS_DECODING_FILTER_WRAPPER_DESCRIPTION_DECLARATION(VideoToolboxH265Decoder, MS_VT_H265_DEC_ID, "H265 hardware decoder for iOS and MacOSX", "H265", MS_FILTER_IS_PUMP);
#endif
extern "C" void _register_videotoolbox_if_supported(MSFactory *factory) {
#if TARGET_OS_SIMULATOR
......@@ -95,7 +91,7 @@ extern "C" void _register_videotoolbox_if_supported(MSFactory *factory) {
"requires iOS 8 or MacOS 10.8");
}
#if TARGET_OS_IPHONE && defined(ENABLE_H265)
#if TARGET_OS_IPHONE
if (kCFCoreFoundationVersionNumber >= 1400) { // MacOS >= 10.13 or iOS >= 11.0
ms_message("Registering VideoToolbox H265 codec");
ms_factory_register_filter(factory, &ms_VideoToolboxH265Encoder_desc);
......@@ -104,7 +100,7 @@ extern "C" void _register_videotoolbox_if_supported(MSFactory *factory) {
ms_message("Cannot register VideoToolbox H265 codec. That "
"requires iOS 11.0 or MacOS 10.13");
}
#endif // TARGET_OS_IPHONE && defined(ENABLE_H265)
#endif // TARGET_OS_IPHONE
#endif // !TARGET_OS_SIMULATOR
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment