diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2006-08-28 22:38:41 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2006-08-28 22:38:41 +0000 |
commit | 4fc717a4c19a1fe0349977d7b9c86561c5a5cf2d (patch) | |
tree | eb6113c7491072f7b5136e24775737764e2cdede /firmware/export | |
parent | 65c2c58b3aa26164bd919665e4d710efa2fa7c79 (diff) | |
download | rockbox-4fc717a4c19a1fe0349977d7b9c86561c5a5cf2d.tar.gz rockbox-4fc717a4c19a1fe0349977d7b9c86561c5a5cf2d.zip |
Added FS#2939 Encoder Codec Interface + Codecs by Antonius Hellmann with additional FM Recording support and my modifications
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10789 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/audio.h | 46 | ||||
-rw-r--r-- | firmware/export/config-h100.h | 3 | ||||
-rw-r--r-- | firmware/export/config-h120.h | 3 | ||||
-rw-r--r-- | firmware/export/config-h300.h | 3 | ||||
-rw-r--r-- | firmware/export/config-iaudiox5.h | 4 | ||||
-rw-r--r-- | firmware/export/fmradio.h | 16 | ||||
-rw-r--r-- | firmware/export/id3.h | 42 | ||||
-rw-r--r-- | firmware/export/pcm_record.h | 14 |
8 files changed, 128 insertions, 3 deletions
diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 9e3499e81f..2ee7f89dbd 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h | |||
@@ -31,6 +31,9 @@ | |||
31 | #define AUDIO_STATUS_PRERECORD 8 | 31 | #define AUDIO_STATUS_PRERECORD 8 |
32 | #define AUDIO_STATUS_ERROR 16 | 32 | #define AUDIO_STATUS_ERROR 16 |
33 | 33 | ||
34 | #define AUDIO_STATUS_STAYON_FLAGS \ | ||
35 | (AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE | AUDIO_STATUS_RECORD | AUDIO_) | ||
36 | |||
34 | #define AUDIOERR_DISK_FULL 1 | 37 | #define AUDIOERR_DISK_FULL 1 |
35 | 38 | ||
36 | #define AUDIO_GAIN_LINEIN 0 | 39 | #define AUDIO_GAIN_LINEIN 0 |
@@ -69,6 +72,7 @@ void audio_resume(void); | |||
69 | void audio_next(void); | 72 | void audio_next(void); |
70 | void audio_prev(void); | 73 | void audio_prev(void); |
71 | int audio_status(void); | 74 | int audio_status(void); |
75 | bool audio_query_poweroff(void); | ||
72 | int audio_track_count(void); /* SWCODEC only */ | 76 | int audio_track_count(void); /* SWCODEC only */ |
73 | void audio_pre_ff_rewind(void); /* SWCODEC only */ | 77 | void audio_pre_ff_rewind(void); /* SWCODEC only */ |
74 | void audio_ff_rewind(long newtime); | 78 | void audio_ff_rewind(long newtime); |
@@ -93,14 +97,56 @@ void audio_stop_recording(void); | |||
93 | void audio_pause_recording(void); | 97 | void audio_pause_recording(void); |
94 | void audio_resume_recording(void); | 98 | void audio_resume_recording(void); |
95 | void audio_new_file(const char *filename); | 99 | void audio_new_file(const char *filename); |
100 | |||
101 | /* audio sources */ | ||
102 | enum | ||
103 | { | ||
104 | AUDIO_SRC_PLAYBACK = -1, /* for audio playback (default) */ | ||
105 | AUDIO_SRC_MIC, /* monitor mic */ | ||
106 | AUDIO_SRC_LINEIN, /* monitor line in */ | ||
107 | #ifdef HAVE_SPDIF_IN | ||
108 | AUDIO_SRC_SPDIF, /* monitor spdif */ | ||
109 | #endif | ||
110 | #if defined(HAVE_FMRADIO_IN) || defined(CONFIG_TUNER) | ||
111 | AUDIO_SRC_FMRADIO, /* monitor fm radio */ | ||
112 | #endif | ||
113 | /* define new audio sources above this line */ | ||
114 | AUDIO_SOURCE_LIST_END, | ||
115 | /* AUDIO_SRC_FMRADIO must be declared #ifdef CONFIG_TUNER but is not in | ||
116 | the list of recordable sources. HAVE_FMRADIO_IN implies CONFIG_TUNER. */ | ||
117 | #if defined(HAVE_FMRADIO_IN) || !defined(CONFIG_TUNER) | ||
118 | AUDIO_NUM_SOURCES = AUDIO_SOURCE_LIST_END, | ||
119 | #else | ||
120 | AUDIO_NUM_SOURCES = AUDIO_SOURCE_LIST_END-1, | ||
121 | #endif | ||
122 | AUDIO_SRC_MAX = AUDIO_NUM_SOURCES-1 | ||
123 | }; | ||
124 | |||
125 | /* channel modes */ | ||
126 | enum | ||
127 | { | ||
128 | CHN_MODE_MONO = 1, | ||
129 | CHN_MODE_STEREO, | ||
130 | }; | ||
96 | void audio_set_recording_options(int frequency, int quality, | 131 | void audio_set_recording_options(int frequency, int quality, |
97 | int source, int channel_mode, | 132 | int source, int channel_mode, |
98 | bool editable, int prerecord_time); | 133 | bool editable, int prerecord_time); |
99 | void audio_set_recording_gain(int left, int right, int type); | 134 | void audio_set_recording_gain(int left, int right, int type); |
100 | unsigned long audio_recorded_time(void); | 135 | unsigned long audio_recorded_time(void); |
101 | unsigned long audio_num_recorded_bytes(void); | 136 | unsigned long audio_num_recorded_bytes(void); |
137 | #if 0 | ||
138 | #ifdef HAVE_SPDIF_POWER | ||
102 | void audio_set_spdif_power_setting(bool on); | 139 | void audio_set_spdif_power_setting(bool on); |
140 | #endif | ||
141 | #endif | ||
103 | unsigned long audio_get_spdif_sample_rate(void); | 142 | unsigned long audio_get_spdif_sample_rate(void); |
143 | #if CONFIG_CODEC == SWCODEC | ||
144 | /* audio encoder functions (defined in playback.c) */ | ||
145 | int audio_get_encoder_id(void); | ||
146 | void audio_load_encoder(int enc_id); | ||
147 | void audio_remove_encoder(void); | ||
148 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
149 | |||
104 | 150 | ||
105 | 151 | ||
106 | 152 | ||
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index c21c8a1dcd..8f936866cc 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h | |||
@@ -135,6 +135,9 @@ | |||
135 | /* Someone with H100 and BDM, please verify if this works. */ | 135 | /* Someone with H100 and BDM, please verify if this works. */ |
136 | /* #define HAVE_EEPROM */ | 136 | /* #define HAVE_EEPROM */ |
137 | 137 | ||
138 | /* Define this for FM radio input available (not for SIMULATOR) */ | ||
139 | #define HAVE_FMRADIO_IN | ||
140 | |||
138 | #endif /* !SIMULATOR */ | 141 | #endif /* !SIMULATOR */ |
139 | 142 | ||
140 | /* Define this for S/PDIF input available */ | 143 | /* Define this for S/PDIF input available */ |
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index 5ff567cae4..4ac4b2b699 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h | |||
@@ -132,6 +132,9 @@ | |||
132 | /* Define this if the EEPROM chip is used */ | 132 | /* Define this if the EEPROM chip is used */ |
133 | #define HAVE_EEPROM_SETTINGS | 133 | #define HAVE_EEPROM_SETTINGS |
134 | 134 | ||
135 | /* Define this for FM radio input available (not for SIMULATOR) */ | ||
136 | #define HAVE_FMRADIO_IN | ||
137 | |||
135 | #endif /* !SIMULATOR */ | 138 | #endif /* !SIMULATOR */ |
136 | 139 | ||
137 | /* Define this for S/PDIF input available */ | 140 | /* Define this for S/PDIF input available */ |
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index d5c54d858f..c9c0b04bcb 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -140,4 +140,7 @@ | |||
140 | /* Define this if there is an EEPROM chip */ | 140 | /* Define this if there is an EEPROM chip */ |
141 | #define HAVE_EEPROM | 141 | #define HAVE_EEPROM |
142 | 142 | ||
143 | /* Define this for FM radio input available (not for SIMULATOR) */ | ||
144 | #define HAVE_FMRADIO_IN | ||
145 | |||
143 | #endif /* SIMULATOR */ | 146 | #endif /* SIMULATOR */ |
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 8a2ed7a29d..d5c67c0a1c 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | /* define this if you have access to the quickscreen */ | 18 | /* define this if you have access to the quickscreen */ |
19 | #define HAVE_QUICKSCREEN | 19 | #define HAVE_QUICKSCREEN |
20 | |||
20 | /* define this if you have access to the pitchscreen */ | 21 | /* define this if you have access to the pitchscreen */ |
21 | #define HAVE_PITCHSCREEN | 22 | #define HAVE_PITCHSCREEN |
22 | 23 | ||
@@ -81,6 +82,9 @@ | |||
81 | should be defined as well. */ | 82 | should be defined as well. */ |
82 | #define HAVE_LCD_SLEEP | 83 | #define HAVE_LCD_SLEEP |
83 | 84 | ||
85 | /* Define this for FM radio input available (not for SIMULATOR) */ | ||
86 | #define HAVE_FMRADIO_IN | ||
87 | |||
84 | /* Define this if you have a Motorola SCF5250 */ | 88 | /* Define this if you have a Motorola SCF5250 */ |
85 | #define CONFIG_CPU MCF5250 | 89 | #define CONFIG_CPU MCF5250 |
86 | 90 | ||
diff --git a/firmware/export/fmradio.h b/firmware/export/fmradio.h index 3c55fb7672..73113237c0 100644 --- a/firmware/export/fmradio.h +++ b/firmware/export/fmradio.h | |||
@@ -20,6 +20,22 @@ | |||
20 | #ifndef FMRADIO_H | 20 | #ifndef FMRADIO_H |
21 | #define FMRADIO_H | 21 | #define FMRADIO_H |
22 | 22 | ||
23 | /** declare some stuff here so powermgmt.c can properly tell if the radio is | ||
24 | actually playing and not just paused. This break in heirarchy is allowed | ||
25 | for audio_status(). **/ | ||
26 | |||
27 | /* set when radio is playing or paused within fm radio screen */ | ||
28 | #define FMRADIO_OFF 0x0 | ||
29 | #define FMRADIO_PLAYING 0x1 | ||
30 | #define FMRADIO_PAUSED 0x2 | ||
31 | |||
32 | /* returns the IN flag */ | ||
33 | #define FMRADIO_IN_SCREEN(s) ((s) & FMRADIO_IN_FLAG) | ||
34 | #define FMRADIO_STATUS_PLAYING(s) ((s) & FMRADIO_PLAYING_OUT) | ||
35 | #define FMRADIO_STATUS_PAUSED(s) ((s) & FMRADIO_PAUSED_OUT) | ||
36 | |||
37 | extern int get_radio_status(void); | ||
38 | |||
23 | extern int fmradio_read(int addr); | 39 | extern int fmradio_read(int addr); |
24 | extern void fmradio_set(int addr, int data); | 40 | extern void fmradio_set(int addr, int data); |
25 | 41 | ||
diff --git a/firmware/export/id3.h b/firmware/export/id3.h index 7930cd9b70..dc58178d50 100644 --- a/firmware/export/id3.h +++ b/firmware/export/id3.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #include "file.h" | 24 | #include "file.h" |
25 | 25 | ||
26 | /* Audio file types. */ | 26 | /* Audio file types. */ |
27 | /* NOTE: When adding new audio types, also add to codec_labels[] in id3.c */ | ||
28 | enum { | 27 | enum { |
29 | AFMT_UNKNOWN = 0, /* Unknown file format */ | 28 | AFMT_UNKNOWN = 0, /* Unknown file format */ |
30 | 29 | ||
@@ -46,9 +45,48 @@ enum { | |||
46 | 45 | ||
47 | /* New formats must be added to the end of this list */ | 46 | /* New formats must be added to the end of this list */ |
48 | 47 | ||
49 | AFMT_NUM_CODECS | 48 | AFMT_NUM_CODECS, |
49 | |||
50 | #if CONFIG_CODEC == SWCODEC | ||
51 | /* masks to decompose parts */ | ||
52 | CODEC_AFMT_MASK = 0x0fff, | ||
53 | CODEC_TYPE_MASK = 0x7000, | ||
54 | |||
55 | /* switch for specifying codec type when requesting a filename */ | ||
56 | CODEC_TYPE_DECODER = (0 << 12), /* default */ | ||
57 | CODEC_TYPE_ENCODER = (1 << 12) | ||
58 | #endif | ||
50 | }; | 59 | }; |
51 | 60 | ||
61 | #if CONFIG_CODEC == SWCODEC | ||
62 | #define AFMT_ENTRY(label, codec_fname, codec_enc_fname, enc_ext) \ | ||
63 | { label, codec_fname, codec_enc_fname, enc_ext } | ||
64 | #else | ||
65 | #define AFMT_ENTRY(label, codec_fname, codec_enc_fname, enc_ext) \ | ||
66 | { label } | ||
67 | #endif | ||
68 | |||
69 | /* record describing the audio format */ | ||
70 | struct afmt_entry | ||
71 | { | ||
72 | #if CONFIG_CODEC == SWCODEC | ||
73 | char label[8]; /* format label */ | ||
74 | char *codec_fn; /* filename of decoder codec */ | ||
75 | char *codec_enc_fn; /* filename of encoder codec */ | ||
76 | char *ext; /* default extension for file (enc only for now) */ | ||
77 | #else | ||
78 | char label[4]; | ||
79 | #endif | ||
80 | }; | ||
81 | |||
82 | /* database of labels and codecs. add formats per above enum */ | ||
83 | extern const struct afmt_entry audio_formats[AFMT_NUM_CODECS]; | ||
84 | |||
85 | #if CONFIG_CODEC == SWCODEC | ||
86 | /* recording quality to AFMT_* */ | ||
87 | extern const int rec_quality_info_afmt[9]; | ||
88 | #endif | ||
89 | |||
52 | struct mp3entry { | 90 | struct mp3entry { |
53 | char path[MAX_PATH]; | 91 | char path[MAX_PATH]; |
54 | char* title; | 92 | char* title; |
diff --git a/firmware/export/pcm_record.h b/firmware/export/pcm_record.h index 5e2d7b7929..b217335340 100644 --- a/firmware/export/pcm_record.h +++ b/firmware/export/pcm_record.h | |||
@@ -20,10 +20,22 @@ | |||
20 | #ifndef PCM_RECORD_H | 20 | #ifndef PCM_RECORD_H |
21 | #define PCM_RECORD_H | 21 | #define PCM_RECORD_H |
22 | 22 | ||
23 | void enc_set_parameters(int chunk_size, int num_chunks, | ||
24 | int samp_per_chunk, char *head_ptr, int head_size, | ||
25 | int enc_id); | ||
26 | void enc_get_inputs(int *buffer_size, int *channels, int *quality); | ||
27 | unsigned int* enc_alloc_chunk(void); | ||
28 | void enc_free_chunk(void); | ||
29 | int enc_wavbuf_near_empty(void); | ||
30 | char* enc_get_wav_data(int size); | ||
31 | extern void (*enc_set_header_callback)(void *head_buffer, int head_size, | ||
32 | int num_pcm_samples, bool is_file_header); | ||
33 | |||
23 | unsigned long pcm_rec_status(void); | 34 | unsigned long pcm_rec_status(void); |
24 | void pcm_rec_init(void); | 35 | void pcm_rec_init(void); |
25 | void pcm_rec_mux(int source); | 36 | void pcm_rec_mux(int source); |
26 | 37 | int pcm_rec_current_bitrate(void); | |
38 | int pcm_get_num_unprocessed(void); | ||
27 | void pcm_rec_get_peaks(int *left, int *right); | 39 | void pcm_rec_get_peaks(int *left, int *right); |
28 | 40 | ||
29 | /* audio.h contains audio recording functions */ | 41 | /* audio.h contains audio recording functions */ |