}
free(datastr);
} else if (!strcmp(content_type, "image/jpeg")) {
- logger_log(&conn->raop->logger, LOGGER_INFO, "UNHANDLED: Got image data of %d bytes", datalen);
+ logger_log(&conn->raop->logger, LOGGER_INFO, "Got image data of %d bytes", datalen);
+ raop_rtp_set_coverart(conn->raop_rtp, data, datalen);
} else if (!strcmp(content_type, "application/x-dmap-tagged")) {
- logger_log(&conn->raop->logger, LOGGER_INFO, "UNHANDLED: Got metadata of %d bytes", datalen);
+ logger_log(&conn->raop->logger, LOGGER_INFO, "Got metadata of %d bytes", datalen);
+ raop_rtp_set_metadata(conn->raop_rtp, data, datalen);
}
} else if (!strcmp(method, "FLUSH")) {
const char *rtpinfo;
struct sockaddr_storage remote_saddr;
socklen_t remote_saddr_len;
+ /* MUTEX LOCKED VARIABLES START */
/* These variables only edited mutex locked */
int running;
int joined;
+
float volume;
+ unsigned char *metadata;
+ int metadata_len;
+ unsigned char *coverart;
+ int coverart_len;
+
int flush;
thread_handle_t thread;
mutex_handle_t run_mutex;
+ /* MUTEX LOCKED VARIABLES END */
/* Remote control and timing ports */
unsigned short control_rport;
MUTEX_DESTROY(raop_rtp->run_mutex);
raop_buffer_destroy(raop_rtp->buffer);
+ free(raop_rtp->metadata);
+ free(raop_rtp->coverart);
free(raop_rtp);
}
}
MUTEX_UNLOCK(raop_rtp->run_mutex);
}
+void
+raop_rtp_set_metadata(raop_rtp_t *raop_rtp, const char *data, int datalen)
+{
+ unsigned char *metadata;
+
+ assert(raop_rtp);
+
+ if (datalen <= 0) {
+ return;
+ }
+ metadata = malloc(datalen);
+ assert(metadata);
+ memcpy(metadata, data, datalen);
+
+ /* Set metadata in thread instead */
+ MUTEX_LOCK(raop_rtp->run_mutex);
+ raop_rtp->metadata = metadata;
+ raop_rtp->metadata_len = datalen;
+ MUTEX_UNLOCK(raop_rtp->run_mutex);
+}
+
+void
+raop_rtp_set_coverart(raop_rtp_t *raop_rtp, const char *data, int datalen)
+{
+ unsigned char *coverart;
+
+ assert(raop_rtp);
+
+ if (datalen <= 0) {
+ return;
+ }
+ coverart = malloc(datalen);
+ assert(coverart);
+ memcpy(coverart, data, datalen);
+
+ /* Set coverart in thread instead */
+ MUTEX_LOCK(raop_rtp->run_mutex);
+ raop_rtp->coverart = coverart;
+ raop_rtp->coverart_len = datalen;
+ MUTEX_UNLOCK(raop_rtp->run_mutex);
+}
+
void
raop_rtp_flush(raop_rtp_t *raop_rtp, int next_seq)
{
void raop_rtp_start(raop_rtp_t *raop_rtp, int use_udp, unsigned short control_rport, unsigned short timing_rport,
unsigned short *control_lport, unsigned short *timing_lport, unsigned short *data_lport);
void raop_rtp_set_volume(raop_rtp_t *raop_rtp, float volume);
+void raop_rtp_set_metadata(raop_rtp_t *raop_rtp, const char *data, int datalen);
+void raop_rtp_set_coverart(raop_rtp_t *raop_rtp, const char *data, int datalen);
void raop_rtp_flush(raop_rtp_t *raop_rtp, int next_seq);
void raop_rtp_stop(raop_rtp_t *raop_rtp);
void raop_rtp_destroy(raop_rtp_t *raop_rtp);