5 #include <vorbis/vorbisfile.h>
7 static void die(char *msg, ...)
11 vfprintf(stderr, msg, args);
21 err = ov_open(stdin, &vf, NULL, 0);
23 die("ov_open: error %d", err);
24 if (!ov_seekable(&vf))
25 die("Input is not seekable");
27 int nstr = ov_streams(&vf);
28 printf("Found %d logical streams\n", nstr);
29 for (int i=0; i<nstr; i++)
34 die("ov_info failed");
35 printf("Stream %d: v=%d chan=%d rate=%ld nbr=%ld rawsize=%Ld samples=%Ld\n", i,
36 vi->version, vi->channels, vi->rate, vi->bitrate_nominal,
37 ov_raw_total(&vf, i), ov_pcm_total(&vf, i));
40 vc = ov_comment(&vf, i);
42 die("ov_comment failed");
43 for (int j=0; j<vc->comments; j++)
44 printf("\t%.*s\n", vc->comment_lengths[j], vc->user_comments[j]);
47 printf("Decoding...\n");
51 printf("@%Ld #%ld ", ov_pcm_tell(&vf), ov_serialnumber(&vf, -1));
53 int e = ov_read(&vf, buf, sizeof(buf), 0, 2, 1, &bp);
54 printf("S%d >%d\n", bp, e);
58 printf("!!! HOLE DETECTED\n");
59 else if (e == OV_EBADLINK)
60 printf("!!! BAD LINK\n");