summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/playback.c7
-rw-r--r--apps/playlist.c39
2 files changed, 30 insertions, 16 deletions
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)
867 int prev_track; 867 int prev_track;
868 868
869 filetype = probe_file_format(trackname); 869 filetype = probe_file_format(trackname);
870
870 switch (filetype) { 871 switch (filetype) {
871 case AFMT_OGG_VORBIS: 872 case AFMT_OGG_VORBIS:
872 logf("Codec: Vorbis"); 873 logf("Codec: Vorbis");
@@ -915,12 +916,11 @@ bool loadcodec(const char *trackname, bool start_play)
915 snprintf(msgbuf, sizeof(msgbuf)-1, "No codec for: %s", trackname); 916 snprintf(msgbuf, sizeof(msgbuf)-1, "No codec for: %s", trackname);
916 gui_syncsplash(HZ*2, true, msgbuf); 917 gui_syncsplash(HZ*2, true, msgbuf);
917 codec_path = NULL; 918 codec_path = NULL;
919 return false;
918 } 920 }
919 921
920 tracks[track_widx].id3.codectype = filetype; 922 tracks[track_widx].id3.codectype = filetype;
921 tracks[track_widx].codecsize = 0; 923 tracks[track_widx].codecsize = 0;
922 if (codec_path == NULL)
923 return false;
924 924
925 if (!start_play) { 925 if (!start_play) {
926 prev_track = track_widx - 1; 926 prev_track = track_widx - 1;
@@ -1094,11 +1094,10 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
1094 tracks[track_widx].codecbuf = &filebuf[buf_widx]; 1094 tracks[track_widx].codecbuf = &filebuf[buf_widx];
1095 if (!loadcodec(trackname, start_play)) { 1095 if (!loadcodec(trackname, start_play)) {
1096 close(fd); 1096 close(fd);
1097 /* Stop buffer filling if codec load failed. */
1098 fill_bytesleft = 0;
1099 /* Set filesize to zero to indicate no file was loaded. */ 1097 /* Set filesize to zero to indicate no file was loaded. */
1100 tracks[track_widx].filesize = 0; 1098 tracks[track_widx].filesize = 0;
1101 tracks[track_widx].filerem = 0; 1099 tracks[track_widx].filerem = 0;
1100 tracks[track_widx].taginfo_ready = false;
1102 1101
1103 /* Try skipping to next track. */ 1102 /* Try skipping to next track. */
1104 if (fill_bytesleft > 0) { 1103 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,
582#ifdef HAVE_DIRCACHE 582#ifdef HAVE_DIRCACHE
583 if (playlist->filenames) 583 if (playlist->filenames)
584 playlist->filenames[insert_position] = NULL; 584 playlist->filenames[insert_position] = NULL;
585 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
586#endif 585#endif
587 586
588 playlist->amount++; 587 playlist->amount++;
@@ -917,22 +916,15 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps)
917 int index; 916 int index;
918 int stepped_count = 0; 917 int stepped_count = 0;
919 918
919 count = steps;
920 if (steps < 0) 920 if (steps < 0)
921 {
922 direction = -1; 921 direction = -1;
923 count = -steps;
924 }
925 else 922 else
926 {
927 direction = 1; 923 direction = 1;
928 count = steps;
929 }
930 924
931 index = playlist->index; 925 index = playlist->index;
932 i = 0; 926 i = 0;
933 while (i < count) 927 do {
934 {
935 index += direction;
936 /* Boundary check */ 928 /* Boundary check */
937 if (index < 0) 929 if (index < 0)
938 index += playlist->amount; 930 index += playlist->amount;
@@ -949,7 +941,9 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps)
949 } 941 }
950 else 942 else
951 i++; 943 i++;
952 } 944
945 index += direction;
946 } while (i < count);
953 947
954 return steps; 948 return steps;
955} 949}
@@ -1693,6 +1687,7 @@ int playlist_resume(void)
1693 1687
1694 empty_playlist(playlist, true); 1688 empty_playlist(playlist, true);
1695 1689
1690 gui_syncsplash(0, true, str(LANG_WAIT));
1696 playlist->control_fd = open(playlist->control_filename, O_RDWR); 1691 playlist->control_fd = open(playlist->control_filename, O_RDWR);
1697 if (playlist->control_fd < 0) 1692 if (playlist->control_fd < 0)
1698 { 1693 {
@@ -1810,7 +1805,7 @@ int playlist_resume(void)
1810 buffer */ 1805 buffer */
1811 if (add_track_to_playlist(playlist, str3, position, 1806 if (add_track_to_playlist(playlist, str3, position,
1812 queue, total_read+(str3-buffer)) < 0) 1807 queue, total_read+(str3-buffer)) < 0)
1813 return -1; 1808 return -1;
1814 1809
1815 playlist->last_insert_pos = last_position; 1810 playlist->last_insert_pos = last_position;
1816 1811
@@ -2041,6 +2036,10 @@ int playlist_resume(void)
2041 } 2036 }
2042 } 2037 }
2043 2038
2039#ifdef HAVE_DIRCACHE
2040 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2041#endif
2042
2044 return 0; 2043 return 0;
2045} 2044}
2046 2045
@@ -2582,6 +2581,10 @@ int playlist_insert_track(struct playlist_info* playlist,
2582 audio_flush_and_reload_tracks(); 2581 audio_flush_and_reload_tracks();
2583 } 2582 }
2584 2583
2584#ifdef HAVE_DIRCACHE
2585 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2586#endif
2587
2585 return result; 2588 return result;
2586} 2589}
2587 2590
@@ -2624,6 +2627,10 @@ int playlist_insert_directory(struct playlist_info* playlist,
2624 if (audio_status() & AUDIO_STATUS_PLAY) 2627 if (audio_status() & AUDIO_STATUS_PLAY)
2625 audio_flush_and_reload_tracks(); 2628 audio_flush_and_reload_tracks();
2626 2629
2630#ifdef HAVE_DIRCACHE
2631 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2632#endif
2633
2627 return result; 2634 return result;
2628} 2635}
2629 2636
@@ -2738,6 +2745,10 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
2738 if (audio_status() & AUDIO_STATUS_PLAY) 2745 if (audio_status() & AUDIO_STATUS_PLAY)
2739 audio_flush_and_reload_tracks(); 2746 audio_flush_and_reload_tracks();
2740 2747
2748#ifdef HAVE_DIRCACHE
2749 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2750#endif
2751
2741 return result; 2752 return result;
2742} 2753}
2743 2754
@@ -2860,6 +2871,10 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
2860 } 2871 }
2861 } 2872 }
2862 2873
2874#ifdef HAVE_DIRCACHE
2875 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2876#endif
2877
2863 return result; 2878 return result;
2864} 2879}
2865 2880