From c0ab8fadda476ae009a0b998f50cb7d6e54f55de Mon Sep 17 00:00:00 2001 From: fryshorts Date: Mon, 10 Mar 2014 23:02:37 +0100 Subject: [PATCH] moved and split up the linux xshm and pulseaudio capture plugins --- obs/obs-app.cpp | 4 +-- obs/window-basic-main.cpp | 3 ++ plugins/CMakeLists.txt | 3 ++ plugins/linux-pulseaudio/CMakeLists.txt | 18 +++++++++++ .../linux-pulseaudio/linux-pulseaudio.c | 2 -- .../linux-pulseaudio}/pulse-input.c | 0 plugins/linux-xshm/CMakeLists.txt | 25 ++++++++++++++++ plugins/linux-xshm/linux-xshm.c | 28 +++++++++++++++++ {test/linux => plugins/linux-xshm}/xcursor.c | 0 {test/linux => plugins/linux-xshm}/xcursor.h | 0 .../linux => plugins/linux-xshm}/xshm-input.c | 0 test/CMakeLists.txt | 4 --- test/linux/CMakeLists.txt | 30 ------------------- 13 files changed, 79 insertions(+), 38 deletions(-) create mode 100644 plugins/linux-pulseaudio/CMakeLists.txt rename test/linux/linux.c => plugins/linux-pulseaudio/linux-pulseaudio.c (92%) rename {test/linux => plugins/linux-pulseaudio}/pulse-input.c (100%) create mode 100644 plugins/linux-xshm/CMakeLists.txt create mode 100644 plugins/linux-xshm/linux-xshm.c rename {test/linux => plugins/linux-xshm}/xcursor.c (100%) rename {test/linux => plugins/linux-xshm}/xcursor.h (100%) rename {test/linux => plugins/linux-xshm}/xshm-input.c (100%) delete mode 100644 test/linux/CMakeLists.txt diff --git a/obs/obs-app.cpp b/obs/obs-app.cpp index 8e6e40f19..ae1b6e48f 100644 --- a/obs/obs-app.cpp +++ b/obs/obs-app.cpp @@ -188,8 +188,8 @@ void OBSApp::OBSInit() #define INPUT_AUDIO_SOURCE "wasapi_input_capture" #define OUTPUT_AUDIO_SOURCE "wasapi_output_capture" #else -#define INPUT_AUDIO_SOURCE "" -#define OUTPUT_AUDIO_SOURCE "" +#define INPUT_AUDIO_SOURCE "pulse_input_capture" +#define OUTPUT_AUDIO_SOURCE "pulse_output_capture" #endif const char *OBSApp::InputAudioSource() const diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 787e25d86..5241d8f51 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -172,6 +172,9 @@ void OBSBasic::OBSInit() #elif _WIN32 obs_load_module("win-wasapi"); obs_load_module("win-capture"); +#else + obs_load_module("linux-xshm"); + obs_load_module("linux-pulseaudio"); #endif ResetAudioDevices(); diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 101b5953a..241e4ebfa 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -6,6 +6,9 @@ if(WIN32) add_subdirectory(win-capture) elseif(APPLE) add_subdirectory(mac-capture) +elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + add_subdirectory(linux-xshm) + add_subdirectory(linux-pulseaudio) endif() add_subdirectory(obs-ffmpeg) diff --git a/plugins/linux-pulseaudio/CMakeLists.txt b/plugins/linux-pulseaudio/CMakeLists.txt new file mode 100644 index 000000000..d5258a94e --- /dev/null +++ b/plugins/linux-pulseaudio/CMakeLists.txt @@ -0,0 +1,18 @@ +find_package(PulseAudio REQUIRED) + +include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs") + +set(linux-pulseaudio_SOURCES + linux-pulseaudio.c + pulse-input.c +) + +add_library(linux-pulseaudio MODULE + ${linux-pulseaudio_SOURCES} +) +target_link_libraries(linux-pulseaudio + libobs + ${PULSEAUDIO_LIBRARY} +) + +install_obs_plugin(linux-pulseaudio) diff --git a/test/linux/linux.c b/plugins/linux-pulseaudio/linux-pulseaudio.c similarity index 92% rename from test/linux/linux.c rename to plugins/linux-pulseaudio/linux-pulseaudio.c index 247363a23..1993dddce 100644 --- a/test/linux/linux.c +++ b/plugins/linux-pulseaudio/linux-pulseaudio.c @@ -18,14 +18,12 @@ along with this program. If not, see . OBS_DECLARE_MODULE() -extern struct obs_source_info xshm_input; extern struct obs_source_info pulse_input_capture; extern struct obs_source_info pulse_output_capture; bool obs_module_load(uint32_t obs_version) { UNUSED_PARAMETER(obs_version); - obs_register_source(&xshm_input); obs_register_source(&pulse_input_capture); obs_register_source(&pulse_output_capture); return true; diff --git a/test/linux/pulse-input.c b/plugins/linux-pulseaudio/pulse-input.c similarity index 100% rename from test/linux/pulse-input.c rename to plugins/linux-pulseaudio/pulse-input.c diff --git a/plugins/linux-xshm/CMakeLists.txt b/plugins/linux-xshm/CMakeLists.txt new file mode 100644 index 000000000..347aed6af --- /dev/null +++ b/plugins/linux-xshm/CMakeLists.txt @@ -0,0 +1,25 @@ +find_package(X11 REQUIRED) + +include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs") + +set(linux-xshm_SOURCES + linux-xshm.c + xcursor.c + xshm-input.c +) +set(linux-xshm_HEADERS + xcursor.h +) + +add_library(linux-xshm MODULE + ${linux-xshm_SOURCES} + ${linux-xshm_HEADERS} +) +target_link_libraries(linux-xshm + libobs + ${X11_LIBRARIES} + ${X11_XShm_LIB} + ${X11_Xfixes_LIB} +) + +install_obs_plugin(linux-xshm) diff --git a/plugins/linux-xshm/linux-xshm.c b/plugins/linux-xshm/linux-xshm.c new file mode 100644 index 000000000..41aebec61 --- /dev/null +++ b/plugins/linux-xshm/linux-xshm.c @@ -0,0 +1,28 @@ +/* +Copyright (C) 2014 by Leonhard Oelke + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include + +OBS_DECLARE_MODULE() + +extern struct obs_source_info xshm_input; + +bool obs_module_load(uint32_t obs_version) +{ + UNUSED_PARAMETER(obs_version); + obs_register_source(&xshm_input); + return true; +} diff --git a/test/linux/xcursor.c b/plugins/linux-xshm/xcursor.c similarity index 100% rename from test/linux/xcursor.c rename to plugins/linux-xshm/xcursor.c diff --git a/test/linux/xcursor.h b/plugins/linux-xshm/xcursor.h similarity index 100% rename from test/linux/xcursor.h rename to plugins/linux-xshm/xcursor.h diff --git a/test/linux/xshm-input.c b/plugins/linux-xshm/xshm-input.c similarity index 100% rename from test/linux/xshm-input.c rename to plugins/linux-xshm/xshm-input.c diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6fa01ee6c..afcbf5ec0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,7 +8,3 @@ endif() if(APPLE AND UNIX) add_subdirectory(osx) endif() - -if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") - add_subdirectory(linux) -endif() \ No newline at end of file diff --git a/test/linux/CMakeLists.txt b/test/linux/CMakeLists.txt deleted file mode 100644 index b63ed9aea..000000000 --- a/test/linux/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -project(linux) - -find_package(X11 REQUIRED) -find_package(PulseAudio REQUIRED) - -include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs") - -set(linux_SOURCES - linux.c - xcursor.c - xshm-input.c - pulse-input.c -) -set(linux_HEADERS - xcursor.h -) - -add_library(linux MODULE - ${linux_SOURCES} - ${linux_HEADERS} -) -target_link_libraries(linux - libobs - ${X11_LIBRARIES} - ${X11_XShm_LIB} - ${X11_Xfixes_LIB} - ${PULSEAUDIO_LIBRARY} -) - -install_obs_plugin(linux)