Cleaning up pcm_getSampleRateConverter.
git-svn-id: https://svn.musicpd.org/mpd/trunk@6275 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
		@@ -151,32 +151,36 @@ void pcm_mix(char *buffer1, char *buffer2, size_t bufferSize1,
 | 
				
			|||||||
#ifdef HAVE_LIBSAMPLERATE
 | 
					#ifdef HAVE_LIBSAMPLERATE
 | 
				
			||||||
static int pcm_getSampleRateConverter(void)
 | 
					static int pcm_getSampleRateConverter(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *conf, *test;
 | 
						const char *conf = getConfigParamValue(CONF_SAMPLERATE_CONVERTER);
 | 
				
			||||||
	int convalgo = SRC_SINC_FASTEST;
 | 
						long convalgo;
 | 
				
			||||||
	int newalgo;
 | 
						char *test;
 | 
				
			||||||
	size_t len;
 | 
						size_t len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	conf = getConfigParamValue(CONF_SAMPLERATE_CONVERTER);
 | 
						if (!conf) {
 | 
				
			||||||
	if(conf) {
 | 
							convalgo = SRC_SINC_FASTEST;
 | 
				
			||||||
		newalgo = strtol(conf, (char **)&test, 10);
 | 
							goto out;
 | 
				
			||||||
		if(*test) {
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						convalgo = strtol(conf, &test, 10);
 | 
				
			||||||
 | 
						if (*test == '\0' && src_get_name(convalgo))
 | 
				
			||||||
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	len = strlen(conf);
 | 
						len = strlen(conf);
 | 
				
			||||||
			for(newalgo = 0; ; newalgo++) {
 | 
						for (convalgo = 0 ; ; convalgo++) {
 | 
				
			||||||
				test = src_get_name(newalgo);
 | 
							test = (char *)src_get_name(convalgo);
 | 
				
			||||||
				if(!test)
 | 
							if (!test) {
 | 
				
			||||||
					break; /* FAIL */
 | 
								convalgo = SRC_SINC_FASTEST;
 | 
				
			||||||
				if(!strncasecmp(test, conf, len)) {
 | 
					 | 
				
			||||||
					convalgo = newalgo;
 | 
					 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if (strncasecmp(test, conf, len) == 0)
 | 
				
			||||||
 | 
								goto out;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
		} else {
 | 
					
 | 
				
			||||||
			if(src_get_name(newalgo))
 | 
						ERROR("unknown samplerate converter \"%s\"\n", conf);
 | 
				
			||||||
				convalgo = newalgo;
 | 
					out:
 | 
				
			||||||
			/* else FAIL */
 | 
						DEBUG("selecting samplerate converter \"%s\"\n",
 | 
				
			||||||
		}
 | 
						      src_get_name(convalgo));
 | 
				
			||||||
	}
 | 
					
 | 
				
			||||||
	DEBUG("Selecting samplerate converter '%s'\n", src_get_name(convalgo));
 | 
					 | 
				
			||||||
	return convalgo;
 | 
						return convalgo;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user