2008-05-01 23:51:45 +00:00
|
|
|
/***
|
|
|
|
|
This file is part of PulseAudio.
|
|
|
|
|
|
2008-06-11 23:01:07 +00:00
|
|
|
Copyright 2004-2006 Lennart Poettering
|
2008-05-11 12:21:32 +00:00
|
|
|
Copyright 2008 Colin Guthrie
|
2008-05-01 23:51:45 +00:00
|
|
|
|
|
|
|
|
PulseAudio is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Lesser General Public License as published
|
2009-03-03 20:23:02 +00:00
|
|
|
by the Free Software Foundation; either version 2.1 of the License,
|
2008-05-01 23:51:45 +00:00
|
|
|
or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
PulseAudio is distributed in the hope that it will be useful, but
|
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2014-11-26 14:14:51 +01:00
|
|
|
along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
|
2008-05-01 23:51:45 +00:00
|
|
|
***/
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <pulsecore/module.h>
|
2016-11-06 12:54:07 -06:00
|
|
|
#include <pulsecore/sink.h>
|
2008-05-01 23:51:45 +00:00
|
|
|
#include <pulsecore/modargs.h>
|
2016-11-06 12:54:07 -06:00
|
|
|
|
|
|
|
|
#include "raop-sink.h"
|
2008-05-01 23:51:45 +00:00
|
|
|
|
|
|
|
|
PA_MODULE_AUTHOR("Colin Guthrie");
|
2009-02-22 16:08:43 +00:00
|
|
|
PA_MODULE_DESCRIPTION("RAOP Sink");
|
2008-05-01 23:51:45 +00:00
|
|
|
PA_MODULE_VERSION(PACKAGE_VERSION);
|
2013-06-27 19:28:09 +02:00
|
|
|
PA_MODULE_LOAD_ONCE(false);
|
2008-05-01 23:51:45 +00:00
|
|
|
PA_MODULE_USAGE(
|
2016-11-06 12:54:07 -06:00
|
|
|
"name=<name of the sink, to be prefixed> "
|
2008-05-01 23:51:45 +00:00
|
|
|
"sink_name=<name for the sink> "
|
2009-05-28 02:39:22 +02:00
|
|
|
"sink_properties=<properties for the sink> "
|
2016-11-06 12:54:07 -06:00
|
|
|
"server=<address> "
|
2016-11-06 12:53:58 -06:00
|
|
|
"protocol=<transport protocol> "
|
|
|
|
|
"encryption=<encryption type> "
|
|
|
|
|
"codec=<audio codec> "
|
2008-05-01 23:51:45 +00:00
|
|
|
"format=<sample format> "
|
2009-05-28 02:39:22 +02:00
|
|
|
"rate=<sample rate> "
|
2016-11-06 12:54:07 -06:00
|
|
|
"channels=<number of channels> "
|
|
|
|
|
"username=<authentication user name, default: \"iTunes\"> "
|
2017-09-17 20:46:49 +02:00
|
|
|
"password=<authentication password> "
|
|
|
|
|
"latency_msec=<audio latency>");
|
2008-05-01 23:51:45 +00:00
|
|
|
|
|
|
|
|
static const char* const valid_modargs[] = {
|
2016-11-06 12:54:07 -06:00
|
|
|
"name",
|
2009-05-28 02:39:22 +02:00
|
|
|
"sink_name",
|
|
|
|
|
"sink_properties",
|
2008-05-01 23:51:45 +00:00
|
|
|
"server",
|
2016-11-06 12:53:58 -06:00
|
|
|
"protocol",
|
|
|
|
|
"encryption",
|
|
|
|
|
"codec",
|
2008-05-01 23:51:45 +00:00
|
|
|
"format",
|
2009-05-28 02:39:22 +02:00
|
|
|
"rate",
|
2008-05-01 23:51:45 +00:00
|
|
|
"channels",
|
2016-11-06 12:54:07 -06:00
|
|
|
"username",
|
|
|
|
|
"password",
|
2017-09-17 20:46:49 +02:00
|
|
|
"latency_msec",
|
2008-05-01 23:51:45 +00:00
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
|
2016-01-31 22:16:00 -06:00
|
|
|
int pa__init(pa_module *m) {
|
2008-05-11 12:21:32 +00:00
|
|
|
pa_modargs *ma = NULL;
|
2008-05-01 23:51:45 +00:00
|
|
|
|
|
|
|
|
pa_assert(m);
|
|
|
|
|
|
|
|
|
|
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
2016-11-06 12:54:07 -06:00
|
|
|
pa_log("Failed to parse module arguments");
|
2008-05-11 12:21:32 +00:00
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-06 12:54:07 -06:00
|
|
|
if (!(m->userdata = pa_raop_sink_new(m, ma, __FILE__)))
|
2008-05-01 23:51:45 +00:00
|
|
|
goto fail;
|
|
|
|
|
|
|
|
|
|
pa_modargs_free(ma);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
fail:
|
2016-11-06 12:53:58 -06:00
|
|
|
|
2008-05-01 23:51:45 +00:00
|
|
|
if (ma)
|
|
|
|
|
pa_modargs_free(ma);
|
|
|
|
|
|
|
|
|
|
pa__done(m);
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-15 20:49:12 +01:00
|
|
|
int pa__get_n_used(pa_module *m) {
|
2016-11-06 12:54:07 -06:00
|
|
|
pa_sink *sink;
|
2009-01-15 20:49:12 +01:00
|
|
|
|
|
|
|
|
pa_assert(m);
|
2016-11-06 12:54:07 -06:00
|
|
|
pa_assert_se(sink = m->userdata);
|
2009-01-15 20:49:12 +01:00
|
|
|
|
2016-11-06 12:54:07 -06:00
|
|
|
return pa_sink_linked_by(sink);
|
2009-01-15 20:49:12 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-31 22:16:00 -06:00
|
|
|
void pa__done(pa_module *m) {
|
2016-11-06 12:54:07 -06:00
|
|
|
pa_sink *sink;
|
2008-05-11 12:21:32 +00:00
|
|
|
|
2016-11-06 12:54:07 -06:00
|
|
|
pa_assert(m);
|
2008-05-11 12:21:32 +00:00
|
|
|
|
2016-11-06 12:54:07 -06:00
|
|
|
if ((sink = m->userdata))
|
|
|
|
|
pa_raop_sink_free(sink);
|
2008-05-01 23:51:45 +00:00
|
|
|
}
|