diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-02-27 20:49:08 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-02-27 20:49:08 +0000 |
commit | 41658bd07a1bc7b48ef12b356f67f11225593ddd (patch) | |
tree | adc3d80e944a0c541c9ed483df4f1f528bdab5e1 | |
parent | 883ff8507e42f7fbba6416e60fb116164219aa5f (diff) | |
download | rockbox-41658bd07a1bc7b48ef12b356f67f11225593ddd.tar.gz rockbox-41658bd07a1bc7b48ef12b356f67f11225593ddd.zip |
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
-rw-r--r-- | apps/codecs.h | 4 | ||||
-rw-r--r-- | apps/metadata.h | 4 | ||||
-rw-r--r-- | apps/metadata/mp3.c | 7 | ||||
-rw-r--r-- | apps/mp3data.c | 23 | ||||
-rw-r--r-- | apps/mp3data.h | 8 |
5 files changed, 22 insertions, 24 deletions
diff --git a/apps/codecs.h b/apps/codecs.h index a3f5d4045a..8a40791106 100644 --- a/apps/codecs.h +++ b/apps/codecs.h | |||
@@ -75,12 +75,12 @@ | |||
75 | #define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ | 75 | #define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ |
76 | 76 | ||
77 | /* increase this every time the api struct changes */ | 77 | /* increase this every time the api struct changes */ |
78 | #define CODEC_API_VERSION 37 | 78 | #define CODEC_API_VERSION 38 |
79 | 79 | ||
80 | /* update this to latest version if a change to the api struct breaks | 80 | /* update this to latest version if a change to the api struct breaks |
81 | backwards compatibility (and please take the opportunity to sort in any | 81 | backwards compatibility (and please take the opportunity to sort in any |
82 | new function which are "waiting" at the end of the function table) */ | 82 | new function which are "waiting" at the end of the function table) */ |
83 | #define CODEC_MIN_API_VERSION 37 | 83 | #define CODEC_MIN_API_VERSION 38 |
84 | 84 | ||
85 | /* codec return codes */ | 85 | /* codec return codes */ |
86 | enum codec_status { | 86 | enum codec_status { |
diff --git a/apps/metadata.h b/apps/metadata.h index 5662c2e840..4c7e94f394 100644 --- a/apps/metadata.h +++ b/apps/metadata.h | |||
@@ -221,7 +221,6 @@ struct mp3entry { | |||
221 | char* grouping; | 221 | char* grouping; |
222 | int discnum; | 222 | int discnum; |
223 | int tracknum; | 223 | int tracknum; |
224 | int version; | ||
225 | int layer; | 224 | int layer; |
226 | int year; | 225 | int year; |
227 | unsigned char id3version; | 226 | unsigned char id3version; |
@@ -233,7 +232,6 @@ struct mp3entry { | |||
233 | unsigned long first_frame_offset; /* Byte offset to first real MP3 frame. | 232 | unsigned long first_frame_offset; /* Byte offset to first real MP3 frame. |
234 | Used for skipping leading garbage to | 233 | Used for skipping leading garbage to |
235 | avoid gaps between tracks. */ | 234 | avoid gaps between tracks. */ |
236 | unsigned long vbr_header_pos; | ||
237 | unsigned long filesize; /* without headers; in bytes */ | 235 | unsigned long filesize; /* without headers; in bytes */ |
238 | unsigned long length; /* song length in ms */ | 236 | unsigned long length; /* song length in ms */ |
239 | unsigned long elapsed; /* ms played */ | 237 | unsigned long elapsed; /* ms played */ |
@@ -241,7 +239,7 @@ struct mp3entry { | |||
241 | int lead_trim; /* Number of samples to skip at the beginning */ | 239 | int lead_trim; /* Number of samples to skip at the beginning */ |
242 | int tail_trim; /* Number of samples to remove from the end */ | 240 | int tail_trim; /* Number of samples to remove from the end */ |
243 | 241 | ||
244 | /* Added for Vorbis */ | 242 | /* Added for Vorbis, used by mp4 parser as well. */ |
245 | unsigned long samples; /* number of samples in track */ | 243 | unsigned long samples; /* number of samples in track */ |
246 | 244 | ||
247 | /* MP3 stream specific info */ | 245 | /* MP3 stream specific info */ |
diff --git a/apps/metadata/mp3.c b/apps/metadata/mp3.c index 9309242604..feb1a52f77 100644 --- a/apps/metadata/mp3.c +++ b/apps/metadata/mp3.c | |||
@@ -100,10 +100,9 @@ static int getsonglength(int fd, struct mp3entry *entry) | |||
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | entry->bitrate = info.bitrate; | 103 | entry->bitrate = info.bitrate; |
104 | entry->frequency = info.frequency; | 104 | entry->frequency = info.frequency; |
105 | entry->version = info.version; | 105 | entry->layer = info.layer; |
106 | entry->layer = info.layer; | ||
107 | switch(entry->layer) { | 106 | switch(entry->layer) { |
108 | #if CONFIG_CODEC==SWCODEC | 107 | #if CONFIG_CODEC==SWCODEC |
109 | case 0: | 108 | case 0: |
@@ -149,8 +148,6 @@ static int getsonglength(int fd, struct mp3entry *entry) | |||
149 | 148 | ||
150 | memcpy(entry->toc, info.toc, sizeof(info.toc)); | 149 | memcpy(entry->toc, info.toc, sizeof(info.toc)); |
151 | 150 | ||
152 | entry->vbr_header_pos = info.vbr_header_pos; | ||
153 | |||
154 | /* Update the seek point for the first playable frame */ | 151 | /* Update the seek point for the first playable frame */ |
155 | entry->first_frame_offset = bytecount; | 152 | entry->first_frame_offset = bytecount; |
156 | logf("First frame is at %lx", entry->first_frame_offset); | 153 | logf("First frame is at %lx", entry->first_frame_offset); |
diff --git a/apps/mp3data.c b/apps/mp3data.c index 44208604bc..f5ef122801 100644 --- a/apps/mp3data.c +++ b/apps/mp3data.c | |||
@@ -142,8 +142,10 @@ static bool mp3headerinfo(struct mp3info *info, unsigned long header) | |||
142 | if (info->layer == 3) | 142 | if (info->layer == 3) |
143 | return false; | 143 | return false; |
144 | 144 | ||
145 | /* Rockbox: not used | ||
145 | info->protection = (header & PROTECTION_MASK) ? true : false; | 146 | info->protection = (header & PROTECTION_MASK) ? true : false; |
146 | 147 | */ | |
148 | |||
147 | /* Bitrate */ | 149 | /* Bitrate */ |
148 | bitindex = (header & BITRATE_MASK) >> 12; | 150 | bitindex = (header & BITRATE_MASK) >> 12; |
149 | info->bitrate = bitrate_table[info->version][info->layer][bitindex]; | 151 | info->bitrate = bitrate_table[info->version][info->layer][bitindex]; |
@@ -187,14 +189,15 @@ static bool mp3headerinfo(struct mp3info *info, unsigned long header) | |||
187 | info->ft_num = 1000 * info->ft_den * info->frame_samples / info->frequency; | 189 | info->ft_num = 1000 * info->ft_den * info->frame_samples / info->frequency; |
188 | 190 | ||
189 | info->channel_mode = (header & CHANNELMODE_MASK) >> 6; | 191 | info->channel_mode = (header & CHANNELMODE_MASK) >> 6; |
192 | /* Rockbox: not used | ||
190 | info->mode_extension = (header & MODE_EXT_MASK) >> 4; | 193 | info->mode_extension = (header & MODE_EXT_MASK) >> 4; |
191 | info->emphasis = header & EMPHASIS_MASK; | 194 | info->emphasis = header & EMPHASIS_MASK; |
192 | 195 | */ | |
193 | VDEBUGF( "Header: %08lx, Ver %d, lay %d, bitr %d, freq %ld, " | 196 | VDEBUGF( "Header: %08lx, Ver %d, lay %d, bitr %d, freq %ld, " |
194 | "chmode %d, mode_ext %d, emph %d, bytes: %d time: %d/%d\n", | 197 | "chmode %d, bytes: %d time: %d/%d\n", |
195 | header, info->version, info->layer+1, info->bitrate, | 198 | header, info->version, info->layer+1, info->bitrate, |
196 | info->frequency, info->channel_mode, info->mode_extension, | 199 | info->frequency, info->channel_mode, |
197 | info->emphasis, info->frame_size, info->ft_num, info->ft_den); | 200 | info->frame_size, info->ft_num, info->ft_den); |
198 | return true; | 201 | return true; |
199 | } | 202 | } |
200 | 203 | ||
@@ -405,8 +408,9 @@ int get_mp3file_info(int fd, struct mp3info *info) | |||
405 | /* DEBUGF("Xing/Info header\n"); */ | 408 | /* DEBUGF("Xing/Info header\n"); */ |
406 | 409 | ||
407 | /* Remember where in the file the Xing header is */ | 410 | /* Remember where in the file the Xing header is */ |
411 | /* Rockbox: not used | ||
408 | info->vbr_header_pos = lseek(fd, 0, SEEK_CUR) - info->frame_size; | 412 | info->vbr_header_pos = lseek(fd, 0, SEEK_CUR) - info->frame_size; |
409 | 413 | */ | |
410 | /* We want to skip the Xing frame when playing the stream */ | 414 | /* We want to skip the Xing frame when playing the stream */ |
411 | bytecount += info->frame_size; | 415 | bytecount += info->frame_size; |
412 | 416 | ||
@@ -420,7 +424,10 @@ int get_mp3file_info(int fd, struct mp3info *info) | |||
420 | return -5; | 424 | return -5; |
421 | 425 | ||
422 | /* Is it a VBR file? */ | 426 | /* Is it a VBR file? */ |
423 | info->is_vbr = info->is_xing_vbr = !memcmp(vbrheader, "Xing", 4); | 427 | info->is_vbr = !memcmp(vbrheader, "Xing", 4); |
428 | /* Rockbox: not used | ||
429 | info->is_xing_vbr = info->is_vbr; | ||
430 | */ | ||
424 | 431 | ||
425 | if (vbrheader[7] & VBR_FRAMES_FLAG) /* Is the frame count there? */ | 432 | if (vbrheader[7] & VBR_FRAMES_FLAG) /* Is the frame count there? */ |
426 | { | 433 | { |
@@ -506,7 +513,9 @@ int get_mp3file_info(int fd, struct mp3info *info) | |||
506 | 513 | ||
507 | /* Yes, it is a FhG VBR file */ | 514 | /* Yes, it is a FhG VBR file */ |
508 | info->is_vbr = true; | 515 | info->is_vbr = true; |
516 | /* Rockbox: not used | ||
509 | info->is_vbri_vbr = true; | 517 | info->is_vbri_vbr = true; |
518 | */ | ||
510 | info->has_toc = false; /* We don't parse the TOC (yet) */ | 519 | info->has_toc = false; /* We don't parse the TOC (yet) */ |
511 | 520 | ||
512 | info->byte_count = bytes2int(vbrheader[10], vbrheader[11], | 521 | info->byte_count = bytes2int(vbrheader[10], vbrheader[11], |
diff --git a/apps/mp3data.h b/apps/mp3data.h index 2a6a27ac2d..0fccd62827 100644 --- a/apps/mp3data.h +++ b/apps/mp3data.h | |||
@@ -30,27 +30,21 @@ struct mp3info { | |||
30 | /* Standard MP3 frame header fields */ | 30 | /* Standard MP3 frame header fields */ |
31 | int version; | 31 | int version; |
32 | int layer; | 32 | int layer; |
33 | bool protection; | ||
34 | int bitrate; | 33 | int bitrate; |
35 | long frequency; | 34 | long frequency; |
36 | int padding; | 35 | int padding; |
37 | int channel_mode; | 36 | int channel_mode; |
38 | int mode_extension; | ||
39 | int emphasis; | ||
40 | int frame_size; /* Frame size in bytes */ | 37 | int frame_size; /* Frame size in bytes */ |
41 | int frame_samples; /* Samples per frame */ | 38 | int frame_samples;/* Samples per frame */ |
42 | int ft_num; /* Numerator of frametime in milliseconds */ | 39 | int ft_num; /* Numerator of frametime in milliseconds */ |
43 | int ft_den; /* Denominator of frametime in milliseconds */ | 40 | int ft_den; /* Denominator of frametime in milliseconds */ |
44 | 41 | ||
45 | bool is_vbr; /* True if the file is VBR */ | 42 | bool is_vbr; /* True if the file is VBR */ |
46 | bool has_toc; /* True if there is a VBR header in the file */ | 43 | bool has_toc; /* True if there is a VBR header in the file */ |
47 | bool is_xing_vbr; /* True if the VBR header is of Xing type */ | ||
48 | bool is_vbri_vbr; /* True if the VBR header is of VBRI type */ | ||
49 | unsigned char toc[100]; | 44 | unsigned char toc[100]; |
50 | unsigned long frame_count; /* Number of frames in the file (if VBR) */ | 45 | unsigned long frame_count; /* Number of frames in the file (if VBR) */ |
51 | unsigned long byte_count; /* File size in bytes */ | 46 | unsigned long byte_count; /* File size in bytes */ |
52 | unsigned long file_time; /* Length of the whole file in milliseconds */ | 47 | unsigned long file_time; /* Length of the whole file in milliseconds */ |
53 | unsigned long vbr_header_pos; | ||
54 | int enc_delay; /* Encoder delay, fetched from LAME header */ | 48 | int enc_delay; /* Encoder delay, fetched from LAME header */ |
55 | int enc_padding; /* Padded samples added to last frame. LAME header */ | 49 | int enc_padding; /* Padded samples added to last frame. LAME header */ |
56 | }; | 50 | }; |