Commit fe65cde1 authored by Antoine Cellerier's avatar Antoine Cellerier

Export stats in http interface

parent de6aa435
......@@ -489,6 +489,7 @@ static void ParseExecute( httpd_file_sys_t *p_args, char *p_buffer,
audio_volume_t i_volume;
char volume[5];
char state[8];
char stats[20];
#define p_sys p_args->p_intf->p_sys
if( p_sys->p_input )
......@@ -548,6 +549,38 @@ static void ParseExecute( httpd_file_sys_t *p_args, char *p_buffer,
E_(mvar_AppendNewVar)( p_args->vars, "stream_state", state );
E_(mvar_AppendNewVar)( p_args->vars, "charset", ((intf_sys_t *)p_args->p_intf->p_sys)->psz_charset );
/* Stats */
#define p_sys p_args->p_intf->p_sys
if( p_sys->p_input )
{
input_item_t *p_item = p_sys->p_input->input.p_item;
if( p_item )
{
vlc_mutex_lock( &p_item->p_stats->lock );
#define STATS_INT( n ) sprintf( stats, "%d", p_item->p_stats->i_ ## n ); \
E_(mvar_AppendNewVar)( p_args->vars, #n, stats );
#define STATS_FLOAT( n ) sprintf( stats, "%f", p_item->p_stats->f_ ## n ); \
E_(mvar_AppendNewVar)( p_args->vars, #n, stats );
STATS_INT( read_bytes )
STATS_FLOAT( input_bitrate )
STATS_INT( demux_read_bytes )
STATS_FLOAT( demux_bitrate )
STATS_INT( decoded_video )
STATS_INT( displayed_pictures )
STATS_INT( lost_pictures )
STATS_INT( decoded_audio )
STATS_INT( played_abuffers )
STATS_INT( lost_abuffers )
STATS_INT( sent_packets )
STATS_INT( sent_bytes )
STATS_FLOAT( send_bitrate )
#undef STATS_INT
#undef STATS_FLOAT
vlc_mutex_unlock( &p_item->p_stats->lock );
}
}
#undef p_sys
E_(SSInit)( &p_args->stack );
/* allocate output */
......
......@@ -118,4 +118,19 @@
</category>
<vlc id="end" />
</information>
<stats>
<readbytes><vlc id="value" param1="read_bytes" /></readbytes>
<inputbitrate><vlc id="value" param1="input_bitrate" /></inputbitrate>
<demuxreadbytes><vlc id="value" param1="demux_read_bytes" /></demuxreadbytes>
<demuxbitrate><vlc id="value" param1="demux_bitrate" /></demuxbitrate>
<decodedvideo><vlc id="value" param1="decoded_video" /></decodedvideo>
<displayedpictures><vlc id="value" param1="displayed_pictures" /></displayedpictures>
<lostpictures><vlc id="value" param1="lost_pictures" /></lostpictures>
<decodedaudio><vlc id="value" param1="decoded_audio" /></decodedaudio>
<playedabuffers><vlc id="value" param1="played_abuffers" /></playedabuffers>
<lostabuffers><vlc id="value" param1="lost_abuffers" /></lostabuffers>
<sentpackets><vlc id="value" param1="sent_packets" /></sentpackets>
<sentbytes><vlc id="value" param1="sent_bytes" /></sentbytes>
<sendbitrate><vlc id="value" param1="send_bitrate" /></sendbitrate>
</stats>
</root>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment