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,252 @@
1
+ /*
2
+ lfs_alias: Aliases to the small/native API functions with the size of long int as suffix.
3
+
4
+ copyright 2010 by the mpg123 project - free software under the terms of the LGPL 2.1
5
+ see COPYING and AUTHORS files in distribution or http://mpg123.org
6
+ initially written by Thomas Orgis
7
+
8
+ Use case: Client code on Linux/x86-64 that defines _FILE_OFFSET_BITS to 64, which is the only choice on that platform anyway. It should be no-op, but prompts the platform-agnostic header of mpg123 to define API calls with the corresponding suffix.
9
+ This file provides the names for this case. It's cruft, but glibc does it, too -- so people rely on it.
10
+ Oh, and it also caters for the lunatics that define _FILE_OFFSET_BITS=32 on 32 bit platforms.
11
+
12
+ There is also the strange case that the mpg123 build itself is configured for unnecessary _FILE_OFFSET_BITS == LFS_ALIAS_BITS =^ sizeof(long). In that case, the "native" function will have the suffix and the alias shall be provided without the suffix.
13
+
14
+ So, two basic cases:
15
+ 1. mpg123_bla_32 alias for mpg123_bla
16
+ 2. mpg123_bla alias for mpg123_bla_32
17
+ Confusing, I know. It sucks.
18
+ */
19
+
20
+ #include "config.h"
21
+
22
+ /* Hack for Solaris: Some system headers included from compat.h might force _FILE_OFFSET_BITS. Need to follow that here. */
23
+ #include "compat.h"
24
+
25
+ #ifndef LFS_ALIAS_BITS
26
+ #error "I need the count of alias bits here."
27
+ #endif
28
+
29
+ #define MACROCAT_REALLY(a, b) a ## b
30
+ #define MACROCAT(a, b) MACROCAT_REALLY(a, b)
31
+
32
+ /* This is wicked switchery: Decide which way the aliases are facing. */
33
+
34
+ #if _FILE_OFFSET_BITS+0 == LFS_ALIAS_BITS
35
+
36
+ /* The native functions are actually _with_ suffix, so let the mpg123 header use large file hackery to define the correct interfaces. */
37
+ #include "mpg123.h"
38
+ /* Don't forget to undef the function symbols before usage... */
39
+
40
+ /* The native functions have suffix, the aliases not. */
41
+ #define NATIVE_SUFFIX MACROCAT(_, _FILE_OFFSET_BITS)
42
+ #define NATIVE_NAME(func) MACROCAT(func, NATIVE_SUFFIX)
43
+ #define ALIAS_NAME(func) func
44
+
45
+ #else
46
+
47
+ /* Native functions are without suffix... */
48
+ #define MPG123_NO_LARGENAME
49
+ #include "mpg123.h"
50
+
51
+ /* The alias functions have suffix, the native ones not. */
52
+ #define ALIAS_SUFFIX MACROCAT(_, LFS_ALIAS_BITS)
53
+ #define ALIAS_NAME(func) MACROCAT(func, ALIAS_SUFFIX)
54
+ #define NATIVE_NAME(func) func
55
+
56
+ #endif
57
+
58
+ /* Now get the rest of the infrastructure on speed, namely attribute_align_arg, to stay safe. */
59
+ #include "mpg123lib_intern.h"
60
+
61
+ /*
62
+ Extract the list of functions we need wrappers for, pregenerating the wrappers for simple cases (inline script for nedit):
63
+ perl -ne '
64
+ if(/^\s*EXPORT\s+(\S+)\s+(mpg123_\S+)\((.*)\);\s*$/)
65
+ {
66
+ my $type = $1;
67
+ my $name = $2;
68
+ my $args = $3;
69
+ next unless ($type =~ /off_t/ or $args =~ /off_t/ or ($name =~ /open/ and $name ne mpg123_open_feed));
70
+ $type =~ s/off_t/long/g;
71
+ my @nargs = ();
72
+ $args =~ s/off_t/long/g;
73
+ foreach my $a (split(/,/, $args))
74
+ {
75
+ $a =~ s/^.*\s\**([a-z_]+)$/$1/;
76
+ push(@nargs, $a);
77
+ }
78
+ my $nargs = join(", ", @nargs);
79
+ $nargs = "Human: figure me out." if($nargs =~ /\(/);
80
+ print <<EOT
81
+
82
+ ##ifdef $name
83
+ ##undef $name
84
+ ##endif
85
+ $type attribute_align_arg ALIAS_NAME($name)($args)
86
+ {
87
+ return NATIVE_NAME($name)($nargs);
88
+ }
89
+ EOT
90
+
91
+ }' < mpg123.h.in
92
+ */
93
+
94
+ #ifdef mpg123_open
95
+ #undef mpg123_open
96
+ #endif
97
+ int attribute_align_arg ALIAS_NAME(mpg123_open)(mpg123_handle *mh, const char *path)
98
+ {
99
+ return NATIVE_NAME(mpg123_open)(mh, path);
100
+ }
101
+
102
+ #ifdef mpg123_open_fd
103
+ #undef mpg123_open_fd
104
+ #endif
105
+ int attribute_align_arg ALIAS_NAME(mpg123_open_fd)(mpg123_handle *mh, int fd)
106
+ {
107
+ return NATIVE_NAME(mpg123_open_fd)(mh, fd);
108
+ }
109
+
110
+ #ifdef mpg123_open_handle
111
+ #undef mpg123_open_handle
112
+ #endif
113
+ int attribute_align_arg ALIAS_NAME(mpg123_open_handle)(mpg123_handle *mh, void *iohandle)
114
+ {
115
+ return NATIVE_NAME(mpg123_open_handle)(mh, iohandle);
116
+ }
117
+
118
+ #ifdef mpg123_decode_frame
119
+ #undef mpg123_decode_frame
120
+ #endif
121
+ int attribute_align_arg ALIAS_NAME(mpg123_decode_frame)(mpg123_handle *mh, long *num, unsigned char **audio, size_t *bytes)
122
+ {
123
+ return NATIVE_NAME(mpg123_decode_frame)(mh, num, audio, bytes);
124
+ }
125
+
126
+ #ifdef mpg123_framebyframe_decode
127
+ #undef mpg123_framebyframe_decode
128
+ #endif
129
+ int attribute_align_arg ALIAS_NAME(mpg123_framebyframe_decode)(mpg123_handle *mh, long *num, unsigned char **audio, size_t *bytes)
130
+ {
131
+ return NATIVE_NAME(mpg123_framebyframe_decode)(mh, num, audio, bytes);
132
+ }
133
+
134
+ #ifdef mpg123_framepos
135
+ #undef mpg123_framepos
136
+ #endif
137
+ long attribute_align_arg ALIAS_NAME(mpg123_framepos)(mpg123_handle *mh)
138
+ {
139
+ return NATIVE_NAME(mpg123_framepos)(mh);
140
+ }
141
+
142
+ #ifdef mpg123_tell
143
+ #undef mpg123_tell
144
+ #endif
145
+ long attribute_align_arg ALIAS_NAME(mpg123_tell)(mpg123_handle *mh)
146
+ {
147
+ return NATIVE_NAME(mpg123_tell)(mh);
148
+ }
149
+
150
+ #ifdef mpg123_tellframe
151
+ #undef mpg123_tellframe
152
+ #endif
153
+ long attribute_align_arg ALIAS_NAME(mpg123_tellframe)(mpg123_handle *mh)
154
+ {
155
+ return NATIVE_NAME(mpg123_tellframe)(mh);
156
+ }
157
+
158
+ #ifdef mpg123_tell_stream
159
+ #undef mpg123_tell_stream
160
+ #endif
161
+ long attribute_align_arg ALIAS_NAME(mpg123_tell_stream)(mpg123_handle *mh)
162
+ {
163
+ return NATIVE_NAME(mpg123_tell_stream)(mh);
164
+ }
165
+
166
+ #ifdef mpg123_seek
167
+ #undef mpg123_seek
168
+ #endif
169
+ long attribute_align_arg ALIAS_NAME(mpg123_seek)(mpg123_handle *mh, long sampleoff, int whence)
170
+ {
171
+ return NATIVE_NAME(mpg123_seek)(mh, sampleoff, whence);
172
+ }
173
+
174
+ #ifdef mpg123_feedseek
175
+ #undef mpg123_feedseek
176
+ #endif
177
+ long attribute_align_arg ALIAS_NAME(mpg123_feedseek)(mpg123_handle *mh, long sampleoff, int whence, long *input_offset)
178
+ {
179
+ return NATIVE_NAME(mpg123_feedseek)(mh, sampleoff, whence, input_offset);
180
+ }
181
+
182
+ #ifdef mpg123_seek_frame
183
+ #undef mpg123_seek_frame
184
+ #endif
185
+ long attribute_align_arg ALIAS_NAME(mpg123_seek_frame)(mpg123_handle *mh, long frameoff, int whence)
186
+ {
187
+ return NATIVE_NAME(mpg123_seek_frame)(mh, frameoff, whence);
188
+ }
189
+
190
+ #ifdef mpg123_timeframe
191
+ #undef mpg123_timeframe
192
+ #endif
193
+ long attribute_align_arg ALIAS_NAME(mpg123_timeframe)(mpg123_handle *mh, double sec)
194
+ {
195
+ return NATIVE_NAME(mpg123_timeframe)(mh, sec);
196
+ }
197
+
198
+ #ifdef mpg123_index
199
+ #undef mpg123_index
200
+ #endif
201
+ int attribute_align_arg ALIAS_NAME(mpg123_index)(mpg123_handle *mh, long **offsets, long *step, size_t *fill)
202
+ {
203
+ return NATIVE_NAME(mpg123_index)(mh, offsets, step, fill);
204
+ }
205
+
206
+ #ifdef mpg123_set_index
207
+ #undef mpg123_set_index
208
+ #endif
209
+ int attribute_align_arg ALIAS_NAME(mpg123_set_index)(mpg123_handle *mh, long *offsets, long step, size_t fill)
210
+ {
211
+ return NATIVE_NAME(mpg123_set_index)(mh, offsets, step, fill);
212
+ }
213
+
214
+ #ifdef mpg123_position
215
+ #undef mpg123_position
216
+ #endif
217
+ int attribute_align_arg ALIAS_NAME(mpg123_position)( mpg123_handle *mh, long frame_offset, long buffered_bytes, long *current_frame, long *frames_left, double *current_seconds, double *seconds_left)
218
+ {
219
+ return NATIVE_NAME(mpg123_position)(mh, frame_offset, buffered_bytes, current_frame, frames_left, current_seconds, seconds_left);
220
+ }
221
+
222
+ #ifdef mpg123_length
223
+ #undef mpg123_length
224
+ #endif
225
+ long attribute_align_arg ALIAS_NAME(mpg123_length)(mpg123_handle *mh)
226
+ {
227
+ return NATIVE_NAME(mpg123_length)(mh);
228
+ }
229
+
230
+ #ifdef mpg123_set_filesize
231
+ #undef mpg123_set_filesize
232
+ #endif
233
+ int attribute_align_arg ALIAS_NAME(mpg123_set_filesize)(mpg123_handle *mh, long size)
234
+ {
235
+ return NATIVE_NAME(mpg123_set_filesize)(mh, size);
236
+ }
237
+
238
+ #ifdef mpg123_replace_reader
239
+ #undef mpg123_replace_reader
240
+ #endif
241
+ int attribute_align_arg ALIAS_NAME(mpg123_replace_reader)(mpg123_handle *mh, ssize_t (*r_read) (int, void *, size_t), long (*r_lseek)(int, long, int))
242
+ {
243
+ return NATIVE_NAME(mpg123_replace_reader)(mh, r_read, r_lseek);
244
+ }
245
+
246
+ #ifdef mpg123_replace_reader_handle
247
+ #undef mpg123_replace_reader_handle
248
+ #endif
249
+ int attribute_align_arg ALIAS_NAME(mpg123_replace_reader_handle)(mpg123_handle *mh, ssize_t (*r_read) (void *, void *, size_t), long (*r_lseek)(void *, long, int), void (*cleanup)(void*))
250
+ {
251
+ return NATIVE_NAME(mpg123_replace_reader_handle)(mh, r_read, r_lseek, cleanup);
252
+ }
@@ -0,0 +1,751 @@
1
+ /*
2
+ lfs_wrap: Crappy wrapper code for supporting crappy ambiguous large file support.
3
+
4
+ copyright 2010 by the mpg123 project - free software under the terms of the LGPL 2.1
5
+ see COPYING and AUTHORS files in distribution or http://mpg123.org
6
+
7
+ initially written by Thomas Orgis, thanks to Guido Draheim for consulting
8
+
9
+ This file contains wrappers for the case that _FILE_OFFSET_BITS (or equivalent, theoretically, depends on mpg123.h) is defined and thus certain mpg123 API calls get renamed with a suffix (p.ex. _64).
10
+ The renamed calls expect large off_t arguments, and possibly return large off_t values... these wrappers here provide the same functionality with long integer arguments/values.
11
+
12
+ Prototypical idea: There is
13
+ off_t mpg123_seek_64(mpg123_handle*, off_t, int)
14
+ This code provides
15
+ long mpg123_seek(mpg123_handle*, long, int)
16
+
17
+ This is rather simple business... wouldn't mpg123 offer replacing the I/O core with callbacks. Translating the callbacks between long and off_t world is the main reason why this file contains non-trivial code.
18
+
19
+ Note about file descriptors: We just assume that they are generally interchangeable between large and small file code... and that a large file descriptor will trigger errors when accessed with small file code where it may cause trouble (a really large file).
20
+ */
21
+
22
+ /* It mainly needs the official API ... */
23
+ /* ... but also some inside access (frame struct, readers). */
24
+ #include "mpg123lib_intern.h"
25
+ /* Include the system headers _after_ the implied config.h!
26
+ Otherwise _FILE_OFFSET_BITS is not in effect! */
27
+ #include <errno.h>
28
+ #include <sys/stat.h>
29
+ #include <fcntl.h>
30
+ #include "compat.h"
31
+ #include "debug.h"
32
+
33
+ /*
34
+ Now, start off easy... translate simple API calls.
35
+ I need to deal with these here:
36
+ perl -ne '
37
+ if(/^\s*EXPORT\s+(\S+)\s+(mpg123_\S+)\((.*)\);\s*$/)
38
+ {
39
+ $type = $1;
40
+ $name = $2;
41
+ $args = $3;
42
+ next unless ($type =~ /off_t/ or $args =~ /off_t/);
43
+ print "$name\n" unless grep {$_ eq $name}
44
+ ("mpg123_open", "mpg123_open_fd", "mpg123_open_handle", "mpg123_replace_reader", "mpg123_replace_reader_handle");
45
+ }' < mpg123.h.in
46
+
47
+ mpg123_decode_frame
48
+ mpg123_framebyframe_decode
49
+ mpg123_framepos
50
+ mpg123_tell
51
+ mpg123_tellframe
52
+ mpg123_tell_stream
53
+ mpg123_seek
54
+ mpg123_feedseek
55
+ mpg123_seek_frame
56
+ mpg123_timeframe
57
+ mpg123_index
58
+ mpg123_set_index
59
+ mpg123_position
60
+ mpg123_length
61
+ mpg123_set_filesize
62
+ mpg123_decode_raw ... that's experimental.
63
+
64
+ Let's work on them in that order.
65
+ */
66
+
67
+ /* I see that I will need custom data storage. Main use is for the replaced I/O later, but the seek table for small file offsets needs extra storage, too. */
68
+
69
+ /* The wrapper handle for descriptor and handle I/O. */
70
+
71
+ /* The handle is used for nothing (0), or one of these two modes of operation: */
72
+ #define IO_FD 1 /* Wrapping over callbacks operation on integer file descriptor. */
73
+ #define IO_HANDLE 2 /* Wrapping over custom handle callbacks. */
74
+
75
+ struct wrap_data
76
+ {
77
+ /* Storage for small offset index table. */
78
+ long *indextable;
79
+ /* I/O handle stuff */
80
+ int iotype; /* IO_FD or IO_HANDLE */
81
+ /* Data for IO_FD. */
82
+ int fd;
83
+ int my_fd; /* A descriptor that the wrapper code opened itself. */
84
+ /* The actual callbacks from the outside. */
85
+ ssize_t (*r_read) (int, void *, size_t);
86
+ long (*r_lseek)(int, long, int);
87
+ /* Data for IO_HANDLE. */
88
+ void* handle;
89
+ ssize_t (*r_h_read)(void *, void *, size_t);
90
+ long (*r_h_lseek)(void*, long, int);
91
+ void (*h_cleanup)(void*);
92
+ };
93
+
94
+
95
+ /* Cleanup I/O part of the handle handle... but not deleting the wrapper handle itself.
96
+ That is stored in the frame and only deleted on mpg123_delete(). */
97
+ static void wrap_io_cleanup(void *handle)
98
+ {
99
+ struct wrap_data *ioh = handle;
100
+ if(ioh->iotype == IO_HANDLE)
101
+ {
102
+ if(ioh->h_cleanup != NULL && ioh->handle != NULL)
103
+ ioh->h_cleanup(ioh->handle);
104
+
105
+ ioh->handle = NULL;
106
+ }
107
+ if(ioh->my_fd >= 0)
108
+ {
109
+ close(ioh->my_fd);
110
+ ioh->my_fd = -1;
111
+ }
112
+ }
113
+
114
+ /* Really finish off the handle... freeing all memory. */
115
+ static void wrap_destroy(void *handle)
116
+ {
117
+ struct wrap_data *wh = handle;
118
+ wrap_io_cleanup(handle);
119
+ if(wh->indextable != NULL)
120
+ free(wh->indextable);
121
+
122
+ free(wh);
123
+ }
124
+
125
+ /* More helper code... extract the special wrapper handle, possible allocate and initialize it. */
126
+ static struct wrap_data* wrap_get(mpg123_handle *mh)
127
+ {
128
+ struct wrap_data* whd;
129
+ if(mh == NULL) return NULL;
130
+
131
+ /* Access the private storage inside the mpg123 handle.
132
+ The real callback functions and handles are stored there. */
133
+ if(mh->wrapperdata == NULL)
134
+ {
135
+ /* Create a new one. */
136
+ mh->wrapperdata = malloc(sizeof(struct wrap_data));
137
+ if(mh->wrapperdata == NULL)
138
+ {
139
+ mh->err = MPG123_OUT_OF_MEM;
140
+ return NULL;
141
+ }
142
+ /* When we have wrapper data present, the callback for its proper cleanup is needed. */
143
+ mh->wrapperclean = wrap_destroy;
144
+
145
+ whd = mh->wrapperdata;
146
+ whd->indextable = NULL;
147
+ whd->iotype = 0;
148
+ whd->fd = -1;
149
+ whd->my_fd = -1;
150
+ whd->r_read = NULL;
151
+ whd->r_lseek = NULL;
152
+ whd->handle = NULL;
153
+ whd->r_h_read = NULL;
154
+ whd->r_h_lseek = NULL;
155
+ whd->h_cleanup = NULL;
156
+ }
157
+ else whd = mh->wrapperdata;
158
+
159
+ return whd;
160
+ }
161
+
162
+ /* After settling the data... start with some simple wrappers. */
163
+
164
+ #undef mpg123_decode_frame
165
+ /* int mpg123_decode_frame(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes) */
166
+ int attribute_align_arg mpg123_decode_frame(mpg123_handle *mh, long *num, unsigned char **audio, size_t *bytes)
167
+ {
168
+ off_t largenum;
169
+ int err;
170
+
171
+ err = MPG123_LARGENAME(mpg123_decode_frame)(mh, &largenum, audio, bytes);
172
+ if(err == MPG123_OK && num != NULL)
173
+ {
174
+ *num = largenum;
175
+ if(*num != largenum)
176
+ {
177
+ mh->err = MPG123_LFS_OVERFLOW;
178
+ err = MPG123_ERR;
179
+ }
180
+ }
181
+ return err;
182
+ }
183
+
184
+ #undef mpg123_framebyframe_decode
185
+ /* int mpg123_framebyframe_decode(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes); */
186
+ int attribute_align_arg mpg123_framebyframe_decode(mpg123_handle *mh, long *num, unsigned char **audio, size_t *bytes)
187
+ {
188
+ off_t largenum;
189
+ int err;
190
+
191
+ err = MPG123_LARGENAME(mpg123_framebyframe_decode)(mh, &largenum, audio, bytes);
192
+ if(err == MPG123_OK && num != NULL)
193
+ {
194
+ *num = largenum;
195
+ if(*num != largenum)
196
+ {
197
+ mh->err = MPG123_LFS_OVERFLOW;
198
+ err = MPG123_ERR;
199
+ }
200
+ }
201
+ return err;
202
+ }
203
+
204
+ #undef mpg123_framepos
205
+ /* off_t mpg123_framepos(mpg123_handle *mh); */
206
+ long attribute_align_arg mpg123_framepos(mpg123_handle *mh)
207
+ {
208
+ long val;
209
+ off_t largeval;
210
+
211
+ largeval = MPG123_LARGENAME(mpg123_framepos)(mh);
212
+ val = largeval;
213
+ if(val != largeval)
214
+ {
215
+ mh->err = MPG123_LFS_OVERFLOW;
216
+ return MPG123_ERR;
217
+ }
218
+ return val;
219
+ }
220
+
221
+ #undef mpg123_tell
222
+ /* off_t mpg123_tell(mpg123_handle *mh); */
223
+ long attribute_align_arg mpg123_tell(mpg123_handle *mh)
224
+ {
225
+ long val;
226
+ off_t largeval;
227
+
228
+ largeval = MPG123_LARGENAME(mpg123_tell)(mh);
229
+ val = largeval;
230
+ if(val != largeval)
231
+ {
232
+ mh->err = MPG123_LFS_OVERFLOW;
233
+ return MPG123_ERR;
234
+ }
235
+ return val;
236
+ }
237
+
238
+ #undef mpg123_tellframe
239
+ /* off_t mpg123_tellframe(mpg123_handle *mh); */
240
+ long attribute_align_arg mpg123_tellframe(mpg123_handle *mh)
241
+ {
242
+ long val;
243
+ off_t largeval;
244
+
245
+ largeval = MPG123_LARGENAME(mpg123_tellframe)(mh);
246
+ val = largeval;
247
+ if(val != largeval)
248
+ {
249
+ mh->err = MPG123_LFS_OVERFLOW;
250
+ return MPG123_ERR;
251
+ }
252
+ return val;
253
+ }
254
+
255
+ #undef mpg123_tell_stream
256
+ /* off_t mpg123_tell_stream(mpg123_handle *mh); */
257
+ long attribute_align_arg mpg123_tell_stream(mpg123_handle *mh)
258
+ {
259
+ long val;
260
+ off_t largeval;
261
+
262
+ largeval = MPG123_LARGENAME(mpg123_tell_stream)(mh);
263
+ val = largeval;
264
+ if(val != largeval)
265
+ {
266
+ mh->err = MPG123_LFS_OVERFLOW;
267
+ return MPG123_ERR;
268
+ }
269
+ return val;
270
+ }
271
+
272
+ #undef mpg123_seek
273
+ /* off_t mpg123_seek(mpg123_handle *mh, off_t sampleoff, int whence); */
274
+ long attribute_align_arg mpg123_seek(mpg123_handle *mh, long sampleoff, int whence)
275
+ {
276
+ long val;
277
+ off_t largeval;
278
+
279
+ largeval = MPG123_LARGENAME(mpg123_seek)(mh, sampleoff, whence);
280
+ val = largeval;
281
+ if(val != largeval)
282
+ {
283
+ mh->err = MPG123_LFS_OVERFLOW;
284
+ return MPG123_ERR;
285
+ }
286
+ return val;
287
+ }
288
+
289
+ #undef mpg123_feedseek
290
+ /* off_t mpg123_feedseek(mpg123_handle *mh, off_t sampleoff, int whence, off_t *input_offset); */
291
+ long attribute_align_arg mpg123_feedseek(mpg123_handle *mh, long sampleoff, int whence, long *input_offset)
292
+ {
293
+ long val;
294
+ off_t largeioff;
295
+ off_t largeval;
296
+
297
+ largeval = MPG123_LARGENAME(mpg123_feedseek)(mh, sampleoff, whence, &largeioff);
298
+ /* Error/message codes are small... */
299
+ if(largeval < 0) return (long)largeval;
300
+
301
+ val = largeval;
302
+ *input_offset = largeioff;
303
+ if(val != largeval || *input_offset != largeioff)
304
+ {
305
+ mh->err = MPG123_LFS_OVERFLOW;
306
+ return MPG123_ERR;
307
+ }
308
+ return val;
309
+ }
310
+
311
+ #undef mpg123_seek_frame
312
+ /* off_t mpg123_seek_frame(mpg123_handle *mh, off_t frameoff, int whence); */
313
+ long attribute_align_arg mpg123_seek_frame(mpg123_handle *mh, long frameoff, int whence)
314
+ {
315
+ long val;
316
+ off_t largeval;
317
+
318
+ largeval = MPG123_LARGENAME(mpg123_seek_frame)(mh, frameoff, whence);
319
+ val = largeval;
320
+ if(val != largeval)
321
+ {
322
+ mh->err = MPG123_LFS_OVERFLOW;
323
+ return MPG123_ERR;
324
+ }
325
+ return val;
326
+ }
327
+
328
+ #undef mpg123_timeframe
329
+ /* off_t mpg123_timeframe(mpg123_handle *mh, double sec); */
330
+ long attribute_align_arg mpg123_timeframe(mpg123_handle *mh, double sec)
331
+ {
332
+ long val;
333
+ off_t largeval;
334
+
335
+ largeval = MPG123_LARGENAME(mpg123_timeframe)(mh, sec);
336
+ val = largeval;
337
+ if(val != largeval)
338
+ {
339
+ mh->err = MPG123_LFS_OVERFLOW;
340
+ return MPG123_ERR;
341
+ }
342
+ return val;
343
+ }
344
+
345
+ /* Now something less simple: Index retrieval and manipulation.
346
+ The index is an _array_ of off_t, which means that I need to construct a copy with translated long values. */
347
+ #undef mpg123_index
348
+ /* int mpg123_index(mpg123_handle *mh, off_t **offsets, off_t *step, size_t *fill) */
349
+ int attribute_align_arg mpg123_index(mpg123_handle *mh, long **offsets, long *step, size_t *fill)
350
+ {
351
+ int err;
352
+ size_t i;
353
+ long smallstep;
354
+ size_t thefill;
355
+ off_t largestep;
356
+ off_t *largeoffsets;
357
+ struct wrap_data *whd;
358
+
359
+ whd = wrap_get(mh);
360
+ if(whd == NULL) return MPG123_ERR;
361
+
362
+ err = MPG123_LARGENAME(mpg123_index)(mh, &largeoffsets, &largestep, &thefill);
363
+ if(err != MPG123_OK) return err;
364
+
365
+ /* For a _very_ large file, even the step could overflow. */
366
+ smallstep = largestep;
367
+ if(smallstep != largestep)
368
+ {
369
+ mh->err = MPG123_LFS_OVERFLOW;
370
+ return MPG123_ERR;
371
+ }
372
+ if(step != NULL) *step = smallstep;
373
+
374
+ /* When there are no values stored, there is no table content to take care of.
375
+ Table pointer does not matter. Mission completed. */
376
+ if(thefill == 0) return MPG123_OK;
377
+
378
+ if(fill != NULL) *fill = thefill;
379
+
380
+ /* Construct a copy of the index to hand over to the small-minded client. */
381
+ *offsets = safe_realloc(whd->indextable, (*fill)*sizeof(long));
382
+ if(*offsets == NULL)
383
+ {
384
+ mh->err = MPG123_OUT_OF_MEM;
385
+ return MPG123_ERR;
386
+ }
387
+ whd->indextable = *offsets;
388
+ /* Elaborate conversion of each index value, with overflow check. */
389
+ for(i=0; i<*fill; ++i)
390
+ {
391
+ whd->indextable[i] = largeoffsets[i];
392
+ if(whd->indextable[i] != largeoffsets[i])
393
+ {
394
+ mh->err = MPG123_LFS_OVERFLOW;
395
+ return MPG123_ERR;
396
+ }
397
+ }
398
+ /* If we came that far... there should be a valid copy of the table now. */
399
+ return MPG123_OK;
400
+ }
401
+
402
+ /* The writing does basically the same than the above, just the opposite.
403
+ Oh, and the overflow checks are not needed -- off_t is bigger than long. */
404
+ #undef mpg123_set_index
405
+ /* int mpg123_set_index(mpg123_handle *mh, off_t *offsets, off_t step, size_t fill); */
406
+ int attribute_align_arg mpg123_set_index(mpg123_handle *mh, long *offsets, long step, size_t fill)
407
+ {
408
+ int err;
409
+ size_t i;
410
+ struct wrap_data *whd;
411
+ off_t *indextmp;
412
+
413
+ whd = wrap_get(mh);
414
+ if(whd == NULL) return MPG123_ERR;
415
+
416
+ /* Expensive temporary storage... for staying outside at the API layer. */
417
+ indextmp = malloc(fill*sizeof(off_t));
418
+ if(indextmp == NULL)
419
+ {
420
+ mh->err = MPG123_OUT_OF_MEM;
421
+ return MPG123_ERR;
422
+ }
423
+
424
+ if(fill > 0 && offsets == NULL)
425
+ {
426
+ mh->err = MPG123_BAD_INDEX_PAR;
427
+ err = MPG123_ERR;
428
+ }
429
+ else
430
+ {
431
+ /* Fill the large-file copy of the provided index, then feed it to mpg123. */
432
+ for(i=0; i<fill; ++i)
433
+ indextmp[i] = offsets[i];
434
+
435
+ err = MPG123_LARGENAME(mpg123_set_index)(mh, indextmp, step, fill);
436
+ }
437
+ free(indextmp);
438
+
439
+ return err;
440
+ }
441
+
442
+ /* So... breathe... a couple of simple wrappers before the big mess. */
443
+ #undef mpg123_position
444
+ /* int mpg123_position( mpg123_handle *mh, off_t frame_offset, off_t buffered_bytes, off_t *current_frame, off_t *frames_left, double *current_seconds, double *seconds_left); */
445
+ int attribute_align_arg mpg123_position(mpg123_handle *mh, long frame_offset, long buffered_bytes, long *current_frame, long *frames_left, double *current_seconds, double *seconds_left)
446
+ {
447
+ off_t curframe, frameleft;
448
+ long small_curframe, small_frameleft;
449
+ int err;
450
+
451
+ err = MPG123_LARGENAME(mpg123_position)(mh, frame_offset, buffered_bytes, &curframe, &frameleft, current_seconds, seconds_left);
452
+ if(err != MPG123_OK) return err;
453
+
454
+ small_curframe = curframe;
455
+ small_frameleft = frameleft;
456
+ if(small_curframe != curframe || small_frameleft != frameleft)
457
+ {
458
+ mh->err = MPG123_LFS_OVERFLOW;
459
+ return MPG123_ERR;
460
+ }
461
+
462
+ if(current_frame != NULL) *current_frame = small_curframe;
463
+
464
+ if(frames_left != NULL) *frames_left = small_frameleft;
465
+
466
+
467
+ return MPG123_OK;
468
+ }
469
+
470
+ #undef mpg123_length
471
+ /* off_t mpg123_length(mpg123_handle *mh); */
472
+ long attribute_align_arg mpg123_length(mpg123_handle *mh)
473
+ {
474
+ long val;
475
+ off_t largeval;
476
+
477
+ largeval = MPG123_LARGENAME(mpg123_length)(mh);
478
+ val = largeval;
479
+ if(val != largeval)
480
+ {
481
+ mh->err = MPG123_LFS_OVERFLOW;
482
+ return MPG123_ERR;
483
+ }
484
+ return val;
485
+ }
486
+
487
+ /* The simplest wrapper of all... */
488
+ #undef mpg123_set_filesize
489
+ /* int mpg123_set_filesize(mpg123_handle *mh, off_t size); */
490
+ int attribute_align_arg mpg123_set_filesize(mpg123_handle *mh, long size)
491
+ {
492
+ return MPG123_LARGENAME(mpg123_set_filesize)(mh, size);
493
+ }
494
+
495
+
496
+ /* =========================================
497
+ THE BOUNDARY OF SANITY
498
+ Behold, stranger!
499
+ ========================================= */
500
+
501
+
502
+ /*
503
+ The messy part: Replacement of I/O core (actally, this is only due to lseek()).
504
+ Both descriptor and handle replaced I/O are mapped to replaced handle I/O, the handle wrapping over the actual callbacks and the actual handle/descriptor.
505
+ You got multiple levels of handles and callbacks to think about. Have fun reading and comprehending.
506
+ */
507
+
508
+ /* Could go into compat.h ... Windows needs that flag. */
509
+ #ifndef O_BINARY
510
+ #define O_BINARY 0
511
+ #endif
512
+
513
+ /* Read callback needs nothing special. */
514
+ ssize_t wrap_read(void* handle, void *buf, size_t count)
515
+ {
516
+ struct wrap_data *ioh = handle;
517
+ switch(ioh->iotype)
518
+ {
519
+ case IO_FD: return ioh->r_read(ioh->fd, buf, count);
520
+ case IO_HANDLE: return ioh->r_h_read(ioh->handle, buf, count);
521
+ }
522
+ error("Serious breakage - bad IO type in LFS wrapper!");
523
+ return -1;
524
+ }
525
+
526
+ /* Seek callback needs protection from too big offsets. */
527
+ off_t wrap_lseek(void *handle, off_t offset, int whence)
528
+ {
529
+ struct wrap_data *ioh = handle;
530
+ long smalloff = offset;
531
+ if(smalloff == offset)
532
+ {
533
+ switch(ioh->iotype)
534
+ {
535
+ case IO_FD: return ioh->r_lseek(ioh->fd, smalloff, whence);
536
+ case IO_HANDLE: return ioh->r_h_lseek(ioh->handle, smalloff, whence);
537
+ }
538
+ error("Serious breakage - bad IO type in LFS wrapper!");
539
+ return -1;
540
+ }
541
+ else
542
+ {
543
+ errno = EOVERFLOW;
544
+ return -1;
545
+ }
546
+ }
547
+
548
+
549
+ /*
550
+ Now, let's replace the API dealing with replacement I/O.
551
+ Start with undefining the renames...
552
+ */
553
+
554
+ #undef mpg123_replace_reader
555
+ #undef mpg123_replace_reader_handle
556
+ #undef mpg123_open
557
+ #undef mpg123_open_fd
558
+ #undef mpg123_open_handle
559
+
560
+
561
+ /* Normal reader replacement needs fallback implementations. */
562
+ static ssize_t fallback_read(int fd, void *buf, size_t count)
563
+ {
564
+ return read(fd, buf, count);
565
+ }
566
+
567
+ static long fallback_lseek(int fd, long offset, int whence)
568
+ {
569
+ /* Since the offset is long int already, the returned value really should fit into a long... but whatever. */
570
+ long newpos_long;
571
+ off_t newpos;
572
+ newpos = lseek(fd, offset, whence);
573
+ newpos_long = newpos;
574
+ if(newpos_long == newpos)
575
+ return newpos_long;
576
+ else
577
+ {
578
+ errno = EOVERFLOW;
579
+ return -1;
580
+ }
581
+ }
582
+
583
+ /* Reader replacement prepares the hidden handle storage for next mpg123_open_fd() or plain mpg123_open(). */
584
+ int attribute_align_arg mpg123_replace_reader(mpg123_handle *mh, ssize_t (*r_read) (int, void *, size_t), long (*r_lseek)(int, long, int) )
585
+ {
586
+ struct wrap_data* ioh;
587
+
588
+ if(mh == NULL) return MPG123_ERR;
589
+
590
+ mpg123_close(mh);
591
+ ioh = wrap_get(mh);
592
+ if(ioh == NULL) return MPG123_ERR;
593
+
594
+ /* If both callbacks are NULL, switch totally to internal I/O, else just use fallback for at most half of them. */
595
+ if(r_read == NULL && r_lseek == NULL)
596
+ {
597
+ /* Only the type is actually important to disable the code. */
598
+ ioh->iotype = 0;
599
+ ioh->fd = -1;
600
+ ioh->r_read = NULL;
601
+ ioh->r_lseek = NULL;
602
+ }
603
+ else
604
+ {
605
+ ioh->iotype = IO_FD;
606
+ ioh->fd = -1; /* On next mpg123_open_fd(), this gets a value. */
607
+ ioh->r_read = r_read != NULL ? r_read : fallback_read;
608
+ ioh->r_lseek = r_lseek != NULL ? r_lseek : fallback_lseek;
609
+ }
610
+
611
+ /* The real reader replacement will happen while opening. */
612
+ return MPG123_OK;
613
+ }
614
+
615
+ int attribute_align_arg mpg123_replace_reader_handle(mpg123_handle *mh, ssize_t (*r_read) (void*, void *, size_t), long (*r_lseek)(void*, long, int), void (*cleanup)(void*))
616
+ {
617
+ struct wrap_data* ioh;
618
+
619
+ if(mh == NULL) return MPG123_ERR;
620
+
621
+ mpg123_close(mh);
622
+ ioh = wrap_get(mh);
623
+ if(ioh == NULL) return MPG123_ERR;
624
+
625
+ ioh->iotype = IO_HANDLE;
626
+ ioh->handle = NULL;
627
+ ioh->r_h_read = r_read;
628
+ ioh->r_h_lseek = r_lseek;
629
+ ioh->h_cleanup = cleanup;
630
+
631
+ /* The real reader replacement will happen while opening. */
632
+ return MPG123_OK;
633
+ }
634
+
635
+ /*
636
+ The open routines always need to watch out for a prepared wrapper handle to use replaced normal I/O.
637
+ Two cases to consider:
638
+ 1. Plain normal open using internal I/O.
639
+ 2. Client called mpg123_replace_reader() before.
640
+ The second case needs hackery to activate the client I/O callbacks. For that, we create a custom I/O handle and use the guts of mpg123_open_fd() on it.
641
+ */
642
+ int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path)
643
+ {
644
+ struct wrap_data* ioh;
645
+
646
+ if(mh == NULL) return MPG123_ERR;
647
+
648
+ ioh = mh->wrapperdata;
649
+ /* Mimic the use of mpg123_replace_reader() functions by lower levels...
650
+ IO_HANDLE is not valid here, though. Only IO_FD. */
651
+ if(ioh != NULL && ioh->iotype == IO_FD)
652
+ {
653
+ int err;
654
+ err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup);
655
+ if(err != MPG123_OK) return MPG123_ERR;
656
+
657
+ /* The above call implied mpg123_close() already */
658
+ /*
659
+ I really need to open the file here... to be able to use the replacer handle I/O ...
660
+ my_fd is used to indicate closing of the descriptor on cleanup.
661
+ */
662
+ ioh->my_fd = compat_open(path, O_RDONLY|O_BINARY);
663
+ if(ioh->my_fd < 0)
664
+ {
665
+ if(!(mh->p.flags & MPG123_QUIET)) error2("Cannot open file %s: %s", path, strerror(errno));
666
+
667
+ mh->err = MPG123_BAD_FILE;
668
+ return MPG123_ERR;
669
+ }
670
+ /* Store a copy of the descriptor where it is actually used. */
671
+ ioh->fd = ioh->my_fd;
672
+ /* Initiate I/O operating on my handle now. */
673
+ err = open_stream_handle(mh, ioh);
674
+ if(err != MPG123_OK)
675
+ {
676
+ wrap_io_cleanup(ioh);
677
+ return MPG123_ERR;
678
+ }
679
+ /* All fine... */
680
+ return MPG123_OK;
681
+ }
682
+ else return MPG123_LARGENAME(mpg123_open)(mh, path);
683
+ }
684
+
685
+ /*
686
+ This is in fact very similar to the above:
687
+ The open routines always need to watch out for a prepared wrapper handle to use replaced normal I/O.
688
+ Two cases to consider:
689
+ 1. Plain normal open_fd using internal I/O.
690
+ 2. Client called mpg123_replace_reader() before.
691
+ The second case needs hackery to activate the client I/O callbacks. For that, we create a custom I/O handle and use the guts of mpg123_open_fd() on it.
692
+ */
693
+
694
+ int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd)
695
+ {
696
+ struct wrap_data* ioh;
697
+
698
+ if(mh == NULL) return MPG123_ERR;
699
+
700
+ mpg123_close(mh);
701
+ ioh = mh->wrapperdata;
702
+ if(ioh != NULL && ioh->iotype == IO_FD)
703
+ {
704
+ int err;
705
+ err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup);
706
+ if(err != MPG123_OK) return MPG123_ERR;
707
+
708
+ /* The above call implied mpg123_close() already */
709
+
710
+ /* Store the real file descriptor inside the handle. */
711
+ ioh->fd = fd;
712
+ /* Initiate I/O operating on my handle now. */
713
+ err = open_stream_handle(mh, ioh);
714
+ if(err != MPG123_OK)
715
+ {
716
+ wrap_io_cleanup(ioh);
717
+ return MPG123_ERR;
718
+ }
719
+ /* All fine... */
720
+ return MPG123_OK;
721
+ }
722
+ else return MPG123_LARGENAME(mpg123_open_fd)(mh, fd);
723
+ }
724
+
725
+ int attribute_align_arg mpg123_open_handle(mpg123_handle *mh, void *handle)
726
+ {
727
+ struct wrap_data* ioh;
728
+
729
+ if(mh == NULL) return MPG123_ERR;
730
+
731
+ mpg123_close(mh);
732
+ ioh = mh->wrapperdata;
733
+ if(ioh != NULL && ioh->iotype == IO_HANDLE && ioh->r_h_read != NULL)
734
+ {
735
+ /* Wrap the custom handle into my handle. */
736
+ int err;
737
+ err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup);
738
+ if(err != MPG123_OK) return MPG123_ERR;
739
+
740
+ ioh->handle = handle;
741
+ /* No extra error handling, keep behaviour of the original open_handle. */
742
+ return open_stream_handle(mh, ioh);
743
+ }
744
+ else
745
+ {
746
+ /* This is an error ... you need to prepare the I/O before using it. */
747
+ mh->err = MPG123_BAD_CUSTOM_IO;
748
+ return MPG123_ERR;
749
+ }
750
+ }
751
+