Added Benjamin Metzlers bookmarking feature (patch #669440)
[kugel-rb.git] / apps / playlist.h
blob020d3332cb1723ebf295121dc2aed85050cfdb69
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by wavey@wavey.org
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef __PLAYLIST_H__
21 #define __PLAYLIST_H__
23 #include <stdbool.h>
24 #include "file.h"
25 #include "kernel.h"
27 /* playlist data */
29 struct playlist_info
31 char filename[MAX_PATH]; /* path name of m3u playlist on disk */
32 int fd; /* descriptor of the open playlist file */
33 int control_fd; /* descriptor of the open control file */
34 int dirlen; /* Length of the path to the playlist file */
35 unsigned int *indices; /* array of indices */
36 int max_playlist_size; /* Max number of files in playlist. Mirror of
37 global_settings.max_files_in_playlist */
38 bool in_ram; /* playlist stored in ram (dirplay) */
39 char *buffer; /* buffer for in-ram playlists */
40 int buffer_size; /* size of buffer */
41 int buffer_end_pos; /* last position where buffer was written */
42 int index; /* index of current playing track */
43 int first_index; /* index of first song in playlist */
44 int amount; /* number of tracks in the index */
45 int last_insert_pos; /* last position we inserted a track */
46 int seed; /* shuffle seed */
47 bool shuffle_modified; /* has playlist been shuffled with
48 inserted tracks? */
49 bool deleted; /* have any tracks been deleted? */
50 int num_inserted_tracks; /* number of tracks inserted */
51 bool shuffle_flush; /* does shuffle value need to be flushed? */
52 struct mutex control_mutex; /* mutex for control file access */
55 #define PLAYLIST_ATTR_QUEUED 0x01
56 #define PLAYLIST_ATTR_INSERTED 0x02
58 struct playlist_track_info
60 char filename[MAX_PATH]; /* path name of mp3 file */
61 int attr; /* playlist attributes for track */
62 int index; /* index of track in playlist */
63 int display_index; /* index of track for display */
66 void playlist_init(void);
67 int playlist_create(char *dir, char *file);
68 int playlist_resume(void);
69 int playlist_add(char *filename);
70 int playlist_insert_track(char *filename, int position, bool queue);
71 int playlist_insert_directory(char *dirname, int position, bool queue,
72 bool recurse);
73 int playlist_insert_playlist(char *filename, int position, bool queue);
74 int playlist_delete(int index);
75 int playlist_move(int index, int new_index);
76 int playlist_shuffle(int random_seed, int start_index);
77 int playlist_randomise(unsigned int seed, bool start_current);
78 int playlist_sort(bool start_current);
79 int playlist_start(int start_index, int offset);
80 bool playlist_check(int steps);
81 char *playlist_peek(int steps);
82 int playlist_next(int steps);
83 int playlist_get_resume_info(int *resume_index);
84 int playlist_get_display_index(void);
85 int playlist_get_first_index(void);
86 int playlist_amount(void);
87 char *playlist_name(char *buf, int buf_size);
88 int playlist_get_track_info(int index, struct playlist_track_info* info);
89 int playlist_save(char *filename);
90 int playlist_get_seed(void);
91 char *playlist_get_name(char *buf, int buf_size);
92 bool playlist_modified(void);
94 enum {
95 PLAYLIST_PREPEND = -1,
96 PLAYLIST_INSERT = -2,
97 PLAYLIST_INSERT_LAST = -3,
98 PLAYLIST_INSERT_FIRST = -4
101 enum {
102 PLAYLIST_DELETE_CURRENT = -1
105 #endif /* __PLAYLIST_H__ */