package ffmpeg-swresample

  1. Overview
  2. Docs

Functor building an implementation of the swresample structure with parameterized input an output audio data types

Parameters

module I : AudioData
module O : AudioData

Signature

type t = (I.t, O.t) ctx
val create : ?options:options list -> Avutil.Channel_layout.t -> ?in_sample_format:Avutil.Sample_format.t -> int -> Avutil.Channel_layout.t -> ?out_sample_format:Avutil.Sample_format.t -> int -> t

Swresample.create in_cl ~in_sample_format:in_sf in_sr out_cl ~out_sample_format:out_sf out_sr create a Swresample.t with in_cl channel layout, in_sf sample format and in_sr sample rate as input format and out_cl channel layout, out_sf sample format and out_sr sample rate as output format. If a sample format parameter is not provided, the sample format defined by the associated AudioData module is used.

Raise Error "Swresample input/output sample format undefined" if a sample format parameter is not provided and the associated AudioData module does not define a sample format as is the case for Bytes and Frame.

val from_codec : ?options:options list -> Avutil.audio Avcodec.params -> Avutil.Channel_layout.t -> ?out_sample_format:Avutil.Sample_format.t -> int -> t

Swresample.from_codec in_ac out_cl ~out_sample_format:out_sf out_sr do the same as Swresample.create with the in_ac audio codec properties as input format.

val to_codec : ?options:options list -> Avutil.Channel_layout.t -> ?in_sample_format:Avutil.Sample_format.t -> int -> Avutil.audio Avcodec.params -> t

Swresample.to_codec in_cl ~in_sample_format:in_sf in_sr out_ac do the same as Swresample.create with the out_ac audio codec properties as output format.

val from_codec_to_codec : ?options:options list -> Avutil.audio Avcodec.params -> Avutil.audio Avcodec.params -> t

Swresample.from_codec_to_codec in_ac out_ac do the same as Swresample.create with the in_ac audio codec properties as input format and the out_ac audio codec properties as output format.

val convert : ?offset:int -> ?length:int -> t -> I.t -> O.t

Swresample.convert rsp iad resample and convert the iad input audio data to the output audio data according to the rsp resampler context format.

Raise Error if the conversion failed.

val flush : t -> O.t

Swresample.convert rpsp flushes the last remaining data.

OCaml

Innovation. Community. Security.