#include "common.h"
#include "mdns.h"
+#include "rtsp.h"
#include <string.h>
#include <avahi-client/client.h>
if (*p != port) {
debug(1, "Client's DACP port: %u.", port);
*p = port;
+ #ifdef CONFIG_METADATA
+ char portstring[10];
+ memset(portstring,0,sizeof(portstring));
+ sprintf(portstring, "%u", port);
+ send_ssnc_metadata('dapo', strdup(portstring), strlen(portstring), 0);
+ #endif
}
}
} else {
avahi_threaded_poll_quit(tpoll);
break;
case AVAHI_BROWSER_NEW:
- // debug(1, "(Browser) NEW: service '%s' of type '%s' in domain '%s'.", name, type, domain);
+ debug(1, "(Browser) NEW: service '%s' of type '%s' in domain '%s'.", name, type, domain);
/* We ignore the returned resolver object. In the callback
function we free it. If the server is terminated before
the callback function is called the server will free
void avahi_dacp_dont_monitor(void **private_pointer) {
dacp_browser_struct **pdbs = (dacp_browser_struct **)private_pointer;
-
- // stop and dispose of everything
- if ((*pdbs)->service_poll)
- avahi_threaded_poll_stop((*pdbs)->service_poll);
- if ((*pdbs)->service_browser)
- avahi_service_browser_free((*pdbs)->service_browser);
- if ((*pdbs)->service_client)
- avahi_client_free((*pdbs)->service_client);
- if ((*pdbs)->service_poll)
- avahi_threaded_poll_free((*pdbs)->service_poll);
- free((char *)(*pdbs));
- *pdbs = NULL;
+ if (*pdbs) {
+ // stop and dispose of everything
+ if ((*pdbs)->service_poll)
+ avahi_threaded_poll_stop((*pdbs)->service_poll);
+ if ((*pdbs)->service_browser)
+ avahi_service_browser_free((*pdbs)->service_browser);
+ if ((*pdbs)->service_client)
+ avahi_client_free((*pdbs)->service_client);
+ if ((*pdbs)->service_poll)
+ avahi_threaded_poll_free((*pdbs)->service_poll);
+ free((char *)(*pdbs));
+ *pdbs = NULL;
+ } else {
+ debug(1,"DHCP Monitor is not running.");
+ }
}
mdns_backend mdns_avahi = {.name = "avahi",
// to send commands to the source's remote control (if it has one).
// `clip` -- the payload is the IP number of the client, i.e. the sender of audio.
// Can be an IPv4 or an IPv6 number.
+// `dapo` -- the payload is the port number (as text) on the server to which remote control commands should be sent. It is 3689 for iTunes but varies for iOS devices.
// A special sub-protocol is used for sending large data items over UDP
// If the payload exceeded 4 MB, it is chunked using the following format:
inet_ntop(AF_INET, &(sa->sin_addr), remote_ip4, INET_ADDRSTRLEN);
unsigned short int rport = ntohs(sa->sin_port);
#ifdef CONFIG_METADATA
- send_ssnc_metadata('clip', strdup(remote_ip4), strlen(remote_ip4), 1);
+ send_ssnc_metadata'clip', strdup(remote_ip4), strlen(remote_ip4), 1);
send_ssnc_metadata('svip', strdup(ip4), strlen(ip4), 1);
#endif
debug(1, "New RTSP connection from %s:%u to self at %s:%u on conversation thread %d.",
// sends metadata out to the metadata pipe, if enabled.
// It is sent with the type 'ssnc' the given code, data and length
-// The handler at the other end must kknow what to do with the data
-// e.g. it it's malloced, to free it, etc.
+// The handler at the other end must know what to do with the data
+// e.g. if it's malloced, to free it, etc.
// nothing is done automatically
int send_ssnc_metadata(uint32_t code, char *data, uint32_t length, int block);