[vlc-commits] commit: statistics to 64bit (Ilkka Ollakka )

git at videolan.org git at videolan.org
Wed Jul 14 20:40:49 CEST 2010


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Jul 14 19:07:36 2010 +0300| [7f48382793df3f420d48d63940ad92cbf7dcf447] | committer: Ilkka Ollakka 

statistics to 64bit

Didn't touch the os x interface code. I don't think I missed any core-code that relates.
Fixe #3411

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

 include/vlc_input_item.h                   |   28 ++++++++++----------
 modules/gui/ncurses.c                      |   12 ++++----
 modules/gui/qt4/components/info_panels.cpp |   39 +++++++++++++++-------------
 src/misc/stats.c                           |   14 +++++-----
 4 files changed, 48 insertions(+), 45 deletions(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 8bf825f..31f877d 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -277,35 +277,35 @@ struct input_stats_t
     vlc_mutex_t         lock;
 
     /* Input */
-    int i_read_packets;
-    int i_read_bytes;
+    int64_t i_read_packets;
+    int64_t i_read_bytes;
     float f_input_bitrate;
     float f_average_input_bitrate;
 
     /* Demux */
-    int i_demux_read_packets;
-    int i_demux_read_bytes;
+    int64_t i_demux_read_packets;
+    int64_t i_demux_read_bytes;
     float f_demux_bitrate;
     float f_average_demux_bitrate;
-    int i_demux_corrupted;
-    int i_demux_discontinuity;
+    int64_t i_demux_corrupted;
+    int64_t i_demux_discontinuity;
 
     /* Decoders */
-    int i_decoded_audio;
-    int i_decoded_video;
+    int64_t i_decoded_audio;
+    int64_t i_decoded_video;
 
     /* Vout */
-    int i_displayed_pictures;
-    int i_lost_pictures;
+    int64_t i_displayed_pictures;
+    int64_t i_lost_pictures;
 
     /* Sout */
-    int i_sent_packets;
-    int i_sent_bytes;
+    int64_t i_sent_packets;
+    int64_t i_sent_bytes;
     float f_send_bitrate;
 
     /* Aout */
-    int i_played_abuffers;
-    int i_lost_abuffers;
+    int64_t i_played_abuffers;
+    int64_t i_lost_abuffers;
 };
 
 #endif
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 70d8f0f..e1f190a 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -1995,13 +1995,13 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
                 MainBoxWrite( p_intf, l, 1, _("+-[Video Decoding]"));
                 SHOW_ACS( 1, ACS_LTEE );  SHOW_ACS( 2, ACS_HLINE ); l++;
                 if( p_sys->b_color ) wcolor_set( p_sys->w, C_DEFAULT, NULL );
