forked from len0rd/rockbox
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
This commit is contained in:
parent
439ba9bdbb
commit
4b03c14a3e
2 changed files with 22 additions and 5 deletions
|
|
@ -15,7 +15,7 @@
|
|||
#include <stdio.h>
|
||||
#define IBSS_ATTR
|
||||
#define ICONST_ATTR
|
||||
|
||||
#define ICODE_ATTR
|
||||
#endif
|
||||
|
||||
/* Endian conversion routines for standalone compilation */
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue