Skip to content

Commit

Permalink
feat: add PipeWire adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
andyholmes committed May 16, 2023
1 parent e95fd64 commit 826dbce
Show file tree
Hide file tree
Showing 15 changed files with 1,851 additions and 0 deletions.
29 changes: 29 additions & 0 deletions build-aux/flatpak/ca.andyholmes.Valent.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"--env=PULSE_PROP_media.category=Manager",
"--filesystem=xdg-download",
"--filesystem=xdg-run/gvfsd",
"--filesystem=xdg-run/pipewire-0:ro",
"--own-name=org.mpris.MediaPlayer2.Valent",
"--share=ipc",
"--share=network",
Expand Down Expand Up @@ -201,6 +202,34 @@
}
]
},
{
"name" : "pipewire",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"-Dgstreamer=disabled",
"-Dman=disabled",
"-Dsystemd=disabled",
"-Dudev=disabled",
"-Dudevrulesdir=disabled",
"-Dsession-managers=[]",
"-Djack=enabled"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.freedesktop.org/pipewire/pipewire.git",
"commit" : "9f7d60c1e84cc0481afc3f6ccf76e127567943a8",
"tag" : "0.3.70",
"x-checker-data" : {
"type" : "anitya",
"project-id" : 57357,
"stable-only" : true,
"tag-template" : "$version"
}
}
]
},
{
"name" : "valent",
"buildsystem" : "meson",
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ project_c_args = [
'-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_72',
'-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_72',
'-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_4_8',

'-Wno-error=analyzer-va-arg-type-mismatch',
]
project_link_args = [
'-Wl,-z,relro',
Expand Down
6 changes: 6 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ option('plugin_ping',
value: true,
)

option('plugin_pipewire',
description: 'Enable Pipewire plugin',
type: 'boolean',
value: true,
)

option('plugin_presenter',
description: 'Enable Presenter plugin',
type: 'boolean',
Expand Down
1 change: 1 addition & 0 deletions src/plugins/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ plugins = [
'notification',
'photo',
'ping',
'pipewire',
'presenter',
'pulseaudio',
'runcommand',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions src/plugins/pipewire/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com>

# pipewire (Pipewire)
libpipewire_dep = dependency('libpipewire-0.3', version: '>= 0.3')

# Dependencies
plugin_pipewire_deps = [
libvalent_dep,

libpipewire_dep,
]

# Sources
plugin_pipewire_sources = files([
'pipewire-plugin.c',
'valent-pipewire-mixer.c',
'valent-pipewire-stream.c',
])

plugin_pipewire_include_directories = [include_directories('.')]

# Resources
plugin_pipewire_info = i18n.merge_file(
input: 'pipewire.plugin.desktop.in',
output: 'pipewire.plugin',
po_dir: po_dir,
type: 'desktop',
)

plugin_pipewire_resources = gnome.compile_resources('pipewire-resources',
'pipewire.gresource.xml',
c_name: 'pipewire',
dependencies: [plugin_pipewire_info],
)
plugin_pipewire_sources += plugin_pipewire_resources

# Static Build
plugin_pipewire = static_library('plugin-pipewire',
plugin_pipewire_sources,
include_directories: plugin_pipewire_include_directories,
dependencies: plugin_pipewire_deps,
c_args: plugins_c_args + release_args,
)

#plugins_link_args += ['-Wl,--undefined=valent_pipewire_plugin_register_types']
plugins_static += [plugin_pipewire]

18 changes: 18 additions & 0 deletions src/plugins/pipewire/pipewire-plugin.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com>

#include "config.h"

#include <libpeas/peas.h>
#include <valent.h>

#include "valent-pipewire-mixer.h"


G_MODULE_EXPORT void
valent_pipewire_plugin_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
VALENT_TYPE_MIXER_ADAPTER,
VALENT_TYPE_PIPEWIRE_MIXER);
}
14 changes: 14 additions & 0 deletions src/plugins/pipewire/pipewire.gresource.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
<!-- SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com> -->

<gresources>
<gresource prefix="/plugins/pipewire">
<file>pipewire.plugin</file>
</gresource>
<gresource prefix="/ca/andyholmes/Valent/icons">
<file preprocess="xml-stripblanks" alias="scalable/apps/valent-pipewire-plugin-symbolic.svg">data/valent-pipewire-plugin-symbolic.svg</file>
</gresource>
</gresources>

15 changes: 15 additions & 0 deletions src/plugins/pipewire/pipewire.plugin.desktop.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com>

[Plugin]
Module=pipewire
Name=PipeWire
Description=Integration with PipeWire
Icon=valent-pipewire-plugin-symbolic
Builtin=true
Embedded=valent_pipewire_plugin_register_types
Website=https://github.com/andyholmes/valent
Help=https://github.com/andyholmes/valent
Hidden=false
X-MixerAdapterPriority=50

Loading

0 comments on commit 826dbce

Please sign in to comment.