diff options
| author | Dave Chapman <dave@dchapman.com> | 2005-11-13 11:04:02 +0000 |
|---|---|---|
| committer | Dave Chapman <dave@dchapman.com> | 2005-11-13 11:04:02 +0000 |
| commit | c01775ff4177d491a79dc65403698c4f39350de1 (patch) | |
| tree | adeba8fdf355a666c465b5c69023a45cc6fba230 /apps/codecs | |
| parent | f40a6fcb30bd6170514446a93b023cfcfc6bd44d (diff) | |
| download | rockbox-c01775ff4177d491a79dc65403698c4f39350de1.zip rockbox-c01775ff4177d491a79dc65403698c4f39350de1.tar.gz rockbox-c01775ff4177d491a79dc65403698c4f39350de1.tar.bz2 rockbox-c01775ff4177d491a79dc65403698c4f39350de1.tar.xz | |
Shorten updates from Mark Arigo: calculate average bitrate, skip id3v2 tags and remove debugf definition from codec
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7840 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
| -rw-r--r-- | apps/codecs/libffmpegFLAC/shndec.c | 5 | ||||
| -rw-r--r-- | apps/codecs/shorten.c | 21 |
2 files changed, 18 insertions, 8 deletions
diff --git a/apps/codecs/libffmpegFLAC/shndec.c b/apps/codecs/libffmpegFLAC/shndec.c index 7f5f5f4..6dde8f7 100644 --- a/apps/codecs/libffmpegFLAC/shndec.c +++ b/apps/codecs/libffmpegFLAC/shndec.c @@ -24,11 +24,6 @@ * */ -#include "../codec.h" -#include "../lib/codeclib.h" -extern struct codec_api* ci; -#define DEBUGF ci->debugf - #include "bitstream.h" #include "golomb.h" #include "shndec.h" diff --git a/apps/codecs/shorten.c b/apps/codecs/shorten.c index c646156..50d7299 100644 --- a/apps/codecs/shorten.c +++ b/apps/codecs/shorten.c @@ -78,6 +78,12 @@ next_track: /* Shorten decoder initialization */ ci->memset(&sc, 0, sizeof(ShortenContext)); + /* Skip id3v2 tags */ + if (ci->id3->first_frame_offset) { + buf = ci->request_buffer(&bytesleft, ci->id3->first_frame_offset); + ci->advance_buffer(ci->id3->first_frame_offset); + } + /* Read the shorten & wave headers */ buf = ci->request_buffer(&bytesleft, MAX_FRAMESIZE); res = shorten_init(&sc, buf, bytesleft); @@ -86,9 +92,18 @@ next_track: return CODEC_ERROR; } - ci->configure(DSP_SET_FREQUENCY, (long *)(sc.sample_rate)); ci->id3->frequency = sc.sample_rate; - ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000; + ci->configure(DSP_SET_FREQUENCY, (long *)(sc.sample_rate)); + + if (sc.sample_rate) { + ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000; + } else { + ci->id3->length = 0; + } + + if (ci->id3->length) { + ci->id3->bitrate = (ci->id3->filesize * 8) / ci->id3->length; + } consumed = sc.gb.index/8; ci->advance_buffer(consumed); @@ -112,7 +127,7 @@ seek_start: /* Seek to start of track */ if (ci->seek_time == 1) { - if (ci->seek_buffer(sc.header_bits/8)) { + if (ci->seek_buffer(sc.header_bits/8 + ci->id3->first_frame_offset)) { sc.bitindex = sc.header_bits - 8*(sc.header_bits/8); ci->set_elapsed(0); ci->seek_complete(); |