@@ -144,7 +144,7 @@ uint32_t readUint(uint8_t nBits, int32_t *bytesLeft){
144144 uint8_t temp = *(s_flacInptr + s_rIndex);
145145 s_rIndex++;
146146 (*bytesLeft)--;
147- if (*bytesLeft < 0 ) { log_e (" error in bitreader" ); s_f_bitReaderError = true ; break ;}
147+ if (*bytesLeft < 0 ) { FLAC_LOG_ERROR (" error in bitreader" ); s_f_bitReaderError = true ; break ;}
148148 s_flac_bitBuffer = (s_flac_bitBuffer << 8 ) | temp;
149149 s_flacBitBufferLen += 8 ;
150150 }
@@ -219,9 +219,9 @@ boolean FLACFindMagicWord(unsigned char* buf, int32_t nBytes){
219219 uint32_t lomd = (buf[idx + 2 ] << 16 ) + (buf[idx + 3 ] << 8 ) + buf[idx + 4 ]; // Length of metadata to follow
220220
221221 (void )lmdbf; (void )bt; (void )lomd;
222- // log_i ("Last-metadata-block flag: %d", lmdbf);
223- // log_i ("block type: %d", bt);
224- // log_i ("Length (in bytes) of metadata to follow: %d", lomd);
222+ // FLAC_LOG_INFO ("Last-metadata-block flag: %d", lmdbf);
223+ // FLAC_LOG_INFO ("block type: %d", bt);
224+ // FLAC_LOG_INFO ("Length (in bytes) of metadata to follow: %d", lomd);
225225 return true ;
226226 }
227227 return false ;
@@ -278,15 +278,15 @@ int32_t FLACparseOGG(uint8_t *inbuf, int32_t *bytesLeft){ // reference https://
278278 }
279279 s_flacSegmTableVec.insert (s_flacSegmTableVec.begin (), n);
280280 }
281- // for(int32_t i = 0; i< s_flacSegmTableVec.size(); i++){log_w ("%i", s_flacSegmTableVec[i]);}
281+ // for(int32_t i = 0; i< s_flacSegmTableVec.size(); i++){FLAC_LOG_INFO ("%i", s_flacSegmTableVec[i]);}
282282
283283 bool continuedPage = headerType & 0x01 ; // set: page contains data of a packet continued from the previous page
284284 bool firstPage = headerType & 0x02 ; // set: this is the first page of a logical bitstream (bos)
285285 bool lastPage = headerType & 0x04 ; // set: this is the last page of a logical bitstream (eos)
286286
287287 (void )continuedPage; (void )lastPage;
288288
289- // log_w ("firstPage %i, continuedPage %i, lastPage %i", firstPage, continuedPage, lastPage);
289+ // FLAC_LOG_INFO ("firstPage %i, continuedPage %i, lastPage %i", firstPage, continuedPage, lastPage);
290290
291291 if (firstPage) s_flacPageNr = 0 ;
292292
@@ -314,7 +314,7 @@ int32_t parseFlacFirstPacket(uint8_t *inbuf, int16_t nBytes){ // 4.2.2. Identifi
314314
315315 int32_t ret = 0 ;
316316 int32_t idx = FLAC_specialIndexOf (inbuf, " fLaC" , nBytes);
317- // log_i ("idx %i, nBytes %i", idx, nBytes);
317+ // FLAC_LOG_INFO ("idx %i, nBytes %i", idx, nBytes);
318318 if (idx >= 0 ){ // FLAC signature found
319319 ret = idx + 4 ;
320320 }
@@ -350,12 +350,12 @@ int32_t parseMetaDataBlockHeader(uint8_t *inbuf, int16_t nBytes){
350350
351351 while (true ){
352352 mdBlockHeader = *(inbuf + pos);
353- s_f_lastMetaDataBlock = mdBlockHeader & 0b10000000 ; // log_w ("lastMdBlockFlag %i", s_f_lastMetaDataBlock);
354- blockType = mdBlockHeader & 0b01111111 ; // log_w ("blockType %i", blockType);
353+ s_f_lastMetaDataBlock = mdBlockHeader & 0b10000000 ; // FLAC_LOG_INFO ("lastMdBlockFlag %i", s_f_lastMetaDataBlock);
354+ blockType = mdBlockHeader & 0b01111111 ; // FLAC_LOG_INFO ("blockType %i", blockType);
355355
356356 blockLength = *(inbuf + pos + 1 ) << 16 ;
357357 blockLength += *(inbuf + pos + 2 ) << 8 ;
358- blockLength += *(inbuf + pos + 3 ); // log_w ("blockLength %i", blockLength);
358+ blockLength += *(inbuf + pos + 3 ); // FLAC_LOG_INFO ("blockLength %i", blockLength);
359359
360360 nBytes -= 4 ;
361361 pos += 4 ;
@@ -366,7 +366,7 @@ int32_t parseMetaDataBlockHeader(uint8_t *inbuf, int16_t nBytes){
366366 break ;
367367 case 1 :
368368 bt = padding;
369- // log_e ("padding");
369+ // FLAC_LOG_ERROR ("padding");
370370 return FLAC_NONE;
371371 break ;
372372 case 2 :
@@ -402,8 +402,8 @@ int32_t parseMetaDataBlockHeader(uint8_t *inbuf, int16_t nBytes){
402402 minBlocksize += *(inbuf + pos + 1 );
403403 maxBlocksize += *(inbuf + pos + 2 ) << 8 ;
404404 maxBlocksize += *(inbuf + pos + 3 );
405- // log_i ("minBlocksize %i", minBlocksize);
406- // log_i ("maxBlocksize %i", maxBlocksize);
405+ // FLAC_LOG_INFO ("minBlocksize %i", minBlocksize);
406+ // FLAC_LOG_INFO ("maxBlocksize %i", maxBlocksize);
407407 FLACMetadataBlock->minblocksize = minBlocksize;
408408 FLACMetadataBlock->maxblocksize = maxBlocksize;
409409
@@ -415,35 +415,35 @@ int32_t parseMetaDataBlockHeader(uint8_t *inbuf, int16_t nBytes){
415415 maxFrameSize = *(inbuf + pos + 7 ) << 16 ;
416416 maxFrameSize += *(inbuf + pos + 8 ) << 8 ;
417417 maxFrameSize += *(inbuf + pos + 9 );
418- // log_i ("minFrameSize %i", minFrameSize);
419- // log_i ("maxFrameSize %i", maxFrameSize);
418+ // FLAC_LOG_INFO ("minFrameSize %i", minFrameSize);
419+ // FLAC_LOG_INFO ("maxFrameSize %i", maxFrameSize);
420420 FLACMetadataBlock->minframesize = minFrameSize;
421421 FLACMetadataBlock->maxframesize = maxFrameSize;
422422
423423 sampleRate = *(inbuf + pos + 10 ) << 12 ;
424424 sampleRate += *(inbuf + pos + 11 ) << 4 ;
425425 sampleRate += (*(inbuf + pos + 12 ) & 0xF0 ) >> 4 ;
426- // log_i ("sampleRate %i", sampleRate);
426+ // FLAC_LOG_INFO ("sampleRate %i", sampleRate);
427427 FLACMetadataBlock->sampleRate = sampleRate;
428428
429429 nrOfChannels = ((*(inbuf + pos + 12 ) & 0x0E ) >> 1 ) + 1 ;
430- // log_i ("nrOfChannels %i", nrOfChannels);
430+ // FLAC_LOG_INFO ("nrOfChannels %i", nrOfChannels);
431431 FLACMetadataBlock->numChannels = nrOfChannels;
432432
433433 bitsPerSample = (*(inbuf + pos + 12 ) & 0x01 ) << 5 ;
434434 bitsPerSample += ((*(inbuf + pos + 13 ) & 0xF0 ) >> 4 ) + 1 ;
435435 FLACMetadataBlock->bitsPerSample = bitsPerSample;
436- // log_i ("bitsPerSample %i", bitsPerSample);
436+ // FLAC_LOG_INFO ("bitsPerSample %i", bitsPerSample);
437437
438438 totalSamplesInStream = (uint64_t )(*(inbuf + pos + 17 ) & 0x0F ) << 32 ;
439439 totalSamplesInStream += (*(inbuf + pos + 14 )) << 24 ;
440440 totalSamplesInStream += (*(inbuf + pos + 14 )) << 16 ;
441441 totalSamplesInStream += (*(inbuf + pos + 15 )) << 8 ;
442442 totalSamplesInStream += (*(inbuf + pos + 16 ));
443- // log_i ("totalSamplesInStream %lli", totalSamplesInStream);
443+ // FLAC_LOG_INFO ("totalSamplesInStream %lli", totalSamplesInStream);
444444 FLACMetadataBlock->totalSamples = totalSamplesInStream;
445445
446- // log_i ("nBytes %i, blockLength %i", nBytes, blockLength);
446+ // FLAC_LOG_INFO ("nBytes %i, blockLength %i", nBytes, blockLength);
447447 pos += blockLength;
448448 nBytes -= blockLength;
449449 if (ret == FLAC_PARSE_OGG_DONE) return ret;
@@ -510,8 +510,8 @@ int32_t parseMetaDataBlockHeader(uint8_t *inbuf, int16_t nBytes){
510510 s_flacBlockPicLenUntilFrameEnd = nBytes - (pos + 23 );
511511 if (s_flacBlockPicLen < s_flacBlockPicLenUntilFrameEnd) s_flacBlockPicLenUntilFrameEnd = s_flacBlockPicLen;
512512 s_flacRemainBlockPicLen = s_flacBlockPicLen - s_flacBlockPicLenUntilFrameEnd;
513- // log_i ("s_flacBlockPicPos %i, s_flacBlockPicLen %i", s_flacBlockPicPos, s_flacBlockPicLen);
514- // log_i ("s_flacBlockPicLenUntilFrameEnd %i, s_flacRemainBlockPicLen %i", s_flacBlockPicLenUntilFrameEnd, s_flacRemainBlockPicLen);
513+ // FLAC_LOG_INFO ("s_flacBlockPicPos %i, s_flacBlockPicLen %i", s_flacBlockPicPos, s_flacBlockPicLen);
514+ // FLAC_LOG_INFO ("s_flacBlockPicLenUntilFrameEnd %i, s_flacRemainBlockPicLen %i", s_flacBlockPicLenUntilFrameEnd, s_flacRemainBlockPicLen);
515515 if (s_flacRemainBlockPicLen <= 0 ) s_f_lastMetaDataBlock = true ; // exeption:: goto audiopage after commemt if lastMetaDataFlag is not set
516516 if (s_flacBlockPicLen){
517517 s_flacBlockPicItem.clear ();
@@ -605,18 +605,18 @@ int8_t FLACDecode(uint8_t *inbuf, int32_t *bytesLeft, int16_t *outbuf){ // MAIN
605605 else return ret; // error
606606 }
607607 // -------------------------------------------------------
608- if (!s_flacSegmTableVec.size ()) log_e (" size is 0" );
608+ if (!s_flacSegmTableVec.size ()) FLAC_LOG_ERROR (" size is 0" );
609609 segmLen = s_flacSegmTableVec.back ();
610610 s_flacSegmTableVec.pop_back ();
611611 if (!s_flacSegmTableVec.size ()) s_f_flacParseOgg = true ;
612612 // -------------------------------------------------------
613613
614614 if (s_flacRemainBlockPicLen <= 0 && !s_f_flacNewMetadataBlockPicture) {
615615 if (s_flacBlockPicItem.size () > 0 ) { // get blockpic data
616- // log_i ("---------------------------------------------------------------------------");
617- // log_i ("metadata blockpic found at pos %i, size %i bytes", s_flacBlockPicPos, s_flacBlockPicLen);
618- // for(int32_t i = 0; i < s_flacBlockPicItem.size(); i += 2) { log_i ("segment %02i, pos %07i, len %05i", i / 2, s_flacBlockPicItem[i], s_flacBlockPicItem[i + 1]); }
619- // log_i ("---------------------------------------------------------------------------");
616+ // FLAC_LOG_INFO ("---------------------------------------------------------------------------");
617+ // FLAC_LOG_INFO ("metadata blockpic found at pos %i, size %i bytes", s_flacBlockPicPos, s_flacBlockPicLen);
618+ // for(int32_t i = 0; i < s_flacBlockPicItem.size(); i += 2) { FLAC_LOG_INFO ("segment %02i, pos %07i, len %05i", i / 2, s_flacBlockPicItem[i], s_flacBlockPicItem[i + 1]); }
619+ // FLAC_LOG_INFO ("---------------------------------------------------------------------------");
620620 s_f_flacNewMetadataBlockPicture = true ;
621621 }
622622 }
@@ -642,7 +642,7 @@ int8_t FLACDecode(uint8_t *inbuf, int32_t *bytesLeft, int16_t *outbuf){ // MAIN
642642 case 1 :
643643 if (s_flacRemainBlockPicLen > 0 ){
644644 s_flacRemainBlockPicLen -= segmLen;
645- // log_i ("s_flacCurrentFilePos %i, len %i, s_flacRemainBlockPicLen %i", s_flacCurrentFilePos, segmLen, s_flacRemainBlockPicLen);
645+ // FLAC_LOG_INFO ("s_flacCurrentFilePos %i, len %i, s_flacRemainBlockPicLen %i", s_flacCurrentFilePos, segmLen, s_flacRemainBlockPicLen);
646646 s_flacBlockPicItem.push_back (s_flacCurrentFilePos);
647647 s_flacBlockPicItem.push_back (segmLen);
648648 if (s_flacRemainBlockPicLen <= 0 ){s_flacPageNr = 2 ;}
@@ -716,18 +716,18 @@ int8_t FLACDecodeNative(uint8_t *inbuf, int32_t *bytesLeft, int16_t *outbuf){
716716 sbl = 0 ;
717717 s_flacBitrate = FLACMetadataBlock->sampleRate * FLACMetadataBlock->bitsPerSample * FLACMetadataBlock->numChannels ;
718718 s_flacBitrate /= s_flacCompressionRatio;
719- // log_e ("s_flacBitrate %i, s_flacCompressionRatio %f, FLACMetadataBlock->sampleRate %i ", s_flacBitrate, s_flacCompressionRatio, FLACMetadataBlock->sampleRate);
719+ // FLAC_LOG_INFO ("s_flacBitrate %i, s_flacCompressionRatio %f, FLACMetadataBlock->sampleRate %i ", s_flacBitrate, s_flacCompressionRatio, FLACMetadataBlock->sampleRate);
720720 }
721721 if (s_offset != s_numOfOutSamples) return GIVE_NEXT_LOOP;
722- if (s_offset > s_numOfOutSamples) { log_e (" offset has a wrong value" ); }
722+ if (s_offset > s_numOfOutSamples) { FLAC_LOG_ERROR (" offset has a wrong value" ); }
723723 s_offset = 0 ;
724724 }
725725
726726 alignToByte ();
727727 readUint (16 , bytesLeft);
728728
729729// s_flacCompressionRatio = (float)m_bytesDecoded / (float)s_numOfOutSamples * FLACMetadataBlock->numChannels * (16/8);
730- // log_i ("s_flacCompressionRatio % f", s_flacCompressionRatio);
730+ // FLAC_LOG_INFO ("s_flacCompressionRatio % f", s_flacCompressionRatio);
731731 s_flacStatus = DECODE_FRAME;
732732 return FLAC_NONE;
733733}
0 commit comments