Skip to content

Commit 47bead8

Browse files
kixelatedclaude
andauthored
Add Qt dock UI for MoQ streaming (#41)
* Add Qt dock UI for MoQ streaming OBS's stable Settings -> Stream UI does not surface third-party services (pending obsproject/obs-studio#12911), so the registered MoQ service/output are invisible in the UI. Add a dockable panel that drives the MoQ output directly instead, working on stable OBS today. The dock (moq-dock.cpp/h, registered via obs_frontend_add_dock_by_id) lets the user enter a relay URL and broadcast path and start/stop streaming. It creates its own service/output and reuses the encoders configured in OBS's Output settings (both Simple and Advanced modes), so no encoder options are exposed in the dock. Settings persist via obs_module_config_path, and a live statistics panel shows status, duration, bitrate, data sent, dropped frames, and connect time. The bundled libmoq version is shown from MOQ_VERSION. Enable ENABLE_FRONTEND_API and ENABLE_QT (gated so the dock only builds when both are on, via MOQ_FRONTEND_ENABLED). Add a build-time workaround for the AGL framework: recent macOS SDKs ship no linkable AGL binary (it exists only in the runtime dyld shared cache), but the obs-deps Qt6 build references it transitively via WrapOpenGL; generate a stub whose install name points at the real framework so the link succeeds and dyld resolves AGL at load. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Apply clang-format and gersemi formatting Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Fix audio mixer index and preserve stop error message - Use the configured TrackIndex (1-based) as the libobs audio mixer index (0-based) instead of hardcoding mixer 0, so Advanced mode with Track 2+ publishes the correct audio track. - Set the stop failure message after StopStream() resets status to Idle, so the failure reason is actually shown. Addresses CodeRabbit review feedback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 29a90c6 commit 47bead8

5 files changed

Lines changed: 556 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,36 @@ else()
4646
target_link_libraries(obs-moq PRIVATE moq::moq)
4747
endif()
4848

49+
# The obs-deps Qt6 build references the AGL framework transitively (via
50+
# WrapOpenGL), but recent macOS SDKs ship no linkable AGL binary -- it exists
51+
# only in the runtime dyld shared cache. Generate a stub whose install name
52+
# points at the real framework so the link succeeds; dyld resolves AGL at load.
53+
if(
54+
(ENABLE_QT OR ENABLE_FRONTEND_API)
55+
AND APPLE
56+
AND NOT EXISTS "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/AGL.framework/Versions/A/AGL"
57+
)
58+
set(_agl_stub_dir "${CMAKE_BINARY_DIR}/agl-stub")
59+
set(_agl_stub_lib "${_agl_stub_dir}/AGL.framework/AGL")
60+
if(NOT EXISTS "${_agl_stub_lib}")
61+
file(MAKE_DIRECTORY "${_agl_stub_dir}/AGL.framework")
62+
set(_agl_arch_flags "")
63+
foreach(_arch IN LISTS CMAKE_OSX_ARCHITECTURES)
64+
list(APPEND _agl_arch_flags "-arch" "${_arch}")
65+
endforeach()
66+
execute_process(
67+
COMMAND
68+
xcrun clang -dynamiclib ${_agl_arch_flags} -install_name /System/Library/Frameworks/AGL.framework/Versions/A/AGL
69+
-o "${_agl_stub_lib}" -x c /dev/null
70+
RESULT_VARIABLE _agl_stub_result
71+
)
72+
if(NOT _agl_stub_result EQUAL 0)
73+
message(WARNING "Failed to build AGL stub (${_agl_stub_result}); Qt link may fail")
74+
endif()
75+
endif()
76+
target_link_options(obs-moq PRIVATE "-F${_agl_stub_dir}")
77+
endif()
78+
4979
if(ENABLE_FRONTEND_API)
5080
find_package(obs-frontend-api REQUIRED)
5181
target_link_libraries(obs-moq PRIVATE OBS::obs-frontend-api)
@@ -76,6 +106,12 @@ target_sources(
76106
src/moq-source.h
77107
)
78108

109+
# The dock requires both the frontend API (to register it) and Qt (to build it).
110+
if(ENABLE_FRONTEND_API AND ENABLE_QT)
111+
target_sources(obs-moq PRIVATE src/moq-dock.cpp src/moq-dock.h)
112+
target_compile_definitions(obs-moq PRIVATE MOQ_FRONTEND_ENABLED MOQ_VERSION_STRING="${MOQ_VERSION}")
113+
endif()
114+
79115
if(${BUILD_PLUGIN})
80116
set_target_properties_plugin(obs-moq PROPERTIES OUTPUT_NAME ${_name})
81117
else()

CMakePresets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"name": "template",
1111
"hidden": true,
1212
"cacheVariables": {
13-
"ENABLE_FRONTEND_API": false,
14-
"ENABLE_QT": false,
13+
"ENABLE_FRONTEND_API": true,
14+
"ENABLE_QT": true,
1515
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
1616
"BUILD_PLUGIN": true,
1717
"MOQ_VERSION": "0.2.14",

0 commit comments

Comments
 (0)