Compare commits

..

36 Commits
4.3.0 ... 4.4.0

Author SHA1 Message Date
4e6d4ac437 events: fix triggering of PreviewSceneChanged 2018-07-31 11:27:10 +02:00
3b197651cc general: step by one commit to have CI running 2018-07-30 19:17:35 +02:00
c675f1c20c docs(travis): Update protocol.md - e87955d [skip ci] 2018-07-30 17:04:19 +00:00
e87955d59a ci(docs): fix docs deployment 2018-07-30 19:02:29 +02:00
c718d8d803 general: version bump + minor CI fixes 2018-07-30 18:57:24 +02:00
454a68d1b7 Merge pull request #199 from Palakis/4.3-jimtree-studiomode-fix
[not ready] events: fix triggering of PreviewSceneChanged
2018-07-29 17:01:48 +02:00
45f6f74cbe cmake: remove copy operation 2018-07-21 23:05:38 +02:00
cb7412a457 events: fix triggering of PreviewSceneChanged 2018-07-08 12:58:06 +02:00
a9fc82365c TransitionBegin: add source and destination scene names 2018-06-24 22:33:07 +02:00
edc0fed9e2 Merge branch 'transition-override-begin-event' into 4.3-maintenance 2018-06-24 22:20:55 +02:00
1c718963ea TransitionBegin: support for transition overrides 2018-06-24 22:19:45 +02:00
cd40ccdb9d Merge pull request #211 from wherget/build-fixes
MacOS Build fixes
2018-05-27 18:38:39 +02:00
80e1dc2446 Merge pull request #210 from RytoEX/build-instruction-update
Build instruction update
2018-05-27 18:35:07 +02:00
d03c4cc4b9 Merge pull request #219 from christopher-dG/cdg/replaystopping
docs: Fix ReplayStopping description
2018-05-27 18:34:58 +02:00
7bd434e755 ci(macos): get rid of manual Packages versioning 2018-04-28 23:53:47 +02:00
640bcb90c6 CI(macOS): Split off obs-studio build task
Split off the obs-studio build task to help separate CI log sections.
2018-04-28 23:53:42 +02:00
08e86a1378 CI(macOS): Use latest Qt from Homebrew
OBS Studio CI currently uses the latest Qt version in Homebrew.
2018-04-28 23:53:36 +02:00
fefcc3937a CI(macOS): Update Packages version
Update Packages to version 1.2.3, which released on April 7, 2018.
2018-04-28 23:53:28 +02:00
25210dfa52 CI and CMake improvements (#205)
* CMake: Copy PDB file to OBS build directory on Debug build

All native OBS build objects also bundle the associated PDB file for
debugging and handling crash reports.

* CMake: Add post-build commands for RelWithDebInfo

Add post-build commands for the RelWithDebInfo build config. OBS
official builds use RelWithDebInfo, so we should be able to treat it as
a release config.

* CI: Disable building OBS native plugins

Use the OBS CMake flag DISABLE_PLUGINS to disable building plugins
included with OBS (including submodule plugins like obs-browser). This
should speed up builds on Windows when we have to rebuild OBS and on
Mac.

* CI: Don't clone/update OBS submodules

The only submodules presently in OBS are in its plugins, which we don't
need to build.

* CI: Use obsproject/obs-studio instead of jp9000/obs-studio

The OBS GitHub recently changed from jp9000/obs-studio to
obsproject/obs-studio, so use that instead.

* CI: Build as RelWithDebInfo instead of Release

OBS official builds are produced with RelWithDebInfo. This will produce
a PDB file for the plugin, similar to the native OBS plugins.

* CI(Windows): Build OBS if current build config doesn't exist

If OBS libs for the current build config do not exist, build OBS before
building obs-websocket.
2018-03-26 11:12:39 +02:00
56fbb7b9cf CI(Windows): Build OBS with Visual Studio 2017
We should also build OBS with Visual Studio 2017.
2018-03-26 11:12:19 +02:00
c55d33b956 CI(Windows): Use Visual Studio 2017
Official OBS releases have switched to Visual Studio 2017. There is no
32-bit Qt 5.10.1 package for Visual Studio 2017, but the Visual Studio
2015 package is compatible.
2018-03-26 11:11:18 +02:00
0c5bce101e CI(linux): forgot to install checkinstall 2018-03-20 14:27:04 +01:00
0a50e2a95c ci(linux): use OBS dev deps from PPA release 2018-03-20 14:11:33 +01:00
5ad940924b CI(windows): build installer
ci(windows): escape path


ci(windows): add inno setup compiler to PATH


ci(windows): fix installer.iss path
2018-03-19 02:36:24 +01:00
6eb49930bf general: version bump to 4.3.3 2018-03-19 01:11:35 +01:00
3a0d5fb190 CI: let's try with VS2015 instead 2018-03-18 23:25:38 +01:00
8c2eee2e25 CI: update Windows builds to VS2017 and Qt 5.10.1 2018-03-18 23:25:31 +01:00
2e19c5f08a docs: update version 2018-03-14 23:03:14 +01:00
548b53437f general: version bump to 4.3.2 2018-03-14 22:58:53 +01:00
e1ca9a8029 notifications: check if system tray is available before notifying 2018-03-14 22:26:08 +01:00
389ef2aea9 Config: remove flawed qstring_data_copy and add toUtf8() macro 2018-03-14 22:26:00 +01:00
357691bad5 CI: bump to latest OBS version 2018-01-22 23:24:09 +01:00
beadb56b05 general: update version to 4.3.1 2018-01-22 23:13:27 +01:00
745fb5ea29 Merge branch 'scenecol-crash-fix' 2018-01-22 23:11:24 +01:00
58434cac3b events: fix crash on exit 2018-01-22 23:10:33 +01:00
c34dff17ff events: fix crash when switching between scene collections 2018-01-22 23:03:20 +01:00
26 changed files with 253 additions and 235 deletions

View File

@ -35,7 +35,9 @@ matrix:
- os: osx - os: osx
env: _macos_build env: _macos_build
osx_image: xcode8.3 osx_image: xcode8.3
before_install: "./CI/install-dependencies-macos.sh" before_install:
- "./CI/install-dependencies-macos.sh"
- "./CI/install-build-obs-macos.sh"
script: "./CI/build-macos.sh" script: "./CI/build-macos.sh"
after_success: after_success:
- ./CI/package-macos.sh - ./CI/package-macos.sh

View File

@ -1,6 +1,9 @@
# Compiling obs-websocket # Compiling obs-websocket
## Prerequisites ## Prerequisites
You'll need [QT 5.9.0](https://download.qt.io/official_releases/qt/5.7/5.7.0/), CMake, and a working development environment for OBS Studio installed on your computer. You'll need [Qt 5.10.x](https://download.qt.io/official_releases/qt/5.10/),
[CMake](https://cmake.org/download/), and a working [development environment for
OBS Studio](https://obsproject.com/wiki/install-instructions) installed on your
computer.
## Windows ## Windows
In cmake-gui, you'll have to set the following variables : In cmake-gui, you'll have to set the following variables :
@ -22,12 +25,24 @@ sudo make install
``` ```
## OS X ## OS X
Use of the Travis macOS CI scripts is recommended. Please note that these scripts install new software and can change several settings on your system. An existing obs-studio development environment is not required, as `install-dependencies-macos.sh` will install it for you. As a prerequisite, you will need Xcode for your current OSX version, the command line tools, and [Homebrew](https://brew.sh/).
Of course, you're encouraged to dig through the contents of these scripts to look for issues or specificities. Homebrew's setup will guide you in getting your system set up, you should be good to go once Homebrew is successfully up and running.
Use of the Travis macOS CI scripts is recommended. Please note that these
scripts install new software and can change several settings on your system. An
existing obs-studio development environment is not required, as
`install-build-obs-macos.sh` will install it for you. If you already have a
working obs-studio development environment and have built obs-studio, you can
skip that script.
Of course, you're encouraged to dig through the contents of these scripts to
look for issues or specificities.
``` ```
git clone --recursive https://github.com/Palakis/obs-websocket.git git clone --recursive https://github.com/Palakis/obs-websocket.git
cd obs-websocket cd obs-websocket
./CI/install-dependencies-macos.sh ./CI/install-dependencies-macos.sh
./CI/install-build-obs-macos.sh
./CI/build-macos.sh ./CI/build-macos.sh
./CI/package-macos.sh ./CI/package-macos.sh
``` ```

View File

@ -3,11 +3,12 @@ set -ex
#export QT_PREFIX="$(find /usr/local/Cellar/qt5 -d 1 | tail -n 1)" #export QT_PREFIX="$(find /usr/local/Cellar/qt5 -d 1 | tail -n 1)"
mkdir build && cd build mkdir -p build && cd build
cmake .. \ cmake .. \
-DQTDIR=/usr/local/opt/qt \ -DQTDIR=/usr/local/opt/qt \
-DLIBOBS_INCLUDE_DIR=../../obs-studio/libobs \ -DLIBOBS_INCLUDE_DIR=../../obs-studio/libobs \
-DLIBOBS_LIB=../../obs-studio/libobs \ -DLIBOBS_LIB=../../obs-studio/libobs \
-DOBS_FRONTEND_LIB="$(pwd)/../../obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib" \ -DOBS_FRONTEND_LIB="$(pwd)/../../obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
&& make -j4 && make -j4

View File

@ -4,5 +4,5 @@ set -ex
cd /root/obs-websocket cd /root/obs-websocket
mkdir build && cd build mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=/usr .. cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4 make -j4

View File

@ -15,7 +15,7 @@ if git diff --quiet; then
exit 0 exit 0
fi fi
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "master" ]; then if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "4.3-maintenance" ]; then
echo "-- Skipping documentation deployment because this is either a pull request or a non-master branch." echo "-- Skipping documentation deployment because this is either a pull request or a non-master branch."
exit 0 exit 0
fi fi

14
CI/install-build-obs-macos.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
set -ex
# Build obs-studio
cd ..
git clone https://github.com/obsproject/obs-studio
cd obs-studio
OBSLatestTag=$(git describe --tags --abbrev=0)
git checkout $OBSLatestTag
mkdir build && cd build
cmake .. \
-DDISABLE_PLUGINS=true \
-DCMAKE_PREFIX_PATH=/usr/local/opt/qt/lib/cmake \
&& make -j4

View File

@ -60,13 +60,24 @@ REM If obs-studio directory does not exist, clone the git repo, get the latest
REM tag number, and set the build flag. REM tag number, and set the build flag.
if not exist C:\projects\obs-studio ( if not exist C:\projects\obs-studio (
echo obs-studio directory does not exist echo obs-studio directory does not exist
git clone --recursive https://github.com/jp9000/obs-studio git clone https://github.com/obsproject/obs-studio
cd C:\projects\obs-studio\ cd C:\projects\obs-studio\
git describe --tags --abbrev=0 > C:\projects\obs-studio-latest-tag.txt git describe --tags --abbrev=0 > C:\projects\obs-studio-latest-tag.txt
set /p OBSLatestTag=<C:\projects\obs-studio-latest-tag.txt set /p OBSLatestTag=<C:\projects\obs-studio-latest-tag.txt
set BuildOBS=true set BuildOBS=true
) )
REM If the needed obs-studio libs for this build_config do not exist,
REM set the build flag.
if not exist C:\projects\obs-studio\build32\libobs\%build_config%\obs.lib (
echo obs-studio\build32\libobs\%build_config%\obs.lib does not exist
set BuildOBS=true
)
if not exist C:\projects\obs-studio\build32\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib (
echo obs-studio\build32\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib does not exist
set BuildOBS=true
)
REM Some debug info REM Some debug info
echo: echo:
echo Latest tag pre-pull: %OBSLatestTagPrePull% echo Latest tag pre-pull: %OBSLatestTagPrePull%
@ -97,12 +108,12 @@ if defined BuildOBS (
mkdir build64 mkdir build64
echo Running cmake for obs-studio %OBSLatestTag% 32-bit... echo Running cmake for obs-studio %OBSLatestTag% 32-bit...
cd ./build32 cd ./build32
cmake -G "Visual Studio 12 2013" -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true .. cmake -G "Visual Studio 15 2017" -DDISABLE_PLUGINS=true -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true ..
echo: echo:
echo: echo:
echo Running cmake for obs-studio %OBSLatestTag% 64-bit... echo Running cmake for obs-studio %OBSLatestTag% 64-bit...
cd ../build64 cd ../build64
cmake -G "Visual Studio 12 2013 Win64" -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true .. cmake -G "Visual Studio 15 2017 Win64" -DDISABLE_PLUGINS=true -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true ..
echo: echo:
echo: echo:
echo Building obs-studio %OBSLatestTag% 32-bit ^(Build Config: %build_config%^)... echo Building obs-studio %OBSLatestTag% 32-bit ^(Build Config: %build_config%^)...

View File

@ -8,25 +8,8 @@ brew install libav
# qtwebsockets deps # qtwebsockets deps
# qt latest # qt latest
#brew install qt5 brew install qt5
# qt 5.9.2
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/2b121c9a96e58a5da14228630cb71d5bead7137e/Formula/qt.rb
#echo "Qt path: $(find /usr/local/Cellar/qt5 -d 1 | tail -n 1)"
# Build obs-studio
cd ..
git clone --recursive https://github.com/jp9000/obs-studio
cd obs-studio
git checkout 20.1.0
mkdir build && cd build
cmake .. \
-DCMAKE_PREFIX_PATH=/usr/local/opt/qt/lib/cmake \
&& make -j4
# Packages app # Packages app
cd .. wget --quiet --retry-connrefused --waitretry=1 https://s3-us-west-2.amazonaws.com/obs-nightly/Packages.pkg
curl -L -O http://s.sudre.free.fr/Software/files/Packages.dmg -f --retry 5 -C - sudo installer -pkg ./Packages.pkg -target /
hdiutil attach ./Packages.dmg
sudo installer -pkg /Volumes/Packages\ 1.2.2/packages/Packages.pkg -target /

View File

@ -1,57 +1,19 @@
#!/bin/sh #!/bin/sh
set -ex set -ex
# OBS Studio deps add-apt-repository -y ppa:obsproject/obs-studio
apt-get -qq update apt-get -qq update
apt-get install -y \
libc-dev-bin libc6-dev \
git \
build-essential
apt-get install -y \ apt-get install -y \
build-essential \ libc-dev-bin \
checkinstall \ libc6-dev git \
cmake \ build-essential \
libasound2-dev \ checkinstall \
libavcodec-dev \ cmake \
libavdevice-dev \ obs-studio \
libavfilter-dev \ libqt5websockets5-dev
libavformat-dev \
libavutil-dev \
libcurl4-openssl-dev \
libfontconfig-dev \
libfreetype6-dev \
libgl1-mesa-dev \
libjack-jackd2-dev \
libjansson-dev \
libpulse-dev \
libqt5x11extras5-dev \
libspeexdsp-dev \
libswresample-dev \
libswscale-dev \
libudev-dev \
libv4l-dev \
libvlc-dev \
libx11-dev \
libx264-dev \
libxcb-shm0-dev \
libxcb-xinerama0-dev \
libxcomposite-dev \
libxinerama-dev \
pkg-config \
qtbase5-dev
# obs-websocket deps # Dirty hack
apt-get install -y libqt5websockets5-dev wget -O /usr/include/obs/obs-frontend-api.h https://raw.githubusercontent.com/obsproject/obs-studio/master/UI/obs-frontend-api/obs-frontend-api.h
# Build obs-studio
cd /root
git clone https://github.com/jp9000/obs-studio ./obs-studio
cd obs-studio
git checkout 20.1.0
mkdir build && cd build
cmake -DUNIX_STRUCTURE=1 -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
make install
ldconfig ldconfig

View File

@ -1,20 +1,6 @@
@echo off @echo off
REM Set default values to use AppVeyor's built-in Qt. REM Set default values to use AppVeyor's built-in Qt.
set QTDIR32=C:\Qt\5.7\msvc2013 set QTDIR32=C:\Qt\5.10.1\msvc2015
set QTDIR64=C:\Qt\5.7\msvc2013_64 set QTDIR64=C:\Qt\5.10.1\msvc2017_64
set QTCompileVersion=5.7.1 set QTCompileVersion=5.10.1
REM If the AppVeyor cache couldn't recover qt570.7z,
REM try to fetch Qt 5.7.0 from slepin.fr.
if not exist qt570.7z (
curl -kLO https://www.slepin.fr/obs-plugins/deps/qt570.7z -f --retry 5 -C -
)
REM If qt570.7z exists now, use that instead of AppVeyor's built-in Qt.
if exist qt570.7z (
7z x qt570.7z -o"Qt5.7.0"
set QTDIR32=%CD%\Qt5.7.0\msvc2013
set QTDIR64=%CD%\Qt5.7.0\msvc2013_64
set QTCompileVersion=5.7.0
)

View File

@ -635,7 +635,7 @@
<key>OVERWRITE_PERMISSIONS</key> <key>OVERWRITE_PERMISSIONS</key>
<false/> <false/>
<key>VERSION</key> <key>VERSION</key>
<string>4.3.0</string> <string>4.4.0</string>
</dict> </dict>
<key>PROJECT_COMMENTS</key> <key>PROJECT_COMMENTS</key>
<dict> <dict>

View File

@ -3,7 +3,7 @@
set -e set -e
echo "-- Preparing package build" echo "-- Preparing package build"
export QT_CELLAR_PREFIX="$(find /usr/local/Cellar/qt -d 1 | tail -n 1)" export QT_CELLAR_PREFIX="$(find /usr/local/Cellar/qt -d 1 | sort -t '.' -k 1,1n -k 2,2n -k 3,3n | tail -n 1)"
export WS_LIB="/usr/local/opt/qt/lib/QtWebSockets.framework/QtWebSockets" export WS_LIB="/usr/local/opt/qt/lib/QtWebSockets.framework/QtWebSockets"
export NET_LIB="/usr/local/opt/qt/lib/QtNetwork.framework/QtNetwork" export NET_LIB="/usr/local/opt/qt/lib/QtNetwork.framework/QtNetwork"
@ -21,19 +21,21 @@ export FILENAME="obs-websocket-$VERSION.pkg"
export LATEST_FILENAME="obs-websocket-latest-$LATEST_VERSION.pkg" export LATEST_FILENAME="obs-websocket-latest-$LATEST_VERSION.pkg"
echo "-- Copying Qt dependencies" echo "-- Copying Qt dependencies"
cp $WS_LIB ./build if [ ! -f ./build/$(basename $WS_LIB) ]; then cp $WS_LIB ./build; fi
cp $NET_LIB ./build if [ ! -f ./build/$(basename $NET_LIB) ]; then cp $NET_LIB ./build; fi
chmod +rw ./build/QtWebSockets ./build/QtNetwork chmod +rw ./build/QtWebSockets ./build/QtNetwork
echo "-- Modifying QtNetwork" echo "-- Modifying QtNetwork"
install_name_tool \ install_name_tool \
-id @rpath/QtNetwork \
-change /usr/local/opt/qt/lib/QtNetwork.framework/Versions/5/QtNetwork @rpath/QtNetwork \ -change /usr/local/opt/qt/lib/QtNetwork.framework/Versions/5/QtNetwork @rpath/QtNetwork \
-change $QT_CELLAR_PREFIX/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \ -change $QT_CELLAR_PREFIX/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \
./build/QtNetwork ./build/QtNetwork
echo "-- Modifying QtWebSockets" echo "-- Modifying QtWebSockets"
install_name_tool \ install_name_tool \
-id @rpath/QtWebSockets \
-change /usr/local/opt/qt/lib/QtWebSockets.framework/Versions/5/QtWebSockets @rpath/QtWebSockets \ -change /usr/local/opt/qt/lib/QtWebSockets.framework/Versions/5/QtWebSockets @rpath/QtWebSockets \
-change $QT_CELLAR_PREFIX/lib/QtNetwork.framework/Versions/5/QtNetwork @rpath/QtNetwork \ -change $QT_CELLAR_PREFIX/lib/QtNetwork.framework/Versions/5/QtNetwork @rpath/QtNetwork \
-change $QT_CELLAR_PREFIX/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \ -change $QT_CELLAR_PREFIX/lib/QtCore.framework/Versions/5/QtCore @rpath/QtCore \

View File

@ -6,7 +6,9 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
if (WIN32 OR APPLE)
include(external/FindLibObs.cmake) include(external/FindLibObs.cmake)
endif()
find_package(LibObs REQUIRED) find_package(LibObs REQUIRED)
find_package(Qt5Core REQUIRED) find_package(Qt5Core REQUIRED)
@ -16,7 +18,7 @@ find_package(Qt5Widgets REQUIRED)
add_subdirectory(deps/mbedtls EXCLUDE_FROM_ALL) add_subdirectory(deps/mbedtls EXCLUDE_FROM_ALL)
set(ENABLE_PROGRAMS false) set(ENABLE_PROGRAMS false)
set(obs-websocket_SOURCES set(obs-websocket_SOURCES
src/obs-websocket.cpp src/obs-websocket.cpp
src/WSServer.cpp src/WSServer.cpp
src/WSRequestHandler.cpp src/WSRequestHandler.cpp
@ -46,13 +48,13 @@ set(obs-websocket_HEADERS
src/forms/settings-dialog.h) src/forms/settings-dialog.h)
# --- Platform-independent build settings --- # --- Platform-independent build settings ---
add_library(obs-websocket MODULE add_library(obs-websocket MODULE
${obs-websocket_SOURCES} ${obs-websocket_SOURCES}
${obs-websocket_HEADERS}) ${obs-websocket_HEADERS})
add_dependencies(obs-websocket mbedcrypto) add_dependencies(obs-websocket mbedcrypto)
include_directories( include_directories(
"${LIBOBS_INCLUDE_DIR}/../UI/obs-frontend-api" "${LIBOBS_INCLUDE_DIR}/../UI/obs-frontend-api"
${Qt5Core_INCLUDES} ${Qt5Core_INCLUDES}
${Qt5WebSockets_INCLUDES} ${Qt5WebSockets_INCLUDES}
@ -60,7 +62,7 @@ include_directories(
${mbedcrypto_INCLUDES} ${mbedcrypto_INCLUDES}
"${CMAKE_SOURCE_DIR}/deps/mbedtls/include") "${CMAKE_SOURCE_DIR}/deps/mbedtls/include")
target_link_libraries(obs-websocket target_link_libraries(obs-websocket
libobs libobs
Qt5::Core Qt5::Core
Qt5::WebSockets Qt5::WebSockets
@ -73,7 +75,7 @@ target_link_libraries(obs-websocket
if(WIN32) if(WIN32)
if(NOT DEFINED OBS_FRONTEND_LIB) if(NOT DEFINED OBS_FRONTEND_LIB)
set(OBS_FRONTEND_LIB "OBS_FRONTEND_LIB-NOTFOUND" CACHE FILEPATH "OBS frontend library") set(OBS_FRONTEND_LIB "OBS_FRONTEND_LIB-NOTFOUND" CACHE FILEPATH "OBS frontend library")
message(FATAL_ERROR "Could not find OBS Frontend API\'s library !") message(FATAL_ERROR "Could not find OBS Frontend API's library !")
endif() endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@ -91,36 +93,45 @@ if(WIN32)
target_link_libraries(obs-websocket target_link_libraries(obs-websocket
"${OBS_FRONTEND_LIB}") "${OBS_FRONTEND_LIB}")
add_custom_command(TARGET obs-websocket POST_BUILD
COMMAND if $<CONFIG:Release>==1 ("${CMAKE_COMMAND}" -E copy
"${QTDIR}/bin/Qt5WebSockets.dll"
"${QTDIR}/bin/Qt5Network.dll"
"${CMAKE_BINARY_DIR}/$<CONFIG>")
COMMAND if $<CONFIG:Debug>==1 ("${CMAKE_COMMAND}" -E copy
"${QTDIR}/bin/Qt5WebSocketsd.dll"
"${QTDIR}/bin/Qt5Networkd.dll"
"${CMAKE_BINARY_DIR}/$<CONFIG>")
)
# --- Release package helper --- # --- Release package helper ---
# The "release" folder has a structure similar OBS' one on Windows # The "release" folder has a structure similar OBS' one on Windows
set(RELEASE_DIR "${PROJECT_SOURCE_DIR}/release") set(RELEASE_DIR "${PROJECT_SOURCE_DIR}/release")
add_custom_command(TARGET obs-websocket POST_BUILD add_custom_command(TARGET obs-websocket POST_BUILD
# If config is Release, package release files
COMMAND if $<CONFIG:Release>==1 ( COMMAND if $<CONFIG:Release>==1 (
"${CMAKE_COMMAND}" -E make_directory "${CMAKE_COMMAND}" -E make_directory
"${RELEASE_DIR}/data/obs-plugins/obs-websocket" "${RELEASE_DIR}/data/obs-plugins/obs-websocket"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}") "${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")
COMMAND if $<CONFIG:Release>==1 ("${CMAKE_COMMAND}" -E copy_directory COMMAND if $<CONFIG:Release>==1 ("${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/data" "${PROJECT_SOURCE_DIR}/data"
"${RELEASE_DIR}/data/obs-plugins/obs-websocket") "${RELEASE_DIR}/data/obs-plugins/obs-websocket")
COMMAND if $<CONFIG:Release>==1 ("${CMAKE_COMMAND}" -E copy COMMAND if $<CONFIG:Release>==1 ("${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:obs-websocket>" "$<TARGET_FILE:obs-websocket>"
"${QTDIR}/bin/Qt5WebSockets.dll" "${QTDIR}/bin/Qt5WebSockets.dll"
"${QTDIR}/bin/Qt5Network.dll" "${QTDIR}/bin/Qt5Network.dll"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")
# If config is RelWithDebInfo, package release files
COMMAND if $<CONFIG:RelWithDebInfo>==1 (
"${CMAKE_COMMAND}" -E make_directory
"${RELEASE_DIR}/data/obs-plugins/obs-websocket"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")
COMMAND if $<CONFIG:RelWithDebInfo>==1 ("${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/data"
"${RELEASE_DIR}/data/obs-plugins/obs-websocket")
COMMAND if $<CONFIG:RelWithDebInfo>==1 ("${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:obs-websocket>"
"${QTDIR}/bin/Qt5WebSockets.dll"
"${QTDIR}/bin/Qt5Network.dll"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")
COMMAND if $<CONFIG:RelWithDebInfo>==1 ("${CMAKE_COMMAND}" -E copy
"$<TARGET_PDB_FILE:obs-websocket>"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}") "${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")
# Copy to obs-studio dev environment for immediate testing # Copy to obs-studio dev environment for immediate testing
@ -131,6 +142,11 @@ if(WIN32)
"${QTDIR}/bin/Qt5Networkd.dll" "${QTDIR}/bin/Qt5Networkd.dll"
"${LIBOBS_INCLUDE_DIR}/../${OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/obs-plugins/${ARCH_NAME}") "${LIBOBS_INCLUDE_DIR}/../${OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/obs-plugins/${ARCH_NAME}")
COMMAND if $<CONFIG:Debug>==1 (
"${CMAKE_COMMAND}" -E copy
"$<TARGET_PDB_FILE:obs-websocket>"
"${LIBOBS_INCLUDE_DIR}/../${OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/obs-plugins/${ARCH_NAME}")
COMMAND if $<CONFIG:Debug>==1 ( COMMAND if $<CONFIG:Debug>==1 (
"${CMAKE_COMMAND}" -E make_directory "${CMAKE_COMMAND}" -E make_directory
"${LIBOBS_INCLUDE_DIR}/../${OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/data/obs-plugins/obs-websocket") "${LIBOBS_INCLUDE_DIR}/../${OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/data/obs-plugins/obs-websocket")
@ -167,6 +183,7 @@ endif()
if(APPLE) if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fvisibility=default") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fvisibility=default")
set(CMAKE_SKIP_RPATH TRUE)
set_target_properties(obs-websocket PROPERTIES PREFIX "") set_target_properties(obs-websocket PROPERTIES PREFIX "")
target_link_libraries(obs-websocket "${OBS_FRONTEND_LIB}") target_link_libraries(obs-websocket "${OBS_FRONTEND_LIB}")
endif() endif()

View File

@ -1,23 +1,25 @@
image: Visual Studio 2017
environment: environment:
CURL_VERSION: 7.39.0 CURL_VERSION: 7.39.0
install: install:
- git submodule update --init --recursive - git submodule update --init --recursive
- cd C:\projects\ - cd C:\projects\
- if not exist dependencies2013.zip curl -kLO https://obsproject.com/downloads/dependencies2013.zip -f --retry 5 -C - - if not exist dependencies2015.zip curl -kLO https://obsproject.com/downloads/dependencies2015.zip -f --retry 5 -C -
- 7z x dependencies2013.zip -odependencies2013 - 7z x dependencies2015.zip -odependencies2015
- set DepsPath32=%CD%\dependencies2013\win32 - set DepsPath32=%CD%\dependencies2015\win32
- set DepsPath64=%CD%\dependencies2013\win64 - set DepsPath64=%CD%\dependencies2015\win64
- call C:\projects\obs-websocket\CI\install-setup-qt.cmd - call C:\projects\obs-websocket\CI\install-setup-qt.cmd
- set build_config=Release - set build_config=RelWithDebInfo
- call C:\projects\obs-websocket\CI\install-build-obs.cmd - call C:\projects\obs-websocket\CI\install-build-obs.cmd
- cd C:\projects\obs-websocket\ - cd C:\projects\obs-websocket\
- mkdir build32 - mkdir build32
- mkdir build64 - mkdir build64
- cd ./build32 - cd ./build32
- cmake -G "Visual Studio 12 2013" -DQTDIR="%QTDIR32%" -DLibObs_DIR="C:\projects\obs-studio\build32\libobs" -DLIBOBS_INCLUDE_DIR="C:\projects\obs-studio\libobs" -DLIBOBS_LIB="C:\projects\obs-studio\build32\libobs\%build_config%\obs.lib" -DOBS_FRONTEND_LIB="C:\projects\obs-studio\build32\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib" .. - cmake -G "Visual Studio 15 2017" -DQTDIR="%QTDIR32%" -DLibObs_DIR="C:\projects\obs-studio\build32\libobs" -DLIBOBS_INCLUDE_DIR="C:\projects\obs-studio\libobs" -DLIBOBS_LIB="C:\projects\obs-studio\build32\libobs\%build_config%\obs.lib" -DOBS_FRONTEND_LIB="C:\projects\obs-studio\build32\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib" ..
- cd ../build64 - cd ../build64
- cmake -G "Visual Studio 12 2013 Win64" -DQTDIR="%QTDIR64%" -DLibObs_DIR="C:\projects\obs-studio\build64\libobs" -DLIBOBS_INCLUDE_DIR="C:\projects\obs-studio\libobs" -DLIBOBS_LIB="C:\projects\obs-studio\build64\libobs\%build_config%\obs.lib" -DOBS_FRONTEND_LIB="C:\projects\obs-studio\build64\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib" .. - cmake -G "Visual Studio 15 2017 Win64" -DQTDIR="%QTDIR64%" -DLibObs_DIR="C:\projects\obs-studio\build64\libobs" -DLIBOBS_INCLUDE_DIR="C:\projects\obs-studio\libobs" -DLIBOBS_LIB="C:\projects\obs-studio\build64\libobs\%build_config%\obs.lib" -DOBS_FRONTEND_LIB="C:\projects\obs-studio\build64\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib" ..
build_script: build_script:
- call msbuild /m /p:Configuration=%build_config% C:\projects\obs-websocket\build32\obs-websocket.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - call msbuild /m /p:Configuration=%build_config% C:\projects\obs-websocket\build32\obs-websocket.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
@ -25,14 +27,16 @@ build_script:
before_deploy: before_deploy:
- 7z a "C:\projects\obs-websocket\build.zip" C:\projects\obs-websocket\release\* - 7z a "C:\projects\obs-websocket\build.zip" C:\projects\obs-websocket\release\*
- set PATH=%PATH%;"C:\\Program Files (x86)\\Inno Setup 5"
- iscc "C:\projects\obs-websocket\installer\installer.iss"
deploy_script: deploy_script:
- ps: Push-AppveyorArtifact "C:\projects\obs-websocket\build.zip" -FileName "obs-websocket-$(git log --pretty=format:'%h' -n 1).zip" - ps: Push-AppveyorArtifact "C:\projects\obs-websocket\build.zip" -FileName "obs-websocket-$(git log --pretty=format:'%h' -n 1)-Windows.zip"
- ps: Push-AppveyorArtifact "C:\projects\obs-websocket\installer\Output\obs-websocket-Windows-Installer.exe" -FileName "obs-websocket-$(git log --pretty=format:'%h' -n 1)-Windows-Installer.exe"
test: off test: off
cache: cache:
- C:\projects\dependencies2013.zip - C:\projects\dependencies2015.zip
- C:\projects\qt570.7z
- C:\projects\obs-studio-last-tag-built.txt - C:\projects\obs-studio-last-tag-built.txt
- C:\projects\obs-studio\ - C:\projects\obs-studio\

View File

@ -271,7 +271,9 @@
"description": "A transition (other than \"cut\") has begun.", "description": "A transition (other than \"cut\") has begun.",
"return": [ "return": [
"{String} `name` Transition name.", "{String} `name` Transition name.",
"{int} `duration` Transition duration (in milliseconds)." "{int} `duration` Transition duration (in milliseconds).",
"{String} `from-scene` Source scene of the transition",
"{String} `to-scene` Destination scene of the transition"
], ],
"api": "events", "api": "events",
"name": "TransitionBegin", "name": "TransitionBegin",
@ -287,6 +289,16 @@
"type": "int", "type": "int",
"name": "duration", "name": "duration",
"description": "Transition duration (in milliseconds)." "description": "Transition duration (in milliseconds)."
},
{
"type": "String",
"name": "from-scene",
"description": "Source scene of the transition"
},
{
"type": "String",
"name": "to-scene",
"description": "Destination scene of the transition"
} }
], ],
"names": [ "names": [
@ -834,7 +846,7 @@
}, },
{ {
"subheads": [], "subheads": [],
"description": "A request to start the replay buffer has been issued.", "description": "A request to stop the replay buffer has been issued.",
"api": "events", "api": "events",
"name": "ReplayStopping", "name": "ReplayStopping",
"category": "replay buffer", "category": "replay buffer",

View File

@ -1,11 +1,6 @@
<!-- This file was generated based on handlebars templates. Do not edit directly! --> <!-- This file was generated based on handlebars templates. Do not edit directly! -->
# obs-websocket 4.2.1 protocol reference # obs-websocket 4.3.2 protocol reference
**This is the reference for the unreleased obs-websocket 4.2.1. See the list below for older versions.**
- [4.2.0 protocol reference](https://github.com/Palakis/obs-websocket/blob/4.2.0/docs/generated/protocol.md)
- [4.1.0 protocol reference](https://github.com/Palakis/obs-websocket/blob/4.1.0/PROTOCOL.md)
- [4.0.0 protocol reference](https://github.com/Palakis/obs-websocket/blob/4.0.0/PROTOCOL.md)
# General Introduction # General Introduction
Messages are exchanged between the client and the server as JSON objects. Messages are exchanged between the client and the server as JSON objects.
@ -304,6 +299,8 @@ A transition (other than "cut") has begun.
| ---- | :---: | ------------| | ---- | :---: | ------------|
| `name` | _String_ | Transition name. | | `name` | _String_ | Transition name. |
| `duration` | _int_ | Transition duration (in milliseconds). | | `duration` | _int_ | Transition duration (in milliseconds). |
| `from-scene` | _String_ | Source scene of the transition |
| `to-scene` | _String_ | Destination scene of the transition |
--- ---
@ -508,7 +505,7 @@ _No additional response items._
- Added in v4.2.0 - Added in v4.2.0
A request to start the replay buffer has been issued. A request to stop the replay buffer has been issued.
**Response Items:** **Response Items:**

View File

@ -1,9 +1,4 @@
# obs-websocket 4.2.1 protocol reference # obs-websocket 4.3.2 protocol reference
**This is the reference for the unreleased obs-websocket 4.2.1. See the list below for older versions.**
- [4.2.0 protocol reference](https://github.com/Palakis/obs-websocket/blob/4.2.0/docs/generated/protocol.md)
- [4.1.0 protocol reference](https://github.com/Palakis/obs-websocket/blob/4.1.0/PROTOCOL.md)
- [4.0.0 protocol reference](https://github.com/Palakis/obs-websocket/blob/4.0.0/PROTOCOL.md)
# General Introduction # General Introduction
Messages are exchanged between the client and the server as JSON objects. Messages are exchanged between the client and the server as JSON objects.

View File

@ -2,8 +2,8 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "obs-websocket" #define MyAppName "obs-websocket"
#define MyAppVersion "4.3.0" #define MyAppVersion "4.4.0"
#define MyAppPublisher "St<EFBFBD>phane Lepin" #define MyAppPublisher "Stephane Lepin"
#define MyAppURL "http://github.com/Palakis/obs-websocket" #define MyAppURL "http://github.com/Palakis/obs-websocket"
[Setup] [Setup]
@ -20,7 +20,7 @@ AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL} AppUpdatesURL={#MyAppURL}
DefaultDirName={code:GetDirName} DefaultDirName={code:GetDirName}
DefaultGroupName={#MyAppName} DefaultGroupName={#MyAppName}
OutputBaseFilename=obs-websocket-{#MyAppVersion}-Windows-Installer OutputBaseFilename=obs-websocket-Windows-Installer
Compression=lzma Compression=lzma
SolidCompression=yes SolidCompression=yes
LicenseFile=..\LICENSE LicenseFile=..\LICENSE

View File

@ -34,6 +34,8 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include "Config.h" #include "Config.h"
#include "Utils.h" #include "Utils.h"
#define QT_TO_UTF8(str) str.toUtf8().constData()
Config* Config::_instance = new Config(); Config* Config::_instance = new Config();
Config::Config() : Config::Config() :
@ -62,9 +64,9 @@ Config::Config() :
config_set_default_bool(obsConfig, config_set_default_bool(obsConfig,
SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired); SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired);
config_set_default_string(obsConfig, config_set_default_string(obsConfig,
SECTION_NAME, PARAM_SECRET, qstring_data_copy(Secret)); SECTION_NAME, PARAM_SECRET, QT_TO_UTF8(Secret));
config_set_default_string(obsConfig, config_set_default_string(obsConfig,
SECTION_NAME, PARAM_SALT, qstring_data_copy(Salt)); SECTION_NAME, PARAM_SALT, QT_TO_UTF8(Salt));
} }
mbedtls_entropy_init(&entropy); mbedtls_entropy_init(&entropy);
@ -104,9 +106,9 @@ void Config::Save() {
config_set_bool(obsConfig, SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired); config_set_bool(obsConfig, SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired);
config_set_string(obsConfig, SECTION_NAME, PARAM_SECRET, config_set_string(obsConfig, SECTION_NAME, PARAM_SECRET,
qstring_data_copy(Secret)); QT_TO_UTF8(Secret));
config_set_string(obsConfig, SECTION_NAME, PARAM_SALT, config_set_string(obsConfig, SECTION_NAME, PARAM_SALT,
qstring_data_copy(Salt)); QT_TO_UTF8(Salt));
config_save(obsConfig); config_save(obsConfig);
} }

View File

@ -28,13 +28,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
Q_DECLARE_METATYPE(OBSScene); Q_DECLARE_METATYPE(OBSScene);
const char* qstring_data_copy(QString value) {
QByteArray stringData = value.toUtf8();
const char* constStringData = new const char[stringData.size()]();
memcpy((void*)constStringData, stringData.constData(), stringData.size());
return constStringData;
}
obs_data_array_t* Utils::StringListToArray(char** strings, char* key) { obs_data_array_t* Utils::StringListToArray(char** strings, char* key) {
if (!strings) if (!strings)
return obs_data_array_create(); return obs_data_array_create();
@ -315,13 +308,19 @@ QString Utils::OBSVersionString() {
QSystemTrayIcon* Utils::GetTrayIcon() { QSystemTrayIcon* Utils::GetTrayIcon() {
QMainWindow* main = (QMainWindow*)obs_frontend_get_main_window(); QMainWindow* main = (QMainWindow*)obs_frontend_get_main_window();
if (!main) return nullptr;
return main->findChildren<QSystemTrayIcon*>().first(); return main->findChildren<QSystemTrayIcon*>().first();
} }
void Utils::SysTrayNotify(QString &text, void Utils::SysTrayNotify(QString &text,
QSystemTrayIcon::MessageIcon icon, QString title) { QSystemTrayIcon::MessageIcon icon, QString title) {
if (!Config::Current()->AlertsEnabled || !QSystemTrayIcon::supportsMessages()) if (!Config::Current()->AlertsEnabled ||
!QSystemTrayIcon::isSystemTrayAvailable() ||
!QSystemTrayIcon::supportsMessages())
{
return; return;
}
QSystemTrayIcon* trayIcon = GetTrayIcon(); QSystemTrayIcon* trayIcon = GetTrayIcon();
if (trayIcon) if (trayIcon)

View File

@ -32,8 +32,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <obs-module.h> #include <obs-module.h>
#include <util/config-file.h> #include <util/config-file.h>
const char* qstring_data_copy(QString value);
class Utils { class Utils {
public: public:
static obs_data_array_t* StringListToArray(char** strings, char* key); static obs_data_array_t* StringListToArray(char** strings, char* key);
@ -49,8 +47,6 @@ class Utils {
static obs_data_array_t* GetScenes(); static obs_data_array_t* GetScenes();
static obs_data_t* GetSceneData(obs_source_t* source); static obs_data_t* GetSceneData(obs_source_t* source);
static obs_data_array_t* GetProfiles();
static QSpinBox* GetTransitionDurationControl(); static QSpinBox* GetTransitionDurationControl();
static int GetTransitionDuration(); static int GetTransitionDuration();
static void SetTransitionDuration(int ms); static void SetTransitionDuration(int ms);

View File

@ -80,12 +80,7 @@ WSEvents::WSEvents(WSServer* srv) {
this, SLOT(Heartbeat())); this, SLOT(Heartbeat()));
statusTimer->start(2000); // equal to frontend's constant BITRATE_UPDATE_SECONDS statusTimer->start(2000); // equal to frontend's constant BITRATE_UPDATE_SECONDS
QListWidget* sceneList = Utils::GetSceneListControl(); currentScene = nullptr;
connect(sceneList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
this, SLOT(SelectedSceneChanged(QListWidgetItem*, QListWidgetItem*)));
transitionHandler = nullptr;
sceneHandler = nullptr;
QTimer::singleShot(1000, this, SLOT(deferredInitOperations())); QTimer::singleShot(1000, this, SLOT(deferredInitOperations()));
@ -104,7 +99,7 @@ WSEvents::~WSEvents() {
void WSEvents::deferredInitOperations() { void WSEvents::deferredInitOperations() {
OBSSourceAutoRelease transition = obs_frontend_get_current_transition(); OBSSourceAutoRelease transition = obs_frontend_get_current_transition();
connectTransitionSignals(transition); hookTransitionBeginEvent();
OBSSourceAutoRelease scene = obs_frontend_get_current_scene(); OBSSourceAutoRelease scene = obs_frontend_get_current_scene();
connectSceneSignals(scene); connectSceneSignals(scene);
@ -132,6 +127,7 @@ void WSEvents::FrontendEventHandler(enum obs_frontend_event event, void* private
owner->OnTransitionChange(); owner->OnTransitionChange();
} }
else if (event == OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED) { else if (event == OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED) {
owner->hookTransitionBeginEvent();
owner->OnTransitionListChange(); owner->OnTransitionListChange();
} }
else if (event == OBS_FRONTEND_EVENT_PROFILE_CHANGED) { else if (event == OBS_FRONTEND_EVENT_PROFILE_CHANGED) {
@ -186,7 +182,11 @@ void WSEvents::FrontendEventHandler(enum obs_frontend_event event, void* private
else if (event == OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED) { else if (event == OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED) {
owner->OnStudioModeSwitched(false); owner->OnStudioModeSwitched(false);
} }
else if (event == OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED) {
owner->OnPreviewSceneChanged();
}
else if (event == OBS_FRONTEND_EVENT_EXIT) { else if (event == OBS_FRONTEND_EVENT_EXIT) {
owner->connectSceneSignals(nullptr);
owner->OnExit(); owner->OnExit();
} }
} }
@ -220,43 +220,50 @@ void WSEvents::broadcastUpdate(const char* updateType,
blog(LOG_DEBUG, "Update << '%s'", json.toUtf8().constData()); blog(LOG_DEBUG, "Update << '%s'", json.toUtf8().constData());
} }
void WSEvents::connectTransitionSignals(obs_source_t* transition) { void WSEvents::hookTransitionBeginEvent() {
if (transitionHandler) { obs_frontend_source_list transitions = {};
signal_handler_disconnect(transitionHandler, obs_frontend_get_transitions(&transitions);
"transition_start", OnTransitionBegin, this);
}
if (!transitionIsCut(transition)) { for (int i = 0; i < transitions.sources.num; i++) {
transitionHandler = obs_source_get_signal_handler(transition); obs_source_t* transition = transitions.sources.array[i];
signal_handler_connect(transitionHandler, signal_handler_t* sh = obs_source_get_signal_handler(transition);
"transition_start", OnTransitionBegin, this); signal_handler_disconnect(sh, "transition_start", OnTransitionBegin, this);
} else { signal_handler_connect(sh, "transition_start", OnTransitionBegin, this);
transitionHandler = nullptr; }
}
obs_frontend_source_list_free(&transitions);
} }
void WSEvents::connectSceneSignals(obs_source_t* scene) { void WSEvents::connectSceneSignals(obs_source_t* scene) {
if (sceneHandler) { signal_handler_t* sh = nullptr;
signal_handler_disconnect(sceneHandler,
if (currentScene) {
sh = obs_source_get_signal_handler(currentScene);
signal_handler_disconnect(sh,
"reorder", OnSceneReordered, this); "reorder", OnSceneReordered, this);
signal_handler_disconnect(sceneHandler, signal_handler_disconnect(sh,
"item_add", OnSceneItemAdd, this); "item_add", OnSceneItemAdd, this);
signal_handler_disconnect(sceneHandler, signal_handler_disconnect(sh,
"item_remove", OnSceneItemDelete, this); "item_remove", OnSceneItemDelete, this);
signal_handler_disconnect(sceneHandler, signal_handler_disconnect(sh,
"item_visible", OnSceneItemVisibilityChanged, this); "item_visible", OnSceneItemVisibilityChanged, this);
} }
// TODO : connect to all scenes, not just the current one. currentScene = scene;
sceneHandler = obs_source_get_signal_handler(scene);
signal_handler_connect(sceneHandler, if (currentScene) {
"reorder", OnSceneReordered, this); // TODO : connect to all scenes, not just the current one.
signal_handler_connect(sceneHandler, sh = obs_source_get_signal_handler(currentScene);
"item_add", OnSceneItemAdd, this); signal_handler_connect(sh,
signal_handler_connect(sceneHandler, "reorder", OnSceneReordered, this);
"item_remove", OnSceneItemDelete, this); signal_handler_connect(sh,
signal_handler_connect(sceneHandler, "item_add", OnSceneItemAdd, this);
"item_visible", OnSceneItemVisibilityChanged, this); signal_handler_connect(sh,
"item_remove", OnSceneItemDelete, this);
signal_handler_connect(sh,
"item_visible", OnSceneItemVisibilityChanged, this);
}
} }
uint64_t WSEvents::GetStreamingTime() { uint64_t WSEvents::GetStreamingTime() {
@ -283,7 +290,7 @@ const char* WSEvents::GetRecordingTimecode() {
/** /**
* Indicates a scene change. * Indicates a scene change.
* *
* @return {String} `scene-name` The new scene. * @return {String} `scene-name` The new scene.
* @return {Array} `sources` List of sources in the new scene. * @return {Array} `sources` List of sources in the new scene.
* *
@ -302,19 +309,12 @@ void WSEvents::OnSceneChange() {
obs_data_set_array(data, "sources", sceneItems); obs_data_set_array(data, "sources", sceneItems);
broadcastUpdate("SwitchScenes", data); broadcastUpdate("SwitchScenes", data);
// Dirty fix : OBS blocks signals when swapping scenes in Studio Mode
// after transition end, so SelectedSceneChanged is never called...
if (obs_frontend_preview_program_mode_active()) {
QListWidget* list = Utils::GetSceneListControl();
SelectedSceneChanged(list->currentItem(), nullptr);
}
} }
/** /**
* The scene list has been modified. * The scene list has been modified.
* Scenes have been added, removed, or renamed. * Scenes have been added, removed, or renamed.
* *
* @api events * @api events
* @name ScenesChanged * @name ScenesChanged
* @category scenes * @category scenes
@ -326,7 +326,7 @@ void WSEvents::OnSceneListChange() {
/** /**
* Triggered when switching to another scene collection or when renaming the current scene collection. * Triggered when switching to another scene collection or when renaming the current scene collection.
* *
* @api events * @api events
* @name SceneCollectionChanged * @name SceneCollectionChanged
* @category scenes * @category scenes
@ -335,8 +335,7 @@ void WSEvents::OnSceneListChange() {
void WSEvents::OnSceneCollectionChange() { void WSEvents::OnSceneCollectionChange() {
broadcastUpdate("SceneCollectionChanged"); broadcastUpdate("SceneCollectionChanged");
sceneHandler = nullptr; currentScene = nullptr;
transitionHandler = nullptr;
OnTransitionListChange(); OnTransitionListChange();
OnTransitionChange(); OnTransitionChange();
@ -347,7 +346,7 @@ void WSEvents::OnSceneCollectionChange() {
/** /**
* Triggered when a scene collection is created, added, renamed, or removed. * Triggered when a scene collection is created, added, renamed, or removed.
* *
* @api events * @api events
* @name SceneCollectionListChanged * @name SceneCollectionListChanged
* @category scenes * @category scenes
@ -369,7 +368,6 @@ void WSEvents::OnSceneCollectionListChange() {
*/ */
void WSEvents::OnTransitionChange() { void WSEvents::OnTransitionChange() {
OBSSourceAutoRelease currentTransition = obs_frontend_get_current_transition(); OBSSourceAutoRelease currentTransition = obs_frontend_get_current_transition();
connectTransitionSignals(currentTransition);
OBSDataAutoRelease data = obs_data_create(); OBSDataAutoRelease data = obs_data_create();
obs_data_set_string(data, "transition-name", obs_data_set_string(data, "transition-name",
@ -448,7 +446,7 @@ void WSEvents::OnStreamStarted() {
/** /**
* A request to stop streaming has been issued. * A request to stop streaming has been issued.
* *
* @return {boolean} `preview-only` Always false (retrocompatibility). * @return {boolean} `preview-only` Always false (retrocompatibility).
* *
* @api events * @api events
@ -551,7 +549,7 @@ void WSEvents::OnReplayStarted() {
} }
/** /**
* A request to start the replay buffer has been issued. * A request to stop the replay buffer has been issued.
* *
* @api events * @api events
* @name ReplayStopping * @name ReplayStopping
@ -658,7 +656,7 @@ void WSEvents::StreamStatus() {
/** /**
* Emitted every 2 seconds after enabling it by calling SetHeartbeat. * Emitted every 2 seconds after enabling it by calling SetHeartbeat.
* *
* @return {boolean} `pulse` Toggles between every JSON meassage as an "I am alive" indicator. * @return {boolean} `pulse` Toggles between every JSON meassage as an "I am alive" indicator.
* @return {string (optional)} `current-profile` Current active profile. * @return {string (optional)} `current-profile` Current active profile.
* @return {string (optional)} `current-scene` Current active scene. * @return {string (optional)} `current-scene` Current active scene.
@ -670,7 +668,7 @@ void WSEvents::StreamStatus() {
* @return {int (optional)} `total-record-time` Total time (in seconds) since recording started. * @return {int (optional)} `total-record-time` Total time (in seconds) since recording started.
* @return {int (optional)} `total-record-bytes` Total bytes recorded since the recording started. * @return {int (optional)} `total-record-bytes` Total bytes recorded since the recording started.
* @return {int (optional)} `total-record-frames` Total frames recorded since the recording started. * @return {int (optional)} `total-record-frames` Total frames recorded since the recording started.
* *
* @api events * @api events
* @name Heartbeat * @name Heartbeat
* @category general * @category general
@ -735,6 +733,8 @@ void WSEvents::TransitionDurationChanged(int ms) {
* *
* @return {String} `name` Transition name. * @return {String} `name` Transition name.
* @return {int} `duration` Transition duration (in milliseconds). * @return {int} `duration` Transition duration (in milliseconds).
* @return {String} `from-scene` Source scene of the transition
* @return {String} `to-scene` Destination scene of the transition
* *
* @api events * @api events
* @name TransitionBegin * @name TransitionBegin
@ -742,14 +742,39 @@ void WSEvents::TransitionDurationChanged(int ms) {
* @since 4.0.0 * @since 4.0.0
*/ */
void WSEvents::OnTransitionBegin(void* param, calldata_t* data) { void WSEvents::OnTransitionBegin(void* param, calldata_t* data) {
UNUSED_PARAMETER(data);
WSEvents* instance = static_cast<WSEvents*>(param); WSEvents* instance = static_cast<WSEvents*>(param);
OBSSourceAutoRelease currentTransition = obs_frontend_get_current_transition(); OBSSource transition = (obs_source_t*)calldata_get_ptr(data, "source");
if (!transition) return;
// Detect if transition is the global transition or a transition override.
// Fetching the duration is different depending on the case.
OBSSourceAutoRelease sourceScene = obs_transition_get_source(transition, OBS_TRANSITION_SOURCE_A);
OBSSourceAutoRelease destinationScene = obs_transition_get_active_source(transition);
OBSDataAutoRelease destinationSettings = obs_source_get_private_settings(destinationScene);
int duration = -1;
if (obs_data_has_default_value(destinationSettings, "transition_duration") ||
obs_data_has_user_value(destinationSettings, "transition_duration"))
{
duration = obs_data_get_int(destinationSettings, "transition_duration");
} else {
duration = Utils::GetTransitionDuration();
}
OBSDataAutoRelease fields = obs_data_create(); OBSDataAutoRelease fields = obs_data_create();
obs_data_set_string(fields, "name", obs_source_get_name(currentTransition)); obs_data_set_string(fields, "name", obs_source_get_name(transition));
obs_data_set_int(fields, "duration", Utils::GetTransitionDuration()); if (duration >= 0) {
obs_data_set_int(fields, "duration", duration);
} else {
blog(LOG_WARNING, "OnTransitionBegin: duration is negative !");
}
if (sourceScene) {
obs_data_set_string(fields, "from-scene", obs_source_get_name(sourceScene));
}
if (destinationScene) {
obs_data_set_string(fields, "to-scene", obs_source_get_name(destinationScene));
}
instance->broadcastUpdate("TransitionBegin", fields); instance->broadcastUpdate("TransitionBegin", fields);
} }
@ -889,17 +914,16 @@ void WSEvents::OnSceneItemVisibilityChanged(void* param, calldata_t* data) {
* @category studio mode * @category studio mode
* @since 4.1.0 * @since 4.1.0
*/ */
void WSEvents::SelectedSceneChanged(QListWidgetItem* current, QListWidgetItem* prev) { void WSEvents::OnPreviewSceneChanged() {
if (obs_frontend_preview_program_mode_active()) { if (obs_frontend_preview_program_mode_active()) {
OBSScene scene = Utils::SceneListItemToScene(current); OBSSourceAutoRelease scene = obs_frontend_get_current_preview_scene();
if (!scene) if (!scene)
return; return;
OBSSource sceneSource = obs_scene_get_source(scene); OBSDataArrayAutoRelease sceneItems = Utils::GetSceneItems(scene);
OBSDataArrayAutoRelease sceneItems = Utils::GetSceneItems(sceneSource);
OBSDataAutoRelease data = obs_data_create(); OBSDataAutoRelease data = obs_data_create();
obs_data_set_string(data, "scene-name", obs_source_get_name(sceneSource)); obs_data_set_string(data, "scene-name", obs_source_get_name(scene));
obs_data_set_array(data, "sources", sceneItems); obs_data_set_array(data, "sources", sceneItems);
broadcastUpdate("PreviewSceneChanged", data); broadcastUpdate("PreviewSceneChanged", data);

View File

@ -33,9 +33,10 @@ class WSEvents : public QObject {
static void FrontendEventHandler( static void FrontendEventHandler(
enum obs_frontend_event event, void* privateData); enum obs_frontend_event event, void* privateData);
static WSEvents* Instance; static WSEvents* Instance;
void connectTransitionSignals(obs_source_t* transition);
void connectSceneSignals(obs_source_t* scene); void connectSceneSignals(obs_source_t* scene);
void hookTransitionBeginEvent();
uint64_t GetStreamingTime(); uint64_t GetStreamingTime();
const char* GetStreamingTimecode(); const char* GetStreamingTimecode();
uint64_t GetRecordingTime(); uint64_t GetRecordingTime();
@ -48,13 +49,10 @@ class WSEvents : public QObject {
void StreamStatus(); void StreamStatus();
void Heartbeat(); void Heartbeat();
void TransitionDurationChanged(int ms); void TransitionDurationChanged(int ms);
void SelectedSceneChanged(
QListWidgetItem* current, QListWidgetItem* prev);
private: private:
WSServer* _srv; WSServer* _srv;
signal_handler_t* transitionHandler; OBSSource currentScene;
signal_handler_t* sceneHandler;
bool pulse; bool pulse;
@ -97,6 +95,7 @@ class WSEvents : public QObject {
void OnReplayStopped(); void OnReplayStopped();
void OnStudioModeSwitched(bool enabled); void OnStudioModeSwitched(bool enabled);
void OnPreviewSceneChanged();
void OnExit(); void OnExit();

View File

@ -22,7 +22,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include "../Config.h" #include "../Config.h"
#include "../WSServer.h" #include "../WSServer.h"
#include "settings-dialog.h" #include "settings-dialog.h"
#include "ui_settings-dialog.h"
#define CHANGE_ME "changeme" #define CHANGE_ME "changeme"

View File

@ -21,9 +21,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <QDialog> #include <QDialog>
namespace Ui { #include "ui_settings-dialog.h"
class SettingsDialog;
}
class SettingsDialog : public QDialog class SettingsDialog : public QDialog
{ {

View File

@ -39,7 +39,7 @@ using OBSOutputAutoRelease =
OBSRef<obs_output_t*, ___output_dummy_addref, obs_output_release>; OBSRef<obs_output_t*, ___output_dummy_addref, obs_output_release>;
#define PROP_AUTHENTICATED "wsclient_authenticated" #define PROP_AUTHENTICATED "wsclient_authenticated"
#define OBS_WEBSOCKET_VERSION "4.3.0" #define OBS_WEBSOCKET_VERSION "4.4.0"
#define blog(level, msg, ...) blog(level, "[obs-websocket] " msg, ##__VA_ARGS__) #define blog(level, msg, ...) blog(level, "[obs-websocket] " msg, ##__VA_ARGS__)