Membrane Element: FFmpeg SWResample v0.1.0 Membrane.Element.FFmpeg.SWResample.Converter.Native View Source

This module provides nativly implemented converter utilizing library swresample

Link to this section Summary

Functions

Function that converts data according to a native handle

Link to this section Types

Link to this section Functions

Link to this function convert(native, data) View Source
convert(handle_t(), binary()) :: {:ok, binary()} | {:error, any()}

Function that converts data according to a native handle.

Expects the native handle, created with create/6 and binary data to convert.

Returns converted samples.

When converter is doing sample rate conversion, which requires “future” samples, samples will be buffered internally. In order to flush them, invoke convert/2 with an empty binary.

WARNING: Converter won’t flush anything until it has enough samples for conversion to happen, so you won’t be able to resample only a couple of samples. The actual threshold depends on conversion parameters.

Link to this function create(sink_format, sink_rate, sink_channels, src_format, src_rate, src_channels) View Source
create(integer(), integer(), integer(), integer(), integer(), integer()) ::
  {:ok, handle_t()} | {:error, any()}

Function creating native handler of converter.

Expects sample format (encoded as integer, using Membrane.Caps.Audio.Raw.Format.serialize/1), sample rate and number of channels for input and output data, respectively.

Currently supported formats are u8, s16le, s32le, f32le, f64le and s24le (input only)

Returns {:ok, native_handle} or {:error, reason}.