diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2006-11-06 18:07:30 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2006-11-06 18:07:30 +0000 |
commit | 0f5cb94aa4a334366a746fcbb22f3335ca413265 (patch) | |
tree | 8f89a96628c1810d51ee9816daf78edb8c76fcd4 /firmware/export/id3.h | |
parent | 0b22795e26ee09de14f6ac23219adeda12f2fd5b (diff) | |
download | rockbox-0f5cb94aa4a334366a746fcbb22f3335ca413265.tar.gz rockbox-0f5cb94aa4a334366a746fcbb22f3335ca413265.zip |
Big Patch adds primarily: Samplerate and format selection to recording for SWCODEC. Supprort for samplerates changing in playback (just goes with the recording part inseparably). Samplerates to all encoders. Encoders can be configured individually on a menu specific to the encoder in the recording menu. File creation is delayed until flush time to reduce spinups when splitting. Misc: statusbar icons for numbers are individual digits to display any number. Audio buffer was rearranged to maximize memory available to recording and properly reinitialized when trashed. ColdFire PCM stuff moved to target tree to avoid a complicated mess when adding samplerate switching. Some needed API changes and to neaten up growing gap between hardware and software codecs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11452 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/id3.h')
-rw-r--r-- | firmware/export/id3.h | 91 |
1 files changed, 67 insertions, 24 deletions
diff --git a/firmware/export/id3.h b/firmware/export/id3.h index 1d07affbfa..dd099e0204 100644 --- a/firmware/export/id3.h +++ b/firmware/export/id3.h | |||
@@ -24,13 +24,19 @@ | |||
24 | #include "file.h" | 24 | #include "file.h" |
25 | 25 | ||
26 | /* Audio file types. */ | 26 | /* Audio file types. */ |
27 | enum { | 27 | enum |
28 | { | ||
28 | AFMT_UNKNOWN = 0, /* Unknown file format */ | 29 | AFMT_UNKNOWN = 0, /* Unknown file format */ |
29 | 30 | ||
31 | /* start formats */ | ||
32 | |||
30 | AFMT_MPA_L1, /* MPEG Audio layer 1 */ | 33 | AFMT_MPA_L1, /* MPEG Audio layer 1 */ |
31 | AFMT_MPA_L2, /* MPEG Audio layer 2 */ | 34 | AFMT_MPA_L2, /* MPEG Audio layer 2 */ |
32 | AFMT_MPA_L3, /* MPEG Audio layer 3 */ | 35 | AFMT_MPA_L3, /* MPEG Audio layer 3 */ |
33 | 36 | ||
37 | AFMT_AIFF, /* Audio Interchange File Format */ | ||
38 | |||
39 | #if CONFIG_CODEC == SWCODEC | ||
34 | AFMT_PCM_WAV, /* Uncompressed PCM in a WAV file */ | 40 | AFMT_PCM_WAV, /* Uncompressed PCM in a WAV file */ |
35 | AFMT_OGG_VORBIS, /* Ogg Vorbis */ | 41 | AFMT_OGG_VORBIS, /* Ogg Vorbis */ |
36 | AFMT_FLAC, /* FLAC */ | 42 | AFMT_FLAC, /* FLAC */ |
@@ -40,54 +46,91 @@ enum { | |||
40 | AFMT_ALAC, /* Apple Lossless Audio Codec */ | 46 | AFMT_ALAC, /* Apple Lossless Audio Codec */ |
41 | AFMT_AAC, /* Advanced Audio Coding (AAC) in M4A container */ | 47 | AFMT_AAC, /* Advanced Audio Coding (AAC) in M4A container */ |
42 | AFMT_SHN, /* Shorten */ | 48 | AFMT_SHN, /* Shorten */ |
43 | AFMT_AIFF, /* Audio Interchange File Format */ | ||
44 | AFMT_SID, /* SID File Format */ | 49 | AFMT_SID, /* SID File Format */ |
45 | AFMT_ADX, /* ADX */ | 50 | AFMT_ADX, /* ADX File Format */ |
51 | #endif | ||
46 | 52 | ||
47 | /* New formats must be added to the end of this list */ | 53 | /* add new formats at any index above this line to have a sensible order - |
54 | specified array index inits are used */ | ||
55 | /* format arrays defined in id3.c */ | ||
48 | 56 | ||
49 | AFMT_NUM_CODECS, | 57 | AFMT_NUM_CODECS, |
50 | 58 | ||
51 | #if CONFIG_CODEC == SWCODEC | 59 | #if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) |
52 | /* masks to decompose parts */ | 60 | /* masks to decompose parts */ |
53 | CODEC_AFMT_MASK = 0x0fff, | 61 | CODEC_AFMT_MASK = 0x0fff, |
54 | CODEC_TYPE_MASK = 0x7000, | 62 | CODEC_TYPE_MASK = 0x7000, |
55 | 63 | ||
56 | /* switch for specifying codec type when requesting a filename */ | 64 | /* switch for specifying codec type when requesting a filename */ |
57 | CODEC_TYPE_DECODER = (0 << 12), /* default */ | 65 | CODEC_TYPE_DECODER = (0 << 12), /* default */ |
58 | CODEC_TYPE_ENCODER = (1 << 12) | 66 | CODEC_TYPE_ENCODER = (1 << 12), |
59 | #endif | 67 | #endif /* CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) */ |
60 | }; | 68 | }; |
61 | 69 | ||
62 | #if CONFIG_CODEC == SWCODEC | 70 | #if CONFIG_CODEC == SWCODEC |
63 | #define AFMT_ENTRY(label, codec_fname, codec_enc_fname, enc_ext) \ | 71 | #define CODEC_EXTENSION "codec" |
64 | { label, codec_fname, codec_enc_fname, enc_ext } | 72 | |
65 | #else | 73 | #ifdef HAVE_RECORDING |
66 | #define AFMT_ENTRY(label, codec_fname, codec_enc_fname, enc_ext) \ | 74 | #define ENCODER_SUFFIX "_enc" |
67 | { label } | 75 | enum rec_format_indexes |
68 | #endif | 76 | { |
77 | __REC_FORMAT_START_INDEX = -1, | ||
78 | |||
79 | /* start formats */ | ||
80 | |||
81 | REC_FORMAT_PCM_WAV, | ||
82 | REC_FORMAT_WAVPACK, | ||
83 | REC_FORMAT_MPA_L3, | ||
84 | |||
85 | /* add new formats at any index above this line to have a sensible order - | ||
86 | specified array index inits are used | ||
87 | REC_FORMAT_CFG_NUM_BITS should allocate enough bits to hold the range | ||
88 | REC_FORMAT_CFG_VALUE_LIST should be in same order as indexes | ||
89 | */ | ||
90 | |||
91 | REC_NUM_FORMATS, | ||
92 | |||
93 | REC_FORMAT_DEFAULT = REC_FORMAT_PCM_WAV, | ||
94 | REC_FORMAT_CFG_NUM_BITS = 2 | ||
95 | }; | ||
96 | |||
97 | #define REC_FORMAT_CFG_VAL_LIST "wave,wvpk,mpa3" | ||
98 | |||
99 | /* get REC_FORMAT_* corresponding AFMT_* */ | ||
100 | extern const int rec_format_afmt[REC_NUM_FORMATS]; | ||
101 | /* get AFMT_* corresponding REC_FORMAT_* */ | ||
102 | extern const int afmt_rec_format[AFMT_NUM_CODECS]; | ||
103 | |||
104 | #define AFMT_ENTRY(label, root_fname, enc_root_fname, ext_list) \ | ||
105 | { label, root_fname, enc_root_fname, ext_list } | ||
106 | #else /* !HAVE_RECORDING */ | ||
107 | #define AFMT_ENTRY(label, root_fname, enc_root_fname, ext_list) \ | ||
108 | { label, root_fname, ext_list } | ||
109 | #endif /* HAVE_RECORDING */ | ||
110 | #else /* !SWCODEC */ | ||
111 | |||
112 | #define AFMT_ENTRY(label, root_fname, enc_root_fname, ext_list) \ | ||
113 | { label, ext_list } | ||
114 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
69 | 115 | ||
70 | /* record describing the audio format */ | 116 | /* record describing the audio format */ |
71 | struct afmt_entry | 117 | struct afmt_entry |
72 | { | 118 | { |
73 | #if CONFIG_CODEC == SWCODEC | ||
74 | char label[8]; /* format label */ | 119 | char label[8]; /* format label */ |
75 | char *codec_fn; /* filename of decoder codec */ | 120 | #if CONFIG_CODEC == SWCODEC |
76 | char *codec_enc_fn; /* filename of encoder codec */ | 121 | char *codec_root_fn; /* root codec filename (sans _enc and .codec) */ |
77 | char *ext; /* default extension for file (enc only for now) */ | 122 | #ifdef HAVE_RECORDING |
78 | #else | 123 | char *codec_enc_root_fn; /* filename of encoder codec */ |
79 | char label[4]; | 124 | #endif |
80 | #endif | 125 | #endif |
126 | char *ext_list; /* double NULL terminated extension | ||
127 | list for type with the first as | ||
128 | the default for recording */ | ||
81 | }; | 129 | }; |
82 | 130 | ||
83 | /* database of labels and codecs. add formats per above enum */ | 131 | /* database of labels and codecs. add formats per above enum */ |
84 | extern const struct afmt_entry audio_formats[AFMT_NUM_CODECS]; | 132 | extern const struct afmt_entry audio_formats[AFMT_NUM_CODECS]; |
85 | 133 | ||
86 | #if CONFIG_CODEC == SWCODEC | ||
87 | /* recording quality to AFMT_* */ | ||
88 | extern const int rec_quality_info_afmt[9]; | ||
89 | #endif | ||
90 | |||
91 | struct mp3entry { | 134 | struct mp3entry { |
92 | char path[MAX_PATH]; | 135 | char path[MAX_PATH]; |
93 | char* title; | 136 | char* title; |