Skip to content

Commit

Permalink
obs-webrtc: Add WHIP output & service
Browse files Browse the repository at this point in the history
This adds a WHIP output & associated service.
- Code inspiration from DDRBoxman
- Implemented by Sean DuBois & tt2468
- Various fixes and contributions by pkv.

Co-authored-by: tt2468 <tt2468@irltoolkit.com>
Co-authored-by: DDRBoxman <colin@recursivepenguin.com>
Co-authored-by: pkv <pkv@obsproject.com>
Signed-off-by: pkv <pkv@obsproject.com>
  • Loading branch information
4 people committed Jun 10, 2023
1 parent ed577a0 commit 851a8c2
Show file tree
Hide file tree
Showing 12 changed files with 843 additions and 0 deletions.
1 change: 1 addition & 0 deletions CI/linux/02_build_obs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ _configure_obs() {
-DLINUX_PORTABLE=${PORTABLE_BUILD:-OFF} \
-DENABLE_AJA=OFF \
-DENABLE_NEW_MPEGTS_OUTPUT=OFF \
-DENABLE_WEBRTC=OFF \
${PIPEWIRE_OPTION} \
${YOUTUBE_OPTIONS} \
${TWITCH_OPTIONS} \
Expand Down
2 changes: 2 additions & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
OR OS_LINUX)
add_subdirectory(obs-vst)
endif()
add_subdirectory(obs-webrtc)
check_obs_websocket()
add_subdirectory(obs-x264)
add_subdirectory(rtmp-services)
Expand Down Expand Up @@ -191,3 +192,4 @@ add_subdirectory(obs-transitions)
add_subdirectory(rtmp-services)
add_subdirectory(text-freetype2)
add_subdirectory(aja)
add_subdirectory(obs-webrtc)
21 changes: 21 additions & 0 deletions plugins/obs-webrtc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.16...3.25)

legacy_check()

option(ENABLE_WEBRTC "Enable WebRTC Output support" ON)
if(NOT ENABLE_WEBRTC)
message(STATUS "OBS: DISABLED obs-webrtc")
return()
endif()

find_package(LibDataChannel REQUIRED)
find_package(CURL REQUIRED)

add_library(obs-webrtc MODULE)
add_library(OBS::webrtc ALIAS obs-webrtc)

target_sources(obs-webrtc PRIVATE obs-webrtc.cpp whip-output.cpp whip-output.h whip-service.cpp whip-service.h)

target_link_libraries(obs-webrtc PRIVATE OBS::libobs LibDataChannel::LibDataChannel CURL::libcurl)

set_target_properties_obs(obs-webrtc PROPERTIES FOLDER plugins PREFIX "")
21 changes: 21 additions & 0 deletions plugins/obs-webrtc/cmake/legacy.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
project(obs-webrtc)

option(ENABLE_WEBRTC "Enable WebRTC Output support" ON)
if(NOT ENABLE_WEBRTC)
obs_status(DISABLED, "obs-webrtc")
return()
endif()

find_package(LibDataChannel REQUIRED)
find_package(CURL REQUIRED)

add_library(obs-webrtc MODULE)
add_library(OBS::webrtc ALIAS obs-webrtc)

target_sources(obs-webrtc PRIVATE obs-webrtc.cpp whip-output.cpp whip-output.h whip-service.cpp whip-service.h)

target_link_libraries(obs-webrtc PRIVATE OBS::libobs LibDataChannel::LibDataChannel CURL::libcurl)

set_target_properties(obs-webrtc PROPERTIES FOLDER "plugins")

setup_plugin_target(obs-webrtc)
28 changes: 28 additions & 0 deletions plugins/obs-webrtc/cmake/macos/Info.plist.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>obs-webrtc</string>
<key>CFBundleIdentifier</key>
<string>com.obsproject.obs-webrtc</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>obs-webrtc</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>LSMinimumSystemVersion</key>
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>(c) 2012-${CURRENT_YEAR} Hugh Bailey</string>
</dict>
</plist>
24 changes: 24 additions & 0 deletions plugins/obs-webrtc/cmake/windows/obs-module.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
1 VERSIONINFO
FILEVERSION ${OBS_VERSION_MAJOR},${OBS_VERSION_MINOR},${OBS_VERSION_PATCH},0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "${OBS_COMPANY_NAME}"
VALUE "FileDescription", "OBS output module"
VALUE "FileVersion", "${OBS_VERSION_CANONICAL}"
VALUE "ProductName", "${OBS_PRODUCT_NAME}"
VALUE "ProductVersion", "${OBS_VERSION_CANONICAL}"
VALUE "Comments", "${OBS_COMMENTS}"
VALUE "LegalCopyright", "${OBS_LEGAL_COPYRIGHT}"
VALUE "InternalName", "obs-webrtc"
VALUE "OriginalFilename", "obs-webrtc"
END
END

BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 0x04B0
END
END
3 changes: 3 additions & 0 deletions plugins/obs-webrtc/data/locale/en-US.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Output.Name="WHIP Output"
Service.Name="WHIP Service"
Service.BearerToken="Bearer Token"
19 changes: 19 additions & 0 deletions plugins/obs-webrtc/obs-webrtc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <obs-module.h>

#include "whip-output.h"
#include "whip-service.h"

OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("obs-webrtc", "en-US")
MODULE_EXPORT const char *obs_module_description(void)
{
return "OBS WebRTC module";
}

bool obs_module_load()
{
register_whip_output();
register_whip_service();

return true;
}
Loading

0 comments on commit 851a8c2

Please sign in to comment.