diff options
author | Michael Giacomelli <giac2000@hotmail.com> | 2009-08-30 03:15:43 +0000 |
---|---|---|
committer | Michael Giacomelli <giac2000@hotmail.com> | 2009-08-30 03:15:43 +0000 |
commit | f701fc516633798524369de07fedb8a21e8fc99f (patch) | |
tree | b7d5fcf6146c4c17d496d3db6057d23dd4df68ec | |
parent | e4c30bdf0edf6b93343ebafaa15bbbdf590a1d37 (diff) | |
download | rockbox-f701fc516633798524369de07fedb8a21e8fc99f.tar.gz rockbox-f701fc516633798524369de07fedb8a21e8fc99f.zip |
Patch doesn't SVN add . . .
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22558 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/metadata/nsf.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/apps/metadata/nsf.c b/apps/metadata/nsf.c new file mode 100644 index 0000000000..a12af14347 --- /dev/null +++ b/apps/metadata/nsf.c | |||
@@ -0,0 +1,59 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <string.h> | ||
3 | #include <stdlib.h> | ||
4 | #include <ctype.h> | ||
5 | #include <inttypes.h> | ||
6 | |||
7 | #include "system.h" | ||
8 | #include "metadata.h" | ||
9 | #include "metadata_common.h" | ||
10 | #include "metadata_parsers.h" | ||
11 | #include "rbunicode.h" | ||
12 | |||
13 | bool get_nsf_metadata(int fd, struct mp3entry* id3) | ||
14 | { | ||
15 | /* Use the trackname part of the id3 structure as a temporary buffer */ | ||
16 | unsigned char* buf = (unsigned char *)id3->path; | ||
17 | int read_bytes; | ||
18 | char *p; | ||
19 | |||
20 | |||
21 | if ((lseek(fd, 0, SEEK_SET) < 0) | ||
22 | || ((read_bytes = read(fd, buf, 110)) < 110)) | ||
23 | { | ||
24 | return false; | ||
25 | } | ||
26 | |||
27 | id3->length = 120*1000; | ||
28 | id3->vbr = false; | ||
29 | id3->filesize = filesize(fd); | ||
30 | |||
31 | if (memcmp(buf,"NESM",4) && memcmp(buf,"NSFE",4)) | ||
32 | { | ||
33 | return false; | ||
34 | } | ||
35 | else if (memcmp(buf, "NESM",4)) /* only NESM contain metadata */ | ||
36 | { | ||
37 | return true; | ||
38 | } | ||
39 | |||
40 | p = id3->id3v2buf; | ||
41 | |||
42 | /* Title */ | ||
43 | memcpy(p, &buf[14], 32); | ||
44 | id3->title = p; | ||
45 | p += strlen(p)+1; | ||
46 | |||
47 | /* Artist */ | ||
48 | memcpy(p, &buf[46], 32); | ||
49 | id3->artist = p; | ||
50 | p += strlen(p)+1; | ||
51 | |||
52 | /* Copyright (per codec) */ | ||
53 | memcpy(p, &buf[78], 32); | ||
54 | id3->album = p; | ||
55 | p += strlen(p)+1; | ||
56 | |||
57 | return true; | ||
58 | } | ||
59 | |||