Sfoglia il codice sorgente

For AAC, do not enable SBR by default

Philippe G 4 anni fa
parent
commit
7b439ae6ee

+ 6 - 1
components/codecs/CMakeLists.txt

@@ -2,9 +2,14 @@ idf_component_register(
 	   INCLUDE_DIRS .  ./inc  inc/alac inc/FLAC  inc/helix-aac inc/mad inc/ogg inc/opus inc/opusfile inc/resample16 inc/soxr inc/vorbis
 )
 
+if (DEFINED AAC_ENABLE_SBR)
+add_prebuilt_library(libhelix-aac 	lib/libhelix-aac-sbr.a ) 
+else ()
+add_prebuilt_library(libhelix-aac 	lib/libhelix-aac.a ) 
+endif()
+
 add_prebuilt_library(libmad 		lib/libmad.a)
 add_prebuilt_library(libFLAC 		lib/libFLAC.a ) 
-add_prebuilt_library(libhelix-aac 	lib/libhelix-aac.a ) 
 add_prebuilt_library(libvorbisidec 	lib/libvorbisidec.a ) 
 add_prebuilt_library(libogg 		lib/libogg.a )
 add_prebuilt_library(libalac 		lib/libalac.a ) 

BIN
components/codecs/lib/libhelix-aac-sbr.a


BIN
components/codecs/lib/libhelix-aac.a


+ 4 - 0
components/squeezelite/CMakeLists.txt

@@ -37,4 +37,8 @@ else()
 	add_definitions(-DRESAMPLE16 -DBYTES_PER_FRAME=4)
 endif()	
 
+if (DEFINED AAC_ENABLE_SBR)
+	add_definitions(-DAAC_ENABLE_SBR)
+endif()	
+
 add_compile_options (-O3 ) 

+ 4 - 0
components/squeezelite/helix-aac.c

@@ -160,6 +160,7 @@ static int read_mp4_header(unsigned long *samplerate_p, unsigned char *channels_
 			info.nChans = (*ptr & 0x7f) >> 3;
 			*channels_p = info.nChans;				
 			// Note that 24 bits frequencies are not handled	
+#if AAC_ENABLE_SBR			
 			if (AOT == 5 || AOT == 29) {
 				*samplerate_p = rates[((ptr[0] & 0x03) << 1) | (ptr[1] >> 7)];
 				LOG_WARN("AAC stream with SBR => high CPU required (use LMS proxied mode)");									
@@ -172,6 +173,9 @@ static int read_mp4_header(unsigned long *samplerate_p, unsigned char *channels_
 				*samplerate_p = 44100;
 				LOG_ERROR("AAC audio object type %d not handled", AOT);									
 			}	
+#else			
+			*samplerate_p = info.sampRateCore;
+#endif			
 			HAAC(a, SetRawBlockParams, a->hAac, 0, &info); 
 			LOG_DEBUG("playable aac track: %u (p:%x, r:%d, c:%d, desc_len:%d)", trak, AOT, info.sampRateCore, info.nChans, desc_len);
 			play = trak;