diff options
Diffstat (limited to 'apps/metadata/gbs.c')
-rw-r--r-- | apps/metadata/gbs.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/apps/metadata/gbs.c b/apps/metadata/gbs.c deleted file mode 100644 index 68f2b2a393..0000000000 --- a/apps/metadata/gbs.c +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
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 | static bool parse_gbs_header(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 | lseek(fd, 0, SEEK_SET); | ||
18 | if (read(fd, buf, 112) < 112) | ||
19 | return false; | ||
20 | |||
21 | /* Calculate track length with number of subtracks */ | ||
22 | id3->length = buf[4] * 1000; | ||
23 | |||
24 | /* If meta info was found in the m3u skip next step */ | ||
25 | if (id3->title && id3->title[0]) return true; | ||
26 | |||
27 | char *p = id3->id3v2buf; | ||
28 | |||
29 | /* Some metadata entries have 32 bytes length */ | ||
30 | /* Game */ | ||
31 | memcpy(p, &buf[16], 32); *(p + 33) = '\0'; | ||
32 | id3->title = p; | ||
33 | p += strlen(p)+1; | ||
34 | |||
35 | /* Artist */ | ||
36 | memcpy(p, &buf[48], 32); *(p + 33) = '\0'; | ||
37 | id3->artist = p; | ||
38 | p += strlen(p)+1; | ||
39 | |||
40 | /* Copyright */ | ||
41 | memcpy(p, &buf[80], 32); *(p + 33) = '\0'; | ||
42 | id3->album = p; | ||
43 | |||
44 | return true; | ||
45 | } | ||
46 | |||
47 | bool get_gbs_metadata(int fd, struct mp3entry* id3) | ||
48 | { | ||
49 | char gbs_type[3]; | ||
50 | if ((lseek(fd, 0, SEEK_SET) < 0) || | ||
51 | (read(fd, gbs_type, 3) < 3)) | ||
52 | return false; | ||
53 | |||
54 | id3->vbr = false; | ||
55 | id3->filesize = filesize(fd); | ||
56 | /* we only render 16 bits, 44.1KHz, Stereo */ | ||
57 | id3->bitrate = 706; | ||
58 | id3->frequency = 44100; | ||
59 | |||
60 | /* Check for GBS magic */ | ||
61 | if (memcmp( gbs_type, "GBS", 3 ) != 0) | ||
62 | return false; | ||
63 | |||
64 | return parse_gbs_header(fd, id3); | ||
65 | } | ||