diff options
Diffstat (limited to 'apps/codecs/vorbis.c')
-rw-r--r-- | apps/codecs/vorbis.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/apps/codecs/vorbis.c b/apps/codecs/vorbis.c index f2939aa68d..9afeb053e1 100644 --- a/apps/codecs/vorbis.c +++ b/apps/codecs/vorbis.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include "Tremor/ivorbisfile.h" | 22 | #include "Tremor/ivorbisfile.h" |
23 | #include "playback.h" | 23 | #include "playback.h" |
24 | #include "dsp.h" | ||
24 | #include "lib/codeclib.h" | 25 | #include "lib/codeclib.h" |
25 | 26 | ||
26 | static struct codec_api* rb; | 27 | static struct codec_api* rb; |
@@ -92,10 +93,6 @@ enum codec_status codec_start(struct codec_api* api) | |||
92 | long n; | 93 | long n; |
93 | int current_section; | 94 | int current_section; |
94 | int eof; | 95 | int eof; |
95 | #if BYTE_ORDER == BIG_ENDIAN | ||
96 | int i; | ||
97 | char x; | ||
98 | #endif | ||
99 | 96 | ||
100 | TEST_CODEC_API(api); | 97 | TEST_CODEC_API(api); |
101 | 98 | ||
@@ -110,15 +107,27 @@ enum codec_status codec_start(struct codec_api* api) | |||
110 | rb->configure(CODEC_SET_FILEBUF_LIMIT, (int *)(1024*1024*2)); | 107 | rb->configure(CODEC_SET_FILEBUF_LIMIT, (int *)(1024*1024*2)); |
111 | rb->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*64)); | 108 | rb->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*64)); |
112 | 109 | ||
113 | /* We need to flush reserver memory every track load. */ | 110 | rb->configure(DSP_DITHER, (bool *)false); |
111 | rb->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED); | ||
112 | rb->configure(DSP_SET_SAMPLE_DEPTH, (int *)(16)); | ||
113 | |||
114 | /* We need to flush reserver memory every track load. */ | ||
114 | next_track: | 115 | next_track: |
115 | if (codec_init(rb)) { | 116 | if (codec_init(rb)) { |
116 | return CODEC_ERROR; | 117 | return CODEC_ERROR; |
117 | } | 118 | } |
118 | 119 | ||
119 | 120 | while (!rb->taginfo_ready) | |
121 | rb->yield(); | ||
122 | |||
123 | if (rb->id3->frequency != NATIVE_FREQUENCY) { | ||
124 | rb->configure(DSP_SET_FREQUENCY, (long *)(rb->id3->frequency)); | ||
125 | rb->configure(CODEC_DSP_ENABLE, (bool *)true); | ||
126 | } else { | ||
127 | rb->configure(CODEC_DSP_ENABLE, (bool *)false); | ||
128 | } | ||
129 | |||
120 | /* Create a decoder instance */ | 130 | /* Create a decoder instance */ |
121 | |||
122 | callbacks.read_func=read_handler; | 131 | callbacks.read_func=read_handler; |
123 | callbacks.seek_func=seek_handler; | 132 | callbacks.seek_func=seek_handler; |
124 | callbacks.tell_func=tell_handler; | 133 | callbacks.tell_func=tell_handler; |
@@ -148,17 +157,10 @@ enum codec_status codec_start(struct codec_api* api) | |||
148 | if (rb->stop_codec || rb->reload_codec) | 157 | if (rb->stop_codec || rb->reload_codec) |
149 | break ; | 158 | break ; |
150 | 159 | ||
151 | rb->yield(); | ||
152 | while (!rb->audiobuffer_insert(pcmbuf, n)) | 160 | while (!rb->audiobuffer_insert(pcmbuf, n)) |
153 | rb->yield(); | 161 | rb->yield(); |
154 | 162 | ||
155 | rb->set_elapsed(ov_time_tell(&vf)); | 163 | rb->set_elapsed(ov_time_tell(&vf)); |
156 | |||
157 | #if BYTE_ORDER == BIG_ENDIAN | ||
158 | for (i=0;i<n;i+=2) { | ||
159 | x=pcmbuf[i]; pcmbuf[i]=pcmbuf[i+1]; pcmbuf[i+1]=x; | ||
160 | } | ||
161 | #endif | ||
162 | } | 164 | } |
163 | } | 165 | } |
164 | 166 | ||