(WaveAudio): store ogg/mp3 format tags in a set.

This commit is contained in:
morkt 2015-11-04 04:02:42 +04:00
parent 68832d9544
commit 382b257532

View File

@ -105,11 +105,15 @@ namespace GameRes
public override string Description { get { return "Wave audio format"; } } public override string Description { get { return "Wave audio format"; } }
public override uint Signature { get { return 0x46464952; } } // 'RIFF' public override uint Signature { get { return 0x46464952; } } // 'RIFF'
static readonly HashSet<ushort> EmbeddedFormats = new HashSet<ushort> {
0x674f, 0x6751, 0x6771, // Vorbis
0x0055, // MpegLayer3
};
public override SoundInput TryOpen (Stream file) public override SoundInput TryOpen (Stream file)
{ {
SoundInput sound = new WaveInput (file); SoundInput sound = new WaveInput (file);
if (0x674f == sound.Format.FormatTag || 0x6771 == sound.Format.FormatTag // Vorbis if (EmbeddedFormats.Contains (sound.Format.FormatTag))
|| 0x0055 == sound.Format.FormatTag) // MpegLayer3
{ {
try try
{ {