Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
BartSte committed Jan 24, 2024
2 parents c173154 + 5179899 commit 63cb66b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 40 deletions.
87 changes: 48 additions & 39 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ find_package(spdlog REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem)
find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia MultimediaWidgets
WaylandClient)
find_libva() # creates Libva::va/va-drm/va-x11/va-wayland

get_target_property(QT6_LIB_TYPE Qt6::Widgets TYPE)
set(QT6_LIB_TYPE
${QT6_LIB_TYPE}
PARENT_SCOPE)

message(STATUS "Qt6 was found at ${Qt6_DIR}")
message(STATUS "Qt6 library type is ${QT6_LIB_TYPE}")
message(STATUS "FFmpeg libraries are: ${FFMPEG_LIBRARIES}")

file(GLOB_RECURSE SOURCES "${CMAKE_SOURCE_DIR}/src/*")
file(GLOB_RECURSE INCLUDES "${CMAKE_SOURCE_DIR}/include/*")
Expand All @@ -26,42 +23,54 @@ target_include_directories(
${Boost_INCLUDE_DIRS}
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/snapshotapp_autogen/include)

set(PLATFORM_PLUGINS
Qt6::QEglFSIntegrationPlugin
Qt6::QLinuxFbIntegrationPlugin
Qt6::QMinimalEglIntegrationPlugin
Qt6::QMinimalIntegrationPlugin
Qt6::QOffscreenIntegrationPlugin
Qt6::QVkKhrDisplayIntegrationPlugin
Qt6::QVncIntegrationPlugin
Qt6::QWaylandEglPlatformIntegrationPlugin
Qt6::QWaylandIntegrationPlugin
Qt6::QXcbIntegrationPlugin)
set(MULTIMEDIA_PLUGINS Qt6::QFFmpegMediaPlugin)
set(LINK_LIBS spdlog::spdlog_header_only Boost::boost Boost::filesystem
Qt6::Widgets Qt6::Multimedia Qt6::MultimediaWidgets)

# FFmpeg is included in Qt6::Multimedia
target_link_libraries(
snapshotapp
PUBLIC spdlog::spdlog_header_only
Boost::boost
Boost::filesystem
Libva::va
Libva::va-drm
Libva::va-x11
Libva::va-wayland
Qt6::Widgets
Qt6::Multimedia
Qt6::MultimediaWidgets
${MULTIMEDIA_PLUGINS}
${PLATFORM_PLUGINS})
# When building the project with a static Qt6 library, we need to link the
# following components statically as well:
# - Platform plugins
# - Multimedia plugins
# - FFmpeg
# - Libva
# Furthermore, the Qt plugins need to be imported manually using the
# qt_import_plugins() function.
if(QT6_LIB_TYPE STREQUAL "STATIC_LIBRARY")
set(PLATFORM_PLUGINS
Qt6::QEglFSIntegrationPlugin
Qt6::QLinuxFbIntegrationPlugin
Qt6::QMinimalEglIntegrationPlugin
Qt6::QMinimalIntegrationPlugin
Qt6::QOffscreenIntegrationPlugin
Qt6::QVkKhrDisplayIntegrationPlugin
Qt6::QVncIntegrationPlugin
Qt6::QWaylandEglPlatformIntegrationPlugin
Qt6::QWaylandIntegrationPlugin
Qt6::QXcbIntegrationPlugin)
set(MULTIMEDIA_PLUGINS Qt6::QFFmpegMediaPlugin)

qt_import_plugins(
snapshotapp
INCLUDE_BY_TYPE
platforms
${PLATFORM_PLUGINS}
INCLUDE_BY_TYPE
multimedia
${MULTIMEDIA_PLUGINS}
)
find_ffmpeg() # creates FFmpeg::FFmpeg
find_libva() # creates Libva::va/va-drm/va-x11/va-wayland
message(STATUS "FFmpeg libraries are: ${FFMPEG_LIBRARIES}")

list(
APPEND
LINK_LIBS
FFmpeg::FFmpeg
Libva::va
Libva::va-drm
Libva::va-x11
Libva::va-wayland
${PLATFORM_PLUGINS}
${MULTIMEDIA_PLUGINS})

qt_import_plugins(
snapshotapp
INCLUDE_BY_TYPE
platforms
${PLATFORM_PLUGINS}
INCLUDE_BY_TYPE
multimedia
${MULTIMEDIA_PLUGINS})
endif()

target_link_libraries(snapshotapp PUBLIC ${LINK_LIBS})
3 changes: 3 additions & 0 deletions src/snapshotapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ void App::makeGui() {
void App::makeRecorder() {
if (!settings.get<bool>("record")) {
return;
} else if (!video) {
spdlog::warn("No video found, not starting recorder.");
return;
}

spdlog::debug("Creating recorder");
Expand Down
2 changes: 1 addition & 1 deletion src/video/record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void ImageSaver::save() {
*/
void ImageSaver::saveFrame(const QVideoFrame &frame) {
if (!frame.isValid()) {
spdlog::warn("Invalid frame");
spdlog::warn("Recorder received an invalid frame. Not saving.");
return;
}

Expand Down

0 comments on commit 63cb66b

Please sign in to comment.