diff options
Diffstat (limited to 'apps/plugins')
-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; | |||
30 | #include "mpeg2.h" | 30 | #include "mpeg2.h" |
31 | #include "video_out.h" | 31 | #include "video_out.h" |
32 | 32 | ||
33 | static int starttick; | 33 | static int starttick = 0; |
34 | static int lasttick = 0; | ||
34 | 35 | ||
35 | #define CSUB_X 2 | 36 | #define CSUB_X 2 |
36 | #define CSUB_Y 2 | 37 | #define CSUB_Y 2 |
@@ -211,19 +212,23 @@ static void rockbox_draw_frame (vo_instance_t * instance, | |||
211 | rb->lcd_update_rect(output_x,output_y,output_width,output_height); | 212 | rb->lcd_update_rect(output_x,output_y,output_width,output_height); |
212 | #endif | 213 | #endif |
213 | 214 | ||
214 | if (starttick==0) starttick=*rb->current_tick-1; /* Avoid divby0 */ | 215 | if (starttick==0) { |
216 | starttick=*rb->current_tick-1; /* Avoid divby0 */ | ||
217 | lasttick=starttick; | ||
218 | } | ||
215 | 219 | ||
216 | /* Calculate fps */ | 220 | /* Calculate fps */ |
217 | frame++; | 221 | if (*rb->current_tick-lasttick>=2*HZ) { |
218 | if ((frame % 125) == 0) { | ||
219 | ticks=(*rb->current_tick)-starttick; | 222 | ticks=(*rb->current_tick)-starttick; |
220 | 223 | ||
221 | fps=(frame*1000)/ticks; | 224 | fps=(frame*1000)/ticks; |
222 | rb->snprintf(str,sizeof(str),"%d.%d",(fps/10),fps%10); | 225 | rb->snprintf(str,sizeof(str),"%d.%d",(fps/10),fps%10); |
223 | rb->lcd_putsxy(0,0,str); | 226 | rb->lcd_putsxy(0,0,str); |
224 | |||
225 | rb->lcd_update_rect(0,0,80,8); | 227 | rb->lcd_update_rect(0,0,80,8); |
228 | |||
229 | lasttick+=2*HZ; | ||
226 | } | 230 | } |
231 | frame++; | ||
227 | } | 232 | } |
228 | 233 | ||
229 | vo_instance_t static_instance; | 234 | vo_instance_t static_instance; |