Skip to content

Commit

Permalink
QT 6 stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Feb 28, 2024
1 parent 9f44f12 commit 425a0a0
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 15 deletions.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 .
Expand Down
7 changes: 6 additions & 1 deletion app/telemetry/tutil/geodesi_helper.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#include "geodesi_helper.h"

#include <QtGlobal>

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){
Expand Down
23 changes: 23 additions & 0 deletions app/videostreaming/avcodec/avcodec_video.cmake
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 16 additions & 0 deletions lib/h264/h264.cmake
Original file line number Diff line number Diff line change
@@ -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}
)
22 changes: 9 additions & 13 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 425a0a0

Please sign in to comment.