2007-02-14 14:40:24 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2007-07-26 14:23:08 +00:00
|
|
|
* $Id$
|
2007-02-14 14:40:24 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Nicolas Pennequin, Jonathan Gordon
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2007-02-14 14:40:24 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _CUESHEET_H_
|
|
|
|
#define _CUESHEET_H_
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "screens.h"
|
2008-04-28 14:13:13 +00:00
|
|
|
#include "file.h"
|
2008-10-15 06:38:51 +00:00
|
|
|
#include "metadata.h"
|
2007-02-14 14:40:24 +00:00
|
|
|
|
2007-03-29 18:39:04 +00:00
|
|
|
#define MAX_NAME 80 /* Max length of information strings */
|
2007-02-14 14:40:24 +00:00
|
|
|
#define MAX_TRACKS 99 /* Max number of tracks in a cuesheet */
|
|
|
|
|
|
|
|
struct cue_track_info {
|
2007-11-12 12:39:56 +00:00
|
|
|
char title[MAX_NAME*3+1];
|
|
|
|
char performer[MAX_NAME*3+1];
|
|
|
|
char songwriter[MAX_NAME*3+1];
|
2007-02-14 14:40:24 +00:00
|
|
|
unsigned long offset; /* ms from start of track */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cuesheet {
|
|
|
|
char path[MAX_PATH];
|
|
|
|
|
2007-11-12 12:39:56 +00:00
|
|
|
char title[MAX_NAME*3+1];
|
|
|
|
char performer[MAX_NAME*3+1];
|
|
|
|
char songwriter[MAX_NAME*3+1];
|
2007-02-14 14:40:24 +00:00
|
|
|
|
|
|
|
int track_count;
|
|
|
|
struct cue_track_info tracks[MAX_TRACKS];
|
|
|
|
|
|
|
|
int curr_track_idx;
|
|
|
|
struct cue_track_info *curr_track;
|
|
|
|
};
|
|
|
|
|
2011-12-16 10:09:41 +00:00
|
|
|
struct cuesheet_file {
|
|
|
|
char path[MAX_PATH];
|
|
|
|
int size;
|
|
|
|
off_t pos;
|
|
|
|
enum character_encoding encoding;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* looks if there is a cuesheet file with a name matching path of "track_id3" */
|
|
|
|
bool look_for_cuesheet_file(struct mp3entry *track_id3, struct cuesheet_file *cue_file);
|
2007-02-14 14:40:24 +00:00
|
|
|
|
2011-12-16 10:09:41 +00:00
|
|
|
/* parse cuesheet_file "cue_file" and store the information in "cue" */
|
|
|
|
bool parse_cuesheet(struct cuesheet_file *cue_file, struct cuesheet *cue);
|
2007-02-14 14:40:24 +00:00
|
|
|
|
|
|
|
/* reads a cuesheet to find the audio track associated to it */
|
|
|
|
bool get_trackname_from_cuesheet(char *filename, char *buf);
|
|
|
|
|
2007-05-14 17:34:52 +00:00
|
|
|
/* display a cuesheet struct */
|
|
|
|
void browse_cuesheet(struct cuesheet *cue);
|
|
|
|
|
|
|
|
/* display a cuesheet file after parsing and loading it to the plugin buffer */
|
2007-02-14 14:40:24 +00:00
|
|
|
bool display_cuesheet_content(char* filename);
|
|
|
|
|
|
|
|
/* finds the index of the current track played within a cuesheet */
|
|
|
|
int cue_find_current_track(struct cuesheet *cue, unsigned long curpos);
|
|
|
|
|
|
|
|
/* skip to next track in the cuesheet towards "direction" (which is 1 or -1) */
|
2009-07-24 01:13:30 +00:00
|
|
|
bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_pos);
|
2007-02-14 14:40:24 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
/* draw track markers on the progressbar */
|
2009-07-24 01:13:30 +00:00
|
|
|
void cue_draw_markers(struct screen *screen, struct cuesheet *cue,
|
|
|
|
unsigned long tracklen,
|
2010-03-07 12:51:23 +00:00
|
|
|
int x, int y, int w, int h);
|
2007-02-14 14:40:24 +00:00
|
|
|
#endif
|
|
|
|
|
2009-07-20 05:18:18 +00:00
|
|
|
/* check if the subtrack has changed */
|
|
|
|
bool cuesheet_subtrack_changed(struct mp3entry *id3);
|
|
|
|
|
2007-02-14 14:40:24 +00:00
|
|
|
#endif
|