mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-26 07:00:13 -05:00
port to meson
This commit is contained in:
parent
924824d0a3
commit
67dd3adb87
69 changed files with 1056 additions and 999 deletions
54
pinos/client/build_mkenum.py
Executable file
54
pinos/client/build_mkenum.py
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# This is in its own file rather than inside meson.build
|
||||
# because a) mixing the two is ugly and b) trying to
|
||||
# make special characters such as \n go through all
|
||||
# backends is a fool's errand.
|
||||
|
||||
import sys, os, shutil, subprocess
|
||||
|
||||
h_array = ['--fhead',
|
||||
"#ifndef __PINOS_ENUM_TYPES_H__\n#define __PINOS_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n",
|
||||
'--fprod',
|
||||
"\n/* enumerations from \"@filename@\" */\n",
|
||||
'--vhead',
|
||||
"GType @enum_name@_get_type (void);\n#define PINOS_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n",
|
||||
'--ftail',
|
||||
"G_END_DECLS\n\n#endif /* __PINOS_ENUM_TYPES_H__ */"]
|
||||
|
||||
c_array = [
|
||||
'--fhead',
|
||||
"#include \"pinos.h\"\n#define C_ENUM(v) ((gint) v)\n#define C_FLAGS(v) ((guint) v)\n ",
|
||||
'--fprod',
|
||||
"\n/* enumerations from \"@filename@\" */",
|
||||
'--vhead',
|
||||
"GType\n@enum_name@_get_type (void)\n{\n static gsize id = 0;\n static const G@Type@Value values[] = {",
|
||||
'--vprod',
|
||||
" { C_@TYPE@(@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" },",
|
||||
'--vtail',
|
||||
" { 0, NULL, NULL }\n };\n\n if (g_once_init_enter (&id)) {\n GType tmp = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&id, tmp);\n }\n\n return (GType) id;\n}"
|
||||
]
|
||||
|
||||
cmd = []
|
||||
argn = 1
|
||||
# Find the full command needed to run glib-mkenums
|
||||
# On UNIX-like, this is just the full path to glib-mkenums
|
||||
# On Windows, this is the full path to interpreter + full path to glib-mkenums
|
||||
for arg in sys.argv[1:]:
|
||||
cmd.append(arg)
|
||||
argn += 1
|
||||
if arg.endswith('glib-mkenums'):
|
||||
break
|
||||
ofilename = sys.argv[argn]
|
||||
headers = sys.argv[argn + 1:]
|
||||
|
||||
if ofilename.endswith('.h'):
|
||||
arg_array = h_array
|
||||
else:
|
||||
arg_array = c_array
|
||||
|
||||
pc = subprocess.Popen(cmd + arg_array + headers, stdout=subprocess.PIPE)
|
||||
(stdo, _) = pc.communicate()
|
||||
if pc.returncode != 0:
|
||||
sys.exit(pc.returncode)
|
||||
open(ofilename, 'wb').write(stdo)
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <pinos/client/pinos.h>
|
||||
#include <pinos/client/format.h>
|
||||
|
||||
static SpaFormat *
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "pinos.h"
|
||||
#include "mainloop.h"
|
||||
|
||||
struct _PinosMainLoopPrivate
|
||||
|
|
|
|||
69
pinos/client/meson.build
Normal file
69
pinos/client/meson.build
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
pinos_headers = [
|
||||
'context.h',
|
||||
'format.h',
|
||||
'introspect.h',
|
||||
'mainloop.h',
|
||||
'pinos.h',
|
||||
'properties.h',
|
||||
'stream.h',
|
||||
'ringbuffer.h',
|
||||
'subscribe.h',
|
||||
]
|
||||
|
||||
pinos_sources = [
|
||||
'context.c',
|
||||
'format.c',
|
||||
'introspect.c',
|
||||
'mainloop.c',
|
||||
'properties.c',
|
||||
'stream.c',
|
||||
'pinos.c',
|
||||
'ringbuffer.c',
|
||||
'subscribe.c',
|
||||
]
|
||||
|
||||
install_headers(pinos_headers, subdir : 'pinos/client')
|
||||
|
||||
mkenums = find_program('build_mkenum.py')
|
||||
glib_mkenums = find_program('glib-mkenums')
|
||||
|
||||
enumtypes_h = custom_target('enumtypes_h',
|
||||
output : 'enumtypes.h',
|
||||
input : pinos_headers,
|
||||
install : true,
|
||||
install_dir : 'include/pinos/client',
|
||||
command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
|
||||
|
||||
enumtypes_c = custom_target('enumtypes_c',
|
||||
output : 'enumtypes.c',
|
||||
input : pinos_headers,
|
||||
depends : [enumtypes_h],
|
||||
command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
|
||||
|
||||
|
||||
libpinos_c_args = [
|
||||
'-DHAVE_CONFIG_H',
|
||||
'-D_GNU_SOURCE',
|
||||
'-DG_LOG_DOMAIN=g_log_domain_pinos',
|
||||
]
|
||||
|
||||
|
||||
pinos_gen_sources = [enumtypes_h]
|
||||
|
||||
libpinos = shared_library('pinos', pinos_sources,
|
||||
enumtypes_h, enumtypes_c,
|
||||
version : libversion,
|
||||
soversion : soversion,
|
||||
c_args : libpinos_c_args,
|
||||
include_directories : [configinc, spa_inc],
|
||||
link_with : spalib,
|
||||
install : true,
|
||||
dependencies : [gobject_dep, gmodule_dep, glib_dep, gio_dep, mathlib],
|
||||
)
|
||||
|
||||
pinos_dep = declare_dependency(link_with : libpinos,
|
||||
include_directories : [configinc, spa_inc],
|
||||
dependencies : [glib_dep, gobject_dep, gmodule_dep],
|
||||
# Everything that uses libpinos needs this built to compile
|
||||
sources : pinos_gen_sources,
|
||||
)
|
||||
|
|
@ -22,6 +22,8 @@
|
|||
#include "pinos/client/pinos.h"
|
||||
#include "spa/include/spa/memory.h"
|
||||
|
||||
const gchar g_log_domain_pinos[] = "Pinos";
|
||||
|
||||
GQuark
|
||||
pinos_error_quark (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
#ifndef __PINOS_H__
|
||||
#define __PINOS_H__
|
||||
|
||||
extern const char g_log_domain_pinos[];
|
||||
|
||||
#include <pinos/client/context.h>
|
||||
#include <pinos/client/enumtypes.h>
|
||||
#include <pinos/client/introspect.h>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "pinos/client/pinos.h"
|
||||
#include "pinos/client/properties.h"
|
||||
|
||||
struct _PinosProperties {
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -28,6 +26,7 @@
|
|||
#include <gio/gio.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <pinos/client/pinos.h>
|
||||
#include <pinos/client/enumtypes.h>
|
||||
#include <pinos/client/ringbuffer.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -632,8 +632,10 @@ add_state_change (PinosStream *stream, SpaControlBuilder *builder, SpaNodeState
|
|||
PinosStreamPrivate *priv = stream->priv;
|
||||
SpaControlCmdNodeStateChange sc;
|
||||
|
||||
sc.state = priv->node_state = state;
|
||||
spa_control_builder_add_cmd (builder, SPA_CONTROL_CMD_NODE_STATE_CHANGE, &sc);
|
||||
if (priv->node_state != state) {
|
||||
sc.state = priv->node_state = state;
|
||||
spa_control_builder_add_cmd (builder, SPA_CONTROL_CMD_NODE_STATE_CHANGE, &sc);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1504,27 +1506,7 @@ pinos_stream_start (PinosStream *stream)
|
|||
static gboolean
|
||||
do_stop (PinosStream *stream)
|
||||
{
|
||||
PinosStreamPrivate *priv = stream->priv;
|
||||
SpaControlBuilder builder;
|
||||
SpaControl control;
|
||||
SpaControlCmdNodeCommand cnc;
|
||||
SpaNodeCommand nc;
|
||||
|
||||
control_builder_init (stream, &builder);
|
||||
cnc.command = &nc;
|
||||
nc.type = SPA_NODE_COMMAND_PAUSE;
|
||||
nc.data = NULL;
|
||||
nc.size = 0;
|
||||
spa_control_builder_add_cmd (&builder, SPA_CONTROL_CMD_NODE_COMMAND, &cnc);
|
||||
spa_control_builder_end (&builder, &control);
|
||||
|
||||
if (spa_control_write (&control, priv->fd) < 0)
|
||||
g_warning ("stream %p: failed to write control", stream);
|
||||
|
||||
spa_control_clear (&control);
|
||||
|
||||
g_object_unref (stream);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue