Skip to content

Commit 5ab666f

Browse files
committed
[feature] now recording is available in stat.
1 parent 1ccfee1 commit 5ab666f

File tree

1 file changed

+185
-0
lines changed

1 file changed

+185
-0
lines changed

stat.xsl

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<tr bgcolor="#999999">
3333
<th>HTTP-FLV</th>
3434
<th>#clients</th>
35+
<th colspan="2">Recorders</th>
3536
<th colspan="2">Server</th>
3637
<th colspan="4">Video</th>
3738
<th colspan="4">Audio</th>
@@ -44,6 +45,8 @@
4445
</tr>
4546
<tr>
4647
<td colspan="2">Accepted: <xsl:value-of select="naccepted"/></td>
48+
<th bgcolor="#999999">list</th>
49+
<th bgcolor="#999999">count</th>
4750
<th bgcolor="#999999">port</th>
4851
<th bgcolor="#999999">index</th>
4952
<th bgcolor="#999999">codec</th>
@@ -101,6 +104,7 @@
101104
</tr>
102105
<xsl:apply-templates select="live"/>
103106
<xsl:apply-templates select="play"/>
107+
<xsl:apply-templates select="recorders"/>
104108
</xsl:template>
105109

106110
<xsl:template match="live">
@@ -127,6 +131,103 @@
127131
<xsl:apply-templates select="stream"/>
128132
</xsl:template>
129133

134+
<xsl:template match="recorders">
135+
<tr bgcolor="#aaaaaa">
136+
<td colspan="2">Recorders</td>
137+
<td>
138+
<a href="">
139+
<xsl:attribute name="onclick">
140+
var d=document.getElementById('<xsl:value-of select="../../port"/>-<xsl:value-of select="../../server_index"/>-<xsl:value-of select="../name"/>-recorders');
141+
d.style.display=d.style.display=='none'?'':'none';
142+
return false;
143+
</xsl:attribute>
144+
<i>config</i>
145+
</a>
146+
</td>
147+
<td align="middle">
148+
<xsl:value-of select="count"/>
149+
</td>
150+
</tr>
151+
<tr style="display:none">
152+
<xsl:attribute name="id"><xsl:value-of select="../../port"/>-<xsl:value-of select="../../server_index"/>-<xsl:value-of select="../name"/>-recorders</xsl:attribute>
153+
<td colspan="16">
154+
<table cellspacing="1" cellpadding="5">
155+
<tr>
156+
<th>Id</th>
157+
<th>Path</th>
158+
<th>Suffix</th>
159+
<th>Flags</th>
160+
<th>Max Size</th>
161+
<th>Max Frames</th>
162+
<th>Interval</th>
163+
<th>Unique</th>
164+
<th>Append</th>
165+
<th>Lock File</th>
166+
<th>Notify</th>
167+
</tr>
168+
<xsl:apply-templates select="recorder"/>
169+
</table>
170+
</td>
171+
</tr>
172+
</xsl:template>
173+
174+
<xsl:template match="recorder">
175+
<tr bgcolor="#cccccc">
176+
<td>
177+
<xsl:value-of select="id"/>
178+
<xsl:if test="string-length(id) = 0">
179+
[DEFAULT]
180+
</xsl:if>
181+
</td>
182+
<td><xsl:value-of select="path"/></td>
183+
<td><xsl:value-of select="suffix"/></td>
184+
<td>
185+
<xsl:if test="flags/video">video<br/></xsl:if>
186+
<xsl:if test="flags/audio">audio<br/></xsl:if>
187+
<xsl:if test="flags/manual">manual</xsl:if>
188+
</td>
189+
<td>
190+
<xsl:call-template name="showsize">
191+
<xsl:with-param name="size" select="max_size"/>
192+
</xsl:call-template>
193+
</td>
194+
<td><xsl:value-of select="max_frames"/></td>
195+
<td>
196+
<xsl:call-template name="showinterval">
197+
<xsl:with-param name="interval" select="interval"/>
198+
</xsl:call-template>
199+
</td>
200+
<td>
201+
<xsl:call-template name="binarystate">
202+
<xsl:with-param name="value" select="unique"/>
203+
</xsl:call-template>
204+
</td>
205+
<td>
206+
<xsl:call-template name="binarystate">
207+
<xsl:with-param name="value" select="append"/>
208+
</xsl:call-template>
209+
</td>
210+
<td>
211+
<xsl:call-template name="binarystate">
212+
<xsl:with-param name="value" select="lock_file"/>
213+
</xsl:call-template>
214+
</td>
215+
<td>
216+
<xsl:call-template name="binarystate">
217+
<xsl:with-param name="value" select="notify"/>
218+
</xsl:call-template>
219+
</td>
220+
</tr>
221+
</xsl:template>
222+
223+
<xsl:template name="binarystate">
224+
<xsl:param name="value"/>
225+
<xsl:choose>
226+
<xsl:when test="$value">on</xsl:when>
227+
<xsl:otherwise>off</xsl:otherwise>
228+
</xsl:choose>
229+
</xsl:template>
230+
130231
<xsl:template match="stream">
131232
<tr valign="top">
132233
<xsl:attribute name="bgcolor">
@@ -149,6 +250,8 @@
149250
</a>
150251
</td>
151252
<td align="middle"> <xsl:value-of select="nclients"/> </td>
253+
<td align="middle"> - </td>
254+
<td align="middle"> - </td>
152255
<td align="middle"> <xsl:value-of select="../../../port"/> </td>
153256
<td align="middle"> <xsl:value-of select="../../../server_index"/> </td>
154257
<td>
@@ -234,10 +337,64 @@
234337
</tr>
235338
<xsl:apply-templates select="client"/>
236339
</table>
340+
<xsl:apply-templates select="records"/>
237341
</td>
238342
</tr>
239343
</xsl:template>
240344

