1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-09-20 09:04:43 +00:00
QB64-PE/internal/c/parts/audio/decode/mp3/misc/main_hack.txt
Luke Ceddia b586eafd3b Integrated _BLINEINPUT into regular LINE INPUT for BINARY files
LINE INPUT will now use the faster method if passed a file handle
that has been opened FOR BINARY. As such, the _BLINEINPUT command
has been removed.

qb64.bas now takes advantage of this for reading from '$include files,
at least in Include Manager 1. Some tweaking of internal/source/main.txt
was required to get things into a sane state, so I'm holing off changing
the compiler any further so the auto-builder can make sure everything's
smoothed over.

Note: Everything should still compile as normal; I'm just being overcautious.
2014-07-27 00:06:17 +10:00

66 lines
1.5 KiB
Text

//*********************************************************
//decode in_buf to out_buf
#define MP3_ERR -1
#define MP3_OK 0
#define MP3_NEED_MORE 1
int status;
struct mpstr mp;
InitMP3(&mp);
int inlen;
inlen=21759;
int outlen;
outlen=0;
int OUT_BUF_SIZE;
OUT_BUF_SIZE=50000000;
char *bufin;
bufin=(char*)((uptrszint)((&(((uint8*)(__ARRAY_UBYTE_IN_BUF[0]))[array_check(( 0 )-__ARRAY_UBYTE_IN_BUF[4],__ARRAY_UBYTE_IN_BUF[5])]))));
char *bufout;
bufout=(char*)((uptrszint)((&(((uint8*)(__ARRAY_UBYTE_OUT_BUF[0]))[array_check(( 0 )-__ARRAY_UBYTE_OUT_BUF[4],__ARRAY_UBYTE_OUT_BUF[5])]))));
status = decodeMP3(&mp,bufin,inlen,bufout,OUT_BUF_SIZE,&outlen);
bufout+=outlen;
ddd:
status = decodeMP3(&mp,NULL,0,bufout,OUT_BUF_SIZE,&outlen);
bufout+=outlen;
if ((status==0)&&(outlen!=0)) goto ddd;
//status = decodeMP3(&mp,buf,len,out,8192,&size);
/*
while(1) {
37 len = read(0,buf,16384);
38 if(len <= 0)
39 break;
40 ret = decodeMP3(&mp,buf,len,out,8192,&size);
41 while(ret == MP3_OK) {
42 write(1,out,size);
43 ret = decodeMP3(&mp,NULL,0,out,8192,&size);
44 }
45 }
// Initialize buffer
status = decodeMP3(&mp,bufin,inlen,bufout,OUT_BUF_SIZE,&outlen);
qbs_print(qbs_str(status),1);
qbs_print(qbs_str(outlen),1);
// Decode buffer
// status = decodeMP3(&mp,NULL,0,bufout,OUT_BUF_SIZE,&outlen);
status = decodeMP3(&mp,NULL,0,bufout,OUT_BUF_SIZE,&outlen);
qbs_print(qbs_str(status),1);
qbs_print(qbs_str(outlen),1);
*/