1 /+ 2 + Copyright 2023 – 2024 Aya Partridge 3 + Distributed under the Boost Software License, Version 1.0. 4 + (See accompanying file LICENSE_1_0.txt or copy at 5 + http://www.boost.org/LICENSE_1_0.txt) 6 +/ 7 module opus; 8 9 import bindbc.opus.config; 10 import bindbc.opus.codegen; 11 12 public import 13 opus.custom, 14 opus.defines, 15 opus.multistream, 16 opus.projection; 17 18 struct OpusEncoder; 19 20 struct OpusDecoder; 21 22 struct OpusRepacketiser; 23 alias OpusRepacketizer = OpusRepacketiser; 24 25 mixin(joinFnBinds((){ 26 FnBind[] ret = [ 27 {q{int}, q{opus_encoder_get_size}, q{int channels}}, 28 {q{OpusEncoder*}, q{opus_encoder_create}, q{int fs, int channels, int application, int* error}}, 29 {q{int}, q{opus_encoder_init}, q{OpusEncoder* st, int fs, int channels, int application}}, 30 {q{int}, q{opus_encode}, q{OpusEncoder* st, const(short)* pcm, int frameSize, ubyte* data, int maxDataBytes}}, 31 {q{int}, q{opus_encode_float}, q{OpusEncoder* st, const(float)* pcm, int frameSize, ubyte* data, int maxDataBytes}}, 32 {q{int}, q{opus_encoder_ctl}, q{OpusEncoder* st, int request, ...}}, 33 {q{int}, q{opus_decoder_get_size}, q{int channels}}, 34 {q{OpusDecoder*}, q{opus_decoder_create}, q{int fs, int channels, int* error}}, 35 {q{int}, q{opus_decoder_init}, q{OpusDecoder* st, int fs, int channels}}, 36 {q{int}, q{opus_decode}, q{OpusDecoder* st, const(ubyte)* data, int len, short* pcm, int frameSize, int decodeFEC}}, 37 {q{int}, q{opus_decode_float}, q{OpusDecoder* st, const(ubyte)* data, int len, float* pcm, int frameSize, int decodeFEC}}, 38 {q{int}, q{opus_decoder_ctl}, q{OpusDecoder* st, int request, ...}}, 39 {q{void}, q{opus_decoder_destroy}, q{OpusDecoder* st}}, 40 {q{int}, q{opus_packet_parse}, q{const(ubyte)* data, int len, ubyte* outTOC, ref const(ubyte)*[48] frames, ref short[48] size, int* payloadOffset}}, 41 {q{int}, q{opus_packet_get_bandwidth}, q{const(ubyte)* data}}, 42 {q{int}, q{opus_packet_get_samples_per_frame}, q{const(ubyte)* data, int fs}}, 43 {q{int}, q{opus_packet_get_nb_channels}, q{const(ubyte)* data}}, 44 {q{int}, q{opus_packet_get_nb_frames}, q{const(ubyte)* packet, int len}}, 45 {q{int}, q{opus_packet_get_nb_samples}, q{const(ubyte)* packet, int len, int fs}}, 46 {q{int}, q{opus_decoder_get_nb_samples}, q{const(OpusDecoder)* dec, const(ubyte)* packet, int len}}, 47 {q{void}, q{opus_pcm_soft_clip}, q{float* pcm, int frameSize, int channels, float* softClipMem}}, 48 {q{int}, q{opus_repacketizer_get_size}, q{}}, 49 {q{OpusRepacketiser*}, q{opus_repacketizer_init}, q{OpusRepacketiser* rp}, aliases: [q{opus_repacketiser_init}]}, 50 {q{OpusRepacketiser*}, q{opus_repacketizer_create}, q{}, aliases: [q{opus_repacketiser_create}]}, 51 {q{void}, q{opus_repacketizer_destroy}, q{OpusRepacketiser* rp}, aliases: [q{opus_repacketiser_destroy}]}, 52 {q{int}, q{opus_repacketizer_cat}, q{OpusRepacketiser* rp, const(ubyte)* data, int len}, aliases: [q{opus_repacketiser_cat}]}, 53 {q{int}, q{opus_repacketizer_out_range}, q{OpusRepacketiser* rp, int begin, int end, ubyte* data, int maxLen}, aliases: [q{opus_repacketiser_out_range}]}, 54 {q{int}, q{opus_repacketizer_get_nb_frames}, q{OpusRepacketiser* rp}, aliases: [q{opus_repacketiser_get_nb_frames}]}, 55 {q{int}, q{opus_repacketizer_out}, q{OpusRepacketiser* rp, ubyte* data, int maxLen}, aliases: [q{opus_repacketiser_out}]}, 56 {q{int}, q{opus_packet_pad}, q{ubyte* data, int len, int newLen}}, 57 {q{int}, q{opus_packet_unpad}, q{ubyte* data, int len}}, 58 {q{int}, q{opus_multistream_packet_pad}, q{ubyte* data, int len, int newLen, int nbStreams}}, 59 {q{int}, q{opus_multistream_packet_unpad}, q{ubyte* data, int len, int nbStreams}}, 60 ]; 61 return ret; 62 }())); 63 64 static if(!staticBinding): 65 import bindbc.loader; 66 67 mixin(makeDynloadFns("Opus", makeLibPaths(["opus"], ["Linux": ["libopus.so.0", "libopus.so.0.8.0"]]), [ 68 __MODULE__, 69 "opus.custom", 70 "opus.defines", 71 "opus.multistream", 72 "opus.projection", 73 ]));