Skip to content

Commit

Permalink
obs-webrtc: Add new WHEP Source
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Wang <[email protected]
  • Loading branch information
Sean-Der committed Jul 8, 2024
1 parent 16325de commit 04c2a67
Show file tree
Hide file tree
Showing 6 changed files with 662 additions and 6 deletions.
39 changes: 36 additions & 3 deletions plugins/obs-webrtc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,48 @@ endif()

find_package(LibDataChannel 0.20 REQUIRED)
find_package(CURL REQUIRED)
find_package(
FFmpeg REQUIRED
COMPONENTS avcodec
avfilter
avdevice
avutil
swscale
avformat
swresample)

if(NOT TARGET OBS::media-playback)
add_subdirectory("${CMAKE_SOURCE_DIR}/deps/media-playback" "${CMAKE_BINARY_DIR}/deps/media-playback")
endif()

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

target_sources(
obs-webrtc PRIVATE # cmake-format: sortable
obs-webrtc.cpp webrtc-utils.h whep-source.cpp whep-source.h whip-output.cpp whip-output.h whip-service.cpp whip-service.h)
obs-webrtc
PRIVATE # cmake-format: sortable
obs-webrtc.cpp
webrtc-utils.h
whep-source.cpp
whep-source.h
whip-output.cpp
whip-output.h
whip-service.cpp
whip-service.h)

target_link_libraries(obs-webrtc PRIVATE OBS::libobs LibDataChannel::LibDataChannel CURL::libcurl)
target_link_libraries(
obs-webrtc
PRIVATE OBS::libobs
OBS::media-playback
LibDataChannel::LibDataChannel
CURL::libcurl
FFmpeg::avcodec
FFmpeg::avfilter
FFmpeg::avformat
FFmpeg::avdevice
FFmpeg::avutil
FFmpeg::swscale
FFmpeg::swresample)

# cmake-format: off
set_target_properties_obs(obs-webrtc PROPERTIES FOLDER plugins PREFIX "")
Expand Down
38 changes: 35 additions & 3 deletions plugins/obs-webrtc/cmake/legacy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,46 @@ endif()

find_package(LibDataChannel 0.20 REQUIRED)
find_package(CURL REQUIRED)
find_package(
FFmpeg REQUIRED
COMPONENTS avcodec
avfilter
avdevice
avutil
swscale
avformat
swresample)
if(NOT TARGET OBS::media-playback)
add_subdirectory("${CMAKE_SOURCE_DIR}/deps/media-playback" "${CMAKE_BINARY_DIR}/deps/media-playback")
endif()

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
webrtc-utils.h)
target_sources(
obs-webrtc
PRIVATE obs-webrtc.cpp
whip-output.cpp
whip-output.h
whip-service.cpp
whip-service.h
whep-source.cpp
whep-source.h
webrtc-utils.h)

target_link_libraries(obs-webrtc PRIVATE OBS::libobs LibDataChannel::LibDataChannel CURL::libcurl)
target_link_libraries(
obs-webrtc
PRIVATE OBS::libobs
OBS::media-playback
LibDataChannel::LibDataChannel
CURL::libcurl
FFmpeg::avcodec
FFmpeg::avfilter
FFmpeg::avformat
FFmpeg::avdevice
FFmpeg::avutil
FFmpeg::swscale
FFmpeg::swresample)

set_target_properties(obs-webrtc PROPERTIES FOLDER "plugins")

Expand Down
1 change: 1 addition & 0 deletions plugins/obs-webrtc/data/locale/en-US.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Output.Name="WHIP Output"
Source.Name="WHEP Source"
Service.Name="WHIP Service"
Service.BearerToken="Bearer Token"

Expand Down
2 changes: 2 additions & 0 deletions plugins/obs-webrtc/obs-webrtc.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <obs-module.h>

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

OBS_DECLARE_MODULE()
Expand All @@ -14,6 +15,7 @@ bool obs_module_load()
{
register_whip_output();
register_whip_service();
register_whep_source();

return true;
}
Loading

0 comments on commit 04c2a67

Please sign in to comment.