diff options
Diffstat (limited to 'apps/playlist.h')
-rw-r--r-- | apps/playlist.h | 66 |
1 files changed, 46 insertions, 20 deletions
diff --git a/apps/playlist.h b/apps/playlist.h index 286823e0cf..3aa5406a51 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -25,7 +25,44 @@ | |||
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "id3.h" | 26 | #include "id3.h" |
27 | 27 | ||
28 | /* playlist data */ | 28 | #define PLAYLIST_ATTR_QUEUED 0x01 |
29 | #define PLAYLIST_ATTR_INSERTED 0x02 | ||
30 | #define PLAYLIST_ATTR_SKIPPED 0x04 | ||
31 | #define PLAYLIST_MAX_CACHE 16 | ||
32 | |||
33 | #define DEFAULT_DYNAMIC_PLAYLIST_NAME "/dynamic.m3u" | ||
34 | |||
35 | enum playlist_command { | ||
36 | PLAYLIST_COMMAND_PLAYLIST, | ||
37 | PLAYLIST_COMMAND_ADD, | ||
38 | PLAYLIST_COMMAND_QUEUE, | ||
39 | PLAYLIST_COMMAND_DELETE, | ||
40 | PLAYLIST_COMMAND_SHUFFLE, | ||
41 | PLAYLIST_COMMAND_UNSHUFFLE, | ||
42 | PLAYLIST_COMMAND_RESET, | ||
43 | PLAYLIST_COMMAND_COMMENT | ||
44 | }; | ||
45 | |||
46 | enum { | ||
47 | PLAYLIST_PREPEND = -1, | ||
48 | PLAYLIST_INSERT = -2, | ||
49 | PLAYLIST_INSERT_LAST = -3, | ||
50 | PLAYLIST_INSERT_FIRST = -4, | ||
51 | PLAYLIST_INSERT_SHUFFLED = -5 | ||
52 | }; | ||
53 | |||
54 | enum { | ||
55 | PLAYLIST_DELETE_CURRENT = -1 | ||
56 | }; | ||
57 | |||
58 | struct playlist_control_cache { | ||
59 | enum playlist_command command; | ||
60 | int i1; | ||
61 | int i2; | ||
62 | const char* s1; | ||
63 | const char* s2; | ||
64 | void* data; | ||
65 | }; | ||
29 | 66 | ||
30 | struct playlist_info | 67 | struct playlist_info |
31 | { | 68 | { |
@@ -53,15 +90,15 @@ struct playlist_info | |||
53 | inserted tracks? */ | 90 | inserted tracks? */ |
54 | bool deleted; /* have any tracks been deleted? */ | 91 | bool deleted; /* have any tracks been deleted? */ |
55 | int num_inserted_tracks; /* number of tracks inserted */ | 92 | int num_inserted_tracks; /* number of tracks inserted */ |
56 | bool shuffle_flush; /* does shuffle value need to be flushed? */ | ||
57 | struct mutex control_mutex; /* mutex for control file access */ | ||
58 | }; | ||
59 | 93 | ||
60 | #define PLAYLIST_ATTR_QUEUED 0x01 | 94 | /* cache of playlist control commands waiting to be flushed to |
61 | #define PLAYLIST_ATTR_INSERTED 0x02 | 95 | to disk */ |
62 | #define PLAYLIST_ATTR_SKIPPED 0x04 | 96 | struct playlist_control_cache control_cache[PLAYLIST_MAX_CACHE]; |
97 | int num_cached; /* number of cached entries */ | ||
98 | bool pending_control_sync; /* control file needs to be synced */ | ||
63 | 99 | ||
64 | #define DEFAULT_DYNAMIC_PLAYLIST_NAME "/dynamic.m3u" | 100 | struct mutex control_mutex; /* mutex for control file access */ |
101 | }; | ||
65 | 102 | ||
66 | struct playlist_track_info | 103 | struct playlist_track_info |
67 | { | 104 | { |
@@ -73,6 +110,7 @@ struct playlist_track_info | |||
73 | 110 | ||
74 | /* Exported functions only for current playlist. */ | 111 | /* Exported functions only for current playlist. */ |
75 | void playlist_init(void); | 112 | void playlist_init(void); |
113 | void playlist_shutdown(void); | ||
76 | int playlist_create(const char *dir, const char *file); | 114 | int playlist_create(const char *dir, const char *file); |
77 | int playlist_resume(void); | 115 | int playlist_resume(void); |
78 | int playlist_add(const char *filename); | 116 | int playlist_add(const char *filename); |
@@ -120,16 +158,4 @@ int playlist_get_track_info(struct playlist_info* playlist, int index, | |||
120 | struct playlist_track_info* info); | 158 | struct playlist_track_info* info); |
121 | int playlist_save(struct playlist_info* playlist, char *filename); | 159 | int playlist_save(struct playlist_info* playlist, char *filename); |
122 | 160 | ||
123 | enum { | ||
124 | PLAYLIST_PREPEND = -1, | ||
125 | PLAYLIST_INSERT = -2, | ||
126 | PLAYLIST_INSERT_LAST = -3, | ||
127 | PLAYLIST_INSERT_FIRST = -4, | ||
128 | PLAYLIST_INSERT_SHUFFLED = -5 | ||
129 | }; | ||
130 | |||
131 | enum { | ||
132 | PLAYLIST_DELETE_CURRENT = -1 | ||
133 | }; | ||
134 | |||
135 | #endif /* __PLAYLIST_H__ */ | 161 | #endif /* __PLAYLIST_H__ */ |