[pulseaudio-discuss] [PATCH 12/18] resampler: Simplify the resample_method_supported() function

poljar (Damir Jelić) poljarinho at gmail.com
Mon Jul 15 06:48:34 PDT 2013


---
 src/pulsecore/resampler.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index 6ecb408..2d83315 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -640,22 +640,10 @@ const char *pa_resample_method_to_string(pa_resample_method_t m) {
 
 int pa_resample_method_supported(pa_resample_method_t m) {
 
-    if (m < 0 || m >= PA_RESAMPLER_MAX)
-        return 0;
-
-#ifndef HAVE_LIBSAMPLERATE
-    if (m <= PA_RESAMPLER_SRC_LINEAR)
-        return 0;
-#endif
-
-#ifndef HAVE_SPEEX
-    if (m >= PA_RESAMPLER_SPEEX_FLOAT_BASE && m <= PA_RESAMPLER_SPEEX_FLOAT_MAX)
-        return 0;
-    if (m >= PA_RESAMPLER_SPEEX_FIXED_BASE && m <= PA_RESAMPLER_SPEEX_FIXED_MAX)
+    if(impl_table[find_base_method(m)] == NULL)
         return 0;
-#endif
-
-    return 1;
+    else
+        return 1;
 }
 
 pa_resample_method_t pa_parse_resample_method(const char *string) {
-- 
1.8.3.2



More information about the pulseaudio-discuss mailing list