Add support for getting Shoutcast (ICY) metadata from internet streams

This commit is contained in:
ejurgensen
2013-09-24 22:27:49 +02:00
parent c1c171e21f
commit 548141e723
6 changed files with 267 additions and 5 deletions

View File

@@ -239,6 +239,13 @@ struct {
* the regular callback.
*/
void (*chunk_cb)(struct evhttp_request *, void *);
/*
* Callback added for forked-daapd so we can collect ICY
* (shoutcast) metadata from the http header. If return
* int is negative the connection will be closed.
*/
int (*header_cb)(struct evhttp_request *, void *);
};
/**

View File

@@ -1656,6 +1656,14 @@ evhttp_read_header(struct evhttp_connection *evcon, struct evhttp_request *req)
return;
}
/* Callback can shut down connection with negative return value */
if (req->header_cb != NULL) {
if ((*req->header_cb)(req, req->cb_arg) < 0) {
evhttp_connection_fail(evcon, EVCON_HTTP_EOF);
return;
}
}
/* Done reading headers, do the real work */
switch (req->kind) {
case EVHTTP_REQUEST: