Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
61603417
Commit
61603417
authored
4 years ago
by
Julian Bouzas
Committed by
George Kiagiadakis
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
src: main: add create-session command to create sessions when wireplumber starts
parent
af5da7a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/config/wireplumber.conf
+4
-0
4 additions, 0 deletions
src/config/wireplumber.conf
src/main.c
+46
-0
46 additions, 0 deletions
src/main.c
with
50 additions
and
0 deletions
src/config/wireplumber.conf
+
4
−
0
View file @
61603417
...
...
@@ -6,6 +6,10 @@ add-spa-lib api.bluez5.* bluez5/libspa-bluez5
add
-
spa
-
lib
api
.
vulkan
.*
vulkan
/
libspa
-
vulkan
add
-
spa
-
lib
api
.
jack
.*
jack
/
libspa
-
jack
# Create the sessions
create
-
session
audio
create
-
session
video
# the client-device pipewire module is needed for libwireplumber-module-monitor
load
-
pipewire
-
module
libpipewire
-
module
-
client
-
device
...
...
This diff is collapsed.
Click to expand it.
src/main.c
+
46
−
0
View file @
61603417
...
...
@@ -36,6 +36,8 @@ struct WpDaemonData
gint
exit_code
;
gchar
*
exit_message
;
GDestroyNotify
free_message
;
GPtrArray
*
sessions
;
};
static
void
...
...
@@ -207,6 +209,20 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
g_strerror
(
-
ret
));
return
FALSE
;
}
}
else
if
(
!
g_strcmp0
(
cmd
,
"create-session"
))
{
g_autoptr
(
WpImplSession
)
session
=
NULL
;
gchar
*
name
=
strtok_r
(
NULL
,
" "
,
&
saveptr
);
if
(
!
name
)
{
g_set_error
(
error
,
WP_DOMAIN_DAEMON
,
WP_CODE_INVALID_ARGUMENT
,
"expected session name at line %i"
,
lineno
);
return
FALSE
;
}
session
=
wp_impl_session_new
(
d
->
core
);
wp_impl_session_set_property
(
session
,
"session.name"
,
name
);
g_ptr_array_add
(
d
->
sessions
,
g_steal_pointer
(
&
session
));
}
else
{
g_set_error
(
error
,
WP_DOMAIN_DAEMON
,
WP_CODE_INVALID_ARGUMENT
,
"unknown command '%s' at line %i"
,
cmd
,
lineno
);
...
...
@@ -239,6 +255,27 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
return
TRUE
;
}
static
void
on_session_exported
(
WpProxy
*
session
,
GAsyncResult
*
res
,
struct
WpDaemonData
*
d
)
{
g_autoptr
(
GError
)
error
=
NULL
;
wp_proxy_augment_finish
(
session
,
res
,
&
error
);
if
(
error
)
wp_warning
(
"session could not be exported: %s"
,
error
->
message
);
}
static
void
on_core_connected
(
WpCore
*
core
,
struct
WpDaemonData
*
d
)
{
for
(
guint
i
=
0
;
i
<
d
->
sessions
->
len
;
i
++
)
{
WpSession
*
session
=
g_ptr_array_index
(
d
->
sessions
,
i
);
wp_proxy_augment
(
WP_PROXY
(
session
),
WP_PROXY_FEATURES_STANDARD
|
WP_PROXY_FEATURE_CONTROLS
,
NULL
,
(
GAsyncReadyCallback
)
on_session_exported
,
d
);
}
}
static
gboolean
load_commands_file
(
struct
WpDaemonData
*
d
)
{
...
...
@@ -264,6 +301,10 @@ load_commands_file (struct WpDaemonData *d)
return
G_SOURCE_REMOVE
;
}
/* add handler to export the sessions when connected */
if
(
d
->
sessions
->
len
>
0
)
g_signal_connect
(
d
->
core
,
"connected"
,
G_CALLBACK
(
on_core_connected
),
d
);
/* connect to pipewire */
if
(
!
wp_core_connect
(
d
->
core
))
daemon_exit_static_str
(
d
,
WP_CODE_DISCONNECTED
,
"failed to connect"
);
...
...
@@ -280,6 +321,7 @@ main (gint argc, gchar **argv)
g_autoptr
(
WpConfiguration
)
config
=
NULL
;
g_autoptr
(
WpCore
)
core
=
NULL
;
g_autoptr
(
GMainLoop
)
loop
=
NULL
;
g_autoptr
(
GPtrArray
)
sessions
=
NULL
;
const
gchar
*
configuration_path
;
g_log_set_writer_func
(
wp_log_writer_default
,
NULL
,
NULL
);
...
...
@@ -309,6 +351,10 @@ main (gint argc, gchar **argv)
data
.
loop
=
loop
=
g_main_loop_new
(
NULL
,
FALSE
);
/* init sessions */
data
.
sessions
=
sessions
=
g_ptr_array_new_with_free_func
(
g_object_unref
);
/* watch for exit signals */
g_unix_signal_add
(
SIGINT
,
signal_handler
,
&
data
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment