opus: add test
This commit is contained in:
parent
08e3576c8d
commit
169a797659
1 changed files with 31 additions and 0 deletions
|
@ -29,4 +29,35 @@ class Opus < Formula
|
|||
system "./configure", *args
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.cpp").write <<-EOS.undent
|
||||
#include <opus.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int err = 0;
|
||||
opus_int32 rate = 48000;
|
||||
int channels = 2;
|
||||
int app = OPUS_APPLICATION_AUDIO;
|
||||
OpusEncoder *enc;
|
||||
int ret;
|
||||
|
||||
enc = opus_encoder_create(rate, channels, app, &err);
|
||||
if (!(err < 0))
|
||||
{
|
||||
err = opus_encoder_ctl(enc, OPUS_SET_BITRATE(OPUS_AUTO));
|
||||
if (!(err < 0))
|
||||
{
|
||||
opus_encoder_destroy(enc);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
EOS
|
||||
system ENV.cxx, "-I#{include}/opus", "-L#{lib}", "-lopus",
|
||||
testpath/"test.cpp", "-o", "test"
|
||||
system "./test"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue