ddiakopoulos / libnyquist

:microphone: Cross platform C++11 library for decoding audio (mp3, wav, ogg, opus, flac, etc)
BSD 2-Clause "Simplified" License
540 stars 66 forks source link

NyquistIO::Load creates temporary map every time it's called #65

Closed SamVanheer closed 2 years ago

SamVanheer commented 2 years ago

The function NyquistIO::Load(AudioData * data, const std::vector<uint8_t> & buffer) creates a temporary map of magic identifiers to extensions every time it's called. Since this is a read-only map it's probably best to make this a global constant to eliminate the overhead.

The function also continues scanning for magic after it's found a match, is that required? Otherwise i'll make a separate issue for that.