Index: apps/codecs.h =================================================================== --- apps/codecs.h (revision 13533) +++ apps/codecs.h (working copy) @@ -81,12 +81,12 @@ #define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ /* increase this every time the api struct changes */ -#define CODEC_API_VERSION 18 +#define CODEC_API_VERSION 19 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define CODEC_MIN_API_VERSION 18 +#define CODEC_MIN_API_VERSION 19 /* codec return codes */ enum codec_status { Index: apps/playback.h =================================================================== --- apps/playback.h (revision 13533) +++ apps/playback.h (working copy) @@ -39,21 +39,28 @@ #define MAX_TRACK_MASK (MAX_TRACK-1) +/* If this struct changes the codec api may break and the + CODEC_MIN_API_VERSION define in codecs.h should be updated + Be careful when changing this struct as gcc may start generating suboptimal + code to access the tracks[] array in playback.c which seriously impacts + binary size */ + struct track_info { - struct mp3entry id3; /* TAG metadata */ - char *codecbuf; /* Pointer to codec buffer */ + volatile size_t available; /* Available bytes to read from buffer */ + size_t codecsize; /* Codec length in bytes */ - bool has_codec; /* Does this track have a codec on the buffer */ - size_t buf_idx; /* Pointer to the track's buffer */ size_t filerem; /* Remaining bytes of file NOT in buffer */ size_t filesize; /* File total length */ size_t start_pos; /* Position to first bytes of file in buffer */ - volatile size_t available; /* Available bytes to read from buffer */ + char *codecbuf; /* Pointer to codec buffer */ + + bool has_codec; /* Does this track have a codec on the buffer */ bool taginfo_ready; /* Is metadata read */ + bool event_sent; /* Was this track's buffered event sent */ - bool event_sent; /* Was this track's buffered event sent */ + struct mp3entry id3; /* TAG metadata */ }; /* Functions */ Index: firmware/export/id3.h =================================================================== --- firmware/export/id3.h (revision 13533) +++ firmware/export/id3.h (working copy) @@ -137,8 +137,36 @@ /* database of labels and codecs. add formats per above enum */ extern const struct afmt_entry audio_formats[AFMT_NUM_CODECS]; +/* If this struct changes the codec api may break and the + CODEC_MIN_API_VERSION define in codecs.h should be updated + Be careful when changing this struct as gcc may start generating suboptimal + code to access the tracks[] array in playback.c which seriously impacts + binary size */ struct mp3entry { + + unsigned long frequency; + unsigned long id3v2len; + unsigned long id3v1len; + unsigned long first_frame_offset; /* Byte offset to first real MP3 frame. + Used for skipping leading garbage to + avoid gaps between tracks. */ + unsigned long vbr_header_pos; + unsigned long filesize; /* without headers; in bytes */ + unsigned long length; /* song length in ms */ + unsigned long elapsed; /* ms played */ + + /* MP3 stream specific info */ + unsigned long frame_count; /* number of frames in the file (if VBR) */ + + /* resume related */ + unsigned long offset; /* bytes played */ + int index; /* playlist index for*/ + + unsigned int codectype; + unsigned int bitrate; char path[MAX_PATH]; + char* track_gain_string; + char* album_gain_string; char* title; char* artist; char* album; @@ -152,70 +180,42 @@ int version; int layer; int year; - unsigned char id3version; - unsigned int codectype; - unsigned int bitrate; - unsigned long frequency; - unsigned long id3v2len; - unsigned long id3v1len; - unsigned long first_frame_offset; /* Byte offset to first real MP3 frame. - Used for skipping leading garbage to - avoid gaps between tracks. */ - unsigned long vbr_header_pos; - unsigned long filesize; /* without headers; in bytes */ - unsigned long length; /* song length in ms */ - unsigned long elapsed; /* ms played */ - int lead_trim; /* Number of samples to skip at the beginning */ - int tail_trim; /* Number of samples to remove from the end */ + /* runtime database fields */ + long playcount; + long lastplayed; + short rating; + short score; +#if CONFIG_CODEC == SWCODEC /* Added for Vorbis */ unsigned long samples; /* number of samples in track */ - /* MP3 stream specific info */ - unsigned long frame_count; /* number of frames in the file (if VBR) */ - /* Used for A52/AC3 */ unsigned long bytesperframe; /* number of bytes per frame (if CBR) */ - /* Xing VBR fields */ - bool vbr; - bool has_toc; /* True if there is a VBR header in the file */ - unsigned char toc[100]; /* table of contents */ - - /* these following two fields are used for local buffering */ - char id3v2buf[300]; - char id3v1buf[4][92]; - - /* resume related */ - unsigned long offset; /* bytes played */ - int index; /* playlist index */ - - /* FileEntry fields */ - long fileentryoffset; - long filehash; - long songentryoffset; - long rundbentryoffset; - - /* runtime database fields */ - short rating; - short score; - long playcount; - long lastplayed; - /* replaygain support */ - -#if CONFIG_CODEC == SWCODEC - char* track_gain_string; - char* album_gain_string; long track_gain; /* 7.24 signed fixed point. 0 for no gain. */ long album_gain; long track_peak; /* 7.24 signed fixed point. 0 for no peak. */ long album_peak; + + int lead_trim; /* Number of samples to skip at the beginning */ + int tail_trim; /* Number of samples to remove from the end */ #endif /* Cuesheet support */ int cuesheet_type; /* 0: none, 1: external, 2: embedded */ + unsigned char id3version; + + /* these following two fields are used for local buffering */ + char id3v2buf[300]; + char id3v1buf[4][92]; + + /* Xing VBR fields */ + bool vbr; + bool has_toc; /* True if there is a VBR header in the file */ + unsigned char toc[100]; /* table of contents */ }; enum {