Remove some useless code and variables in the area of metadata parsing. Bump codec API.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29438 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2011-02-27 20:49:08 +00:00
parent 883ff8507e
commit 41658bd07a
5 changed files with 22 additions and 24 deletions

View file

@ -75,12 +75,12 @@
#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
/* increase this every time the api struct changes */
#define CODEC_API_VERSION 37
#define CODEC_API_VERSION 38
/* 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 37
#define CODEC_MIN_API_VERSION 38
/* codec return codes */
enum codec_status {

View file

@ -221,7 +221,6 @@ struct mp3entry {
char* grouping;
int discnum;
int tracknum;
int version;
int layer;
int year;
unsigned char id3version;
@ -233,7 +232,6 @@ struct mp3entry {
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 */
@ -241,7 +239,7 @@ struct mp3entry {
int lead_trim; /* Number of samples to skip at the beginning */
int tail_trim; /* Number of samples to remove from the end */
/* Added for Vorbis */
/* Added for Vorbis, used by mp4 parser as well. */
unsigned long samples; /* number of samples in track */
/* MP3 stream specific info */

View file

@ -102,7 +102,6 @@ static int getsonglength(int fd, struct mp3entry *entry)
entry->bitrate = info.bitrate;
entry->frequency = info.frequency;
entry->version = info.version;
entry->layer = info.layer;
switch(entry->layer) {
#if CONFIG_CODEC==SWCODEC
@ -149,8 +148,6 @@ static int getsonglength(int fd, struct mp3entry *entry)
memcpy(entry->toc, info.toc, sizeof(info.toc));
entry->vbr_header_pos = info.vbr_header_pos;
/* Update the seek point for the first playable frame */
entry->first_frame_offset = bytecount;
logf("First frame is at %lx", entry->first_frame_offset);

View file

@ -142,7 +142,9 @@ static bool mp3headerinfo(struct mp3info *info, unsigned long header)
if (info->layer == 3)
return false;
/* Rockbox: not used
info->protection = (header & PROTECTION_MASK) ? true : false;
*/
/* Bitrate */
bitindex = (header & BITRATE_MASK) >> 12;
@ -187,14 +189,15 @@ static bool mp3headerinfo(struct mp3info *info, unsigned long header)
info->ft_num = 1000 * info->ft_den * info->frame_samples / info->frequency;
info->channel_mode = (header & CHANNELMODE_MASK) >> 6;
/* Rockbox: not used
info->mode_extension = (header & MODE_EXT_MASK) >> 4;
info->emphasis = header & EMPHASIS_MASK;
*/
VDEBUGF( "Header: %08lx, Ver %d, lay %d, bitr %d, freq %ld, "
"chmode %d, mode_ext %d, emph %d, bytes: %d time: %d/%d\n",
"chmode %d, bytes: %d time: %d/%d\n",
header, info->version, info->layer+1, info->bitrate,
info->frequency, info->channel_mode, info->mode_extension,
info->emphasis, info->frame_size, info->ft_num, info->ft_den);
info->frequency, info->channel_mode,
info->frame_size, info->ft_num, info->ft_den);
return true;
}
@ -405,8 +408,9 @@ int get_mp3file_info(int fd, struct mp3info *info)
/* DEBUGF("Xing/Info header\n"); */
/* Remember where in the file the Xing header is */
/* Rockbox: not used
info->vbr_header_pos = lseek(fd, 0, SEEK_CUR) - info->frame_size;
*/
/* We want to skip the Xing frame when playing the stream */
bytecount += info->frame_size;
@ -420,7 +424,10 @@ int get_mp3file_info(int fd, struct mp3info *info)
return -5;
/* Is it a VBR file? */
info->is_vbr = info->is_xing_vbr = !memcmp(vbrheader, "Xing", 4);
info->is_vbr = !memcmp(vbrheader, "Xing", 4);
/* Rockbox: not used
info->is_xing_vbr = info->is_vbr;
*/
if (vbrheader[7] & VBR_FRAMES_FLAG) /* Is the frame count there? */
{
@ -506,7 +513,9 @@ int get_mp3file_info(int fd, struct mp3info *info)
/* Yes, it is a FhG VBR file */
info->is_vbr = true;
/* Rockbox: not used
info->is_vbri_vbr = true;
*/
info->has_toc = false; /* We don't parse the TOC (yet) */
info->byte_count = bytes2int(vbrheader[10], vbrheader[11],

View file

@ -30,27 +30,21 @@ struct mp3info {
/* Standard MP3 frame header fields */
int version;
int layer;
bool protection;
int bitrate;
long frequency;
int padding;
int channel_mode;
int mode_extension;
int emphasis;
int frame_size; /* Frame size in bytes */
int frame_samples; /* Samples per frame */
int frame_samples;/* Samples per frame */
int ft_num; /* Numerator of frametime in milliseconds */
int ft_den; /* Denominator of frametime in milliseconds */
bool is_vbr; /* True if the file is VBR */
bool has_toc; /* True if there is a VBR header in the file */
bool is_xing_vbr; /* True if the VBR header is of Xing type */
bool is_vbri_vbr; /* True if the VBR header is of VBRI type */
unsigned char toc[100];
unsigned long frame_count; /* Number of frames in the file (if VBR) */
unsigned long byte_count; /* File size in bytes */
unsigned long file_time; /* Length of the whole file in milliseconds */
unsigned long vbr_header_pos;
int enc_delay; /* Encoder delay, fetched from LAME header */
int enc_padding; /* Padded samples added to last frame. LAME header */
};