├── .clang-format ├── .github └── workflows │ ├── clang-format.yml │ └── main.yml ├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── ci ├── ci_includes.cmd.in ├── ci_includes.sh.in ├── forum-update-info.json ├── macos │ ├── change-rpath.sh │ └── install-packagesbuild.sh └── windows │ └── package-windows.cmd ├── cmake ├── ObsPluginHelpers.cmake └── bundle │ └── macos │ ├── Plugin-Info.plist.in │ └── entitlements.plist ├── data └── locale │ └── en-US.ini ├── installer ├── installer-Windows.iss.in └── installer-macOS.pkgproj.in └── src ├── main-view-source.c ├── plugin-macros.h.in └── plugin-main.c /.clang-format: -------------------------------------------------------------------------------- 1 | # please use clang-format version 8 or later 2 | 3 | Standard: Cpp11 4 | AccessModifierOffset: -8 5 | AlignAfterOpenBracket: Align 6 | AlignConsecutiveAssignments: false 7 | AlignConsecutiveDeclarations: false 8 | AlignEscapedNewlines: Left 9 | AlignOperands: true 10 | AlignTrailingComments: true 11 | #AllowAllArgumentsOnNextLine: false # requires clang-format 9 12 | #AllowAllConstructorInitializersOnNextLine: false # requires clang-format 9 13 | AllowAllParametersOfDeclarationOnNextLine: false 14 | AllowShortBlocksOnASingleLine: false 15 | AllowShortCaseLabelsOnASingleLine: false 16 | AllowShortFunctionsOnASingleLine: Inline 17 | AllowShortIfStatementsOnASingleLine: false 18 | #AllowShortLambdasOnASingleLine: Inline # requires clang-format 9 19 | AllowShortLoopsOnASingleLine: false 20 | AlwaysBreakAfterDefinitionReturnType: None 21 | AlwaysBreakAfterReturnType: None 22 | AlwaysBreakBeforeMultilineStrings: false 23 | AlwaysBreakTemplateDeclarations: false 24 | BinPackArguments: true 25 | BinPackParameters: true 26 | BraceWrapping: 27 | AfterClass: false 28 | AfterControlStatement: false 29 | AfterEnum: false 30 | AfterFunction: true 31 | AfterNamespace: false 32 | AfterObjCDeclaration: false 33 | AfterStruct: true 34 | AfterUnion: false 35 | AfterExternBlock: false 36 | BeforeCatch: false 37 | BeforeElse: true 38 | IndentBraces: false 39 | SplitEmptyFunction: true 40 | SplitEmptyRecord: true 41 | SplitEmptyNamespace: true 42 | BreakBeforeBinaryOperators: None 43 | BreakBeforeBraces: Custom 44 | BreakBeforeTernaryOperators: true 45 | BreakConstructorInitializers: BeforeColon 46 | BreakStringLiterals: false # apparently unpredictable 47 | ColumnLimit: 120 48 | CompactNamespaces: false 49 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 50 | ConstructorInitializerIndentWidth: 8 51 | ContinuationIndentWidth: 8 52 | Cpp11BracedListStyle: true 53 | DerivePointerAlignment: false 54 | DisableFormat: false 55 | FixNamespaceComments: false 56 | ForEachMacros: 57 | - 'json_object_foreach' 58 | - 'json_object_foreach_safe' 59 | - 'json_array_foreach' 60 | IncludeBlocks: Preserve 61 | IndentCaseLabels: false 62 | IndentPPDirectives: None 63 | IndentWidth: 8 64 | IndentWrappedFunctionNames: false 65 | KeepEmptyLinesAtTheStartOfBlocks: true 66 | MaxEmptyLinesToKeep: 1 67 | NamespaceIndentation: None 68 | #ObjCBinPackProtocolList: Auto # requires clang-format 7 69 | ObjCBlockIndentWidth: 8 70 | ObjCSpaceAfterProperty: true 71 | ObjCSpaceBeforeProtocolList: true 72 | 73 | PenaltyBreakAssignment: 10 74 | PenaltyBreakBeforeFirstCallParameter: 30 75 | PenaltyBreakComment: 10 76 | PenaltyBreakFirstLessLess: 0 77 | PenaltyBreakString: 10 78 | PenaltyExcessCharacter: 100 79 | PenaltyReturnTypeOnItsOwnLine: 60 80 | 81 | PointerAlignment: Right 82 | ReflowComments: false 83 | SortIncludes: false 84 | SortUsingDeclarations: false 85 | SpaceAfterCStyleCast: false 86 | #SpaceAfterLogicalNot: false # requires clang-format 9 87 | SpaceAfterTemplateKeyword: false 88 | SpaceBeforeAssignmentOperators: true 89 | #SpaceBeforeCtorInitializerColon: true # requires clang-format 7 90 | #SpaceBeforeInheritanceColon: true # requires clang-format 7 91 | SpaceBeforeParens: ControlStatements 92 | #SpaceBeforeRangeBasedForLoopColon: true # requires clang-format 7 93 | SpaceInEmptyParentheses: false 94 | SpacesBeforeTrailingComments: 1 95 | SpacesInAngles: false 96 | SpacesInCStyleCastParentheses: false 97 | SpacesInContainerLiterals: false 98 | SpacesInParentheses: false 99 | SpacesInSquareBrackets: false 100 | #StatementMacros: # requires clang-format 8 101 | # - 'Q_OBJECT' 102 | TabWidth: 8 103 | #TypenameMacros: # requires clang-format 9 104 | # - 'DARRAY' 105 | UseTab: ForContinuationAndIndentation 106 | --- 107 | Language: ObjC 108 | -------------------------------------------------------------------------------- /.github/workflows/clang-format.yml: -------------------------------------------------------------------------------- 1 | name: Clang Format Check 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | clang: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Clang 17 | run: | 18 | sudo apt-get install -y clang-format-12 19 | clang-format -i -fallback-style=none $(git ls-files | grep '\.\(c\|h\)$') 20 | 21 | - name: Check 22 | # Build your program with the given configuration 23 | run: | 24 | dirty=$(git ls-files --modified) 25 | set +x 26 | if [[ $dirty ]]; then 27 | git diff 28 | echo "Error: File(s) are not properly formatted." 29 | echo "$dirty" 30 | exit 1 31 | fi 32 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Plugin Build 2 | 3 | on: 4 | push: 5 | paths-ignore: 6 | - '**.md' 7 | branches: 8 | - main 9 | tags: 10 | - '*' 11 | pull_request: 12 | paths-ignore: 13 | - '**.md' 14 | branches: 15 | - main 16 | 17 | env: 18 | artifactName: ${{ contains(github.ref_name, '/') && 'artifact' || github.ref_name }} 19 | qt: false 20 | 21 | jobs: 22 | linux_build: 23 | runs-on: ${{ matrix.ubuntu }} 24 | strategy: 25 | fail-fast: false 26 | matrix: 27 | obs: [27, 28] 28 | ubuntu: ['ubuntu-20.04'] 29 | defaults: 30 | run: 31 | shell: bash 32 | steps: 33 | - name: Checkout 34 | uses: actions/checkout@v3 35 | with: 36 | submodules: recursive 37 | 38 | - name: Download obs-studio development environment 39 | id: obsdeps 40 | uses: norihiro/obs-studio-devel-action@v1-beta 41 | with: 42 | obs: ${{ matrix.obs }} 43 | verbose: true 44 | qt: ${{ env.qt }} 45 | 46 | - name: Build plugin 47 | run: | 48 | OBS_QT_VERSION_MAJOR=${{ steps.obsdeps.outputs.OBS_QT_VERSION_MAJOR }} 49 | mkdir build 50 | cd build 51 | case ${{ matrix.obs }} in 52 | 27) 53 | cmake_opt=( 54 | -D CMAKE_INSTALL_LIBDIR=/usr/lib/ 55 | -D CPACK_DEBIAN_PACKAGE_DEPENDS='obs-studio (>= 27), obs-studio (<< 28)' 56 | ) 57 | ;; 58 | 28) 59 | cmake_opt=( 60 | -D CPACK_DEBIAN_PACKAGE_DEPENDS='obs-studio (>= 28)' 61 | ) 62 | ;; 63 | esac 64 | cmake .. \ 65 | -D QT_VERSION=$OBS_QT_VERSION_MAJOR \ 66 | -D CMAKE_INSTALL_PREFIX=/usr \ 67 | -D CMAKE_BUILD_TYPE=RelWithDebInfo \ 68 | -D LINUX_PORTABLE=OFF \ 69 | -D CPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON \ 70 | -D PKG_SUFFIX=-obs${{ matrix.obs }}-${{ matrix.ubuntu }}-x86_64 \ 71 | "${cmake_opt[@]}" 72 | make -j4 73 | make package 74 | echo "FILE_NAME=$(find $PWD -name '*.deb' | head -n 1)" >> $GITHUB_ENV 75 | - name: Upload build artifact 76 | uses: actions/upload-artifact@v3 77 | with: 78 | name: ${{ env.artifactName }} 79 | path: '${{ env.FILE_NAME }}' 80 | - name: Check package 81 | run: | 82 | . ci/ci_includes.generated.sh 83 | set -ex 84 | sudo apt install '${{ env.FILE_NAME }}' 85 | case ${{ matrix.obs }} in 86 | 27) plugins_dir=/usr/lib/obs-plugins ;; 87 | 28) plugins_dir=/usr/lib/x86_64-linux-gnu/obs-plugins ;; 88 | esac 89 | ldd $plugins_dir/${PLUGIN_NAME}.so > ldd.out 90 | if grep not.found ldd.out ; then 91 | echo "Error: unresolved shared object." >&2 92 | exit 1 93 | fi 94 | ls /usr/share/obs/obs-plugins/${PLUGIN_NAME}/ 95 | 96 | macos_build: 97 | runs-on: macos-12 98 | strategy: 99 | fail-fast: false 100 | matrix: 101 | include: 102 | - obs: 27 103 | arch: x86_64 104 | - obs: 28 105 | arch: universal 106 | defaults: 107 | run: 108 | shell: bash 109 | steps: 110 | - name: Checkout 111 | uses: actions/checkout@v3 112 | with: 113 | submodules: recursive 114 | 115 | - name: Setup Environment 116 | id: setup 117 | run: | 118 | set -e 119 | echo '::group::Set up code signing' 120 | if [[ '${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}' != '' && \ 121 | '${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}' != '' && \ 122 | '${{ secrets.MACOS_SIGNING_CERT }}' != '' ]]; then 123 | echo '::set-output name=haveCodesignIdent::true' 124 | else 125 | echo '::set-output name=haveCodesignIdent::false' 126 | fi 127 | if [[ '${{ secrets.MACOS_NOTARIZATION_USERNAME }}' != '' && \ 128 | '${{ secrets.MACOS_NOTARIZATION_PASSWORD }}' != '' ]]; then 129 | echo '::set-output name=haveNotarizationUser::true' 130 | else 131 | echo '::set-output name=haveNotarizationUser::false' 132 | fi 133 | echo '::endgroup::' 134 | 135 | - name: Install Apple Developer Certificate 136 | if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }} 137 | uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071 138 | with: 139 | keychain-password: ${{ github.run_id }} 140 | p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }} 141 | p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }} 142 | 143 | - name: Set Signing Identity 144 | if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }} 145 | run: | 146 | set -e 147 | TEAM_ID=$(echo "${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" | sed 's/.*(\([A-Za-z0-9]*\))$/\1/') 148 | xcrun notarytool store-credentials AC_PASSWORD \ 149 | --apple-id "${{ secrets.MACOS_NOTARIZATION_USERNAME }}" \ 150 | --team-id "$TEAM_ID" \ 151 | --password "${{ secrets.MACOS_NOTARIZATION_PASSWORD }}" 152 | 153 | - name: Download obs-studio development environment 154 | id: obsdeps 155 | uses: norihiro/obs-studio-devel-action@v1-beta 156 | with: 157 | path: /tmp/deps-${{ matrix.obs }}-${{ matrix.arch }} 158 | arch: ${{ matrix.arch }} 159 | obs: ${{ matrix.obs }} 160 | verbose: true 161 | qt: ${{ env.qt }} 162 | 163 | - name: Build plugin 164 | run: | 165 | arch=${{ matrix.arch }} 166 | deps=/tmp/deps-${{ matrix.obs }}-${{ matrix.arch }} 167 | MACOSX_DEPLOYMENT_TARGET=${{ steps.obsdeps.outputs.MACOSX_DEPLOYMENT_TARGET }} 168 | OBS_QT_VERSION_MAJOR=${{ steps.obsdeps.outputs.OBS_QT_VERSION_MAJOR }} 169 | GIT_TAG=$(git describe --tags --always) 170 | PKG_SUFFIX=-${GIT_TAG}-obs${{ matrix.obs }}-macos-${{ matrix.arch }} 171 | set -e 172 | case "${{ matrix.obs }}" in 173 | 27) 174 | cmake_opt=() 175 | ;; 176 | 28) 177 | cmake_opt=( 178 | -D MACOSX_PLUGIN_BUNDLE_TYPE=BNDL 179 | -D OBS_BUNDLE_CODESIGN_IDENTITY='${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}' 180 | ) 181 | ;; 182 | esac 183 | cmake -S . -B build -G Ninja \ 184 | -D QT_VERSION=$OBS_QT_VERSION_MAJOR \ 185 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ 186 | -DCMAKE_PREFIX_PATH="$PWD/release/" \ 187 | -DCMAKE_OSX_ARCHITECTURES=${arch/#universal/x86_64;arm64} \ 188 | -DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \ 189 | -DCMAKE_FRAMEWORK_PATH="$deps/Frameworks;$deps/lib/cmake;$deps" \ 190 | -D PKG_SUFFIX=$PKG_SUFFIX \ 191 | "${cmake_opt[@]}" 192 | cmake --build build --config RelWithDebInfo 193 | echo "PKG_SUFFIX='$PKG_SUFFIX'" >> ci/ci_includes.generated.sh 194 | 195 | - name: Prepare package 196 | run: | 197 | set -ex 198 | . ci/ci_includes.generated.sh 199 | cmake --install build --config RelWithDebInfo --prefix=release 200 | case ${{ matrix.obs }} in 201 | 27) 202 | (cd release/${PLUGIN_NAME} && ../../ci/macos/change-rpath.sh -obs ${{ matrix.obs }} -lib lib/ bin/${PLUGIN_NAME}.so) 203 | cp LICENSE release/${PLUGIN_NAME}/data/LICENSE-$PLUGIN_NAME 204 | ;; 205 | 28) 206 | (cd release/${PLUGIN_NAME}.plugin/Contents && ../../../ci/macos/change-rpath.sh -obs 28 -lib lib/ MacOS/${PLUGIN_NAME}) 207 | cp LICENSE release/${PLUGIN_NAME}.plugin/Contents/Resources/LICENSE-$PLUGIN_NAME 208 | ;; 209 | esac 210 | 211 | - name: Codesign 212 | if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }} 213 | run: | 214 | . ci/ci_includes.generated.sh 215 | set -ex 216 | case ${{ matrix.obs }} in 217 | 27) 218 | files=( 219 | $(find release/${PLUGIN_NAME}/ -name '*.dylib') 220 | release/${PLUGIN_NAME}/bin/${PLUGIN_NAME}.so 221 | ) 222 | ;; 223 | 28) 224 | files=( 225 | $(find release/${PLUGIN_NAME}.plugin/ -name '*.dylib') 226 | release/${PLUGIN_NAME}.plugin/Contents/MacOS/${PLUGIN_NAME} 227 | ) 228 | ;; 229 | esac 230 | for dylib in "${files[@]}"; do 231 | codesign --force --sign "${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" "$dylib" 232 | done 233 | for dylib in "${files[@]}"; do 234 | codesign -vvv --deep --strict "$dylib" 235 | done 236 | 237 | - name: Package 238 | run: | 239 | . ci/ci_includes.generated.sh 240 | set -ex 241 | zipfile=$PWD/package/${PLUGIN_NAME}${PKG_SUFFIX}.zip 242 | mkdir package 243 | case ${{ matrix.obs }} in 244 | 27) (cd release/ && zip -r $zipfile ${PLUGIN_NAME}) ;; 245 | 28) (cd release/ && zip -r $zipfile ${PLUGIN_NAME}.plugin) ;; 246 | esac 247 | ci/macos/install-packagesbuild.sh 248 | packagesbuild \ 249 | --build-folder $PWD/package/ \ 250 | build/installer-macOS.generated.pkgproj 251 | 252 | - name: Productsign 253 | if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }} 254 | run: | 255 | . ci/ci_includes.generated.sh 256 | pkgfile=package/${PLUGIN_NAME}${PKG_SUFFIX}.pkg 257 | set -e 258 | . ci/ci_includes.generated.sh 259 | productsign --sign "${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}" $pkgfile package/${PLUGIN_NAME}-signed.pkg 260 | mv package/${PLUGIN_NAME}-signed.pkg $pkgfile 261 | 262 | - name: Notarize 263 | if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }} 264 | uses: norihiro/macos-notarize-action@v1 265 | with: 266 | path: package/* 267 | keychainProfile: AC_PASSWORD 268 | verbose: true 269 | 270 | - name: Upload build artifact 271 | uses: actions/upload-artifact@v3 272 | with: 273 | name: ${{ env.artifactName }} 274 | path: package/* 275 | 276 | windows_build: 277 | runs-on: windows-2022 278 | strategy: 279 | fail-fast: false 280 | matrix: 281 | obs: [27] 282 | arch: [x64] 283 | env: 284 | visualStudio: 'Visual Studio 17 2022' 285 | Configuration: 'RelWithDebInfo' 286 | defaults: 287 | run: 288 | shell: pwsh 289 | steps: 290 | - name: Checkout 291 | uses: actions/checkout@v3 292 | with: 293 | submodules: recursive 294 | - name: Download obs-studio 295 | id: obsdeps 296 | uses: norihiro/obs-studio-devel-action@v1-beta 297 | with: 298 | obs: ${{ matrix.obs }} 299 | qt: ${{ env.qt }} 300 | 301 | - name: Build plugin 302 | run: | 303 | $CmakeArgs = @( 304 | '-G', "${{ env.visualStudio }}" 305 | '-DQT_VERSION=${{ steps.obsdeps.outputs.OBS_QT_VERSION_MAJOR }}' 306 | '-DCMAKE_SYSTEM_VERSION=10.0.18363.657' 307 | "-DCMAKE_INSTALL_PREFIX=$(Resolve-Path -Path "./obs-build-dependencies/plugin-deps-${{ matrix.arch }}")" 308 | "-DCMAKE_PREFIX_PATH=$(Resolve-Path -Path "./obs-build-dependencies/plugin-deps-${{ matrix.arch }}")" 309 | ) 310 | cmake -S . -B build @CmakeArgs 311 | cmake --build build --config RelWithDebInfo -j 4 312 | cmake --install build --config RelWithDebInfo --prefix "$(Resolve-Path -Path .)/release" 313 | - name: Package plugin 314 | run: ci/windows/package-windows.cmd ${{ matrix.obs }} 315 | - name: Upload build artifact 316 | uses: actions/upload-artifact@v3 317 | with: 318 | name: ${{ env.artifactName }} 319 | path: package/* 320 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .DS_Store 3 | /build/ 4 | /build32/ 5 | /build64/ 6 | /release/ 7 | /installer/Output/ 8 | 9 | .vscode 10 | .idea 11 | 12 | # ignore generated files 13 | *.generated.* 14 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | 3 | project(obs-main-view-source VERSION 0.2.4) 4 | 5 | set(PLUGIN_AUTHOR "Norihiro Kamae") 6 | 7 | # Replace `com.example.obs-plugin-template` with a unique Bundle ID for macOS releases 8 | # (used both in the installer and when submitting the installer for notarization) 9 | set(MACOS_BUNDLEID "net.nagater.obs-main-view-source") 10 | set(ID_PREFIX "net.nagater.obs-main-view-source.") 11 | set(MACOS_PACKAGE_UUID "BE89E243-A0FD-49E7-82BC-57D451D81D38") 12 | set(MACOS_INSTALLER_UUID "F2AFC1AC-4C21-4B6E-8F23-B506D0156D96") 13 | set(PLUGIN_URL "https://obsproject.com/forum/resources/main-view-source.1501/") 14 | 15 | # Replace `me@contoso.com` with the maintainer email address you want to put in Linux packages 16 | set(LINUX_MAINTAINER_EMAIL "norihiro@nagater.net") 17 | 18 | # TAKE NOTE: No need to edit things past this point 19 | 20 | find_package(libobs REQUIRED) 21 | include(cmake/ObsPluginHelpers.cmake) 22 | 23 | configure_file( 24 | src/plugin-macros.h.in 25 | ../src/plugin-macros.generated.h 26 | ) 27 | configure_file( 28 | installer/installer-Windows.iss.in 29 | ../installer/installer-Windows.generated.iss 30 | ) 31 | 32 | configure_file( 33 | ci/ci_includes.sh.in 34 | ../ci/ci_includes.generated.sh 35 | ) 36 | configure_file( 37 | ci/ci_includes.cmd.in 38 | ../ci/ci_includes.generated.cmd 39 | ) 40 | 41 | set(PLUGIN_SOURCES 42 | src/plugin-main.c 43 | src/main-view-source.c 44 | ) 45 | 46 | add_library(${CMAKE_PROJECT_NAME} MODULE ${PLUGIN_SOURCES}) 47 | 48 | target_link_libraries(${CMAKE_PROJECT_NAME} 49 | OBS::libobs 50 | ) 51 | 52 | if(OS_WINDOWS) 53 | # Enable Multicore Builds and disable FH4 (to not depend on VCRUNTIME140_1.DLL when building with VS2019) 54 | if (MSVC) 55 | add_definitions(/MP /d2FH4-) 56 | endif() 57 | 58 | target_link_libraries(${CMAKE_PROJECT_NAME} OBS::w32-pthreads) 59 | endif() 60 | 61 | if(OS_LINUX) 62 | target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -Wall -Wextra) 63 | endif() 64 | 65 | if(APPLE) 66 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fvisibility=default") 67 | 68 | set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PREFIX "") 69 | set(MACOSX_PLUGIN_GUI_IDENTIFIER "${MACOS_BUNDLEID}") 70 | set(MACOSX_PLUGIN_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION}") 71 | set(MACOSX_PLUGIN_SHORT_VERSION_STRING "1") 72 | endif() 73 | 74 | setup_plugin_target(${CMAKE_PROJECT_NAME}) 75 | 76 | configure_file(installer/installer-macOS.pkgproj.in installer-macOS.generated.pkgproj) 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Main View Source plugin for OBS Studio 2 | 3 | ## Introduction 4 | 5 | This is a simple plugin for OBS Studio that provides a source to duplicate the main view. 6 | 7 | This plugin is compatible with Source Record filter and Dedicated NDI filter. 8 | 9 | ## Properties 10 | 11 | ### Cache the main view 12 | 13 | Cache texture of the main view at the first rendering and reuse the cached texture for the later rendering. 14 | If enabled, the previous frame will be displayed if the source is nested. Also scene items overflowing the texture will be cropped. 15 | Enable this setting if one of these conditions applies. 16 | - You want to hide overflowing scene items outside the bounding box of the main view. 17 | - You want to put the source on the main view to enjoy fractals. 18 | 19 | ### Render before output/display rendering 20 | 21 | *Deprecated* 22 | 23 | Render the texture before OBS start to render output and each display. 24 | Recommended to enable if 25 | - You want to have the source in a nested scene. 26 | 27 | If enabled, since the order of rendering sources changes, something might be affected. 28 | 29 | If no issues are reported without disabling this property, this property might be dropped in the future and fixed to enabled. If you need this property, please file an issue not to deprecate. 30 | 31 | ## Build and install 32 | ### Linux 33 | Use cmake to build on Linux. After checkout, run these commands. 34 | ``` 35 | sed -i 's;${CMAKE_INSTALL_FULL_LIBDIR};/usr/lib;' CMakeLists.txt 36 | mkdir build && cd build 37 | cmake -DCMAKE_INSTALL_PREFIX=/usr .. 38 | make 39 | sudo make install 40 | ``` 41 | 42 | ### macOS 43 | Use cmake to build on Linux. After checkout, run these commands. 44 | ``` 45 | mkdir build && cd build 46 | cmake .. 47 | make 48 | ``` 49 | 50 | ## See also 51 | - [obs-source-record](https://github.com/exeldro/obs-source-record) 52 | - [obs-ndi](https://github.com/Palakis/obs-ndi) 53 | -------------------------------------------------------------------------------- /ci/ci_includes.cmd.in: -------------------------------------------------------------------------------- 1 | set PluginName=@CMAKE_PROJECT_NAME@ 2 | set PluginVersion=@CMAKE_PROJECT_VERSION@ 3 | -------------------------------------------------------------------------------- /ci/ci_includes.sh.in: -------------------------------------------------------------------------------- 1 | PLUGIN_NAME="@CMAKE_PROJECT_NAME@" 2 | PLUGIN_VERSION="@CMAKE_PROJECT_VERSION@" 3 | MACOS_BUNDLEID="@MACOS_BUNDLEID@" 4 | LINUX_MAINTAINER_EMAIL="@LINUX_MAINTAINER_EMAIL@" -------------------------------------------------------------------------------- /ci/forum-update-info.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugin_url": "https://obsproject.com/forum/resources/main-view-source.1501/" 3 | } 4 | -------------------------------------------------------------------------------- /ci/macos/change-rpath.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | libdir='' 4 | obsver='' 5 | 6 | while (($# > 0)); do 7 | case "$1" in 8 | -lib) 9 | libdir="$2" 10 | shift 2;; 11 | -obs) 12 | obsver="$2" 13 | shift 2;; 14 | *) 15 | break ;; 16 | esac 17 | done 18 | 19 | set -e 20 | 21 | function copy_local_dylib 22 | { 23 | local dylib 24 | t=$(mktemp) 25 | otool -L $1 > $t 26 | awk '/^ \/usr\/local\/(opt|Cellar)\/.*\.dylib/{print $1}' $t | 27 | while read -r dylib; do 28 | echo "Changing dependency $1 -> $dylib" 29 | local b=$(basename $dylib) 30 | if test ! -e $libdir/$b; then 31 | mkdir -p $libdir 32 | cp $dylib $libdir 33 | chmod +rwx $libdir/$b 34 | install_name_tool -id "@loader_path/$b" $libdir/$b 35 | copy_local_dylib $libdir/$b 36 | fi 37 | install_name_tool -change "$dylib" "@loader_path/../$libdir/$b" $1 38 | done 39 | rm -f "$t" 40 | } 41 | 42 | function change_obs27_libs 43 | { 44 | # obs-frontend-api: 45 | # OBS 27.2 provides only `libobs-frontend-api.dylib`. 46 | # OBS 28.0 will provide `libobs-frontend-api.1.dylib` and `libobs-frontend-api.dylib`. 47 | # libobs: 48 | # Both OBS 27.2 and 28.0 provides `libobs.dylib`, `libobs.0.dylib`, `libobs.framework/Versions/A/libobs`. 49 | 50 | install_name_tool \ 51 | -change @rpath/QtWidgets.framework/Versions/5/QtWidgets \ 52 | @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets \ 53 | -change @rpath/QtGui.framework/Versions/5/QtGui \ 54 | @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui \ 55 | -change @rpath/QtCore.framework/Versions/5/QtCore \ 56 | @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore \ 57 | -change @rpath/libobs.framework/Versions/A/libobs \ 58 | @rpath/libobs.0.dylib \ 59 | -change @rpath/libobs-frontend-api.0.dylib \ 60 | @rpath/libobs-frontend-api.dylib \ 61 | "$1" 62 | } 63 | 64 | for i in "$@"; do 65 | case "$obsver" in 66 | 27 | 27.*) 67 | change_obs27_libs "$i" 68 | ;; 69 | 28 | 28.*) 70 | : # Not necessary to change dylib paths for OBS 28 71 | ;; 72 | esac 73 | copy_local_dylib "$i" 74 | done 75 | -------------------------------------------------------------------------------- /ci/macos/install-packagesbuild.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | set -e 4 | 5 | if which packagesbuild; then 6 | exit 0 7 | fi 8 | 9 | packages_url='http://www.nagater.net/obs-studio/Packages.dmg' 10 | packages_hash='6afdd25386295974dad8f078b8f1e41cabebd08e72d970bf92f707c7e48b16c9' 11 | 12 | for ((retry=5; retry>0; retry--)); do 13 | curl -o Packages.dmg $packages_url 14 | sha256sum -c <<<"$packages_hash Packages.dmg" && break 15 | done 16 | 17 | hdiutil attach -noverify Packages.dmg 18 | packages_volume="$(hdiutil info -plist | grep '/Volumes/Packages' | sed 's/.*\(\/Volumes\/[^<]*\)<\/string>/\1/')" 19 | 20 | sudo installer -pkg "${packages_volume}/packages/Packages.pkg" -target / 21 | hdiutil detach "${packages_volume}" 22 | -------------------------------------------------------------------------------- /ci/windows/package-windows.cmd: -------------------------------------------------------------------------------- 1 | call "%~dp0..\ci_includes.generated.cmd" 2 | 3 | mkdir package 4 | cd package 5 | 6 | git describe --tags --always > package-version.txt 7 | set /p PackageVersion= 262 | DESTINATION $/${OBS_PLUGIN_DESTINATION} 263 | COMPONENT obs_rundir 264 | EXCLUDE_FROM_ALL) 265 | 266 | if(OS_WINDOWS) 267 | install( 268 | FILES $ 269 | CONFIGURATIONS "RelWithDebInfo" "Debug" 270 | DESTINATION ${OBS_PLUGIN_DESTINATION} 271 | COMPONENT ${target}_Runtime 272 | OPTIONAL) 273 | 274 | install( 275 | FILES $ 276 | CONFIGURATIONS "RelWithDebInfo" "Debug" 277 | DESTINATION $/${OBS_PLUGIN_DESTINATION} 278 | COMPONENT obs_rundir 279 | OPTIONAL EXCLUDE_FROM_ALL) 280 | endif() 281 | 282 | if(MSVC) 283 | target_link_options( 284 | ${target} 285 | PRIVATE 286 | "LINKER:/OPT:REF" 287 | "$<$>:LINKER\:/SAFESEH\:NO>" 288 | "$<$:LINKER\:/INCREMENTAL:NO>" 289 | "$<$:LINKER\:/INCREMENTAL:NO>") 290 | endif() 291 | 292 | setup_target_resources(${target} obs-plugins/${target}) 293 | 294 | if(OS_WINDOWS) 295 | add_custom_command( 296 | TARGET ${target} 297 | POST_BUILD 298 | COMMAND 299 | "${CMAKE_COMMAND}" -DCMAKE_INSTALL_PREFIX=${OBS_OUTPUT_DIR} 300 | -DCMAKE_INSTALL_COMPONENT=obs_rundir 301 | -DCMAKE_INSTALL_CONFIG_NAME=$ -P 302 | ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake 303 | COMMENT "Installing to plugin rundir" 304 | VERBATIM) 305 | endif() 306 | endfunction() 307 | 308 | function(setup_target_resources target destination) 309 | if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/data) 310 | install( 311 | DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/ 312 | DESTINATION ${OBS_DATA_DESTINATION}/${destination} 313 | USE_SOURCE_PERMISSIONS 314 | COMPONENT obs_plugins) 315 | 316 | install( 317 | DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data 318 | DESTINATION $/${OBS_DATA_DESTINATION}/${destination} 319 | USE_SOURCE_PERMISSIONS 320 | COMPONENT obs_rundir 321 | EXCLUDE_FROM_ALL) 322 | endif() 323 | endfunction() 324 | endif() 325 | -------------------------------------------------------------------------------- /cmake/bundle/macos/Plugin-Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleName 6 | ${MACOSX_PLUGIN_BUNDLE_NAME} 7 | CFBundleIdentifier 8 | ${MACOSX_PLUGIN_GUI_IDENTIFIER} 9 | CFBundleVersion 10 | ${MACOSX_PLUGIN_BUNDLE_VERSION} 11 | CFBundleShortVersionString 12 | ${MACOSX_PLUGIN_SHORT_VERSION_STRING} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleExecutable 16 | ${MACOSX_PLUGIN_EXECUTABLE_NAME} 17 | CFBundlePackageType 18 | ${MACOSX_PLUGIN_BUNDLE_TYPE} 19 | CFBundleSupportedPlatforms 20 | 21 | MacOSX 22 | 23 | LSMinimumSystemVersion 24 | 10.13 25 | 26 | 27 | -------------------------------------------------------------------------------- /cmake/bundle/macos/entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.cs.allow-unsigned-executable-memory 6 | 7 | com.apple.security.device.camera 8 | 9 | com.apple.security.device.audio-input 10 | 11 | com.apple.security.cs.disable-library-validation 12 | 13 | 14 | com.apple.security.cs.allow-dyld-environment-variables 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /data/locale/en-US.ini: -------------------------------------------------------------------------------- 1 | Source.Name="Main View Source" 2 | -------------------------------------------------------------------------------- /installer/installer-Windows.iss.in: -------------------------------------------------------------------------------- 1 | #define MyAppName "@CMAKE_PROJECT_NAME@" 2 | #define MyAppVersion "@CMAKE_PROJECT_VERSION@" 3 | #define MyAppPublisher "@PLUGIN_AUTHOR@" 4 | #define MyAppURL "@PLUGIN_URL@" 5 | 6 | [Setup] 7 | ; NOTE: The value of AppId uniquely identifies this application. 8 | ; Do not use the same AppId value in installers for other applications. 9 | ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) 10 | AppId={{CD703FE5-1F2C-4837-BD3D-DD840D83C3E3} 11 | AppName={#MyAppName} 12 | AppVersion={#MyAppVersion} 13 | AppPublisher={#MyAppPublisher} 14 | AppPublisherURL={#MyAppURL} 15 | AppSupportURL={#MyAppURL} 16 | AppUpdatesURL={#MyAppURL} 17 | DefaultDirName={code:GetDirName} 18 | DefaultGroupName={#MyAppName} 19 | OutputBaseFilename={#MyAppName}-{#MyAppVersion}-Windows-Installer 20 | Compression=lzma 21 | SolidCompression=yes 22 | 23 | [Languages] 24 | Name: "english"; MessagesFile: "compiler:Default.isl" 25 | 26 | [Files] 27 | Source: "..\release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs 28 | Source: "..\LICENSE"; Flags: dontcopy 29 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files 30 | 31 | [Icons] 32 | Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" 33 | Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" 34 | 35 | [Code] 36 | procedure InitializeWizard(); 37 | var 38 | GPLText: AnsiString; 39 | Page: TOutputMsgMemoWizardPage; 40 | begin 41 | ExtractTemporaryFile('LICENSE'); 42 | LoadStringFromFile(ExpandConstant('{tmp}\LICENSE'), GPLText); 43 | Page := CreateOutputMsgMemoPage(wpWelcome, 44 | 'License Information', 'Please review the license terms before installing {#MyAppName}', 45 | 'Press Page Down to see the rest of the agreement. Once you are aware of your rights, click Next to continue.', 46 | String(GPLText) 47 | ); 48 | end; 49 | 50 | // credit where it's due : 51 | // following function come from https://github.com/Xaymar/obs-studio_amf-encoder-plugin/blob/master/%23Resources/Installer.in.iss#L45 52 | function GetDirName(Value: string): string; 53 | var 54 | InstallPath: string; 55 | begin 56 | // initialize default path, which will be returned when the following registry 57 | // key queries fail due to missing keys or for some different reason 58 | Result := '{pf}\obs-studio'; 59 | // query the first registry value; if this succeeds, return the obtained value 60 | if RegQueryStringValue(HKLM32, 'SOFTWARE\OBS Studio', '', InstallPath) then 61 | Result := InstallPath 62 | end; 63 | 64 | -------------------------------------------------------------------------------- /installer/installer-macOS.pkgproj.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PACKAGES 6 | 7 | 8 | MUST-CLOSE-APPLICATION-ITEMS 9 | 10 | MUST-CLOSE-APPLICATIONS 11 | 12 | PACKAGE_FILES 13 | 14 | DEFAULT_INSTALL_LOCATION 15 | / 16 | HIERARCHY 17 | 18 | CHILDREN 19 | 20 | 21 | CHILDREN 22 | 23 | GID 24 | 80 25 | PATH 26 | Applications 27 | PATH_TYPE 28 | 0 29 | PERMISSIONS 30 | 509 31 | TYPE 32 | 1 33 | UID 34 | 0 35 | 36 | 37 | CHILDREN 38 | 39 | 40 | CHILDREN 41 | 42 | 43 | CHILDREN 44 | 45 | 46 | CHILDREN 47 | 48 | 49 | BUNDLE_CAN_DOWNGRADE 50 | 51 | BUNDLE_POSTINSTALL_PATH 52 | 53 | PATH_TYPE 54 | 0 55 | 56 | BUNDLE_PREINSTALL_PATH 57 | 58 | PATH_TYPE 59 | 0 60 | 61 | CHILDREN 62 | 63 | GID 64 | 80 65 | PATH 66 | ../@RELATIVE_INSTALL_PATH@/@CMAKE_PROJECT_NAME@@FIRST_DIR_SUFFIX@ 67 | PATH_TYPE 68 | 1 69 | PERMISSIONS 70 | 493 71 | TYPE 72 | 3 73 | UID 74 | 0 75 | 76 | 77 | GID 78 | 80 79 | PATH 80 | plugins 81 | PATH_TYPE 82 | 2 83 | PERMISSIONS 84 | 509 85 | TYPE 86 | 2 87 | UID 88 | 0 89 | 90 | 91 | GID 92 | 80 93 | PATH 94 | obs-studio 95 | PATH_TYPE 96 | 2 97 | PERMISSIONS 98 | 509 99 | TYPE 100 | 2 101 | UID 102 | 0 103 | 104 | 105 | GID 106 | 80 107 | PATH 108 | Application Support 109 | PATH_TYPE 110 | 0 111 | PERMISSIONS 112 | 493 113 | TYPE 114 | 1 115 | UID 116 | 0 117 | 118 | 119 | CHILDREN 120 | 121 | GID 122 | 0 123 | PATH 124 | Automator 125 | PATH_TYPE 126 | 0 127 | PERMISSIONS 128 | 493 129 | TYPE 130 | 1 131 | UID 132 | 0 133 | 134 | 135 | CHILDREN 136 | 137 | GID 138 | 0 139 | PATH 140 | Documentation 141 | PATH_TYPE 142 | 0 143 | PERMISSIONS 144 | 493 145 | TYPE 146 | 1 147 | UID 148 | 0 149 | 150 | 151 | CHILDREN 152 | 153 | GID 154 | 0 155 | PATH 156 | Extensions 157 | PATH_TYPE 158 | 0 159 | PERMISSIONS 160 | 493 161 | TYPE 162 | 1 163 | UID 164 | 0 165 | 166 | 167 | CHILDREN 168 | 169 | GID 170 | 0 171 | PATH 172 | Filesystems 173 | PATH_TYPE 174 | 0 175 | PERMISSIONS 176 | 493 177 | TYPE 178 | 1 179 | UID 180 | 0 181 | 182 | 183 | CHILDREN 184 | 185 | GID 186 | 0 187 | PATH 188 | Frameworks 189 | PATH_TYPE 190 | 0 191 | PERMISSIONS 192 | 493 193 | TYPE 194 | 1 195 | UID 196 | 0 197 | 198 | 199 | CHILDREN 200 | 201 | GID 202 | 0 203 | PATH 204 | Input Methods 205 | PATH_TYPE 206 | 0 207 | PERMISSIONS 208 | 493 209 | TYPE 210 | 1 211 | UID 212 | 0 213 | 214 | 215 | CHILDREN 216 | 217 | GID 218 | 0 219 | PATH 220 | Internet Plug-Ins 221 | PATH_TYPE 222 | 0 223 | PERMISSIONS 224 | 493 225 | TYPE 226 | 1 227 | UID 228 | 0 229 | 230 | 231 | CHILDREN 232 | 233 | GID 234 | 0 235 | PATH 236 | LaunchAgents 237 | PATH_TYPE 238 | 0 239 | PERMISSIONS 240 | 493 241 | TYPE 242 | 1 243 | UID 244 | 0 245 | 246 | 247 | CHILDREN 248 | 249 | GID 250 | 0 251 | PATH 252 | LaunchDaemons 253 | PATH_TYPE 254 | 0 255 | PERMISSIONS 256 | 493 257 | TYPE 258 | 1 259 | UID 260 | 0 261 | 262 | 263 | CHILDREN 264 | 265 | GID 266 | 0 267 | PATH 268 | PreferencePanes 269 | PATH_TYPE 270 | 0 271 | PERMISSIONS 272 | 493 273 | TYPE 274 | 1 275 | UID 276 | 0 277 | 278 | 279 | CHILDREN 280 | 281 | GID 282 | 0 283 | PATH 284 | Preferences 285 | PATH_TYPE 286 | 0 287 | PERMISSIONS 288 | 493 289 | TYPE 290 | 1 291 | UID 292 | 0 293 | 294 | 295 | CHILDREN 296 | 297 | GID 298 | 80 299 | PATH 300 | Printers 301 | PATH_TYPE 302 | 0 303 | PERMISSIONS 304 | 493 305 | TYPE 306 | 1 307 | UID 308 | 0 309 | 310 | 311 | CHILDREN 312 | 313 | GID 314 | 0 315 | PATH 316 | PrivilegedHelperTools 317 | PATH_TYPE 318 | 0 319 | PERMISSIONS 320 | 1005 321 | TYPE 322 | 1 323 | UID 324 | 0 325 | 326 | 327 | CHILDREN 328 | 329 | GID 330 | 0 331 | PATH 332 | QuickLook 333 | PATH_TYPE 334 | 0 335 | PERMISSIONS 336 | 493 337 | TYPE 338 | 1 339 | UID 340 | 0 341 | 342 | 343 | CHILDREN 344 | 345 | GID 346 | 0 347 | PATH 348 | QuickTime 349 | PATH_TYPE 350 | 0 351 | PERMISSIONS 352 | 493 353 | TYPE 354 | 1 355 | UID 356 | 0 357 | 358 | 359 | CHILDREN 360 | 361 | GID 362 | 0 363 | PATH 364 | Screen Savers 365 | PATH_TYPE 366 | 0 367 | PERMISSIONS 368 | 493 369 | TYPE 370 | 1 371 | UID 372 | 0 373 | 374 | 375 | CHILDREN 376 | 377 | GID 378 | 0 379 | PATH 380 | Scripts 381 | PATH_TYPE 382 | 0 383 | PERMISSIONS 384 | 493 385 | TYPE 386 | 1 387 | UID 388 | 0 389 | 390 | 391 | CHILDREN 392 | 393 | GID 394 | 0 395 | PATH 396 | Services 397 | PATH_TYPE 398 | 0 399 | PERMISSIONS 400 | 493 401 | TYPE 402 | 1 403 | UID 404 | 0 405 | 406 | 407 | CHILDREN 408 | 409 | GID 410 | 0 411 | PATH 412 | Widgets 413 | PATH_TYPE 414 | 0 415 | PERMISSIONS 416 | 493 417 | TYPE 418 | 1 419 | UID 420 | 0 421 | 422 | 423 | GID 424 | 0 425 | PATH 426 | Library 427 | PATH_TYPE 428 | 0 429 | PERMISSIONS 430 | 493 431 | TYPE 432 | 1 433 | UID 434 | 0 435 | 436 | 437 | CHILDREN 438 | 439 | 440 | CHILDREN 441 | 442 | GID 443 | 0 444 | PATH 445 | Shared 446 | PATH_TYPE 447 | 0 448 | PERMISSIONS 449 | 1023 450 | TYPE 451 | 1 452 | UID 453 | 0 454 | 455 | 456 | GID 457 | 80 458 | PATH 459 | Users 460 | PATH_TYPE 461 | 0 462 | PERMISSIONS 463 | 493 464 | TYPE 465 | 1 466 | UID 467 | 0 468 | 469 | 470 | GID 471 | 0 472 | PATH 473 | / 474 | PATH_TYPE 475 | 0 476 | PERMISSIONS 477 | 493 478 | TYPE 479 | 1 480 | UID 481 | 0 482 | 483 | PAYLOAD_TYPE 484 | 0 485 | PRESERVE_EXTENDED_ATTRIBUTES 486 | 487 | SHOW_INVISIBLE 488 | 489 | SPLIT_FORKS 490 | 491 | TREAT_MISSING_FILES_AS_WARNING 492 | 493 | VERSION 494 | 5 495 | 496 | PACKAGE_SCRIPTS 497 | 498 | POSTINSTALL_PATH 499 | 500 | PATH_TYPE 501 | 0 502 | 503 | PREINSTALL_PATH 504 | 505 | PATH_TYPE 506 | 0 507 | 508 | RESOURCES 509 | 510 | 511 | PACKAGE_SETTINGS 512 | 513 | AUTHENTICATION 514 | 0 515 | CONCLUSION_ACTION 516 | 0 517 | FOLLOW_SYMBOLIC_LINKS 518 | 519 | IDENTIFIER 520 | @MACOS_BUNDLEID@ 521 | LOCATION 522 | 0 523 | NAME 524 | @CMAKE_PROJECT_NAME@ 525 | OVERWRITE_PERMISSIONS 526 | 527 | PAYLOAD_SIZE 528 | -1 529 | REFERENCE_PATH 530 | 531 | RELOCATABLE 532 | 533 | USE_HFS+_COMPRESSION 534 | 535 | VERSION 536 | @CMAKE_PROJECT_VERSION@ 537 | 538 | TYPE 539 | 0 540 | UUID 541 | @MACOS_PACKAGE_UUID@ 542 | 543 | 544 | PROJECT 545 | 546 | PROJECT_COMMENTS 547 | 548 | NOTES 549 | 550 | 551 | 552 | PROJECT_PRESENTATION 553 | 554 | BACKGROUND 555 | 556 | APPAREANCES 557 | 558 | DARK_AQUA 559 | 560 | LIGHT_AQUA 561 | 562 | 563 | SHARED_SETTINGS_FOR_ALL_APPAREANCES 564 | 565 | 566 | INSTALLATION TYPE 567 | 568 | HIERARCHIES 569 | 570 | INSTALLER 571 | 572 | LIST 573 | 574 | 575 | CHILDREN 576 | 577 | DESCRIPTION 578 | 579 | OPTIONS 580 | 581 | HIDDEN 582 | 583 | STATE 584 | 1 585 | 586 | PACKAGE_UUID 587 | @MACOS_PACKAGE_UUID@ 588 | TITLE 589 | 590 | TYPE 591 | 0 592 | UUID 593 | @MACOS_INSTALLER_UUID@ 594 | 595 | 596 | REMOVED 597 | 598 | 599 | 600 | MODE 601 | 0 602 | 603 | INSTALLATION_STEPS 604 | 605 | 606 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 607 | ICPresentationViewIntroductionController 608 | INSTALLER_PLUGIN 609 | Introduction 610 | LIST_TITLE_KEY 611 | InstallerSectionTitle 612 | 613 | 614 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 615 | ICPresentationViewReadMeController 616 | INSTALLER_PLUGIN 617 | ReadMe 618 | LIST_TITLE_KEY 619 | InstallerSectionTitle 620 | 621 | 622 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 623 | ICPresentationViewLicenseController 624 | INSTALLER_PLUGIN 625 | License 626 | LIST_TITLE_KEY 627 | InstallerSectionTitle 628 | 629 | 630 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 631 | ICPresentationViewDestinationSelectController 632 | INSTALLER_PLUGIN 633 | TargetSelect 634 | LIST_TITLE_KEY 635 | InstallerSectionTitle 636 | 637 | 638 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 639 | ICPresentationViewInstallationTypeController 640 | INSTALLER_PLUGIN 641 | PackageSelection 642 | LIST_TITLE_KEY 643 | InstallerSectionTitle 644 | 645 | 646 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 647 | ICPresentationViewInstallationController 648 | INSTALLER_PLUGIN 649 | Install 650 | LIST_TITLE_KEY 651 | InstallerSectionTitle 652 | 653 | 654 | ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS 655 | ICPresentationViewSummaryController 656 | INSTALLER_PLUGIN 657 | Summary 658 | LIST_TITLE_KEY 659 | InstallerSectionTitle 660 | 661 | 662 | INTRODUCTION 663 | 664 | LOCALIZATIONS 665 | 666 | 667 | LICENSE 668 | 669 | LOCALIZATIONS 670 | 671 | MODE 672 | 0 673 | 674 | README 675 | 676 | LOCALIZATIONS 677 | 678 | 679 | SUMMARY 680 | 681 | LOCALIZATIONS 682 | 683 | 684 | TITLE 685 | 686 | LOCALIZATIONS 687 | 688 | 689 | 690 | PROJECT_REQUIREMENTS 691 | 692 | LIST 693 | 694 | 695 | BEHAVIOR 696 | 3 697 | DICTIONARY 698 | 699 | IC_REQUIREMENT_OS_DISK_TYPE 700 | 1 701 | IC_REQUIREMENT_OS_DISTRIBUTION_TYPE 702 | 0 703 | IC_REQUIREMENT_OS_MINIMUM_VERSION 704 | 101300 705 | 706 | IC_REQUIREMENT_CHECK_TYPE 707 | 0 708 | IDENTIFIER 709 | fr.whitebox.Packages.requirement.os 710 | MESSAGE 711 | 712 | NAME 713 | Operating System 714 | STATE 715 | 716 | 717 | 718 | RESOURCES 719 | 720 | ROOT_VOLUME_ONLY 721 | 722 | 723 | PROJECT_SETTINGS 724 | 725 | ADVANCED_OPTIONS 726 | 727 | installer-script.domains:enable_currentUserHome 728 | 1 729 | 730 | BUILD_FORMAT 731 | 0 732 | BUILD_PATH 733 | 734 | PATH 735 | ../@RELATIVE_BUILD_PATH@ 736 | PATH_TYPE 737 | 1 738 | 739 | EXCLUDED_FILES 740 | 741 | 742 | PATTERNS_ARRAY 743 | 744 | 745 | REGULAR_EXPRESSION 746 | 747 | STRING 748 | .DS_Store 749 | TYPE 750 | 0 751 | 752 | 753 | PROTECTED 754 | 755 | PROXY_NAME 756 | Remove .DS_Store files 757 | PROXY_TOOLTIP 758 | Remove ".DS_Store" files created by the Finder. 759 | STATE 760 | 761 | 762 | 763 | PATTERNS_ARRAY 764 | 765 | 766 | REGULAR_EXPRESSION 767 | 768 | STRING 769 | .pbdevelopment 770 | TYPE 771 | 0 772 | 773 | 774 | PROTECTED 775 | 776 | PROXY_NAME 777 | Remove .pbdevelopment files 778 | PROXY_TOOLTIP 779 | Remove ".pbdevelopment" files created by ProjectBuilder or Xcode. 780 | STATE 781 | 782 | 783 | 784 | PATTERNS_ARRAY 785 | 786 | 787 | REGULAR_EXPRESSION 788 | 789 | STRING 790 | CVS 791 | TYPE 792 | 1 793 | 794 | 795 | REGULAR_EXPRESSION 796 | 797 | STRING 798 | .cvsignore 799 | TYPE 800 | 0 801 | 802 | 803 | REGULAR_EXPRESSION 804 | 805 | STRING 806 | .cvspass 807 | TYPE 808 | 0 809 | 810 | 811 | REGULAR_EXPRESSION 812 | 813 | STRING 814 | .svn 815 | TYPE 816 | 1 817 | 818 | 819 | REGULAR_EXPRESSION 820 | 821 | STRING 822 | .git 823 | TYPE 824 | 1 825 | 826 | 827 | REGULAR_EXPRESSION 828 | 829 | STRING 830 | .gitignore 831 | TYPE 832 | 0 833 | 834 | 835 | PROTECTED 836 | 837 | PROXY_NAME 838 | Remove SCM metadata 839 | PROXY_TOOLTIP 840 | Remove helper files and folders used by the CVS, SVN or Git Source Code Management systems. 841 | STATE 842 | 843 | 844 | 845 | PATTERNS_ARRAY 846 | 847 | 848 | REGULAR_EXPRESSION 849 | 850 | STRING 851 | classes.nib 852 | TYPE 853 | 0 854 | 855 | 856 | REGULAR_EXPRESSION 857 | 858 | STRING 859 | designable.db 860 | TYPE 861 | 0 862 | 863 | 864 | REGULAR_EXPRESSION 865 | 866 | STRING 867 | info.nib 868 | TYPE 869 | 0 870 | 871 | 872 | PROTECTED 873 | 874 | PROXY_NAME 875 | Optimize nib files 876 | PROXY_TOOLTIP 877 | Remove "classes.nib", "info.nib" and "designable.nib" files within .nib bundles. 878 | STATE 879 | 880 | 881 | 882 | PATTERNS_ARRAY 883 | 884 | 885 | REGULAR_EXPRESSION 886 | 887 | STRING 888 | Resources Disabled 889 | TYPE 890 | 1 891 | 892 | 893 | PROTECTED 894 | 895 | PROXY_NAME 896 | Remove Resources Disabled folders 897 | PROXY_TOOLTIP 898 | Remove "Resources Disabled" folders. 899 | STATE 900 | 901 | 902 | 903 | SEPARATOR 904 | 905 | 906 | 907 | NAME 908 | @CMAKE_PROJECT_NAME@@PKG_SUFFIX@ 909 | PAYLOAD_ONLY 910 | 911 | TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING 912 | 913 | 914 | 915 | TYPE 916 | 0 917 | VERSION 918 | 2 919 | 920 | 921 | -------------------------------------------------------------------------------- /src/main-view-source.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "plugin-macros.generated.h" 5 | 6 | #if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(29, 1, 0) 7 | #define USE_RENDERED_CALLBACK 8 | #endif 9 | 10 | struct main_view_s 11 | { 12 | obs_source_t *context; 13 | bool rendered; 14 | 15 | #ifndef USE_RENDERED_CALLBACK 16 | obs_weak_source_t *weak_source; 17 | 18 | gs_texrender_t *texrender; 19 | gs_texrender_t *texrender_prev; 20 | #else 21 | gs_texture_t *cached_texture; 22 | #endif 23 | 24 | bool offscreen_render; 25 | }; 26 | 27 | static const char *get_name(void *type_data) 28 | { 29 | UNUSED_PARAMETER(type_data); 30 | return obs_module_text("Source.Name"); 31 | } 32 | 33 | static obs_properties_t *get_properties(void *data) 34 | { 35 | UNUSED_PARAMETER(data); 36 | obs_properties_t *props = obs_properties_create(); 37 | 38 | return props; 39 | } 40 | 41 | #ifndef USE_RENDERED_CALLBACK 42 | static void main_view_offscreen_render_cb(void *data, uint32_t cx, uint32_t cy); 43 | #else 44 | static void main_view_rendered_callback(void *data); 45 | #endif 46 | 47 | static void register_offscreen_render(struct main_view_s *s) 48 | { 49 | #ifndef USE_RENDERED_CALLBACK 50 | obs_add_main_render_callback(main_view_offscreen_render_cb, s); 51 | #else 52 | obs_add_main_rendered_callback(main_view_rendered_callback, s); 53 | #endif 54 | } 55 | 56 | static void unregister_offscreen_render(struct main_view_s *s) 57 | { 58 | #ifndef USE_RENDERED_CALLBACK 59 | obs_remove_main_render_callback(main_view_offscreen_render_cb, s); 60 | #else 61 | obs_remove_main_rendered_callback(main_view_rendered_callback, s); 62 | #endif 63 | } 64 | 65 | static void update(void *data, obs_data_t *settings) 66 | { 67 | UNUSED_PARAMETER(settings); 68 | 69 | struct main_view_s *s = data; 70 | 71 | if (!s->offscreen_render) 72 | register_offscreen_render(s); 73 | s->offscreen_render = true; 74 | } 75 | 76 | static void *create(obs_data_t *settings, obs_source_t *source) 77 | { 78 | struct main_view_s *s = bzalloc(sizeof(struct main_view_s)); 79 | 80 | s->context = source; 81 | 82 | update(s, settings); 83 | 84 | return s; 85 | } 86 | 87 | static void destroy(void *data) 88 | { 89 | struct main_view_s *s = data; 90 | 91 | if (s->offscreen_render) 92 | unregister_offscreen_render(s); 93 | 94 | #ifndef USE_RENDERED_CALLBACK 95 | obs_weak_source_release(s->weak_source); 96 | #endif 97 | 98 | obs_enter_graphics(); 99 | #ifndef USE_RENDERED_CALLBACK 100 | gs_texrender_destroy(s->texrender); 101 | gs_texrender_destroy(s->texrender_prev); 102 | #else 103 | gs_texture_destroy(s->cached_texture); 104 | #endif 105 | obs_leave_graphics(); 106 | 107 | bfree(s); 108 | } 109 | 110 | static void video_tick(void *data, float seconds) 111 | { 112 | UNUSED_PARAMETER(seconds); 113 | struct main_view_s *s = data; 114 | 115 | #ifndef USE_RENDERED_CALLBACK 116 | obs_weak_source_release(s->weak_source); 117 | 118 | obs_source_t *target = obs_get_output_source(0); 119 | s->weak_source = obs_source_get_weak_source(target); 120 | obs_source_release(target); 121 | #endif 122 | 123 | s->rendered = false; 124 | } 125 | 126 | #ifndef USE_RENDERED_CALLBACK 127 | static void cache_video(struct main_view_s *s, obs_source_t *target) 128 | { 129 | gs_texrender_t *texrender = s->texrender_prev; 130 | if (!texrender) 131 | s->texrender_prev = texrender = gs_texrender_create(GS_BGRA, GS_ZS_NONE); 132 | else 133 | gs_texrender_reset(texrender); 134 | 135 | uint32_t width = obs_source_get_width(target); 136 | uint32_t height = obs_source_get_height(target); 137 | 138 | if (gs_texrender_begin(texrender, width, height)) { 139 | struct vec4 background; 140 | vec4_zero(&background); 141 | 142 | gs_clear(GS_CLEAR_COLOR, &background, 0.0f, 0); 143 | gs_ortho(0.0f, (float)width, 0.0f, (float)height, -100.0f, 100.0f); 144 | 145 | gs_blend_state_push(); 146 | gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); 147 | obs_source_video_render(target); 148 | gs_blend_state_pop(); 149 | gs_texrender_end(texrender); 150 | 151 | s->texrender_prev = s->texrender; 152 | s->texrender = texrender; 153 | } 154 | } 155 | 156 | #else 157 | 158 | static void cache_texture(struct main_view_s *s, gs_texture_t *src_tex) 159 | { 160 | uint32_t width = gs_texture_get_width(src_tex); 161 | uint32_t height = gs_texture_get_height(src_tex); 162 | enum gs_color_format format = gs_texture_get_color_format(src_tex); 163 | 164 | gs_texture_t *dst_tex = s->cached_texture; 165 | 166 | if (!dst_tex || gs_texture_get_width(dst_tex) != width || gs_texture_get_height(dst_tex) != height || 167 | gs_texture_get_color_format(dst_tex) != format) { 168 | gs_texture_destroy(dst_tex); 169 | dst_tex = s->cached_texture = gs_texture_create(width, height, format, 1, NULL, GS_RENDER_TARGET); 170 | } 171 | 172 | gs_copy_texture(dst_tex, src_tex); 173 | } 174 | #endif // USE_RENDERED_CALLBACK 175 | 176 | static void render_cached_video(struct main_view_s *s) 177 | { 178 | #ifndef USE_RENDERED_CALLBACK 179 | gs_texture_t *tex = gs_texrender_get_texture(s->texrender); 180 | #else 181 | gs_texture_t *tex = s->cached_texture; 182 | #endif 183 | if (!tex) 184 | return; 185 | 186 | gs_blend_state_push(); 187 | gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); 188 | 189 | gs_effect_t *effect = obs_get_base_effect(OBS_EFFECT_DEFAULT); 190 | gs_effect_set_texture(gs_effect_get_param_by_name(effect, "image"), tex); 191 | uint32_t cx = gs_texture_get_width(tex); 192 | uint32_t cy = gs_texture_get_height(tex); 193 | 194 | while (gs_effect_loop(effect, "Draw")) 195 | gs_draw_sprite(tex, 0, cx, cy); 196 | 197 | gs_blend_state_pop(); 198 | } 199 | 200 | #ifndef USE_RENDERED_CALLBACK 201 | static void main_view_offscreen_render_cb(void *data, uint32_t cx, uint32_t cy) 202 | { 203 | UNUSED_PARAMETER(cx); 204 | UNUSED_PARAMETER(cy); 205 | struct main_view_s *s = data; 206 | 207 | if (!obs_source_showing(s->context)) 208 | return; 209 | 210 | // When virtual camera is enabled with scene or source type, this callback is called twice or more. 211 | if (s->rendered) 212 | return; 213 | s->rendered = true; 214 | 215 | obs_source_t *target = obs_weak_source_get_source(s->weak_source); 216 | if (target) { 217 | cache_video(s, target); 218 | obs_source_release(target); 219 | } 220 | } 221 | 222 | #else 223 | 224 | static void main_view_rendered_callback(void *data) 225 | { 226 | struct main_view_s *s = data; 227 | 228 | if (!obs_source_showing(s->context)) 229 | return; 230 | 231 | // When virtual camera is enabled with scene or source type, this callback is called twice or more. 232 | if (s->rendered) 233 | return; 234 | 235 | gs_texture_t *tex = obs_get_main_texture(); 236 | if (!tex) 237 | return; 238 | 239 | s->rendered = true; 240 | cache_texture(s, tex); 241 | } 242 | #endif 243 | 244 | static void video_render(void *data, gs_effect_t *effect) 245 | { 246 | UNUSED_PARAMETER(effect); 247 | struct main_view_s *s = data; 248 | 249 | render_cached_video(s); 250 | } 251 | 252 | static uint32_t get_width(void *data) 253 | { 254 | UNUSED_PARAMETER(data); 255 | 256 | struct obs_video_info ovi; 257 | if (!obs_get_video_info(&ovi)) 258 | return 0; 259 | 260 | return ovi.base_width; 261 | } 262 | 263 | static uint32_t get_height(void *data) 264 | { 265 | UNUSED_PARAMETER(data); 266 | 267 | struct obs_video_info ovi; 268 | if (!obs_get_video_info(&ovi)) 269 | return 0; 270 | 271 | return ovi.base_height; 272 | } 273 | 274 | const struct obs_source_info main_view_source = { 275 | .id = ID_PREFIX "source", 276 | .type = OBS_SOURCE_TYPE_INPUT, 277 | .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW, 278 | .get_name = get_name, 279 | .create = create, 280 | .destroy = destroy, 281 | .get_properties = get_properties, 282 | .update = update, 283 | .video_tick = video_tick, 284 | .video_render = video_render, 285 | .get_width = get_width, 286 | .get_height = get_height, 287 | }; 288 | -------------------------------------------------------------------------------- /src/plugin-macros.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | OBS Main View Source Plugin 3 | Copyright (C) 2022 Norihiro Kamae 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef PLUGINNAME_H 21 | #define PLUGINNAME_H 22 | 23 | #define PLUGIN_NAME "@CMAKE_PROJECT_NAME@" 24 | #define PLUGIN_VERSION "@CMAKE_PROJECT_VERSION@" 25 | #define ID_PREFIX "@ID_PREFIX@" 26 | 27 | #define blog(level, msg, ...) blog(level, "[" PLUGIN_NAME "] " msg, ##__VA_ARGS__) 28 | 29 | #endif // PLUGINNAME_H 30 | -------------------------------------------------------------------------------- /src/plugin-main.c: -------------------------------------------------------------------------------- 1 | /* 2 | OBS Main View Source Plugin 3 | Copyright (C) 2022 Norihiro Kamae 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #include 21 | 22 | #include "plugin-macros.generated.h" 23 | 24 | OBS_DECLARE_MODULE() 25 | OBS_MODULE_USE_DEFAULT_LOCALE(PLUGIN_NAME, "en-US") 26 | 27 | extern const struct obs_source_info main_view_source; 28 | 29 | bool obs_module_load(void) 30 | { 31 | obs_register_source(&main_view_source); 32 | blog(LOG_INFO, "plugin loaded (version %s)", PLUGIN_VERSION); 33 | return true; 34 | } 35 | 36 | void obs_module_unload() 37 | { 38 | blog(LOG_INFO, "plugin unloaded"); 39 | } 40 | --------------------------------------------------------------------------------