DiscordPHP Documentation

OpusFFI
in package

Handles the decoding of Opus audio data using FFI (Foreign Function Interface).

Tags
todo

Table of Contents

Properties

$ffi  : FFI

Methods

__call()  : mixed
Magic method to redirect method calls to the FFI instance.
__construct()  : mixed
decode()  : string
Creates a FFI instance (code in C) to decode Opus audio data.
opus_decode()  : int
opus_decoder_create()  : mixed
opus_decoder_destroy()  : void
opus_packet_get_nb_frames()  : int
opus_packet_get_samples_per_frame()  : int

Properties

Methods

__call()

Magic method to redirect method calls to the FFI instance.

public __call(string $name, array<string|int, mixed> $arguments) : mixed
Parameters
$name : string
$arguments : array<string|int, mixed>

__construct()

public __construct() : mixed

decode()

Creates a FFI instance (code in C) to decode Opus audio data.

public decode(string|mixed $data[, int $channels = 2 ][, int $audioRate = 48000 ]) : string

By using the libopus library, this function decodes Opus-encoded audio data into PCM samples.

Parameters
$data : string|mixed

The Opus-encoded audio data to decode.

$channels : int = 2
$audioRate : int = 48000
Return values
string

The decoded PCM audio data as a string/binary.

opus_decode()

public opus_decode(mixed $st, mixed $data, int $len, mixed $pcm, int $frame_size, int $decode_fec) : int
Parameters
$st : mixed
$data : mixed
$len : int
$pcm : mixed
$frame_size : int
$decode_fec : int
Return values
int

opus_decoder_create()

public opus_decoder_create(int $Fs, int $channels, mixed $error) : mixed
Parameters
$Fs : int
$channels : int
$error : mixed

opus_decoder_destroy()

public opus_decoder_destroy(mixed $st) : void
Parameters
$st : mixed

opus_packet_get_nb_frames()

public opus_packet_get_nb_frames(mixed $packet, int $len) : int
Parameters
$packet : mixed
$len : int
Return values
int

opus_packet_get_samples_per_frame()

public opus_packet_get_samples_per_frame(mixed $data, int $Fs) : int
Parameters
$data : mixed
$Fs : int
Return values
int

        
On this page

Search results