diff options
| author | Thom Johansen <thomj@rockbox.org> | 2008-05-21 11:19:58 +0000 |
|---|---|---|
| committer | Thom Johansen <thomj@rockbox.org> | 2008-05-21 11:19:58 +0000 |
| commit | c0f7eb9f9dda1941ff80571df74d5616a4604ed7 (patch) | |
| tree | 9196ea881d0a49b0f2f0cb6c577f4de1cc7c9b25 /apps/metadata/mod.c | |
| parent | c78bb5a00ef4c71c875d33dac2cb97872db9a0d4 (diff) | |
| download | rockbox-c0f7eb9f9dda1941ff80571df74d5616a4604ed7.zip rockbox-c0f7eb9f9dda1941ff80571df74d5616a4604ed7.tar.gz rockbox-c0f7eb9f9dda1941ff80571df74d5616a4604ed7.tar.bz2 rockbox-c0f7eb9f9dda1941ff80571df74d5616a4604ed7.tar.xz | |
FS #8680. MOD codec by Rainer Sinsch.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17595 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata/mod.c')
| -rw-r--r-- | apps/metadata/mod.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/apps/metadata/mod.c b/apps/metadata/mod.c new file mode 100644 index 0000000..0205fd0 --- /dev/null +++ b/apps/metadata/mod.c @@ -0,0 +1,62 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2005 Dave Chapman + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> +#include <inttypes.h> + +#include "system.h" +#include "id3.h" +#include "metadata_common.h" +#include "rbunicode.h" + +bool get_mod_metadata(int fd, struct mp3entry* id3) +{ + /* Use the trackname part of the id3 structure as a temporary buffer */ + unsigned char buf[1084]; + int read_bytes; + char *p; + + + if ((lseek(fd, 0, SEEK_SET) < 0) + || ((read_bytes = read(fd, buf, sizeof(buf))) < 1084)) + { + return false; + } + + /* We don't do file format checking here + * There can be .mod files without any signatures out there */ + + p = id3->id3v2buf; + + /* Copy Title as artist */ + strcpy(p, &buf[0x00]); + id3->artist = p; + p += strlen(p)+1; + + id3->bitrate = filesize(fd)/1024; /* size in kb */ + id3->frequency = 44100; + id3->length = 120*1000; + id3->vbr = false; + id3->filesize = filesize(fd); + + return true; +} + |