diff --git a/src/decoder/dec_mac.cpp b/src/decoder/dec_mac.cpp index c868ee9..d291690 100644 --- a/src/decoder/dec_mac.cpp +++ b/src/decoder/dec_mac.cpp @@ -24,6 +24,7 @@ #include #include #include +#include /* expand this to nothing so there's no error when including MACLib.h */ @@ -60,9 +61,9 @@ decode_mac(decoder_t * dec) { mac_pdata_t * pd = (mac_pdata_t *)dec->pdata; file_decoder_t * fdec = dec->fdec; - IAPEDecompress * pdecompress = (IAPEDecompress *)pd->decompress; + APE::IAPEDecompress * pdecompress = (APE::IAPEDecompress *)pd->decompress; - int act_read = 0; + APE::int64 act_read = 0; unsigned long scale = 1 << (pd->bits_per_sample - 1); float fbuf[2 * BLOCKS_PER_READ]; int n = 0; @@ -170,31 +171,33 @@ mac_decoder_open(decoder_t * dec, char * filename) { mac_pdata_t * pd = (mac_pdata_t *)dec->pdata; file_decoder_t * fdec = dec->fdec; metadata_t * meta; - IAPEDecompress * pdecompress = (IAPEDecompress *)pd->decompress; + APE::IAPEDecompress * pdecompress = (APE::IAPEDecompress *)pd->decompress; const char * comp_level = NULL; int ret = 0; #ifdef __OpenBSD__ wchar_t * pUTF16 = GetUTF16FromANSI(filename); -#else - wchar_t * pUTF16 = CAPECharacterHelper::GetUTF16FromANSI(filename); -#endif pdecompress = CreateIAPEDecompress(pUTF16, &ret); free(pUTF16); +#else + gunichar2 * pUTF16 = g_utf8_to_utf16(filename, -1, NULL, NULL, NULL); + pdecompress = CreateIAPEDecompress((wchar_t *)pUTF16, &ret, FALSE, FALSE); + g_free(pUTF16); +#endif if (!pdecompress || ret != ERROR_SUCCESS) { return DECODER_OPEN_BADLIB; } pd->decompress = (void *)pdecompress; - pd->sample_rate = pdecompress->GetInfo(APE_INFO_SAMPLE_RATE); - pd->bits_per_sample = pdecompress->GetInfo(APE_INFO_BITS_PER_SAMPLE); - pd->bitrate = pdecompress->GetInfo(APE_DECOMPRESS_AVERAGE_BITRATE); - pd->channels = pdecompress->GetInfo(APE_INFO_CHANNELS); - pd->length_in_ms = pdecompress->GetInfo(APE_DECOMPRESS_LENGTH_MS); - pd->block_align = pdecompress->GetInfo(APE_INFO_BLOCK_ALIGN); - pd->compression_level = pdecompress->GetInfo(APE_INFO_COMPRESSION_LEVEL); + pd->sample_rate = pdecompress->GetInfo(APE::APE_INFO_SAMPLE_RATE); + pd->bits_per_sample = pdecompress->GetInfo(APE::APE_INFO_BITS_PER_SAMPLE); + pd->bitrate = pdecompress->GetInfo(APE::APE_DECOMPRESS_AVERAGE_BITRATE); + pd->channels = pdecompress->GetInfo(APE::APE_INFO_CHANNELS); + pd->length_in_ms = pdecompress->GetInfo(APE::APE_DECOMPRESS_LENGTH_MS); + pd->block_align = pdecompress->GetInfo(APE::APE_INFO_BLOCK_ALIGN); + pd->compression_level = pdecompress->GetInfo(APE::APE_INFO_COMPRESSION_LEVEL); if ((pd->channels != 1) && (pd->channels != 2)) { printf("Sorry, MAC file with %d channels is not supported.\n", pd->channels); @@ -218,19 +221,19 @@ mac_decoder_open(decoder_t * dec, char * filename) { fdec->file_lib = MAC_LIB; switch (pd->compression_level) { - case COMPRESSION_LEVEL_FAST: + case MAC_COMPRESSION_LEVEL_FAST: comp_level = _("Compression: Fast"); break; - case COMPRESSION_LEVEL_NORMAL: + case MAC_COMPRESSION_LEVEL_NORMAL: comp_level = _("Compression: Normal"); break; - case COMPRESSION_LEVEL_HIGH: + case MAC_COMPRESSION_LEVEL_HIGH: comp_level = _("Compression: High"); break; - case COMPRESSION_LEVEL_EXTRA_HIGH: + case MAC_COMPRESSION_LEVEL_EXTRA_HIGH: comp_level = _("Compression: Extra High"); break; - case COMPRESSION_LEVEL_INSANE: + case MAC_COMPRESSION_LEVEL_INSANE: comp_level = _("Compression: Insane"); break; default: @@ -255,7 +258,7 @@ void mac_decoder_close(decoder_t * dec) { mac_pdata_t * pd = (mac_pdata_t *)dec->pdata; - IAPEDecompress * pdecompress = (IAPEDecompress *)pd->decompress; + APE::IAPEDecompress * pdecompress = (APE::IAPEDecompress *)pd->decompress; delete(pdecompress); rb_free(pd->rb); @@ -294,7 +297,7 @@ mac_decoder_seek(decoder_t * dec, unsigned long long seek_to_pos) { mac_pdata_t * pd = (mac_pdata_t *)dec->pdata; file_decoder_t * fdec = dec->fdec; - IAPEDecompress * pdecompress = (IAPEDecompress *)pd->decompress; + APE::IAPEDecompress * pdecompress = (APE::IAPEDecompress *)pd->decompress; char flush_dest; pdecompress->Seek(seek_to_pos);