diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-08-08 21:06:01 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-08-08 21:06:01 +0000 |
commit | c4c56a3da7a3ef868b853fb8f434198d6b9f9ee9 (patch) | |
tree | cd8713db8608758fc5f6bd5eed18d4700edbb1e1 | |
parent | b09ba217cc36274ce6a4a190256a5bfbd79b0041 (diff) |
mpegplayer FPS display: * Don't count the first frame if we don't know the decode time it took. * Display every 2 seconds independent of actual fps.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10486 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/mpegplayer/video_out_rockbox.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c index a5fdf5efbb..c77c433dee 100644 --- a/apps/plugins/mpegplayer/video_out_rockbox.c +++ b/apps/plugins/mpegplayer/video_out_rockbox.c @@ -30,7 +30,8 @@ extern struct plugin_api* rb; #include "mpeg2.h" #include "video_out.h" -static int starttick; +static int starttick = 0; +static int lasttick = 0; #define CSUB_X 2 #define CSUB_Y 2 @@ -211,19 +212,23 @@ static void rockbox_draw_frame (vo_instance_t * instance, rb->lcd_update_rect(output_x,output_y,output_width,output_height); #endif - if (starttick==0) starttick=*rb->current_tick-1; /* Avoid divby0 */ + if (starttick==0) { + starttick=*rb->current_tick-1; /* Avoid divby0 */ + lasttick=starttick; + } /* Calculate fps */ - frame++; - if ((frame % 125) == 0) { + if (*rb->current_tick-lasttick>=2*HZ) { ticks=(*rb->current_tick)-starttick; fps=(frame*1000)/ticks; rb->snprintf(str,sizeof(str),"%d.%d",(fps/10),fps%10); rb->lcd_putsxy(0,0,str); - rb->lcd_update_rect(0,0,80,8); + + lasttick+=2*HZ; } + frame++; } vo_instance_t static_instance; |