-                MainBoxWrite( p_intf, l, 1, _("| video decoded    :    %5i"),
+                MainBoxWrite( p_intf, l, 1, _("| video decoded    :    %"PRId64),
                         p_item->p_stats->i_decoded_video );
                 SHOW_ACS( 1, ACS_VLINE ); l++;
-                MainBoxWrite( p_intf, l, 1, _("| frames displayed :    %5i"),
+                MainBoxWrite( p_intf, l, 1, _("| frames displayed :    %"PRId64),
                         p_item->p_stats->i_displayed_pictures );
                 SHOW_ACS( 1, ACS_VLINE ); l++;
-                MainBoxWrite( p_intf, l, 1, _("| frames lost      :    %5i"),
+                MainBoxWrite( p_intf, l, 1, _("| frames lost      :    %"PRId64),
                         p_item->p_stats->i_lost_pictures );
                 SHOW_ACS( 1, ACS_VLINE ); l++;
                 DrawEmptyLine( p_sys->w, p_sys->i_box_y + l - p_sys->i_box_start, 1, COLS - 2 );
@@ -2014,13 +2014,13 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
                 MainBoxWrite( p_intf, l, 1, _("+-[Audio Decoding]"));
                 SHOW_ACS( 1, ACS_LTEE );  SHOW_ACS( 2, ACS_HLINE ); l++;
                 if( p_sys->b_color ) wcolor_set( p_sys->w, C_DEFAULT, NULL );
-                MainBoxWrite( p_intf, l, 1, _("| audio decoded    :    %5i"),
+                MainBoxWrite( p_intf, l, 1, _("| audio decoded    :    %"PRId64),
                         p_item->p_stats->i_decoded_audio );
                 SHOW_ACS( 1, ACS_VLINE ); l++;
-                MainBoxWrite( p_intf, l, 1, _("| buffers played   :    %5i"),
+                MainBoxWrite( p_intf, l, 1, _("| buffers played   :    %"PRId64),
                         p_item->p_stats->i_played_abuffers );
                 SHOW_ACS( 1, ACS_VLINE ); l++;
-                MainBoxWrite( p_intf, l, 1, _("| buffers lost     :    %5i"),
+                MainBoxWrite( p_intf, l, 1, _("| buffers lost     :    %"PRId64),
                         p_item->p_stats->i_lost_abuffers );
                 SHOW_ACS( 1, ACS_VLINE ); l++;
                 DrawEmptyLine( p_sys->w, p_sys->i_box_y + l - p_sys->i_box_start, 1, COLS - 2 );
diff --git a/modules/gui/qt4/components/info_panels.cpp b/modules/gui/qt4/components/info_panels.cpp
index 2b35cdb..506e653 100644
--- a/modules/gui/qt4/components/info_panels.cpp
+++ b/modules/gui/qt4/components/info_panels.cpp
@@ -23,6 +23,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#define __STDC_FORMAT_MACROS 1
+#define __STDC_CONSTANT_MACROS 1
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
@@ -566,33 +569,33 @@ void InputStatsPanel::update( input_item_t *p_item )
 #define UPDATE( widget, format, calc... ) \
     { QString str; widget->setText( 1 , str.sprintf( format, ## calc ) );  }
 
-    UPDATE( read_media_stat, "%8.0f",
-            (float)(p_item->p_stats->i_read_bytes)/1024);
+    UPDATE( read_media_stat, "%"PRId64,
+            (p_item->p_stats->i_read_bytes / 1024 ) );
     UPDATE( input_bitrate_stat, "%6.0f",
-                    (float)(p_item->p_stats->f_input_bitrate * 8000 ));
-    UPDATE( demuxed_stat, "%8.0f",
-                    (float)(p_item->p_stats->i_demux_read_bytes)/1024 );
+                    (float)(p_item->p_stats->f_input_bitrate *  8000  ));
+    UPDATE( demuxed_stat, "%"PRId64,
+                    (p_item->p_stats->i_demux_read_bytes / 1024 ) );
     UPDATE( stream_bitrate_stat, "%6.0f",
-                    (float)(p_item->p_stats->f_demux_bitrate * 8000 ));
-    UPDATE( corrupted_stat, "%5i", p_item->p_stats->i_demux_corrupted );
-    UPDATE( discontinuity_stat, "%5i", p_item->p_stats->i_demux_discontinuity );
+                    (float)(p_item->p_stats->f_demux_bitrate *  8000  ));
+    UPDATE( corrupted_stat, "%"PRId64, p_item->p_stats->i_demux_corrupted );
+    UPDATE( discontinuity_stat, "%"PRId64, p_item->p_stats->i_demux_discontinuity );
 
     /* Video */
-    UPDATE( vdecoded_stat, "%5i", p_item->p_stats->i_decoded_video );
-    UPDATE( vdisplayed_stat, "%5i", p_item->p_stats->i_displayed_pictures );
-    UPDATE( vlost_frames_stat, "%5i", p_item->p_stats->i_lost_pictures );
+    UPDATE( vdecoded_stat, "%"PRId64, p_item->p_stats->i_decoded_video );
+    UPDATE( vdisplayed_stat, "%"PRId64, p_item->p_stats->i_displayed_pictures );
+    UPDATE( vlost_frames_stat, "%"PRId64, p_item->p_stats->i_lost_pictures );
 
     /* Sout */
-    UPDATE( send_stat, "%5i", p_item->p_stats->i_sent_packets );
-    UPDATE( send_bytes_stat, "%8.0f",
-            (float)(p_item->p_stats->i_sent_bytes)/1024 );
+    UPDATE( send_stat, "%"PRId64, p_item->p_stats->i_sent_packets );
+    UPDATE( send_bytes_stat, "%"PRId64,
+            (p_item->p_stats->i_sent_bytes)/ 1024 );
     UPDATE( send_bitrate_stat, "%6.0f",
-            (float)(p_item->p_stats->f_send_bitrate*8)*1000 );
+            (float)(p_item->p_stats->f_send_bitrate * 8000 ) );
 
     /* Audio*/
-    UPDATE( adecoded_stat, "%5i", p_item->p_stats->i_decoded_audio );
-    UPDATE( aplayed_stat, "%5i", p_item->p_stats->i_played_abuffers );
-    UPDATE( alost_stat, "%5i", p_item->p_stats->i_lost_abuffers );
+    UPDATE( adecoded_stat, "%"PRId64, p_item->p_stats->i_decoded_audio );
+    UPDATE( aplayed_stat, "%"PRId64, p_item->p_stats->i_played_abuffers );
+    UPDATE( alost_stat, "%"PRId64, p_item->p_stats->i_lost_abuffers );
 
 #undef UPDATE
 
diff --git a/src/misc/stats.c b/src/misc/stats.c
index 2190f48..7a46306 100644
--- a/src/misc/stats.c
+++ b/src/misc/stats.c
@@ -127,7 +127,7 @@ int stats_Get( vlc_object_t *p_this, counter_t *p_counter, vlc_value_t *val )
                         p_counter->pp_samples[1]->value.i_int ) /
                     (float)(  p_counter->pp_samples[0]->date -
                               p_counter->pp_samples[1]->date );
-            val->i_int = (int)f;
+            val->i_int = (int64_t)f;
         }
         else
         {
@@ -232,9 +232,9 @@ void stats_DumpInputStats( input_stats_t *p_stats  )
     vlc_mutex_lock( &p_stats->lock );
     /* f_bitrate is in bytes / microsecond
      * *1000 => bytes / millisecond => kbytes / seconds */
-    fprintf( stderr, "Input : %i (%i bytes) - %f kB/s - "
-                     "Demux : %i (%i bytes) - %f kB/s\n"
-                     " - Vout : %i/%i - Aout : %i/%i - Sout : %f\n",
+    fprintf( stderr, "Input : %"PRId64" (%"PRId64" bytes) - %f kB/s - "
+                     "Demux : %"PRId64" (%"PRId64" bytes) - %f kB/s\n"
+                     " - Vout : %"PRId64"/%"PRId64" - Aout : %"PRId64"/%"PRId64" - Sout : %f\n",
                     p_stats->i_read_packets, p_stats->i_read_bytes,
                     p_stats->f_input_bitrate * 1000,
                     p_stats->i_demux_read_packets, p_stats->i_demux_read_bytes,
@@ -560,7 +560,7 @@ static void TimerDump( vlc_object_t *p_obj, counter_t *p_counter,
         return;
 
     mtime_t last, total;
-    int i_total;
+    int64_t i_total;
     if( p_counter->i_samples != 2 )
     {
         msg_Err( p_obj, "timer %s does not exist", p_counter->psz_name );
@@ -581,14 +581,14 @@ static void TimerDump( vlc_object_t *p_obj, counter_t *p_counter,
     if( b_total )
     {
         msg_Dbg( p_obj,
-             "TIMER %s : %.3f ms - Total %.3f ms / %i intvls (Avg %.3f ms)",
+             "TIMER %s : %.3f ms - Total %.3f ms / %"PRId64" intvls (Avg %.3f ms)",
              p_counter->psz_name, (float)last/1000, (float)total/1000, i_total,
              (float)(total)/(1000*(float)i_total ) );
     }
     else
     {
         msg_Dbg( p_obj,
-             "TIMER %s : Total %.3f ms / %i intvls (Avg %.3f ms)",
+             "TIMER %s : Total %.3f ms / %"PRId64" intvls (Avg %.3f ms)",
              p_counter->psz_name, (float)total/1000, i_total,
              (float)(total)/(1000*(float)i_total ) );
     }



More information about the vlc-commits mailing list