[xiph-commits] r7629 - icecast/branches/kh/icecast/src
karl at motherfish-iii.xiph.org
karl at motherfish-iii.xiph.org
Wed Aug 25 06:51:13 PDT 2004
Author: karl
Date: 2004-08-25 06:51:13 -0700 (Wed, 25 Aug 2004)
New Revision: 7629
Modified:
icecast/branches/kh/icecast/src/cfgfile.c
icecast/branches/kh/icecast/src/cfgfile.h
icecast/branches/kh/icecast/src/format_ogg.c
icecast/branches/kh/icecast/src/slave.c
icecast/branches/kh/icecast/src/source.c
icecast/branches/kh/icecast/src/source.h
icecast/branches/kh/icecast/src/stats.c
Log:
update stats handling, xsl should show mountpoints available even if clients
would fallback. Also add hidden flag to mount options to hide from xsl
Modified: icecast/branches/kh/icecast/src/cfgfile.c
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.c 2004-08-24 20:27:24 UTC (rev 7628)
+++ icecast/branches/kh/icecast/src/cfgfile.c 2004-08-25 13:51:13 UTC (rev 7629)
@@ -586,6 +586,11 @@
mount->no_yp = atoi(tmp);
if(tmp) xmlFree(tmp);
}
+ else if (strcmp(node->name, "hidden") == 0) {
+ tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+ mount->hidden = atoi(tmp);
+ if(tmp) xmlFree(tmp);
+ }
else if (strcmp(node->name, "authentication") == 0) {
mount->auth_type = xmlGetProp(node, "type");
option = node->xmlChildrenNode;
@@ -1020,4 +1025,3 @@
}
-
Modified: icecast/branches/kh/icecast/src/cfgfile.h
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.h 2004-08-24 20:27:24 UTC (rev 7628)
+++ icecast/branches/kh/icecast/src/cfgfile.h 2004-08-25 13:51:13 UTC (rev 7629)
@@ -61,6 +61,7 @@
* from global setting */
unsigned int queue_size_limit;
int no_yp; /* Do we prevent YP on this mount */
+ int hidden; /* Do we list this on the xsl pages */
unsigned int source_timeout; /* source timeout in seconds */
char *auth_type; /* Authentication type */
Modified: icecast/branches/kh/icecast/src/format_ogg.c
===================================================================
--- icecast/branches/kh/icecast/src/format_ogg.c 2004-08-24 20:27:24 UTC (rev 7628)
+++ icecast/branches/kh/icecast/src/format_ogg.c 2004-08-25 13:51:13 UTC (rev 7629)
@@ -137,6 +137,10 @@
{
vorbis_codec_t *vorbis = codec->specific;
+ stats_event (codec->feed->mount, "audio-samplerate", NULL);
+ stats_event (codec->feed->mount, "audio-channels", NULL);
+ stats_event (codec->feed->mount, "audio-bitrate", NULL);
+
codec->feed->artist = NULL;
codec->feed->title = NULL;
vorbis_info_clear (&vorbis->vi);
@@ -369,6 +373,10 @@
{
theora_codec_t *theora = codec->specific;
+ stats_event (codec->feed->mount, "video_bitrate", NULL);
+ stats_event (codec->feed->mount, "frame_size", NULL);
+ stats_event (codec->feed->mount, "framerate", NULL);
+
theora_info_clear (&theora->ti);
theora_comment_clear (&theora->tc);
ogg_stream_clear (&codec->os);
Modified: icecast/branches/kh/icecast/src/slave.c
===================================================================
--- icecast/branches/kh/icecast/src/slave.c 2004-08-24 20:27:24 UTC (rev 7628)
+++ icecast/branches/kh/icecast/src/slave.c 2004-08-25 13:51:13 UTC (rev 7629)
@@ -304,6 +304,9 @@
if (relay->on_demand)
DEBUG0 ("setting on_demand");
relay->source->on_demand = relay->on_demand;
+ /* on-demand relays can be used as fallback mounts so allow
+ * for dependant mountpoints to show up on xsl pages*/
+ source_recheck_mounts ();
}
else
WARN1 ("new relay but source \"%s\" already exists", relay->localmount);
Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c 2004-08-24 20:27:24 UTC (rev 7628)
+++ icecast/branches/kh/icecast/src/source.c 2004-08-25 13:51:13 UTC (rev 7629)
@@ -77,10 +77,6 @@
do
{
- unsigned int listen_url_size;
- char *listenurl;
- ice_config_t *config;
-
avl_tree_wlock (global.source_tree);
src = source_find_mount_raw (mount);
if (src)
@@ -103,25 +99,6 @@
avl_insert (global.source_tree, src);
- config = config_get_config();
-
- /* 6 for max size of port */
- listen_url_size = strlen("http://") + strlen(config->hostname) +
- strlen(":") + 6 + strlen(mount) + 1;
-
- listenurl = malloc (listen_url_size);
- if (listenurl)
- {
- snprintf (listenurl, listen_url_size, "http://%s:%d%s",
- config->hostname, config->port, mount);
-
- stats_event (mount, "listenurl", listenurl);
-
- free(listenurl);
- }
- config_release_config();
- stats_event (mount, "listeners", "0");
-
} while (0);
avl_tree_unlock (global.source_tree);
@@ -307,8 +284,6 @@
avl_tree_wlock (global.source_tree);
avl_delete (global.source_tree, source, NULL);
avl_tree_unlock (global.source_tree);
- stats_event (source->mount, "listeners", NULL);
- stats_event (source->mount, NULL, NULL);
/* There should be no listeners on this mount */
if (source->active_clients)
@@ -418,7 +393,6 @@
dest->check_pending = 1;
source->listeners = 0;
source->new_listeners = 0;
- stats_event (source->mount, "listeners", "0");
} while (0);
@@ -764,6 +738,7 @@
avl_tree_unlock(global.source_tree);
}
+ source_recheck_mounts();
thread_mutex_lock (&source->lock);
if (source->yp_public)
yp_add (source);
@@ -1100,7 +1075,18 @@
therefore reserved */
source_clear_source (source);
+ /* remove main source stats */
+ stats_event (source->mount, "public", NULL);
+ stats_event (source->mount, "server_description", NULL);
+ stats_event (source->mount, "server_name", NULL);
+ stats_event (source->mount, "genre", NULL);
+ stats_event (source->mount, "type", NULL);
+ stats_event (source->mount, "artist", NULL);
+ stats_event (source->mount, "title", NULL);
+ stats_event (source->mount, "audio_info", NULL);
+
thread_mutex_unlock (&source->lock);
+ source_recheck_mounts ();
global_lock();
global.sources--;
@@ -1347,3 +1333,31 @@
}
}
#endif
+
+/* rescan the mount list, so that xsl files are updated to show
+ * unconnected but active fallback mountpoints
+ */
+void source_recheck_mounts (void)
+{
+ ice_config_t *config = config_get_config();
+ mount_proxy *mount = config->mounts;
+
+ avl_tree_rlock (global.source_tree);
+
+ while (mount)
+ {
+ char *value = NULL;
+ source_t *source = source_find_mount (mount->mountname);
+ if (source && mount->hidden == 0)
+ {
+ if (source->running || source->on_demand)
+ value = "0";
+ }
+ stats_event (mount->mountname, "listeners", value);
+
+ mount = mount->next;
+ }
+ avl_tree_unlock (global.source_tree);
+ config_release_config();
+}
+
Modified: icecast/branches/kh/icecast/src/source.h
===================================================================
--- icecast/branches/kh/icecast/src/source.h 2004-08-24 20:27:24 UTC (rev 7628)
+++ icecast/branches/kh/icecast/src/source.h 2004-08-25 13:51:13 UTC (rev 7629)
@@ -102,6 +102,7 @@
void add_client (char *mount, client_t *client);
int add_authenticated_client (source_t *source, client_t *client);
int source_free_client (source_t *source, client_t *client);
+void source_recheck_mounts (void);
extern mutex_t move_clients_mutex;
Modified: icecast/branches/kh/icecast/src/stats.c
===================================================================
--- icecast/branches/kh/icecast/src/stats.c 2004-08-24 20:27:24 UTC (rev 7628)
+++ icecast/branches/kh/icecast/src/stats.c 2004-08-25 13:51:13 UTC (rev 7629)
@@ -424,18 +424,21 @@
}
}
} else {
- /* this is a new source */
- asnode = (stats_source_t *)malloc(sizeof(stats_source_t));
- asnode->source = (char *)strdup(event->source);
- asnode->stats_tree = avl_tree_new(_compare_stats, NULL);
+ if (event->value)
+ {
+ /* this is a new source */
+ asnode = (stats_source_t *)malloc(sizeof(stats_source_t));
+ asnode->source = (char *)strdup(event->source);
+ asnode->stats_tree = avl_tree_new(_compare_stats, NULL);
- anode = (stats_node_t *)malloc(sizeof(stats_node_t));
- anode->name = (char *)strdup(event->name);
- anode->value = (char *)strdup(event->value);
-
- avl_insert(asnode->stats_tree, (void *)anode);
+ anode = (stats_node_t *)malloc(sizeof(stats_node_t));
+ anode->name = (char *)strdup(event->name);
+ anode->value = (char *)strdup(event->value);
- avl_insert(_stats.source_tree, (void *)asnode);
+ avl_insert(asnode->stats_tree, (void *)anode);
+
+ avl_insert(_stats.source_tree, (void *)asnode);
+ }
}
}
More information about the commits
mailing list