Debian Codegraph @

src/playlist.h

raw symbols SCIP
1 /*
2 * Copyright (c) 2007 Moritz Grimm <[email protected]>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef __PLAYLIST_H__
18 #define __PLAYLIST_H__
19
20 typedef struct playlist * playlist_t;
21
22 /*
23 * Initialize the playlist routines. Should be called before any of the other
24 * playlist functions.
25 */
26 int playlist_init(void);
27
28 /*
29 * Clean up for clean shutdowns. No-op at the moment.
30 */
31 void playlist_exit(void);
32
33 /*
34 * Read a playlist file (in .M3U format), and return a new playlist handler
35 * on success, or NULL on failure.
36 */
37 playlist_t playlist_read(const char * /* filename */);
38
39 /*
40 * For each call to playlist_get_next(), the specified program is run. This
41 * program is supposed to print one line to standard output, containing the
42 * path and filename of a media file.
43 */
44 playlist_t playlist_program(const char * /* program name */);
45
46 /*
47 * Free all memory used by a playlist handler that was created with
48 * playlist_read().
49 */
50 void playlist_free(playlist_t *);
51
52 /*
53 * Get the next item in the playlist. Returns a NUL-terminated string of a
54 * playlist entry, or NULL if the end of the list has been reached.
55 */
56 const char * playlist_get_next(playlist_t);
57
58 /*
59 * The functions below work on playlist handlers obtained with playlist_read()
60 * and are no-ops (i.e. return failure) for playlists from playlist_program().
61 */
62
63 /*
64 * Skip the playlist item that would be played next.
65 */
66 void playlist_skip_next(playlist_t);
67
68 /*
69 * Get the number of items in the playlist.
70 */
71 unsigned long playlist_get_num_items(playlist_t);
72
73 /*
74 * Get the current position in the playlist.
75 */
76 unsigned long playlist_get_position(playlist_t);
77
78 /*
79 * Search for a given entry in the playlist and reposition to it. Returns 1 on
80 * success and 0 on failure. A subsequent call to playlist_get_next() will
81 * return this list item again.
82 */
83 int playlist_goto_entry(playlist_t, const char * /* name */);
84
85 /*
86 * Rewind the playlist to the beginning, so that it can be replayed. Does
87 * not reread the playlist file.
88 */
89 void playlist_rewind(playlist_t);
90
91 /*
92 * Reread the playlist file and rewind to the beginning. Equivalent to calling
93 * playlist_free() and playlist_read(). Entries will no longer be shuffled
94 * after calling this function.
95 * Returns 1 on success, and 0 on error.
96 */
97 int playlist_reread(playlist_t *);
98
99 /*
100 * Shuffle the entries of the playlist randomly.
101 */
102 void playlist_shuffle(playlist_t);
103
104 #endif /* __PLAYLIST_H__ */