linux-pipewire: Create new plugin

This plugin should contain different plugins importing and exporting
multimedia streams via PipeWire.
This commit is contained in:
columbarius 2021-10-05 02:18:50 +02:00 committed by Georges Basile Stavracas Neto
parent 923d427212
commit ebe8f6c72a
6 changed files with 129 additions and 0 deletions

View File

@ -63,6 +63,7 @@ elseif(OS_LINUX)
add_subdirectory(linux-v4l2)
add_subdirectory(linux-jack)
add_subdirectory(linux-alsa)
add_subdirectory(linux-pipewire)
add_subdirectory(decklink)
add_subdirectory(vlc-video)
add_subdirectory(sndio)

View File

@ -0,0 +1,28 @@
project(linux-pipewire)
option(ENABLE_PIPEWIRE "Enable PipeWire support" ON)
if(NOT ENABLE_PIPEWIRE)
message(STATUS "PipeWire support disabled, linux-pipewire plugin disabled")
return()
endif()
find_package(PipeWire REQUIRED)
if(NOT TARGET PipeWire::PipeWire)
message(
FATAL_ERROR
"OBS: - PipeWire library not found! Please install PipeWire or set ENABLE_PIPEWIRE=OFF"
)
endif()
add_library(linux-pipewire MODULE)
add_library(OBS::pipewire ALIAS linux-pipewire)
target_sources(linux-pipewire PRIVATE linux-pipewire.c pipewire-common.c
pipewire-common.h)
target_link_libraries(linux-pipewire PRIVATE OBS::libobs PipeWire::PipeWire)
set_target_properties(linux-pipewire PROPERTIES FOLDER "plugins")
setup_plugin_target(linux-pipewire)

View File

View File

@ -0,0 +1,43 @@
/* linux-pipewire.c
*
* Copyright 2021 columbarius <co1umbarius@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <obs-module.h>
#include <obs-nix-platform.h>
#include "pipewire-common.h"
OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("linux-pipewire", "en-US")
MODULE_EXPORT const char *obs_module_description(void)
{
return "PipeWire based sources/outputs";
}
bool obs_module_load(void)
{
obs_pipewire_load();
return true;
}
void obs_module_unload(void)
{
obs_pipewire_unload();
}

View File

@ -0,0 +1,33 @@
/* pipewire-common.c
*
* Copyright 2021 columbarius <co1umbarius@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <pipewire/pipewire.h>
#include "pipewire-common.h"
void obs_pipewire_load(void)
{
pw_init(NULL, NULL);
}
void obs_pipewire_unload(void)
{
pw_deinit();
}

View File

@ -0,0 +1,24 @@
/* pipewire-common.h
*
* Copyright 2021 columbarius <co1umbarius@protonmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
void obs_pipewire_load(void);
void obs_pipewire_unload(void);