1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2006-08-08 21:06:01 +00:00
parent b09ba217cc
commit c4c56a3da7

View file

@ -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;