diff options
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 81265813c4..e0a2b9ba6e 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -888,25 +888,6 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current, | |||
888 | return 0; | 888 | return 0; |
889 | } | 889 | } |
890 | 890 | ||
891 | /* Marks the index of the track to be skipped that is "steps" away from | ||
892 | * current playing track. | ||
893 | */ | ||
894 | void playlist_skip_entry(struct playlist_info *playlist, int steps) | ||
895 | { | ||
896 | int index; | ||
897 | |||
898 | if (playlist == NULL) | ||
899 | playlist = ¤t_playlist; | ||
900 | |||
901 | index = rotate_index(playlist, playlist->index); | ||
902 | index += steps; | ||
903 | if (index < 0 || index >= playlist->amount) | ||
904 | return ; | ||
905 | |||
906 | index = (index+playlist->first_index) % playlist->amount; | ||
907 | playlist->indices[index] |= PLAYLIST_SKIPPED; | ||
908 | } | ||
909 | |||
910 | /* Calculate how many steps we have to really step when skipping entries | 891 | /* Calculate how many steps we have to really step when skipping entries |
911 | * marked as bad. | 892 | * marked as bad. |
912 | */ | 893 | */ |
@@ -953,6 +934,25 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps) | |||
953 | return steps; | 934 | return steps; |
954 | } | 935 | } |
955 | 936 | ||
937 | /* Marks the index of the track to be skipped that is "steps" away from | ||
938 | * current playing track. | ||
939 | */ | ||
940 | void playlist_skip_entry(struct playlist_info *playlist, int steps) | ||
941 | { | ||
942 | int index; | ||
943 | |||
944 | if (playlist == NULL) | ||
945 | playlist = ¤t_playlist; | ||
946 | |||
947 | index = rotate_index(playlist, playlist->index); | ||
948 | /* We should also skip already skipped entries before the entry to be skipepd. */ | ||
949 | index += calculate_step_count(playlist, steps); | ||
950 | if (index < 0 || index >= playlist->amount) | ||
951 | return ; | ||
952 | |||
953 | index = (index+playlist->first_index) % playlist->amount; | ||
954 | playlist->indices[index] |= PLAYLIST_SKIPPED; | ||
955 | } | ||
956 | 956 | ||
957 | /* | 957 | /* |
958 | * returns the index of the track that is "steps" away from current playing | 958 | * returns the index of the track that is "steps" away from current playing |