mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:32:45 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			727 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			727 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2021, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibAudio/FlacLoader.h>
 | |
| #include <LibAudio/WavLoader.h>
 | |
| 
 | |
| namespace Audio {
 | |
| 
 | |
| Loader::Loader(StringView path)
 | |
| {
 | |
|     m_plugin = make<WavLoaderPlugin>(path);
 | |
|     if (m_plugin->sniff())
 | |
|         return;
 | |
|     m_plugin = make<FlacLoaderPlugin>(path);
 | |
|     if (m_plugin->sniff())
 | |
|         return;
 | |
|     m_plugin = nullptr;
 | |
| }
 | |
| 
 | |
| Loader::Loader(const ByteBuffer& buffer)
 | |
| {
 | |
|     m_plugin = make<WavLoaderPlugin>(buffer);
 | |
|     if (m_plugin->sniff())
 | |
|         return;
 | |
|     m_plugin = make<FlacLoaderPlugin>(buffer);
 | |
|     if (m_plugin->sniff()) {
 | |
|         dbgln("FLAC sniff successful");
 | |
|         return;
 | |
|     }
 | |
|     m_plugin = nullptr;
 | |
| }
 | |
| 
 | |
| }
 | 
