Revert r23339 and use setid3v1title() from metadata/mp3.c instead.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23349 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1e4c2fd9d2
commit
e0d8202599
3 changed files with 4 additions and 49 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
char* id3_get_num_genre(unsigned int genre_num);
|
||||
int getid3v2len(int fd);
|
||||
bool setid3v1title(int fd, struct mp3entry *entry);
|
||||
bool get_mp3_metadata(int fd, struct mp3entry* id3, const char *filename);
|
||||
|
||||
bool get_adx_metadata(int fd, struct mp3entry* id3);
|
||||
|
|
|
@ -555,7 +555,7 @@ static int unicode_munge(char* string, char* utf8buf, int *len) {
|
|||
*
|
||||
* Returns: true if a title was found and created, else false
|
||||
*/
|
||||
static bool setid3v1title(int fd, struct mp3entry *entry)
|
||||
bool setid3v1title(int fd, struct mp3entry *entry)
|
||||
{
|
||||
unsigned char buffer[128];
|
||||
static const char offsets[] = {3, 33, 63, 97, 93, 125, 127};
|
||||
|
|
|
@ -88,52 +88,6 @@ static char* fourcc2str(uint32_t f)
|
|||
}
|
||||
#endif
|
||||
|
||||
static inline int real_read_id3v1_tags(int fd, struct mp3entry *id3)
|
||||
{
|
||||
/* ID3v1 Standard : http://id3.org/id3v1.html */
|
||||
char temp[31];
|
||||
char *buf = &id3->id3v1buf[0][0];
|
||||
long buf_remaining = sizeof(id3->id3v1buf);
|
||||
|
||||
lseek(fd, ID3V1_OFFSET, SEEK_END);
|
||||
read(fd, temp, 3);
|
||||
temp[3] = '\0';
|
||||
if(!strcmp(temp, "TAG"))
|
||||
{
|
||||
read_string(fd, temp, sizeof(temp), -1, 30);
|
||||
parse_tag("title", temp, id3, buf, buf_remaining, 0);
|
||||
buf += 30;
|
||||
buf_remaining -= 30;
|
||||
|
||||
read_string(fd, temp, sizeof(temp), -1, 30);
|
||||
parse_tag("artist", temp, id3, buf, buf_remaining, 0);
|
||||
buf += 30;
|
||||
buf_remaining -= 30;
|
||||
|
||||
read_string(fd, temp, sizeof(temp), -1, 30);
|
||||
parse_tag("album", temp, id3, buf, buf_remaining, 0);
|
||||
buf += 30;
|
||||
buf_remaining -= 30;
|
||||
|
||||
read_string(fd, temp, sizeof(temp), -1, 4);
|
||||
parse_tag("year", temp, id3, buf, buf_remaining, 0);
|
||||
buf += 4;
|
||||
buf_remaining -= 4;
|
||||
|
||||
read_string(fd, temp, sizeof(temp), -1, 30);
|
||||
parse_tag("comment", temp, id3, buf, buf_remaining, 0);
|
||||
buf += 30;
|
||||
buf_remaining -= 30;
|
||||
|
||||
read_string(fd, temp, sizeof(temp), -1, 1);
|
||||
parse_tag("genre", temp, id3, buf, buf_remaining, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int real_read_audio_stream_info(int fd, RMContext *rmctx)
|
||||
{
|
||||
int skipped = 0;
|
||||
|
@ -457,8 +411,8 @@ bool get_rm_metadata(int fd, struct mp3entry* id3)
|
|||
memset(rmctx,0,sizeof(RMContext));
|
||||
if(rm_parse_header(fd, rmctx, id3) < 0)
|
||||
return false;
|
||||
|
||||
if(real_read_id3v1_tags(fd, id3)) {
|
||||
|
||||
if (!setid3v1title(fd, id3)) {
|
||||
/* file has no id3v1 tags, use the tags from CONT chunk */
|
||||
id3->title = id3->id3v1buf[0];
|
||||
id3->artist = id3->id3v1buf[1];
|
||||
|
|
Loading…
Reference in a new issue