seal 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (421) hide show
  1. data/.yardopts +1 -0
  2. data/LICENSE +13 -0
  3. data/README.md +265 -0
  4. data/ext/seal/extconf.rb +45 -0
  5. data/include/al/al.h +724 -0
  6. data/include/al/alc.h +277 -0
  7. data/include/al/efx-presets.h +402 -0
  8. data/include/al/efx.h +758 -0
  9. data/include/mpg123/mpg123.h +1034 -0
  10. data/include/ogg/config_types.h +25 -0
  11. data/include/ogg/ogg.h +210 -0
  12. data/include/ogg/os_types.h +147 -0
  13. data/include/seal.h +23 -0
  14. data/include/seal/buf.h +143 -0
  15. data/include/seal/core.h +95 -0
  16. data/include/seal/efs.h +112 -0
  17. data/include/seal/err.h +93 -0
  18. data/include/seal/fmt.h +58 -0
  19. data/include/seal/listener.h +103 -0
  20. data/include/seal/raw.h +86 -0
  21. data/include/seal/rvb.h +520 -0
  22. data/include/seal/src.h +413 -0
  23. data/include/seal/stream.h +81 -0
  24. data/include/vorbis/codec.h +243 -0
  25. data/include/vorbis/vorbisfile.h +206 -0
  26. data/mpg123/AUTHORS +150 -0
  27. data/mpg123/COPYING +773 -0
  28. data/mpg123/ChangeLog +3 -0
  29. data/mpg123/INSTALL +111 -0
  30. data/mpg123/Makefile.am +99 -0
  31. data/mpg123/Makefile.in +1043 -0
  32. data/mpg123/NEWS +1200 -0
  33. data/mpg123/NEWS.libmpg123 +133 -0
  34. data/mpg123/README +203 -0
  35. data/mpg123/TODO +38 -0
  36. data/mpg123/aclocal.m4 +1168 -0
  37. data/mpg123/build/config.guess +1530 -0
  38. data/mpg123/build/config.sub +1782 -0
  39. data/mpg123/build/depcomp +707 -0
  40. data/mpg123/build/install-sh +527 -0
  41. data/mpg123/build/ltmain.sh +9655 -0
  42. data/mpg123/build/missing +330 -0
  43. data/mpg123/configure +20267 -0
  44. data/mpg123/configure.ac +2178 -0
  45. data/mpg123/doc/ACCURACY +2 -0
  46. data/mpg123/doc/BENCHMARKING +110 -0
  47. data/mpg123/doc/BUGS +3 -0
  48. data/mpg123/doc/CONTACT +17 -0
  49. data/mpg123/doc/LICENSE +22 -0
  50. data/mpg123/doc/Makefile.am +32 -0
  51. data/mpg123/doc/Makefile.in +490 -0
  52. data/mpg123/doc/PATENTS +39 -0
  53. data/mpg123/doc/README.3DNOW +56 -0
  54. data/mpg123/doc/README.gain +171 -0
  55. data/mpg123/doc/README.remote +218 -0
  56. data/mpg123/doc/ROAD_TO_LGPL +270 -0
  57. data/mpg123/doc/THANKS +13 -0
  58. data/mpg123/doc/TODO +63 -0
  59. data/mpg123/doc/doxy_examples.c +21 -0
  60. data/mpg123/doc/doxygen.conf +41 -0
  61. data/mpg123/doc/doxyhead.xhtml +12 -0
  62. data/mpg123/doc/examples/dump_seekindex.c +41 -0
  63. data/mpg123/doc/examples/extract_frames.c +92 -0
  64. data/mpg123/doc/examples/feedseek.c +238 -0
  65. data/mpg123/doc/examples/id3dump.c +178 -0
  66. data/mpg123/doc/examples/mpg123_to_wav.c +118 -0
  67. data/mpg123/doc/examples/mpglib.c +92 -0
  68. data/mpg123/doc/examples/scan.c +47 -0
  69. data/mpg123/doc/libmpg123_speed.txt +84 -0
  70. data/mpg123/equalize.dat +37 -0
  71. data/mpg123/libmpg123.pc.in +11 -0
  72. data/mpg123/m4/addrconfig.m4 +34 -0
  73. data/mpg123/m4/libtool.m4 +7982 -0
  74. data/mpg123/m4/ltoptions.m4 +384 -0
  75. data/mpg123/m4/ltsugar.m4 +123 -0
  76. data/mpg123/m4/ltversion.m4 +23 -0
  77. data/mpg123/m4/lt~obsolete.m4 +98 -0
  78. data/mpg123/makedll.sh +19 -0
  79. data/mpg123/man1/mpg123.1 +512 -0
  80. data/mpg123/mpg123.spec +68 -0
  81. data/mpg123/mpg123.spec.in +68 -0
  82. data/mpg123/ports/MSVC++/2005/libmpg123/libmpg123.vcproj +741 -0
  83. data/mpg123/ports/MSVC++/2008/dump_seekindex/dump_seekindex.vcproj +194 -0
  84. data/mpg123/ports/MSVC++/2008/feedseek/feedseek.vcproj +195 -0
  85. data/mpg123/ports/MSVC++/2008/libmpg123/libmpg123.vcproj +1357 -0
  86. data/mpg123/ports/MSVC++/2008/mpg123.sln +44 -0
  87. data/mpg123/ports/MSVC++/2008/mpglib/mpglib.vcproj +191 -0
  88. data/mpg123/ports/MSVC++/2008/scan/scan.vcproj +195 -0
  89. data/mpg123/ports/MSVC++/2008clr/2008clr.sln +81 -0
  90. data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/Program.cs +435 -0
  91. data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/Properties/AssemblyInfo.cs +36 -0
  92. data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/ReplaceReaderclr.csproj +72 -0
  93. data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/Program.cs +331 -0
  94. data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/Properties/AssemblyInfo.cs +36 -0
  95. data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/feedseekclr.csproj +71 -0
  96. data/mpg123/ports/MSVC++/2008clr/examples/scanclr/Program.cs +79 -0
  97. data/mpg123/ports/MSVC++/2008clr/examples/scanclr/Properties/AssemblyInfo.cs +36 -0
  98. data/mpg123/ports/MSVC++/2008clr/examples/scanclr/scanclr.csproj +70 -0
  99. data/mpg123/ports/MSVC++/2008clr/mpg123clr/AssemblyInfo.cpp +76 -0
  100. data/mpg123/ports/MSVC++/2008clr/mpg123clr/ReadMe.txt +165 -0
  101. data/mpg123/ports/MSVC++/2008clr/mpg123clr/advanced.cpp +91 -0
  102. data/mpg123/ports/MSVC++/2008clr/mpg123clr/advanced.h +130 -0
  103. data/mpg123/ports/MSVC++/2008clr/mpg123clr/dllmain.cpp +19 -0
  104. data/mpg123/ports/MSVC++/2008clr/mpg123clr/enum.h +218 -0
  105. data/mpg123/ports/MSVC++/2008clr/mpg123clr/error.cpp +48 -0
  106. data/mpg123/ports/MSVC++/2008clr/mpg123clr/error.h +134 -0
  107. data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v1.cpp +92 -0
  108. data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v1.h +132 -0
  109. data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v2.cpp +138 -0
  110. data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v2.h +152 -0
  111. data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.cpp +896 -0
  112. data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.h +953 -0
  113. data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.rc +102 -0
  114. data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.vcproj +328 -0
  115. data/mpg123/ports/MSVC++/2008clr/mpg123clr/resource.h +14 -0
  116. data/mpg123/ports/MSVC++/2008clr/mpg123clr/stdafx.cpp +8 -0
  117. data/mpg123/ports/MSVC++/2008clr/mpg123clr/stdafx.h +38 -0
  118. data/mpg123/ports/MSVC++/2008clr/mpg123clr/string.cpp +166 -0
  119. data/mpg123/ports/MSVC++/2008clr/mpg123clr/string.h +265 -0
  120. data/mpg123/ports/MSVC++/2008clr/mpg123clr/targetver.h +24 -0
  121. data/mpg123/ports/MSVC++/2008clr/mpg123clr/text.cpp +67 -0
  122. data/mpg123/ports/MSVC++/2008clr/mpg123clr/text.h +111 -0
  123. data/mpg123/ports/MSVC++/2010/dump_seekindex/dump_seekindex.vcxproj +90 -0
  124. data/mpg123/ports/MSVC++/2010/dump_seekindex/dump_seekindex.vcxproj.filters +6 -0
  125. data/mpg123/ports/MSVC++/2010/feedseek/feedseek.vcxproj +95 -0
  126. data/mpg123/ports/MSVC++/2010/feedseek/feedseek.vcxproj.filters +6 -0
  127. data/mpg123/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj +960 -0
  128. data/mpg123/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj.user +3 -0
  129. data/mpg123/ports/MSVC++/2010/libmpg123/yasm.exe +0 -0
  130. data/mpg123/ports/MSVC++/2010/mpg123.sln +38 -0
  131. data/mpg123/ports/MSVC++/2010/scan/scan.vcxproj +93 -0
  132. data/mpg123/ports/MSVC++/2010/scan/scan.vcxproj.filters +6 -0
  133. data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/CORE/CORE_FileIn.H +15 -0
  134. data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/CORE/SourceFilter_MP3.H +139 -0
  135. data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/IIEP_Def.H +206 -0
  136. data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/IIEP_FileIn.H +167 -0
  137. data/mpg123/ports/MSVC++/CMP3Stream/README +4 -0
  138. data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_FileIn.CPP +462 -0
  139. data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_Log.CPP +122 -0
  140. data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_Mutex.CPP +35 -0
  141. data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/SourceFilter_MP3Stream.CPP +586 -0
  142. data/mpg123/ports/MSVC++/CMP3Stream/libMPG123/PLACE_LIBMPG123_SOURCES_HERE +0 -0
  143. data/mpg123/ports/MSVC++/CMP3Stream/libMPG123/libMPG123.vcproj +245 -0
  144. data/mpg123/ports/MSVC++/config.h +35 -0
  145. data/mpg123/ports/MSVC++/examples/feedseek.c +240 -0
  146. data/mpg123/ports/MSVC++/examples/scan.c +47 -0
  147. data/mpg123/ports/MSVC++/mpg123.h +46 -0
  148. data/mpg123/ports/MSVC++/msvc.c +59 -0
  149. data/mpg123/ports/README +26 -0
  150. data/mpg123/ports/Sony_PSP/Makefile.psp +38 -0
  151. data/mpg123/ports/Sony_PSP/README +11 -0
  152. data/mpg123/ports/Sony_PSP/config.h +368 -0
  153. data/mpg123/ports/Sony_PSP/readers.c.patch +2 -0
  154. data/mpg123/ports/Xcode/config.h +197 -0
  155. data/mpg123/ports/Xcode/mpg123.h +17 -0
  156. data/mpg123/ports/Xcode/mpg123.xcodeproj/project.pbxproj +670 -0
  157. data/mpg123/ports/mpg123_.pas +478 -0
  158. data/mpg123/scripts/benchmark-cpu.pl +56 -0
  159. data/mpg123/scripts/tag_lyrics.py +76 -0
  160. data/mpg123/src/Makefile.am +186 -0
  161. data/mpg123/src/Makefile.in +1097 -0
  162. data/mpg123/src/audio.c +725 -0
  163. data/mpg123/src/audio.h +106 -0
  164. data/mpg123/src/buffer.c +312 -0
  165. data/mpg123/src/buffer.h +45 -0
  166. data/mpg123/src/common.c +240 -0
  167. data/mpg123/src/common.h +29 -0
  168. data/mpg123/src/config.h.in +436 -0
  169. data/mpg123/src/control_generic.c +809 -0
  170. data/mpg123/src/equalizer.c +48 -0
  171. data/mpg123/src/genre.c +271 -0
  172. data/mpg123/src/genre.h +15 -0
  173. data/mpg123/src/getlopt.c +148 -0
  174. data/mpg123/src/getlopt.h +77 -0
  175. data/mpg123/src/httpget.c +700 -0
  176. data/mpg123/src/httpget.h +66 -0
  177. data/mpg123/src/legacy_module.c +74 -0
  178. data/mpg123/src/libmpg123/Makefile.am +141 -0
  179. data/mpg123/src/libmpg123/Makefile.in +919 -0
  180. data/mpg123/src/libmpg123/compat.c +138 -0
  181. data/mpg123/src/libmpg123/compat.h +178 -0
  182. data/mpg123/src/libmpg123/dct36_3dnow.S +505 -0
  183. data/mpg123/src/libmpg123/dct36_3dnowext.S +512 -0
  184. data/mpg123/src/libmpg123/dct64.c +174 -0
  185. data/mpg123/src/libmpg123/dct64_3dnow.S +712 -0
  186. data/mpg123/src/libmpg123/dct64_3dnowext.S +714 -0
  187. data/mpg123/src/libmpg123/dct64_altivec.c +315 -0
  188. data/mpg123/src/libmpg123/dct64_i386.c +336 -0
  189. data/mpg123/src/libmpg123/dct64_i486.c +342 -0
  190. data/mpg123/src/libmpg123/dct64_mmx.S +811 -0
  191. data/mpg123/src/libmpg123/dct64_neon.S +297 -0
  192. data/mpg123/src/libmpg123/dct64_neon_float.S +270 -0
  193. data/mpg123/src/libmpg123/dct64_sse.S +454 -0
  194. data/mpg123/src/libmpg123/dct64_sse_float.S +401 -0
  195. data/mpg123/src/libmpg123/dct64_x86_64.S +464 -0
  196. data/mpg123/src/libmpg123/dct64_x86_64_float.S +426 -0
  197. data/mpg123/src/libmpg123/debug.h +171 -0
  198. data/mpg123/src/libmpg123/decode.h +268 -0
  199. data/mpg123/src/libmpg123/dither.c +119 -0
  200. data/mpg123/src/libmpg123/dither.h +23 -0
  201. data/mpg123/src/libmpg123/equalizer.c +17 -0
  202. data/mpg123/src/libmpg123/equalizer_3dnow.S +70 -0
  203. data/mpg123/src/libmpg123/feature.c +106 -0
  204. data/mpg123/src/libmpg123/format.c +521 -0
  205. data/mpg123/src/libmpg123/frame.c +1046 -0
  206. data/mpg123/src/libmpg123/frame.h +410 -0
  207. data/mpg123/src/libmpg123/gapless.h +119 -0
  208. data/mpg123/src/libmpg123/getbits.h +100 -0
  209. data/mpg123/src/libmpg123/getcpuflags.S +91 -0
  210. data/mpg123/src/libmpg123/getcpuflags.h +47 -0
  211. data/mpg123/src/libmpg123/huffman.h +340 -0
  212. data/mpg123/src/libmpg123/icy.c +32 -0
  213. data/mpg123/src/libmpg123/icy.h +38 -0
  214. data/mpg123/src/libmpg123/icy2utf8.c +438 -0
  215. data/mpg123/src/libmpg123/icy2utf8.h +10 -0
  216. data/mpg123/src/libmpg123/id3.c +999 -0
  217. data/mpg123/src/libmpg123/id3.h +43 -0
  218. data/mpg123/src/libmpg123/index.c +134 -0
  219. data/mpg123/src/libmpg123/index.h +59 -0
  220. data/mpg123/src/libmpg123/intsym.h +256 -0
  221. data/mpg123/src/libmpg123/l12_integer_tables.h +278 -0
  222. data/mpg123/src/libmpg123/l2tables.h +164 -0
  223. data/mpg123/src/libmpg123/l3_integer_tables.h +1002 -0
  224. data/mpg123/src/libmpg123/layer1.c +155 -0
  225. data/mpg123/src/libmpg123/layer2.c +371 -0
  226. data/mpg123/src/libmpg123/layer3.c +2053 -0
  227. data/mpg123/src/libmpg123/lfs_alias.c +252 -0
  228. data/mpg123/src/libmpg123/lfs_wrap.c +751 -0
  229. data/mpg123/src/libmpg123/libmpg123.c +1607 -0
  230. data/mpg123/src/libmpg123/mangle.h +74 -0
  231. data/mpg123/src/libmpg123/mpeghead.h +87 -0
  232. data/mpg123/src/libmpg123/mpg123.h.in +1075 -0
  233. data/mpg123/src/libmpg123/mpg123lib_intern.h +338 -0
  234. data/mpg123/src/libmpg123/ntom.c +148 -0
  235. data/mpg123/src/libmpg123/optimize.c +964 -0
  236. data/mpg123/src/libmpg123/optimize.h +219 -0
  237. data/mpg123/src/libmpg123/parse.c +1179 -0
  238. data/mpg123/src/libmpg123/parse.h +25 -0
  239. data/mpg123/src/libmpg123/reader.h +137 -0
  240. data/mpg123/src/libmpg123/readers.c +1235 -0
  241. data/mpg123/src/libmpg123/sample.h +152 -0
  242. data/mpg123/src/libmpg123/stringbuf.c +163 -0
  243. data/mpg123/src/libmpg123/synth.c +816 -0
  244. data/mpg123/src/libmpg123/synth.h +196 -0
  245. data/mpg123/src/libmpg123/synth_3dnow.S +318 -0
  246. data/mpg123/src/libmpg123/synth_3dnowext.S +6 -0
  247. data/mpg123/src/libmpg123/synth_8bit.c +142 -0
  248. data/mpg123/src/libmpg123/synth_8bit.h +86 -0
  249. data/mpg123/src/libmpg123/synth_altivec.c +1057 -0
  250. data/mpg123/src/libmpg123/synth_arm.S +271 -0
  251. data/mpg123/src/libmpg123/synth_arm_accurate.S +287 -0
  252. data/mpg123/src/libmpg123/synth_i486.c +252 -0
  253. data/mpg123/src/libmpg123/synth_i586.S +336 -0
  254. data/mpg123/src/libmpg123/synth_i586_dither.S +375 -0
  255. data/mpg123/src/libmpg123/synth_mmx.S +125 -0
  256. data/mpg123/src/libmpg123/synth_mono.h +64 -0
  257. data/mpg123/src/libmpg123/synth_neon.S +123 -0
  258. data/mpg123/src/libmpg123/synth_neon_accurate.S +173 -0
  259. data/mpg123/src/libmpg123/synth_neon_float.S +149 -0
  260. data/mpg123/src/libmpg123/synth_neon_s32.S +168 -0
  261. data/mpg123/src/libmpg123/synth_ntom.h +213 -0
  262. data/mpg123/src/libmpg123/synth_real.c +404 -0
  263. data/mpg123/src/libmpg123/synth_s32.c +411 -0
  264. data/mpg123/src/libmpg123/synth_sse.S +6 -0
  265. data/mpg123/src/libmpg123/synth_sse3d.h +246 -0
  266. data/mpg123/src/libmpg123/synth_sse_accurate.S +294 -0
  267. data/mpg123/src/libmpg123/synth_sse_float.S +241 -0
  268. data/mpg123/src/libmpg123/synth_sse_s32.S +306 -0
  269. data/mpg123/src/libmpg123/synth_stereo_neon.S +175 -0
  270. data/mpg123/src/libmpg123/synth_stereo_neon_accurate.S +262 -0
  271. data/mpg123/src/libmpg123/synth_stereo_neon_float.S +220 -0
  272. data/mpg123/src/libmpg123/synth_stereo_neon_s32.S +247 -0
  273. data/mpg123/src/libmpg123/synth_stereo_sse_accurate.S +508 -0
  274. data/mpg123/src/libmpg123/synth_stereo_sse_float.S +416 -0
  275. data/mpg123/src/libmpg123/synth_stereo_sse_s32.S +540 -0
  276. data/mpg123/src/libmpg123/synth_stereo_x86_64.S +335 -0
  277. data/mpg123/src/libmpg123/synth_stereo_x86_64_accurate.S +454 -0
  278. data/mpg123/src/libmpg123/synth_stereo_x86_64_float.S +396 -0
  279. data/mpg123/src/libmpg123/synth_stereo_x86_64_s32.S +473 -0
  280. data/mpg123/src/libmpg123/synth_x86_64.S +244 -0
  281. data/mpg123/src/libmpg123/synth_x86_64_accurate.S +301 -0
  282. data/mpg123/src/libmpg123/synth_x86_64_float.S +259 -0
  283. data/mpg123/src/libmpg123/synth_x86_64_s32.S +312 -0
  284. data/mpg123/src/libmpg123/synths.h +52 -0
  285. data/mpg123/src/libmpg123/tabinit.c +294 -0
  286. data/mpg123/src/libmpg123/tabinit_mmx.S +210 -0
  287. data/mpg123/src/libmpg123/testcpu.c +35 -0
  288. data/mpg123/src/libmpg123/true.h +14 -0
  289. data/mpg123/src/local.c +63 -0
  290. data/mpg123/src/local.h +21 -0
  291. data/mpg123/src/metaprint.c +373 -0
  292. data/mpg123/src/metaprint.h +17 -0
  293. data/mpg123/src/module.c +306 -0
  294. data/mpg123/src/module.h +48 -0
  295. data/mpg123/src/mpg123.c +1405 -0
  296. data/mpg123/src/mpg123app.h +171 -0
  297. data/mpg123/src/output/Makefile.am +213 -0
  298. data/mpg123/src/output/Makefile.in +1238 -0
  299. data/mpg123/src/output/aix.c +300 -0
  300. data/mpg123/src/output/alib.c +209 -0
  301. data/mpg123/src/output/alsa.c +297 -0
  302. data/mpg123/src/output/arts.c +117 -0
  303. data/mpg123/src/output/coreaudio.c +370 -0
  304. data/mpg123/src/output/dummy.c +78 -0
  305. data/mpg123/src/output/esd.c +167 -0
  306. data/mpg123/src/output/hp.c +184 -0
  307. data/mpg123/src/output/jack.c +450 -0
  308. data/mpg123/src/output/mint.c +197 -0
  309. data/mpg123/src/output/nas.c +335 -0
  310. data/mpg123/src/output/openal.c +197 -0
  311. data/mpg123/src/output/os2.c +665 -0
  312. data/mpg123/src/output/oss.c +319 -0
  313. data/mpg123/src/output/portaudio.c +255 -0
  314. data/mpg123/src/output/pulse.c +164 -0
  315. data/mpg123/src/output/sdl.c +206 -0
  316. data/mpg123/src/output/sgi.c +213 -0
  317. data/mpg123/src/output/sndio.c +161 -0
  318. data/mpg123/src/output/sun.c +281 -0
  319. data/mpg123/src/output/win32.c +229 -0
  320. data/mpg123/src/playlist.c +596 -0
  321. data/mpg123/src/playlist.h +52 -0
  322. data/mpg123/src/resolver.c +319 -0
  323. data/mpg123/src/resolver.h +25 -0
  324. data/mpg123/src/sfifo.c +146 -0
  325. data/mpg123/src/sfifo.h +95 -0
  326. data/mpg123/src/streamdump.c +74 -0
  327. data/mpg123/src/streamdump.h +20 -0
  328. data/mpg123/src/term.c +479 -0
  329. data/mpg123/src/term.h +81 -0
  330. data/mpg123/src/tests/noise.c +52 -0
  331. data/mpg123/src/tests/plain_id3.c +109 -0
  332. data/mpg123/src/tests/seek_accuracy.c +261 -0
  333. data/mpg123/src/tests/seek_whence.c +56 -0
  334. data/mpg123/src/tests/testtext.h +34 -0
  335. data/mpg123/src/tests/text.c +80 -0
  336. data/mpg123/src/wav.c +464 -0
  337. data/mpg123/src/wavhead.h +68 -0
  338. data/mpg123/src/win32_net.c +599 -0
  339. data/mpg123/src/win32_support.c +191 -0
  340. data/mpg123/src/win32_support.h +152 -0
  341. data/mpg123/src/xfermem.c +321 -0
  342. data/mpg123/src/xfermem.h +74 -0
  343. data/mpg123/windows-builds.sh +137 -0
  344. data/msvc/lib/OpenAL32.lib +0 -0
  345. data/spec/fixtures/heal.ogg +0 -0
  346. data/spec/fixtures/tone_up.wav +0 -0
  347. data/spec/seal/buffer_spec.rb +37 -0
  348. data/spec/seal/core_spec.rb +29 -0
  349. data/spec/seal/effect_slot_spec.rb +38 -0
  350. data/spec/seal/listener_spec.rb +33 -0
  351. data/spec/seal/reverb_spec.rb +51 -0
  352. data/spec/seal/source_spec.rb +370 -0
  353. data/spec/seal/stream_spec.rb +38 -0
  354. data/spec/spec_helper.rb +45 -0
  355. data/spec/support/attribute_examples.rb +75 -0
  356. data/spec/support/audio_object_with_format.rb +27 -0
  357. data/spec/support/movable_object.rb +22 -0
  358. data/src/libogg/bitwise.c +857 -0
  359. data/src/libogg/framing.c +2093 -0
  360. data/src/libvorbis/backends.h +144 -0
  361. data/src/libvorbis/bitrate.c +253 -0
  362. data/src/libvorbis/bitrate.h +59 -0
  363. data/src/libvorbis/block.c +1046 -0
  364. data/src/libvorbis/codebook.c +484 -0
  365. data/src/libvorbis/codebook.h +119 -0
  366. data/src/libvorbis/codec_internal.h +167 -0
  367. data/src/libvorbis/envelope.c +375 -0
  368. data/src/libvorbis/envelope.h +80 -0
  369. data/src/libvorbis/floor0.c +221 -0
  370. data/src/libvorbis/floor1.c +1100 -0
  371. data/src/libvorbis/highlevel.h +58 -0
  372. data/src/libvorbis/info.c +668 -0
  373. data/src/libvorbis/lookup.c +94 -0
  374. data/src/libvorbis/lookup.h +32 -0
  375. data/src/libvorbis/lookup_data.h +192 -0
  376. data/src/libvorbis/lpc.c +160 -0
  377. data/src/libvorbis/lpc.h +29 -0
  378. data/src/libvorbis/lsp.c +456 -0
  379. data/src/libvorbis/lsp.h +28 -0
  380. data/src/libvorbis/mapping0.c +816 -0
  381. data/src/libvorbis/masking.h +785 -0
  382. data/src/libvorbis/mdct.c +563 -0
  383. data/src/libvorbis/mdct.h +71 -0
  384. data/src/libvorbis/misc.h +57 -0
  385. data/src/libvorbis/os.h +186 -0
  386. data/src/libvorbis/psy.c +1206 -0
  387. data/src/libvorbis/psy.h +154 -0
  388. data/src/libvorbis/registry.c +45 -0
  389. data/src/libvorbis/registry.h +32 -0
  390. data/src/libvorbis/res0.c +889 -0
  391. data/src/libvorbis/scales.h +90 -0
  392. data/src/libvorbis/sharedbook.c +579 -0
  393. data/src/libvorbis/smallft.c +1255 -0
  394. data/src/libvorbis/smallft.h +34 -0
  395. data/src/libvorbis/synthesis.c +184 -0
  396. data/src/libvorbis/vorbisfile.c +2337 -0
  397. data/src/libvorbis/window.c +2135 -0
  398. data/src/libvorbis/window.h +26 -0
  399. data/src/rubyext.c +2329 -0
  400. data/src/seal/buf.c +124 -0
  401. data/src/seal/core.c +283 -0
  402. data/src/seal/efs.c +74 -0
  403. data/src/seal/err.c +118 -0
  404. data/src/seal/fmt.c +86 -0
  405. data/src/seal/listener.c +111 -0
  406. data/src/seal/mpg.c +174 -0
  407. data/src/seal/mpg.h +24 -0
  408. data/src/seal/ov.c +180 -0
  409. data/src/seal/ov.h +22 -0
  410. data/src/seal/raw.c +59 -0
  411. data/src/seal/reader.c +102 -0
  412. data/src/seal/reader.h +59 -0
  413. data/src/seal/rvb.c +368 -0
  414. data/src/seal/src.c +654 -0
  415. data/src/seal/stream.c +109 -0
  416. data/src/seal/threading.c +66 -0
  417. data/src/seal/threading.h +20 -0
  418. data/src/seal/wav.c +297 -0
  419. data/src/seal/wav.h +23 -0
  420. data/src/win32api.rb +29 -0
  421. metadata +563 -0
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ include Source::State
4
+
5
+ describe Stream do
6
+ let(:source) do
7
+ Source.new.tap { |source| source.stream = Stream.new(WAV_PATH) }
8
+ end
9
+
10
+ it_behaves_like 'an audio object with format'
11
+
12
+ context 'that are closed' do
13
+ subject do
14
+ Stream.new(WAV_PATH).tap { |stream| stream.close }
15
+ end
16
+
17
+ its(:bit_depth) { should eq 16 }
18
+ its(:channel_count) { should eq 1 }
19
+ its(:frequency) { should eq 0 }
20
+ end
21
+
22
+ example 'rewinding prevents source from stopping' do
23
+ source.play
24
+ 6.times do
25
+ sleep(0.1)
26
+ source.stream.rewind
27
+ end
28
+ source.state.should be PLAYING
29
+ end
30
+
31
+ it 'can be closed even when used by sources' do
32
+ expect do
33
+ source.play
34
+ source.stream.close
35
+ sleep 0.5
36
+ end.to_not raise_error
37
+ end
38
+ end
@@ -0,0 +1,45 @@
1
+ module CustomMatchers
2
+ class BeEachWithin < RSpec::Matchers::BuiltIn::BeWithin
3
+ def matches?(target)
4
+ target.zip(@expected).all? { |a, b| (a - b).abs <= @delta }
5
+ end
6
+
7
+ def description
8
+ "be each within #{@delta} of the parallel elements in #{@expected}"
9
+ end
10
+ end
11
+
12
+ def be_each_within(tolerance)
13
+ BeEachWithin.new(tolerance)
14
+ end
15
+ end
16
+
17
+ class Symbol
18
+ def to_writer
19
+ "#{self}=".intern
20
+ end
21
+ end
22
+
23
+ Dir["./spec/support/**/*.rb"].each { |f| require f}
24
+ require 'seal'
25
+ include Seal
26
+
27
+ TOLERANCE = 0.00001
28
+ FIXTURE_DIR = File.join File.dirname(__FILE__), 'fixtures'
29
+ WAV_PATH = File.join FIXTURE_DIR, 'tone_up.wav'
30
+ OV_PATH = File.join FIXTURE_DIR, 'heal.ogg'
31
+
32
+ RSpec.configure do |config|
33
+ config.include CustomMatchers
34
+ config.alias_it_should_behave_like_to :it_validates, 'validates that'
35
+
36
+ config.instance_eval do
37
+ before :all do
38
+ Seal.startup
39
+ end
40
+
41
+ after :all do
42
+ Seal.cleanup
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+
3
+ shared_examples 'the boolean attribute' do |reader_sym|
4
+ writer_sym = reader_sym.to_writer
5
+
6
+ it "'#{reader_sym}' can be a truthy or falsy" do
7
+ subject.send writer_sym, true
8
+ subject.send(reader_sym).should be_true
9
+ subject.send writer_sym, false
10
+ subject.send(reader_sym).should be_false
11
+ subject.send writer_sym, Object.new
12
+ subject.send(reader_sym).should be_true
13
+ subject.send writer_sym, nil
14
+ subject.send(reader_sym).should be_false
15
+ end
16
+ end
17
+
18
+ shared_examples 'the float attribute' do |reader_sym, interval|
19
+ writer_sym = reader_sym.to_writer
20
+ interval =~ /(\[|\()\s*(.+?)\s*,\s*(.+?)\s*(\]|\))/
21
+ lower = $2 == '-inf.' ? -Float::INFINITY : $2.to_f
22
+ upper = $3 == '+inf.' ? +Float::INFINITY : $3.to_f
23
+ # Whether the boundaries are open.
24
+ lopen = $1 == '('
25
+ uopen = $4 == ')'
26
+ error_pattern = /Invalid parameter value/
27
+ specify "'#{reader_sym}' is in #$1#$2,#$3#$4" do
28
+
29
+ if lower != -Float::INFINITY
30
+ # Validates values smaller than the lower bound.
31
+ [lower - 4096, lower - 0.01].each do |value|
32
+ expect { subject.send writer_sym, value }.to raise_error error_pattern
33
+ end
34
+
35
+ # Validates the lower bound.
36
+ if lopen
37
+ expect { subject.send writer_sym, lower }.to raise_error error_pattern
38
+ else
39
+ subject.send writer_sym, lower
40
+ subject.send(reader_sym).should be_within(TOLERANCE).of lower
41
+ end
42
+ end
43
+
44
+ # Validates values within the bounds.
45
+ l, u =
46
+ if lower == -Float::INFINITY and upper == Float::INFINITY
47
+ [-4096, 4096]
48
+ elsif lower == -Float::INFINITY
49
+ [upper - 4096, upper]
50
+ elsif upper == Float::INFINITY
51
+ [lower, lower + 4096]
52
+ else
53
+ [lower, upper]
54
+ end
55
+ [l + 0.01, (l + u) / 2.0, u - 0.01].each do |value|
56
+ subject.send writer_sym, value
57
+ subject.send(reader_sym).should be_within(TOLERANCE).of(value)
58
+ end
59
+
60
+ if upper != Float::INFINITY
61
+ # Validates the upper bound.
62
+ if uopen
63
+ expect { subject.send writer_sym, upper }.to raise_error error_pattern
64
+ else
65
+ subject.send writer_sym, upper
66
+ subject.send(reader_sym).should be_within(TOLERANCE).of upper
67
+ end
68
+
69
+ # Validates values greater than the upper bound.
70
+ [upper + 0.01, upper + upper.abs].each do |value|
71
+ expect { subject.send writer_sym, value }.to raise_error error_pattern
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ shared_examples 'an audio object with format' do
4
+
5
+ context 'read from the WAVE file' do
6
+ subject { described_class.new(WAV_PATH) }
7
+ its(:bit_depth) { should eq 8 }
8
+ its(:channel_count) { should eq 1 }
9
+ its(:frequency) { should eq 11025 }
10
+ end
11
+
12
+ context 'read from the Ogg Vorbis file' do
13
+ subject { described_class.new(OV_PATH) }
14
+ its(:bit_depth) { should eq 16 }
15
+ its(:channel_count) { should eq 1 }
16
+ its(:frequency) { should eq 44100 }
17
+ end
18
+
19
+ it 'fails reading audio if a wrong format is specified' do
20
+ expect do
21
+ described_class.new(WAV_PATH, Format::OV)
22
+ end.to raise_error /Ogg Vorbis/
23
+ expect do
24
+ described_class.new(OV_PATH, Format::MPG)
25
+ end.to raise_error /MPEG/
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ shared_examples 'a movable object' do
4
+ describe 'by default' do
5
+ its(:position) { should eq [0, 0, 0] }
6
+ its(:velocity) { should eq [0, 0, 0] }
7
+ end
8
+
9
+ it 'can change its position' do
10
+ old_position = subject.position
11
+ subject.position = 3.2, 3.1, -0.3
12
+ subject.position.should be_each_within(TOLERANCE).of [3.2, 3.1, -0.3]
13
+ subject.position = old_position
14
+ end
15
+
16
+ it 'can change its velocity' do
17
+ old_velocity = subject.velocity
18
+ subject.velocity = 1.3, -3, 0.566
19
+ subject.velocity.should be_each_within(TOLERANCE).of [1.3, -3, 0.566]
20
+ subject.velocity = old_velocity
21
+ end
22
+ end
@@ -0,0 +1,857 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE Ogg CONTAINER SOURCE CODE. *
4
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
+ * *
8
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 *
9
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
10
+ * *
11
+ ********************************************************************
12
+
13
+ function: packing variable sized words into an octet stream
14
+ last mod: $Id: bitwise.c 18051 2011-08-04 17:56:39Z giles $
15
+
16
+ ********************************************************************/
17
+
18
+ /* We're 'LSb' endian; if we write a word but read individual bits,
19
+ then we'll read the lsb first */
20
+
21
+ #include <string.h>
22
+ #include <stdlib.h>
23
+ #include <limits.h>
24
+ #include <ogg/ogg.h>
25
+
26
+ #define BUFFER_INCREMENT 256
27
+
28
+ static const unsigned long mask[]=
29
+ {0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
30
+ 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
31
+ 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
32
+ 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,
33
+ 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff,
34
+ 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,
35
+ 0x3fffffff,0x7fffffff,0xffffffff };
36
+
37
+ static const unsigned int mask8B[]=
38
+ {0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};
39
+
40
+ void oggpack_writeinit(oggpack_buffer *b){
41
+ memset(b,0,sizeof(*b));
42
+ b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT);
43
+ b->buffer[0]='\0';
44
+ b->storage=BUFFER_INCREMENT;
45
+ }
46
+
47
+ void oggpackB_writeinit(oggpack_buffer *b){
48
+ oggpack_writeinit(b);
49
+ }
50
+
51
+ int oggpack_writecheck(oggpack_buffer *b){
52
+ if(!b->ptr || !b->storage)return -1;
53
+ return 0;
54
+ }
55
+
56
+ int oggpackB_writecheck(oggpack_buffer *b){
57
+ return oggpack_writecheck(b);
58
+ }
59
+
60
+ void oggpack_writetrunc(oggpack_buffer *b,long bits){
61
+ long bytes=bits>>3;
62
+ if(b->ptr){
63
+ bits-=bytes*8;
64
+ b->ptr=b->buffer+bytes;
65
+ b->endbit=bits;
66
+ b->endbyte=bytes;
67
+ *b->ptr&=mask[bits];
68
+ }
69
+ }
70
+
71
+ void oggpackB_writetrunc(oggpack_buffer *b,long bits){
72
+ long bytes=bits>>3;
73
+ if(b->ptr){
74
+ bits-=bytes*8;
75
+ b->ptr=b->buffer+bytes;
76
+ b->endbit=bits;
77
+ b->endbyte=bytes;
78
+ *b->ptr&=mask8B[bits];
79
+ }
80
+ }
81
+
82
+ /* Takes only up to 32 bits. */
83
+ void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){
84
+ if(bits<0 || bits>32) goto err;
85
+ if(b->endbyte>=b->storage-4){
86
+ void *ret;
87
+ if(!b->ptr)return;
88
+ if(b->storage>LONG_MAX-BUFFER_INCREMENT) goto err;
89
+ ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
90
+ if(!ret) goto err;
91
+ b->buffer=ret;
92
+ b->storage+=BUFFER_INCREMENT;
93
+ b->ptr=b->buffer+b->endbyte;
94
+ }
95
+
96
+ value&=mask[bits];
97
+ bits+=b->endbit;
98
+
99
+ b->ptr[0]|=value<<b->endbit;
100
+
101
+ if(bits>=8){
102
+ b->ptr[1]=(unsigned char)(value>>(8-b->endbit));
103
+ if(bits>=16){
104
+ b->ptr[2]=(unsigned char)(value>>(16-b->endbit));
105
+ if(bits>=24){
106
+ b->ptr[3]=(unsigned char)(value>>(24-b->endbit));
107
+ if(bits>=32){
108
+ if(b->endbit)
109
+ b->ptr[4]=(unsigned char)(value>>(32-b->endbit));
110
+ else
111
+ b->ptr[4]=0;
112
+ }
113
+ }
114
+ }
115
+ }
116
+
117
+ b->endbyte+=bits/8;
118
+ b->ptr+=bits/8;
119
+ b->endbit=bits&7;
120
+ return;
121
+ err:
122
+ oggpack_writeclear(b);
123
+ }
124
+
125
+ /* Takes only up to 32 bits. */
126
+ void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits){
127
+ if(bits<0 || bits>32) goto err;
128
+ if(b->endbyte>=b->storage-4){
129
+ void *ret;
130
+ if(!b->ptr)return;
131
+ if(b->storage>LONG_MAX-BUFFER_INCREMENT) goto err;
132
+ ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
133
+ if(!ret) goto err;
134
+ b->buffer=ret;
135
+ b->storage+=BUFFER_INCREMENT;
136
+ b->ptr=b->buffer+b->endbyte;
137
+ }
138
+
139
+ value=(value&mask[bits])<<(32-bits);
140
+ bits+=b->endbit;
141
+
142
+ b->ptr[0]|=value>>(24+b->endbit);
143
+
144
+ if(bits>=8){
145
+ b->ptr[1]=(unsigned char)(value>>(16+b->endbit));
146
+ if(bits>=16){
147
+ b->ptr[2]=(unsigned char)(value>>(8+b->endbit));
148
+ if(bits>=24){
149
+ b->ptr[3]=(unsigned char)(value>>(b->endbit));
150
+ if(bits>=32){
151
+ if(b->endbit)
152
+ b->ptr[4]=(unsigned char)(value<<(8-b->endbit));
153
+ else
154
+ b->ptr[4]=0;
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ b->endbyte+=bits/8;
161
+ b->ptr+=bits/8;
162
+ b->endbit=bits&7;
163
+ return;
164
+ err:
165
+ oggpack_writeclear(b);
166
+ }
167
+
168
+ void oggpack_writealign(oggpack_buffer *b){
169
+ int bits=8-b->endbit;
170
+ if(bits<8)
171
+ oggpack_write(b,0,bits);
172
+ }
173
+
174
+ void oggpackB_writealign(oggpack_buffer *b){
175
+ int bits=8-b->endbit;
176
+ if(bits<8)
177
+ oggpackB_write(b,0,bits);
178
+ }
179
+
180
+ static void oggpack_writecopy_helper(oggpack_buffer *b,
181
+ void *source,
182
+ long bits,
183
+ void (*w)(oggpack_buffer *,
184
+ unsigned long,
185
+ int),
186
+ int msb){
187
+ unsigned char *ptr=(unsigned char *)source;
188
+
189
+ long bytes=bits/8;
190
+ bits-=bytes*8;
191
+
192
+ if(b->endbit){
193
+ int i;
194
+ /* unaligned copy. Do it the hard way. */
195
+ for(i=0;i<bytes;i++)
196
+ w(b,(unsigned long)(ptr[i]),8);
197
+ }else{
198
+ /* aligned block copy */
199
+ if(b->endbyte+bytes+1>=b->storage){
200
+ void *ret;
201
+ if(!b->ptr) goto err;
202
+ if(b->endbyte+bytes+BUFFER_INCREMENT>b->storage) goto err;
203
+ b->storage=b->endbyte+bytes+BUFFER_INCREMENT;
204
+ ret=_ogg_realloc(b->buffer,b->storage);
205
+ if(!ret) goto err;
206
+ b->buffer=ret;
207
+ b->ptr=b->buffer+b->endbyte;
208
+ }
209
+
210
+ memmove(b->ptr,source,bytes);
211
+ b->ptr+=bytes;
212
+ b->endbyte+=bytes;
213
+ *b->ptr=0;
214
+
215
+ }
216
+ if(bits){
217
+ if(msb)
218
+ w(b,(unsigned long)(ptr[bytes]>>(8-bits)),bits);
219
+ else
220
+ w(b,(unsigned long)(ptr[bytes]),bits);
221
+ }
222
+ return;
223
+ err:
224
+ oggpack_writeclear(b);
225
+ }
226
+
227
+ void oggpack_writecopy(oggpack_buffer *b,void *source,long bits){
228
+ oggpack_writecopy_helper(b,source,bits,oggpack_write,0);
229
+ }
230
+
231
+ void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits){
232
+ oggpack_writecopy_helper(b,source,bits,oggpackB_write,1);
233
+ }
234
+
235
+ void oggpack_reset(oggpack_buffer *b){
236
+ if(!b->ptr)return;
237
+ b->ptr=b->buffer;
238
+ b->buffer[0]=0;
239
+ b->endbit=b->endbyte=0;
240
+ }
241
+
242
+ void oggpackB_reset(oggpack_buffer *b){
243
+ oggpack_reset(b);
244
+ }
245
+
246
+ void oggpack_writeclear(oggpack_buffer *b){
247
+ if(b->buffer)_ogg_free(b->buffer);
248
+ memset(b,0,sizeof(*b));
249
+ }
250
+
251
+ void oggpackB_writeclear(oggpack_buffer *b){
252
+ oggpack_writeclear(b);
253
+ }
254
+
255
+ void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){
256
+ memset(b,0,sizeof(*b));
257
+ b->buffer=b->ptr=buf;
258
+ b->storage=bytes;
259
+ }
260
+
261
+ void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){
262
+ oggpack_readinit(b,buf,bytes);
263
+ }
264
+
265
+ /* Read in bits without advancing the bitptr; bits <= 32 */
266
+ long oggpack_look(oggpack_buffer *b,int bits){
267
+ unsigned long ret;
268
+ unsigned long m;
269
+
270
+ if(bits<0 || bits>32) return -1;
271
+ m=mask[bits];
272
+ bits+=b->endbit;
273
+
274
+ if(b->endbyte >= b->storage-4){
275
+ /* not the main path */
276
+ if(b->endbyte > b->storage-((bits+7)>>3)) return -1;
277
+ /* special case to avoid reading b->ptr[0], which might be past the end of
278
+ the buffer; also skips some useless accounting */
279
+ else if(!bits)return(0L);
280
+ }
281
+
282
+ ret=b->ptr[0]>>b->endbit;
283
+ if(bits>8){
284
+ ret|=b->ptr[1]<<(8-b->endbit);
285
+ if(bits>16){
286
+ ret|=b->ptr[2]<<(16-b->endbit);
287
+ if(bits>24){
288
+ ret|=b->ptr[3]<<(24-b->endbit);
289
+ if(bits>32 && b->endbit)
290
+ ret|=b->ptr[4]<<(32-b->endbit);
291
+ }
292
+ }
293
+ }
294
+ return(m&ret);
295
+ }
296
+
297
+ /* Read in bits without advancing the bitptr; bits <= 32 */
298
+ long oggpackB_look(oggpack_buffer *b,int bits){
299
+ unsigned long ret;
300
+ int m=32-bits;
301
+
302
+ if(m<0 || m>32) return -1;
303
+ bits+=b->endbit;
304
+
305
+ if(b->endbyte >= b->storage-4){
306
+ /* not the main path */
307
+ if(b->endbyte > b->storage-((bits+7)>>3)) return -1;
308
+ /* special case to avoid reading b->ptr[0], which might be past the end of
309
+ the buffer; also skips some useless accounting */
310
+ else if(!bits)return(0L);
311
+ }
312
+
313
+ ret=b->ptr[0]<<(24+b->endbit);
314
+ if(bits>8){
315
+ ret|=b->ptr[1]<<(16+b->endbit);
316
+ if(bits>16){
317
+ ret|=b->ptr[2]<<(8+b->endbit);
318
+ if(bits>24){
319
+ ret|=b->ptr[3]<<(b->endbit);
320
+ if(bits>32 && b->endbit)
321
+ ret|=b->ptr[4]>>(8-b->endbit);
322
+ }
323
+ }
324
+ }
325
+ return ((ret&0xffffffff)>>(m>>1))>>((m+1)>>1);
326
+ }
327
+
328
+ long oggpack_look1(oggpack_buffer *b){
329
+ if(b->endbyte>=b->storage)return(-1);
330
+ return((b->ptr[0]>>b->endbit)&1);
331
+ }
332
+
333
+ long oggpackB_look1(oggpack_buffer *b){
334
+ if(b->endbyte>=b->storage)return(-1);
335
+ return((b->ptr[0]>>(7-b->endbit))&1);
336
+ }
337
+
338
+ void oggpack_adv(oggpack_buffer *b,int bits){
339
+ bits+=b->endbit;
340
+
341
+ if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow;
342
+
343
+ b->ptr+=bits/8;
344
+ b->endbyte+=bits/8;
345
+ b->endbit=bits&7;
346
+ return;
347
+
348
+ overflow:
349
+ b->ptr=NULL;
350
+ b->endbyte=b->storage;
351
+ b->endbit=1;
352
+ }
353
+
354
+ void oggpackB_adv(oggpack_buffer *b,int bits){
355
+ oggpack_adv(b,bits);
356
+ }
357
+
358
+ void oggpack_adv1(oggpack_buffer *b){
359
+ if(++(b->endbit)>7){
360
+ b->endbit=0;
361
+ b->ptr++;
362
+ b->endbyte++;
363
+ }
364
+ }
365
+
366
+ void oggpackB_adv1(oggpack_buffer *b){
367
+ oggpack_adv1(b);
368
+ }
369
+
370
+ /* bits <= 32 */
371
+ long oggpack_read(oggpack_buffer *b,int bits){
372
+ long ret;
373
+ unsigned long m;
374
+
375
+ if(bits<0 || bits>32) goto err;
376
+ m=mask[bits];
377
+ bits+=b->endbit;
378
+
379
+ if(b->endbyte >= b->storage-4){
380
+ /* not the main path */
381
+ if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow;
382
+ /* special case to avoid reading b->ptr[0], which might be past the end of
383
+ the buffer; also skips some useless accounting */
384
+ else if(!bits)return(0L);
385
+ }
386
+
387
+ ret=b->ptr[0]>>b->endbit;
388
+ if(bits>8){
389
+ ret|=b->ptr[1]<<(8-b->endbit);
390
+ if(bits>16){
391
+ ret|=b->ptr[2]<<(16-b->endbit);
392
+ if(bits>24){
393
+ ret|=b->ptr[3]<<(24-b->endbit);
394
+ if(bits>32 && b->endbit){
395
+ ret|=b->ptr[4]<<(32-b->endbit);
396
+ }
397
+ }
398
+ }
399
+ }
400
+ ret&=m;
401
+ b->ptr+=bits/8;
402
+ b->endbyte+=bits/8;
403
+ b->endbit=bits&7;
404
+ return ret;
405
+
406
+ overflow:
407
+ err:
408
+ b->ptr=NULL;
409
+ b->endbyte=b->storage;
410
+ b->endbit=1;
411
+ return -1L;
412
+ }
413
+
414
+ /* bits <= 32 */
415
+ long oggpackB_read(oggpack_buffer *b,int bits){
416
+ long ret;
417
+ long m=32-bits;
418
+
419
+ if(m<0 || m>32) goto err;
420
+ bits+=b->endbit;
421
+
422
+ if(b->endbyte+4>=b->storage){
423
+ /* not the main path */
424
+ if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow;
425
+ /* special case to avoid reading b->ptr[0], which might be past the end of
426
+ the buffer; also skips some useless accounting */
427
+ else if(!bits)return(0L);
428
+ }
429
+
430
+ ret=b->ptr[0]<<(24+b->endbit);
431
+ if(bits>8){
432
+ ret|=b->ptr[1]<<(16+b->endbit);
433
+ if(bits>16){
434
+ ret|=b->ptr[2]<<(8+b->endbit);
435
+ if(bits>24){
436
+ ret|=b->ptr[3]<<(b->endbit);
437
+ if(bits>32 && b->endbit)
438
+ ret|=b->ptr[4]>>(8-b->endbit);
439
+ }
440
+ }
441
+ }
442
+ ret=((ret&0xffffffffUL)>>(m>>1))>>((m+1)>>1);
443
+
444
+ b->ptr+=bits/8;
445
+ b->endbyte+=bits/8;
446
+ b->endbit=bits&7;
447
+ return ret;
448
+
449
+ overflow:
450
+ err:
451
+ b->ptr=NULL;
452
+ b->endbyte=b->storage;
453
+ b->endbit=1;
454
+ return -1L;
455
+ }
456
+
457
+ long oggpack_read1(oggpack_buffer *b){
458
+ long ret;
459
+
460
+ if(b->endbyte >= b->storage) goto overflow;
461
+ ret=(b->ptr[0]>>b->endbit)&1;
462
+
463
+ b->endbit++;
464
+ if(b->endbit>7){
465
+ b->endbit=0;
466
+ b->ptr++;
467
+ b->endbyte++;
468
+ }
469
+ return ret;
470
+
471
+ overflow:
472
+ b->ptr=NULL;
473
+ b->endbyte=b->storage;
474
+ b->endbit=1;
475
+ return -1L;
476
+ }
477
+
478
+ long oggpackB_read1(oggpack_buffer *b){
479
+ long ret;
480
+
481
+ if(b->endbyte >= b->storage) goto overflow;
482
+ ret=(b->ptr[0]>>(7-b->endbit))&1;
483
+
484
+ b->endbit++;
485
+ if(b->endbit>7){
486
+ b->endbit=0;
487
+ b->ptr++;
488
+ b->endbyte++;
489
+ }
490
+ return ret;
491
+
492
+ overflow:
493
+ b->ptr=NULL;
494
+ b->endbyte=b->storage;
495
+ b->endbit=1;
496
+ return -1L;
497
+ }
498
+
499
+ long oggpack_bytes(oggpack_buffer *b){
500
+ return(b->endbyte+(b->endbit+7)/8);
501
+ }
502
+
503
+ long oggpack_bits(oggpack_buffer *b){
504
+ return(b->endbyte*8+b->endbit);
505
+ }
506
+
507
+ long oggpackB_bytes(oggpack_buffer *b){
508
+ return oggpack_bytes(b);
509
+ }
510
+
511
+ long oggpackB_bits(oggpack_buffer *b){
512
+ return oggpack_bits(b);
513
+ }
514
+
515
+ unsigned char *oggpack_get_buffer(oggpack_buffer *b){
516
+ return(b->buffer);
517
+ }
518
+
519
+ unsigned char *oggpackB_get_buffer(oggpack_buffer *b){
520
+ return oggpack_get_buffer(b);
521
+ }
522
+
523
+ /* Self test of the bitwise routines; everything else is based on
524
+ them, so they damned well better be solid. */
525
+
526
+ #ifdef _V_SELFTEST
527
+ #include <stdio.h>
528
+
529
+ static int ilog(unsigned int v){
530
+ int ret=0;
531
+ while(v){
532
+ ret++;
533
+ v>>=1;
534
+ }
535
+ return(ret);
536
+ }
537
+
538
+ oggpack_buffer o;
539
+ oggpack_buffer r;
540
+
541
+ void report(char *in){
542
+ fprintf(stderr,"%s",in);
543
+ exit(1);
544
+ }
545
+
546
+ void cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){
547
+ long bytes,i;
548
+ unsigned char *buffer;
549
+
550
+ oggpack_reset(&o);
551
+ for(i=0;i<vals;i++)
552
+ oggpack_write(&o,b[i],bits?bits:ilog(b[i]));
553
+ buffer=oggpack_get_buffer(&o);
554
+ bytes=oggpack_bytes(&o);
555
+ if(bytes!=compsize)report("wrong number of bytes!\n");
556
+ for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
557
+ for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
558
+ report("wrote incorrect value!\n");
559
+ }
560
+ oggpack_readinit(&r,buffer,bytes);
561
+ for(i=0;i<vals;i++){
562
+ int tbit=bits?bits:ilog(b[i]);
563
+ if(oggpack_look(&r,tbit)==-1)
564
+ report("out of data!\n");
565
+ if(oggpack_look(&r,tbit)!=(b[i]&mask[tbit]))
566
+ report("looked at incorrect value!\n");
567
+ if(tbit==1)
568
+ if(oggpack_look1(&r)!=(b[i]&mask[tbit]))
569
+ report("looked at single bit incorrect value!\n");
570
+ if(tbit==1){
571
+ if(oggpack_read1(&r)!=(b[i]&mask[tbit]))
572
+ report("read incorrect single bit value!\n");
573
+ }else{
574
+ if(oggpack_read(&r,tbit)!=(b[i]&mask[tbit]))
575
+ report("read incorrect value!\n");
576
+ }
577
+ }
578
+ if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
579
+ }
580
+
581
+ void cliptestB(unsigned long *b,int vals,int bits,int *comp,int compsize){
582
+ long bytes,i;
583
+ unsigned char *buffer;
584
+
585
+ oggpackB_reset(&o);
586
+ for(i=0;i<vals;i++)
587
+ oggpackB_write(&o,b[i],bits?bits:ilog(b[i]));
588
+ buffer=oggpackB_get_buffer(&o);
589
+ bytes=oggpackB_bytes(&o);
590
+ if(bytes!=compsize)report("wrong number of bytes!\n");
591
+ for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
592
+ for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
593
+ report("wrote incorrect value!\n");
594
+ }
595
+ oggpackB_readinit(&r,buffer,bytes);
596
+ for(i=0;i<vals;i++){
597
+ int tbit=bits?bits:ilog(b[i]);
598
+ if(oggpackB_look(&r,tbit)==-1)
599
+ report("out of data!\n");
600
+ if(oggpackB_look(&r,tbit)!=(b[i]&mask[tbit]))
601
+ report("looked at incorrect value!\n");
602
+ if(tbit==1)
603
+ if(oggpackB_look1(&r)!=(b[i]&mask[tbit]))
604
+ report("looked at single bit incorrect value!\n");
605
+ if(tbit==1){
606
+ if(oggpackB_read1(&r)!=(b[i]&mask[tbit]))
607
+ report("read incorrect single bit value!\n");
608
+ }else{
609
+ if(oggpackB_read(&r,tbit)!=(b[i]&mask[tbit]))
610
+ report("read incorrect value!\n");
611
+ }
612
+ }
613
+ if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
614
+ }
615
+
616
+ int main(void){
617
+ unsigned char *buffer;
618
+ long bytes,i;
619
+ static unsigned long testbuffer1[]=
620
+ {18,12,103948,4325,543,76,432,52,3,65,4,56,32,42,34,21,1,23,32,546,456,7,
621
+ 567,56,8,8,55,3,52,342,341,4,265,7,67,86,2199,21,7,1,5,1,4};
622
+ int test1size=43;
623
+
624
+ static unsigned long testbuffer2[]=
625
+ {216531625L,1237861823,56732452,131,3212421,12325343,34547562,12313212,
626
+ 1233432,534,5,346435231,14436467,7869299,76326614,167548585,
627
+ 85525151,0,12321,1,349528352};
628
+ int test2size=21;
629
+
630
+ static unsigned long testbuffer3[]=
631
+ {1,0,14,0,1,0,12,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1,
632
+ 0,1,30,1,1,1,0,0,1,0,0,0,12,0,11,0,1,0,0,1};
633
+ int test3size=56;
634
+
635
+ static unsigned long large[]=
636
+ {2136531625L,2137861823,56732452,131,3212421,12325343,34547562,12313212,
637
+ 1233432,534,5,2146435231,14436467,7869299,76326614,167548585,
638
+ 85525151,0,12321,1,2146528352};
639
+
640
+ int onesize=33;
641
+ static int one[33]={146,25,44,151,195,15,153,176,233,131,196,65,85,172,47,40,
642
+ 34,242,223,136,35,222,211,86,171,50,225,135,214,75,172,
643
+ 223,4};
644
+ static int oneB[33]={150,101,131,33,203,15,204,216,105,193,156,65,84,85,222,
645
+ 8,139,145,227,126,34,55,244,171,85,100,39,195,173,18,
646
+ 245,251,128};
647
+
648
+ int twosize=6;
649
+ static int two[6]={61,255,255,251,231,29};
650
+ static int twoB[6]={247,63,255,253,249,120};
651
+
652
+ int threesize=54;
653
+ static int three[54]={169,2,232,252,91,132,156,36,89,13,123,176,144,32,254,
654
+ 142,224,85,59,121,144,79,124,23,67,90,90,216,79,23,83,
655
+ 58,135,196,61,55,129,183,54,101,100,170,37,127,126,10,
656
+ 100,52,4,14,18,86,77,1};
657
+ static int threeB[54]={206,128,42,153,57,8,183,251,13,89,36,30,32,144,183,
658
+ 130,59,240,121,59,85,223,19,228,180,134,33,107,74,98,
659
+ 233,253,196,135,63,2,110,114,50,155,90,127,37,170,104,
660
+ 200,20,254,4,58,106,176,144,0};
661
+
662
+ int foursize=38;
663
+ static int four[38]={18,6,163,252,97,194,104,131,32,1,7,82,137,42,129,11,72,
664
+ 132,60,220,112,8,196,109,64,179,86,9,137,195,208,122,169,
665
+ 28,2,133,0,1};
666
+ static int fourB[38]={36,48,102,83,243,24,52,7,4,35,132,10,145,21,2,93,2,41,
667
+ 1,219,184,16,33,184,54,149,170,132,18,30,29,98,229,67,
668
+ 129,10,4,32};
669
+
670
+ int fivesize=45;
671
+ static int five[45]={169,2,126,139,144,172,30,4,80,72,240,59,130,218,73,62,
672
+ 241,24,210,44,4,20,0,248,116,49,135,100,110,130,181,169,
673
+ 84,75,159,2,1,0,132,192,8,0,0,18,22};
674
+ static int fiveB[45]={1,84,145,111,245,100,128,8,56,36,40,71,126,78,213,226,
675
+ 124,105,12,0,133,128,0,162,233,242,67,152,77,205,77,
676
+ 172,150,169,129,79,128,0,6,4,32,0,27,9,0};
677
+
678
+ int sixsize=7;
679
+ static int six[7]={17,177,170,242,169,19,148};
680
+ static int sixB[7]={136,141,85,79,149,200,41};
681
+
682
+ /* Test read/write together */
683
+ /* Later we test against pregenerated bitstreams */
684
+ oggpack_writeinit(&o);
685
+
686
+ fprintf(stderr,"\nSmall preclipped packing (LSb): ");
687
+ cliptest(testbuffer1,test1size,0,one,onesize);
688
+ fprintf(stderr,"ok.");
689
+
690
+ fprintf(stderr,"\nNull bit call (LSb): ");
691
+ cliptest(testbuffer3,test3size,0,two,twosize);
692
+ fprintf(stderr,"ok.");
693
+
694
+ fprintf(stderr,"\nLarge preclipped packing (LSb): ");
695
+ cliptest(testbuffer2,test2size,0,three,threesize);
696
+ fprintf(stderr,"ok.");
697
+
698
+ fprintf(stderr,"\n32 bit preclipped packing (LSb): ");
699
+ oggpack_reset(&o);
700
+ for(i=0;i<test2size;i++)
701
+ oggpack_write(&o,large[i],32);
702
+ buffer=oggpack_get_buffer(&o);
703
+ bytes=oggpack_bytes(&o);
704
+ oggpack_readinit(&r,buffer,bytes);
705
+ for(i=0;i<test2size;i++){
706
+ if(oggpack_look(&r,32)==-1)report("out of data. failed!");
707
+ if(oggpack_look(&r,32)!=large[i]){
708
+ fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpack_look(&r,32),large[i],
709
+ oggpack_look(&r,32),large[i]);
710
+ report("read incorrect value!\n");
711
+ }
712
+ oggpack_adv(&r,32);
713
+ }
714
+ if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
715
+ fprintf(stderr,"ok.");
716
+
717
+ fprintf(stderr,"\nSmall unclipped packing (LSb): ");
718
+ cliptest(testbuffer1,test1size,7,four,foursize);
719
+ fprintf(stderr,"ok.");
720
+
721
+ fprintf(stderr,"\nLarge unclipped packing (LSb): ");
722
+ cliptest(testbuffer2,test2size,17,five,fivesize);
723
+ fprintf(stderr,"ok.");
724
+
725
+ fprintf(stderr,"\nSingle bit unclipped packing (LSb): ");
726
+ cliptest(testbuffer3,test3size,1,six,sixsize);
727
+ fprintf(stderr,"ok.");
728
+
729
+ fprintf(stderr,"\nTesting read past end (LSb): ");
730
+ oggpack_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
731
+ for(i=0;i<64;i++){
732
+ if(oggpack_read(&r,1)!=0){
733
+ fprintf(stderr,"failed; got -1 prematurely.\n");
734
+ exit(1);
735
+ }
736
+ }
737
+ if(oggpack_look(&r,1)!=-1 ||
738
+ oggpack_read(&r,1)!=-1){
739
+ fprintf(stderr,"failed; read past end without -1.\n");
740
+ exit(1);
741
+ }
742
+ oggpack_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
743
+ if(oggpack_read(&r,30)!=0 || oggpack_read(&r,16)!=0){
744
+ fprintf(stderr,"failed 2; got -1 prematurely.\n");
745
+ exit(1);
746
+ }
747
+
748
+ if(oggpack_look(&r,18)!=0 ||
749
+ oggpack_look(&r,18)!=0){
750
+ fprintf(stderr,"failed 3; got -1 prematurely.\n");
751
+ exit(1);
752
+ }
753
+ if(oggpack_look(&r,19)!=-1 ||
754
+ oggpack_look(&r,19)!=-1){
755
+ fprintf(stderr,"failed; read past end without -1.\n");
756
+ exit(1);
757
+ }
758
+ if(oggpack_look(&r,32)!=-1 ||
759
+ oggpack_look(&r,32)!=-1){
760
+ fprintf(stderr,"failed; read past end without -1.\n");
761
+ exit(1);
762
+ }
763
+ oggpack_writeclear(&o);
764
+ fprintf(stderr,"ok.\n");
765
+
766
+ /********** lazy, cut-n-paste retest with MSb packing ***********/
767
+
768
+ /* Test read/write together */
769
+ /* Later we test against pregenerated bitstreams */
770
+ oggpackB_writeinit(&o);
771
+
772
+ fprintf(stderr,"\nSmall preclipped packing (MSb): ");
773
+ cliptestB(testbuffer1,test1size,0,oneB,onesize);
774
+ fprintf(stderr,"ok.");
775
+
776
+ fprintf(stderr,"\nNull bit call (MSb): ");
777
+ cliptestB(testbuffer3,test3size,0,twoB,twosize);
778
+ fprintf(stderr,"ok.");
779
+
780
+ fprintf(stderr,"\nLarge preclipped packing (MSb): ");
781
+ cliptestB(testbuffer2,test2size,0,threeB,threesize);
782
+ fprintf(stderr,"ok.");
783
+
784
+ fprintf(stderr,"\n32 bit preclipped packing (MSb): ");
785
+ oggpackB_reset(&o);
786
+ for(i=0;i<test2size;i++)
787
+ oggpackB_write(&o,large[i],32);
788
+ buffer=oggpackB_get_buffer(&o);
789
+ bytes=oggpackB_bytes(&o);
790
+ oggpackB_readinit(&r,buffer,bytes);
791
+ for(i=0;i<test2size;i++){
792
+ if(oggpackB_look(&r,32)==-1)report("out of data. failed!");
793
+ if(oggpackB_look(&r,32)!=large[i]){
794
+ fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpackB_look(&r,32),large[i],
795
+ oggpackB_look(&r,32),large[i]);
796
+ report("read incorrect value!\n");
797
+ }
798
+ oggpackB_adv(&r,32);
799
+ }
800
+ if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
801
+ fprintf(stderr,"ok.");
802
+
803
+ fprintf(stderr,"\nSmall unclipped packing (MSb): ");
804
+ cliptestB(testbuffer1,test1size,7,fourB,foursize);
805
+ fprintf(stderr,"ok.");
806
+
807
+ fprintf(stderr,"\nLarge unclipped packing (MSb): ");
808
+ cliptestB(testbuffer2,test2size,17,fiveB,fivesize);
809
+ fprintf(stderr,"ok.");
810
+
811
+ fprintf(stderr,"\nSingle bit unclipped packing (MSb): ");
812
+ cliptestB(testbuffer3,test3size,1,sixB,sixsize);
813
+ fprintf(stderr,"ok.");
814
+
815
+ fprintf(stderr,"\nTesting read past end (MSb): ");
816
+ oggpackB_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
817
+ for(i=0;i<64;i++){
818
+ if(oggpackB_read(&r,1)!=0){
819
+ fprintf(stderr,"failed; got -1 prematurely.\n");
820
+ exit(1);
821
+ }
822
+ }
823
+ if(oggpackB_look(&r,1)!=-1 ||
824
+ oggpackB_read(&r,1)!=-1){
825
+ fprintf(stderr,"failed; read past end without -1.\n");
826
+ exit(1);
827
+ }
828
+ oggpackB_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
829
+ if(oggpackB_read(&r,30)!=0 || oggpackB_read(&r,16)!=0){
830
+ fprintf(stderr,"failed 2; got -1 prematurely.\n");
831
+ exit(1);
832
+ }
833
+
834
+ if(oggpackB_look(&r,18)!=0 ||
835
+ oggpackB_look(&r,18)!=0){
836
+ fprintf(stderr,"failed 3; got -1 prematurely.\n");
837
+ exit(1);
838
+ }
839
+ if(oggpackB_look(&r,19)!=-1 ||
840
+ oggpackB_look(&r,19)!=-1){
841
+ fprintf(stderr,"failed; read past end without -1.\n");
842
+ exit(1);
843
+ }
844
+ if(oggpackB_look(&r,32)!=-1 ||
845
+ oggpackB_look(&r,32)!=-1){
846
+ fprintf(stderr,"failed; read past end without -1.\n");
847
+ exit(1);
848
+ }
849
+ oggpackB_writeclear(&o);
850
+ fprintf(stderr,"ok.\n\n");
851
+
852
+
853
+ return(0);
854
+ }
855
+ #endif /* _V_SELFTEST */
856
+
857
+ #undef BUFFER_INCREMENT