[vlc-devel] commit: luarc: implement stats command. ( Rémi Duraffort )

git version control git at videolan.org
Fri Nov 13 17:59:51 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Nov 13 13:56:04 2009 +0100| [323a0b215a858c64e0ef6ce3f9a0c741233bac98] | committer: Rémi Duraffort 

luarc: implement stats command.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=323a0b215a858c64e0ef6ce3f9a0c741233bac98
---

 share/lua/intf/rc.lua |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/share/lua/intf/rc.lua b/share/lua/intf/rc.lua
index 4b07157..75bca3c 100644
--- a/share/lua/intf/rc.lua
+++ b/share/lua/intf/rc.lua
@@ -320,6 +320,34 @@ function input_info(name,client)
     client:append("+----[ end of stream info ]")
 end
 
+function stats(name,client)
+    local stats_tab = vlc.input.stats()
+
+    client:append("bla"..stats_tab["demux_bitrate"])
+    client:append("+----[ begin of statistical info")
+    client:append("+-[Incoming]")
+    client:append("| input bytes read : "..string.format("%8.0f kB",stats_tab["read_bytes"]/1000))
+    client:append("| input bitrate    :   "..string.format("%6.0f bB/s",stats_tab["input_bitrate"]*8000))
+    client:append("| demux bytes read : "..string.format("%8.0f kB",stats_tab["demux_read_bytes"]/1000))
+    client:append("| demux bitrate    :   "..string.format("%6.0f kB/s",stats_tab["demux_bitrate"]*8000))
+    client:append("|")
+    client:append("+-[Video Decoding]")
+    client:append("| video decoded    :    "..string.format("%5i",stats_tab["decoded_video"]))
+    client:append("| frames displayed :    "..string.format("%5i",stats_tab["displayed_pictures"]))
+    client:append("| frames lost      :    "..string.format("%5i",stats_tab["lost_pictures"]))
+    client:append("|")
+    client:append("+-[Audio Decoding]")
+    client:append("| audio decoded    :    "..string.format("%5i",stats_tab["decoded_audio"]))
+    client:append("| buffers played   :    "..string.format("%5i",stats_tab["played_abuffers"]))
+    client:append("| buffers lost     :    "..string.format("%5i",stats_tab["lost_abuffers"]))
+    client:append("|")
+    client:append("+-[Streaming]")
+    client:append("| packets sent     :    "..string.format("%5i",stats_tab["sent_packets"]))
+    client:append("| bytes sent       : "..string.format("%8.0f kB",stats_tab["sent_bytes"]/1000))
+    client:append("| sending bitrate  :   "..string.format("%6.0f kb/s",stats_tab["send_bitrate"]*8000))
+    client:append("+----[ end of statistical info ]")
+end
+
 function playlist_status(name,client)
     local a,b,c = vlc.playlist.status()
     client:append( "( new input: " .. tostring(a) .. " )" )
@@ -450,7 +478,7 @@ commands_ordered = {
     { "frame"; { func = frame; help = "play frame by frame" } };
     { "fullscreen"; { func = skip2(vlc.video.fullscreen); args = "[on|off]"; help = "toggle fullscreen"; aliases = { "f", "F" } } };
     { "info"; { func = input_info; help = "information about the current stream" } };
-    { "states"; { func = fixme; help = "show statistical information" } };
+    { "stats"; { func = stats; help = "show statistical information" } };
     { "get_time"; { func = get_time("time"); help = "seconds elapsed since stream's beginning" } };
     { "is_playing"; { func = is_playing; help = "1 if a stream plays, 0 otherwise" } };
     { "get_title"; { func = ret_print(vlc.input.get_title); help = "the title of the current stream" } };




More information about the vlc-devel mailing list