mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
[http] Change name of struct field for StreamUrl
Should not be called artwork_url, since it also can link to other ressources. Also some fixup, e.g. use new macros.
This commit is contained in:
parent
d073781445
commit
d2ac216f47
46
src/http.c
46
src/http.c
@ -667,9 +667,9 @@ metadata_packet_get(struct http_icy_metadata *metadata, AVFormatContext *fmtctx)
|
||||
else
|
||||
metadata->title = strdup(metadata->title);
|
||||
}
|
||||
else if ((strncmp(icy_token, "StreamUrl", strlen("StreamUrl")) == 0) && !metadata->artwork_url && strlen(ptr) > 0)
|
||||
else if ((strncmp(icy_token, "StreamUrl", strlen("StreamUrl")) == 0) && !metadata->url && strlen(ptr) > 0)
|
||||
{
|
||||
metadata->artwork_url = strdup(ptr);
|
||||
metadata->url = strdup(ptr);
|
||||
}
|
||||
|
||||
if (end)
|
||||
@ -741,10 +741,7 @@ http_icy_metadata_get(AVFormatContext *fmtctx, int packet_only)
|
||||
int got_packet;
|
||||
int got_header;
|
||||
|
||||
metadata = malloc(sizeof(struct http_icy_metadata));
|
||||
if (!metadata)
|
||||
return NULL;
|
||||
memset(metadata, 0, sizeof(struct http_icy_metadata));
|
||||
CHECK_NULL(L_HTTP, metadata = calloc(1, sizeof(struct http_icy_metadata)));
|
||||
|
||||
got_packet = (metadata_packet_get(metadata, fmtctx) == 0);
|
||||
got_header = (!packet_only) && (metadata_header_get(metadata, fmtctx) == 0);
|
||||
@ -761,7 +758,7 @@ http_icy_metadata_get(AVFormatContext *fmtctx, int packet_only)
|
||||
metadata->genre,
|
||||
metadata->title,
|
||||
metadata->artist,
|
||||
metadata->artwork_url,
|
||||
metadata->url,
|
||||
metadata->hash
|
||||
);
|
||||
*/
|
||||
@ -816,10 +813,7 @@ http_icy_metadata_get(AVFormatContext *fmtctx, int packet_only)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
metadata = malloc(sizeof(struct http_icy_metadata));
|
||||
if (!metadata)
|
||||
return NULL;
|
||||
memset(metadata, 0, sizeof(struct http_icy_metadata));
|
||||
CHECK_NULL(L_HTTP, metadata = calloc(1, sizeof(struct http_icy_metadata)));
|
||||
|
||||
got_header = 0;
|
||||
if ( (value = keyval_get(ctx.input_headers, "icy-name")) )
|
||||
@ -853,7 +847,7 @@ http_icy_metadata_get(AVFormatContext *fmtctx, int packet_only)
|
||||
metadata->genre,
|
||||
metadata->title,
|
||||
metadata->artist,
|
||||
metadata->artwork_url,
|
||||
metadata->url,
|
||||
metadata->hash
|
||||
);*/
|
||||
|
||||
@ -864,24 +858,14 @@ http_icy_metadata_get(AVFormatContext *fmtctx, int packet_only)
|
||||
void
|
||||
http_icy_metadata_free(struct http_icy_metadata *metadata, int content_only)
|
||||
{
|
||||
if (metadata->name)
|
||||
free(metadata->name);
|
||||
if (!metadata)
|
||||
return;
|
||||
|
||||
if (metadata->description)
|
||||
free(metadata->description);
|
||||
|
||||
if (metadata->genre)
|
||||
free(metadata->genre);
|
||||
|
||||
if (metadata->title)
|
||||
free(metadata->title);
|
||||
|
||||
if (metadata->artist)
|
||||
free(metadata->artist);
|
||||
|
||||
if (metadata->artwork_url)
|
||||
free(metadata->artwork_url);
|
||||
|
||||
if (!content_only)
|
||||
free(metadata);
|
||||
free(metadata->name);
|
||||
free(metadata->description);
|
||||
free(metadata->genre);
|
||||
free(metadata->title);
|
||||
free(metadata->artist);
|
||||
free(metadata->url);
|
||||
free(metadata);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ struct http_icy_metadata
|
||||
/* Track specific, comes from icy_metadata_packet */
|
||||
char *title;
|
||||
char *artist;
|
||||
char *artwork_url;
|
||||
char *url;
|
||||
|
||||
uint32_t hash;
|
||||
};
|
||||
|
@ -147,7 +147,7 @@ metadata_get_http(struct input_metadata *metadata, struct input_source *source)
|
||||
swap_pointers(&metadata->artist, &m->artist);
|
||||
// Note we map title to album, because clients should show stream name as titel
|
||||
swap_pointers(&metadata->album, &m->title);
|
||||
swap_pointers(&metadata->artwork_url, &m->artwork_url);
|
||||
swap_pointers(&metadata->artwork_url, &m->url);
|
||||
|
||||
http_icy_metadata_free(m, 0);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user