dlzma: added fix for very rare out-of-bounds write in LZMA encoder (it can happen...
[iv.d.git] / dopus / optestx.d
blob890539ca3ae5ae6a135f05335a6847a1f04619cd
1 import iv.dopus;
3 import iv.alsa;
4 import iv.cmdcon;
5 import iv.vfs;
7 import xalsa;
10 // ////////////////////////////////////////////////////////////////////////// //
11 void main (string[] args) {
12 assert(args.length > 1);
14 OpusFile of = opusOpen(VFile(args[1]));
15 scope(exit) opusClose(of);
17 conwriteln("vendor: [", of.vendor, "]");
18 conwriteln("channels: ", of.channels);
19 conwritefln!"duration: %s:%02s"(of.duration/1000/60, of.duration/1000%60);
20 conwriteln("comment count: ", of.commentCount);
21 foreach (immutable cidx; 0..of.commentCount) conwriteln(" #", cidx, ": [", of.comment(cidx), "]");
23 version(noplay) {} else alsaOpen(of.channels);
24 version(noplay) {} else scope(exit) alsaClose();
26 //of.seek(25000);
28 long lasttime = -1;
29 for (;;) {
30 auto rd = of.readFrame();
31 if (rd.length == 0) break;
33 version(noplay) {} else {
34 if (lasttime != of.curtime) {
35 lasttime = of.curtime;
36 conwritef!"\r%s:%02s / %s:%02s"(lasttime/1000/60, lasttime/1000%60, of.duration/1000/60, of.duration/1000%60);
38 alsaWriteX(rd.ptr, cast(uint)rd.length/of.channels);
41 conwriteln;