mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-03 05:33:56 +08:00
update 2026-05-10 09:48:30
This commit is contained in:
1 parent
95ac96413e
commit
0b362674f1
6244 files changed
+2992248
No files matched your search
@@ -0,0 +1,11 @@
|
||||
|
||||
config global
|
||||
option enable '0'
|
||||
option ipv6 '0'
|
||||
option https '0'
|
||||
option ts_record '0'
|
||||
option flv_record '0'
|
||||
option http_port '18080'
|
||||
option rtmp_port '1935'
|
||||
option hls '1'
|
||||
option hls2 '1'
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2020 Lienol <lawlienol@gmail.com>
|
||||
|
||||
START=99
|
||||
|
||||
CONFIG="pingos"
|
||||
|
||||
TEMP_PATH="/var/etc/$CONFIG"
|
||||
NGINX_CONFIG="$TEMP_PATH/nginx.conf"
|
||||
|
||||
config_t_get() {
|
||||
local index=0
|
||||
[ -n "$4" ] && index=$4
|
||||
local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
gen_nginx_config() {
|
||||
ipv6=$(config_t_get global ipv6 0)
|
||||
http_port=$(config_t_get global http_port)
|
||||
[ "$(config_t_get global https 0)" == "1" ] && {
|
||||
http_port="$http_port ssl"
|
||||
ssl_certificate="ssl_certificate $(config_t_get global certificate);"
|
||||
ssl_certificate_key="ssl_certificate_key $(config_t_get global key);"
|
||||
}
|
||||
rtmp_port=$(config_t_get global rtmp_port)
|
||||
hls=$(config_t_get global hls 0)
|
||||
[ $hls == 1 ] && hls=on || hls=off
|
||||
hls2=$(config_t_get global hls2 0)
|
||||
[ $hls2 == 1 ] && hls2=on || hls2=off
|
||||
ts_record=$(config_t_get global ts_record 0)
|
||||
[ $ts_record == 1 ] && ts_record=on || ts_record=off
|
||||
flv_record=$(config_t_get global flv_record 0)
|
||||
[ $flv_record == 1 ] && flv_record=all || flv_record=off
|
||||
record_path=$(config_t_get global record_path "$TEMP_PATH/record")
|
||||
|
||||
sed -e "s#|TMP_PATH|#$TEMP_PATH#g" \
|
||||
-e "s#|HTTP_PORT|#$http_port#g" \
|
||||
-e "s#|ssl_certificate|#$ssl_certificate#g" \
|
||||
-e "s#|ssl_certificate_key|#$ssl_certificate_key#g" \
|
||||
-e "s#|RTMP_PORT|#$rtmp_port#g" \
|
||||
-e "s#|HLS|#$hls#g" \
|
||||
-e "s#|HLS2|#$hls2#g" \
|
||||
-e "s#|TS_RECORD|#$ts_record#g" \
|
||||
-e "s#|FLV_RECORD|#$flv_record#g" \
|
||||
-e "s#|RECORD_PATH|#$record_path#g" \
|
||||
/etc/$CONFIG.template > $1
|
||||
|
||||
[ "$ipv6" = "0" ] && sed -i '/listen \[::\]:/d' $1
|
||||
}
|
||||
|
||||
start() {
|
||||
ENABLED=$(config_t_get global enable 0)
|
||||
[ "$ENABLED" = "0" ] && return 0
|
||||
mkdir -p $TEMP_PATH $TEMP_PATH/lib
|
||||
gen_nginx_config $NGINX_CONFIG
|
||||
/usr/sbin/pingos -c $NGINX_CONFIG >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/sbin/pingos -c $NGINX_CONFIG -s stop >/dev/null 2>&1
|
||||
rm -rf $TEMP_PATH
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
user root;
|
||||
daemon on;
|
||||
master_process on;
|
||||
worker_processes 1;
|
||||
#worker_rlimit 4g;
|
||||
|
||||
#error_log |TMP_PATH|/error.log;
|
||||
#error_log |TMP_PATH|/error.log notice;
|
||||
error_log |TMP_PATH|/error.log info;
|
||||
|
||||
worker_rlimit_nofile 102400;
|
||||
worker_rlimit_core 2G;
|
||||
working_directory |TMP_PATH|;
|
||||
|
||||
pid |TMP_PATH|/pingos.pid;
|
||||
|
||||
events {
|
||||
use epoll;
|
||||
worker_connections 4096;
|
||||
multi_listen unix:|TMP_PATH|/http |HTTP_PORT|;
|
||||
multi_listen unix:|TMP_PATH|/rtmp |RTMP_PORT|;
|
||||
|
||||
dynamic_refresh_interval 5s;
|
||||
dynamic_domain_buckets 1001;
|
||||
resolver 114.114.114.114 valid=1m;
|
||||
resolver_timeout 30s;
|
||||
}
|
||||
|
||||
#stream_zone buckets=1024 streams=4096;
|
||||
|
||||
#dynamic_conf conf/nginx_dynamic.conf 10;
|
||||
#dynamic_log |TMP_PATH|/dynamic.log info;
|
||||
|
||||
rtmp {
|
||||
log_format log_bandwidth '{"app":"$app","name":"$name","bitrate":$bitrate,"args":"$args","timestamp":$ntp,"ts":"$time_local","type":"$command","remote_addr":"$remote_addr","domain":"$domain"}';
|
||||
access_log |TMP_PATH|/bandwidth.log log_bandwidth trunc=60s;
|
||||
|
||||
server {
|
||||
listen |RTMP_PORT|;
|
||||
listen [::]:|RTMP_PORT| ipv6only=on;
|
||||
serverid 000;
|
||||
out_queue 2048;
|
||||
server_name localhost;
|
||||
rtmp_auto_pull on;
|
||||
rtmp_auto_pull_port unix:|TMP_PATH|/rtmp;
|
||||
|
||||
application push {
|
||||
live on;
|
||||
push rtmp://127.0.0.1:|RTMP_PORT|/live app=live;
|
||||
}
|
||||
|
||||
application live {
|
||||
live_record |TS_RECORD|;
|
||||
live_record_path |RECORD_PATH|;
|
||||
|
||||
recorder r1{
|
||||
record |FLV_RECORD|;
|
||||
record_path |RECORD_PATH|;
|
||||
}
|
||||
|
||||
live on;
|
||||
hls |HLS|;
|
||||
hls_path |TMP_PATH|/hls;
|
||||
hls_fragment 4000ms;
|
||||
#hls_max_fragment 10000ms;
|
||||
hls_playlist_length 12000ms;
|
||||
hls_type live;
|
||||
|
||||
hls2 |HLS2|;
|
||||
mpegts_cache_time 20s;
|
||||
|
||||
hls2_fragment 2000ms;
|
||||
hls2_max_fragment 3000ms;
|
||||
hls2_playlist_length 6000ms;
|
||||
|
||||
wait_key on;
|
||||
wait_video on;
|
||||
cache_time 1s;
|
||||
send_all on;
|
||||
low_latency off;
|
||||
fix_timestamp 2s;
|
||||
# h265 codecid, default 12
|
||||
hevc_codecid 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
http {
|
||||
include /usr/share/pingos/conf/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_X-Forwarded-For" "$http_X-Real-IP" "$host"';
|
||||
|
||||
|
||||
access_log |TMP_PATH|/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 65;
|
||||
|
||||
#reset_server_name www.test1.com www.test2.com;
|
||||
#gzip on;
|
||||
|
||||
upstream hlsm {
|
||||
#hash $remote_addr consistent;
|
||||
hash $arg_session consistent;
|
||||
# 这里需要注意,你要开几个进程,就要按这个规则写几条记录
|
||||
server unix:|TMP_PATH|/http.0;
|
||||
#server unix:|TMP_PATH|/http.1;
|
||||
}
|
||||
|
||||
server {
|
||||
listen |HTTP_PORT|;
|
||||
listen [::]:|HTTP_PORT|;
|
||||
|ssl_certificate|
|
||||
|ssl_certificate_key|
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
ssl_session_timeout 5m;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
location /rtmp_stat {
|
||||
rtmp_stat all;
|
||||
rtmp_stat_stylesheet /stat.xsl;
|
||||
}
|
||||
|
||||
location /xstat {
|
||||
rtmp_stat all;
|
||||
}
|
||||
|
||||
location /sys_stat {
|
||||
sys_stat;
|
||||
}
|
||||
location ~ .mp4$ {
|
||||
root /usr/share/pingos/html;
|
||||
#mp4;
|
||||
}
|
||||
|
||||
location /control {
|
||||
rtmp_control all;
|
||||
}
|
||||
location /flv {
|
||||
flv_live |RTMP_PORT| app=live;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header "Access-Control-Allow-Credentials" "true";
|
||||
add_header "Access-Control-Allow-Methods" "*";
|
||||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
|
||||
add_header "Access-Control-Expose-Headers" "*";
|
||||
}
|
||||
location /ts {
|
||||
ts_live |RTMP_PORT| app=live;
|
||||
expires -1;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header "Access-Control-Allow-Credentials" "true";
|
||||
add_header "Access-Control-Allow-Methods" "*";
|
||||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
|
||||
add_header "Access-Control-Expose-Headers" "*";
|
||||
}
|
||||
location /hls {
|
||||
# Serve HLS fragments
|
||||
types {
|
||||
application/vnd.apple.mpegurl m3u8;
|
||||
video/mp2t ts;
|
||||
}
|
||||
root |TMP_PATH|;
|
||||
expires -1;
|
||||
add_header Cache-Control no-cache;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header "Access-Control-Allow-Credentials" "true";
|
||||
add_header "Access-Control-Allow-Methods" "*";
|
||||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
|
||||
add_header "Access-Control-Expose-Headers" "*";
|
||||
}
|
||||
|
||||
location /hlsm {
|
||||
hls2_live |RTMP_PORT| app=live;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header Cache-Control no-cache;
|
||||
add_header "Access-Control-Allow-Credentials" "true";
|
||||
add_header "Access-Control-Allow-Methods" "*";
|
||||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
|
||||
add_header "Access-Control-Expose-Headers" "*";
|
||||
}
|
||||
|
||||
location /hls2 {
|
||||
proxy_buffering on;
|
||||
proxy_buffer_size 4k;
|
||||
proxy_buffers 8 1M;
|
||||
proxy_busy_buffers_size 2M;
|
||||
proxy_max_temp_file_size 0;
|
||||
set $hls_args location=/hls2&scheme=$scheme;
|
||||
#if ($args) {
|
||||
# set $hls_args $args&location=/hls2&scheme=$scheme;
|
||||
#}
|
||||
proxy_set_header Host $host:$server_port;
|
||||
rewrite ^/(.*)/(.*)\.(.*)$ /hlsm/$2.$3?$hls_args break;
|
||||
proxy_pass http://hlsm;
|
||||
}
|
||||
|
||||
location / {
|
||||
chunked_transfer_encoding on;
|
||||
root /usr/share/pingos/html/;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@pingos[-1]
|
||||
add ucitrack pingos
|
||||
set ucitrack.@pingos[-1].init=pingos
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -rf /tmp/luci-*cache
|
||||
exit 0
|
||||
@@ -0,0 +1,206 @@
|
||||
user root;
|
||||
daemon on;
|
||||
master_process on;
|
||||
worker_processes 1;
|
||||
#worker_rlimit 4g;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
error_log logs/error.log info;
|
||||
|
||||
worker_rlimit_nofile 102400;
|
||||
worker_rlimit_core 2G;
|
||||
working_directory /tmp;
|
||||
|
||||
pid logs/nginx.pid;
|
||||
|
||||
events {
|
||||
use epoll;
|
||||
worker_connections 4096;
|
||||
multi_listen unix:/tmp/http 8080;
|
||||
multi_listen unix:/tmp/rtmp 1935;
|
||||
|
||||
dynamic_refresh_interval 5s;
|
||||
dynamic_domain_buckets 1001;
|
||||
resolver 114.114.114.114 valid=1m;
|
||||
resolver_timeout 30s;
|
||||
}
|
||||
|
||||
#stream_zone buckets=1024 streams=4096;
|
||||
|
||||
#dynamic_conf conf/nginx_dynamic.conf 10;
|
||||
#dynamic_log logs/dynamic.log info;
|
||||
|
||||
|
||||
rtmp {
|
||||
log_format log_bandwidth '{"app":"$app","name":"$name","bitrate":$bitrate,"args":"$args","timestamp":$ntp,"ts":"$time_local","type":"$command","remote_addr":"$remote_addr","domain":"$domain"}';
|
||||
access_log logs/bandwidth.log log_bandwidth trunc=60s;
|
||||
|
||||
server {
|
||||
listen 1935;
|
||||
serverid 000;
|
||||
out_queue 2048;
|
||||
server_name live.pingos.io;
|
||||
rtmp_auto_pull on;
|
||||
rtmp_auto_pull_port unix:/tmp/rtmp;
|
||||
|
||||
application push {
|
||||
live on;
|
||||
push rtmp://127.0.0.1/live app=live;
|
||||
}
|
||||
|
||||
application live {
|
||||
live_record on;
|
||||
live_record_path /data/record;
|
||||
|
||||
recorder r1{
|
||||
record all;
|
||||
record_path /data/record;
|
||||
}
|
||||
|
||||
live on;
|
||||
hls on;
|
||||
hls_path /tmp/hls;
|
||||
hls_fragment 4000ms;
|
||||
#hls_max_fragment 10000ms;
|
||||
hls_playlist_length 12000ms;
|
||||
hls_type live;
|
||||
|
||||
hls2 on;
|
||||
mpegts_cache_time 20s;
|
||||
|
||||
hls2_fragment 2000ms;
|
||||
hls2_max_fragment 3000ms;
|
||||
hls2_playlist_length 6000ms;
|
||||
|
||||
wait_key on;
|
||||
wait_video on;
|
||||
cache_time 1s;
|
||||
send_all on;
|
||||
low_latency off;
|
||||
fix_timestamp 2s;
|
||||
# h265 codecid, default 12
|
||||
hevc_codecid 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_X-Forwarded-For" "$http_X-Real-IP" "$host"';
|
||||
|
||||
|
||||
access_log logs/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 65;
|
||||
|
||||
#reset_server_name www.test1.com www.test2.com;
|
||||
#gzip on;
|
||||
|
||||
upstream hlsm {
|
||||
# hash $remote_addr consistent;
|
||||
hash $arg_session consistent;
|
||||
# 这里需要注意,你要开几个进程,就要按这个规则写几条记录
|
||||
server unix:/tmp/http.0;
|
||||
# server unix:/tmp/http.1;
|
||||
# server unix:/tmp/http.2;
|
||||
# server unix:/tmp/http.3;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
# listen 443 ssl;
|
||||
# ssl_certificate /usr/local/pingos/cert/full_chain.pem;
|
||||
# ssl_certificate_key /usr/local/pingos/cert/privkey.pem;
|
||||
location /rtmp_stat {
|
||||
rtmp_stat all;
|
||||
rtmp_stat_stylesheet /stat.xsl;
|
||||
}
|
||||
|
||||
location /xstat {
|
||||
rtmp_stat all;
|
||||
}
|
||||
|
||||
location /sys_stat {
|
||||
sys_stat;
|
||||
}
|
||||
location ~ .mp4$ {
|
||||
root html;
|
||||
#mp4;
|
||||
}
|
||||
|
||||
location /control {
|
||||
rtmp_control all;
|
||||
}
|
||||
location /flv {
|
||||
flv_live 1935 app=live;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header "Access-Control-Allow-Credentials" "true";
|
||||
add_header "Access-Control-Allow-Methods" "*";
|
||||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
|
||||
add_header "Access-Control-Expose-Headers" "*";
|
||||
}
|
||||
location /ts {
|
||||
ts_live 1935 app=live;
|
||||
expires -1;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header "Access-Control-Allow-Credentials" "true";
|
||||
add_header "Access-Control-Allow-Methods" "*";
|
||||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
|
||||
add_header "Access-Control-Expose-Headers" "*";
|
||||
}
|
||||
location /hls {
|
||||
# Serve HLS fragments
|
||||
types {
|
||||
application/vnd.apple.mpegurl m3u8;
|
||||
video/mp2t ts;
|
||||
}
|
||||
root /tmp;
|
||||
expires -1;
|
||||
add_header Cache-Control no-cache;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header "Access-Control-Allow-Credentials" "true";
|
||||
add_header "Access-Control-Allow-Methods" "*";
|
||||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
|
||||
add_header "Access-Control-Expose-Headers" "*";
|
||||
}
|
||||
|
||||
location /hlsm {
|
||||
hls2_live 1935 app=live;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header Cache-Control no-cache;
|
||||
add_header "Access-Control-Allow-Credentials" "true";
|
||||
add_header "Access-Control-Allow-Methods" "*";
|
||||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
|
||||
add_header "Access-Control-Expose-Headers" "*";
|
||||
}
|
||||
|
||||
location /hls2 {
|
||||
proxy_buffering on;
|
||||
proxy_buffer_size 4k;
|
||||
proxy_buffers 8 1M;
|
||||
proxy_busy_buffers_size 2M;
|
||||
proxy_max_temp_file_size 0;
|
||||
set $hls_args location=/hls2&scheme=$scheme;
|
||||
# if ($args) {
|
||||
# set $hls_args $args&location=/hls2&scheme=$scheme;
|
||||
# }
|
||||
proxy_set_header Host $host:$server_port;
|
||||
rewrite ^/(.*)/(.*)\.(.*)$ /hlsm/$2.$3?$hls_args break;
|
||||
proxy_pass http://hlsm;
|
||||
}
|
||||
|
||||
location / {
|
||||
chunked_transfer_encoding on;
|
||||
root html/;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<cross-domain-policy>
|
||||
<allow-access-from domain="*"/>
|
||||
</cross-domain-policy>
|
||||
@@ -0,0 +1,355 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
|
||||
<!--
|
||||
Copyright (C) Roman Arutyunyan
|
||||
-->
|
||||
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<title>RTMP statistics</title>
|
||||
</head>
|
||||
<body>
|
||||
<xsl:apply-templates select="rtmp"/>
|
||||
<hr/>
|
||||
Generated by <a href='https://github.com/im-pingo/pingos'>
|
||||
PingOS</a> <xsl:value-of select="/rtmp/nginx_rtmp_version"/>,
|
||||
<a href="http://nginx.org">nginx</a> <xsl:value-of select="/rtmp/nginx_version"/>,
|
||||
pid <xsl:value-of select="/rtmp/pid"/>,
|
||||
built <xsl:value-of select="/rtmp/built"/> <xsl:value-of select="/rtmp/compiler"/>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="rtmp">
|
||||
<table cellspacing="1" cellpadding="5">
|
||||
<tr bgcolor="#999999">
|
||||
<th>RTMP</th>
|
||||
<th>#clients</th>
|
||||
<th colspan="4">Video</th>
|
||||
<th colspan="4">Audio</th>
|
||||
<th>In bytes</th>
|
||||
<th>Out bytes</th>
|
||||
<th>In bits/s</th>
|
||||
<th>Out bits/s</th>
|
||||
<th>State</th>
|
||||
<th>Time</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">Accepted: <xsl:value-of select="naccepted"/></td>
|
||||
<th bgcolor="#999999">codec</th>
|
||||
<th bgcolor="#999999">bits/s</th>
|
||||
<th bgcolor="#999999">size</th>
|
||||
<th bgcolor="#999999">fps</th>
|
||||
<th bgcolor="#999999">codec</th>
|
||||
<th bgcolor="#999999">bits/s</th>
|
||||
<th bgcolor="#999999">freq</th>
|
||||
<th bgcolor="#999999">chan</th>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bytes_in"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bytes_out"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bw_in"/>
|
||||
<xsl:with-param name="bits" select="1"/>
|
||||
<xsl:with-param name="persec" select="1"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bw_out"/>
|
||||
<xsl:with-param name="bits" select="1"/>
|
||||
<xsl:with-param name="persec" select="1"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td/>
|
||||
<td>
|
||||
<xsl:call-template name="showtime">
|
||||
<xsl:with-param name="time" select="/rtmp/uptime * 1000"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates select="server"/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="server">
|
||||
<xsl:apply-templates select="live"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="application">
|
||||
<tr bgcolor="#999999">
|
||||
<td>
|
||||
<b><xsl:value-of select="name"/></b>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates select="live"/>
|
||||
<xsl:apply-templates select="play"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="live">
|
||||
<tr bgcolor="#aaaaaa">
|
||||
<td>
|
||||
<i>live streams</i>
|
||||
</td>
|
||||
<td align="middle">
|
||||
<xsl:value-of select="nclients"/>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates select="stream"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="play">
|
||||
<tr bgcolor="#aaaaaa">
|
||||
<td>
|
||||
<i>vod streams</i>
|
||||
</td>
|
||||
<td align="middle">
|
||||
<xsl:value-of select="nclients"/>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates select="stream"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="stream">
|
||||
<tr valign="top">
|
||||
<xsl:attribute name="bgcolor">
|
||||
<xsl:choose>
|
||||
<xsl:when test="active">#cccccc</xsl:when>
|
||||
<xsl:otherwise>#dddddd</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<td>
|
||||
<a href="">
|
||||
<xsl:attribute name="onclick">
|
||||
var d=document.getElementById('<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>');
|
||||
d.style.display=d.style.display=='none'?'':'none';
|
||||
return false
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="name"/>
|
||||
<xsl:if test="string-length(name) = 0">
|
||||
[EMPTY]
|
||||
</xsl:if>
|
||||
</a>
|
||||
</td>
|
||||
<td align="middle"> <xsl:value-of select="nclients"/> </td>
|
||||
<td>
|
||||
<xsl:value-of select="meta/video/codec"/> <xsl:value-of select="meta/video/profile"/> <xsl:value-of select="meta/video/level"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bw_video"/>
|
||||
<xsl:with-param name="bits" select="1"/>
|
||||
<xsl:with-param name="persec" select="1"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:apply-templates select="meta/video/width"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="meta/video/frame_rate"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="meta/audio/codec"/> <xsl:value-of select="meta/audio/profile"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bw_audio"/>
|
||||
<xsl:with-param name="bits" select="1"/>
|
||||
<xsl:with-param name="persec" select="1"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:apply-templates select="meta/audio/sample_rate"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="meta/audio/channels"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bytes_in"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bytes_out"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bw_in"/>
|
||||
<xsl:with-param name="bits" select="1"/>
|
||||
<xsl:with-param name="persec" select="1"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:call-template name="showsize">
|
||||
<xsl:with-param name="size" select="bw_out"/>
|
||||
<xsl:with-param name="bits" select="1"/>
|
||||
<xsl:with-param name="persec" select="1"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
<td><xsl:call-template name="streamstate"/></td>
|
||||
<td>
|
||||
<xsl:call-template name="showtime">
|
||||
<xsl:with-param name="time" select="time"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="display:none">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>
|
||||
</xsl:attribute>
|
||||
<td colspan="16" ngcolor="#eeeeee">
|
||||
<table cellspacing="1" cellpadding="5">
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>State</th>
|
||||
<th>Address</th>
|
||||
<th>Flash version</th>
|
||||
<th>Page URL</th>
|
||||
<th>SWF URL</th>
|
||||
<th>Dropped</th>
|
||||
<th>Timestamp</th>
|
||||
<th>A-V</th>
|
||||
<th>Time</th>
|
||||
</tr>
|
||||
<xsl:apply-templates select="client"/>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="showtime">
|
||||
<xsl:param name="time"/>
|
||||
|
||||
<xsl:if test="$time > 0">
|
||||
<xsl:variable name="sec">
|
||||
<xsl:value-of select="floor($time div 1000)"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:if test="$sec >= 86400">
|
||||
<xsl:value-of select="floor($sec div 86400)"/>d
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$sec >= 3600">
|
||||
<xsl:value-of select="(floor($sec div 3600)) mod 24"/>h
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$sec >= 60">
|
||||
<xsl:value-of select="(floor($sec div 60)) mod 60"/>m
|
||||
</xsl:if>
|
||||
|
||||
<xsl:value-of select="$sec mod 60"/>s
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="showsize">
|
||||
<xsl:param name="size"/>
|
||||
<xsl:param name="bits" select="0" />
|
||||
<xsl:param name="persec" select="0" />
|
||||
<xsl:variable name="sizen">
|
||||
<xsl:value-of select="floor($size div 1024)"/>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sizen >= 1073741824">
|
||||
<xsl:value-of select="format-number($sizen div 1073741824,'#.###')"/> T</xsl:when>
|
||||
|
||||
<xsl:when test="$sizen >= 1048576">
|
||||
<xsl:value-of select="format-number($sizen div 1048576,'#.###')"/> G</xsl:when>
|
||||
|
||||
<xsl:when test="$sizen >= 1024">
|
||||
<xsl:value-of select="format-number($sizen div 1024,'#.##')"/> M</xsl:when>
|
||||
<xsl:when test="$sizen >= 0">
|
||||
<xsl:value-of select="$sizen"/> K</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:if test="string-length($size) > 0">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$bits = 1">b</xsl:when>
|
||||
<xsl:otherwise>B</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="$persec = 1">/s</xsl:if>
|
||||
</xsl:if>
|
||||
</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>
|
||||
<xsl:attribute name="bgcolor">
|
||||
<xsl:choose>
|
||||
<xsl:when test="publishing">#cccccc</xsl:when>
|
||||
<xsl:otherwise>#eeeeee</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<td><xsl:value-of select="id"/></td>
|
||||
<td><xsl:call-template name="clientstate"/></td>
|
||||
<td>
|
||||
<a target="_blank">
|
||||
<xsl:attribute name="href">
|
||||
http://apps.db.ripe.net/search/query.html?searchtext=<xsl:value-of select="address"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="title">whois</xsl:attribute>
|
||||
<xsl:value-of select="address"/>
|
||||
</a>
|
||||
</td>
|
||||
<td><xsl:value-of select="flashver"/></td>
|
||||
<td>
|
||||
<a target="_blank">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="pageurl"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="pageurl"/>
|
||||
</a>
|
||||
</td>
|
||||
<td><xsl:value-of select="swfurl"/></td>
|
||||
<td><xsl:value-of select="dropped"/></td>
|
||||
<td><xsl:value-of select="timestamp"/></td>
|
||||
<td><xsl:value-of select="avsync"/></td>
|
||||
<td>
|
||||
<xsl:call-template name="showtime">
|
||||
<xsl:with-param name="time" select="time"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="publishing">
|
||||
publishing
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="active">
|
||||
active
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="width">
|
||||
<xsl:value-of select="."/>x<xsl:value-of select="../height"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-nginx-pingos": {
|
||||
"description": "Grant UCI access for luci-app-nginx-pingos",
|
||||
"read": {
|
||||
"uci": [ "pingos" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "pingos" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"config": "pingos",
|
||||
"init": "pingos"
|
||||
}
|
||||
Reference in new issue
Block a user