Ticket #125: 0001-pulsecore-Make-libsamplerate-optional.patch
| File 0001-pulsecore-Make-libsamplerate-optional.patch, 6.2 kB (added by elmarco, 1 year ago) |
|---|
-
a/configure.ac
old new 323 323 324 324 PKG_PROG_PKG_CONFIG 325 325 326 #### Sample rate conversion ####327 328 PKG_CHECK_MODULES(LIBSAMPLERATE, [ samplerate >= 0.1.0 ])329 AC_SUBST(LIBSAMPLERATE_CFLAGS)330 AC_SUBST(LIBSAMPLERATE_LIBS)331 332 326 #### Sound file #### 333 327 334 328 PKG_CHECK_MODULES(LIBSNDFILE, [ sndfile >= 1.0.10 ]) … … 346 340 LIBS="$LIBS -latomic_ops" 347 341 fi 348 342 343 #### Libsample support (optional) #### 344 345 AC_ARG_ENABLE([samplerate], 346 AC_HELP_STRING([--disable-samplerate], [Disable optional libsamplerate support]), 347 [ 348 case "${enableval}" in 349 yes) samplerate=yes ;; 350 no) samplerate=no ;; 351 *) AC_MSG_ERROR(bad value ${enableval} for --disable-samplerate) ;; 352 esac 353 ], 354 [samplerate=auto]) 355 356 if test "x${samplerate}" != xno ; then 357 PKG_CHECK_MODULES(LIBSAMPLERATE, [ samplerate >= 0.1.0 ], 358 HAVE_LIBSAMPLERATE=1, 359 [ 360 HAVE_LIBSAMPLERATE=0 361 if test "x$samplerate" = xyes ; then 362 AC_MSG_ERROR([*** Libsamplerate not found]) 363 fi 364 ]) 365 else 366 HAVE_LIBSAMPLERATE=0 367 fi 368 369 AC_SUBST(LIBSAMPLERATE_CFLAGS) 370 AC_SUBST(LIBSAMPLERATE_LIBS) 371 AC_SUBST(HAVE_LIBSAMPLERATE) 372 AM_CONDITIONAL([HAVE_LIBSAMPLERATE], [test "x$HAVE_LIBSAMPLERATE" = x1]) 373 349 374 #### OSS support (optional) #### 350 375 351 376 AC_ARG_ENABLE([oss], … … 869 894 System Group: ${PA_SYSTEM_GROUP} 870 895 Realtime Group: ${PA_REALTIME_GROUP} 871 896 Access Group: ${PA_ACCESS_GROUP} 872 " 897 " | tee configure.summary-$(date +%T-%s) -
a/src/pulsecore/core-util.c
old new 74 74 #include <grp.h> 75 75 #endif 76 76 77 #ifdef HAVE_LIBSAMPLERATE 77 78 #include <samplerate.h> 79 #endif 78 80 79 81 #include <pulse/xmalloc.h> 80 82 #include <pulse/util.h> -
a/src/pulsecore/resampler.c
old new 27 27 28 28 #include <string.h> 29 29 30 #if HAVE_LIBSAMPLERATE 30 31 #include <samplerate.h> 32 #endif 31 33 32 34 #include <liboil/liboilfuncs.h> 33 35 #include <liboil/liboil.h> … … 70 72 unsigned i_counter; 71 73 } trivial; 72 74 75 #ifdef HAVE_LIBSAMPLERATE 73 76 struct { /* data specific to libsamplerate */ 74 77 SRC_STATE *state; 75 78 } src; 79 #endif 76 80 77 81 struct { /* data specific to speex */ 78 82 SpeexResamplerState* state; … … 84 88 } ffmpeg; 85 89 }; 86 90 91 #ifdef HAVE_LIBSAMPLERATE 87 92 static int libsamplerate_init(pa_resampler*r); 93 #define LIBSAMPLERATE_INIT libsamplerate_init 94 #else 95 #define LIBSAMPLERATE_INIT NULL 96 #endif 97 88 98 static int trivial_init(pa_resampler*r); 89 99 static int speex_init(pa_resampler*r); 90 100 static int ffmpeg_init(pa_resampler*r); … … 92 102 static void calc_map_table(pa_resampler *r); 93 103 94 104 static int (* const init_table[])(pa_resampler*r) = { 95 [PA_RESAMPLER_SRC_SINC_BEST_QUALITY] = libsamplerate_init,96 [PA_RESAMPLER_SRC_SINC_MEDIUM_QUALITY] = libsamplerate_init,97 [PA_RESAMPLER_SRC_SINC_FASTEST] = libsamplerate_init,98 [PA_RESAMPLER_SRC_ZERO_ORDER_HOLD] = libsamplerate_init,99 [PA_RESAMPLER_SRC_LINEAR] = libsamplerate_init,105 [PA_RESAMPLER_SRC_SINC_BEST_QUALITY] = LIBSAMPLERATE_INIT, 106 [PA_RESAMPLER_SRC_SINC_MEDIUM_QUALITY] = LIBSAMPLERATE_INIT, 107 [PA_RESAMPLER_SRC_SINC_FASTEST] = LIBSAMPLERATE_INIT, 108 [PA_RESAMPLER_SRC_ZERO_ORDER_HOLD] = LIBSAMPLERATE_INIT, 109 [PA_RESAMPLER_SRC_LINEAR] = LIBSAMPLERATE_INIT, 100 110 [PA_RESAMPLER_TRIVIAL] = trivial_init, 101 111 [PA_RESAMPLER_SPEEX_FLOAT_BASE+0] = speex_init, 102 112 [PA_RESAMPLER_SPEEX_FLOAT_BASE+1] = speex_init, … … 622 632 623 633 /*** libsamplerate based implementation ***/ 624 634 635 #ifdef HAVE_LIBSAMPLERATE 625 636 static void libsamplerate_resample(pa_resampler *r, const pa_memchunk *input, unsigned in_n_frames, pa_memchunk *output, unsigned *out_n_frames) { 626 637 SRC_DATA data; 627 638 … … 677 688 678 689 return 0; 679 690 } 691 #endif 680 692 681 693 /*** speex based implementation ***/ 682 694 -
a/src/pulsecore/resampler.h
old new 24 24 USA. 25 25 ***/ 26 26 27 #include <samplerate.h>28 29 27 #include <pulse/sample.h> 30 28 #include <pulse/channelmap.h> 31 29 #include <pulsecore/memblock.h> … … 35 33 36 34 typedef enum pa_resample_method { 37 35 PA_RESAMPLER_INVALID = -1, 38 PA_RESAMPLER_SRC_SINC_BEST_QUALITY = SRC_SINC_BEST_QUALITY,39 PA_RESAMPLER_SRC_SINC_MEDIUM_QUALITY = SRC_SINC_MEDIUM_QUALITY,40 PA_RESAMPLER_SRC_SINC_FASTEST = SRC_SINC_FASTEST,41 PA_RESAMPLER_SRC_ZERO_ORDER_HOLD = SRC_ZERO_ORDER_HOLD,42 PA_RESAMPLER_SRC_LINEAR = SRC_LINEAR,36 PA_RESAMPLER_SRC_SINC_BEST_QUALITY = 0, /* = SRC_SINC_BEST_QUALITY */ 37 PA_RESAMPLER_SRC_SINC_MEDIUM_QUALITY = 1, /* = SRC_SINC_MEDIUM_QUALITY */ 38 PA_RESAMPLER_SRC_SINC_FASTEST = 2, /* = SRC_SINC_FASTEST */ 39 PA_RESAMPLER_SRC_ZERO_ORDER_HOLD = 3, /* = SRC_ZERO_ORDER_HOLD */ 40 PA_RESAMPLER_SRC_LINEAR = 4, /* = SRC_LINEAR */ 43 41 PA_RESAMPLER_TRIVIAL, 44 42 PA_RESAMPLER_SPEEX_FLOAT_BASE, 45 43 PA_RESAMPLER_SPEEX_FLOAT_MAX = PA_RESAMPLER_SPEEX_FLOAT_BASE + 10,
