From 4b03c14a3e2b3e983ae019723982d7b44105cb97 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Thu, 3 Nov 2005 18:48:23 +0000 Subject: 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 --- apps/codecs/libffmpegFLAC/bitstream.h | 2 +- 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 668e23a836..288d839c4a 100644 --- a/apps/codecs/libffmpegFLAC/bitstream.h +++ b/apps/codecs/libffmpegFLAC/bitstream.h @@ -15,7 +15,7 @@ #include #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 eea97f4f18..c1d562664e 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]; -- cgit v1.2.3