Commit 2a9685cb authored by Max Kellermann's avatar Max Kellermann

output/jack: use jack_client_open() instead of jack_client_new()

jack_client_new() is deprecated. This requires libjack 0.100 (released nearly 5 years ago). We havn't been testing older libjack versions anyway. As a side effect, there is the new option "autostart".
parent 9449006a
...@@ -32,6 +32,7 @@ ver 0.16 (20??/??/??) ...@@ -32,6 +32,7 @@ ver 0.16 (20??/??/??)
- pulse: announce "media.role=music" - pulse: announce "media.role=music"
- pulse: renamed context to "Music Player Daemon" - pulse: renamed context to "Music Player Daemon"
- pulse: connect to server on MPD startup, implement pause - pulse: connect to server on MPD startup, implement pause
- jack: require libjack 0.100
- jack: don't disconnect during pause - jack: don't disconnect during pause
- jack: connect to server on MPD startup - jack: connect to server on MPD startup
- jack: added option "client_name" - jack: added option "client_name"
......
...@@ -700,7 +700,7 @@ AC_ARG_ENABLE(jack, ...@@ -700,7 +700,7 @@ AC_ARG_ENABLE(jack,
[enable jack support]),, [enable jack support]),,
enable_jack=auto) enable_jack=auto)
MPD_AUTO_PKG(jack, JACK, [jack >= 0.4], MPD_AUTO_PKG(jack, JACK, [jack >= 0.100],
[JACK output plugin], [libjack not found]) [JACK output plugin], [libjack not found])
if test x$enable_jack = xyes; then if test x$enable_jack = xyes; then
AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support]) AC_DEFINE([HAVE_JACK], 1, [Define to enable JACK support])
......
...@@ -747,6 +747,17 @@ cd mpd-version</programlisting> ...@@ -747,6 +747,17 @@ cd mpd-version</programlisting>
</row> </row>
<row> <row>
<entry> <entry>
<varname>autostart</varname>
<parameter>yes|no</parameter>
</entry>
<entry>
If set to <parameter>yes</parameter>, then
<filename>libjack</filename> will automatically
launch the JACK daemon. Disabled by default.
</entry>
</row>
<row>
<entry>
<varname>ports</varname> <varname>ports</varname>
<parameter>A,B</parameter> <parameter>A,B</parameter>
</entry> </entry>
......
...@@ -43,6 +43,11 @@ static const char *const port_names[2] = { ...@@ -43,6 +43,11 @@ static const char *const port_names[2] = {
}; };
struct jack_data { struct jack_data {
/**
* libjack options passed to jack_client_open().
*/
jack_options_t options;
const char *name; const char *name;
/* configuration */ /* configuration */
...@@ -169,13 +174,17 @@ mpd_jack_disconnect(struct jack_data *jd) ...@@ -169,13 +174,17 @@ mpd_jack_disconnect(struct jack_data *jd)
static bool static bool
mpd_jack_connect(struct jack_data *jd, GError **error_r) mpd_jack_connect(struct jack_data *jd, GError **error_r)
{ {
jack_status_t status;
assert(jd != NULL); assert(jd != NULL);
jd->shutdown = false; jd->shutdown = false;
if ((jd->client = jack_client_new(jd->name)) == NULL) { jd->client = jack_client_open(jd->name, jd->options, &status);
if (jd->client == NULL) {
g_set_error(error_r, jack_output_quark(), 0, g_set_error(error_r, jack_output_quark(), 0,
"Failed to connect to JACK server"); "Failed to connect to JACK server, status=%d",
status);
return false; return false;
} }
...@@ -212,8 +221,18 @@ mpd_jack_init(G_GNUC_UNUSED const struct audio_format *audio_format, ...@@ -212,8 +221,18 @@ mpd_jack_init(G_GNUC_UNUSED const struct audio_format *audio_format,
const char *value; const char *value;
jd = g_new(struct jack_data, 1); jd = g_new(struct jack_data, 1);
jd->name = config_get_block_string(param, "client_name", jd->options = JackNullOption;
"Music Player Daemon");
jd->name = config_get_block_string(param, "client_name", NULL);
if (jd->name != NULL)
jd->options |= JackUseExactName;
else
/* if there's a no configured client name, we don't
care about the JackUseExactName option */
jd->name = "Music Player Daemon";
if (!config_get_block_bool(param, "autostart", false))
jd->options |= JackNoStartServer;
value = config_get_block_string(param, "ports", NULL); value = config_get_block_string(param, "ports", NULL);
if (value != NULL) { if (value != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment