summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist.c')
-rwxr-xr-xapps/playlist.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 9c895bfd67..0e73781238 100755
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -621,7 +621,7 @@ static int create_and_play_dir(int direction, bool play_last)
621#if (CONFIG_CODEC == SWCODEC) 621#if (CONFIG_CODEC == SWCODEC)
622 current_playlist.started = true; 622 current_playlist.started = true;
623#else 623#else
624 playlist_start(index, 0); 624 playlist_start(index, 0, 0);
625#endif 625#endif
626 } 626 }
627 627
@@ -2565,7 +2565,8 @@ unsigned int playlist_get_filename_crc32(struct playlist_info *playlist,
2565} 2565}
2566 2566
2567/* resume a playlist track with the given crc_32 of the track name. */ 2567/* resume a playlist track with the given crc_32 of the track name. */
2568void playlist_resume_track(int start_index, unsigned int crc, int offset) 2568void playlist_resume_track(int start_index, unsigned int crc,
2569 unsigned long elapsed, unsigned long offset)
2569{ 2570{
2570 int i; 2571 int i;
2571 unsigned int tmp_crc; 2572 unsigned int tmp_crc;
@@ -2573,7 +2574,7 @@ void playlist_resume_track(int start_index, unsigned int crc, int offset)
2573 tmp_crc = playlist_get_filename_crc32(playlist, start_index); 2574 tmp_crc = playlist_get_filename_crc32(playlist, start_index);
2574 if (tmp_crc == crc) 2575 if (tmp_crc == crc)
2575 { 2576 {
2576 playlist_start(start_index, offset); 2577 playlist_start(start_index, elapsed, offset);
2577 return; 2578 return;
2578 } 2579 }
2579 2580
@@ -2582,17 +2583,18 @@ void playlist_resume_track(int start_index, unsigned int crc, int offset)
2582 tmp_crc = playlist_get_filename_crc32(playlist, i); 2583 tmp_crc = playlist_get_filename_crc32(playlist, i);
2583 if (tmp_crc == crc) 2584 if (tmp_crc == crc)
2584 { 2585 {
2585 playlist_start(i, offset); 2586 playlist_start(i, elapsed, offset);
2586 return; 2587 return;
2587 } 2588 }
2588 } 2589 }
2589 2590
2590 /* If we got here the file wasnt found, so start from the beginning */ 2591 /* If we got here the file wasnt found, so start from the beginning */
2591 playlist_start(0,0); 2592 playlist_start(0, 0, 0);
2592} 2593}
2593 2594
2594/* start playing current playlist at specified index/offset */ 2595/* start playing current playlist at specified index/offset */
2595void playlist_start(int start_index, int offset) 2596void playlist_start(int start_index, unsigned long elapsed,
2597 unsigned long offset)
2596{ 2598{
2597 struct playlist_info* playlist = &current_playlist; 2599 struct playlist_info* playlist = &current_playlist;
2598 2600
@@ -2605,7 +2607,7 @@ void playlist_start(int start_index, int offset)
2605 2607
2606 playlist->started = true; 2608 playlist->started = true;
2607 sync_control(playlist, false); 2609 sync_control(playlist, false);
2608 audio_play(offset); 2610 audio_play(elapsed, offset);
2609} 2611}
2610 2612
2611/* Returns false if 'steps' is out of bounds, else true */ 2613/* Returns false if 'steps' is out of bounds, else true */
@@ -2723,7 +2725,7 @@ int playlist_next(int steps)
2723#if CONFIG_CODEC == SWCODEC 2725#if CONFIG_CODEC == SWCODEC
2724 playlist->started = true; 2726 playlist->started = true;
2725#else 2727#else
2726 playlist_start(0, 0); 2728 playlist_start(0, 0, 0);
2727#endif 2729#endif
2728 playlist->index = 0; 2730 playlist->index = 0;
2729 index = 0; 2731 index = 0;
@@ -2801,11 +2803,13 @@ int playlist_update_resume_info(const struct mp3entry* id3)
2801 if (id3) 2803 if (id3)
2802 { 2804 {
2803 if (global_status.resume_index != playlist->index || 2805 if (global_status.resume_index != playlist->index ||
2806 global_status.resume_elapsed != id3->elapsed ||
2804 global_status.resume_offset != id3->offset) 2807 global_status.resume_offset != id3->offset)
2805 { 2808 {
2806 unsigned int crc = crc_32(id3->path, strlen(id3->path), -1); 2809 unsigned int crc = crc_32(id3->path, strlen(id3->path), -1);
2807 global_status.resume_index = playlist->index; 2810 global_status.resume_index = playlist->index;
2808 global_status.resume_crc32 = crc; 2811 global_status.resume_crc32 = crc;
2812 global_status.resume_elapsed = id3->elapsed;
2809 global_status.resume_offset = id3->offset; 2813 global_status.resume_offset = id3->offset;
2810 status_save(); 2814 status_save();
2811 } 2815 }
@@ -2814,6 +2818,7 @@ int playlist_update_resume_info(const struct mp3entry* id3)
2814 { 2818 {
2815 global_status.resume_index = -1; 2819 global_status.resume_index = -1;
2816 global_status.resume_crc32 = -1; 2820 global_status.resume_crc32 = -1;
2821 global_status.resume_elapsed = -1;
2817 global_status.resume_offset = -1; 2822 global_status.resume_offset = -1;
2818 status_save(); 2823 status_save();
2819 } 2824 }