[xiph-commits] r8360 - icecast/trunk/icecast/src
karl at motherfish-iii.xiph.org
karl at motherfish-iii.xiph.org
Thu Dec 9 16:11:17 PST 2004
Author: karl
Date: 2004-12-09 16:11:16 -0800 (Thu, 09 Dec 2004)
New Revision: 8360
Modified:
icecast/trunk/icecast/src/format_ogg.c
icecast/trunk/icecast/src/format_ogg.h
icecast/trunk/icecast/src/format_theora.c
icecast/trunk/icecast/src/format_vorbis.c
icecast/trunk/icecast/src/yp.c
icecast/trunk/icecast/src/yp.h
Log:
add subtype to yp add phase, this is to identify the codecs in use
Modified: icecast/trunk/icecast/src/format_ogg.c
===================================================================
--- icecast/trunk/icecast/src/format_ogg.c 2004-12-09 19:03:20 UTC (rev 8359)
+++ icecast/trunk/icecast/src/format_ogg.c 2004-12-10 00:11:16 UTC (rev 8360)
@@ -242,6 +242,8 @@
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 @@
}
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);
}
Modified: icecast/trunk/icecast/src/format_ogg.h
===================================================================
--- icecast/trunk/icecast/src/format_ogg.h 2004-12-09 19:03:20 UTC (rev 8359)
+++ icecast/trunk/icecast/src/format_ogg.h 2004-12-10 00:11:16 UTC (rev 8360)
@@ -49,6 +49,7 @@
struct ogg_codec_tag *next;
ogg_stream_state os;
unsigned headers;
+ const char *name;
void *specific;
refbuf_t *possible_start;
refbuf_t *page;
Modified: icecast/trunk/icecast/src/format_theora.c
===================================================================
--- icecast/trunk/icecast/src/format_theora.c 2004-12-09 19:03:20 UTC (rev 8359)
+++ icecast/trunk/icecast/src/format_theora.c 2004-12-10 00:11:16 UTC (rev 8360)
@@ -177,6 +177,8 @@
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;
Modified: icecast/trunk/icecast/src/format_vorbis.c
===================================================================
--- icecast/trunk/icecast/src/format_vorbis.c 2004-12-09 19:03:20 UTC (rev 8359)
+++ icecast/trunk/icecast/src/format_vorbis.c 2004-12-10 00:11:16 UTC (rev 8360)
@@ -357,6 +357,7 @@
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]);
Modified: icecast/trunk/icecast/src/yp.c
===================================================================
--- icecast/trunk/icecast/src/yp.c 2004-12-09 19:03:20 UTC (rev 8359)
+++ icecast/trunk/icecast/src/yp.c 2004-12-10 00:11:16 UTC (rev 8360)
@@ -70,6 +70,7 @@
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_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 @@
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 @@
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 @@
yp->cluster_password = escaped;
}
break;
+ case YP_SUBTYPE:
+ escaped = util_url_escape(info);
+ if (escaped)
+ {
+ free (yp->subtype);
+ yp->subtype = escaped;
+ }
+ break;
}
}
Modified: icecast/trunk/icecast/src/yp.h
===================================================================
--- icecast/trunk/icecast/src/yp.h 2004-12-09 19:03:20 UTC (rev 8359)
+++ icecast/trunk/icecast/src/yp.h 2004-12-10 00:11:16 UTC (rev 8360)
@@ -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;
More information about the commits
mailing list