From 425a0a0f53f959dd1dd681a162f7a573ea3ec17c Mon Sep 17 00:00:00 2001 From: consti10 Date: Wed, 28 Feb 2024 23:24:33 +0100 Subject: [PATCH] QT 6 stuff --- CMakeLists.txt | 12 +++++++++- app/telemetry/tutil/geodesi_helper.cpp | 7 +++++- .../avcodec/avcodec_video.cmake | 23 +++++++++++++++++++ lib/h264/h264.cmake | 16 +++++++++++++ qml/main.qml | 22 ++++++++---------- 5 files changed, 65 insertions(+), 15 deletions(-) create mode 100644 app/videostreaming/avcodec/avcodec_video.cmake create mode 100644 lib/h264/h264.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f0fb30985..a1ea17a9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,13 +74,20 @@ qt_add_executable(QOpenHDApp #app/videostreaming/vscommon/rtp/rtpreceiver.cpp #app/videostreaming/vscommon/rtp/ParseRTP.cpp app/videostreaming/vscommon/decodingstatistcs.cpp - app/videostreaming/vscommon/decodingstatistcs.h + app/videostreaming/vscommon/audio_playback.cpp + app/videostreaming/vscommon/rtp/ParseRTP.cpp + app/videostreaming/vscommon/rtp/rtpreceiver.cpp + app/videostreaming/vscommon/udp/UDPReceiver.cpp + app/videostreaming/vscommon/decodingstatistcs.cpp + ## lib/geographiclib-c-2.0/src/geodesic.c ## ## ## qml/qml.qrc + app/videostreaming/avcodec/avcodec_video.cmake + lib/h264/h264.cmake ) target_include_directories(QOpenHDApp PUBLIC app) @@ -116,6 +123,9 @@ target_link_libraries(QOpenHDApp PRIVATE Qt6::Core Qt6::Quick Qt6::Gui Qt6::Widgets ) +include(lib/h264/h264.cmake) +include(app/videostreaming/avcodec/avcodec_video.cmake) + #include(GNUInstallDirs) #install(TARGETS QOpenHD # BUNDLE DESTINATION . diff --git a/app/telemetry/tutil/geodesi_helper.cpp b/app/telemetry/tutil/geodesi_helper.cpp index 668b2edc5..4f3129e7d 100644 --- a/app/telemetry/tutil/geodesi_helper.cpp +++ b/app/telemetry/tutil/geodesi_helper.cpp @@ -1,8 +1,13 @@ #include "geodesi_helper.h" +#include + extern "C" { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include "lib/geographiclib-c-2.0/src/geodesic.h" -//#include "geodesic.h" +#else +#include "geodesic.h" +#endif } double distance_between(double lat1, double lon1, double lat2, double lon2){ diff --git a/app/videostreaming/avcodec/avcodec_video.cmake b/app/videostreaming/avcodec/avcodec_video.cmake new file mode 100644 index 000000000..8dee99a52 --- /dev/null +++ b/app/videostreaming/avcodec/avcodec_video.cmake @@ -0,0 +1,23 @@ +set(AVCODEC_SOURCES + ${CMAKE_CURRENT_LIST_DIR}/QSGVideoTextureItem.cpp + ${CMAKE_CURRENT_LIST_DIR}/gl/gl_shaders.cpp + ${CMAKE_CURRENT_LIST_DIR}/gl/gl_videorenderer.cpp + ${CMAKE_CURRENT_LIST_DIR}/texturerenderer.cpp + ${CMAKE_CURRENT_LIST_DIR}/avcodec_decoder.cpp +) + +set(AVCODEC_HEADERS + QSGVideoTextureItem.h +) + +target_sources(QOpenHDApp PRIVATE ${AVCODEC_SOURCES}) + +target_include_directories(QOpenHDApp + PUBLIC + ${CMAKE_CURRENT_LIST_DIR} +) + +target_link_libraries(QOpenHDApp PRIVATE avcodec avutil avformat) +target_link_libraries(QOpenHDApp PRIVATE GLESv2 EGL) + +add_compile_definitions(QOPENHD_ENABLE_VIDEO_VIA_AVCODEC) diff --git a/lib/h264/h264.cmake b/lib/h264/h264.cmake new file mode 100644 index 000000000..6cf59f56c --- /dev/null +++ b/lib/h264/h264.cmake @@ -0,0 +1,16 @@ +set(H264_SOURCES + ${CMAKE_CURRENT_LIST_DIR}/h264_bitstream_parser.cc + ${CMAKE_CURRENT_LIST_DIR}/h264_common.cc + ${CMAKE_CURRENT_LIST_DIR}/pps_parser.cc + ${CMAKE_CURRENT_LIST_DIR}/sps_parser.cc + ${CMAKE_CURRENT_LIST_DIR}/bit_buffer.cc + ${CMAKE_CURRENT_LIST_DIR}/checks.cc + ${CMAKE_CURRENT_LIST_DIR}/zero_memory.cc +) + +target_sources(QOpenHDApp PRIVATE ${H264_SOURCES}) + +target_include_directories(QOpenHDApp + PUBLIC + ${CMAKE_CURRENT_LIST_DIR} +) diff --git a/qml/main.qml b/qml/main.qml index 252bf89a0..c0510eee3 100755 --- a/qml/main.qml +++ b/qml/main.qml @@ -35,8 +35,8 @@ ApplicationWindow { _qrenderstats.set_window_height(height) } - contentOrientation: settings.general_screen_rotation===0 ? Qt.PortraitOrientation : Qt.LandscapeOrientation - contentItem.rotation: settings.general_screen_rotation + //contentOrientation: settings.general_screen_rotation===0 ? Qt.PortraitOrientation : Qt.LandscapeOrientation + //contentItem.rotation: settings.general_screen_rotation //minimumWidth: 850 //minimumHeight: 480 @@ -52,6 +52,13 @@ ApplicationWindow { // android / ios - specifc: We need to explicitly say full screen, otherwise things might be "cut off" visibility: (settings.dev_force_show_full_screen || QOPENHD_IS_MOBILE) ? "FullScreen" : "AutomaticVisibility" + // Local app settings. Uses the "user defaults" system on Mac/iOS, the Registry on Windows, + // and equivalent settings systems on Linux and Android + // On linux, they generally are stored under /home/username/.config/Open.HD + // See https://doc.qt.io/qt-5/qsettings.html#platform-specific-notes for more info + AppSettings { + id: settings + } // This only exists to be able to fully rotate "everything" for users that have their screen upside down for some reason. // Won't affect the video, but heck, then just mount your camera upside down. // TODO: the better fix really would be to somehow the the RPI HDMI config to rotate the screen in HW - but r.n there seems to be @@ -63,17 +70,6 @@ ApplicationWindow { width: (settings.general_screen_rotation == 90 || settings.general_screen_rotation == 270) ? parent.height : parent.width height: (settings.general_screen_rotation == 90 || settings.general_screen_rotation == 270) ? parent.width : parent.height - // Local app settings. Uses the "user defaults" system on Mac/iOS, the Registry on Windows, - // and equivalent settings systems on Linux and Android - // On linux, they generally are stored under /home/username/.config/Open.HD - // See https://doc.qt.io/qt-5/qsettings.html#platform-specific-notes for more info - AppSettings { - id: settings - Component.onCompleted: { - // - } - } - // Loads the proper (platform-dependent) video widget for the main (primary) video // primary video is always full-screen and behind the HUD OSD Elements Loader {