diff --git a/src/Audio.c b/src/Audio.c index 53b3789fb..c03169900 100644 --- a/src/Audio.c +++ b/src/Audio.c @@ -886,7 +886,10 @@ static cc_result Sound_ReadWaveData(struct Stream* stream, struct Sound* snd) { if ((res = Stream_Read(stream, tmp, 12))) return res; fourCC = Stream_GetU32_BE(tmp + 0); - if (fourCC != WAV_FourCC('R','I','F','F')) return WAV_ERR_STREAM_HDR; + if (fourCC == WAV_FourCC('I', 'D', '3', 2)) return AUDIO_ERR_MP3_SIG; /* ID3 v2.2 tags header */ + if (fourCC == WAV_FourCC('I', 'D', '3', 3)) return AUDIO_ERR_MP3_SIG; /* ID3 v2.3 tags header */ + if (fourCC != WAV_FourCC('R','I','F','F')) return WAV_ERR_STREAM_HDR; + /* tmp[4] (4) file size */ fourCC = Stream_GetU32_BE(tmp + 8); if (fourCC != WAV_FourCC('W','A','V','E')) return WAV_ERR_STREAM_TYPE; diff --git a/src/Errors.h b/src/Errors.h index 8e1094061..c9f595a50 100644 --- a/src/Errors.h +++ b/src/Errors.h @@ -19,9 +19,11 @@ enum CC_ERRORS { WAV_ERR_STREAM_HDR = 0xCCDED007UL, /* Bytes #1-#4 aren't "RIFF" */ WAV_ERR_STREAM_TYPE = 0xCCDED008UL, /* Bytes #9-#12 aren't "WAV " */ WAV_ERR_DATA_TYPE = 0xCCDED009UL, /* Audio data type isn't 1 (PCM) */ - /*WAV_ERR_NO_DATA = 0xCCDED00AUL, no longer used */ + /*WAV_ERR_NO_DATA = 0xCCDED00AUL, repurposed for AUDIO_ERR_MP3_SIG */ WAV_ERR_SAMPLE_BITS = 0xCCDED00BUL, /* Bits per sample isn't 16 */ + AUDIO_ERR_MP3_SIG = 0xCCDED00AUL, /* Signature bytes are "ID3" (repurposed WAV_ERR_NO_DATA) */ + /*VORBIS_ERR_HEADER = 0xCCDED00CUL, no longer used */ VORBIS_ERR_WRONG_HEADER = 0xCCDED00DUL, /* Packet header doesn't match expected type */ VORBIS_ERR_FRAMING = 0xCCDED00EUL, /* Framing flag doesn't match expected value */ diff --git a/src/Logger.c b/src/Logger.c index 1c9010a11..d238fb3bd 100644 --- a/src/Logger.c +++ b/src/Logger.c @@ -59,10 +59,11 @@ static const char* GetCCErrorDesc(cc_result res) { case ERR_INVALID_ARGUMENT: return "Invalid argument"; case ERR_OUT_OF_MEMORY: return "Out of memory"; - case OGG_ERR_INVALID_SIG: return "Invalid OGG signature"; + case OGG_ERR_INVALID_SIG: return "Only OGG music files supported"; case OGG_ERR_VERSION: return "Invalid OGG format version"; + case AUDIO_ERR_MP3_SIG: return "MP3 audio files are not supported"; - case WAV_ERR_STREAM_HDR: return "Invalid WAV header"; + case WAV_ERR_STREAM_HDR: return "Only WAV sound files supported"; case WAV_ERR_STREAM_TYPE: return "Invalid WAV type"; case WAV_ERR_DATA_TYPE: return "Unsupported WAV audio format"; diff --git a/src/Model.c b/src/Model.c index 4299e7074..7587fa46b 100644 --- a/src/Model.c +++ b/src/Model.c @@ -11,7 +11,6 @@ #include "Drawer.h" #include "Block.h" #include "Stream.h" -#include "Funcs.h" #include "Options.h" struct _ModelsData Models; diff --git a/src/Vorbis.c b/src/Vorbis.c index 33dc000dd..453995d9b 100644 --- a/src/Vorbis.c +++ b/src/Vorbis.c @@ -52,6 +52,8 @@ static cc_result Ogg_NextPage(struct OggState* ctx) { if ((res = Stream_Read(source, header, sizeof(header)))) return res; sig = Stream_GetU32_BE(&header[0]); + if (sig == OGG_FourCC('I','D','3', 2)) return AUDIO_ERR_MP3_SIG; /* ID3 v2.2 tags header */ + if (sig == OGG_FourCC('I','D','3', 3)) return AUDIO_ERR_MP3_SIG; /* ID3 v2.3 tags header */ if (sig != OGG_FourCC('O','g','g','S')) return OGG_ERR_INVALID_SIG; if (header[4] != 0) return OGG_ERR_VERSION; diff --git a/src/Window_Haiku.cpp b/src/Window_Haiku.cpp index 76a7b9f0c..823c3f514 100644 --- a/src/Window_Haiku.cpp +++ b/src/Window_Haiku.cpp @@ -10,10 +10,20 @@ extern "C" { #include "Utils.h" } -#include -#include -#include -#include +// AppKit +#include +#include +#include +// GLKit +#include +#include +// InterfaceKit +#include +#include +#include +// StorageKit +#include +#include static BApplication* app_handle; static BWindow* win_handle;