diff options
| author | Dave Chapman <dave@dchapman.com> | 2005-11-03 18:48:23 +0000 |
|---|---|---|
| committer | Dave Chapman <dave@dchapman.com> | 2005-11-03 18:48:23 +0000 |
| commit | 4b03c14a3e2b3e983ae019723982d7b44105cb97 (patch) | |
| tree | 76d2374c6f5c0bd83531804e8dce1a334c533c16 /apps/codecs/libffmpegFLAC | |
| parent | 439ba9bdbb059d9065aa4d26688e50ab90ed5930 (diff) | |
| download | rockbox-4b03c14a3e2b3e983ae019723982d7b44105cb97.zip rockbox-4b03c14a3e2b3e983ae019723982d7b44105cb97.tar.gz rockbox-4b03c14a3e2b3e983ae019723982d7b44105cb97.tar.bz2 rockbox-4b03c14a3e2b3e983ae019723982d7b44105cb97.tar.xz | |
Add seekpoint parsing and dummy ICODE_ATTR macro to standalone FLAC test program
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7742 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libffmpegFLAC')
| -rw-r--r-- | apps/codecs/libffmpegFLAC/bitstream.h | 2 | ||||
| -rw-r--r-- | apps/codecs/libffmpegFLAC/main.c | 25 |
2 files changed, 22 insertions, 5 deletions
diff --git a/apps/codecs/libffmpegFLAC/bitstream.h b/apps/codecs/libffmpegFLAC/bitstream.h index 668e23a..288d839 100644 --- a/apps/codecs/libffmpegFLAC/bitstream.h +++ b/apps/codecs/libffmpegFLAC/bitstream.h @@ -15,7 +15,7 @@ #include <stdio.h> #define IBSS_ATTR #define ICONST_ATTR - + #define ICODE_ATTR #endif /* Endian conversion routines for standalone compilation */ diff --git a/apps/codecs/libffmpegFLAC/main.c b/apps/codecs/libffmpegFLAC/main.c index eea97f4..c1d5626 100644 --- a/apps/codecs/libffmpegFLAC/main.c +++ b/apps/codecs/libffmpegFLAC/main.c @@ -138,6 +138,10 @@ static bool flac_init(int fd, FLACContext* fc) bool found_streaminfo=false; int endofmetadata=0; int blocklength; + uint32_t* p; + uint32_t seekpoint_lo,seekpoint_hi; + uint32_t offset_lo,offset_hi; + int n; if (lseek(fd, 0, SEEK_SET) < 0) { @@ -196,9 +200,22 @@ static bool flac_init(int fd, FLACContext* fc) found_streaminfo=true; } else if ((buf[0] & 0x7f) == 3) { /* 3 is the SEEKTABLE block */ fprintf(stderr,"Seektable length = %d bytes\n",blocklength); - if (lseek(fd, blocklength, SEEK_CUR) < 0) { - return false; - } + while (blocklength >= 18) { + n=read(fd,buf,18); + if (n < 18) return false; + blocklength-=n; + + p=(uint32_t*)buf; + seekpoint_hi=betoh32(*(p++)); + seekpoint_lo=betoh32(*(p++)); + offset_hi=betoh32(*(p++)); + offset_lo=betoh32(*(p++)); + + if ((seekpoint_hi != 0xffffffff) && (seekpoint_lo != 0xffffffff)) { + fprintf(stderr,"Seekpoint: %u, Offset=%u\n",seekpoint_lo,offset_lo); + } + } + lseek(fd, blocklength, SEEK_CUR); } else { /* Skip to next metadata block */ if (lseek(fd, blocklength, SEEK_CUR) < 0) @@ -227,7 +244,7 @@ int main(int argc, char* argv[]) { int i; int bytesleft; int consumed; - char buf[MAX_FRAMESIZE]; /* The input buffer */ + unsigned char buf[MAX_FRAMESIZE]; /* The input buffer */ /* The output buffers containing the decoded samples (channels 0 and 1) */ int32_t decoded0[MAX_BLOCKSIZE]; int32_t decoded1[MAX_BLOCKSIZE]; |