From 61c2f5d5fa6f775ba9bee01788962cdae41c0b6c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Juho=20Va=CC=88ha=CC=88-Herttua?= Date: Tue, 9 Apr 2013 11:47:17 +0300 Subject: [PATCH] Print error if dnssd library not available --- src/shairplay.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/shairplay.c b/src/shairplay.c index b125bbe..6ee23ba 100644 --- a/src/shairplay.c +++ b/src/shairplay.c @@ -233,6 +233,8 @@ main(int argc, char *argv[]) raop_t *raop; raop_callbacks_t raop_cbs; + int error; + memset(&options, 0, sizeof(options)); if (parse_options(&options, argc, argv)) { return 0; @@ -266,8 +268,20 @@ main(int argc, char *argv[]) raop_set_log_level(raop, RAOP_LOG_DEBUG); raop_start(raop, &options.port, hwaddr, sizeof(hwaddr), NULL); - dnssd = dnssd_init(NULL); + error = 0; + dnssd = dnssd_init(&error); + if (error) { + fprintf(stderr, "ERROR: Could not initialize dnssd library!\n"); + fprintf(stderr, "------------------------------------------\n"); + fprintf(stderr, "You could try the following resolutions based on your OS:\n"); + fprintf(stderr, "Windows: Try installing http://support.apple.com/kb/DL999\n"); + fprintf(stderr, "Debian/Ubuntu: Try installing libavahi-compat-libdnssd1 package\n"); + raop_destroy(raop); + return -1; + } + dnssd_register_raop(dnssd, options.apname, options.port, hwaddr, sizeof(hwaddr), 0); + dnssd_register_airplay(dnssd, options.apname, 1234, hwaddr, sizeof(hwaddr)); #ifndef WIN32 sleep(100); -- 2.34.1