summaryrefslogtreecommitdiff
path: root/apps/codecs/mpa.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/mpa.c')
-rw-r--r--apps/codecs/mpa.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index df78b07247..5cf4eb8730 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -23,7 +23,6 @@
23 23
24#include "playback.h" 24#include "playback.h"
25#include "dsp.h" 25#include "dsp.h"
26#include "mp3data.h"
27#include "lib/codeclib.h" 26#include "lib/codeclib.h"
28 27
29struct mad_stream Stream IDATA_ATTR; 28struct mad_stream Stream IDATA_ATTR;
@@ -61,7 +60,6 @@ extern char iramend[];
61enum codec_status codec_start(struct codec_api* api) 60enum codec_status codec_start(struct codec_api* api)
62{ 61{
63 struct codec_api *ci = api; 62 struct codec_api *ci = api;
64 struct mp3info *info;
65 int Status = 0; 63 int Status = 0;
66 size_t size; 64 size_t size;
67 int file_end; 65 int file_end;
@@ -115,7 +113,6 @@ enum codec_status codec_start(struct codec_api* api)
115 for gapless playback */ 113 for gapless playback */
116 next_track: 114 next_track:
117 115
118 info = ci->mp3data;
119 first_frame = false; 116 first_frame = false;
120 file_end = 0; 117 file_end = 0;
121 OutputPtr = OutputBuffer; 118 OutputPtr = OutputBuffer;
@@ -128,24 +125,24 @@ enum codec_status codec_start(struct codec_api* api)
128 125
129 ci->request_buffer(&size, ci->id3->first_frame_offset); 126 ci->request_buffer(&size, ci->id3->first_frame_offset);
130 ci->advance_buffer(size); 127 ci->advance_buffer(size);
131 128
132 if (info->enc_delay >= 0 && info->enc_padding >= 0) { 129 if (ci->id3->lead_trim >= 0 && ci->id3->tail_trim >= 0) {
133 stop_skip = info->enc_padding - mpeg_latency[info->layer]; 130 stop_skip = ci->id3->tail_trim - mpeg_latency[ci->id3->layer];
134 if (stop_skip < 0) stop_skip = 0; 131 if (stop_skip < 0) stop_skip = 0;
135 start_skip = info->enc_delay + mpeg_latency[info->layer]; 132 start_skip = ci->id3->lead_trim + mpeg_latency[ci->id3->layer];
136 } else { 133 } else {
137 stop_skip = 0; 134 stop_skip = 0;
138 /* We want to skip this amount anyway */ 135 /* We want to skip this amount anyway */
139 start_skip = mpeg_latency[info->layer]; 136 start_skip = mpeg_latency[ci->id3->layer];
140 } 137 }
141 138
142 /* NOTE: currently this doesn't work, the below calculated samples_count 139 /* NOTE: currently this doesn't work, the below calculated samples_count
143 seems to be right, but sometimes libmad just can't supply us with 140 seems to be right, but sometimes libmad just can't supply us with
144 all the data we need... */ 141 all the data we need... */
145 if (info->frame_count) { 142 if (ci->id3->frame_count) {
146 /* TODO: 1152 is the frame size in samples for MPEG1 layer 2 and layer 3, 143 /* TODO: 1152 is the frame size in samples for MPEG1 layer 2 and layer 3,
147 it's probably not correct at all for MPEG2 and layer 1 */ 144 it's probably not correct at all for MPEG2 and layer 1 */
148 samplecount = info->frame_count*1152 - (start_skip + stop_skip); 145 samplecount = ci->id3->frame_count*1152 - (start_skip + stop_skip);
149 samplesdone = ci->id3->elapsed * frequency_divider / 10; 146 samplesdone = ci->id3->elapsed * frequency_divider / 10;
150 } else { 147 } else {
151 samplecount = ci->id3->length * frequency_divider / 10; 148 samplecount = ci->id3->length * frequency_divider / 10;