summaryrefslogtreecommitdiff
path: root/apps/codecs/atrac3_rm.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/atrac3_rm.c')
-rw-r--r--apps/codecs/atrac3_rm.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/codecs/atrac3_rm.c b/apps/codecs/atrac3_rm.c
index a8610f5764..f3bfa2f801 100644
--- a/apps/codecs/atrac3_rm.c
+++ b/apps/codecs/atrac3_rm.c
@@ -41,7 +41,6 @@ enum codec_status codec_main(void)
41 static size_t buff_size; 41 static size_t buff_size;
42 int datasize, res, consumed, i, time_offset; 42 int datasize, res, consumed, i, time_offset;
43 uint8_t *bit_buffer; 43 uint8_t *bit_buffer;
44 int16_t outbuf[2048] __attribute__((aligned(32)));
45 uint16_t fs,sps,h; 44 uint16_t fs,sps,h;
46 uint32_t packet_count; 45 uint32_t packet_count;
47 int scrambling_unit_size, num_units, elapsed = 0; 46 int scrambling_unit_size, num_units, elapsed = 0;
@@ -62,9 +61,9 @@ next_track:
62 init_rm(&rmctx); 61 init_rm(&rmctx);
63 62
64 ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency); 63 ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency);
65 ci->configure(DSP_SET_SAMPLE_DEPTH, 16); 64 ci->configure(DSP_SET_SAMPLE_DEPTH, 17); /* Remark: atrac3 uses s15.0 by default, s15.2 was hacked. */
66 ci->configure(DSP_SET_STEREO_MODE, rmctx.nb_channels == 1 ? 65 ci->configure(DSP_SET_STEREO_MODE, rmctx.nb_channels == 1 ?
67 STEREO_MONO : STEREO_INTERLEAVED); 66 STEREO_MONO : STEREO_NONINTERLEAVED);
68 67
69 packet_count = rmctx.nb_packets; 68 packet_count = rmctx.nb_packets;
70 rmctx.audio_framesize = rmctx.block_align; 69 rmctx.audio_framesize = rmctx.block_align;
@@ -145,7 +144,7 @@ seek_start :
145 ci->seek_complete(); 144 ci->seek_complete();
146 } 145 }
147 if(pkt.length) 146 if(pkt.length)
148 res = atrac3_decode_frame(&rmctx,&q, outbuf, &datasize, pkt.frames[i], rmctx.block_align); 147 res = atrac3_decode_frame(&rmctx, &q, &datasize, pkt.frames[i], rmctx.block_align);
149 else /* indicates that there are no remaining frames */ 148 else /* indicates that there are no remaining frames */
150 goto done; 149 goto done;
151 150
@@ -155,7 +154,7 @@ seek_start :
155 } 154 }
156 155
157 if(datasize) 156 if(datasize)
158 ci->pcmbuf_insert(outbuf, NULL, q.samples_per_frame / rmctx.nb_channels); 157 ci->pcmbuf_insert(q.outSamples, q.outSamples + 1024, q.samples_per_frame / rmctx.nb_channels);
159 elapsed = rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i; 158 elapsed = rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i;
160 ci->set_elapsed(elapsed); 159 ci->set_elapsed(elapsed);
161 rmctx.frame_number++; 160 rmctx.frame_number++;