summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/codecs/libatrac/atrac3.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c
index c1648681f5..e134998dfd 100644
--- a/apps/codecs/libatrac/atrac3.c
+++ b/apps/codecs/libatrac/atrac3.c
@@ -178,11 +178,6 @@ static int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
178 for (i = 0; i < bytes/4; i++) 178 for (i = 0; i < bytes/4; i++)
179 obuf[i] = c ^ buf[i]; 179 obuf[i] = c ^ buf[i];
180 180
181 if (off) {
182 DEBUGF("Offset of %d not handled, post sample on ffmpeg-dev.\n",off);
183 return off;
184 }
185
186 return off; 181 return off;
187} 182}
188 183
@@ -698,7 +693,7 @@ static int decodeChannelSoundUnit (GetBitContext *gb, channel_unit *pSnd, int32_
698 * @param databuf the input data 693 * @param databuf the input data
699 */ 694 */
700 695
701static int decodeFrame(ATRAC3Context *q, const uint8_t* databuf) 696static int decodeFrame(ATRAC3Context *q, const uint8_t* databuf, int off)
702{ 697{
703 int result, i; 698 int result, i;
704 int32_t *p1, *p2, *p3, *p4; 699 int32_t *p1, *p2, *p3, *p4;
@@ -766,7 +761,7 @@ static int decodeFrame(ATRAC3Context *q, const uint8_t* databuf)
766 for (i=0 ; i<q->channels ; i++) { 761 for (i=0 ; i<q->channels ; i++) {
767 762
768 /* Set the bitstream reader at the start of a channel sound unit. */ 763 /* Set the bitstream reader at the start of a channel sound unit. */
769 init_get_bits(&q->gb, databuf+((i*q->bytes_per_frame)/q->channels), (q->bits_per_frame)/q->channels); 764 init_get_bits(&q->gb, databuf+((i*q->bytes_per_frame)/q->channels)+off, (q->bits_per_frame)/q->channels);
770 765
771 result = decodeChannelSoundUnit(&q->gb, &q->pUnits[i], &q->outSamples[i*1024], i, q->codingMode); 766 result = decodeChannelSoundUnit(&q->gb, &q->pUnits[i], &q->outSamples[i*1024], i, q->codingMode);
772 if (result != 0) 767 if (result != 0)
@@ -799,7 +794,7 @@ static int decodeFrame(ATRAC3Context *q, const uint8_t* databuf)
799int atrac3_decode_frame(RMContext *rmctx, ATRAC3Context *q, 794int atrac3_decode_frame(RMContext *rmctx, ATRAC3Context *q,
800 void *data, int *data_size, 795 void *data, int *data_size,
801 const uint8_t *buf, int buf_size) { 796 const uint8_t *buf, int buf_size) {
802 int result = 0, i; 797 int result = 0, off = 0, i;
803 const uint8_t* databuf; 798 const uint8_t* databuf;
804 int16_t* samples = data; 799 int16_t* samples = data;
805 800
@@ -808,13 +803,13 @@ int atrac3_decode_frame(RMContext *rmctx, ATRAC3Context *q,
808 803
809 /* Check if we need to descramble and what buffer to pass on. */ 804 /* Check if we need to descramble and what buffer to pass on. */
810 if (q->scrambled_stream) { 805 if (q->scrambled_stream) {
811 decode_bytes(buf, q->decoded_bytes_buffer, rmctx->block_align); 806 off = decode_bytes(buf, q->decoded_bytes_buffer, rmctx->block_align);
812 databuf = q->decoded_bytes_buffer; 807 databuf = q->decoded_bytes_buffer;
813 } else { 808 } else {
814 databuf = buf; 809 databuf = buf;
815 } 810 }
816 811
817 result = decodeFrame(q, databuf); 812 result = decodeFrame(q, databuf, off);
818 813
819 if (result != 0) { 814 if (result != 0) {
820 DEBUGF("Frame decoding error!\n"); 815 DEBUGF("Frame decoding error!\n");