Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add _hdr option to avoid getting ICY metadata #336

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ int is_worker_incoming (worker_t *w);
#define CLIENT_RANGE_END (1<<11)
#define CLIENT_KEEPALIVE (1<<12)
#define CLIENT_CHUNKED (1<<13)
#define CLIENT_NO_ICY (1<<14)
#define CLIENT_FORMAT_BIT (1<<16)

#endif /* __CLIENT_H__ */
3 changes: 3 additions & 0 deletions src/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ int format_general_headers (format_plugin_t *plugin, client_t *client)
#define FMT_LOWERCASE_TYPE 2
#define FMT_FORCE_AAC 4
#define FMT_DISABLE_CHUNKED 8
#define FMT_NO_ICY 16

do
{
Expand Down Expand Up @@ -374,6 +375,8 @@ int format_general_headers (format_plugin_t *plugin, client_t *client)
contenttypehdr = "content-type";
if (fmtcode & FMT_FORCE_AAC) // ie for avoiding audio/aacp
contenttype = "audio/aac";
if (fmtcode & FMT_NO_ICY)
client->flags |= CLIENT_NO_ICY;
if (fs)
{
uint64_t len = (uint64_t)-1;
Expand Down
4 changes: 2 additions & 2 deletions src/format_mp3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ static int format_mp3_create_client_data (format_plugin_t *plugin, client_t *cli
client->refbuf->len = 0;

metadata = httpp_getvar(client->parser, "icy-metadata");
if (metadata && atoi(metadata))
if (metadata && atoi(metadata) && (client->flags & CLIENT_NO_ICY) == 0)
httpp_setvar (client->parser, HTTPP_VAR_VERSION, "1.0"); // hack force 1.0 if icy metadata requested

if (format_general_headers (plugin, client) < 0)
Expand All @@ -1150,7 +1150,7 @@ static int format_mp3_create_client_data (format_plugin_t *plugin, client_t *cli
else
{
/* check for shoutcast style metadata inserts */
if (metadata && atoi(metadata))
if (metadata && atoi(metadata) && (client->flags & CLIENT_NO_ICY) == 0)
{
if (source_mp3->interval >= 0)
client_mp3->interval = source_mp3->interval;
Expand Down