0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00

linux-pipewire: Version check call to pw_deinit

Per upstream this function is not supposed to be called by users of
PipeWire, and will crash when called twice. Instead only call it on
recent versions of PipeWire where it is safe to call.

This also removes the nearly empty pipewire-common files.
This commit is contained in:
Kurt Kartaltepe 2022-03-31 21:18:10 -07:00 committed by Georges Basile Stavracas Neto
parent 255c4096a8
commit bf660b1d8d
4 changed files with 5 additions and 62 deletions

View File

@ -33,8 +33,6 @@ add_library(OBS::pipewire ALIAS linux-pipewire)
target_sources( target_sources(
linux-pipewire linux-pipewire
PRIVATE linux-pipewire.c PRIVATE linux-pipewire.c
pipewire-common.c
pipewire-common.h
pipewire.c pipewire.c
pipewire.h pipewire.h
pipewire-capture.c pipewire-capture.c

View File

@ -22,7 +22,7 @@
#include <obs-module.h> #include <obs-module.h>
#include <obs-nix-platform.h> #include <obs-nix-platform.h>
#include "pipewire-common.h" #include <pipewire/pipewire.h>
#include "pipewire-capture.h" #include "pipewire-capture.h"
OBS_DECLARE_MODULE() OBS_DECLARE_MODULE()
@ -34,7 +34,7 @@ MODULE_EXPORT const char *obs_module_description(void)
bool obs_module_load(void) bool obs_module_load(void)
{ {
obs_pipewire_load(); pw_init(NULL, NULL);
// OBS PipeWire Screen Capture // OBS PipeWire Screen Capture
switch (obs_get_nix_platform()) { switch (obs_get_nix_platform()) {
@ -53,5 +53,7 @@ bool obs_module_load(void)
void obs_module_unload(void) void obs_module_unload(void)
{ {
obs_pipewire_unload(); #if PW_CHECK_VERSION(0, 3, 49)
pw_deinit();
#endif
} }

View File

@ -1,33 +0,0 @@
/* 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

@ -1,24 +0,0 @@
/* 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);