Commit d077dc4b authored by Karl Heyes's avatar Karl Heyes

add subtype to yp add phase, this is to identify the codecs in use

svn path=/icecast/trunk/icecast/; revision=8360
parent 4066a89c
...@@ -242,6 +242,8 @@ static void update_comments (source_t *source) ...@@ -242,6 +242,8 @@ static void update_comments (source_t *source)
char *artist = ogg_info->artist; char *artist = ogg_info->artist;
char *metadata = NULL; char *metadata = NULL;
unsigned int len = 0; unsigned int len = 0;
ogg_codec_t *codec;
char codec_names [100] = "";
if (ogg_info->artist) if (ogg_info->artist)
{ {
...@@ -274,6 +276,23 @@ static void update_comments (source_t *source) ...@@ -274,6 +276,23 @@ static void update_comments (source_t *source)
} }
stats_event (source->mount, "artist", artist); stats_event (source->mount, "artist", artist);
stats_event (source->mount, "title", title); stats_event (source->mount, "title", title);
codec = ogg_info->codecs;
while (codec)
{
if (codec->name)
{
int len = strlen (codec_names);
int remaining = sizeof (codec_names) - len;
char *where = codec_names + len;
char *separator = " ";
if (len == 0)
separator = "";
snprintf (where, remaining, "%s%s", separator, codec->name);
}
codec = codec->next;
}
stats_event (source->mount, "subtype", codec_names);
yp_touch (source->mount); yp_touch (source->mount);
} }
......
...@@ -49,6 +49,7 @@ typedef struct ogg_codec_tag ...@@ -49,6 +49,7 @@ typedef struct ogg_codec_tag
struct ogg_codec_tag *next; struct ogg_codec_tag *next;
ogg_stream_state os; ogg_stream_state os;
unsigned headers; unsigned headers;
const char *name;
void *specific; void *specific;
refbuf_t *possible_start; refbuf_t *possible_start;
refbuf_t *page; refbuf_t *page;
......
...@@ -177,6 +177,8 @@ ogg_codec_t *initial_theora_page (format_plugin_t *plugin, ogg_page *page) ...@@ -177,6 +177,8 @@ ogg_codec_t *initial_theora_page (format_plugin_t *plugin, ogg_page *page)
codec->process_page = process_theora_page; codec->process_page = process_theora_page;
codec->codec_free = theora_codec_free; codec->codec_free = theora_codec_free;
codec->headers = 1; codec->headers = 1;
codec->name = "Theora";
format_ogg_attach_header (ogg_info, page); format_ogg_attach_header (ogg_info, page);
ogg_info->codec_sync = codec; ogg_info->codec_sync = codec;
return codec; return codec;
......
...@@ -357,6 +357,7 @@ ogg_codec_t *initial_vorbis_page (format_plugin_t *plugin, ogg_page *page) ...@@ -357,6 +357,7 @@ ogg_codec_t *initial_vorbis_page (format_plugin_t *plugin, ogg_page *page)
codec->specific = vorbis; codec->specific = vorbis;
codec->codec_free = vorbis_codec_free; codec->codec_free = vorbis_codec_free;
codec->headers = 1; codec->headers = 1;
codec->name = "Vorbis";
free_ogg_packet (vorbis->header[0]); free_ogg_packet (vorbis->header[0]);
free_ogg_packet (vorbis->header[1]); free_ogg_packet (vorbis->header[1]);
......
...@@ -70,6 +70,7 @@ typedef struct ypdata_tag ...@@ -70,6 +70,7 @@ typedef struct ypdata_tag
char *audio_info; char *audio_info;
char *server_type; char *server_type;
char *current_song; char *current_song;
char *subtype;
struct yp_server *server; struct yp_server *server;
time_t next_update; time_t next_update;
...@@ -330,11 +331,21 @@ static unsigned do_yp_remove (ypdata_t *yp, char *s, unsigned len) ...@@ -330,11 +331,21 @@ static unsigned do_yp_remove (ypdata_t *yp, char *s, unsigned len)
static unsigned do_yp_add (ypdata_t *yp, char *s, unsigned len) static unsigned do_yp_add (ypdata_t *yp, char *s, unsigned len)
{ {
int ret = snprintf (s, len, "action=add&sn=%s&genre=%s&cpswd=%s&desc=" int ret;
"%s&url=%s&listenurl=%s&type=%s&b=%s&%s\r\n", char *value;
value = stats_get_value (yp->mount, "subtype");
if (value)
{
add_yp_info (yp, "subtype", value, YP_SUBTYPE);
free (value);
}
ret = snprintf (s, len, "action=add&sn=%s&genre=%s&cpswd=%s&desc="
"%s&url=%s&listenurl=%s&type=%s&stype=%s&b=%s&%s\r\n",
yp->server_name, yp->server_genre, yp->cluster_password, yp->server_name, yp->server_genre, yp->cluster_password,
yp->server_desc, yp->url, yp->listen_url, yp->server_desc, yp->url, yp->listen_url,
yp->server_type, yp->bitrate, yp->audio_info); yp->server_type, yp->subtype, yp->bitrate, yp->audio_info);
if (ret >= (signed)len) if (ret >= (signed)len)
return ret+1; return ret+1;
if (send_to_yp ("add", yp, s) == 0) if (send_to_yp ("add", yp, s) == 0)
...@@ -483,6 +494,7 @@ static ypdata_t *create_yp_entry (source_t *source) ...@@ -483,6 +494,7 @@ static ypdata_t *create_yp_entry (source_t *source)
yp->url = strdup (""); yp->url = strdup ("");
yp->current_song = strdup (""); yp->current_song = strdup ("");
yp->audio_info = strdup (""); yp->audio_info = strdup ("");
yp->subtype = strdup ("");
yp->process = do_yp_add; yp->process = do_yp_add;
url = malloc (len); url = malloc (len);
...@@ -747,9 +759,7 @@ static void yp_destroy_ypdata(ypdata_t *ypdata) ...@@ -747,9 +759,7 @@ static void yp_destroy_ypdata(ypdata_t *ypdata)
if (ypdata->audio_info) { if (ypdata->audio_info) {
free(ypdata->audio_info); free(ypdata->audio_info);
} }
if (ypdata->cluster_password) { free (ypdata->subtype);
free(ypdata->cluster_password);
}
free (ypdata->error_msg); free (ypdata->error_msg);
free (ypdata); free (ypdata);
} }
...@@ -847,6 +857,14 @@ static void add_yp_info (ypdata_t *yp, char *stat_name, void *info, int type) ...@@ -847,6 +857,14 @@ static void add_yp_info (ypdata_t *yp, char *stat_name, void *info, int type)
yp->cluster_password = escaped; yp->cluster_password = escaped;
} }
break; break;
case YP_SUBTYPE:
escaped = util_url_escape(info);
if (escaped)
{
free (yp->subtype);
yp->subtype = escaped;
}
break;
} }
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#define YP_SERVER_TYPE 7 #define YP_SERVER_TYPE 7
#define YP_CURRENT_SONG 8 #define YP_CURRENT_SONG 8
#define YP_CLUSTER_PASSWORD 9 #define YP_CLUSTER_PASSWORD 9
#define YP_SUBTYPE 10
struct source_tag; struct source_tag;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment