diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playback.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/apps/playback.c b/apps/playback.c index ad7075eaf9..031e981915 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -1255,8 +1255,7 @@ static void audio_update_and_announce_next_track(const struct mp3entry *id3_next | |||
1255 | 1255 | ||
1256 | /* Bring the user current mp3entry up to date and set a new offset for the | 1256 | /* Bring the user current mp3entry up to date and set a new offset for the |
1257 | buffered metadata */ | 1257 | buffered metadata */ |
1258 | static void playing_id3_sync(struct track_info *user_infop, | 1258 | static void playing_id3_sync(struct track_info *user_infop, struct audio_resume_info *resume_info) |
1259 | unsigned long elapsed, unsigned long offset) | ||
1260 | { | 1259 | { |
1261 | id3_mutex_lock(); | 1260 | id3_mutex_lock(); |
1262 | 1261 | ||
@@ -1264,16 +1263,18 @@ static void playing_id3_sync(struct track_info *user_infop, | |||
1264 | 1263 | ||
1265 | pcm_play_lock(); | 1264 | pcm_play_lock(); |
1266 | 1265 | ||
1267 | if (id3) | 1266 | if (resume_info && id3) |
1268 | { | 1267 | { |
1269 | if (elapsed != (unsigned long)-1) | 1268 | id3->elapsed = resume_info->elapsed; |
1270 | id3->elapsed = elapsed; | 1269 | id3->offset = resume_info->offset; |
1271 | |||
1272 | if (offset != (unsigned long)-1) | ||
1273 | id3->offset = offset; | ||
1274 | } | 1270 | } |
1275 | id3_write(PLAYING_ID3, id3); | 1271 | id3_write(PLAYING_ID3, id3); |
1276 | 1272 | ||
1273 | if (!resume_info && id3) | ||
1274 | { | ||
1275 | id3->offset = 0; | ||
1276 | id3->elapsed = 0; | ||
1277 | } | ||
1277 | pcm_play_unlock(); | 1278 | pcm_play_unlock(); |
1278 | 1279 | ||
1279 | id3_mutex_unlock(); | 1280 | id3_mutex_unlock(); |
@@ -2433,7 +2434,7 @@ static void audio_on_finish_load_track(int id3_hid) | |||
2433 | change otherwise */ | 2434 | change otherwise */ |
2434 | bool was_valid = valid_mp3entry(id3_get(PLAYING_ID3)); | 2435 | bool was_valid = valid_mp3entry(id3_get(PLAYING_ID3)); |
2435 | 2436 | ||
2436 | playing_id3_sync(&info, -1, -1); | 2437 | playing_id3_sync(&info, NULL); |
2437 | 2438 | ||
2438 | if (!was_valid) | 2439 | if (!was_valid) |
2439 | { | 2440 | { |
@@ -2626,7 +2627,7 @@ static void audio_begin_track_change(enum pcm_track_change_type type, | |||
2626 | if (audio_start_codec(!track_skip_is_manual)) | 2627 | if (audio_start_codec(!track_skip_is_manual)) |
2627 | { | 2628 | { |
2628 | if (track_skip_is_manual) | 2629 | if (track_skip_is_manual) |
2629 | playing_id3_sync(&info, -1, -1); | 2630 | playing_id3_sync(&info, NULL); |
2630 | return; | 2631 | return; |
2631 | } | 2632 | } |
2632 | } | 2633 | } |
@@ -2903,7 +2904,7 @@ static void audio_start_playback(const struct audio_resume_info *resume_info, | |||
2903 | /* This is the currently playing track - get metadata, stat */ | 2904 | /* This is the currently playing track - get metadata, stat */ |
2904 | struct track_info info; | 2905 | struct track_info info; |
2905 | track_list_current(0, &info); | 2906 | track_list_current(0, &info); |
2906 | playing_id3_sync(&info, resume.elapsed, resume.offset); | 2907 | playing_id3_sync(&info, &resume); |
2907 | 2908 | ||
2908 | if (valid_mp3entry(id3_get(PLAYING_ID3))) | 2909 | if (valid_mp3entry(id3_get(PLAYING_ID3))) |
2909 | { | 2910 | { |