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,58 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC 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-2009 *
9
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
10
+ * *
11
+ ********************************************************************
12
+
13
+ function: highlevel encoder setup struct separated out for vorbisenc clarity
14
+ last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $
15
+
16
+ ********************************************************************/
17
+
18
+ typedef struct highlevel_byblocktype {
19
+ double tone_mask_setting;
20
+ double tone_peaklimit_setting;
21
+ double noise_bias_setting;
22
+ double noise_compand_setting;
23
+ } highlevel_byblocktype;
24
+
25
+ typedef struct highlevel_encode_setup {
26
+ int set_in_stone;
27
+ const void *setup;
28
+ double base_setting;
29
+
30
+ double impulse_noisetune;
31
+
32
+ /* bitrate management below all settable */
33
+ float req;
34
+ int managed;
35
+ long bitrate_min;
36
+ long bitrate_av;
37
+ double bitrate_av_damp;
38
+ long bitrate_max;
39
+ long bitrate_reservoir;
40
+ double bitrate_reservoir_bias;
41
+
42
+ int impulse_block_p;
43
+ int noise_normalize_p;
44
+ int coupling_p;
45
+
46
+ double stereo_point_setting;
47
+ double lowpass_kHz;
48
+ int lowpass_altered;
49
+
50
+ double ath_floating_dB;
51
+ double ath_absolute_dB;
52
+
53
+ double amplitude_track_dBpersec;
54
+ double trigger_setting;
55
+
56
+ highlevel_byblocktype block[4]; /* padding, impulse, transition, long */
57
+
58
+ } highlevel_encode_setup;
@@ -0,0 +1,668 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC 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: maintain the info structure, info <-> header packets
14
+ last mod: $Id: info.c 18186 2012-02-03 22:08:44Z xiphmont $
15
+
16
+ ********************************************************************/
17
+
18
+ /* general handling of the header and the vorbis_info structure (and
19
+ substructures) */
20
+
21
+ #include <stdlib.h>
22
+ #include <string.h>
23
+ #include <ctype.h>
24
+ #include <ogg/ogg.h>
25
+ #include "vorbis/codec.h"
26
+ #include "codec_internal.h"
27
+ #include "codebook.h"
28
+ #include "registry.h"
29
+ #include "window.h"
30
+ #include "psy.h"
31
+ #include "misc.h"
32
+ #include "os.h"
33
+
34
+ #define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.3"
35
+ #define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20120203 (Omnipresent)"
36
+
37
+ /* helpers */
38
+ static int ilog2(unsigned int v){
39
+ int ret=0;
40
+ if(v)--v;
41
+ while(v){
42
+ ret++;
43
+ v>>=1;
44
+ }
45
+ return(ret);
46
+ }
47
+
48
+ static void _v_writestring(oggpack_buffer *o,const char *s, int bytes){
49
+
50
+ while(bytes--){
51
+ oggpack_write(o,*s++,8);
52
+ }
53
+ }
54
+
55
+ static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){
56
+ while(bytes--){
57
+ *buf++=oggpack_read(o,8);
58
+ }
59
+ }
60
+
61
+ void vorbis_comment_init(vorbis_comment *vc){
62
+ memset(vc,0,sizeof(*vc));
63
+ }
64
+
65
+ void vorbis_comment_add(vorbis_comment *vc,const char *comment){
66
+ vc->user_comments=_ogg_realloc(vc->user_comments,
67
+ (vc->comments+2)*sizeof(*vc->user_comments));
68
+ vc->comment_lengths=_ogg_realloc(vc->comment_lengths,
69
+ (vc->comments+2)*sizeof(*vc->comment_lengths));
70
+ vc->comment_lengths[vc->comments]=strlen(comment);
71
+ vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1);
72
+ strcpy(vc->user_comments[vc->comments], comment);
73
+ vc->comments++;
74
+ vc->user_comments[vc->comments]=NULL;
75
+ }
76
+
77
+ void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents){
78
+ char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */
79
+ strcpy(comment, tag);
80
+ strcat(comment, "=");
81
+ strcat(comment, contents);
82
+ vorbis_comment_add(vc, comment);
83
+ }
84
+
85
+ /* This is more or less the same as strncasecmp - but that doesn't exist
86
+ * everywhere, and this is a fairly trivial function, so we include it */
87
+ static int tagcompare(const char *s1, const char *s2, int n){
88
+ int c=0;
89
+ while(c < n){
90
+ if(toupper(s1[c]) != toupper(s2[c]))
91
+ return !0;
92
+ c++;
93
+ }
94
+ return 0;
95
+ }
96
+
97
+ char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count){
98
+ long i;
99
+ int found = 0;
100
+ int taglen = strlen(tag)+1; /* +1 for the = we append */
101
+ char *fulltag = alloca(taglen+ 1);
102
+
103
+ strcpy(fulltag, tag);
104
+ strcat(fulltag, "=");
105
+
106
+ for(i=0;i<vc->comments;i++){
107
+ if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
108
+ if(count == found)
109
+ /* We return a pointer to the data, not a copy */
110
+ return vc->user_comments[i] + taglen;
111
+ else
112
+ found++;
113
+ }
114
+ }
115
+ return NULL; /* didn't find anything */
116
+ }
117
+
118
+ int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){
119
+ int i,count=0;
120
+ int taglen = strlen(tag)+1; /* +1 for the = we append */
121
+ char *fulltag = alloca(taglen+1);
122
+ strcpy(fulltag,tag);
123
+ strcat(fulltag, "=");
124
+
125
+ for(i=0;i<vc->comments;i++){
126
+ if(!tagcompare(vc->user_comments[i], fulltag, taglen))
127
+ count++;
128
+ }
129
+
130
+ return count;
131
+ }
132
+
133
+ void vorbis_comment_clear(vorbis_comment *vc){
134
+ if(vc){
135
+ long i;
136
+ if(vc->user_comments){
137
+ for(i=0;i<vc->comments;i++)
138
+ if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
139
+ _ogg_free(vc->user_comments);
140
+ }
141
+ if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
142
+ if(vc->vendor)_ogg_free(vc->vendor);
143
+ memset(vc,0,sizeof(*vc));
144
+ }
145
+ }
146
+
147
+ /* blocksize 0 is guaranteed to be short, 1 is guaranteed to be long.
148
+ They may be equal, but short will never ge greater than long */
149
+ int vorbis_info_blocksize(vorbis_info *vi,int zo){
150
+ codec_setup_info *ci = vi->codec_setup;
151
+ return ci ? ci->blocksizes[zo] : -1;
152
+ }
153
+
154
+ /* used by synthesis, which has a full, alloced vi */
155
+ void vorbis_info_init(vorbis_info *vi){
156
+ memset(vi,0,sizeof(*vi));
157
+ vi->codec_setup=_ogg_calloc(1,sizeof(codec_setup_info));
158
+ }
159
+
160
+ void vorbis_info_clear(vorbis_info *vi){
161
+ codec_setup_info *ci=vi->codec_setup;
162
+ int i;
163
+
164
+ if(ci){
165
+
166
+ for(i=0;i<ci->modes;i++)
167
+ if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
168
+
169
+ for(i=0;i<ci->maps;i++) /* unpack does the range checking */
170
+ if(ci->map_param[i]) /* this may be cleaning up an aborted
171
+ unpack, in which case the below type
172
+ cannot be trusted */
173
+ _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
174
+
175
+ for(i=0;i<ci->floors;i++) /* unpack does the range checking */
176
+ if(ci->floor_param[i]) /* this may be cleaning up an aborted
177
+ unpack, in which case the below type
178
+ cannot be trusted */
179
+ _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
180
+
181
+ for(i=0;i<ci->residues;i++) /* unpack does the range checking */
182
+ if(ci->residue_param[i]) /* this may be cleaning up an aborted
183
+ unpack, in which case the below type
184
+ cannot be trusted */
185
+ _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
186
+
187
+ for(i=0;i<ci->books;i++){
188
+ if(ci->book_param[i]){
189
+ /* knows if the book was not alloced */
190
+ vorbis_staticbook_destroy(ci->book_param[i]);
191
+ }
192
+ if(ci->fullbooks)
193
+ vorbis_book_clear(ci->fullbooks+i);
194
+ }
195
+ if(ci->fullbooks)
196
+ _ogg_free(ci->fullbooks);
197
+
198
+ for(i=0;i<ci->psys;i++)
199
+ _vi_psy_free(ci->psy_param[i]);
200
+
201
+ _ogg_free(ci);
202
+ }
203
+
204
+ memset(vi,0,sizeof(*vi));
205
+ }
206
+
207
+ /* Header packing/unpacking ********************************************/
208
+
209
+ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
210
+ codec_setup_info *ci=vi->codec_setup;
211
+ if(!ci)return(OV_EFAULT);
212
+
213
+ vi->version=oggpack_read(opb,32);
214
+ if(vi->version!=0)return(OV_EVERSION);
215
+
216
+ vi->channels=oggpack_read(opb,8);
217
+ vi->rate=oggpack_read(opb,32);
218
+
219
+ vi->bitrate_upper=oggpack_read(opb,32);
220
+ vi->bitrate_nominal=oggpack_read(opb,32);
221
+ vi->bitrate_lower=oggpack_read(opb,32);
222
+
223
+ ci->blocksizes[0]=1<<oggpack_read(opb,4);
224
+ ci->blocksizes[1]=1<<oggpack_read(opb,4);
225
+
226
+ if(vi->rate<1)goto err_out;
227
+ if(vi->channels<1)goto err_out;
228
+ if(ci->blocksizes[0]<64)goto err_out;
229
+ if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
230
+ if(ci->blocksizes[1]>8192)goto err_out;
231
+
232
+ if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
233
+
234
+ return(0);
235
+ err_out:
236
+ vorbis_info_clear(vi);
237
+ return(OV_EBADHEADER);
238
+ }
239
+
240
+ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
241
+ int i;
242
+ int vendorlen=oggpack_read(opb,32);
243
+ if(vendorlen<0)goto err_out;
244
+ if(vendorlen>opb->storage-8)goto err_out;
245
+ vc->vendor=_ogg_calloc(vendorlen+1,1);
246
+ _v_readstring(opb,vc->vendor,vendorlen);
247
+ i=oggpack_read(opb,32);
248
+ if(i<0)goto err_out;
249
+ if(i>((opb->storage-oggpack_bytes(opb))>>2))goto err_out;
250
+ vc->comments=i;
251
+ vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
252
+ vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
253
+
254
+ for(i=0;i<vc->comments;i++){
255
+ int len=oggpack_read(opb,32);
256
+ if(len<0)goto err_out;
257
+ if(len>opb->storage-oggpack_bytes(opb))goto err_out;
258
+ vc->comment_lengths[i]=len;
259
+ vc->user_comments[i]=_ogg_calloc(len+1,1);
260
+ _v_readstring(opb,vc->user_comments[i],len);
261
+ }
262
+ if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
263
+
264
+ return(0);
265
+ err_out:
266
+ vorbis_comment_clear(vc);
267
+ return(OV_EBADHEADER);
268
+ }
269
+
270
+ /* all of the real encoding details are here. The modes, books,
271
+ everything */
272
+ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
273
+ codec_setup_info *ci=vi->codec_setup;
274
+ int i;
275
+ if(!ci)return(OV_EFAULT);
276
+
277
+ /* codebooks */
278
+ ci->books=oggpack_read(opb,8)+1;
279
+ if(ci->books<=0)goto err_out;
280
+ for(i=0;i<ci->books;i++){
281
+ ci->book_param[i]=vorbis_staticbook_unpack(opb);
282
+ if(!ci->book_param[i])goto err_out;
283
+ }
284
+
285
+ /* time backend settings; hooks are unused */
286
+ {
287
+ int times=oggpack_read(opb,6)+1;
288
+ if(times<=0)goto err_out;
289
+ for(i=0;i<times;i++){
290
+ int test=oggpack_read(opb,16);
291
+ if(test<0 || test>=VI_TIMEB)goto err_out;
292
+ }
293
+ }
294
+
295
+ /* floor backend settings */
296
+ ci->floors=oggpack_read(opb,6)+1;
297
+ if(ci->floors<=0)goto err_out;
298
+ for(i=0;i<ci->floors;i++){
299
+ ci->floor_type[i]=oggpack_read(opb,16);
300
+ if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
301
+ ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb);
302
+ if(!ci->floor_param[i])goto err_out;
303
+ }
304
+
305
+ /* residue backend settings */
306
+ ci->residues=oggpack_read(opb,6)+1;
307
+ if(ci->residues<=0)goto err_out;
308
+ for(i=0;i<ci->residues;i++){
309
+ ci->residue_type[i]=oggpack_read(opb,16);
310
+ if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
311
+ ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb);
312
+ if(!ci->residue_param[i])goto err_out;
313
+ }
314
+
315
+ /* map backend settings */
316
+ ci->maps=oggpack_read(opb,6)+1;
317
+ if(ci->maps<=0)goto err_out;
318
+ for(i=0;i<ci->maps;i++){
319
+ ci->map_type[i]=oggpack_read(opb,16);
320
+ if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
321
+ ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
322
+ if(!ci->map_param[i])goto err_out;
323
+ }
324
+
325
+ /* mode settings */
326
+ ci->modes=oggpack_read(opb,6)+1;
327
+ if(ci->modes<=0)goto err_out;
328
+ for(i=0;i<ci->modes;i++){
329
+ ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i]));
330
+ ci->mode_param[i]->blockflag=oggpack_read(opb,1);
331
+ ci->mode_param[i]->windowtype=oggpack_read(opb,16);
332
+ ci->mode_param[i]->transformtype=oggpack_read(opb,16);
333
+ ci->mode_param[i]->mapping=oggpack_read(opb,8);
334
+
335
+ if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
336
+ if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
337
+ if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
338
+ if(ci->mode_param[i]->mapping<0)goto err_out;
339
+ }
340
+
341
+ if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
342
+
343
+ return(0);
344
+ err_out:
345
+ vorbis_info_clear(vi);
346
+ return(OV_EBADHEADER);
347
+ }
348
+
349
+ /* Is this packet a vorbis ID header? */
350
+ int vorbis_synthesis_idheader(ogg_packet *op){
351
+ oggpack_buffer opb;
352
+ char buffer[6];
353
+
354
+ if(op){
355
+ oggpack_readinit(&opb,op->packet,op->bytes);
356
+
357
+ if(!op->b_o_s)
358
+ return(0); /* Not the initial packet */
359
+
360
+ if(oggpack_read(&opb,8) != 1)
361
+ return 0; /* not an ID header */
362
+
363
+ memset(buffer,0,6);
364
+ _v_readstring(&opb,buffer,6);
365
+ if(memcmp(buffer,"vorbis",6))
366
+ return 0; /* not vorbis */
367
+
368
+ return 1;
369
+ }
370
+
371
+ return 0;
372
+ }
373
+
374
+ /* The Vorbis header is in three packets; the initial small packet in
375
+ the first page that identifies basic parameters, a second packet
376
+ with bitstream comments and a third packet that holds the
377
+ codebook. */
378
+
379
+ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
380
+ oggpack_buffer opb;
381
+
382
+ if(op){
383
+ oggpack_readinit(&opb,op->packet,op->bytes);
384
+
385
+ /* Which of the three types of header is this? */
386
+ /* Also verify header-ness, vorbis */
387
+ {
388
+ char buffer[6];
389
+ int packtype=oggpack_read(&opb,8);
390
+ memset(buffer,0,6);
391
+ _v_readstring(&opb,buffer,6);
392
+ if(memcmp(buffer,"vorbis",6)){
393
+ /* not a vorbis header */
394
+ return(OV_ENOTVORBIS);
395
+ }
396
+ switch(packtype){
397
+ case 0x01: /* least significant *bit* is read first */
398
+ if(!op->b_o_s){
399
+ /* Not the initial packet */
400
+ return(OV_EBADHEADER);
401
+ }
402
+ if(vi->rate!=0){
403
+ /* previously initialized info header */
404
+ return(OV_EBADHEADER);
405
+ }
406
+
407
+ return(_vorbis_unpack_info(vi,&opb));
408
+
409
+ case 0x03: /* least significant *bit* is read first */
410
+ if(vi->rate==0){
411
+ /* um... we didn't get the initial header */
412
+ return(OV_EBADHEADER);
413
+ }
414
+
415
+ return(_vorbis_unpack_comment(vc,&opb));
416
+
417
+ case 0x05: /* least significant *bit* is read first */
418
+ if(vi->rate==0 || vc->vendor==NULL){
419
+ /* um... we didn;t get the initial header or comments yet */
420
+ return(OV_EBADHEADER);
421
+ }
422
+
423
+ return(_vorbis_unpack_books(vi,&opb));
424
+
425
+ default:
426
+ /* Not a valid vorbis header type */
427
+ return(OV_EBADHEADER);
428
+ break;
429
+ }
430
+ }
431
+ }
432
+ return(OV_EBADHEADER);
433
+ }
434
+
435
+ /* pack side **********************************************************/
436
+
437
+ static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
438
+ codec_setup_info *ci=vi->codec_setup;
439
+ if(!ci)return(OV_EFAULT);
440
+
441
+ /* preamble */
442
+ oggpack_write(opb,0x01,8);
443
+ _v_writestring(opb,"vorbis", 6);
444
+
445
+ /* basic information about the stream */
446
+ oggpack_write(opb,0x00,32);
447
+ oggpack_write(opb,vi->channels,8);
448
+ oggpack_write(opb,vi->rate,32);
449
+
450
+ oggpack_write(opb,vi->bitrate_upper,32);
451
+ oggpack_write(opb,vi->bitrate_nominal,32);
452
+ oggpack_write(opb,vi->bitrate_lower,32);
453
+
454
+ oggpack_write(opb,ilog2(ci->blocksizes[0]),4);
455
+ oggpack_write(opb,ilog2(ci->blocksizes[1]),4);
456
+ oggpack_write(opb,1,1);
457
+
458
+ return(0);
459
+ }
460
+
461
+ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
462
+ int bytes = strlen(ENCODE_VENDOR_STRING);
463
+
464
+ /* preamble */
465
+ oggpack_write(opb,0x03,8);
466
+ _v_writestring(opb,"vorbis", 6);
467
+
468
+ /* vendor */
469
+ oggpack_write(opb,bytes,32);
470
+ _v_writestring(opb,ENCODE_VENDOR_STRING, bytes);
471
+
472
+ /* comments */
473
+
474
+ oggpack_write(opb,vc->comments,32);
475
+ if(vc->comments){
476
+ int i;
477
+ for(i=0;i<vc->comments;i++){
478
+ if(vc->user_comments[i]){
479
+ oggpack_write(opb,vc->comment_lengths[i],32);
480
+ _v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]);
481
+ }else{
482
+ oggpack_write(opb,0,32);
483
+ }
484
+ }
485
+ }
486
+ oggpack_write(opb,1,1);
487
+
488
+ return(0);
489
+ }
490
+
491
+ static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){
492
+ codec_setup_info *ci=vi->codec_setup;
493
+ int i;
494
+ if(!ci)return(OV_EFAULT);
495
+
496
+ oggpack_write(opb,0x05,8);
497
+ _v_writestring(opb,"vorbis", 6);
498
+
499
+ /* books */
500
+ oggpack_write(opb,ci->books-1,8);
501
+ for(i=0;i<ci->books;i++)
502
+ if(vorbis_staticbook_pack(ci->book_param[i],opb))goto err_out;
503
+
504
+ /* times; hook placeholders */
505
+ oggpack_write(opb,0,6);
506
+ oggpack_write(opb,0,16);
507
+
508
+ /* floors */
509
+ oggpack_write(opb,ci->floors-1,6);
510
+ for(i=0;i<ci->floors;i++){
511
+ oggpack_write(opb,ci->floor_type[i],16);
512
+ if(_floor_P[ci->floor_type[i]]->pack)
513
+ _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i],opb);
514
+ else
515
+ goto err_out;
516
+ }
517
+
518
+ /* residues */
519
+ oggpack_write(opb,ci->residues-1,6);
520
+ for(i=0;i<ci->residues;i++){
521
+ oggpack_write(opb,ci->residue_type[i],16);
522
+ _residue_P[ci->residue_type[i]]->pack(ci->residue_param[i],opb);
523
+ }
524
+
525
+ /* maps */
526
+ oggpack_write(opb,ci->maps-1,6);
527
+ for(i=0;i<ci->maps;i++){
528
+ oggpack_write(opb,ci->map_type[i],16);
529
+ _mapping_P[ci->map_type[i]]->pack(vi,ci->map_param[i],opb);
530
+ }
531
+
532
+ /* modes */
533
+ oggpack_write(opb,ci->modes-1,6);
534
+ for(i=0;i<ci->modes;i++){
535
+ oggpack_write(opb,ci->mode_param[i]->blockflag,1);
536
+ oggpack_write(opb,ci->mode_param[i]->windowtype,16);
537
+ oggpack_write(opb,ci->mode_param[i]->transformtype,16);
538
+ oggpack_write(opb,ci->mode_param[i]->mapping,8);
539
+ }
540
+ oggpack_write(opb,1,1);
541
+
542
+ return(0);
543
+ err_out:
544
+ return(-1);
545
+ }
546
+
547
+ int vorbis_commentheader_out(vorbis_comment *vc,
548
+ ogg_packet *op){
549
+
550
+ oggpack_buffer opb;
551
+
552
+ oggpack_writeinit(&opb);
553
+ if(_vorbis_pack_comment(&opb,vc)){
554
+ oggpack_writeclear(&opb);
555
+ return OV_EIMPL;
556
+ }
557
+
558
+ op->packet = _ogg_malloc(oggpack_bytes(&opb));
559
+ memcpy(op->packet, opb.buffer, oggpack_bytes(&opb));
560
+
561
+ op->bytes=oggpack_bytes(&opb);
562
+ op->b_o_s=0;
563
+ op->e_o_s=0;
564
+ op->granulepos=0;
565
+ op->packetno=1;
566
+
567
+ oggpack_writeclear(&opb);
568
+ return 0;
569
+ }
570
+
571
+ int vorbis_analysis_headerout(vorbis_dsp_state *v,
572
+ vorbis_comment *vc,
573
+ ogg_packet *op,
574
+ ogg_packet *op_comm,
575
+ ogg_packet *op_code){
576
+ int ret=OV_EIMPL;
577
+ vorbis_info *vi=v->vi;
578
+ oggpack_buffer opb;
579
+ private_state *b=v->backend_state;
580
+
581
+ if(!b){
582
+ ret=OV_EFAULT;
583
+ goto err_out;
584
+ }
585
+
586
+ /* first header packet **********************************************/
587
+
588
+ oggpack_writeinit(&opb);
589
+ if(_vorbis_pack_info(&opb,vi))goto err_out;
590
+
591
+ /* build the packet */
592
+ if(b->header)_ogg_free(b->header);
593
+ b->header=_ogg_malloc(oggpack_bytes(&opb));
594
+ memcpy(b->header,opb.buffer,oggpack_bytes(&opb));
595
+ op->packet=b->header;
596
+ op->bytes=oggpack_bytes(&opb);
597
+ op->b_o_s=1;
598
+ op->e_o_s=0;
599
+ op->granulepos=0;
600
+ op->packetno=0;
601
+
602
+ /* second header packet (comments) **********************************/
603
+
604
+ oggpack_reset(&opb);
605
+ if(_vorbis_pack_comment(&opb,vc))goto err_out;
606
+
607
+ if(b->header1)_ogg_free(b->header1);
608
+ b->header1=_ogg_malloc(oggpack_bytes(&opb));
609
+ memcpy(b->header1,opb.buffer,oggpack_bytes(&opb));
610
+ op_comm->packet=b->header1;
611
+ op_comm->bytes=oggpack_bytes(&opb);
612
+ op_comm->b_o_s=0;
613
+ op_comm->e_o_s=0;
614
+ op_comm->granulepos=0;
615
+ op_comm->packetno=1;
616
+
617
+ /* third header packet (modes/codebooks) ****************************/
618
+
619
+ oggpack_reset(&opb);
620
+ if(_vorbis_pack_books(&opb,vi))goto err_out;
621
+
622
+ if(b->header2)_ogg_free(b->header2);
623
+ b->header2=_ogg_malloc(oggpack_bytes(&opb));
624
+ memcpy(b->header2,opb.buffer,oggpack_bytes(&opb));
625
+ op_code->packet=b->header2;
626
+ op_code->bytes=oggpack_bytes(&opb);
627
+ op_code->b_o_s=0;
628
+ op_code->e_o_s=0;
629
+ op_code->granulepos=0;
630
+ op_code->packetno=2;
631
+
632
+ oggpack_writeclear(&opb);
633
+ return(0);
634
+ err_out:
635
+ memset(op,0,sizeof(*op));
636
+ memset(op_comm,0,sizeof(*op_comm));
637
+ memset(op_code,0,sizeof(*op_code));
638
+
639
+ if(b){
640
+ oggpack_writeclear(&opb);
641
+ if(b->header)_ogg_free(b->header);
642
+ if(b->header1)_ogg_free(b->header1);
643
+ if(b->header2)_ogg_free(b->header2);
644
+ b->header=NULL;
645
+ b->header1=NULL;
646
+ b->header2=NULL;
647
+ }
648
+ return(ret);
649
+ }
650
+
651
+ double vorbis_granule_time(vorbis_dsp_state *v,ogg_int64_t granulepos){
652
+ if(granulepos == -1) return -1;
653
+
654
+ /* We're not guaranteed a 64 bit unsigned type everywhere, so we
655
+ have to put the unsigned granpo in a signed type. */
656
+ if(granulepos>=0){
657
+ return((double)granulepos/v->vi->rate);
658
+ }else{
659
+ ogg_int64_t granuleoff=0xffffffff;
660
+ granuleoff<<=31;
661
+ granuleoff|=0x7ffffffff;
662
+ return(((double)granulepos+2+granuleoff+granuleoff)/v->vi->rate);
663
+ }
664
+ }
665
+
666
+ const char *vorbis_version_string(void){
667
+ return GENERAL_VENDOR_STRING;
668
+ }