2002-06-04 21:43:38 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by wavey@wavey.org
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __PLAYLIST_H__
|
|
|
|
#define __PLAYLIST_H__
|
|
|
|
|
2002-06-17 10:36:42 +00:00
|
|
|
#include <stdbool.h>
|
2002-07-17 23:23:57 +00:00
|
|
|
#include "file.h"
|
2003-07-01 21:05:43 +00:00
|
|
|
#include "kernel.h"
|
2002-06-17 10:36:42 +00:00
|
|
|
|
2002-06-04 21:43:38 +00:00
|
|
|
/* playlist data */
|
|
|
|
|
2002-08-23 20:04:31 +00:00
|
|
|
struct playlist_info
|
2002-06-04 21:43:38 +00:00
|
|
|
{
|
2002-10-06 05:50:41 +00:00
|
|
|
char filename[MAX_PATH]; /* path name of m3u playlist on disk */
|
2003-07-01 21:05:43 +00:00
|
|
|
int fd; /* descriptor of the open playlist file */
|
|
|
|
int control_fd; /* descriptor of the open control file */
|
2002-08-06 13:09:48 +00:00
|
|
|
int dirlen; /* Length of the path to the playlist file */
|
2003-07-01 21:05:43 +00:00
|
|
|
unsigned int *indices; /* array of indices */
|
|
|
|
int max_playlist_size; /* Max number of files in playlist. Mirror of
|
2003-05-09 16:01:21 +00:00
|
|
|
global_settings.max_files_in_playlist */
|
2003-07-01 21:05:43 +00:00
|
|
|
bool in_ram; /* playlist stored in ram (dirplay) */
|
|
|
|
char *buffer; /* buffer for in-ram playlists */
|
|
|
|
int buffer_size; /* size of buffer */
|
|
|
|
int buffer_end_pos; /* last position where buffer was written */
|
2003-12-09 08:18:03 +00:00
|
|
|
short index; /* index of current playing track */
|
|
|
|
short first_index; /* index of first song in playlist */
|
2002-06-04 21:43:38 +00:00
|
|
|
int amount; /* number of tracks in the index */
|
2003-07-01 21:05:43 +00:00
|
|
|
int last_insert_pos; /* last position we inserted a track */
|
2003-12-09 08:18:03 +00:00
|
|
|
bool shuffle_flush; /* Does shuffle value need to be flushed? */
|
2003-07-01 21:05:43 +00:00
|
|
|
struct mutex control_mutex; /* mutex for control file access */
|
2002-08-23 20:04:31 +00:00
|
|
|
};
|
2002-06-04 21:43:38 +00:00
|
|
|
|
2003-04-24 17:31:36 +00:00
|
|
|
void playlist_init(void);
|
2003-07-01 21:05:43 +00:00
|
|
|
int playlist_create(char *dir, char *file);
|
|
|
|
int playlist_resume(void);
|
2002-08-06 13:09:48 +00:00
|
|
|
int playlist_add(char *filename);
|
2003-07-01 21:05:43 +00:00
|
|
|
int playlist_insert_track(char *filename, int position, bool queue);
|
2003-07-02 15:54:44 +00:00
|
|
|
int playlist_insert_directory(char *dirname, int position, bool queue,
|
|
|
|
bool recurse);
|
2003-07-01 21:05:43 +00:00
|
|
|
int playlist_insert_playlist(char *filename, int position, bool queue);
|
|
|
|
int playlist_delete(int index);
|
|
|
|
int playlist_shuffle(int random_seed, int start_index);
|
|
|
|
int playlist_randomise(unsigned int seed, bool start_current);
|
|
|
|
int playlist_sort(bool start_current);
|
|
|
|
int playlist_start(int start_index, int offset);
|
|
|
|
bool playlist_check(int steps);
|
|
|
|
char *playlist_peek(int steps);
|
|
|
|
int playlist_next(int steps);
|
2003-12-09 08:18:03 +00:00
|
|
|
int playlist_get_resume_info(short *resume_index);
|
2003-07-01 21:05:43 +00:00
|
|
|
int playlist_get_display_index(void);
|
2002-10-09 13:42:59 +00:00
|
|
|
int playlist_amount(void);
|
2003-07-01 21:05:43 +00:00
|
|
|
char *playlist_name(char *buf, int buf_size);
|
|
|
|
int playlist_save(char *filename);
|
2003-01-09 00:55:00 +00:00
|
|
|
|
2003-07-01 21:05:43 +00:00
|
|
|
enum {
|
|
|
|
PLAYLIST_PREPEND = -1,
|
|
|
|
PLAYLIST_INSERT = -2,
|
|
|
|
PLAYLIST_INSERT_LAST = -3,
|
|
|
|
PLAYLIST_INSERT_FIRST = -4
|
|
|
|
};
|
2002-06-04 21:43:38 +00:00
|
|
|
|
|
|
|
#endif /* __PLAYLIST_H__ */
|