{ "name": "libvorbis", "version": "1.3.7", "summary": "libvorbis: the Vorbis audio codec (libvorbis, libvorbisenc, libvorbisfile), for mkvtoolnix", "category": "library", "license": "BSD-3-Clause", "homepage": "https://xiph.org/vorbis/", "source": { "url": "https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz", "sha256": "b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b" }, "watch": {"kind": "index", "url": "https://downloads.xiph.org/releases/vorbis/", "regex": "libvorbis-([0-9]+\\.[0-9]+\\.[0-9]+)\\.tar\\.xz", "checksum": "https://downloads.xiph.org/releases/vorbis/SHA256SUMS"}, "deps": [ "libogg" ], "env_packages": [], "static": true, "nss": false, "check": "LDFLAGS=\"$LDFLAGS -lm\" check_lib 'vorbis vorbisenc vorbisfile ogg' 'vorbis/vorbisenc.h vorbis/vorbisfile.h math.h' 'vorbis_info vi; vorbis_comment vc; vorbis_dsp_state vd; vorbis_block vb; ogg_stream_state os; ogg_page og; ogg_packet op, h1, h2, h3; FILE *f = tmpfile(); vorbis_info_init(&vi); if (vorbis_encode_init_vbr(&vi, 1, 44100, 0.4f)) return 1; vorbis_comment_init(&vc); vorbis_comment_add_tag(&vc, \"TITLE\", \"bvs\"); vorbis_analysis_init(&vd, &vi); vorbis_block_init(&vd, &vb); ogg_stream_init(&os, 7); vorbis_analysis_headerout(&vd, &vc, &h1, &h2, &h3); ogg_stream_packetin(&os, &h1); ogg_stream_packetin(&os, &h2); ogg_stream_packetin(&os, &h3); while (ogg_stream_flush(&os, &og)) { fwrite(og.header, 1, og.header_len, f); fwrite(og.body, 1, og.body_len, f); } for (int done = 0, n = 0; !done;) { if (n < 44100) { float **b = vorbis_analysis_buffer(&vd, 1024); int k = 0; for (; k < 1024 && n < 44100; k++, n++) b[0][k] = (float) (0.5 * sin(2 * 3.14159265 * 440 * n / 44100.0)); vorbis_analysis_wrote(&vd, k); } else vorbis_analysis_wrote(&vd, 0); while (vorbis_analysis_blockout(&vd, &vb) == 1) { vorbis_analysis(&vb, NULL); vorbis_bitrate_addblock(&vb); while (vorbis_bitrate_flushpacket(&vd, &op)) { ogg_stream_packetin(&os, &op); while (ogg_stream_pageout(&os, &og)) { fwrite(og.header, 1, og.header_len, f); fwrite(og.body, 1, og.body_len, f); if (ogg_page_eos(&og)) done = 1; } } } } rewind(f); OggVorbis_File vf; if (ov_open(f, &vf, NULL, 0)) return 2; long total = 0; char pcm[4096]; int sec; long r; double peak = 0; while ((r = ov_read(&vf, pcm, sizeof pcm, 0, 2, 1, &sec)) > 0) { for (long i = 0; i + 1 < r; i += 2) { short s = (short) (pcm[i] | (pcm[i + 1] << 8)); if (fabs(s / 32768.0) > peak) peak = fabs(s / 32768.0); } total += r / 2; } const char *t = vorbis_comment_query(ov_comment(&vf, -1), \"TITLE\", 0); printf(\"libvorbis: %ld samples decoded, peak %.2f, title %s\\n\", total, peak, t ? t : \"none\"); return total != 44100 || peak < 0.4 || peak > 0.6 || !t || strcmp(t, \"bvs\")' && echo 'libvorbis 1.3.7: one second of a 440 Hz tone at 44.1 kHz encoded with libvorbisenc (VBR) into Ogg and decoded by libvorbisfile to 44100 samples of the same amplitude, its title tag read back, through check_lib'" }