mirror of
				https://github.com/taglib/taglib.git
				synced 2025-10-30 23:36:29 -04:00 
			
		
		
		
	Ignore 'fact' chunk of WAV files if their format is PCM.
TagLib reports wrong length of some PCM files with a 'fact' chunk.
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								tests/data/pcm_with_fact_chunk.wav
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/data/pcm_with_fact_chunk.wav
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -25,6 +25,7 @@ class TestWAV : public CppUnit::TestFixture | ||||
|   CPPUNIT_TEST(testFuzzedFile1); | ||||
|   CPPUNIT_TEST(testFuzzedFile2); | ||||
|   CPPUNIT_TEST(testStripAndProperties); | ||||
|   CPPUNIT_TEST(testPCMWithFactChunk); | ||||
|   CPPUNIT_TEST_SUITE_END(); | ||||
|  | ||||
| public: | ||||
| @ -247,6 +248,22 @@ public: | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   void testPCMWithFactChunk() | ||||
|   { | ||||
|     RIFF::WAV::File f(TEST_FILE_PATH_C("pcm_with_fact_chunk.wav")); | ||||
|     CPPUNIT_ASSERT(f.audioProperties()); | ||||
|     CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->length()); | ||||
|     CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->lengthInSeconds()); | ||||
|     CPPUNIT_ASSERT_EQUAL(3675, f.audioProperties()->lengthInMilliseconds()); | ||||
|     CPPUNIT_ASSERT_EQUAL(32, f.audioProperties()->bitrate()); | ||||
|     CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels()); | ||||
|     CPPUNIT_ASSERT_EQUAL(1000, f.audioProperties()->sampleRate()); | ||||
|     CPPUNIT_ASSERT_EQUAL(16, f.audioProperties()->bitsPerSample()); | ||||
|     CPPUNIT_ASSERT_EQUAL(16, f.audioProperties()->sampleWidth()); | ||||
|     CPPUNIT_ASSERT_EQUAL(3675U, f.audioProperties()->sampleFrames()); | ||||
|     CPPUNIT_ASSERT_EQUAL(1, f.audioProperties()->format()); | ||||
|   } | ||||
|  | ||||
| }; | ||||
|  | ||||
| CPPUNIT_TEST_SUITE_REGISTRATION(TestWAV); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user