FS #8680. MOD codec by Rainer Sinsch.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17595 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c78bb5a00e
commit
c0f7eb9f9d
10 changed files with 1406 additions and 0 deletions
|
@ -134,6 +134,7 @@ metadata/mp4.c
|
|||
metadata/mpc.c
|
||||
metadata/ogg.c
|
||||
metadata/sid.c
|
||||
metadata/mod.c
|
||||
metadata/spc.c
|
||||
metadata/vorbis.c
|
||||
metadata/wave.c
|
||||
|
|
|
@ -47,6 +47,7 @@ all: $(LINKCODEC) $(ROCKS)
|
|||
ifndef SIMVER
|
||||
$(BUILDDIR)/%.a : % $(CODECDEPS)
|
||||
|
||||
$(OBJDIR)/mod.elf : $(OBJDIR)/mod.o $(OBJDIR)/codec_crt0.o
|
||||
$(OBJDIR)/wav.elf : $(OBJDIR)/wav.o $(OBJDIR)/codec_crt0.o
|
||||
$(OBJDIR)/sid.elf : $(OBJDIR)/sid.o $(OBJDIR)/codec_crt0.o
|
||||
$(OBJDIR)/adx.elf : $(OBJDIR)/adx.o $(OBJDIR)/codec_crt0.o
|
||||
|
|
|
@ -13,6 +13,7 @@ wma.c
|
|||
aac.c
|
||||
#endif
|
||||
ape.c
|
||||
mod.c
|
||||
shorten.c
|
||||
aiff.c
|
||||
speex.c
|
||||
|
|
1327
apps/codecs/mod.c
Normal file
1327
apps/codecs/mod.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -68,6 +68,7 @@ const struct filetype inbuilt_filetypes[] = {
|
|||
{ "m4a", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
|
||||
{ "m4b", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
|
||||
{ "mp4", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
|
||||
{ "mod", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
|
||||
{ "shn", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
|
||||
{ "aif", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
|
||||
{ "aiff",FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
|
||||
|
|
|
@ -184,6 +184,14 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname)
|
|||
|
||||
break;
|
||||
|
||||
case AFMT_MOD:
|
||||
if (!get_mod_metadata(fd, id3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AFMT_SHN:
|
||||
id3->vbr = true;
|
||||
id3->filesize = filesize(fd);
|
||||
|
|
|
@ -25,6 +25,7 @@ bool get_mp4_metadata(int fd, struct mp3entry* id3);
|
|||
bool get_monkeys_metadata(int fd, struct mp3entry* id3);
|
||||
bool get_musepack_metadata(int fd, struct mp3entry *id3);
|
||||
bool get_sid_metadata(int fd, struct mp3entry* id3);
|
||||
bool get_mod_metadata(int fd, struct mp3entry* id3);
|
||||
bool get_spc_metadata(int fd, struct mp3entry* id3);
|
||||
bool get_ogg_metadata(int fd, struct mp3entry* id3);
|
||||
bool get_wave_metadata(int fd, struct mp3entry* id3);
|
||||
|
|
62
apps/metadata/mod.c
Normal file
62
apps/metadata/mod.c
Normal file
|
@ -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;
|
||||
}
|
||||
|
|
@ -57,6 +57,7 @@ enum
|
|||
AFMT_SPC, /* SPC700 save state */
|
||||
AFMT_APE, /* Monkey's Audio (APE) */
|
||||
AFMT_WMA, /* WMAV1/V2 in ASF */
|
||||
AFMT_MOD, /* Amiga MOD File Format */
|
||||
#endif
|
||||
|
||||
/* add new formats at any index above this line to have a sensible order -
|
||||
|
|
|
@ -112,6 +112,9 @@ const struct afmt_entry audio_formats[AFMT_NUM_CODECS] =
|
|||
/* WMA (WMAV1/V2 in ASF) */
|
||||
[AFMT_WMA] =
|
||||
AFMT_ENTRY("WMA", "wma", NULL, "wma\0wmv\0asf\0" ),
|
||||
/* Amiga MOD File */
|
||||
[AFMT_MOD] =
|
||||
AFMT_ENTRY("MOD", "mod", NULL, "mod\0" ),
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue