0009-Fix-static-linking-with-libsndfile.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. From d89a938f48e97b5770509d53c5478c5c3008d6e8 Mon Sep 17 00:00:00 2001
  2. From: Bernd Kuhls <bernd.kuhls@t-online.de>
  3. Date: Sat, 27 May 2017 17:53:33 +0200
  4. Subject: [PATCH 1/1] Fix static linking with libsndfile
  5. libsndfile and audiofile both contain mixXX functions in their alac
  6. code which lead to symbol name clashes when apps like mpd try to
  7. statically link to both audiofile and libsndfile at the same time.
  8. This patch renames these functions to avoid the problem which was
  9. detected by the buildroot autobuilders:
  10. http://autobuild.buildroot.net/results/799/7997ccd698f03885f98d00bd150dc3a578e4b161/
  11. Patch sent upstream: https://github.com/mpruett/audiofile/pull/45
  12. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  13. ---
  14. libaudiofile/alac/ALACEncoder.cpp | 28 ++++++++++++++--------------
  15. libaudiofile/alac/matrix_enc.c | 8 ++++----
  16. libaudiofile/alac/matrixlib.h | 8 ++++----
  17. 3 files changed, 22 insertions(+), 22 deletions(-)
  18. diff --git a/libaudiofile/alac/ALACEncoder.cpp b/libaudiofile/alac/ALACEncoder.cpp
  19. index da922c2..3d088cc 100644
  20. --- a/libaudiofile/alac/ALACEncoder.cpp
  21. +++ b/libaudiofile/alac/ALACEncoder.cpp
  22. @@ -332,19 +332,19 @@ int32_t ALACEncoder::EncodeStereo( BitBuffer * bitstream, void * inputBuffer, ui
  23. switch ( mBitDepth )
  24. {
  25. case 16:
  26. - mix16( (int16_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples/dilate, mixBits, mixRes );
  27. + audiofile_alac_mix16( (int16_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples/dilate, mixBits, mixRes );
  28. break;
  29. case 20:
  30. - mix20( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples/dilate, mixBits, mixRes );
  31. + audiofile_alac_mix20( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples/dilate, mixBits, mixRes );
  32. break;
  33. case 24:
  34. // includes extraction of shifted-off bytes
  35. - mix24( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples/dilate,
  36. + audiofile_alac_mix24( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples/dilate,
  37. mixBits, mixRes, mShiftBufferUV, bytesShifted );
  38. break;
  39. case 32:
  40. // includes extraction of shifted-off bytes
  41. - mix32( (int32_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples/dilate,
  42. + audiofile_alac_mix32( (int32_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples/dilate,
  43. mixBits, mixRes, mShiftBufferUV, bytesShifted );
  44. break;
  45. }
  46. @@ -379,19 +379,19 @@ int32_t ALACEncoder::EncodeStereo( BitBuffer * bitstream, void * inputBuffer, ui
  47. switch ( mBitDepth )
  48. {
  49. case 16:
  50. - mix16( (int16_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, mixBits, mixRes );
  51. + audiofile_alac_mix16( (int16_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, mixBits, mixRes );
  52. break;
  53. case 20:
  54. - mix20( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, mixBits, mixRes );
  55. + audiofile_alac_mix20( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, mixBits, mixRes );
  56. break;
  57. case 24:
  58. // also extracts the shifted off bytes into the shift buffers
  59. - mix24( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples,
  60. + audiofile_alac_mix24( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples,
  61. mixBits, mixRes, mShiftBufferUV, bytesShifted );
  62. break;
  63. case 32:
  64. // also extracts the shifted off bytes into the shift buffers
  65. - mix32( (int32_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples,
  66. + audiofile_alac_mix32( (int32_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples,
  67. mixBits, mixRes, mShiftBufferUV, bytesShifted );
  68. break;
  69. }
  70. @@ -605,19 +605,19 @@ int32_t ALACEncoder::EncodeStereoFast( BitBuffer * bitstream, void * inputBuffer
  71. switch ( mBitDepth )
  72. {
  73. case 16:
  74. - mix16( (int16_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, mixBits, mixRes );
  75. + audiofile_alac_mix16( (int16_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, mixBits, mixRes );
  76. break;
  77. case 20:
  78. - mix20( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, mixBits, mixRes );
  79. + audiofile_alac_mix20( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, mixBits, mixRes );
  80. break;
  81. case 24:
  82. // also extracts the shifted off bytes into the shift buffers
  83. - mix24( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples,
  84. + audiofile_alac_mix24( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples,
  85. mixBits, mixRes, mShiftBufferUV, bytesShifted );
  86. break;
  87. case 32:
  88. // also extracts the shifted off bytes into the shift buffers
  89. - mix32( (int32_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples,
  90. + audiofile_alac_mix32( (int32_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples,
  91. mixBits, mixRes, mShiftBufferUV, bytesShifted );
  92. break;
  93. }
  94. @@ -756,7 +756,7 @@ int32_t ALACEncoder::EncodeStereoEscape( BitBuffer * bitstream, void * inputBuff
  95. break;
  96. case 20:
  97. // mix20() with mixres param = 0 means de-interleave so use it to simplify things
  98. - mix20( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, 0, 0 );
  99. + audiofile_alac_mix20( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, 0, 0 );
  100. for ( index = 0; index < numSamples; index++ )
  101. {
  102. BitBufferWrite( bitstream, mMixBufferU[index], 20 );
  103. @@ -765,7 +765,7 @@ int32_t ALACEncoder::EncodeStereoEscape( BitBuffer * bitstream, void * inputBuff
  104. break;
  105. case 24:
  106. // mix24() with mixres param = 0 means de-interleave so use it to simplify things
  107. - mix24( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, 0, 0, mShiftBufferUV, 0 );
  108. + audiofile_alac_mix24( (uint8_t *) inputBuffer, stride, mMixBufferU, mMixBufferV, numSamples, 0, 0, mShiftBufferUV, 0 );
  109. for ( index = 0; index < numSamples; index++ )
  110. {
  111. BitBufferWrite( bitstream, mMixBufferU[index], 24 );
  112. diff --git a/libaudiofile/alac/matrix_enc.c b/libaudiofile/alac/matrix_enc.c
  113. index e194330..8abd556 100644
  114. --- a/libaudiofile/alac/matrix_enc.c
  115. +++ b/libaudiofile/alac/matrix_enc.c
  116. @@ -57,7 +57,7 @@
  117. // 16-bit routines
  118. -void mix16( int16_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres )
  119. +void audiofile_alac_mix16( int16_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres )
  120. {
  121. int16_t * ip = in;
  122. int32_t j;
  123. @@ -95,7 +95,7 @@ void mix16( int16_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t num
  124. // 20-bit routines
  125. // - the 20 bits of data are left-justified in 3 bytes of storage but right-aligned for input/output predictor buffers
  126. -void mix20( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres )
  127. +void audiofile_alac_mix20( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres )
  128. {
  129. int32_t l, r;
  130. uint8_t * ip = in;
  131. @@ -140,7 +140,7 @@ void mix20( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t num
  132. // 24-bit routines
  133. // - the 24 bits of data are right-justified in the input/output predictor buffers
  134. -void mix24( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
  135. +void audiofile_alac_mix24( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
  136. int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted )
  137. {
  138. int32_t l, r;
  139. @@ -240,7 +240,7 @@ void mix24( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t num
  140. // - otherwise, the calculations might overflow into the 33rd bit and be lost
  141. // - therefore, these routines deal with the specified "unused lower" bytes in the "shift" buffers
  142. -void mix32( int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
  143. +void audiofile_alac_mix32( int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
  144. int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted )
  145. {
  146. int32_t * ip = in;
  147. diff --git a/libaudiofile/alac/matrixlib.h b/libaudiofile/alac/matrixlib.h
  148. index 0a4f371..5728b6d 100644
  149. --- a/libaudiofile/alac/matrixlib.h
  150. +++ b/libaudiofile/alac/matrixlib.h
  151. @@ -38,17 +38,17 @@ extern "C" {
  152. #endif
  153. // 16-bit routines
  154. -void mix16( int16_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres );
  155. +void audiofile_alac_mix16( int16_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres );
  156. void unmix16( int32_t * u, int32_t * v, int16_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres );
  157. // 20-bit routines
  158. -void mix20( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres );
  159. +void audiofile_alac_mix20( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples, int32_t mixbits, int32_t mixres );
  160. void unmix20( int32_t * u, int32_t * v, uint8_t * out, uint32_t stride, int32_t numSamples, int32_t mixbits, int32_t mixres );
  161. // 24-bit routines
  162. // - 24-bit data sometimes compresses better by shifting off the bottom byte so these routines deal with
  163. // the specified "unused lower bytes" in the combined "shift" buffer
  164. -void mix24( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
  165. +void audiofile_alac_mix24( uint8_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
  166. int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted );
  167. void unmix24( int32_t * u, int32_t * v, uint8_t * out, uint32_t stride, int32_t numSamples,
  168. int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted );
  169. @@ -57,7 +57,7 @@ void unmix24( int32_t * u, int32_t * v, uint8_t * out, uint32_t stride, int32_t
  170. // - note that these really expect the internal data width to be < 32-bit but the arrays are 32-bit
  171. // - otherwise, the calculations might overflow into the 33rd bit and be lost
  172. // - therefore, these routines deal with the specified "unused lower" bytes in the combined "shift" buffer
  173. -void mix32( int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
  174. +void audiofile_alac_mix32( int32_t * in, uint32_t stride, int32_t * u, int32_t * v, int32_t numSamples,
  175. int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted );
  176. void unmix32( int32_t * u, int32_t * v, int32_t * out, uint32_t stride, int32_t numSamples,
  177. int32_t mixbits, int32_t mixres, uint16_t * shiftUV, int32_t bytesShifted );
  178. --
  179. 2.11.0