Skip to content

Commit c1477d6

Browse files
committed
[dev] merge branch 'vhost'.
2 parents 8331ae3 + 5ff91d4 commit c1477d6

File tree

7 files changed

+30
-8
lines changed

7 files changed

+30
-8
lines changed

README.CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
基于[nginx-rtmp-module](https://github.com/arut/nginx-rtmp-module)的流媒体服务器。
66

7-
[English README](https://github.com/winshining/nginx-http-flv-module/blob/master/README.md)
7+
[English README](https://github.com/winshining/nginx-http-flv-module/blob/vhost/README.md)
88

99
如果您喜欢这个模块,可以通过赞赏来支持我的工作,非常感谢!
1010

@@ -16,7 +16,7 @@
1616

1717
* Roman Arutyunyan,[nginx-rtmp-module](https://github.com/arut/nginx-rtmp-module)的作者。
1818

19-
* 贡献者,详情见[AUTHORS](https://github.com/winshining/nginx-http-flv-module/blob/master/AUTHORS)
19+
* 贡献者,详情见[AUTHORS](https://github.com/winshining/nginx-http-flv-module/blob/vhost/AUTHORS)
2020

2121
## 功能
2222

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Media streaming server based on [nginx-rtmp-module](https://github.com/arut/nginx-rtmp-module).
66

7-
[中文说明](https://github.com/winshining/nginx-http-flv-module/blob/master/README.CN.md).
7+
[中文说明](https://github.com/winshining/nginx-http-flv-module/blob/vhost/README.CN.md).
88

99
Donate if you like this module. Many thanks to you!
1010

@@ -16,7 +16,7 @@ Donate if you like this module. Many thanks to you!
1616

1717
* Roman Arutyunyan, who created [nginx-rtmp-module](https://github.com/arut/nginx-rtmp-module).
1818

19-
* Contributors, refer to [AUTHORS](https://github.com/winshining/nginx-http-flv-module/blob/master/AUTHORS) for details.
19+
* Contributors, refer to [AUTHORS](https://github.com/winshining/nginx-http-flv-module/blob/vhost/AUTHORS) for details.
2020

2121
## Features
2222

ngx_rtmp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@ ngx_rtmp_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
326326

327327
*cf = pcf;
328328

329+
cscfp = cmcf->servers.elts;
330+
for (s = 0; s < cmcf->servers.nelts; s++) {
331+
cscfp[s]->index = s;
332+
}
333+
329334
if (ngx_rtmp_init_event_handlers(cf, cmcf) != NGX_OK) {
330335
return NGX_CONF_ERROR;
331336
}

ngx_rtmp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ struct ngx_rtmp_core_srv_conf_s {
464464

465465
ngx_array_t applications; /* ngx_rtmp_core_app_conf_t */
466466

467+
ngx_uint_t index; /* index in server array */
468+
467469
ngx_msec_t timeout;
468470
ngx_msec_t ping;
469471
ngx_msec_t ping_timeout;
@@ -496,6 +498,8 @@ struct ngx_rtmp_core_srv_conf_s {
496498
#if (NGX_PCRE)
497499
unsigned captures:1;
498500
#endif
501+
502+
in_port_t port;
499503
};
500504

501505

ngx_rtmp_core_module.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,8 @@ ngx_rtmp_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
629629
if (ngx_rtmp_add_listen(cf, cscf, &lsopt) != NGX_OK) {
630630
return NGX_CONF_ERROR;
631631
}
632+
633+
cscf->port = 1935;
632634
}
633635

634636
return rv;
@@ -1382,6 +1384,8 @@ ngx_rtmp_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
13821384
return NGX_CONF_ERROR;
13831385
}
13841386

1387+
cscf->port = u.port;
1388+
13851389
if (ngx_rtmp_add_listen(cf, cscf, &lsopt) == NGX_OK) {
13861390
return NGX_CONF_OK;
13871391
}

ngx_rtmp_stat_module.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,14 +1003,23 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
10031003

10041004
static void
10051005
ngx_rtmp_stat_application(ngx_http_request_t *r, ngx_chain_t ***lll,
1006-
ngx_rtmp_core_app_conf_t *cacf)
1006+
ngx_rtmp_core_srv_conf_t *cscf, ngx_rtmp_core_app_conf_t *cacf)
10071007
{
1008+
u_char buf[NGX_INT_T_LEN];
10081009
ngx_rtmp_stat_loc_conf_t *slcf;
10091010

10101011
slcf = ngx_http_get_module_loc_conf(r, ngx_rtmp_stat_module);
10111012

10121013
if (slcf->format & NGX_RTMP_STAT_FORMAT_XML) {
10131014
NGX_RTMP_STAT_L("<application>\r\n");
1015+
NGX_RTMP_STAT_L("<port>");
1016+
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
1017+
"%ui", cscf->port) - buf);
1018+
NGX_RTMP_STAT_L("</port>\r\n");
1019+
NGX_RTMP_STAT_L("<server_index>");
1020+
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
1021+
"%ui", cscf->index) - buf);
1022+
NGX_RTMP_STAT_L("</server_index>\r\n");
10141023
NGX_RTMP_STAT_L("<name>");
10151024
NGX_RTMP_STAT_ES(&cacf->name);
10161025
NGX_RTMP_STAT_L("</name>\r\n");
@@ -1070,7 +1079,7 @@ ngx_rtmp_stat_server(ngx_http_request_t *r, ngx_chain_t ***lll,
10701079

10711080
cacf = cscf->applications.elts;
10721081
for (n = 0; n < cscf->applications.nelts; ++n, ++cacf) {
1073-
ngx_rtmp_stat_application(r, lll, *cacf);
1082+
ngx_rtmp_stat_application(r, lll, cscf, *cacf);
10741083

10751084
if (slcf->format & NGX_RTMP_STAT_FORMAT_JSON &&
10761085
n < cscf->applications.nelts - 1)

stat.xsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
<td>
136136
<a href="">
137137
<xsl:attribute name="onclick">
138-
var d=document.getElementById('<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>');
138+
var d=document.getElementById('<xsl:value-of select="../../port"/>-<xsl:value-of select="../../server_index"/>-<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>');
139139
d.style.display=d.style.display=='none'?'':'none';
140140
return false
141141
</xsl:attribute>
@@ -211,7 +211,7 @@
211211
</tr>
212212
<tr style="display:none">
213213
<xsl:attribute name="id">
214-
<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>
214+
<xsl:value-of select="../../port"/>-<xsl:value-of select="../../server_index"/>-<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>
215215
</xsl:attribute>
216216
<td colspan="16" ngcolor="#eeeeee">
217217
<table cellspacing="1" cellpadding="5">

0 commit comments

Comments
 (0)