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/main.c | |
parent | 439ba9bdbb059d9065aa4d26688e50ab90ed5930 (diff) | |
download | rockbox-4b03c14a3e2b3e983ae019723982d7b44105cb97.tar.gz rockbox-4b03c14a3e2b3e983ae019723982d7b44105cb97.zip |
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/main.c')
-rw-r--r-- | apps/codecs/libffmpegFLAC/main.c | 25 |
1 files changed, 21 insertions, 4 deletions
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) | |||
138 | bool found_streaminfo=false; | 138 | bool found_streaminfo=false; |
139 | int endofmetadata=0; | 139 | int endofmetadata=0; |
140 | int blocklength; | 140 | int blocklength; |
141 | uint32_t* p; | ||
142 | uint32_t seekpoint_lo,seekpoint_hi; | ||
143 | uint32_t offset_lo,offset_hi; | ||
144 | int n; | ||
141 | 145 | ||
142 | if (lseek(fd, 0, SEEK_SET) < 0) | 146 | if (lseek(fd, 0, SEEK_SET) < 0) |
143 | { | 147 | { |
@@ -196,9 +200,22 @@ static bool flac_init(int fd, FLACContext* fc) | |||
196 | found_streaminfo=true; | 200 | found_streaminfo=true; |
197 | } else if ((buf[0] & 0x7f) == 3) { /* 3 is the SEEKTABLE block */ | 201 | } else if ((buf[0] & 0x7f) == 3) { /* 3 is the SEEKTABLE block */ |
198 | fprintf(stderr,"Seektable length = %d bytes\n",blocklength); | 202 | fprintf(stderr,"Seektable length = %d bytes\n",blocklength); |
199 | if (lseek(fd, blocklength, SEEK_CUR) < 0) { | 203 | while (blocklength >= 18) { |
200 | return false; | 204 | n=read(fd,buf,18); |
201 | } | 205 | if (n < 18) return false; |
206 | blocklength-=n; | ||
207 | |||
208 | p=(uint32_t*)buf; | ||
209 | seekpoint_hi=betoh32(*(p++)); | ||
210 | seekpoint_lo=betoh32(*(p++)); | ||
211 | offset_hi=betoh32(*(p++)); | ||
212 | offset_lo=betoh32(*(p++)); | ||
213 | |||
214 | if ((seekpoint_hi != 0xffffffff) && (seekpoint_lo != 0xffffffff)) { | ||
215 | fprintf(stderr,"Seekpoint: %u, Offset=%u\n",seekpoint_lo,offset_lo); | ||
216 | } | ||
217 | } | ||
218 | lseek(fd, blocklength, SEEK_CUR); | ||
202 | } else { | 219 | } else { |
203 | /* Skip to next metadata block */ | 220 | /* Skip to next metadata block */ |
204 | if (lseek(fd, blocklength, SEEK_CUR) < 0) | 221 | if (lseek(fd, blocklength, SEEK_CUR) < 0) |
@@ -227,7 +244,7 @@ int main(int argc, char* argv[]) { | |||
227 | int i; | 244 | int i; |
228 | int bytesleft; | 245 | int bytesleft; |
229 | int consumed; | 246 | int consumed; |
230 | char buf[MAX_FRAMESIZE]; /* The input buffer */ | 247 | unsigned char buf[MAX_FRAMESIZE]; /* The input buffer */ |
231 | /* The output buffers containing the decoded samples (channels 0 and 1) */ | 248 | /* The output buffers containing the decoded samples (channels 0 and 1) */ |
232 | int32_t decoded0[MAX_BLOCKSIZE]; | 249 | int32_t decoded0[MAX_BLOCKSIZE]; |
233 | int32_t decoded1[MAX_BLOCKSIZE]; | 250 | int32_t decoded1[MAX_BLOCKSIZE]; |