summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer/mpegplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 12282a3322..5d79475d2a 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)
1042 1042
1043static int button_loop(void) 1043static int button_loop(void)
1044{ 1044{
1045 bool result; 1045 int result;
1046 int vol, minvol, maxvol; 1046 int vol, minvol, maxvol;
1047 int button; 1047 int button;
1048 1048
@@ -1118,15 +1118,19 @@ static int button_loop(void)
1118 /* The menu can change the font, so restore */ 1118 /* The menu can change the font, so restore */
1119 rb->lcd_setfont(FONT_SYSFIXED); 1119 rb->lcd_setfont(FONT_SYSFIXED);
1120 1120
1121 if (result) { 1121 switch (result)
1122 settings.resume_time = (int)(get_stream_time()/CLOCK_RATE/ 1122 {
1123 30-start_pts_time); 1123 case MPEG_MENU_QUIT:
1124 str_send_msg(&video_str, STREAM_QUIT, 0); 1124 settings.resume_time = (int)(get_stream_time()/CLOCK_RATE/
1125 audio_str.status = STREAM_STOPPED; 1125 30-start_pts_time);
1126 } else { 1126 str_send_msg(&video_str, STREAM_QUIT, 0);
1127 audio_str.status = STREAM_PLAYING; 1127 audio_str.status = STREAM_STOPPED;
1128 str_send_msg(&video_str, STREAM_PLAY, 0); 1128 break;
1129 pcm_playback_play_pause(true); 1129 default:
1130 audio_str.status = STREAM_PLAYING;
1131 str_send_msg(&video_str, STREAM_PLAY, 0);
1132 pcm_playback_play_pause(true);
1133 break;
1130 } 1134 }
1131 break; 1135 break;
1132 1136
@@ -2203,7 +2207,8 @@ ssize_t seek_PTS( int in_file, int start_time, int accept_button )
2203enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 2207enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
2204{ 2208{
2205 int status = PLUGIN_ERROR; /* assume failure */ 2209 int status = PLUGIN_ERROR; /* assume failure */
2206 int start_time=-1; 2210 int result;
2211 int start_time = -1;
2207 void* audiobuf; 2212 void* audiobuf;
2208 ssize_t audiosize; 2213 ssize_t audiosize;
2209 int in_file; 2214 int in_file;
@@ -2295,8 +2300,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
2295 rb->lcd_set_foreground(LCD_WHITE); 2300 rb->lcd_set_foreground(LCD_WHITE);
2296 rb->lcd_set_background(LCD_BLACK); 2301 rb->lcd_set_background(LCD_BLACK);
2297#endif 2302#endif
2298 rb->lcd_clear_display();
2299 rb->lcd_update();
2300 2303
2301 init_settings((char*)parameter); 2304 init_settings((char*)parameter);
2302 2305
@@ -2312,10 +2315,21 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
2312 find_end_pts( in_file ); 2315 find_end_pts( in_file );
2313 2316
2314 /* start menu */ 2317 /* start menu */
2315 start_time = mpeg_start_menu(end_pts_time-start_pts_time, in_file); 2318 rb->lcd_clear_display();
2316 if ( start_time == -1 ) 2319 rb->lcd_update();
2317 return 0; 2320 result = mpeg_start_menu(end_pts_time-start_pts_time, in_file);
2318 else if ( start_time < 0 ) 2321
2322 switch (result)
2323 {
2324 case MPEG_START_QUIT:
2325 return 0;
2326 default:
2327 start_time = settings.resume_time;
2328 break;
2329 }
2330
2331 /* basic time checks */
2332 if ( start_time < 0 )
2319 start_time = 0; 2333 start_time = 0;
2320 else if ( start_time > (end_pts_time-start_pts_time) ) 2334 else if ( start_time > (end_pts_time-start_pts_time) )
2321 start_time = (end_pts_time-start_pts_time); 2335 start_time = (end_pts_time-start_pts_time);