Define CACHEALIGN_BITS for missing ARM CPUs for later use.
[kugel-rb.git] / apps / metadata / mod.c
blobdbedc6e62f62716e166cbc344e2be024fd2320aa
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 Dave Chapman
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include <stdio.h>
22 #include <string.h>
23 #include <stdlib.h>
24 #include <ctype.h>
25 #include <inttypes.h>
27 #include "system.h"
28 #include "metadata.h"
29 #include "metadata_common.h"
30 #include "metadata_parsers.h"
31 #include "rbunicode.h"
33 bool get_mod_metadata(int fd, struct mp3entry* id3)
35 /* Use the trackname part of the id3 structure as a temporary buffer */
36 unsigned char buf[1084];
37 int read_bytes;
38 char *p;
41 if ((lseek(fd, 0, SEEK_SET) < 0)
42 || ((read_bytes = read(fd, buf, sizeof(buf))) < 1084))
44 return false;
47 /* We don't do file format checking here
48 * There can be .mod files without any signatures out there */
50 p = id3->id3v2buf;
52 /* Copy Title */
53 strcpy(p, &buf[0x00]);
54 id3->title = p;
55 p += strlen(p)+1;
57 id3->bitrate = filesize(fd)/1024; /* size in kb */
58 id3->frequency = 44100;
59 id3->length = 120*1000;
60 id3->vbr = false;
61 id3->filesize = filesize(fd);
63 return true;