Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

[RFC] REPEAT_ONE manual track skip

I recently added track skipping while REPEAT_ONE was set

currently by registering a track skip callback
I'm not entirely happy with the additional constant overhead
of the event callback

Instead I went looking for a way to distinguish
a pending track skip from some limited testing
it appears to work just as well to compare
playback's skip_pending == TRACK_SKIP_AUTO
but the lack of lifetime control worries me slightly

Change-Id: Ic71b4c3925e991f5a1216d16ecd3af6cc777ef1e

authored by

William Wilgus and committed by
William Wilgus
e01055a2 3dbf5a97

+9 -15
+6
apps/playback.c
··· 3687 3687 audio_queue_send(Q_AUDIO_PAUSE, false); 3688 3688 } 3689 3689 3690 + /* Internal function used by REPEAT_ONE */ 3691 + bool audio_pending_track_skip_is_auto(void) 3692 + { 3693 + return (skip_pending == TRACK_SKIP_AUTO); 3694 + } 3695 + 3690 3696 /* Skip the specified number of tracks forward or backward from the current */ 3691 3697 void audio_skip(int offset) 3692 3698 {
+3 -15
apps/playlist.c
··· 167 167 #define PLAYLIST_SKIPPED 0x10000000 168 168 169 169 static struct playlist_info current_playlist; 170 - /* REPEAT_ONE support functions */ 171 - static long last_manual_skip_tick = 0; 172 - 170 + /* REPEAT_ONE support function from playback.c */ 171 + extern bool audio_pending_track_skip_is_auto(void); 173 172 static inline bool is_manual_skip(void) 174 173 { 175 - return (last_manual_skip_tick + HZ/2 > current_tick); 176 - } 177 - 178 - static void track_change_callback(unsigned short id, void *param) 179 - { 180 - (void)id; 181 - unsigned int flags = ((struct track_event *)param)->flags; 182 - if ((flags & TEF_AUTO_SKIP) != TEF_AUTO_SKIP) 183 - { 184 - last_manual_skip_tick = current_tick; 185 - } 174 + return !audio_pending_track_skip_is_auto(); 186 175 } 187 176 188 177 /* Directory Cache*/ ··· 1985 1974 1986 1975 dc_thread_start(&current_playlist, false); 1987 1976 #endif /* HAVE_DIRCACHE */ 1988 - add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_change_callback); 1989 1977 } 1990 1978 1991 1979 /*