seal 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/LICENSE +13 -0
- data/README.md +265 -0
- data/ext/seal/extconf.rb +45 -0
- data/include/al/al.h +724 -0
- data/include/al/alc.h +277 -0
- data/include/al/efx-presets.h +402 -0
- data/include/al/efx.h +758 -0
- data/include/mpg123/mpg123.h +1034 -0
- data/include/ogg/config_types.h +25 -0
- data/include/ogg/ogg.h +210 -0
- data/include/ogg/os_types.h +147 -0
- data/include/seal.h +23 -0
- data/include/seal/buf.h +143 -0
- data/include/seal/core.h +95 -0
- data/include/seal/efs.h +112 -0
- data/include/seal/err.h +93 -0
- data/include/seal/fmt.h +58 -0
- data/include/seal/listener.h +103 -0
- data/include/seal/raw.h +86 -0
- data/include/seal/rvb.h +520 -0
- data/include/seal/src.h +413 -0
- data/include/seal/stream.h +81 -0
- data/include/vorbis/codec.h +243 -0
- data/include/vorbis/vorbisfile.h +206 -0
- data/mpg123/AUTHORS +150 -0
- data/mpg123/COPYING +773 -0
- data/mpg123/ChangeLog +3 -0
- data/mpg123/INSTALL +111 -0
- data/mpg123/Makefile.am +99 -0
- data/mpg123/Makefile.in +1043 -0
- data/mpg123/NEWS +1200 -0
- data/mpg123/NEWS.libmpg123 +133 -0
- data/mpg123/README +203 -0
- data/mpg123/TODO +38 -0
- data/mpg123/aclocal.m4 +1168 -0
- data/mpg123/build/config.guess +1530 -0
- data/mpg123/build/config.sub +1782 -0
- data/mpg123/build/depcomp +707 -0
- data/mpg123/build/install-sh +527 -0
- data/mpg123/build/ltmain.sh +9655 -0
- data/mpg123/build/missing +330 -0
- data/mpg123/configure +20267 -0
- data/mpg123/configure.ac +2178 -0
- data/mpg123/doc/ACCURACY +2 -0
- data/mpg123/doc/BENCHMARKING +110 -0
- data/mpg123/doc/BUGS +3 -0
- data/mpg123/doc/CONTACT +17 -0
- data/mpg123/doc/LICENSE +22 -0
- data/mpg123/doc/Makefile.am +32 -0
- data/mpg123/doc/Makefile.in +490 -0
- data/mpg123/doc/PATENTS +39 -0
- data/mpg123/doc/README.3DNOW +56 -0
- data/mpg123/doc/README.gain +171 -0
- data/mpg123/doc/README.remote +218 -0
- data/mpg123/doc/ROAD_TO_LGPL +270 -0
- data/mpg123/doc/THANKS +13 -0
- data/mpg123/doc/TODO +63 -0
- data/mpg123/doc/doxy_examples.c +21 -0
- data/mpg123/doc/doxygen.conf +41 -0
- data/mpg123/doc/doxyhead.xhtml +12 -0
- data/mpg123/doc/examples/dump_seekindex.c +41 -0
- data/mpg123/doc/examples/extract_frames.c +92 -0
- data/mpg123/doc/examples/feedseek.c +238 -0
- data/mpg123/doc/examples/id3dump.c +178 -0
- data/mpg123/doc/examples/mpg123_to_wav.c +118 -0
- data/mpg123/doc/examples/mpglib.c +92 -0
- data/mpg123/doc/examples/scan.c +47 -0
- data/mpg123/doc/libmpg123_speed.txt +84 -0
- data/mpg123/equalize.dat +37 -0
- data/mpg123/libmpg123.pc.in +11 -0
- data/mpg123/m4/addrconfig.m4 +34 -0
- data/mpg123/m4/libtool.m4 +7982 -0
- data/mpg123/m4/ltoptions.m4 +384 -0
- data/mpg123/m4/ltsugar.m4 +123 -0
- data/mpg123/m4/ltversion.m4 +23 -0
- data/mpg123/m4/lt~obsolete.m4 +98 -0
- data/mpg123/makedll.sh +19 -0
- data/mpg123/man1/mpg123.1 +512 -0
- data/mpg123/mpg123.spec +68 -0
- data/mpg123/mpg123.spec.in +68 -0
- data/mpg123/ports/MSVC++/2005/libmpg123/libmpg123.vcproj +741 -0
- data/mpg123/ports/MSVC++/2008/dump_seekindex/dump_seekindex.vcproj +194 -0
- data/mpg123/ports/MSVC++/2008/feedseek/feedseek.vcproj +195 -0
- data/mpg123/ports/MSVC++/2008/libmpg123/libmpg123.vcproj +1357 -0
- data/mpg123/ports/MSVC++/2008/mpg123.sln +44 -0
- data/mpg123/ports/MSVC++/2008/mpglib/mpglib.vcproj +191 -0
- data/mpg123/ports/MSVC++/2008/scan/scan.vcproj +195 -0
- data/mpg123/ports/MSVC++/2008clr/2008clr.sln +81 -0
- data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/Program.cs +435 -0
- data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/Properties/AssemblyInfo.cs +36 -0
- data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/ReplaceReaderclr.csproj +72 -0
- data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/Program.cs +331 -0
- data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/Properties/AssemblyInfo.cs +36 -0
- data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/feedseekclr.csproj +71 -0
- data/mpg123/ports/MSVC++/2008clr/examples/scanclr/Program.cs +79 -0
- data/mpg123/ports/MSVC++/2008clr/examples/scanclr/Properties/AssemblyInfo.cs +36 -0
- data/mpg123/ports/MSVC++/2008clr/examples/scanclr/scanclr.csproj +70 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/AssemblyInfo.cpp +76 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/ReadMe.txt +165 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/advanced.cpp +91 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/advanced.h +130 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/dllmain.cpp +19 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/enum.h +218 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/error.cpp +48 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/error.h +134 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v1.cpp +92 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v1.h +132 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v2.cpp +138 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v2.h +152 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.cpp +896 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.h +953 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.rc +102 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.vcproj +328 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/resource.h +14 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/stdafx.cpp +8 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/stdafx.h +38 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/string.cpp +166 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/string.h +265 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/targetver.h +24 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/text.cpp +67 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/text.h +111 -0
- data/mpg123/ports/MSVC++/2010/dump_seekindex/dump_seekindex.vcxproj +90 -0
- data/mpg123/ports/MSVC++/2010/dump_seekindex/dump_seekindex.vcxproj.filters +6 -0
- data/mpg123/ports/MSVC++/2010/feedseek/feedseek.vcxproj +95 -0
- data/mpg123/ports/MSVC++/2010/feedseek/feedseek.vcxproj.filters +6 -0
- data/mpg123/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj +960 -0
- data/mpg123/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj.user +3 -0
- data/mpg123/ports/MSVC++/2010/libmpg123/yasm.exe +0 -0
- data/mpg123/ports/MSVC++/2010/mpg123.sln +38 -0
- data/mpg123/ports/MSVC++/2010/scan/scan.vcxproj +93 -0
- data/mpg123/ports/MSVC++/2010/scan/scan.vcxproj.filters +6 -0
- data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/CORE/CORE_FileIn.H +15 -0
- data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/CORE/SourceFilter_MP3.H +139 -0
- data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/IIEP_Def.H +206 -0
- data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/IIEP_FileIn.H +167 -0
- data/mpg123/ports/MSVC++/CMP3Stream/README +4 -0
- data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_FileIn.CPP +462 -0
- data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_Log.CPP +122 -0
- data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_Mutex.CPP +35 -0
- data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/SourceFilter_MP3Stream.CPP +586 -0
- data/mpg123/ports/MSVC++/CMP3Stream/libMPG123/PLACE_LIBMPG123_SOURCES_HERE +0 -0
- data/mpg123/ports/MSVC++/CMP3Stream/libMPG123/libMPG123.vcproj +245 -0
- data/mpg123/ports/MSVC++/config.h +35 -0
- data/mpg123/ports/MSVC++/examples/feedseek.c +240 -0
- data/mpg123/ports/MSVC++/examples/scan.c +47 -0
- data/mpg123/ports/MSVC++/mpg123.h +46 -0
- data/mpg123/ports/MSVC++/msvc.c +59 -0
- data/mpg123/ports/README +26 -0
- data/mpg123/ports/Sony_PSP/Makefile.psp +38 -0
- data/mpg123/ports/Sony_PSP/README +11 -0
- data/mpg123/ports/Sony_PSP/config.h +368 -0
- data/mpg123/ports/Sony_PSP/readers.c.patch +2 -0
- data/mpg123/ports/Xcode/config.h +197 -0
- data/mpg123/ports/Xcode/mpg123.h +17 -0
- data/mpg123/ports/Xcode/mpg123.xcodeproj/project.pbxproj +670 -0
- data/mpg123/ports/mpg123_.pas +478 -0
- data/mpg123/scripts/benchmark-cpu.pl +56 -0
- data/mpg123/scripts/tag_lyrics.py +76 -0
- data/mpg123/src/Makefile.am +186 -0
- data/mpg123/src/Makefile.in +1097 -0
- data/mpg123/src/audio.c +725 -0
- data/mpg123/src/audio.h +106 -0
- data/mpg123/src/buffer.c +312 -0
- data/mpg123/src/buffer.h +45 -0
- data/mpg123/src/common.c +240 -0
- data/mpg123/src/common.h +29 -0
- data/mpg123/src/config.h.in +436 -0
- data/mpg123/src/control_generic.c +809 -0
- data/mpg123/src/equalizer.c +48 -0
- data/mpg123/src/genre.c +271 -0
- data/mpg123/src/genre.h +15 -0
- data/mpg123/src/getlopt.c +148 -0
- data/mpg123/src/getlopt.h +77 -0
- data/mpg123/src/httpget.c +700 -0
- data/mpg123/src/httpget.h +66 -0
- data/mpg123/src/legacy_module.c +74 -0
- data/mpg123/src/libmpg123/Makefile.am +141 -0
- data/mpg123/src/libmpg123/Makefile.in +919 -0
- data/mpg123/src/libmpg123/compat.c +138 -0
- data/mpg123/src/libmpg123/compat.h +178 -0
- data/mpg123/src/libmpg123/dct36_3dnow.S +505 -0
- data/mpg123/src/libmpg123/dct36_3dnowext.S +512 -0
- data/mpg123/src/libmpg123/dct64.c +174 -0
- data/mpg123/src/libmpg123/dct64_3dnow.S +712 -0
- data/mpg123/src/libmpg123/dct64_3dnowext.S +714 -0
- data/mpg123/src/libmpg123/dct64_altivec.c +315 -0
- data/mpg123/src/libmpg123/dct64_i386.c +336 -0
- data/mpg123/src/libmpg123/dct64_i486.c +342 -0
- data/mpg123/src/libmpg123/dct64_mmx.S +811 -0
- data/mpg123/src/libmpg123/dct64_neon.S +297 -0
- data/mpg123/src/libmpg123/dct64_neon_float.S +270 -0
- data/mpg123/src/libmpg123/dct64_sse.S +454 -0
- data/mpg123/src/libmpg123/dct64_sse_float.S +401 -0
- data/mpg123/src/libmpg123/dct64_x86_64.S +464 -0
- data/mpg123/src/libmpg123/dct64_x86_64_float.S +426 -0
- data/mpg123/src/libmpg123/debug.h +171 -0
- data/mpg123/src/libmpg123/decode.h +268 -0
- data/mpg123/src/libmpg123/dither.c +119 -0
- data/mpg123/src/libmpg123/dither.h +23 -0
- data/mpg123/src/libmpg123/equalizer.c +17 -0
- data/mpg123/src/libmpg123/equalizer_3dnow.S +70 -0
- data/mpg123/src/libmpg123/feature.c +106 -0
- data/mpg123/src/libmpg123/format.c +521 -0
- data/mpg123/src/libmpg123/frame.c +1046 -0
- data/mpg123/src/libmpg123/frame.h +410 -0
- data/mpg123/src/libmpg123/gapless.h +119 -0
- data/mpg123/src/libmpg123/getbits.h +100 -0
- data/mpg123/src/libmpg123/getcpuflags.S +91 -0
- data/mpg123/src/libmpg123/getcpuflags.h +47 -0
- data/mpg123/src/libmpg123/huffman.h +340 -0
- data/mpg123/src/libmpg123/icy.c +32 -0
- data/mpg123/src/libmpg123/icy.h +38 -0
- data/mpg123/src/libmpg123/icy2utf8.c +438 -0
- data/mpg123/src/libmpg123/icy2utf8.h +10 -0
- data/mpg123/src/libmpg123/id3.c +999 -0
- data/mpg123/src/libmpg123/id3.h +43 -0
- data/mpg123/src/libmpg123/index.c +134 -0
- data/mpg123/src/libmpg123/index.h +59 -0
- data/mpg123/src/libmpg123/intsym.h +256 -0
- data/mpg123/src/libmpg123/l12_integer_tables.h +278 -0
- data/mpg123/src/libmpg123/l2tables.h +164 -0
- data/mpg123/src/libmpg123/l3_integer_tables.h +1002 -0
- data/mpg123/src/libmpg123/layer1.c +155 -0
- data/mpg123/src/libmpg123/layer2.c +371 -0
- data/mpg123/src/libmpg123/layer3.c +2053 -0
- data/mpg123/src/libmpg123/lfs_alias.c +252 -0
- data/mpg123/src/libmpg123/lfs_wrap.c +751 -0
- data/mpg123/src/libmpg123/libmpg123.c +1607 -0
- data/mpg123/src/libmpg123/mangle.h +74 -0
- data/mpg123/src/libmpg123/mpeghead.h +87 -0
- data/mpg123/src/libmpg123/mpg123.h.in +1075 -0
- data/mpg123/src/libmpg123/mpg123lib_intern.h +338 -0
- data/mpg123/src/libmpg123/ntom.c +148 -0
- data/mpg123/src/libmpg123/optimize.c +964 -0
- data/mpg123/src/libmpg123/optimize.h +219 -0
- data/mpg123/src/libmpg123/parse.c +1179 -0
- data/mpg123/src/libmpg123/parse.h +25 -0
- data/mpg123/src/libmpg123/reader.h +137 -0
- data/mpg123/src/libmpg123/readers.c +1235 -0
- data/mpg123/src/libmpg123/sample.h +152 -0
- data/mpg123/src/libmpg123/stringbuf.c +163 -0
- data/mpg123/src/libmpg123/synth.c +816 -0
- data/mpg123/src/libmpg123/synth.h +196 -0
- data/mpg123/src/libmpg123/synth_3dnow.S +318 -0
- data/mpg123/src/libmpg123/synth_3dnowext.S +6 -0
- data/mpg123/src/libmpg123/synth_8bit.c +142 -0
- data/mpg123/src/libmpg123/synth_8bit.h +86 -0
- data/mpg123/src/libmpg123/synth_altivec.c +1057 -0
- data/mpg123/src/libmpg123/synth_arm.S +271 -0
- data/mpg123/src/libmpg123/synth_arm_accurate.S +287 -0
- data/mpg123/src/libmpg123/synth_i486.c +252 -0
- data/mpg123/src/libmpg123/synth_i586.S +336 -0
- data/mpg123/src/libmpg123/synth_i586_dither.S +375 -0
- data/mpg123/src/libmpg123/synth_mmx.S +125 -0
- data/mpg123/src/libmpg123/synth_mono.h +64 -0
- data/mpg123/src/libmpg123/synth_neon.S +123 -0
- data/mpg123/src/libmpg123/synth_neon_accurate.S +173 -0
- data/mpg123/src/libmpg123/synth_neon_float.S +149 -0
- data/mpg123/src/libmpg123/synth_neon_s32.S +168 -0
- data/mpg123/src/libmpg123/synth_ntom.h +213 -0
- data/mpg123/src/libmpg123/synth_real.c +404 -0
- data/mpg123/src/libmpg123/synth_s32.c +411 -0
- data/mpg123/src/libmpg123/synth_sse.S +6 -0
- data/mpg123/src/libmpg123/synth_sse3d.h +246 -0
- data/mpg123/src/libmpg123/synth_sse_accurate.S +294 -0
- data/mpg123/src/libmpg123/synth_sse_float.S +241 -0
- data/mpg123/src/libmpg123/synth_sse_s32.S +306 -0
- data/mpg123/src/libmpg123/synth_stereo_neon.S +175 -0
- data/mpg123/src/libmpg123/synth_stereo_neon_accurate.S +262 -0
- data/mpg123/src/libmpg123/synth_stereo_neon_float.S +220 -0
- data/mpg123/src/libmpg123/synth_stereo_neon_s32.S +247 -0
- data/mpg123/src/libmpg123/synth_stereo_sse_accurate.S +508 -0
- data/mpg123/src/libmpg123/synth_stereo_sse_float.S +416 -0
- data/mpg123/src/libmpg123/synth_stereo_sse_s32.S +540 -0
- data/mpg123/src/libmpg123/synth_stereo_x86_64.S +335 -0
- data/mpg123/src/libmpg123/synth_stereo_x86_64_accurate.S +454 -0
- data/mpg123/src/libmpg123/synth_stereo_x86_64_float.S +396 -0
- data/mpg123/src/libmpg123/synth_stereo_x86_64_s32.S +473 -0
- data/mpg123/src/libmpg123/synth_x86_64.S +244 -0
- data/mpg123/src/libmpg123/synth_x86_64_accurate.S +301 -0
- data/mpg123/src/libmpg123/synth_x86_64_float.S +259 -0
- data/mpg123/src/libmpg123/synth_x86_64_s32.S +312 -0
- data/mpg123/src/libmpg123/synths.h +52 -0
- data/mpg123/src/libmpg123/tabinit.c +294 -0
- data/mpg123/src/libmpg123/tabinit_mmx.S +210 -0
- data/mpg123/src/libmpg123/testcpu.c +35 -0
- data/mpg123/src/libmpg123/true.h +14 -0
- data/mpg123/src/local.c +63 -0
- data/mpg123/src/local.h +21 -0
- data/mpg123/src/metaprint.c +373 -0
- data/mpg123/src/metaprint.h +17 -0
- data/mpg123/src/module.c +306 -0
- data/mpg123/src/module.h +48 -0
- data/mpg123/src/mpg123.c +1405 -0
- data/mpg123/src/mpg123app.h +171 -0
- data/mpg123/src/output/Makefile.am +213 -0
- data/mpg123/src/output/Makefile.in +1238 -0
- data/mpg123/src/output/aix.c +300 -0
- data/mpg123/src/output/alib.c +209 -0
- data/mpg123/src/output/alsa.c +297 -0
- data/mpg123/src/output/arts.c +117 -0
- data/mpg123/src/output/coreaudio.c +370 -0
- data/mpg123/src/output/dummy.c +78 -0
- data/mpg123/src/output/esd.c +167 -0
- data/mpg123/src/output/hp.c +184 -0
- data/mpg123/src/output/jack.c +450 -0
- data/mpg123/src/output/mint.c +197 -0
- data/mpg123/src/output/nas.c +335 -0
- data/mpg123/src/output/openal.c +197 -0
- data/mpg123/src/output/os2.c +665 -0
- data/mpg123/src/output/oss.c +319 -0
- data/mpg123/src/output/portaudio.c +255 -0
- data/mpg123/src/output/pulse.c +164 -0
- data/mpg123/src/output/sdl.c +206 -0
- data/mpg123/src/output/sgi.c +213 -0
- data/mpg123/src/output/sndio.c +161 -0
- data/mpg123/src/output/sun.c +281 -0
- data/mpg123/src/output/win32.c +229 -0
- data/mpg123/src/playlist.c +596 -0
- data/mpg123/src/playlist.h +52 -0
- data/mpg123/src/resolver.c +319 -0
- data/mpg123/src/resolver.h +25 -0
- data/mpg123/src/sfifo.c +146 -0
- data/mpg123/src/sfifo.h +95 -0
- data/mpg123/src/streamdump.c +74 -0
- data/mpg123/src/streamdump.h +20 -0
- data/mpg123/src/term.c +479 -0
- data/mpg123/src/term.h +81 -0
- data/mpg123/src/tests/noise.c +52 -0
- data/mpg123/src/tests/plain_id3.c +109 -0
- data/mpg123/src/tests/seek_accuracy.c +261 -0
- data/mpg123/src/tests/seek_whence.c +56 -0
- data/mpg123/src/tests/testtext.h +34 -0
- data/mpg123/src/tests/text.c +80 -0
- data/mpg123/src/wav.c +464 -0
- data/mpg123/src/wavhead.h +68 -0
- data/mpg123/src/win32_net.c +599 -0
- data/mpg123/src/win32_support.c +191 -0
- data/mpg123/src/win32_support.h +152 -0
- data/mpg123/src/xfermem.c +321 -0
- data/mpg123/src/xfermem.h +74 -0
- data/mpg123/windows-builds.sh +137 -0
- data/msvc/lib/OpenAL32.lib +0 -0
- data/spec/fixtures/heal.ogg +0 -0
- data/spec/fixtures/tone_up.wav +0 -0
- data/spec/seal/buffer_spec.rb +37 -0
- data/spec/seal/core_spec.rb +29 -0
- data/spec/seal/effect_slot_spec.rb +38 -0
- data/spec/seal/listener_spec.rb +33 -0
- data/spec/seal/reverb_spec.rb +51 -0
- data/spec/seal/source_spec.rb +370 -0
- data/spec/seal/stream_spec.rb +38 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/support/attribute_examples.rb +75 -0
- data/spec/support/audio_object_with_format.rb +27 -0
- data/spec/support/movable_object.rb +22 -0
- data/src/libogg/bitwise.c +857 -0
- data/src/libogg/framing.c +2093 -0
- data/src/libvorbis/backends.h +144 -0
- data/src/libvorbis/bitrate.c +253 -0
- data/src/libvorbis/bitrate.h +59 -0
- data/src/libvorbis/block.c +1046 -0
- data/src/libvorbis/codebook.c +484 -0
- data/src/libvorbis/codebook.h +119 -0
- data/src/libvorbis/codec_internal.h +167 -0
- data/src/libvorbis/envelope.c +375 -0
- data/src/libvorbis/envelope.h +80 -0
- data/src/libvorbis/floor0.c +221 -0
- data/src/libvorbis/floor1.c +1100 -0
- data/src/libvorbis/highlevel.h +58 -0
- data/src/libvorbis/info.c +668 -0
- data/src/libvorbis/lookup.c +94 -0
- data/src/libvorbis/lookup.h +32 -0
- data/src/libvorbis/lookup_data.h +192 -0
- data/src/libvorbis/lpc.c +160 -0
- data/src/libvorbis/lpc.h +29 -0
- data/src/libvorbis/lsp.c +456 -0
- data/src/libvorbis/lsp.h +28 -0
- data/src/libvorbis/mapping0.c +816 -0
- data/src/libvorbis/masking.h +785 -0
- data/src/libvorbis/mdct.c +563 -0
- data/src/libvorbis/mdct.h +71 -0
- data/src/libvorbis/misc.h +57 -0
- data/src/libvorbis/os.h +186 -0
- data/src/libvorbis/psy.c +1206 -0
- data/src/libvorbis/psy.h +154 -0
- data/src/libvorbis/registry.c +45 -0
- data/src/libvorbis/registry.h +32 -0
- data/src/libvorbis/res0.c +889 -0
- data/src/libvorbis/scales.h +90 -0
- data/src/libvorbis/sharedbook.c +579 -0
- data/src/libvorbis/smallft.c +1255 -0
- data/src/libvorbis/smallft.h +34 -0
- data/src/libvorbis/synthesis.c +184 -0
- data/src/libvorbis/vorbisfile.c +2337 -0
- data/src/libvorbis/window.c +2135 -0
- data/src/libvorbis/window.h +26 -0
- data/src/rubyext.c +2329 -0
- data/src/seal/buf.c +124 -0
- data/src/seal/core.c +283 -0
- data/src/seal/efs.c +74 -0
- data/src/seal/err.c +118 -0
- data/src/seal/fmt.c +86 -0
- data/src/seal/listener.c +111 -0
- data/src/seal/mpg.c +174 -0
- data/src/seal/mpg.h +24 -0
- data/src/seal/ov.c +180 -0
- data/src/seal/ov.h +22 -0
- data/src/seal/raw.c +59 -0
- data/src/seal/reader.c +102 -0
- data/src/seal/reader.h +59 -0
- data/src/seal/rvb.c +368 -0
- data/src/seal/src.c +654 -0
- data/src/seal/stream.c +109 -0
- data/src/seal/threading.c +66 -0
- data/src/seal/threading.h +20 -0
- data/src/seal/wav.c +297 -0
- data/src/seal/wav.h +23 -0
- data/src/win32api.rb +29 -0
- metadata +563 -0
@@ -0,0 +1,106 @@
|
|
1
|
+
#include "mpg123lib_intern.h"
|
2
|
+
|
3
|
+
int mpg123_feature(const enum mpg123_feature_set key)
|
4
|
+
{
|
5
|
+
switch(key)
|
6
|
+
{
|
7
|
+
case MPG123_FEATURE_ABI_UTF8OPEN:
|
8
|
+
#ifdef WANT_WIN32_UNICODE
|
9
|
+
return 1;
|
10
|
+
#else
|
11
|
+
return 0;
|
12
|
+
#endif /* WANT_WIN32_UNICODE */
|
13
|
+
|
14
|
+
case MPG123_FEATURE_OUTPUT_8BIT:
|
15
|
+
#ifdef NO_8BIT
|
16
|
+
return 0;
|
17
|
+
#else
|
18
|
+
return 1;
|
19
|
+
#endif /* mpg123_output_8bit */
|
20
|
+
|
21
|
+
case MPG123_FEATURE_OUTPUT_16BIT:
|
22
|
+
#ifdef NO_16BIT
|
23
|
+
return 0;
|
24
|
+
#else
|
25
|
+
return 1;
|
26
|
+
#endif /* mpg123_output_16bit */
|
27
|
+
|
28
|
+
case MPG123_FEATURE_OUTPUT_32BIT:
|
29
|
+
#ifdef NO_32BIT
|
30
|
+
return 0;
|
31
|
+
#else
|
32
|
+
return 1;
|
33
|
+
#endif /* mpg123_output_32bit */
|
34
|
+
|
35
|
+
case MPG123_FEATURE_PARSE_ID3V2:
|
36
|
+
#ifdef NO_ID3V2
|
37
|
+
return 0;
|
38
|
+
#else
|
39
|
+
return 1;
|
40
|
+
#endif /* NO_ID3V2 */
|
41
|
+
|
42
|
+
case MPG123_FEATURE_DECODE_LAYER1:
|
43
|
+
#ifdef NO_LAYER1
|
44
|
+
return 0;
|
45
|
+
#else
|
46
|
+
return 1;
|
47
|
+
#endif /* NO_LAYER1 */
|
48
|
+
|
49
|
+
case MPG123_FEATURE_DECODE_LAYER2:
|
50
|
+
#ifdef NO_LAYER2
|
51
|
+
return 0;
|
52
|
+
#else
|
53
|
+
return 1;
|
54
|
+
#endif /* NO_LAYER2 */
|
55
|
+
|
56
|
+
case MPG123_FEATURE_DECODE_LAYER3:
|
57
|
+
#ifdef NO_LAYER3
|
58
|
+
return 0;
|
59
|
+
#else
|
60
|
+
return 1;
|
61
|
+
#endif /* NO_LAYER3 */
|
62
|
+
|
63
|
+
case MPG123_FEATURE_DECODE_ACCURATE:
|
64
|
+
#ifdef ACCURATE_ROUNDING
|
65
|
+
return 1;
|
66
|
+
#else
|
67
|
+
return 0;
|
68
|
+
#endif /* ACCURATE_ROUNDING */
|
69
|
+
|
70
|
+
case MPG123_FEATURE_DECODE_DOWNSAMPLE:
|
71
|
+
#ifdef NO_DOWNSAMPLE
|
72
|
+
return 0;
|
73
|
+
#else
|
74
|
+
return 1;
|
75
|
+
#endif /* NO_DOWNSAMPLE */
|
76
|
+
|
77
|
+
case MPG123_FEATURE_DECODE_NTOM:
|
78
|
+
#ifdef NO_NTOM
|
79
|
+
return 0;
|
80
|
+
#else
|
81
|
+
return 1;
|
82
|
+
#endif /* NO_NTOM */
|
83
|
+
|
84
|
+
case MPG123_FEATURE_PARSE_ICY:
|
85
|
+
#ifdef NO_ICY
|
86
|
+
return 0;
|
87
|
+
#else
|
88
|
+
return 1;
|
89
|
+
#endif /* NO_ICY */
|
90
|
+
|
91
|
+
case MPG123_FEATURE_INDEX:
|
92
|
+
#ifdef FRAME_INDEX
|
93
|
+
return 1;
|
94
|
+
#else
|
95
|
+
return 0;
|
96
|
+
#endif /* FRAME_INDEX */
|
97
|
+
case MPG123_FEATURE_TIMEOUT_READ:
|
98
|
+
#ifdef TIMEOUT_READ
|
99
|
+
return 1;
|
100
|
+
#else
|
101
|
+
return 0;
|
102
|
+
#endif
|
103
|
+
|
104
|
+
default: return 0;
|
105
|
+
}
|
106
|
+
}
|
@@ -0,0 +1,521 @@
|
|
1
|
+
/*
|
2
|
+
format:routines to deal with audio (output) format
|
3
|
+
|
4
|
+
copyright 2008-9 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, starting with parts of the old audio.c, with only faintly manage to show now
|
7
|
+
*/
|
8
|
+
|
9
|
+
#include "mpg123lib_intern.h"
|
10
|
+
#include "debug.h"
|
11
|
+
|
12
|
+
/* static int chans[NUM_CHANNELS] = { 1 , 2 }; */
|
13
|
+
static const long my_rates[MPG123_RATES] = /* only the standard rates */
|
14
|
+
{
|
15
|
+
8000, 11025, 12000,
|
16
|
+
16000, 22050, 24000,
|
17
|
+
32000, 44100, 48000,
|
18
|
+
};
|
19
|
+
|
20
|
+
static const int my_encodings[MPG123_ENCODINGS] =
|
21
|
+
{
|
22
|
+
MPG123_ENC_SIGNED_16,
|
23
|
+
MPG123_ENC_UNSIGNED_16,
|
24
|
+
MPG123_ENC_SIGNED_32,
|
25
|
+
MPG123_ENC_UNSIGNED_32,
|
26
|
+
MPG123_ENC_SIGNED_24,
|
27
|
+
MPG123_ENC_UNSIGNED_24,
|
28
|
+
/* Floating point range, see below. */
|
29
|
+
MPG123_ENC_FLOAT_32,
|
30
|
+
MPG123_ENC_FLOAT_64,
|
31
|
+
/* 8 bit range, see below. */
|
32
|
+
MPG123_ENC_SIGNED_8,
|
33
|
+
MPG123_ENC_UNSIGNED_8,
|
34
|
+
MPG123_ENC_ULAW_8,
|
35
|
+
MPG123_ENC_ALAW_8
|
36
|
+
};
|
37
|
+
|
38
|
+
/* Make that match the above table.
|
39
|
+
And yes, I still don't like this kludgy stuff. */
|
40
|
+
/* range[0] <= i < range[1] for forced floating point */
|
41
|
+
static const int enc_float_range[2] = { 6, 8 };
|
42
|
+
/* same for 8 bit encodings */
|
43
|
+
static const int enc_8bit_range[2] = { 8, 12 };
|
44
|
+
|
45
|
+
/* Only one type of float is supported. */
|
46
|
+
# ifdef REAL_IS_FLOAT
|
47
|
+
# define MPG123_FLOAT_ENC MPG123_ENC_FLOAT_32
|
48
|
+
# else
|
49
|
+
# define MPG123_FLOAT_ENC MPG123_ENC_FLOAT_64
|
50
|
+
# endif
|
51
|
+
|
52
|
+
/* The list of actually possible encodings. */
|
53
|
+
static const int good_encodings[] =
|
54
|
+
{
|
55
|
+
#ifndef NO_16BIT
|
56
|
+
MPG123_ENC_SIGNED_16,
|
57
|
+
MPG123_ENC_UNSIGNED_16,
|
58
|
+
#endif
|
59
|
+
#ifndef NO_32BIT
|
60
|
+
MPG123_ENC_SIGNED_32,
|
61
|
+
MPG123_ENC_UNSIGNED_32,
|
62
|
+
MPG123_ENC_SIGNED_24,
|
63
|
+
MPG123_ENC_UNSIGNED_24,
|
64
|
+
#endif
|
65
|
+
#ifndef NO_REAL
|
66
|
+
MPG123_FLOAT_ENC,
|
67
|
+
#endif
|
68
|
+
#ifndef NO_8BIT
|
69
|
+
MPG123_ENC_SIGNED_8,
|
70
|
+
MPG123_ENC_UNSIGNED_8,
|
71
|
+
MPG123_ENC_ULAW_8,
|
72
|
+
MPG123_ENC_ALAW_8
|
73
|
+
#endif
|
74
|
+
};
|
75
|
+
|
76
|
+
/* Check if encoding is a valid one in this build.
|
77
|
+
...lazy programming: linear search. */
|
78
|
+
static int good_enc(const int enc)
|
79
|
+
{
|
80
|
+
size_t i;
|
81
|
+
for(i=0; i<sizeof(good_encodings)/sizeof(int); ++i)
|
82
|
+
if(enc == good_encodings[i]) return TRUE;
|
83
|
+
|
84
|
+
return FALSE;
|
85
|
+
}
|
86
|
+
|
87
|
+
void attribute_align_arg mpg123_rates(const long **list, size_t *number)
|
88
|
+
{
|
89
|
+
if(list != NULL) *list = my_rates;
|
90
|
+
if(number != NULL) *number = sizeof(my_rates)/sizeof(long);
|
91
|
+
}
|
92
|
+
|
93
|
+
/* Now that's a bit tricky... One build of the library knows only a subset of the encodings. */
|
94
|
+
void attribute_align_arg mpg123_encodings(const int **list, size_t *number)
|
95
|
+
{
|
96
|
+
if(list != NULL) *list = good_encodings;
|
97
|
+
if(number != NULL) *number = sizeof(good_encodings)/sizeof(int);
|
98
|
+
}
|
99
|
+
|
100
|
+
int attribute_align_arg mpg123_encsize(int encoding)
|
101
|
+
{
|
102
|
+
if(encoding & MPG123_ENC_8)
|
103
|
+
return 1;
|
104
|
+
else if(encoding & MPG123_ENC_16)
|
105
|
+
return 2;
|
106
|
+
else if(encoding & MPG123_ENC_24)
|
107
|
+
return 3;
|
108
|
+
else if(encoding & MPG123_ENC_32 || encoding == MPG123_ENC_FLOAT_32)
|
109
|
+
return 4;
|
110
|
+
else if(encoding == MPG123_ENC_FLOAT_64)
|
111
|
+
return 8;
|
112
|
+
else
|
113
|
+
return 0;
|
114
|
+
}
|
115
|
+
|
116
|
+
/* char audio_caps[NUM_CHANNELS][MPG123_RATES+1][MPG123_ENCODINGS]; */
|
117
|
+
|
118
|
+
static int rate2num(mpg123_pars *mp, long r)
|
119
|
+
{
|
120
|
+
int i;
|
121
|
+
for(i=0;i<MPG123_RATES;i++) if(my_rates[i] == r) return i;
|
122
|
+
#ifndef NO_NTOM
|
123
|
+
if(mp && mp->force_rate != 0 && mp->force_rate == r) return MPG123_RATES;
|
124
|
+
#endif
|
125
|
+
|
126
|
+
return -1;
|
127
|
+
}
|
128
|
+
|
129
|
+
static int enc2num(int encoding)
|
130
|
+
{
|
131
|
+
int i;
|
132
|
+
for(i=0;i<MPG123_ENCODINGS;++i)
|
133
|
+
if(my_encodings[i] == encoding) return i;
|
134
|
+
|
135
|
+
return -1;
|
136
|
+
}
|
137
|
+
|
138
|
+
static int cap_fit(mpg123_handle *fr, struct audioformat *nf, int f0, int f2)
|
139
|
+
{
|
140
|
+
int i;
|
141
|
+
int c = nf->channels-1;
|
142
|
+
int rn = rate2num(&fr->p, nf->rate);
|
143
|
+
if(rn >= 0) for(i=f0;i<f2;i++)
|
144
|
+
{
|
145
|
+
if(fr->p.audio_caps[c][rn][i])
|
146
|
+
{
|
147
|
+
nf->encoding = my_encodings[i];
|
148
|
+
return 1;
|
149
|
+
}
|
150
|
+
}
|
151
|
+
return 0;
|
152
|
+
}
|
153
|
+
|
154
|
+
static int freq_fit(mpg123_handle *fr, struct audioformat *nf, int f0, int f2)
|
155
|
+
{
|
156
|
+
nf->rate = frame_freq(fr)>>fr->p.down_sample;
|
157
|
+
if(cap_fit(fr,nf,f0,f2)) return 1;
|
158
|
+
if(fr->p.flags & MPG123_AUTO_RESAMPLE)
|
159
|
+
{
|
160
|
+
nf->rate>>=1;
|
161
|
+
if(cap_fit(fr,nf,f0,f2)) return 1;
|
162
|
+
nf->rate>>=1;
|
163
|
+
if(cap_fit(fr,nf,f0,f2)) return 1;
|
164
|
+
}
|
165
|
+
#ifndef NO_NTOM
|
166
|
+
/* If nothing worked, try the other rates, only without constrains from user.
|
167
|
+
In case you didn't guess: We enable flexible resampling if we find a working rate. */
|
168
|
+
if( fr->p.flags & MPG123_AUTO_RESAMPLE &&
|
169
|
+
!fr->p.force_rate && fr->p.down_sample == 0)
|
170
|
+
{
|
171
|
+
int i;
|
172
|
+
int c = nf->channels-1;
|
173
|
+
int rn = rate2num(&fr->p, frame_freq(fr));
|
174
|
+
int rrn;
|
175
|
+
if(rn < 0) return 0;
|
176
|
+
/* Try higher rates first. */
|
177
|
+
for(i=f0;i<f2;i++) for(rrn=rn+1; rrn<MPG123_RATES; ++rrn)
|
178
|
+
if(fr->p.audio_caps[c][rrn][i])
|
179
|
+
{
|
180
|
+
nf->rate = my_rates[rrn];
|
181
|
+
nf->encoding = my_encodings[i];
|
182
|
+
return 1;
|
183
|
+
}
|
184
|
+
/* Then lower rates. */
|
185
|
+
for(i=f0;i<f2;i++) for(rrn=rn-1; rrn>=0; --rrn)
|
186
|
+
if(fr->p.audio_caps[c][rrn][i])
|
187
|
+
{
|
188
|
+
nf->rate = my_rates[rrn];
|
189
|
+
nf->encoding = my_encodings[i];
|
190
|
+
return 1;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
#endif
|
194
|
+
|
195
|
+
return 0;
|
196
|
+
}
|
197
|
+
|
198
|
+
/* match constraints against supported audio formats, store possible setup in frame
|
199
|
+
return: -1: error; 0: no format change; 1: format change */
|
200
|
+
int frame_output_format(mpg123_handle *fr)
|
201
|
+
{
|
202
|
+
struct audioformat nf;
|
203
|
+
int f0=0;
|
204
|
+
int f2=MPG123_ENCODINGS; /* Omit the 32bit and float encodings. */
|
205
|
+
mpg123_pars *p = &fr->p;
|
206
|
+
/* initialize new format, encoding comes later */
|
207
|
+
nf.channels = fr->stereo;
|
208
|
+
|
209
|
+
/* All this forcing should be removed in favour of the capabilities table... */
|
210
|
+
if(p->flags & MPG123_FORCE_8BIT)
|
211
|
+
{
|
212
|
+
f0 = enc_8bit_range[0];
|
213
|
+
f2 = enc_8bit_range[1];
|
214
|
+
}
|
215
|
+
if(p->flags & MPG123_FORCE_FLOAT)
|
216
|
+
{
|
217
|
+
f0 = enc_float_range[0];
|
218
|
+
f2 = enc_float_range[1];
|
219
|
+
}
|
220
|
+
|
221
|
+
/* force stereo is stronger */
|
222
|
+
if(p->flags & MPG123_FORCE_MONO) nf.channels = 1;
|
223
|
+
if(p->flags & MPG123_FORCE_STEREO) nf.channels = 2;
|
224
|
+
|
225
|
+
#ifndef NO_NTOM
|
226
|
+
if(p->force_rate)
|
227
|
+
{
|
228
|
+
nf.rate = p->force_rate;
|
229
|
+
if(cap_fit(fr,&nf,f0,2)) goto end; /* 16bit encodings */
|
230
|
+
if(cap_fit(fr,&nf,f0<=2 ? 2 : f0,f2)) goto end; /* 8bit encodings */
|
231
|
+
|
232
|
+
/* try again with different stereoness */
|
233
|
+
if(nf.channels == 2 && !(p->flags & MPG123_FORCE_STEREO)) nf.channels = 1;
|
234
|
+
else if(nf.channels == 1 && !(p->flags & MPG123_FORCE_MONO)) nf.channels = 2;
|
235
|
+
|
236
|
+
if(cap_fit(fr,&nf,f0,2)) goto end; /* 16bit encodings */
|
237
|
+
if(cap_fit(fr,&nf,f0<=2 ? 2 : f0,f2)) goto end; /* 8bit encodings */
|
238
|
+
|
239
|
+
if(NOQUIET)
|
240
|
+
error3( "Unable to set up output format! Constraints: %s%s%liHz.",
|
241
|
+
( p->flags & MPG123_FORCE_STEREO ? "stereo, " :
|
242
|
+
(p->flags & MPG123_FORCE_MONO ? "mono, " : "") ),
|
243
|
+
(p->flags & MPG123_FORCE_8BIT ? "8bit, " : ""),
|
244
|
+
p->force_rate );
|
245
|
+
/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */
|
246
|
+
|
247
|
+
fr->err = MPG123_BAD_OUTFORMAT;
|
248
|
+
return -1;
|
249
|
+
}
|
250
|
+
#endif
|
251
|
+
|
252
|
+
if(freq_fit(fr, &nf, f0, 2)) goto end; /* try rates with 16bit */
|
253
|
+
if(freq_fit(fr, &nf, f0<=2 ? 2 : f0, f2)) goto end; /* ... 8bit */
|
254
|
+
|
255
|
+
/* try again with different stereoness */
|
256
|
+
if(nf.channels == 2 && !(p->flags & MPG123_FORCE_STEREO)) nf.channels = 1;
|
257
|
+
else if(nf.channels == 1 && !(p->flags & MPG123_FORCE_MONO)) nf.channels = 2;
|
258
|
+
|
259
|
+
if(freq_fit(fr, &nf, f0, 2)) goto end; /* try rates with 16bit */
|
260
|
+
if(freq_fit(fr, &nf, f0<=2 ? 2 : f0, f2)) goto end; /* ... 8bit */
|
261
|
+
|
262
|
+
/* Here is the _bad_ end. */
|
263
|
+
if(NOQUIET)
|
264
|
+
{
|
265
|
+
error5( "Unable to set up output format! Constraints: %s%s%li, %li or %liHz.",
|
266
|
+
( p->flags & MPG123_FORCE_STEREO ? "stereo, " :
|
267
|
+
(p->flags & MPG123_FORCE_MONO ? "mono, " : "") ),
|
268
|
+
(p->flags & MPG123_FORCE_8BIT ? "8bit, " : ""),
|
269
|
+
frame_freq(fr), frame_freq(fr)>>1, frame_freq(fr)>>2 );
|
270
|
+
}
|
271
|
+
/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */
|
272
|
+
|
273
|
+
fr->err = MPG123_BAD_OUTFORMAT;
|
274
|
+
return -1;
|
275
|
+
|
276
|
+
end: /* Here is the _good_ end. */
|
277
|
+
/* we had a successful match, now see if there's a change */
|
278
|
+
if(nf.rate == fr->af.rate && nf.channels == fr->af.channels && nf.encoding == fr->af.encoding)
|
279
|
+
{
|
280
|
+
debug2("Old format with %i channels, and FORCE_MONO=%li", nf.channels, p->flags & MPG123_FORCE_MONO);
|
281
|
+
return 0; /* the same format as before */
|
282
|
+
}
|
283
|
+
else /* a new format */
|
284
|
+
{
|
285
|
+
debug1("New format with %i channels!", nf.channels);
|
286
|
+
fr->af.rate = nf.rate;
|
287
|
+
fr->af.channels = nf.channels;
|
288
|
+
fr->af.encoding = nf.encoding;
|
289
|
+
/* Cache the size of one sample in bytes, for ease of use. */
|
290
|
+
fr->af.encsize = mpg123_encsize(fr->af.encoding);
|
291
|
+
if(fr->af.encsize < 1)
|
292
|
+
{
|
293
|
+
if(NOQUIET) error1("Some unknown encoding??? (%i)", fr->af.encoding);
|
294
|
+
|
295
|
+
fr->err = MPG123_BAD_OUTFORMAT;
|
296
|
+
return -1;
|
297
|
+
}
|
298
|
+
return 1;
|
299
|
+
}
|
300
|
+
}
|
301
|
+
|
302
|
+
int attribute_align_arg mpg123_format_none(mpg123_handle *mh)
|
303
|
+
{
|
304
|
+
int r;
|
305
|
+
if(mh == NULL) return MPG123_ERR;
|
306
|
+
|
307
|
+
r = mpg123_fmt_none(&mh->p);
|
308
|
+
if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; }
|
309
|
+
|
310
|
+
return r;
|
311
|
+
}
|
312
|
+
|
313
|
+
int attribute_align_arg mpg123_fmt_none(mpg123_pars *mp)
|
314
|
+
{
|
315
|
+
if(mp == NULL) return MPG123_BAD_PARS;
|
316
|
+
|
317
|
+
if(PVERB(mp,3)) fprintf(stderr, "Note: Disabling all formats.\n");
|
318
|
+
|
319
|
+
memset(mp->audio_caps,0,sizeof(mp->audio_caps));
|
320
|
+
return MPG123_OK;
|
321
|
+
}
|
322
|
+
|
323
|
+
int attribute_align_arg mpg123_format_all(mpg123_handle *mh)
|
324
|
+
{
|
325
|
+
int r;
|
326
|
+
if(mh == NULL) return MPG123_ERR;
|
327
|
+
|
328
|
+
r = mpg123_fmt_all(&mh->p);
|
329
|
+
if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; }
|
330
|
+
|
331
|
+
return r;
|
332
|
+
}
|
333
|
+
|
334
|
+
int attribute_align_arg mpg123_fmt_all(mpg123_pars *mp)
|
335
|
+
{
|
336
|
+
size_t rate, ch, enc;
|
337
|
+
if(mp == NULL) return MPG123_BAD_PARS;
|
338
|
+
|
339
|
+
if(PVERB(mp,3)) fprintf(stderr, "Note: Enabling all formats.\n");
|
340
|
+
|
341
|
+
for(ch=0; ch < NUM_CHANNELS; ++ch)
|
342
|
+
for(rate=0; rate < MPG123_RATES+1; ++rate)
|
343
|
+
for(enc=0; enc < MPG123_ENCODINGS; ++enc)
|
344
|
+
mp->audio_caps[ch][rate][enc] = good_enc(my_encodings[enc]) ? 1 : 0;
|
345
|
+
|
346
|
+
return MPG123_OK;
|
347
|
+
}
|
348
|
+
|
349
|
+
int attribute_align_arg mpg123_format(mpg123_handle *mh, long rate, int channels, int encodings)
|
350
|
+
{
|
351
|
+
int r;
|
352
|
+
if(mh == NULL) return MPG123_ERR;
|
353
|
+
r = mpg123_fmt(&mh->p, rate, channels, encodings);
|
354
|
+
if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; }
|
355
|
+
|
356
|
+
return r;
|
357
|
+
}
|
358
|
+
|
359
|
+
int attribute_align_arg mpg123_fmt(mpg123_pars *mp, long rate, int channels, int encodings)
|
360
|
+
{
|
361
|
+
int ie, ic, ratei;
|
362
|
+
int ch[2] = {0, 1};
|
363
|
+
if(mp == NULL) return MPG123_BAD_PARS;
|
364
|
+
if(!(channels & (MPG123_MONO|MPG123_STEREO))) return MPG123_BAD_CHANNEL;
|
365
|
+
|
366
|
+
if(PVERB(mp,3)) fprintf(stderr, "Note: Want to enable format %li/%i for encodings 0x%x.\n", rate, channels, encodings);
|
367
|
+
|
368
|
+
if(!(channels & MPG123_STEREO)) ch[1] = 0; /* {0,0} */
|
369
|
+
else if(!(channels & MPG123_MONO)) ch[0] = 1; /* {1,1} */
|
370
|
+
ratei = rate2num(mp, rate);
|
371
|
+
if(ratei < 0) return MPG123_BAD_RATE;
|
372
|
+
|
373
|
+
/* now match the encodings */
|
374
|
+
for(ic = 0; ic < 2; ++ic)
|
375
|
+
{
|
376
|
+
for(ie = 0; ie < MPG123_ENCODINGS; ++ie)
|
377
|
+
if(good_enc(my_encodings[ie]) && ((my_encodings[ie] & encodings) == my_encodings[ie]))
|
378
|
+
mp->audio_caps[ch[ic]][ratei][ie] = 1;
|
379
|
+
|
380
|
+
if(ch[0] == ch[1]) break; /* no need to do it again */
|
381
|
+
}
|
382
|
+
|
383
|
+
return MPG123_OK;
|
384
|
+
}
|
385
|
+
|
386
|
+
int attribute_align_arg mpg123_format_support(mpg123_handle *mh, long rate, int encoding)
|
387
|
+
{
|
388
|
+
if(mh == NULL) return 0;
|
389
|
+
else return mpg123_fmt_support(&mh->p, rate, encoding);
|
390
|
+
}
|
391
|
+
|
392
|
+
int attribute_align_arg mpg123_fmt_support(mpg123_pars *mp, long rate, int encoding)
|
393
|
+
{
|
394
|
+
int ch = 0;
|
395
|
+
int ratei, enci;
|
396
|
+
ratei = rate2num(mp, rate);
|
397
|
+
enci = enc2num(encoding);
|
398
|
+
if(mp == NULL || ratei < 0 || enci < 0) return 0;
|
399
|
+
if(mp->audio_caps[0][ratei][enci]) ch |= MPG123_MONO;
|
400
|
+
if(mp->audio_caps[1][ratei][enci]) ch |= MPG123_STEREO;
|
401
|
+
return ch;
|
402
|
+
}
|
403
|
+
|
404
|
+
/* Call this one to ensure that any valid format will be something different than this. */
|
405
|
+
void invalidate_format(struct audioformat *af)
|
406
|
+
{
|
407
|
+
af->encoding = 0;
|
408
|
+
af->rate = 0;
|
409
|
+
af->channels = 0;
|
410
|
+
}
|
411
|
+
|
412
|
+
/* Consider 24bit output needing 32bit output as temporary storage. */
|
413
|
+
off_t samples_to_storage(mpg123_handle *fr, off_t s)
|
414
|
+
{
|
415
|
+
if(fr->af.encoding & MPG123_ENC_24)
|
416
|
+
return s*4*fr->af.channels; /* 4 bytes per sample */
|
417
|
+
else
|
418
|
+
return samples_to_bytes(fr, s);
|
419
|
+
}
|
420
|
+
|
421
|
+
/* take into account: channels, bytes per sample -- NOT resampling!*/
|
422
|
+
off_t samples_to_bytes(mpg123_handle *fr , off_t s)
|
423
|
+
{
|
424
|
+
return s * fr->af.encsize * fr->af.channels;
|
425
|
+
}
|
426
|
+
|
427
|
+
off_t bytes_to_samples(mpg123_handle *fr , off_t b)
|
428
|
+
{
|
429
|
+
return b / fr->af.encsize / fr->af.channels;
|
430
|
+
}
|
431
|
+
|
432
|
+
|
433
|
+
#ifndef NO_32BIT
|
434
|
+
/* Remove every fourth byte, facilitating conversion from 32 bit to 24 bit integers.
|
435
|
+
This has to be aware of endianness, of course. */
|
436
|
+
static void chop_fourth_byte(struct outbuffer *buf)
|
437
|
+
{
|
438
|
+
unsigned char *wpos = buf->data;
|
439
|
+
unsigned char *rpos = buf->data;
|
440
|
+
#ifdef WORDS_BIGENDIAN
|
441
|
+
while((size_t) (rpos - buf->data + 4) <= buf->fill)
|
442
|
+
{
|
443
|
+
/* Really stupid: Copy, increment. Byte per byte. */
|
444
|
+
*wpos = *rpos;
|
445
|
+
wpos++; rpos++;
|
446
|
+
*wpos = *rpos;
|
447
|
+
wpos++; rpos++;
|
448
|
+
*wpos = *rpos;
|
449
|
+
wpos++; rpos++;
|
450
|
+
rpos++; /* Skip the lowest byte (last). */
|
451
|
+
}
|
452
|
+
#else
|
453
|
+
while((size_t) (rpos - buf->data + 4) <= buf->fill)
|
454
|
+
{
|
455
|
+
/* Really stupid: Copy, increment. Byte per byte. */
|
456
|
+
rpos++; /* Skip the lowest byte (first). */
|
457
|
+
*wpos = *rpos;
|
458
|
+
wpos++; rpos++;
|
459
|
+
*wpos = *rpos;
|
460
|
+
wpos++; rpos++;
|
461
|
+
*wpos = *rpos;
|
462
|
+
wpos++; rpos++;
|
463
|
+
}
|
464
|
+
#endif
|
465
|
+
buf->fill = wpos-buf->data;
|
466
|
+
}
|
467
|
+
#endif
|
468
|
+
|
469
|
+
void postprocess_buffer(mpg123_handle *fr)
|
470
|
+
{
|
471
|
+
/* Handle unsigned output formats via reshifting after decode here.
|
472
|
+
Also handle conversion to 24 bit. */
|
473
|
+
#ifndef NO_32BIT
|
474
|
+
if(fr->af.encoding == MPG123_ENC_UNSIGNED_32 || fr->af.encoding == MPG123_ENC_UNSIGNED_24)
|
475
|
+
{ /* 32bit signed -> unsigned */
|
476
|
+
size_t i;
|
477
|
+
int32_t *ssamples;
|
478
|
+
uint32_t *usamples;
|
479
|
+
ssamples = (int32_t*)fr->buffer.data;
|
480
|
+
usamples = (uint32_t*)fr->buffer.data;
|
481
|
+
debug("converting output to unsigned 32 bit integer");
|
482
|
+
for(i=0; i<fr->buffer.fill/sizeof(int32_t); ++i)
|
483
|
+
{
|
484
|
+
/* Different strategy since we don't have a larger type at hand.
|
485
|
+
Also watch out for silly +-1 fun because integer constants are signed in C90! */
|
486
|
+
if(ssamples[i] >= 0)
|
487
|
+
usamples[i] = (uint32_t)ssamples[i] + 2147483647+1;
|
488
|
+
/* The smalles value goes zero. */
|
489
|
+
else if(ssamples[i] == ((int32_t)-2147483647-1))
|
490
|
+
usamples[i] = 0;
|
491
|
+
/* Now -value is in the positive range of signed int ... so it's a possible value at all. */
|
492
|
+
else
|
493
|
+
usamples[i] = (uint32_t)2147483647+1 - (uint32_t)(-ssamples[i]);
|
494
|
+
}
|
495
|
+
/* Dumb brute force: A second pass for hacking off the last byte. */
|
496
|
+
if(fr->af.encoding == MPG123_ENC_UNSIGNED_24)
|
497
|
+
chop_fourth_byte(&fr->buffer);
|
498
|
+
}
|
499
|
+
else if(fr->af.encoding == MPG123_ENC_SIGNED_24)
|
500
|
+
{
|
501
|
+
/* We got 32 bit signed ... chop off for 24 bit signed. */
|
502
|
+
chop_fourth_byte(&fr->buffer);
|
503
|
+
}
|
504
|
+
#endif
|
505
|
+
#ifndef NO_16BIT
|
506
|
+
if(fr->af.encoding == MPG123_ENC_UNSIGNED_16)
|
507
|
+
{
|
508
|
+
size_t i;
|
509
|
+
short *ssamples;
|
510
|
+
unsigned short *usamples;
|
511
|
+
ssamples = (short*)fr->buffer.data;
|
512
|
+
usamples = (unsigned short*)fr->buffer.data;
|
513
|
+
debug("converting output to unsigned 16 bit integer");
|
514
|
+
for(i=0; i<fr->buffer.fill/sizeof(short); ++i)
|
515
|
+
{
|
516
|
+
long tmp = (long)ssamples[i]+32768;
|
517
|
+
usamples[i] = (unsigned short)tmp;
|
518
|
+
}
|
519
|
+
}
|
520
|
+
#endif
|
521
|
+
}
|