A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 90 lines 3.1 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * $Id$ 9 * 10 * Copyright (C) 2007 Nicolas Pennequin, Jonathan Gordon 11 * 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; either version 2 15 * of the License, or (at your option) any later version. 16 * 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 * KIND, either express or implied. 19 * 20 ****************************************************************************/ 21 22#ifndef _CUESHEET_H_ 23#define _CUESHEET_H_ 24 25#include <stdbool.h> 26#include "screens.h" 27#include "file.h" 28#include "metadata.h" 29 30#define MAX_NAME 80 /* Max length of information strings */ 31#define MAX_TRACKS 99 /* Max number of tracks in a cuesheet */ 32 33struct cue_track_info { 34 char title[MAX_NAME*3+1]; 35 char performer[MAX_NAME*3+1]; 36 char songwriter[MAX_NAME*3+1]; 37 unsigned long offset; /* ms from start of track */ 38}; 39 40struct cuesheet { 41 char path[MAX_PATH]; 42 char file[MAX_PATH]; 43 char title[MAX_NAME*3+1]; 44 char performer[MAX_NAME*3+1]; 45 char songwriter[MAX_NAME*3+1]; 46 47 int track_count; 48 struct cue_track_info tracks[MAX_TRACKS]; 49 50 int curr_track_idx; 51 struct cue_track_info *curr_track; 52}; 53 54struct cuesheet_file { 55 char path[MAX_PATH]; 56 int size; 57 off_t pos; 58 enum character_encoding encoding; 59}; 60 61/* looks if there is a cuesheet file with a name matching path of "track_id3" */ 62bool look_for_cuesheet_file(struct mp3entry *track_id3, struct cuesheet_file *cue_file); 63 64/* parse cuesheet_file "cue_file" and store the information in "cue" */ 65bool parse_cuesheet(struct cuesheet_file *cue_file, struct cuesheet *cue); 66 67/* reads a cuesheet to find the audio track associated to it */ 68bool get_trackname_from_cuesheet(char *filename, char *buf); 69 70/* display a cuesheet struct */ 71void browse_cuesheet(struct cuesheet *cue); 72 73/* display a cuesheet file after parsing and loading it to the plugin buffer */ 74bool display_cuesheet_content(char* filename); 75 76/* finds the index of the current track played within a cuesheet */ 77int cue_find_current_track(struct cuesheet *cue, unsigned long curpos); 78 79/* skip to next track in the cuesheet towards "direction" (which is 1 or -1) */ 80bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_pos); 81 82/* draw track markers on the progressbar */ 83void cue_draw_markers(struct screen *screen, struct cuesheet *cue, 84 unsigned long tracklen, 85 int x, int y, int w, int h); 86 87/* check if the subtrack has changed */ 88bool cuesheet_subtrack_changed(struct mp3entry *id3); 89 90#endif