diff --git a/src/daemon/pipewire.conf.in b/src/daemon/pipewire.conf.in index 170e745c8..65a4fc2e0 100644 --- a/src/daemon/pipewire.conf.in +++ b/src/daemon/pipewire.conf.in @@ -1,13 +1,12 @@ #load-module libpipewire-module-protocol-dbus -#load-module libpipewire-module-rtkit +load-module libpipewire-module-rtkit load-module libpipewire-module-protocol-native -load-module libpipewire-module-suspend-on-idle load-module libpipewire-module-spa-monitor alsa/libspa-alsa alsa-monitor alsa load-module libpipewire-module-spa-monitor v4l2/libspa-v4l2 v4l2-monitor v4l2 load-module libpipewire-module-spa-monitor bluez5/libspa-bluez5 bluez5-monitor bluez5 #load-module libpipewire-module-spa-node videotestsrc/libspa-videotestsrc videotestsrc videotestsrc Spa:POD:Object:Props:patternType=Spa:POD:Object:Props:patternType:snow load-module libpipewire-module-client-node load-module libpipewire-module-flatpak -load-module libpipewire-module-media-session load-module libpipewire-module-audio-dsp load-module libpipewire-module-link-factory +exec build/src/examples/media-session diff --git a/src/pipewire/command.c b/src/pipewire/command.c index 1578829bb..2ce732d5c 100644 --- a/src/pipewire/command.c +++ b/src/pipewire/command.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include #include @@ -33,6 +35,7 @@ static struct pw_command *parse_command_help(const char *line, char **err); static struct pw_command *parse_command_module_load(const char *line, char **err); +static struct pw_command *parse_command_exec(const char *line, char **err); struct impl { struct pw_command this; @@ -49,6 +52,7 @@ struct command_parse { static const struct command_parse parsers[] = { {"help", "Show this help", parse_command_help}, {"load-module", "Load a module", parse_command_module_load}, + {"exec", "Execute a program", parse_command_exec}, {NULL, NULL, NULL } }; @@ -127,6 +131,50 @@ static struct pw_command *parse_command_module_load(const char *line, char **err return NULL; } +static int +execute_command_exec(struct pw_command *command, struct pw_core *core, char **err) +{ + int pid; + + pid = fork(); + + if (pid == 0) { + pw_log_info("exec %s", command->args[1]); + execv(command->args[1], command->args); + } + else { + pw_log_info("exec got pid %d", pid); + } + return 0; +} + +static struct pw_command *parse_command_exec(const char *line, char **err) +{ + struct impl *impl; + struct pw_command *this; + + impl = calloc(1, sizeof(struct impl)); + if (impl == NULL) + goto no_mem; + + this = &impl->this; + this->func = execute_command_exec; + this->args = pw_split_strv(line, whitespace, INT_MAX, &this->n_args); + + if (this->n_args < 1) + goto no_executable; + + return this; + + no_executable: + asprintf(err, "requires an executable name"); + pw_free_strv(this->args); + return NULL; + no_mem: + asprintf(err, "no memory"); + return NULL; +} + /** Free command * * \param command a command to free