Module Avutil.Channel_layout

Channel layouts: how many audio channels, which ones and in which order.

type layout = Channel_layout.t

The names of FFmpeg's layout masks, as a variant generated from FFmpeg's headers at build time. No function of this module takes or returns it.

type t

A channel layout. The value owns its own copy of an FFmpeg layout, shares nothing with the value or the object it was read from, is immutable, and is released when it is collected. Every function that returns a layout returns a fresh copy.

val standard_layouts : t list

Every standard layout FFmpeg lists, in FFmpeg's order. Built once when this module is loaded.

val stereo : t

The layout FFmpeg names "stereo".

val mono : t

The layout FFmpeg names "mono".

val five_point_one : t

The layout FFmpeg names "5.1".

val compare : t -> t -> bool

compare a b is an equality test, despite its name: true when FFmpeg finds the two layouts equal, false when they differ.

  • raises Error

    when FFmpeg finds one of the layouts invalid.

val find : string -> t

find name parses name as FFmpeg parses the description of a channel layout: a layout name such as "stereo" or "5.1", channel names joined by + such as "FL+FR", a channel count such as "4c", the value of a native mask such as "0x4".

  • raises Not_found

    when FFmpeg does not accept name.

val get_description : t -> string

FFmpeg's description of the layout, such as "stereo", in full whatever its length. find accepts it.

  • raises Error

    when FFmpeg cannot describe the layout.

val get_nb_channels : t -> int

The number of channels of the layout.

val get_default : int -> t

get_default n returns FFmpeg's default layout for n channels, such as stereo for 2. When FFmpeg has no standard layout of n channels, the result is a layout of n channels in unspecified order, for which get_mask returns None and get_nb_channels returns n.

  • raises Not_found

    when n is below 1, or above the largest C int.

val get_mask : t -> int64 option

The channel mask of the layout, one bit per channel, when the layout has FFmpeg's native channel order. None for any other order: unspecified, custom, ambisonic.