diff --git a/apps/playback.c b/apps/playback.c index b662d0329b..1f0492544a 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -867,6 +867,7 @@ bool loadcodec(const char *trackname, bool start_play) int prev_track; filetype = probe_file_format(trackname); + switch (filetype) { case AFMT_OGG_VORBIS: logf("Codec: Vorbis"); @@ -915,12 +916,11 @@ bool loadcodec(const char *trackname, bool start_play) snprintf(msgbuf, sizeof(msgbuf)-1, "No codec for: %s", trackname); gui_syncsplash(HZ*2, true, msgbuf); codec_path = NULL; + return false; } tracks[track_widx].id3.codectype = filetype; tracks[track_widx].codecsize = 0; - if (codec_path == NULL) - return false; if (!start_play) { prev_track = track_widx - 1; @@ -1094,11 +1094,10 @@ bool audio_load_track(int offset, bool start_play, int peek_offset) tracks[track_widx].codecbuf = &filebuf[buf_widx]; if (!loadcodec(trackname, start_play)) { close(fd); - /* Stop buffer filling if codec load failed. */ - fill_bytesleft = 0; /* Set filesize to zero to indicate no file was loaded. */ tracks[track_widx].filesize = 0; tracks[track_widx].filerem = 0; + tracks[track_widx].taginfo_ready = false; /* Try skipping to next track. */ if (fill_bytesleft > 0) { diff --git a/apps/playlist.c b/apps/playlist.c index 694caab3c0..9a132e02f8 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -582,7 +582,6 @@ static int add_track_to_playlist(struct playlist_info* playlist, #ifdef HAVE_DIRCACHE if (playlist->filenames) playlist->filenames[insert_position] = NULL; - queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); #endif playlist->amount++; @@ -917,22 +916,15 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps) int index; int stepped_count = 0; + count = steps; if (steps < 0) - { direction = -1; - count = -steps; - } else - { direction = 1; - count = steps; - } index = playlist->index; i = 0; - while (i < count) - { - index += direction; + do { /* Boundary check */ if (index < 0) index += playlist->amount; @@ -949,7 +941,9 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps) } else i++; - } + + index += direction; + } while (i < count); return steps; } @@ -1693,6 +1687,7 @@ int playlist_resume(void) empty_playlist(playlist, true); + gui_syncsplash(0, true, str(LANG_WAIT)); playlist->control_fd = open(playlist->control_filename, O_RDWR); if (playlist->control_fd < 0) { @@ -1810,7 +1805,7 @@ int playlist_resume(void) buffer */ if (add_track_to_playlist(playlist, str3, position, queue, total_read+(str3-buffer)) < 0) - return -1; + return -1; playlist->last_insert_pos = last_position; @@ -2041,6 +2036,10 @@ int playlist_resume(void) } } +#ifdef HAVE_DIRCACHE + queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); +#endif + return 0; } @@ -2582,6 +2581,10 @@ int playlist_insert_track(struct playlist_info* playlist, audio_flush_and_reload_tracks(); } +#ifdef HAVE_DIRCACHE + queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); +#endif + return result; } @@ -2624,6 +2627,10 @@ int playlist_insert_directory(struct playlist_info* playlist, if (audio_status() & AUDIO_STATUS_PLAY) audio_flush_and_reload_tracks(); +#ifdef HAVE_DIRCACHE + queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); +#endif + return result; } @@ -2738,6 +2745,10 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename, if (audio_status() & AUDIO_STATUS_PLAY) audio_flush_and_reload_tracks(); +#ifdef HAVE_DIRCACHE + queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); +#endif + return result; } @@ -2860,6 +2871,10 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index) } } +#ifdef HAVE_DIRCACHE + queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); +#endif + return result; }