initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
rtmp.conf
|
||||
.env
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
FROM docker.angie.software/angie:1.11.4-alpine
|
||||
|
||||
RUN apk add --no-cache ffmpeg curl ca-certificates
|
||||
|
||||
COPY angie.conf /etc/angie/angie.conf
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# package: angie-module-rtmp
|
||||
load_module modules/ngx_rtmp_module.so;
|
||||
|
||||
user angie;
|
||||
worker_processes auto;
|
||||
worker_rlimit_nofile 65536;
|
||||
|
||||
error_log /var/log/angie/error.log notice;
|
||||
pid /run/angie/angie.pid;
|
||||
|
||||
events {
|
||||
worker_connections 2048;
|
||||
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/angie/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"';
|
||||
|
||||
log_format extended '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" rt="$request_time" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for" '
|
||||
'h="$host" sn="$server_name" ru="$request_uri" u="$uri" '
|
||||
'ucs="$upstream_cache_status" ua="$upstream_addr" us="$upstream_status" '
|
||||
'uct="$upstream_connect_time" urt="$upstream_response_time"';
|
||||
|
||||
access_log /var/log/angie/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/angie/http.d/*.conf;
|
||||
}
|
||||
|
||||
rtmp {
|
||||
include /etc/angie/rtmp.d/*.conf;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
services:
|
||||
restream:
|
||||
#image: docker.angie.software/angie:1.11.4-alpine
|
||||
build: angie_rtmp
|
||||
restart: unless-stopped
|
||||
container_name: restream
|
||||
volumes:
|
||||
- ./web:/usr/share/angie/html:ro
|
||||
- ./rtmp.conf:/etc/angie/rtmp.d/rtmp.conf:ro
|
||||
- ./http.conf:/etc/angie/http.d/default.conf:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
environment:
|
||||
TZ: Europe/Moscow
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
ports:
|
||||
- 1935:1935/tcp
|
||||
- 1935:1935/udp
|
||||
- 59080:80/tcp
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "5"
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/angie/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
# rtmp stat
|
||||
location /stat {
|
||||
rtmp_stat all;
|
||||
rtmp_stat_stylesheet stat.xsl;
|
||||
}
|
||||
location /stat.xsl {
|
||||
root /usr/share/angie/html/rtmp;
|
||||
}
|
||||
|
||||
# rtmp control
|
||||
location /control {
|
||||
rtmp_control all;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Статус сервера</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.status-container {
|
||||
text-align: center;
|
||||
background: white;
|
||||
padding: 40px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.checkmark {
|
||||
display: inline-block;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.checkmark::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 20px;
|
||||
top: 10px;
|
||||
width: 25px;
|
||||
height: 40px;
|
||||
border: solid #4CAF50;
|
||||
border-width: 0 10px 10px 0;
|
||||
transform: rotate(45deg);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #333;
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="status-container">
|
||||
<div class="checkmark"></div>
|
||||
<h1>Сервер рестрима работает</h1>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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/arut/nginx-rtmp-module'>
|
||||
nginx-rtmp-module</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="application"/>
|
||||
</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>
|
||||
+355
@@ -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/arut/nginx-rtmp-module'>
|
||||
nginx-rtmp-module</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="application"/>
|
||||
</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>
|
||||
Reference in New Issue
Block a user