Skip to content
This repository was archived by the owner on Mar 15, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ set(CMAKE_AUTOUIC ON)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)

file(GLOB_RECURSE FRONTEND_API_HEADER_PATH "/usr/*/*/obs-frontend-api.h")
get_filename_component(FRONTEND_API_HEADER_DIR "${FRONTEND_API_HEADER_PATH}" DIRECTORY)

set(virtualoutput_SOURCES
src/v4l2sink.cpp
Expand All @@ -23,9 +25,8 @@ set(virtualoutput_HEADERS
src/v4l2sink.h
src/v4l2sinkproperties.h)

include_directories(
"${LIBOBS_INCLUDE_DIR}/../UI/obs-frontend-api")

include_directories("${FRONTEND_API_HEADER_DIR}")

add_library(v4l2sink MODULE
${virtualoutput_SOURCES}
${virtualoutput_HEADERS})
Expand Down
19 changes: 19 additions & 0 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM debian:buster

# workaround for lack of frontend-api headerfile
RUN echo "deb-src http://deb.debian.org/debian buster main" >> /etc/apt/sources.list

RUN apt update
RUN apt install -y qtbase5-dev build-essential cmake apt-src
RUN apt-get build-dep -y libobs-dev
RUN apt-src install --location=/usr/src -i libobs-dev

VOLUME /opt/src

CMD /bin/bash && \
mkdir -p /opt/src/build-debian && \
cd /opt/src && \
rm -rf /opt/src/build-debian/* && \
cd /opt/src/build-debian && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr && \
make -j4
14 changes: 14 additions & 0 deletions Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM fedora:32 as builder

RUN dnf update -y
RUN dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-32.noarch.rpm
RUN dnf install -y obs-studio-libs obs-studio-devel qt5-qtbase-devel cmake make automake gcc gcc-c++ --enablerepo=rpmfusion-free-updates

VOLUME /opt/src

CMD mkdir -p /opt/src/build-fedora && \
cd /opt/src && \
rm -rf /opt/src/build-fedora/* && \
cd /opt/src/build-fedora && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr && \
make -j4
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,32 @@ issue #17][vcam#17].

## Build

- Install QT
- Install QT + dev packages

Ubuntu/Debian:
```
sudo apt install qtbase5-dev
sudo apt install -y qtbase5-dev build-essential cmake apt-src
sudo apt-get build-dep -y libobs-dev
sudo apt-src install --location=/usr/src -i libobs-dev
```

- Get obs-studio source code

Fedora 32:
```
git clone --recursive https://github.com/obsproject/obs-studio.git
sudo dnf install -y obs-studio-libs obs-studio-devel qt5-qtbase-devel cmake make automake gcc gcc-c++ --enablerepo=rpmfusion-free-updates
```

- Build plugins
- Build plugin:

```
git clone https://github.com/CatxFish/obs-v4l2sink.git
cd obs-v4l2sink
mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=/usr ..
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
sudo make install
```
Docker:
```
docker-compose build
docker-compose up
```
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3'
services:

fedora:
build:
context: .
dockerfile: Dockerfile.fedora
volumes:
- .:/opt/src

debian:
build:
context: .
dockerfile: Dockerfile.debian
volumes:
- .:/opt/src
29 changes: 8 additions & 21 deletions external/FindLibObs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@ if(DEFINED CMAKE_BUILD_TYPE)
endif()
endif()

find_path(LIBOBS_INCLUDE_DIR
NAMES obs.h
HINTS
ENV obsPath${_lib_suffix}
ENV obsPath
${obsPath}
PATHS
/usr/include /usr/local/include /opt/local/include /sw/include
PATH_SUFFIXES
libobs
)

function(find_obs_lib base_name repo_build_path lib_name)
string(TOUPPER "${base_name}" base_name_u)

Expand Down Expand Up @@ -79,10 +67,10 @@ find_obs_lib(LIBOBS libobs obs)
if(MSVC)
find_obs_lib(W32_PTHREADS deps/w32-pthreads w32-pthreads)
endif()

find_package(LibObs REQUIRED)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libobs DEFAULT_MSG LIBOBS_LIB LIBOBS_INCLUDE_DIR)
mark_as_advanced(LIBOBS_INCLUDE_DIR LIBOBS_LIB)
find_package_handle_standard_args(Libobs DEFAULT_MSG LIBOBS_LIB LibObs_DIR)
mark_as_advanced(LibObs_DIR LIBOBS_LIB)

if(LIBOBS_FOUND)
if(MSVC)
Expand All @@ -92,16 +80,15 @@ if(LIBOBS_FOUND)

set(W32_PTHREADS_INCLUDE_DIR ${LIBOBS_INCLUDE_DIR}/../deps/w32-pthreads)
endif()

set(LIBOBS_INCLUDE_DIRS ${LIBOBS_INCLUDE_DIR} ${W32_PTHREADS_INCLUDE_DIR})
set(LIBOBS_INCLUDE_DIRS ${LIBOBS_INCLUDE_DIRS} ${W32_PTHREADS_INCLUDE_DIR})
set(LIBOBS_LIBRARIES ${LIBOBS_LIB} ${W32_PTHREADS_LIB})
include(${LIBOBS_INCLUDE_DIR}/../cmake/external/ObsPluginHelpers.cmake)

# allows external plugins to easily use/share common dependencies that are often included with libobs (such as FFmpeg)
if(NOT DEFINED INCLUDED_LIBOBS_CMAKE_MODULES)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LIBOBS_INCLUDE_DIR}/../cmake/Modules/")
if(DEFINED LIBOBS_CMAKE_MODULES)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LIBOBS_CMAKE_MODULES}/cmake/Modules/")
set(INCLUDED_LIBOBS_CMAKE_MODULES true)
endif()
else()
message(FATAL_ERROR "Could not find the libobs library" )
message(FATAL_ERROR "Could not find the libobs library ${LIBOBS_CMAKE_PATH}" )
endif()