浏览代码

allow -Z even w/o RESAMPLE (32 bits mode)

Philippe G 4 年之前
父节点
当前提交
1063cd5899
共有 2 个文件被更改,包括 8 次插入11 次删除
  1. 4 11
      components/squeezelite/main.c
  2. 4 0
      components/squeezelite/slimproto.c

+ 4 - 11
components/squeezelite/main.c

@@ -343,16 +343,9 @@ int main(int argc, char **argv) {
 
 	while (optind < argc && strlen(argv[optind]) >= 2 && argv[optind][0] == '-') {
 		char *opt = argv[optind] + 1;
-		if (strstr("oabcCdefmMnNpPrs"
+		if (strstr("oabcCdefmMnNpPrsZ"
 #if ALSA
 				   "UVO"
-#endif
-/* 
- * only allow '-Z <rate>' override of maxSampleRate 
- * reported by client if built with the capability to resample!
- */
-#if RESAMPLE || RESAMPLE16
-				   "Z"
 #endif
 				   , opt) && optind < argc - 1) {
 			optarg = argv[optind + 1];
@@ -519,6 +512,9 @@ int main(int argc, char **argv) {
 		case 'N':
 			namefile = optarg;
 			break;
+		case 'Z':
+			maxSampleRate = atoi(optarg);
+			break;			
 		case 'W':
 			pcm_check_header = true;
 			break;
@@ -552,9 +548,6 @@ int main(int argc, char **argv) {
 				resample = "";
 			}
 			break;
-		case 'Z':
-			maxSampleRate = atoi(optarg);
-			break;
 #endif
 #if DSD
 		case 'D':

+ 4 - 0
components/squeezelite/slimproto.c

@@ -914,7 +914,11 @@ void slimproto(log_level level, char *server, u8_t mac[6], const char *name, con
 
 	LOCK_O;
 	snprintf(fixed_cap, FIXED_CAP_LEN, ",ModelName=%s,MaxSampleRate=%u", modelname ? modelname : MODEL_NAME_STRING,
+#if RESAMPLE || RESAMPLE16	
 			 ((maxSampleRate > 0) ? maxSampleRate : output.supported_rates[0]));
+#else
+			 ((maxSampleRate > 0 && maxSampleRate < output.supported_rates[0]) ? maxSampleRate : output.supported_rates[0]));
+#endif
 	
 	for (i = 0; i < MAX_CODECS; i++) {
 		if (codecs[i] && codecs[i]->id && strlen(fixed_cap) < FIXED_CAP_LEN - 10) {