diff options
| author | Robert Kukla <roolku@rockbox.org> | 2007-10-16 14:23:50 +0000 |
|---|---|---|
| committer | Robert Kukla <roolku@rockbox.org> | 2007-10-16 14:23:50 +0000 |
| commit | 0b911fefea7615105244098da1baf4655fa1e721 (patch) | |
| tree | fdf7364483d71ffe8dacfbd0dc44933b3d865178 /apps/plugins/mpegplayer/mpegplayer.c | |
| parent | 94c23df2abdd1b8ac171f6bf1d651bd3a1faed58 (diff) | |
| download | rockbox-0b911fefea7615105244098da1baf4655fa1e721.zip rockbox-0b911fefea7615105244098da1baf4655fa1e721.tar.gz rockbox-0b911fefea7615105244098da1baf4655fa1e721.tar.bz2 rockbox-0b911fefea7615105244098da1baf4655fa1e721.tar.xz | |
FS#7971 - mpegplayer - start menu loads quicker - menu clean up - code clean up
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15143 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
| -rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 12282a3..5d79475 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -1042,7 +1042,7 @@ static inline int32_t clip_sample(int32_t sample) static int button_loop(void) { - bool result; + int result; int vol, minvol, maxvol; int button; @@ -1118,15 +1118,19 @@ static int button_loop(void) /* The menu can change the font, so restore */ rb->lcd_setfont(FONT_SYSFIXED); - if (result) { - settings.resume_time = (int)(get_stream_time()/CLOCK_RATE/ - 30-start_pts_time); - str_send_msg(&video_str, STREAM_QUIT, 0); - audio_str.status = STREAM_STOPPED; - } else { - audio_str.status = STREAM_PLAYING; - str_send_msg(&video_str, STREAM_PLAY, 0); - pcm_playback_play_pause(true); + switch (result) + { + case MPEG_MENU_QUIT: + settings.resume_time = (int)(get_stream_time()/CLOCK_RATE/ + 30-start_pts_time); + str_send_msg(&video_str, STREAM_QUIT, 0); + audio_str.status = STREAM_STOPPED; + break; + default: + audio_str.status = STREAM_PLAYING; + str_send_msg(&video_str, STREAM_PLAY, 0); + pcm_playback_play_pause(true); + break; } break; @@ -2203,7 +2207,8 @@ ssize_t seek_PTS( int in_file, int start_time, int accept_button ) enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { int status = PLUGIN_ERROR; /* assume failure */ - int start_time=-1; + int result; + int start_time = -1; void* audiobuf; ssize_t audiosize; int in_file; @@ -2295,8 +2300,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->lcd_set_foreground(LCD_WHITE); rb->lcd_set_background(LCD_BLACK); #endif - rb->lcd_clear_display(); - rb->lcd_update(); init_settings((char*)parameter); @@ -2312,10 +2315,21 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) find_end_pts( in_file ); /* start menu */ - start_time = mpeg_start_menu(end_pts_time-start_pts_time, in_file); - if ( start_time == -1 ) - return 0; - else if ( start_time < 0 ) + rb->lcd_clear_display(); + rb->lcd_update(); + result = mpeg_start_menu(end_pts_time-start_pts_time, in_file); + + switch (result) + { + case MPEG_START_QUIT: + return 0; + default: + start_time = settings.resume_time; + break; + } + + /* basic time checks */ + if ( start_time < 0 ) start_time = 0; else if ( start_time > (end_pts_time-start_pts_time) ) start_time = (end_pts_time-start_pts_time); |