mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-15 16:31:07 +02:00
added activity flag to xml; updated xsl to display it; improved live sync handler to have default value and to receive off
This commit is contained in:
parent
3192d657f1
commit
a46983c2a2
|
@ -16,7 +16,9 @@ static ngx_rtmp_close_stream_pt next_close_stream;
|
|||
static ngx_int_t ngx_rtmp_live_postconfiguration(ngx_conf_t *cf);
|
||||
static void * ngx_rtmp_live_create_app_conf(ngx_conf_t *cf);
|
||||
static char * ngx_rtmp_live_merge_app_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
void *parent, void *child);
|
||||
static char *ngx_rtmp_live_sync(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
void *conf);
|
||||
|
||||
|
||||
#define NGX_RTMP_LIVE_TIME_ABSOLUTE 0x01
|
||||
|
@ -55,7 +57,7 @@ static ngx_command_t ngx_rtmp_live_commands[] = {
|
|||
|
||||
{ ngx_string("sync"),
|
||||
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
|
||||
ngx_conf_set_msec_slot,
|
||||
ngx_rtmp_live_sync,
|
||||
NGX_RTMP_APP_CONF_OFFSET,
|
||||
offsetof(ngx_rtmp_live_app_conf_t, sync),
|
||||
NULL },
|
||||
|
@ -154,7 +156,7 @@ ngx_rtmp_live_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
ngx_conf_merge_value(conf->meta, prev->meta, 1);
|
||||
ngx_conf_merge_value(conf->nbuckets, prev->nbuckets, 1024);
|
||||
ngx_conf_merge_msec_value(conf->buflen, prev->buflen, 0);
|
||||
ngx_conf_merge_msec_value(conf->sync, prev->sync, 0);
|
||||
ngx_conf_merge_msec_value(conf->sync, prev->sync, 300);
|
||||
ngx_conf_merge_value(conf->interleave, prev->interleave, 0);
|
||||
ngx_conf_merge_value(conf->wait_key, prev->wait_key, 0);
|
||||
ngx_conf_merge_value(conf->publish_notify, prev->publish_notify, 0);
|
||||
|
@ -172,6 +174,25 @@ ngx_rtmp_live_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
}
|
||||
|
||||
|
||||
static char *
|
||||
ngx_rtmp_live_sync(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_rtmp_live_app_conf_t *lacf = conf;
|
||||
ngx_str_t *value;
|
||||
|
||||
value = cf->args->elts;
|
||||
|
||||
if (value->len == sizeof("off") - 1 &&
|
||||
ngx_strncasecmp(value->data, (u_char *) "off", value->len))
|
||||
{
|
||||
lacf->sync = 0;
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
||||
return ngx_conf_set_msec_slot(cf, cmd, conf);
|
||||
}
|
||||
|
||||
|
||||
static ngx_rtmp_live_stream_t **
|
||||
ngx_rtmp_live_get_stream(ngx_rtmp_session_t *s, u_char *name, int create)
|
||||
{
|
||||
|
|
|
@ -258,7 +258,6 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
|
|||
ngx_rtmp_session_t *s;
|
||||
ngx_int_t n;
|
||||
size_t nclients, total_nclients;
|
||||
ngx_int_t publishing;
|
||||
u_char buf[NGX_OFF_T_LEN + 1];
|
||||
ngx_rtmp_stat_loc_conf_t *slcf;
|
||||
u_char *cname;
|
||||
|
@ -270,7 +269,6 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
|
|||
total_nclients = 0;
|
||||
for (n = 0; n < lacf->nbuckets; ++n) {
|
||||
for (stream = lacf->streams[n]; stream; stream = stream->next) {
|
||||
publishing = 0;
|
||||
NGX_RTMP_STAT_L("<stream>\r\n");
|
||||
|
||||
NGX_RTMP_STAT_L("<name>");
|
||||
|
@ -346,7 +344,6 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
|
|||
NGX_RTMP_STAT_L("</client>\r\n");
|
||||
}
|
||||
if (ctx->publishing) {
|
||||
publishing = 1;
|
||||
codec = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
|
||||
}
|
||||
}
|
||||
|
@ -393,10 +390,14 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
|
|||
"%uz", nclients) - buf);
|
||||
NGX_RTMP_STAT_L("</nclients>\r\n");
|
||||
|
||||
if (publishing) {
|
||||
if (stream->publishing) {
|
||||
NGX_RTMP_STAT_L("<publishing/>\r\n");
|
||||
}
|
||||
|
||||
if (stream->active) {
|
||||
NGX_RTMP_STAT_L("<active/>\r\n");
|
||||
}
|
||||
|
||||
NGX_RTMP_STAT_L("</stream>\r\n");
|
||||
}
|
||||
}
|
||||
|
|
32
stat.xsl
32
stat.xsl
|
@ -105,7 +105,7 @@
|
|||
<xsl:apply-templates select="meta/level"/>
|
||||
</td>
|
||||
<td><xsl:value-of select="meta/audio"/></td>
|
||||
<td> <xsl:apply-templates select="publishing"/> </td>
|
||||
<td><xsl:call-template name="streamstate"/></td>
|
||||
<td>
|
||||
<xsl:call-template name="showtime">
|
||||
<xsl:with-param name="time" select="time"/>
|
||||
|
@ -157,9 +157,31 @@
|
|||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="streamstate">
|
||||
<xsl:choose>
|
||||
<xsl:when test="active">active</xsl:when>
|
||||
<xsl:otherwise>idle</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="clientstate">
|
||||
<xsl:choose>
|
||||
<xsl:when test="publishing">publishing</xsl:when>
|
||||
<xsl:otherwise>playing</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="client">
|
||||
<tr bgcolor="#eeeeee">
|
||||
<td><xsl:apply-templates select="publishing"/></td>
|
||||
<tr>
|
||||
<xsl:attribute name="bgcolor">
|
||||
<xsl:choose>
|
||||
<xsl:when test="publishing">#cccccc</xsl:when>
|
||||
<xsl:otherwise>#eeeeee</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<td><xsl:call-template name="clientstate"/></td>
|
||||
<td><xsl:value-of select="address"/></td>
|
||||
<td><xsl:value-of select="flashver"/></td>
|
||||
<td>
|
||||
|
@ -185,6 +207,10 @@
|
|||
publishing
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="active">
|
||||
active
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="profile">
|
||||
/ <xsl:value-of select="."/>
|
||||
</xsl:template>
|
||||
|
|
Loading…
Reference in a new issue