Skip to content

Commit 834a840

Browse files
committed
search for OpenH264 library
1 parent 34b5204 commit 834a840

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

CMakeLists.txt

+26
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,23 @@ if (WITH_VVENC)
161161
endif()
162162
endif ()
163163

164+
# openh264 decoder
165+
166+
plugin_option(OPENH264_DECODER "OpenH264 decoder" ON OFF)
167+
plugin_option(OPENH264_ENCODER "OpenH264 encoder" ON OFF)
168+
if (WITH_OPENH264_ENCODER OR WITH_OPENH264_DECODER)
169+
find_package(OpenH264)
170+
171+
# When decoding/encoding is disabled, overwrite the *_FOUND variables, because they are used to ultimately decide what to build.
172+
# TODO
173+
if (OpenH264_FOUND AND WITH_OPENH264_DECODER)
174+
set(OpenH264_DECODER_FOUND TRUE)
175+
endif()
176+
if (OpenH264_FOUND AND WITH_OPENH264_ENCODER)
177+
set(OpenH264_ENCODER_FOUND TRUE)
178+
endif()
179+
endif()
180+
164181
# dav1d
165182

166183
plugin_option(DAV1D "Dav1d AV1 decoder" OFF ON)
@@ -248,6 +265,8 @@ plugin_compilation_info(SvtEnc SvtEnc "SVT AV1 encoder")
248265
plugin_compilation_info(RAV1E RAV1E "Rav1e AV1 encoder")
249266
plugin_compilation_info(JPEG_DECODER JPEG "JPEG decoder")
250267
plugin_compilation_info(JPEG_ENCODER JPEG "JPEG encoder")
268+
plugin_compilation_info(OpenH264_DECODER OpenH264_DECODER "OpenH264 decoder")
269+
plugin_compilation_info(OpenH264_ENCODER OpenH264_ENCODER "OpenH264 encoder")
251270
plugin_compilation_info(OpenJPEG_DECODER OpenJPEG "OpenJPEG J2K decoder")
252271
plugin_compilation_info(OpenJPEG_ENCODER OpenJPEG "OpenJPEG J2K encoder")
253272
# plugin_compilation_info(OPENJPH_DECODER OPENJPH "OpenJPH HT-J2K decoder")
@@ -316,6 +335,12 @@ endif()
316335
if (vvdec_FOUND AND WITH_VVDEC)
317336
set(SUPPORTS_VVC_DECODING TRUE)
318337
endif()
338+
if (OpenH264_DECODER_FOUND)
339+
set(SUPPORTS_AVC_DECODING TRUE)
340+
endif()
341+
if (OpenH264_ENCODER_FOUND)
342+
set(SUPPORTS_AVC_ENCODING TRUE)
343+
endif()
319344

320345
if (WITH_UNCOMPRESSED_CODEC)
321346
set(SUPPORTS_UNCOMPRESSED_DECODING TRUE)
@@ -327,6 +352,7 @@ message("format decoding encoding")
327352
format_compilation_info("HEIC" SUPPORTS_HEIC_DECODING SUPPORTS_HEIC_ENCODING)
328353
format_compilation_info("AVIF" SUPPORTS_AVIF_DECODING SUPPORTS_AVIF_ENCODING)
329354
format_compilation_info("VVC" SUPPORTS_VVC_DECODING SUPPORTS_VVC_ENCODING)
355+
format_compilation_info("AVC" SUPPORTS_AVC_DECODING SUPPORTS_AVC_ENCODING)
330356
format_compilation_info("JPEG" SUPPORTS_JPEG_DECODING SUPPORTS_JPEG_ENCODING)
331357
format_compilation_info("JPEG2000" SUPPORTS_J2K_DECODING SUPPORTS_J2K_ENCODING)
332358
format_compilation_info("JPEG2000-HT" SUPPORTS_J2K_HT_DECODING SUPPORTS_J2K_HT_ENCODING)

cmake/modules/FindOpenH264.cmake

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
include(LibFindMacros)
2+
include(CheckSymbolExists)
3+
4+
libfind_pkg_check_modules(OpenH264_PKGCONF openh264)
5+
6+
find_path(OpenH264_INCLUDE_DIR
7+
NAMES wels/codec_api.h
8+
HINTS ${OpenH264_PKGCONF_INCLUDE_DIRS} ${OpenH264_PKGCONF_INCLUDEDIR}
9+
PATH_SUFFIXES OpenH264
10+
)
11+
12+
find_library(OpenH264_LIBRARY
13+
NAMES libopenh264 openh264
14+
HINTS ${OpenH264_PKGCONF_LIBRARY_DIRS} ${OpenH264_PKGCONF_LIBDIR}
15+
)
16+
17+
set(OpenH264_PROCESS_LIBS OpenH264_LIBRARY)
18+
set(OpenH264_PROCESS_INCLUDES OpenH264_INCLUDE_DIR)
19+
libfind_process(OpenH264)
20+
21+
include(FindPackageHandleStandardArgs)
22+
find_package_handle_standard_args(OpenH264
23+
REQUIRED_VARS
24+
OpenH264_INCLUDE_DIR
25+
OpenH264_LIBRARIES
26+
)

0 commit comments

Comments
 (0)