1
0
Fork 0
forked from len0rd/rockbox

mpegplayer: A) Replace 'Start Menu' option with 'Resume Settings' 1) Start menu - Always show the start menu 2) Start menu if not completed - show the start menu if playback was interrupted before finishing (equivalent to the previous 'Resume No/Yes' screen) 3) Resume automatically - Always resume immediately with no prompting 4) Play from beginning - Always play file from the beginning. B) Do everything possible at this time to ensure USB connection and power down preserve the resume time. C) Add Settings menu to start menu D) Small OSD erasure drawing tweak.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16061 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2008-01-12 05:45:38 +00:00
parent 41cd44caa7
commit 29775f7bab
4 changed files with 436 additions and 279 deletions

View file

@ -133,7 +133,7 @@ void str_data_notify_received(struct stream *str)
static void stream_mgr_init_state(void)
{
stream_mgr.filename = NULL;
stream_mgr.resume_time = 0;
stream_mgr.resume_time = INVALID_TIMESTAMP;
stream_mgr.seeked = false;
}
@ -341,6 +341,26 @@ static uint32_t stream_seek_intl(uint32_t time, int whence,
return parser_seek_time(time);
}
/* Store the resume time at the last seek/current clock point */
static void stream_remember_resume_time(void)
{
/* Assume invalidity */
stream_mgr.resume_time = 0;
if (stream_can_seek())
{
/* Read the current stream time or the last seeked position */
uint32_t start;
uint32_t time = stream_get_seek_time(&start);
if (time >= str_parser.start_pts && time < str_parser.end_pts)
{
/* Save the current stream time */
stream_mgr.resume_time = time - start;
}
}
}
/* Handle STREAM_OPEN */
void stream_on_open(const char *filename)
{
@ -396,11 +416,11 @@ static void stream_on_play(void)
/* Seek to initial position and set clock to that time */
/* Save the resume time */
start = str_parser.last_seek_time - str_parser.start_pts;
stream_mgr.resume_time = start;
stream_remember_resume_time();
/* Prepare seek to start point */
start = stream_seek_intl(start, SEEK_SET, STREAM_STOPPED, NULL);
start = stream_seek_intl(stream_mgr.resume_time, SEEK_SET,
STREAM_STOPPED, NULL);
/* Sync and start - force buffer fill */
stream_start_playback(start, true);
@ -485,21 +505,8 @@ static void stream_on_stop(bool reply)
/* Pause the clock */
pcm_output_play_pause(false);
/* Assume invalidity */
stream_mgr.resume_time = 0;
if (stream_can_seek())
{
/* Read the current stream time or the last seeked position */
uint32_t start;
uint32_t time = stream_get_seek_time(&start);
if (time >= str_parser.start_pts && time < str_parser.end_pts)
{
/* Save the current stream time */
stream_mgr.resume_time = time - start;
}
}
/* Update the resume time info */
stream_remember_resume_time();
/* Not stopped = paused or playing */
stream_mgr.seeked = false;
@ -555,6 +562,7 @@ static void stream_on_seek(struct stream_seek_data *skd)
}
time = stream_seek_intl(time, whence, stream_mgr.status, &buffer);
stream_remember_resume_time();
if (stream_mgr.status == STREAM_PLAYING)
{