audio/mp3: Move Read_CRC to Go

This commit is contained in:
Hajime Hoshi 2017-06-13 10:28:21 +09:00
parent 5dd91f6c83
commit b3e3adb9f0
3 changed files with 12 additions and 13 deletions

View File

@ -37,6 +37,14 @@ var (
writer io.Writer
)
//export Read_CRC
func Read_CRC() C.int {
if Get_Byte() == eof || Get_Byte() == eof {
return C.FALSE
}
return C.OK
}
//export Get_Byte
func Get_Byte() C.unsigned {
for len(readerCache) == 0 && !readerEOF {

View File

@ -78,8 +78,6 @@ typedef struct { /* Scale factor band indices,for long and short windows */
}
t_sf_band_indices;
#define TRUE 1
#define FALSE 0
#define C_SYNC 0xffe00000
#define C_EOF 0xffffffff
#define C_PI 3.14159265358979323846
@ -110,7 +108,6 @@ static void dmp_samples(t_mpeg1_main_data *md,int gr,int ch,int type);
#endif
static int Read_Audio_L3(void);
static int Read_CRC(void);
static int Read_Header(void) ;
static int Read_Main_L3(void);
@ -728,16 +725,6 @@ static int Read_Audio_L3(void){
}
/**Description: Reads 16 CRC bits
* Parameters: None
* Return value: OK or ERROR if CRC could not be read.
* Author: Krister Lagerström(krister@kmlager.com) **/
static int Read_CRC(void){
/* Get next two bytes from bitstream, If we got an End Of File we're done */
if((Get_Byte()==C_EOF)||(Get_Byte()==C_EOF)) return(FALSE);
return(OK); /* Done */
}
/**Description: Search for next frame and read it into buffer. Main data in
this frame is saved for two frames since it might be needed by them.
* Parameters: None

View File

@ -13,6 +13,8 @@
#define OK 0
#define ERROR -1
#define TRUE 1
#define FALSE 0
unsigned Get_Byte(void);
unsigned Get_Bytes(unsigned num, unsigned* data_vec);
@ -32,6 +34,8 @@ unsigned Get_Main_Bits(unsigned number_of_bits);
void Get_Sideinfo(unsigned sideinfo_size);
unsigned Get_Side_Bits(unsigned number_of_bits);
int Read_CRC(void);
int Huffman_Decode(unsigned table_num, int32_t* x, int32_t*y, int32_t* v, int32_t* w);
#endif