Skip to content

Commit 411ad8e

Browse files
committed
Add FFmpeg interface
This feature is experimental and not fully validated. Use at your own risk, behavior may change or be removed in future revisions.
1 parent 7ccb497 commit 411ad8e

File tree

11 files changed

+714
-22
lines changed

11 files changed

+714
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ build
22
_*
33
docs
44
sdp
5+
.clangd-trace

.gitlab-ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ build-v3crtp:
5050
- _build/CI/src/app/uvgVPCCenc
5151
expire_in: 1 week
5252

53+
# Test building uvgVPCCenc with v3c rtp integration
54+
build-ffmpeg:
55+
stage: build
56+
script:
57+
- apt-get update && apt-get install -y ffmpeg libavcodec-dev libavformat-dev libavutil-dev
58+
- export PATH="${HOME}/bin:${PATH}"
59+
- cmake --preset=CI -DENABLE_FFMPEG=ON
60+
- cmake --build --preset=CI
61+
artifacts:
62+
paths:
63+
- _build/CI/src/app/uvgVPCCenc
64+
expire_in: 1 week
65+
5366
# Test long default
5467
test-long-default:
5568
stage: test-default

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ option(BUILD_SHARED_LIBS "Build using shared uvgVPCCenc library" ON)
1818

1919
# Control if uvgVPCCenc should be build with RTP support
2020
option(ENABLE_V3CRTP "Enable RTP support" OFF)
21+
option(ENABLE_FFMPEG "Link ffmpeg library" OFF)
22+
23+
if(ENABLE_FFMPEG)
24+
add_compile_definitions(LINK_FFMPEG)
25+
endif()
2126

2227
project(uvgVPCCenc
2328
VERSION ${uvgVPCCenc_VER}

src/lib/bitstreamGeneration/vps.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@
4242
#include "uvgvpcc/uvgvpcc.hpp"
4343

4444
vps::vps(const uvgvpcc_enc::Parameters& paramUVG, const std::shared_ptr<uvgvpcc_enc::GOF>& gofUVG) {
45-
if (paramUVG.occupancyEncoderName=="Kvazaar" &&paramUVG.geometryEncoderName=="Kvazaar" &&paramUVG.attributeEncoderName=="Kvazaar" /*|| paramUVG.useEncoderCommand*/) {
45+
if (paramUVG.occupancyEncoderName=="Kvazaar" && paramUVG.geometryEncoderName=="Kvazaar" && paramUVG.attributeEncoderName=="Kvazaar" /*|| paramUVG.useEncoderCommand*/) {
4646
codec_group_ = 1; // TMC2 : CODEC_GROUP_HEVC_MAIN10
47-
47+
#if LINK_FFMPEG
48+
} else if (paramUVG.occupancyEncoderName=="FFmpeg" || paramUVG.geometryEncoderName=="FFmpeg" || paramUVG.attributeEncoderName=="FFmpeg") {
49+
codec_group_ = 1; // TMC2 : CODEC_GROUP_HEVC_MAIN10
50+
#endif
4851
/**} else if (paramUVG.occupancyEncoderName=="uvg266" &&paramUVG.geometryEncoderName=="uvg266" &&paramUVG.attributeEncoderName=="uvg266") {
4952
codec_group_ = 3; // TMC2 : CODEC_GROUP_VVC_MAIN10
5053
**/

src/lib/mapEncoding/CMakeLists.txt

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,44 @@ else()
2222
message(FATAL_ERROR "Could not find stdio.h")
2323
endif()
2424

25+
26+
add_library(catchLibLogLibrary STATIC
27+
catchLibLog.cpp
28+
)
29+
30+
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_DEFAULT}")
31+
32+
# Set the default build libraries
33+
set(LIB_SOURCES "mapEncoding.cpp" "catchLibLog.cpp" "encoderKvazaar.cpp")
34+
35+
if(ENABLE_FFMPEG)
36+
# check if ffmpeg is available if available include encoderFFmpeg.cpp
37+
find_package(PkgConfig QUIET)
38+
if(PKG_CONFIG_FOUND)
39+
pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET
40+
libavcodec
41+
libavformat
42+
libavutil
43+
)
44+
message(STATUS "FFmpeg found: ${FFMPEG_VERSION}")
45+
set(LIB_SOURCES ${LIB_SOURCES} encoderFFmpeg.cpp)
46+
set(FFMPEG_LIBS PkgConfig::FFMPEG)
47+
else()
48+
message(WARNING "FFmpeg not found, skipping encoderFFmpeg")
49+
set(FFMPEG_LIBS "")
50+
endif()
51+
endif()
52+
53+
# Define the library
54+
add_library(mapEncodingLibrary STATIC
55+
${LIB_SOURCES}
56+
)
57+
58+
if(FFMPEG_LIBS)
59+
target_link_libraries(mapEncodingLibrary PUBLIC ${FFMPEG_LIBS})
60+
endif()
61+
62+
2563
set(STDIO_PREFIX "kvazaar")
2664
set(KVAZAAR_STDIO_LIB ${STDIO_PREFIX}_stdio)
2765
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/uvg_stdio.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/${STDIO_PREFIX}_stdio.h @ONLY)
@@ -60,20 +98,9 @@ ExternalProject_Add(
6098
)
6199
add_dependencies(kvazaar ${KVAZAAR_STDIO_LIB})
62100

63-
# Define the library
64-
add_library(catchLibLogLibrary STATIC
65-
catchLibLog.cpp
66-
)
67101

68102
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_DEFAULT}")
69103

70-
# Define the library
71-
add_library(mapEncodingLibrary STATIC
72-
encoderKvazaar.cpp
73-
mapEncoding.cpp
74-
catchLibLog.cpp
75-
)
76-
77104
# Include directories for headers
78105
target_include_directories(mapEncodingLibrary PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include)
79106

0 commit comments

Comments
 (0)