Browse Source

FLAC but no MP3

philippe44 5 years ago
parent
commit
1fd1d9bf60
5 changed files with 17 additions and 8 deletions
  1. 5 3
      decode.c
  2. 4 0
      esp32.c
  3. 6 3
      output_dac.c
  4. 1 1
      scan.c
  5. 1 1
      squeezelite.h

+ 5 - 3
decode.c

@@ -80,7 +80,7 @@ static void *decode_thread() {
 			IF_PROCESS(
 				min_space = process.max_out_frames * BYTES_PER_FRAME;
 			);
-			
+
 			if (space > min_space && (bytes > codec->min_read_bytes || toend)) {
 				
 				decode.state = codec->decode();
@@ -172,16 +172,18 @@ void decode_init(log_level level, const char *include_codecs, const char *exclud
 #endif
 	if (!strstr(exclude_codecs, "ogg")	&& (!include_codecs || (order_codecs = strstr(include_codecs, "ogg"))))
 		sort_codecs((include_codecs ? order_codecs - include_codecs : i), register_vorbis());
+*/	
 	if (!strstr(exclude_codecs, "flac") && (!include_codecs || (order_codecs = strstr(include_codecs, "flac"))))
 		sort_codecs((include_codecs ? order_codecs - include_codecs : i), register_flac());
-*/	
+
 	if (!strstr(exclude_codecs, "pcm")	&& (!include_codecs || (order_codecs = strstr(include_codecs, "pcm"))))
 		sort_codecs((include_codecs ? order_codecs - include_codecs : i), register_pcm());
-/*
+
 	// try mad then mpg for mp3 unless command line option passed
 	if (!(strstr(exclude_codecs, "mp3") || strstr(exclude_codecs, "mad")) &&
 		(!include_codecs || (order_codecs = strstr(include_codecs, "mp3")) || (order_codecs = strstr(include_codecs, "mad"))))
 		sort_codecs((include_codecs ? order_codecs - include_codecs : i), register_mad());
+/*		
 	else if (!(strstr(exclude_codecs, "mp3") || strstr(exclude_codecs, "mpg")) &&
 		(!include_codecs || (order_codecs = strstr(include_codecs, "mp3")) || (order_codecs = strstr(include_codecs, "mpg"))))
 		sort_codecs((include_codecs ? order_codecs - include_codecs : i), register_mpg());

+ 4 - 0
esp32.c

@@ -10,3 +10,7 @@ void get_mac(u8_t mac[]) {
 _sig_func_ptr signal(int sig, _sig_func_ptr func) {
 	return NULL;
 }
+
+void *audio_calloc(size_t nmemb, size_t size) {
+		return calloc(nmemb, size);
+}

+ 6 - 3
output_dac.c

@@ -145,13 +145,16 @@ static void *output_thread() {
 		output.frames_played_dmp = output.frames_played;
 
 		_output_frames(FRAME_BLOCK);
-
+		
 		UNLOCK;
 
 		if (buffill) {
-			//fwrite(buf, bytes_per_frame, buffill, stdout);
+			// do something ...
+			usleep((buffill * 1000 * 1000) / output.current_sample_rate);			
 			buffill = 0;
-		}
+		} else {
+			usleep((FRAME_BLOCK * 1000 * 1000) / output.current_sample_rate);
+		}	
 		
 	}
 

+ 1 - 1
scan.c

@@ -125,7 +125,7 @@ void app_main()
 		"-d",
 		"all=info",
 		"-b",
-		"128:2000",
+		"256:2000",
 	};
 	
 	// can't do strtok on FLASH strings

+ 1 - 1
squeezelite.h

@@ -281,7 +281,7 @@
 #endif /* SUN */
 
 #define STREAM_THREAD_STACK_SIZE  8 * 1024
-#define DECODE_THREAD_STACK_SIZE 8 * 1024
+#define DECODE_THREAD_STACK_SIZE 32 * 1024
 #define OUTPUT_THREAD_STACK_SIZE  8 * 1024
 #define IR_THREAD_STACK_SIZE      8 * 1024
 #if !OSX