From 9558c4956d3d603c4d132af88633767810f3ba62 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Tue, 14 Oct 2008 11:12:20 +0000 Subject: Moved pcm_record from firmware to apps. Cleaned up some. Now all code using struct mp3entry is in apps. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18807 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/audio.h | 2 - firmware/export/id3.h | 246 ------------------------------------------- firmware/export/mas.h | 6 ++ firmware/export/mpeg.h | 66 ------------ firmware/export/pcm_record.h | 66 ------------ firmware/export/replaygain.h | 33 ------ 6 files changed, 6 insertions(+), 413 deletions(-) delete mode 100644 firmware/export/id3.h delete mode 100644 firmware/export/mpeg.h delete mode 100644 firmware/export/pcm_record.h delete mode 100644 firmware/export/replaygain.h (limited to 'firmware/export') diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 9530082050..661247df2f 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h @@ -30,8 +30,6 @@ #include "pcm_sampr.h" #include "pcm.h" #ifdef HAVE_RECORDING -#include "pcm_record.h" -#include "id3.h" #include "enc_base.h" #endif /* HAVE_RECORDING */ #endif /* CONFIG_CODEC == SWCODEC */ diff --git a/firmware/export/id3.h b/firmware/export/id3.h deleted file mode 100644 index da2faf1b12..0000000000 --- a/firmware/export/id3.h +++ /dev/null @@ -1,246 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Daniel Stenberg - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef ID3_H -#define ID3_H - -#include -#include "config.h" -#include "file.h" - -#define ID3V2_BUF_SIZE 300 - -/* Audio file types. */ -/* NOTE: The values of the AFMT_* items are used for the %fc tag in the WPS - - so new entries MUST be added to the end to maintain compatibility. - */ -enum -{ - AFMT_UNKNOWN = 0, /* Unknown file format */ - - /* start formats */ - - AFMT_MPA_L1, /* MPEG Audio layer 1 */ - AFMT_MPA_L2, /* MPEG Audio layer 2 */ - AFMT_MPA_L3, /* MPEG Audio layer 3 */ - -#if CONFIG_CODEC == SWCODEC - AFMT_AIFF, /* Audio Interchange File Format */ - AFMT_PCM_WAV, /* Uncompressed PCM in a WAV file */ - AFMT_OGG_VORBIS, /* Ogg Vorbis */ - AFMT_FLAC, /* FLAC */ - AFMT_MPC, /* Musepack */ - AFMT_A52, /* A/52 (aka AC3) audio */ - AFMT_WAVPACK, /* WavPack */ - AFMT_ALAC, /* Apple Lossless Audio Codec */ - AFMT_AAC, /* Advanced Audio Coding (AAC) in M4A container */ - AFMT_SHN, /* Shorten */ - AFMT_SID, /* SID File Format */ - AFMT_ADX, /* ADX File Format */ - AFMT_NSF, /* NESM (NES Sound Format) */ - AFMT_SPEEX, /* Ogg Speex speech */ - AFMT_SPC, /* SPC700 save state */ - AFMT_APE, /* Monkey's Audio (APE) */ - AFMT_WMA, /* WMAV1/V2 in ASF */ - AFMT_MOD, /* Amiga MOD File Format */ - AFMT_SAP, /* Amiga 8Bit SAP Format */ -#endif - - /* add new formats at any index above this line to have a sensible order - - specified array index inits are used */ - /* format arrays defined in id3.c */ - - AFMT_NUM_CODECS, - -#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) - /* masks to decompose parts */ - CODEC_AFMT_MASK = 0x0fff, - CODEC_TYPE_MASK = 0x7000, - - /* switch for specifying codec type when requesting a filename */ - CODEC_TYPE_DECODER = (0 << 12), /* default */ - CODEC_TYPE_ENCODER = (1 << 12), -#endif /* CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) */ -}; - -#if CONFIG_CODEC == SWCODEC -#define CODEC_EXTENSION "codec" - -#ifdef HAVE_RECORDING -#define ENCODER_SUFFIX "_enc" -enum rec_format_indexes -{ - __REC_FORMAT_START_INDEX = -1, - - /* start formats */ - - REC_FORMAT_PCM_WAV, - REC_FORMAT_AIFF, - REC_FORMAT_WAVPACK, - REC_FORMAT_MPA_L3, - - /* add new formats at any index above this line to have a sensible order - - specified array index inits are used - REC_FORMAT_CFG_NUM_BITS should allocate enough bits to hold the range - REC_FORMAT_CFG_VALUE_LIST should be in same order as indexes - */ - - REC_NUM_FORMATS, - - REC_FORMAT_DEFAULT = REC_FORMAT_PCM_WAV, - REC_FORMAT_CFG_NUM_BITS = 2 -}; - -#define REC_FORMAT_CFG_VAL_LIST "wave,aiff,wvpk,mpa3" - -/* get REC_FORMAT_* corresponding AFMT_* */ -extern const int rec_format_afmt[REC_NUM_FORMATS]; -/* get AFMT_* corresponding REC_FORMAT_* */ -extern const int afmt_rec_format[AFMT_NUM_CODECS]; - -#define AFMT_ENTRY(label, root_fname, enc_root_fname, ext_list) \ - { label, root_fname, enc_root_fname, ext_list } -#else /* !HAVE_RECORDING */ -#define AFMT_ENTRY(label, root_fname, enc_root_fname, ext_list) \ - { label, root_fname, ext_list } -#endif /* HAVE_RECORDING */ -#else /* !SWCODEC */ - -#define AFMT_ENTRY(label, root_fname, enc_root_fname, ext_list) \ - { label, ext_list } -#endif /* CONFIG_CODEC == SWCODEC */ - -/* record describing the audio format */ -struct afmt_entry -{ - char label[8]; /* format label */ -#if CONFIG_CODEC == SWCODEC - char *codec_root_fn; /* root codec filename (sans _enc and .codec) */ -#ifdef HAVE_RECORDING - char *codec_enc_root_fn; /* filename of encoder codec */ -#endif -#endif - char *ext_list; /* double NULL terminated extension - list for type with the first as - the default for recording */ -}; - -/* database of labels and codecs. add formats per above enum */ -extern const struct afmt_entry audio_formats[AFMT_NUM_CODECS]; - -struct mp3entry { - char path[MAX_PATH]; - char* title; - char* artist; - char* album; - char* genre_string; - char* disc_string; - char* track_string; - char* year_string; - char* composer; - char* comment; - char* albumartist; - char* grouping; - int discnum; - int tracknum; - int version; - int layer; - int year; - unsigned char id3version; - unsigned int codectype; - unsigned int bitrate; - unsigned long frequency; - unsigned long id3v2len; - unsigned long id3v1len; - unsigned long first_frame_offset; /* Byte offset to first real MP3 frame. - Used for skipping leading garbage to - avoid gaps between tracks. */ - unsigned long vbr_header_pos; - unsigned long filesize; /* without headers; in bytes */ - unsigned long length; /* song length in ms */ - unsigned long elapsed; /* ms played */ - - int lead_trim; /* Number of samples to skip at the beginning */ - int tail_trim; /* Number of samples to remove from the end */ - - /* Added for Vorbis */ - unsigned long samples; /* number of samples in track */ - - /* MP3 stream specific info */ - unsigned long frame_count; /* number of frames in the file (if VBR) */ - - /* Used for A52/AC3 */ - unsigned long bytesperframe; /* number of bytes per frame (if CBR) */ - - /* Xing VBR fields */ - bool vbr; - bool has_toc; /* True if there is a VBR header in the file */ - unsigned char toc[100]; /* table of contents */ - - /* these following two fields are used for local buffering */ - char id3v2buf[ID3V2_BUF_SIZE]; - char id3v1buf[4][92]; - - /* resume related */ - unsigned long offset; /* bytes played */ - int index; /* playlist index */ - - /* runtime database fields */ - long tagcache_idx; /* 0=invalid, otherwise idx+1 */ - int rating; - int score; - long playcount; - long lastplayed; - long playtime; - - /* replaygain support */ - -#if CONFIG_CODEC == SWCODEC - char* track_gain_string; - char* album_gain_string; - long track_gain; /* 7.24 signed fixed point. 0 for no gain. */ - long album_gain; - long track_peak; /* 7.24 signed fixed point. 0 for no peak. */ - long album_peak; -#endif - - /* Cuesheet support */ - int cuesheet_type; /* 0: none, 1: external, 2: embedded */ - - /* Musicbrainz Track ID */ - char* mb_track_id; -}; - -enum { - ID3_VER_1_0 = 1, - ID3_VER_1_1, - ID3_VER_2_2, - ID3_VER_2_3, - ID3_VER_2_4 -}; - -bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename); -bool mp3info(struct mp3entry *entry, const char *filename); -char* id3_get_num_genre(unsigned int genre_num); -int getid3v2len(int fd); -void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig); -void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig); - -#endif diff --git a/firmware/export/mas.h b/firmware/export/mas.h index ab6135cbfa..493ed6a63c 100644 --- a/firmware/export/mas.h +++ b/firmware/export/mas.h @@ -163,3 +163,9 @@ int mas_codec_readreg(int reg); unsigned long mas_readver(void); #endif + +#if CONFIG_TUNER & S1A0903X01 +void mas_store_pllfreq(int freq); +int mas_get_pllfreq(void); +#endif + diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h deleted file mode 100644 index ce2cff0069..0000000000 --- a/firmware/export/mpeg.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Linus Nielsen Feltzing - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef _MPEG_H_ -#define _MPEG_H_ - -#include -#include "id3.h" - -#define MPEG_SWAP_CHUNKSIZE 0x2000 -#define MPEG_HIGH_WATER 2 /* We leave 2 bytes empty because otherwise we - wouldn't be able to see the difference between - an empty buffer and a full one. */ -#define MPEG_LOW_WATER 0x60000 -#define MPEG_RECORDING_LOW_WATER 0x80000 -#define MPEG_LOW_WATER_CHUNKSIZE 0x40000 -#define MPEG_LOW_WATER_SWAP_CHUNKSIZE 0x10000 -#ifdef HAVE_MMC -#define MPEG_PLAY_PENDING_THRESHOLD 0x20000 -#define MPEG_PLAY_PENDING_SWAPSIZE 0x20000 -#else -#define MPEG_PLAY_PENDING_THRESHOLD 0x10000 -#define MPEG_PLAY_PENDING_SWAPSIZE 0x10000 -#endif - -#define MPEG_MAX_PRERECORD_SECONDS 30 - -/* For ID3 info and VBR header */ -#define MPEG_RESERVED_HEADER_SPACE (4096 + 576) - -#if (CONFIG_CODEC == MAS3587F) || defined(SIMULATOR) - -#if CONFIG_TUNER & S1A0903X01 -int mpeg_get_mas_pllfreq(void); -#endif - -#endif -unsigned long mpeg_get_last_header(void); - -/* in order to keep the recording here, I have to expose this */ -void rec_tick(void); -void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */ - -void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3)); -void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3)); -void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3)); -void audio_set_cuesheet_callback(bool (*handler)(const char *filename)); - -#endif diff --git a/firmware/export/pcm_record.h b/firmware/export/pcm_record.h deleted file mode 100644 index f805313fe5..0000000000 --- a/firmware/export/pcm_record.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2005 by Linus Nielsen Feltzing - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#ifndef PCM_RECORD_H -#define PCM_RECORD_H - -#define DMA_REC_ERROR_DMA (-1) -#ifdef HAVE_SPDIF_REC -#define DMA_REC_ERROR_SPDIF (-2) -#endif - -/** Warnings **/ -/* pcm (dma) buffer has overflowed */ -#define PCMREC_W_PCM_BUFFER_OVF 0x00000001 -/* encoder output buffer has overflowed */ -#define PCMREC_W_ENC_BUFFER_OVF 0x00000002 -/** Errors **/ -/* failed to load encoder */ -#define PCMREC_E_LOAD_ENCODER 0x80001000 -/* error originating in encoder */ -#define PCMREC_E_ENCODER 0x80002000 -/* filename queue has desynced from stream markers */ -#define PCMREC_E_FNQ_DESYNC 0x80004000 -/* I/O error has occurred */ -#define PCMREC_E_IO 0x80008000 -#ifdef DEBUG -/* encoder has written past end of allotted space */ -#define PCMREC_E_CHUNK_OVF 0x80010000 -#endif /* DEBUG */ - -/** General functions for high level codec recording **/ -/* pcm_rec_error_clear is deprecated for general use. audio_error_clear - should be used */ -void pcm_rec_error_clear(void); -/* pcm_rec_status is deprecated for general use. audio_status merges the - results for consistency with the hardware codec version */ -unsigned long pcm_rec_status(void); -unsigned long pcm_rec_get_warnings(void); -void pcm_rec_init(void); -int pcm_rec_current_bitrate(void); -int pcm_rec_encoder_afmt(void); /* AFMT_* value, AFMT_UNKNOWN if none */ -int pcm_rec_rec_format(void); /* Format index or -1 otherwise */ -unsigned long pcm_rec_sample_rate(void); -int pcm_get_num_unprocessed(void); - -/* audio.h contains audio_* recording functions */ - -#endif /* PCM_RECORD_H */ diff --git a/firmware/export/replaygain.h b/firmware/export/replaygain.h deleted file mode 100644 index dbc079b1d3..0000000000 --- a/firmware/export/replaygain.h +++ /dev/null @@ -1,33 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2005 Magnus Holmgren - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#ifndef _REPLAYGAIN_H -#define _REPLAYGAIN_H - -#include "id3.h" - -long get_replaygain_int(long int_gain); -long parse_replaygain(const char* key, const char* value, - struct mp3entry* entry, char* buffer, int length); -long parse_replaygain_int(bool album, long gain, long peak, - struct mp3entry* entry, char* buffer, int length); - -#endif -- cgit v1.2.3