[pulseaudio-discuss] [PATCH v10 3/3] pipe-source: implement autosuspend option
Raman Shyshniou
rommer at ibuffed.com
Tue Mar 20 12:27:37 UTC 2018
This patch implements the autosuspend option. Setting autosuspend to
false restores original pipe-source behaviour.
---
src/modules/module-pipe-source.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index 4fd515b..b2dcb02 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -58,7 +58,8 @@ PA_MODULE_USAGE(
"format=<sample format> "
"rate=<sample rate> "
"channels=<number of channels> "
- "channel_map=<channel map>");
+ "channel_map=<channel map> "
+ "autosuspend=<bool>");
#define DEFAULT_FILE_NAME "/tmp/music.input"
#define DEFAULT_SOURCE_NAME "fifo_input"
@@ -108,6 +109,7 @@ static const char* const valid_modargs[] = {
"rate",
"channels",
"channel_map",
+ "autosuspend",
NULL
};
@@ -364,6 +366,7 @@ int pa__init(pa_module *m) {
pa_modargs *ma;
struct pollfd *pollfd;
pa_source_new_data data;
+ bool autosuspend;
pa_assert(m);
@@ -409,7 +412,13 @@ int pa__init(pa_module *m) {
u->writer_connected = true;
- if ((u->fd = pa_open_cloexec(u->filename, O_RDONLY, 0)) < 0) {
+ autosuspend = true;
+ if (pa_modargs_get_value_boolean(ma, "autosuspend", &autosuspend) < 0) {
+ pa_log("Failed to parse autosuspend argument.");
+ goto fail;
+ }
+
+ if ((u->fd = pa_open_cloexec(u->filename, autosuspend ? O_RDONLY : O_RDWR, 0)) < 0) {
pa_log("open('%s'): %s", u->filename, pa_cstrerror(errno));
goto fail;
}
--
1.8.3.1
More information about the pulseaudio-discuss
mailing list