1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-02-02 15:07:36 -05:00

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

svn path=/icecast/trunk/icecast/; revision=8360
This commit is contained in:
Karl Heyes 2004-12-10 00:11:16 +00:00
parent 4066a89c01
commit d077dc4b28
6 changed files with 48 additions and 6 deletions

View File

@ -242,6 +242,8 @@ static void update_comments (source_t *source)
char *artist = ogg_info->artist;
char *metadata = NULL;
unsigned int len = 0;
ogg_codec_t *codec;
char codec_names [100] = "";
if (ogg_info->artist)
{
@ -274,6 +276,23 @@ static void update_comments (source_t *source)
}
stats_event (source->mount, "artist", artist);
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);
}

View File

@ -49,6 +49,7 @@ typedef struct ogg_codec_tag
struct ogg_codec_tag *next;
ogg_stream_state os;
unsigned headers;
const char *name;
void *specific;
refbuf_t *possible_start;
refbuf_t *page;

View File

@ -177,6 +177,8 @@ ogg_codec_t *initial_theora_page (format_plugin_t *plugin, ogg_page *page)
codec->process_page = process_theora_page;
codec->codec_free = theora_codec_free;
codec->headers = 1;
codec->name = "Theora";
format_ogg_attach_header (ogg_info, page);
ogg_info->codec_sync = codec;
return codec;

View File

@ -357,6 +357,7 @@ ogg_codec_t *initial_vorbis_page (format_plugin_t *plugin, ogg_page *page)
codec->specific = vorbis;
codec->codec_free = vorbis_codec_free;
codec->headers = 1;
codec->name = "Vorbis";
free_ogg_packet (vorbis->header[0]);
free_ogg_packet (vorbis->header[1]);

View File

@ -70,6 +70,7 @@ typedef struct ypdata_tag
char *audio_info;
char *server_type;
char *current_song;
char *subtype;
struct yp_server *server;
time_t next_update;
@ -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)
{
int ret = snprintf (s, len, "action=add&sn=%s&genre=%s&cpswd=%s&desc="
"%s&url=%s&listenurl=%s&type=%s&b=%s&%s\r\n",
int ret;
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_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)
return ret+1;
if (send_to_yp ("add", yp, s) == 0)
@ -483,6 +494,7 @@ static ypdata_t *create_yp_entry (source_t *source)
yp->url = strdup ("");
yp->current_song = strdup ("");
yp->audio_info = strdup ("");
yp->subtype = strdup ("");
yp->process = do_yp_add;
url = malloc (len);
@ -747,9 +759,7 @@ static void yp_destroy_ypdata(ypdata_t *ypdata)
if (ypdata->audio_info) {
free(ypdata->audio_info);
}
if (ypdata->cluster_password) {
free(ypdata->cluster_password);
}
free (ypdata->subtype);
free (ypdata->error_msg);
free (ypdata);
}
@ -847,6 +857,14 @@ static void add_yp_info (ypdata_t *yp, char *stat_name, void *info, int type)
yp->cluster_password = escaped;
}
break;
case YP_SUBTYPE:
escaped = util_url_escape(info);
if (escaped)
{
free (yp->subtype);
yp->subtype = escaped;
}
break;
}
}

View File

@ -23,6 +23,7 @@
#define YP_SERVER_TYPE 7
#define YP_CURRENT_SONG 8
#define YP_CLUSTER_PASSWORD 9
#define YP_SUBTYPE 10
struct source_tag;