Move MPEG check to end of content-based detection (#1319)

MPEG::File::isSupported() scans for frame sync bytes that can appear
in other files, causing them to be misidentified as MP3.

This also includes a test with such a file.
This commit is contained in:
Daniel
2026-04-04 01:01:41 -05:00
committed by GitHub
parent 7f2f2ddcaf
commit 49510e7d5a
3 changed files with 7 additions and 2 deletions

Binary file not shown.

View File

@ -167,6 +167,7 @@ class TestFileRefDetectByContent : public CppUnit::TestFixture
CPPUNIT_TEST(testSilence44SFlac);
CPPUNIT_TEST(testSinewaveFlac);
CPPUNIT_TEST(testZeroSizedPaddingFlac);
CPPUNIT_TEST(testFLACWithMPEGSyncBytes);
// Ogg::Speex::File
CPPUNIT_TEST(testEmptySpx);
// Ogg::Opus::File
@ -326,6 +327,9 @@ public:
void testZeroSizedPaddingFlac() {
detectByContent<FLAC::File>("zero-sized-padding.flac");
}
void testFLACWithMPEGSyncBytes() {
detectByContent<FLAC::File>("mpeg-sync-flac.flac");
}
// -- Ogg::Speex::File --
void testEmptySpx() { detectByContent<Ogg::Speex::File>("empty.spx"); }