+void stats_ComputeInputStats( input_thread_t *p_input,
+ input_stats_t *p_stats )
+{
+ vlc_mutex_lock( &p_stats->lock );
+ /* read_packets and read_bytes are common to all streams */
+ stats_GetInteger( p_input, p_input->i_object_id, "read_packets",
+ &p_stats->i_read_packets );
+ stats_GetInteger( p_input, p_input->i_object_id, "read_bytes",
+ &p_stats->i_read_bytes );
+ vlc_mutex_unlock( &p_stats->lock );
+}
+
+void stats_ReinitInputStats( input_stats_t *p_stats )
+{
+ p_stats->i_read_packets = p_stats->i_read_bytes =
+ p_stats->f_last_bitrate = p_stats->f_average_bitrate =
+ p_stats->i_displayed_pictures = p_stats->i_lost_pictures = 0;
+}
+
+void stats_DumpInputStats( input_stats_t *p_stats )
+{
+ vlc_mutex_lock( &p_stats->lock );
+ fprintf( stderr, "Read packets : %i (%i bytes)\n",
+ p_stats->i_read_packets, p_stats->i_read_bytes );
+ vlc_mutex_unlock( &p_stats->lock );
+}
+
+
+/********************************************************************
+ * Following functions are local
+ ********************************************************************/
+
+/**
+ * Update a statistics counter, according to its type
+ * If needed, perform a bit of computation (derivative, mostly)
+ * This function must be entered with stats handler lock
+ * \param p_handler stats handler singleton
+ * \param p_counter the counter to update
+ * \param val the "new" value
+ * \return an error code
+ */