int mqtt_enable_remote;
char *mqtt_empty_payload_substitute;
#endif
+ uint8_t ap1_prefix[6];
uint8_t hw_addr[8]; // only needs 6 but 8 is handy when converting this to a number
int port;
int udp_port_base;
http_response = dacp_get_speaker_list((dacp_spkr_stuff *)&speaker_info, 50, &speaker_count);
if (http_response == 200) {
// get our machine number
- uint16_t *hn = (uint16_t *)config.hw_addr;
- uint32_t *ln = (uint32_t *)(config.hw_addr + 2);
+ uint16_t *hn = (uint16_t *)config.ap1_prefix;
+ uint32_t *ln = (uint32_t *)(config.ap1_prefix + 2);
uint64_t t1 = ntohs(*hn);
uint64_t t2 = ntohl(*ln);
int64_t machine_number = (t1 << 32) + t2; // this form is useful
http_response = dacp_get_speaker_list((dacp_spkr_stuff *)&speaker_info, 50, &speaker_count);
if (http_response == 200) {
// get our machine number
- uint16_t *hn = (uint16_t *)config.hw_addr;
- uint32_t *ln = (uint32_t *)(config.hw_addr + 2);
+ uint16_t *hn = (uint16_t *)config.ap1_prefix;
+ uint32_t *ln = (uint32_t *)(config.ap1_prefix + 2);
uint64_t t1 = ntohs(*hn);
uint64_t t2 = ntohl(*ln);
int64_t machine_number = (t1 << 32) + t2; // this form is useful
char *p = ap1_service_name;
int i;
for (i = 0; i < 6; i++) {
- snprintf(p, 3, "%02X", config.hw_addr[i]);
+ snprintf(p, 3, "%02X", config.ap1_prefix[i]);
p += 2;
}
*p++ = '@';
buffers_allocated++;
}
}
- debug(1, "%" PRId64 " buffers allocated, %" PRId64 " buffers released.", buffers_allocated, buffers_released);
}
static void free_audio_buffers(rtsp_conn_info *conn) {
free(conn->audio_buffer[i].data);
buffers_released++;
}
+ debug(1, "%" PRId64 " buffers allocated, %" PRId64 " buffers released.", buffers_allocated, buffers_released);
}
int first_possibly_missing_frame = -1;
int64_t elapsedMin = (time_playing / 60) % 60;
int64_t elapsedSec = time_playing % 60;
if (conn->frame_rate_valid)
- inform("Connection %d: Playback Stopped. Total playing time %02" PRId64 ":%02" PRId64
+ inform("Connection %d: Playback stopped. Total playing time %02" PRId64 ":%02" PRId64
":%02" PRId64 ". "
"Output: %0.2f (raw), %0.2f (corrected) "
"frames per second.",
conn->connection_number, elapsedHours, elapsedMin, elapsedSec, conn->raw_frame_rate,
conn->corrected_frame_rate);
else
- inform("Connection %d: Playback Stopped. Total playing time %02" PRId64 ":%02" PRId64
+ inform("Connection %d: Playback stopped. Total playing time %02" PRId64 ":%02" PRId64
":%02" PRId64 ".",
conn->connection_number, elapsedHours, elapsedMin, elapsedSec);
}
send_ssnc_metadata('styp', "Classic", strlen("Classic"), 1);
#endif
if (config.statistics_requested)
- inform("Connection %d: Playback Started at frame %" PRId64 " -- AirPlay 1 Compatible.",
+ inform("Connection %d: Playback started at frame %" PRId64 " -- AirPlay 1 Compatible.",
conn->connection_number, inframe->given_timestamp);
} else {
#ifdef CONFIG_METADATA_HUB
send_ssnc_metadata('styp', "Realtime", strlen("Realtime"), 1);
#endif
if (config.statistics_requested)
- inform("Connection %d: Playback Started at frame %" PRId64 " -- AirPlay 2 Realtime.",
+ inform("Connection %d: Playback started at frame %" PRId64 " -- AirPlay 2 Realtime.",
conn->connection_number, inframe->given_timestamp);
}
} else {
send_ssnc_metadata('styp', "Buffered", strlen("Buffered"), 1);
#endif
if (config.statistics_requested)
- inform("Connection %d: Playback Started at frame %" PRId64 " -- AirPlay 2 Buffered.",
+ inform("Connection %d: Playback started at frame %" PRId64 " -- AirPlay 2 Buffered.",
conn->connection_number, inframe->given_timestamp);
}
#else
send_ssnc_metadata('styp', "Classic", strlen("Classic"), 1);
#endif
if (config.statistics_requested)
- inform("Connection %d: Playback Started at frame %" PRId64 " -- AirPlay 1.", conn->connection_number, inframe->given_timestamp);
+ inform("Connection %d: Playback started at frame %" PRId64 " -- AirPlay 1.", conn->connection_number, inframe->given_timestamp);
#endif
}
// not too sure if abs() is implemented for int64_t, so we'll do it manually
while (msg_size < 0) {
if (conn->stop != 0) {
- debug(3, "Connection %d: shutdown requested.", conn->connection_number);
+ debug(3, "Connection %d: Shutdown requested by client.", conn->connection_number);
reply = rtsp_read_request_response_immediate_shutdown_requested;
goto shutdown;
}
if (nread == 0) {
// a blocking read that returns zero means eof -- implies connection closed by client
- debug(1, "Connection %d: RTSP connection closed by client.",
+ debug(1, "Connection %d: Connection closed by client.",
conn->connection_number);
reply = rtsp_read_request_response_channel_closed;
// Note: the socket will be closed when the thread exits
}
for (i = 0; i < 6; i++)
- *bp++ = config.hw_addr[i];
+ *bp++ = config.ap1_prefix[i];
int buflen, resplen;
buflen = bp - buf;
conn->audio_socket = 0;
}
if (conn->fd > 0) {
- debug(1, "Connection %d: terminating -- closing RTSP connection socket %d: from %s:%u to self at %s:%u.",
+ debug(2, "Connection %d: terminating -- closing RTSP connection socket %d: from %s:%u to self at %s:%u.",
conn->connection_number, conn->fd, conn->client_ip_string, conn->client_rtsp_port,
conn->self_ip_string, conn->self_rtsp_port);
close(conn->fd);
soxr_time_check_thread_started = 1;
#endif
+ // calculate the 12-hex-digit prefix by hashing the service name.
+ uint8_t ap_md5[16];
+
+debug(1,"size of hw_addr is %u.", sizeof(config.hw_addr));
+#ifdef CONFIG_OPENSSL
+ MD5_CTX ctx;
+ MD5_Init(&ctx);
+ MD5_Update(&ctx, config.service_name, strlen(config.service_name));
+ MD5_Update(&ctx, config.hw_addr, sizeof(config.hw_addr));
+ MD5_Final(ap_md5, &ctx);
+#endif
+
+#ifdef CONFIG_MBEDTLS
+#if MBEDTLS_VERSION_MINOR >= 7
+ mbedtls_md5_context tctx;
+ mbedtls_md5_starts_ret(&tctx);
+ mbedtls_md5_update_ret(&tctx, (unsigned char *)config.service_name, strlen(config.service_name));
+ mbedtls_md5_update_ret(&tctx, (unsigned char *)config.hw_addr, sizeof(config.hw_addr));
+ mbedtls_md5_finish_ret(&tctx, ap_md5);
+#else
+ mbedtls_md5_context tctx;
+ mbedtls_md5_starts(&tctx);
+ mbedtls_md5_update(&tctx, (unsigned char *)config.service_name, strlen(config.service_name));
+ mbedtls_md5_update(&tctx, (unsigned char *)config.hw_addr, sizeof(config.hw_addr));
+ mbedtls_md5_finish(&tctx, ap_md5);
+#endif
+#endif
+
+#ifdef CONFIG_POLARSSL
+ md5_context tctx;
+ md5_starts(&tctx);
+ md5_update(&tctx, (unsigned char *)config.service_name, strlen(config.service_name));
+ md5_update(&tctx, (unsigned char *)config.hw_addr, sizeof(config.hw_addr));
+ md5_finish(&tctx, ap_md5);
+#endif
+
+ memcpy(config.ap1_prefix, ap_md5, sizeof(config.ap1_prefix));
+
+
#ifdef CONFIG_METADATA
metadata_init(); // create the metadata pipe if necessary
#endif