345+
<xsl:template match="records">
346+
<table cellspacing="1" cellpadding="5">
347+
<tr>
348+
<th>Recorder</th>
349+
<th>State</th>
350+
<th>Epoch</th>
351+
<th>Time Shift</th>
352+
<th>File Name</th>
353+
<th>Time</th>
354+
<th>Size</th>
355+
<th>Frames</th>
356+
</tr>
357+
<xsl:apply-templates select="record"/>
358+
</table>
359+
</xsl:template>
360+
361+
<xsl:template match="record">
362+
<tr>
363+
<xsl:attribute name="bgcolor">
364+
<xsl:choose>
365+
<xsl:when test="recording">#cccccc</xsl:when>
366+
<xsl:otherwise>#eeeeee</xsl:otherwise>
367+
</xsl:choose>
368+
</xsl:attribute>
369+
<td>
370+
<xsl:value-of select="recorder"/>
371+
<xsl:if test="string-length(recorder) = 0">
372+
[DEFAULT]
373+
</xsl:if>
374+
</td>
375+
<td>
376+
<xsl:choose>
377+
<xsl:when test="recording">recording</xsl:when>
378+
<xsl:otherwise>idle</xsl:otherwise>
379+
</xsl:choose>
380+
</td>
381+
<td><xsl:value-of select="epoch"/></td>
382+
<td><xsl:value-of select="time_shift"/></td>
383+
<td><xsl:value-of select="file"/></td>
384+
<td>
385+
<xsl:call-template name="showtime">
386+
<xsl:with-param name="time" select="time * 1000"/>
387+
</xsl:call-template>
388+
</td>
389+
<td>
390+
<xsl:call-template name="showsize">
391+
<xsl:with-param name="size" select="size"/>
392+
</xsl:call-template>
393+
</td>
394+
<td><xsl:value-of select="nframes"/></td>
395+
</tr>
396+
</xsl:template>
397+
241398
<xsl:template name="showtime">
242399
<xsl:param name="time"/>
243400

@@ -290,6 +447,34 @@
290447
</xsl:if>
291448
</xsl:template>
292449

450+
<xsl:template name="showinterval">
451+
<xsl:param name="interval"/>
452+
453+
<xsl:if test="$interval &gt; 0">
454+
<xsl:variable name="sec">
455+
<xsl:value-of select="floor($interval div 1000)"/>
456+
</xsl:variable>
457+
458+
<xsl:if test="$sec &gt;= 86400">
459+
<xsl:value-of select="floor($sec div 86400)"/>d
460+
</xsl:if>
461+
462+
<xsl:if test="$sec &gt;= 3600">
463+
<xsl:value-of select="(floor($sec div 3600)) mod 24"/>h
464+
</xsl:if>
465+
466+
<xsl:if test="$sec &gt;= 60">
467+
<xsl:value-of select="(floor($sec div 60)) mod 60"/>m
468+
</xsl:if>
469+
470+
<xsl:if test="$sec &lt; 60">
471+
<xsl:value-of select="$sec mod 60"/>s
472+
</xsl:if>
473+
</xsl:if>
474+
475+
<xsl:if test="$interval = -1">Unset</xsl:if>
476+
</xsl:template>
477+
293478
<xsl:template name="streamstate">
294479
<xsl:choose>
295480
<xsl:when test="active">active</xsl:when>

0 commit comments

Comments
 (0)