diff options
author | Max Kellermann <max@duempel.org> | 2009-11-05 20:01:18 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-05 20:01:18 +0100 |
commit | 2a9685cb3ad50702bad8789ab4c7d7837a4579fe (patch) | |
tree | 4631ed6de47e5166195e6f6b0743fe42d5faea39 /src/output/jack_output_plugin.c | |
parent | 9449006ac386234c06e5e8c9c3b65850967e647c (diff) | |
download | mpd-2a9685cb3ad50702bad8789ab4c7d7837a4579fe.tar.gz mpd-2a9685cb3ad50702bad8789ab4c7d7837a4579fe.tar.xz mpd-2a9685cb3ad50702bad8789ab4c7d7837a4579fe.zip |
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".
Diffstat (limited to '')
-rw-r--r-- | src/output/jack_output_plugin.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/output/jack_output_plugin.c b/src/output/jack_output_plugin.c index 3d38a9d2d..51c148282 100644 --- a/src/output/jack_output_plugin.c +++ b/src/output/jack_output_plugin.c @@ -43,6 +43,11 @@ static const char *const port_names[2] = { }; struct jack_data { + /** + * libjack options passed to jack_client_open(). + */ + jack_options_t options; + const char *name; /* configuration */ @@ -169,13 +174,17 @@ mpd_jack_disconnect(struct jack_data *jd) static bool mpd_jack_connect(struct jack_data *jd, GError **error_r) { + jack_status_t status; + assert(jd != NULL); 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, - "Failed to connect to JACK server"); + "Failed to connect to JACK server, status=%d", + status); return false; } @@ -212,8 +221,18 @@ mpd_jack_init(G_GNUC_UNUSED const struct audio_format *audio_format, const char *value; jd = g_new(struct jack_data, 1); - jd->name = config_get_block_string(param, "client_name", - "Music Player Daemon"); + jd->options = JackNullOption; + + 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); if (value != NULL) { |