mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
Enable and handle JPEG artwork in DACP
This commit is contained in:
parent
204c9681ca
commit
ac73ee0ce5
@ -1220,6 +1220,7 @@ dacp_reply_nowplayingartwork(struct evhttp_request *req, struct evbuffer *evbuf,
|
|||||||
char clen[32];
|
char clen[32];
|
||||||
struct daap_session *s;
|
struct daap_session *s;
|
||||||
const char *param;
|
const char *param;
|
||||||
|
char *ctype;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
int max_w;
|
int max_w;
|
||||||
int max_h;
|
int max_h;
|
||||||
@ -1269,17 +1270,26 @@ dacp_reply_nowplayingartwork(struct evhttp_request *req, struct evbuffer *evbuf,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto no_artwork;
|
goto no_artwork;
|
||||||
|
|
||||||
ret = artwork_get_item(id, max_w, max_h, ART_CAN_PNG, evbuf);
|
ret = artwork_get_item(id, max_w, max_h, ART_CAN_PNG | ART_CAN_JPEG, evbuf);
|
||||||
if (ret < 0)
|
switch (ret)
|
||||||
{
|
{
|
||||||
if (EVBUFFER_LENGTH(evbuf) > 0)
|
case ART_FMT_PNG:
|
||||||
evbuffer_drain(evbuf, EVBUFFER_LENGTH(evbuf));
|
ctype = "image/png";
|
||||||
|
break;
|
||||||
|
|
||||||
goto no_artwork;
|
case ART_FMT_JPEG:
|
||||||
|
ctype = "image/jpeg";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (EVBUFFER_LENGTH(evbuf) > 0)
|
||||||
|
evbuffer_drain(evbuf, EVBUFFER_LENGTH(evbuf));
|
||||||
|
|
||||||
|
goto no_artwork;
|
||||||
}
|
}
|
||||||
|
|
||||||
evhttp_remove_header(req->output_headers, "Content-Type");
|
evhttp_remove_header(req->output_headers, "Content-Type");
|
||||||
evhttp_add_header(req->output_headers, "Content-Type", "image/png");
|
evhttp_add_header(req->output_headers, "Content-Type", ctype);
|
||||||
snprintf(clen, sizeof(clen), "%ld", (long)EVBUFFER_LENGTH(evbuf));
|
snprintf(clen, sizeof(clen), "%ld", (long)EVBUFFER_LENGTH(evbuf));
|
||||||
evhttp_add_header(req->output_headers, "Content-Length", clen);
|
evhttp_add_header(req->output_headers, "Content-Length", clen);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user