diff options
Diffstat (limited to 'apps/codecs/shorten.c')
-rw-r--r-- | apps/codecs/shorten.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/codecs/shorten.c b/apps/codecs/shorten.c index c64615665f..50d72997ce 100644 --- a/apps/codecs/shorten.c +++ b/apps/codecs/shorten.c | |||
@@ -78,6 +78,12 @@ next_track: | |||
78 | /* Shorten decoder initialization */ | 78 | /* Shorten decoder initialization */ |
79 | ci->memset(&sc, 0, sizeof(ShortenContext)); | 79 | ci->memset(&sc, 0, sizeof(ShortenContext)); |
80 | 80 | ||
81 | /* Skip id3v2 tags */ | ||
82 | if (ci->id3->first_frame_offset) { | ||
83 | buf = ci->request_buffer(&bytesleft, ci->id3->first_frame_offset); | ||
84 | ci->advance_buffer(ci->id3->first_frame_offset); | ||
85 | } | ||
86 | |||
81 | /* Read the shorten & wave headers */ | 87 | /* Read the shorten & wave headers */ |
82 | buf = ci->request_buffer(&bytesleft, MAX_FRAMESIZE); | 88 | buf = ci->request_buffer(&bytesleft, MAX_FRAMESIZE); |
83 | res = shorten_init(&sc, buf, bytesleft); | 89 | res = shorten_init(&sc, buf, bytesleft); |
@@ -86,9 +92,18 @@ next_track: | |||
86 | return CODEC_ERROR; | 92 | return CODEC_ERROR; |
87 | } | 93 | } |
88 | 94 | ||
89 | ci->configure(DSP_SET_FREQUENCY, (long *)(sc.sample_rate)); | ||
90 | ci->id3->frequency = sc.sample_rate; | 95 | ci->id3->frequency = sc.sample_rate; |
91 | ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000; | 96 | ci->configure(DSP_SET_FREQUENCY, (long *)(sc.sample_rate)); |
97 | |||
98 | if (sc.sample_rate) { | ||
99 | ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000; | ||
100 | } else { | ||
101 | ci->id3->length = 0; | ||
102 | } | ||
103 | |||
104 | if (ci->id3->length) { | ||
105 | ci->id3->bitrate = (ci->id3->filesize * 8) / ci->id3->length; | ||
106 | } | ||
92 | 107 | ||
93 | consumed = sc.gb.index/8; | 108 | consumed = sc.gb.index/8; |
94 | ci->advance_buffer(consumed); | 109 | ci->advance_buffer(consumed); |
@@ -112,7 +127,7 @@ seek_start: | |||
112 | 127 | ||
113 | /* Seek to start of track */ | 128 | /* Seek to start of track */ |
114 | if (ci->seek_time == 1) { | 129 | if (ci->seek_time == 1) { |
115 | if (ci->seek_buffer(sc.header_bits/8)) { | 130 | if (ci->seek_buffer(sc.header_bits/8 + ci->id3->first_frame_offset)) { |
116 | sc.bitindex = sc.header_bits - 8*(sc.header_bits/8); | 131 | sc.bitindex = sc.header_bits - 8*(sc.header_bits/8); |
117 | ci->set_elapsed(0); | 132 | ci->set_elapsed(0); |
118 | ci->seek_complete(); | 133 | ci->seek_complete(); |