## GstAudio

GstAudio — Support library for audio elements

## Functions

void | (*GstAudioFormatPack) ()
void | (*GstAudioFormatUnpack) ()
void | gst_audio_info_init ()
gboolean | gst_audio_info_from_caps ()
GstCaps * | gst_audio_info_to_caps ()
gboolean | gst_audio_info_convert ()
const GstAudioFormatInfo * | gst_audio_format_get_info ()
GstAudioInfo * | gst_audio_info_copy ()
void | gst_audio_info_free ()
GstAudioInfo * | gst_audio_info_new ()
void | gst_audio_info_set_format ()
gboolean | gst_audio_info_is_equal ()
GstAudioFormat | gst_audio_format_build_integer ()
void | gst_audio_format_fill_silence ()
GstAudioFormat | gst_audio_format_from_string ()
const gchar * | gst_audio_format_to_string ()
#define | GST_AUDIO_FORMAT_INFO_DEPTH()
#define | GST_AUDIO_FORMAT_INFO_ENDIANNESS()
#define | GST_AUDIO_FORMAT_INFO_FLAGS()
#define | GST_AUDIO_FORMAT_INFO_FORMAT()
#define | GST_AUDIO_FORMAT_INFO_IS_FLOAT()
#define | GST_AUDIO_FORMAT_INFO_IS_INTEGER()
#define | GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN()
#define | GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN()
#define | GST_AUDIO_FORMAT_INFO_IS_SIGNED()
#define | GST_AUDIO_FORMAT_INFO_NAME()
#define | GST_AUDIO_FORMAT_INFO_WIDTH()
#define | GST_AUDIO_INFO_BPF()
#define | GST_AUDIO_INFO_BPS()
#define | GST_AUDIO_INFO_CHANNELS()
#define | GST_AUDIO_INFO_DEPTH()
#define | GST_AUDIO_INFO_FLAGS()
#define | GST_AUDIO_INFO_FORMAT()
#define | GST_AUDIO_INFO_NAME()
#define | GST_AUDIO_INFO_POSITION()
#define | GST_AUDIO_INFO_RATE()
#define | GST_AUDIO_INFO_WIDTH()
#define | GST_AUDIO_INFO_ENDIANNESS()
#define | GST_AUDIO_INFO_IS_BIG_ENDIAN()
#define | GST_AUDIO_INFO_IS_FLOAT()
#define | GST_AUDIO_INFO_IS_INTEGER()
#define | GST_AUDIO_INFO_IS_LITTLE_ENDIAN()
#define | GST_AUDIO_INFO_IS_SIGNED()
#define | GST_AUDIO_INFO_IS_UNPOSITIONED()
#define | GST_AUDIO_INFO_IS_VALID()
#define | GST_AUDIO_INFO_LAYOUT()
#define | GST_FRAMES_TO_CLOCK_TIME()
#define | GST_CLOCK_TIME_TO_FRAMES()
#define | GST_AUDIO_NE()
#define | GST_AUDIO_OE()
#define | GST_AUDIO_CAPS_MAKE()
GstBuffer * | gst_audio_buffer_clip ()
void | gst_audio_resampler_free ()
gsize | gst_audio_resampler_get_in_frames ()
gsize | gst_audio_resampler_get_max_latency ()
gsize | gst_audio_resampler_get_out_frames ()
GstAudioResampler * | gst_audio_resampler_new ()
void | gst_audio_resampler_options_set_quality ()
void | gst_audio_resampler_resample ()
void | gst_audio_resampler_reset ()
gboolean | gst_audio_resampler_update ()

## Types and Values

enum | GstAudioFlags
enum | GstAudioFormat
enum | GstAudioFormatFlags
struct | GstAudioFormatInfo
struct | GstAudioInfo
enum | GstAudioLayout
enum | GstAudioPackFlags
#define | GST_META_TAG_AUDIO_STR
#define | GST_META_TAG_AUDIO_CHANNELS_STR
#define | GST_META_TAG_AUDIO_RATE_STR
#define | GST_AUDIO_RATE_RANGE
#define | GST_AUDIO_CHANNELS_RANGE
#define | GST_AUDIO_FORMATS_ALL
#define | GST_AUDIO_DEF_RATE
#define | GST_AUDIO_DEF_CHANNELS
#define | GST_AUDIO_DEF_FORMAT
| GstAudioResampler
enum | GstAudioResamplerFilterInterpolation
enum | GstAudioResamplerFilterMode
enum | GstAudioResamplerFlags
enum | GstAudioResamplerMethod
#define | GST_AUDIO_RESAMPLER_OPT_CUBIC_B
#define | GST_AUDIO_RESAMPLER_OPT_CUBIC_C
#define | GST_AUDIO_RESAMPLER_OPT_CUTOFF
#define | GST_AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION
#define | GST_AUDIO_RESAMPLER_OPT_FILTER_MODE
#define | GST_AUDIO_RESAMPLER_OPT_FILTER_MODE_THRESHOLD
#define | GST_AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE
#define | GST_AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR
#define | GST_AUDIO_RESAMPLER_OPT_N_TAPS
#define | GST_AUDIO_RESAMPLER_OPT_STOP_ATTENUATION
#define | GST_AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH
#define | GST_AUDIO_RESAMPLER_QUALITY_DEFAULT
#define | GST_AUDIO_RESAMPLER_QUALITY_MAX
#define | GST_AUDIO_RESAMPLER_QUALITY_MIN

## Includes

    #include <gst/audio/audio.h>

## Description

This library contains some helper functions for audio elements.

## Functions

### GstAudioFormatPack ()

    void
    (*GstAudioFormatPack) (const GstAudioFormatInfo *info,
                           GstAudioPackFlags flags,
                           const gpointer src,
                           gpointer data,
                           gint length);

Packs `length` samples from `src` to the data array in format `info` . The samples from source have each channel interleaved and will be packed into `data` .

#### Parameters

info | a GstAudioFormatInfo |
src | a source array. | [array][element-type guint8]
data | pointer to the destination data. | [array][element-type guint8]
length | the amount of samples to pack. |

### GstAudioFormatUnpack ()

    void
    (*GstAudioFormatUnpack) (const GstAudioFormatInfo *info,
                             GstAudioPackFlags flags,
                             gpointer dest,
                             const gpointer data,
                             gint length);

Unpacks `length` samples from the given data of format `info` . The samples will be unpacked into `dest` which each channel interleaved. `dest` should at least be big enough to hold `length` * channels * size(unpack_format) bytes.

#### Parameters

info | a GstAudioFormatInfo |
dest | a destination array. | [array][element-type guint8]
data | pointer to the audio data. | [array][element-type guint8]
length | the amount of samples to unpack. |

### gst_audio_info_init ()

    void
    gst_audio_info_init (GstAudioInfo *info);

Initialize `info` with default values.

#### Parameters

info | a GstAudioInfo |

### gst_audio_info_from_caps ()

    gboolean
    gst_audio_info_from_caps (GstAudioInfo *info,
                              const GstCaps *caps);

Parse `caps` and update `info` .

#### Parameters

info | a GstAudioInfo |
caps | a GstCaps |

#### Returns

TRUE if `caps` could be parsed

### gst_audio_info_to_caps ()

    GstCaps *
    gst_audio_info_to_caps (const GstAudioInfo *info);

Convert the values of `info` into a GstCaps.

#### Parameters

info | a GstAudioInfo |

#### Returns

the new GstCaps containing the info of `info` .

[transfer full]

### gst_audio_info_convert ()

    gboolean
    gst_audio_info_convert (const GstAudioInfo *info,
                            GstFormat src_fmt,
                            gint64 src_val,
                            GstFormat dest_fmt,
                            gint64 *dest_val);

Converts among various GstFormat types. This function handles GST_FORMAT_BYTES, GST_FORMAT_TIME, and GST_FORMAT_DEFAULT. For raw audio, GST_FORMAT_DEFAULT corresponds to audio frames. This function can be used to handle pad queries of the type GST_QUERY_CONVERT.

#### Parameters

info | a GstAudioInfo |
src_fmt | GstFormat of the `src_val` |
src_val | value to convert |
dest_fmt | GstFormat of the `dest_val` |
dest_val | pointer to destination value |

#### Returns

TRUE if the conversion was successful.

### gst_audio_format_get_info ()

    const GstAudioFormatInfo *
    gst_audio_format_get_info (GstAudioFormat format);

Get the GstAudioFormatInfo for `format`

#### Parameters

format | a GstAudioFormat |

#### Returns

The GstAudioFormatInfo for `format` .

### gst_audio_info_copy ()

    GstAudioInfo *
    gst_audio_info_copy (const GstAudioInfo *info);

Copy a GstAudioInfo structure.

#### Parameters

info | a GstAudioInfo |

#### Returns

a new GstAudioInfo. free with gst_audio_info_free.

### gst_audio_info_free ()

    void
    gst_audio_info_free (GstAudioInfo *info);

Free a GstAudioInfo structure previously allocated with `gst_audio_info_new()` or `gst_audio_info_copy()`.

#### Parameters

info | a GstAudioInfo |

### gst_audio_info_new ()

    GstAudioInfo *
    gst_audio_info_new (void);

Allocate a new GstAudioInfo that is also initialized with `gst_audio_info_init()`.

#### Returns

a new GstAudioInfo. free with `gst_audio_info_free()`.

### gst_audio_info_set_format ()

    void
    gst_audio_info_set_format (GstAudioInfo *info,
                               GstAudioFormat format,
                               gint rate,
                               gint channels,
                               const GstAudioChannelPosition *position);

Set the default info for the audio info of `format` and `rate` and `channels` .

Note: This initializes `info` first, no values are preserved.

#### Parameters

info | a GstAudioInfo |
format | the format |
rate | the samplerate |
channels | the number of channels |
position | the channel positions |

### gst_audio_info_is_equal ()

    gboolean
    gst_audio_info_is_equal (const GstAudioInfo *info,
                             const GstAudioInfo *other);

Compares two GstAudioInfo and returns whether they are equal or not

#### Parameters

info | a GstAudioInfo |
other | a GstAudioInfo |

#### Returns

`TRUE` if `info` and `other` are equal, else `FALSE`.

Since: 1.2

### gst_audio_format_build_integer ()

    GstAudioFormat
    gst_audio_format_build_integer (gboolean sign,
                                    gint endianness,
                                    gint width,
                                    gint depth);

Construct a GstAudioFormat with given parameters.

#### Parameters

sign | signed or unsigned format |
endianness | G_LITTLE_ENDIAN or G_BIG_ENDIAN |
width | amount of bits used per sample |
depth | amount of used bits in `width` |

#### Returns

a GstAudioFormat or GST_AUDIO_FORMAT_UNKNOWN when no audio format exists with the given parameters.

### gst_audio_format_fill_silence ()

    void
    gst_audio_format_fill_silence (const GstAudioFormatInfo *info,
                                   gpointer dest,
                                   gsize length);

Fill `length` bytes in `dest` with silence samples for `info` .

#### Parameters

info | a GstAudioFormatInfo |
dest | a destination to fill. | [array length=length][element-type guint8]
length | the length to fill |

### gst_audio_format_from_string ()

    GstAudioFormat
    gst_audio_format_from_string (const gchar *format);

Convert the `format` string to its GstAudioFormat.

#### Parameters

format | a format string |

#### Returns

the GstAudioFormat for `format` or GST_AUDIO_FORMAT_UNKNOWN when the string is not a known format.

### gst_audio_format_to_string ()

    const gchar *
    gst_audio_format_to_string (GstAudioFormat format);

### GST_AUDIO_FORMAT_INFO_DEPTH()

    #define GST_AUDIO_FORMAT_INFO_DEPTH(info)            ((info)->depth)

### GST_AUDIO_FORMAT_INFO_ENDIANNESS()

    #define GST_AUDIO_FORMAT_INFO_ENDIANNESS(info)       ((info)->endianness)

### GST_AUDIO_FORMAT_INFO_FLAGS()

    #define GST_AUDIO_FORMAT_INFO_FLAGS(info)            ((info)->flags)

### GST_AUDIO_FORMAT_INFO_FORMAT()

    #define GST_AUDIO_FORMAT_INFO_FORMAT(info)           ((info)->format)

### GST_AUDIO_FORMAT_INFO_IS_FLOAT()

    #define GST_AUDIO_FORMAT_INFO_IS_FLOAT(info)         !!((info)->flags & GST_AUDIO_FORMAT_FLAG_FLOAT)

### GST_AUDIO_FORMAT_INFO_IS_INTEGER()

    #define GST_AUDIO_FORMAT_INFO_IS_INTEGER(info)       !!((info)->flags & GST_AUDIO_FORMAT_FLAG_INTEGER)

### GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN()

    #define GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN(info)    ((info)->endianness == G_BIG_ENDIAN)

### GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN()

    #define GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN(info) ((info)->endianness == G_LITTLE_ENDIAN)

### GST_AUDIO_FORMAT_INFO_IS_SIGNED()

    #define GST_AUDIO_FORMAT_INFO_IS_SIGNED(info)        !!((info)->flags & GST_AUDIO_FORMAT_FLAG_SIGNED)

### GST_AUDIO_FORMAT_INFO_NAME()

    #define GST_AUDIO_FORMAT_INFO_NAME(info)             ((info)->name)

### GST_AUDIO_FORMAT_INFO_WIDTH()

    #define GST_AUDIO_FORMAT_INFO_WIDTH(info)            ((info)->width)

### GST_AUDIO_INFO_BPF()

    #define GST_AUDIO_INFO_BPF(info)             ((info)->bpf)

### GST_AUDIO_INFO_BPS()

    #define GST_AUDIO_INFO_BPS(info)             (GST_AUDIO_INFO_DEPTH(info) >> 3)

### GST_AUDIO_INFO_CHANNELS()

    #define GST_AUDIO_INFO_CHANNELS(info)        ((info)->channels)

### GST_AUDIO_INFO_DEPTH()

    #define GST_AUDIO_INFO_DEPTH(i)              (GST_AUDIO_FORMAT_INFO_DEPTH((i)->finfo))

### GST_AUDIO_INFO_FLAGS()

    #define GST_AUDIO_INFO_FLAGS(info)           ((info)->flags)

### GST_AUDIO_INFO_FORMAT()

    #define GST_AUDIO_INFO_FORMAT(i)             (GST_AUDIO_FORMAT_INFO_FORMAT((i)->finfo))

### GST_AUDIO_INFO_NAME()

    #define GST_AUDIO_INFO_NAME(i)               (GST_AUDIO_FORMAT_INFO_NAME((i)->finfo))

### GST_AUDIO_INFO_POSITION()

    #define GST_AUDIO_INFO_POSITION(info,c)      ((info)->position[c])

### GST_AUDIO_INFO_RATE()

    #define GST_AUDIO_INFO_RATE(info)            ((info)->rate)

### GST_AUDIO_INFO_WIDTH()

    #define GST_AUDIO_INFO_WIDTH(i)              (GST_AUDIO_FORMAT_INFO_WIDTH((i)->finfo))

### GST_AUDIO_INFO_ENDIANNESS()

    #define GST_AUDIO_INFO_ENDIANNESS(i)         (GST_AUDIO_FORMAT_INFO_ENDIANNESS((i)->finfo))

### GST_AUDIO_INFO_IS_BIG_ENDIAN()

    #define GST_AUDIO_INFO_IS_BIG_ENDIAN(i)      (GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN((i)->finfo))

### GST_AUDIO_INFO_IS_FLOAT()

    #define GST_AUDIO_INFO_IS_FLOAT(i)           (GST_AUDIO_FORMAT_INFO_IS_FLOAT((i)->finfo))

### GST_AUDIO_INFO_IS_INTEGER()

    #define GST_AUDIO_INFO_IS_INTEGER(i)         (GST_AUDIO_FORMAT_INFO_IS_INTEGER((i)->finfo))

### GST_AUDIO_INFO_IS_LITTLE_ENDIAN()

    #define GST_AUDIO_INFO_IS_LITTLE_ENDIAN(i)   (GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN((i)->finfo))

### GST_AUDIO_INFO_IS_SIGNED()

    #define GST_AUDIO_INFO_IS_SIGNED(i)          (GST_AUDIO_FORMAT_INFO_IS_SIGNED((i)->finfo))

### GST_AUDIO_INFO_IS_UNPOSITIONED()

    #define GST_AUDIO_INFO_IS_UNPOSITIONED(info) ((info)->flags & GST_AUDIO_FLAG_UNPOSITIONED)

### GST_AUDIO_INFO_IS_VALID()

    #define GST_AUDIO_INFO_IS_VALID(i)           ((i)->finfo != NULL && (i)->rate > 0 && (i)->channels > 0 && (i)->bpf > 0)

### GST_AUDIO_INFO_LAYOUT()

    #define GST_AUDIO_INFO_LAYOUT(info)          ((info)->layout)

### GST_FRAMES_TO_CLOCK_TIME()

    #define             GST_FRAMES_TO_CLOCK_TIME(frames, rate)

Calculate clocktime from sample `frames` and `rate` .

#### Parameters

frames | sample frames |
rate | sampling rate |

### GST_CLOCK_TIME_TO_FRAMES()

    #define             GST_CLOCK_TIME_TO_FRAMES(clocktime, rate)

Calculate frames from `clocktime` and sample `rate` .

#### Parameters

clocktime | clock time |
rate | sampling rate |

### GST_AUDIO_NE()

    # define GST_AUDIO_NE(s) G_STRINGIFY(s)"LE"

Turns audio format string `s` into the format string for native endianness.

#### Parameters

s | format string without endianness marker |

### GST_AUDIO_OE()

    # define GST_AUDIO_OE(s) G_STRINGIFY(s)"BE"

Turns audio format string `s` into the format string for other endianness.

#### Parameters

s | format string without endianness marker |

### GST_AUDIO_CAPS_MAKE()

    #define             GST_AUDIO_CAPS_MAKE(format)

Generic caps string for audio, for use in pad templates.

#### Parameters

format | string format that describes the sample layout, as string (e.g. "S16LE", "S8", etc.) |

### gst_audio_buffer_clip ()

    GstBuffer *
    gst_audio_buffer_clip (GstBuffer *buffer,
                           const GstSegment *segment,
                           gint rate,
                           gint bpf);

Clip the buffer to the given `GstSegment`.

After calling this function the caller does not own a reference to `buffer` anymore.

#### Parameters

buffer | The buffer to clip. | [transfer full]
segment | Segment in `GST_FORMAT_TIME` or `GST_FORMAT_DEFAULT` to which the buffer should be clipped. |
rate | sample rate. |
bpf | size of one audio frame in bytes. This is the size of one sample * number of channels. |

#### Returns

`NULL` if the buffer is completely outside the configured segment, otherwise the clipped buffer is returned.

If the buffer has no timestamp, it is assumed to be inside the segment and is not clipped.

[transfer full]

### gst_audio_resampler_free ()

    void
    gst_audio_resampler_free (GstAudioResampler *resampler);

Free a previously allocated GstAudioResampler `resampler` .

#### Parameters

resampler | a GstAudioResampler |

Since: 1.6

### gst_audio_resampler_get_in_frames ()

    gsize
    gst_audio_resampler_get_in_frames (GstAudioResampler *resampler,
                                       gsize out_frames);

Get the number of input frames that would currently be needed to produce `out_frames` from `resampler` .

#### Parameters

resampler | a GstAudioResampler |
out_frames | number of input frames |

#### Returns

The number of input frames needed for producing `out_frames` of data from `resampler` .

### gst_audio_resampler_get_max_latency ()

    gsize
    gst_audio_resampler_get_max_latency (GstAudioResampler *resampler);

Get the maximum number of input samples that the resampler would need before producing output.

#### Parameters

resampler | a GstAudioResampler |

#### Returns

the latency of `resampler` as expressed in the number of frames.

### gst_audio_resampler_get_out_frames ()

    gsize
    gst_audio_resampler_get_out_frames (GstAudioResampler *resampler,
                                        gsize in_frames);

Get the number of output frames that would be currently available when `in_frames` are given to `resampler` .

#### Parameters

resampler | a GstAudioResampler |
in_frames | number of input frames |

#### Returns

The number of frames that would be availabe after giving `in_frames` as input to `resampler` .

### gst_audio_resampler_new ()

    GstAudioResampler *
    gst_audio_resampler_new (GstAudioResamplerMethod method,
                             GstAudioResamplerFlags flags,
                             GstAudioFormat format,
                             gint channels,
                             gint in_rate,
                             gint out_rate,
                             GstStructure *options);

Make a new resampler.

#### Parameters

method | a GstAudioResamplerMethod |
flags | GstAudioResamplerFlags |
in_rate | input rate |
out_rate | output rate |
options | extra options |

#### Returns

`TRUE` on success.

[skip][transfer full]

### gst_audio_resampler_options_set_quality ()

    void
    gst_audio_resampler_options_set_quality
                                   (GstAudioResamplerMethod method,
                                    guint quality,
                                    gint in_rate,
                                    gint out_rate,
                                    GstStructure *options);

Set the parameters for resampling from `in_rate` to `out_rate` using `method` for `quality` in `options` .

#### Parameters

method | a GstAudioResamplerMethod |
quality | the quality |
in_rate | the input rate |
out_rate | the output rate |
options | a GstStructure |

### gst_audio_resampler_resample ()

    void
    gst_audio_resampler_resample (GstAudioResampler *resampler,
                                  gpointer in[],
                                  gsize in_frames,
                                  gpointer out[],
                                  gsize out_frames);

Perform resampling on `in_frames` frames in `in` and write `out_frames` to `out` .

In case the samples are interleaved, `in` and `out` must point to an array with a single element pointing to a block of interleaved samples.

If non-interleaved samples are used, `in` and `out` must point to an array with pointers to memory blocks, one for each channel.

`in` may be `NULL`, in which case `in_frames` of silence samples are pushed into the resampler.

This function always produces `out_frames` of output and consumes `in_frames` of input. Use `gst_audio_resampler_get_out_frames()` and `gst_audio_resampler_get_in_frames()` to make sure `in_frames` and `out_frames` are matching and `in` and `out` point to enough memory.

#### Parameters

resampler | a GstAudioResampler |
in | input samples |
in_frames | number of input frames |
out | output samples |
out_frames | number of output frames |

### gst_audio_resampler_reset ()

    void
    gst_audio_resampler_reset (GstAudioResampler *resampler);

Reset `resampler` to the state it was when it was first created, discarding all sample history.

#### Parameters

resampler | a GstAudioResampler |

### gst_audio_resampler_update ()

    gboolean
    gst_audio_resampler_update (GstAudioResampler *resampler,
                                gint in_rate,
                                gint out_rate,
                                GstStructure *options);

Update the resampler parameters for `resampler` . This function should not be called concurrently with any other function on `resampler` .

When `in_rate` or `out_rate` is 0, its value is unchanged.

When `options` is `NULL`, the previously configured options are reused.

#### Parameters

resampler | a GstAudioResampler |
in_rate | new input rate |
out_rate | new output rate |
options | new options or `NULL` |

#### Returns

`TRUE` if the new parameters could be set

## Types and Values

### enum GstAudioFlags

Extra audio flags

#### Members

GST_AUDIO_FLAG_NONE | no valid flag |
GST_AUDIO_FLAG_UNPOSITIONED | the position array explicitly contains unpositioned channels. |

### enum GstAudioFormat

Enum value describing the most common audio formats.

#### Members

GST_AUDIO_FORMAT_UNKNOWN | unknown or unset audio format |
GST_AUDIO_FORMAT_ENCODED | encoded audio format |
GST_AUDIO_FORMAT_S8 | 8 bits in 8 bits, signed |
GST_AUDIO_FORMAT_U8 | 8 bits in 8 bits, unsigned |
GST_AUDIO_FORMAT_S16LE | 16 bits in 16 bits, signed, little endian |
GST_AUDIO_FORMAT_S16BE | 16 bits in 16 bits, signed, big endian |
GST_AUDIO_FORMAT_U16LE | 16 bits in 16 bits, unsigned, little endian |
GST_AUDIO_FORMAT_U16BE | 16 bits in 16 bits, unsigned, big endian |
GST_AUDIO_FORMAT_S24_32LE | 24 bits in 32 bits, signed, little endian |
GST_AUDIO_FORMAT_S24_32BE | 24 bits in 32 bits, signed, big endian |
GST_AUDIO_FORMAT_U24_32LE | 24 bits in 32 bits, unsigned, little endian |
GST_AUDIO_FORMAT_U24_32BE | 24 bits in 32 bits, unsigned, big endian |
GST_AUDIO_FORMAT_S32LE | 32 bits in 32 bits, signed, little endian |
GST_AUDIO_FORMAT_S32BE | 32 bits in 32 bits, signed, big endian |
GST_AUDIO_FORMAT_U32LE | 32 bits in 32 bits, unsigned, little endian |
GST_AUDIO_FORMAT_U32BE | 32 bits in 32 bits, unsigned, big endian |
GST_AUDIO_FORMAT_S24LE | 24 bits in 24 bits, signed, little endian |
GST_AUDIO_FORMAT_S24BE | 24 bits in 24 bits, signed, big endian |
GST_AUDIO_FORMAT_U24LE | 24 bits in 24 bits, unsigned, little endian |
GST_AUDIO_FORMAT_U24BE | 24 bits in 24 bits, unsigned, big endian |
GST_AUDIO_FORMAT_S20LE | 20 bits in 24 bits, signed, little endian |
GST_AUDIO_FORMAT_S20BE | 20 bits in 24 bits, signed, big endian |
GST_AUDIO_FORMAT_U20LE | 20 bits in 24 bits, unsigned, little endian |
GST_AUDIO_FORMAT_U20BE | 20 bits in 24 bits, unsigned, big endian |
GST_AUDIO_FORMAT_S18LE | 18 bits in 24 bits, signed, little endian |
GST_AUDIO_FORMAT_S18BE | 18 bits in 24 bits, signed, big endian |
GST_AUDIO_FORMAT_U18LE | 18 bits in 24 bits, unsigned, little endian |
GST_AUDIO_FORMAT_U18BE | 18 bits in 24 bits, unsigned, big endian |
GST_AUDIO_FORMAT_F32LE | 32-bit floating point samples, little endian |
GST_AUDIO_FORMAT_F32BE | 32-bit floating point samples, big endian |
GST_AUDIO_FORMAT_F64LE | 64-bit floating point samples, little endian |
GST_AUDIO_FORMAT_F64BE | 64-bit floating point samples, big endian |
GST_AUDIO_FORMAT_S16 | 16 bits in 16 bits, signed, native endianness |
GST_AUDIO_FORMAT_U16 | 16 bits in 16 bits, unsigned, native endianness |
GST_AUDIO_FORMAT_S24_32 | 24 bits in 32 bits, signed, native endianness |
GST_AUDIO_FORMAT_U24_32 | 24 bits in 32 bits, unsigned, native endianness |
GST_AUDIO_FORMAT_S32 | 32 bits in 32 bits, signed, native endianness |
GST_AUDIO_FORMAT_U32 | 32 bits in 32 bits, unsigned, native endianness |
GST_AUDIO_FORMAT_S24 | 24 bits in 24 bits, signed, native endianness |
GST_AUDIO_FORMAT_U24 | 24 bits in 24 bits, unsigned, native endianness |
GST_AUDIO_FORMAT_S20 | 20 bits in 24 bits, signed, native endianness |
GST_AUDIO_FORMAT_U20 | 20 bits in 24 bits, unsigned, native endianness |
GST_AUDIO_FORMAT_S18 | 18 bits in 24 bits, signed, native endianness |
GST_AUDIO_FORMAT_U18 | 18 bits in 24 bits, unsigned, native endianness |
GST_AUDIO_FORMAT_F32 | 32-bit floating point samples, native endianness |
GST_AUDIO_FORMAT_F64 | 64-bit floating point samples, native endianness |

### enum GstAudioFormatFlags

The different audio flags that a format info can have.

#### Members

GST_AUDIO_FORMAT_FLAG_INTEGER | integer samples |
GST_AUDIO_FORMAT_FLAG_FLOAT | float samples |
GST_AUDIO_FORMAT_FLAG_SIGNED | signed samples |
GST_AUDIO_FORMAT_FLAG_COMPLEX | complex layout |
GST_AUDIO_FORMAT_FLAG_UNPACK | the format can be used in GstAudioFormatUnpack and GstAudioFormatPack functions |

### struct GstAudioFormatInfo

    struct GstAudioFormatInfo {
      GstAudioFormat format;
      const gchar *name;
      const gchar *description;
      GstAudioFormatFlags flags;
      gint endianness;
      gint width;
      gint depth;
      guint8 silence[8];

      GstAudioFormat unpack_format;
      GstAudioFormatUnpack unpack_func;
      GstAudioFormatPack pack_func;
    };

Information for an audio format.

#### Members

GstAudioFormat `format`; | GstAudioFormat |
const gchar *`name`; | string representation of the format |
const gchar *`description`; | user readable description of the format |
GstAudioFormatFlags `flags`; | GstAudioFormatFlags |
gint `endianness`; | the endianness |
gint `width`; | amount of bits used for one sample |
gint `depth`; | amount of valid bits in `width` |
guint8 `silence`[8]; | `width` /8 bytes with 1 silent sample |
GstAudioFormat `unpack_format`; | the format of the unpacked samples |
GstAudioFormatUnpack `unpack_func`; | function to unpack samples |
GstAudioFormatPack `pack_func`; | function to pack samples |

### struct GstAudioInfo

    struct GstAudioInfo {
      const GstAudioFormatInfo *finfo;
      GstAudioFlags             flags;
      GstAudioLayout            layout;
      gint                      rate;
      gint                      channels;
      gint                      bpf;
      GstAudioChannelPosition   position[64];
    };

Information describing audio properties. This information can be filled in from GstCaps with `gst_audio_info_from_caps()`.

Use the provided macros to access the info in this structure.

#### Members

const GstAudioFormatInfo *`finfo`; | the format info of the audio |
GstAudioFlags `flags`; | additional audio flags |
GstAudioLayout `layout`; | audio layout |
gint `rate`; | the audio sample rate |
gint `channels`; | the number of channels |
gint `bpf`; | the number of bytes for one frame, this is the size of one sample * `channels` |
GstAudioChannelPosition `position`[64]; | the positions for each channel |

### enum GstAudioLayout

Layout of the audio samples for the different channels.

#### Members

GST_AUDIO_LAYOUT_INTERLEAVED | interleaved audio |
GST_AUDIO_LAYOUT_NON_INTERLEAVED | non-interleaved audio |

### enum GstAudioPackFlags

The different flags that can be used when packing and unpacking.

#### Members

GST_AUDIO_PACK_FLAG_NONE | No flag |
GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE | When the source has a smaller depth than the target format, set the least significant bits of the target to 0. This is likely sightly faster but less accurate. When this flag is not specified, the most significant bits of the source are duplicated in the least significant bits of the destination. |

### GST_META_TAG_AUDIO_STR

    #define GST_META_TAG_AUDIO_STR "audio"

This metadata is relevant for audio streams.

Since: 1.2

### GST_META_TAG_AUDIO_CHANNELS_STR

    #define GST_META_TAG_AUDIO_CHANNELS_STR "channels"

This metadata stays relevant as long as channels are unchanged.

Since: 1.2

### GST_META_TAG_AUDIO_RATE_STR

    #define GST_META_TAG_AUDIO_RATE_STR "rate"

This metadata stays relevant as long as sample rate is unchanged.

Since: 1.8

### GST_AUDIO_RATE_RANGE

    #define GST_AUDIO_RATE_RANGE "(int) [ 1, max ]"

Maximum range of allowed sample rates, for use in template caps strings.

### GST_AUDIO_CHANNELS_RANGE

    #define GST_AUDIO_CHANNELS_RANGE "(int) [ 1, max ]"

Maximum range of allowed channels, for use in template caps strings.

### GST_AUDIO_FORMATS_ALL

    #define             GST_AUDIO_FORMATS_ALL

List of all audio formats, for use in template caps strings.

### GST_AUDIO_DEF_RATE

    #define GST_AUDIO_DEF_RATE 44100

Standard sampling rate used in consumer audio.

### GST_AUDIO_DEF_CHANNELS

    #define GST_AUDIO_DEF_CHANNELS 2

Standard number of channels used in consumer audio.

### GST_AUDIO_DEF_FORMAT

    #define GST_AUDIO_DEF_FORMAT "S16LE"

Standard format used in consumer audio.

### GstAudioResampler

    typedef struct {
      GstAudioResamplerMethod method;
      GstAudioResamplerFlags flags;
      GstAudioFormat format;
      GstStructure *options;
      gint format_index;
      gint channels;
      gint in_rate;
      gint out_rate;

      gint bps;
      gint ostride;

      GstAudioResamplerFilterMode filter_mode;
      guint filter_threshold;
      GstAudioResamplerFilterInterpolation filter_interpolation;

      gdouble cutoff;
      gdouble kaiser_beta;
      /* for cubic */
      gdouble b, c;

      /* temp taps */
      gpointer tmp_taps;

      /* oversampled main filter table */
      gint oversample;
      gint n_taps;
      gpointer taps;
      gpointer taps_mem;
      gsize taps_stride;
      gint n_phases;
      gint alloc_taps;
      gint alloc_phases;

      /* cached taps */
      gpointer *cached_phases;
      gpointer cached_taps;
      gpointer cached_taps_mem;
      gsize cached_taps_stride;

      ConvertTapsFunc convert_taps;
      InterpolateFunc interpolate;
      DeinterleaveFunc deinterleave;
      ResampleFunc resample;

      gint blocks;
      gint inc;
      gint samp_inc;
      gint samp_frac;
      gint samp_index;
      gint samp_phase;
      gint skip;

      gpointer samples;
      gsize samples_len;
      gsize samples_avail;
      gpointer *sbuf;
    } GstAudioResampler;

### enum GstAudioResamplerFilterInterpolation

The different filter interpolation methods.

#### Members

GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_NONE | no interpolation |
GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_LINEAR | linear interpolation of the filter coeficients. |
GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC | cubic interpolation of the filter coeficients. |

### enum GstAudioResamplerFilterMode

Select for the filter tables should be set up.

#### Members

GST_AUDIO_RESAMPLER_FILTER_MODE_INTERPOLATED | Use interpolated filter tables. This uses less memory but more CPU and is slightly less accurate but it allows for more efficient variable rate resampling with `gst_audio_resampler_update()`. |
GST_AUDIO_RESAMPLER_FILTER_MODE_FULL | Use full filter table. This uses more memory but less CPU. |
GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO | Automatically choose between interpolated and full filter tables. |

### enum GstAudioResamplerFlags

Different resampler flags.

#### Members

GST_AUDIO_RESAMPLER_FLAG_NONE | no flags |
GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN | input samples are non-interleaved. an array of blocks of samples, one for each channel, should be passed to the resample function. |
GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT | output samples are non-interleaved. an array of blocks of samples, one for each channel, should be passed to the resample function. |
GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE | optimize for dynamic updates of the sample rates with `gst_audio_resampler_update()`. This will select an interpolating filter when GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO is configured. |

### enum GstAudioResamplerMethod

Different subsampling and upsampling methods

#### Members

GST_AUDIO_RESAMPLER_METHOD_NEAREST | Duplicates the samples when upsampling and drops when downsampling |
GST_AUDIO_RESAMPLER_METHOD_LINEAR | Uses linear interpolation to reconstruct missing samples and averaging to downsample |
GST_AUDIO_RESAMPLER_METHOD_CUBIC | Uses cubic interpolation |
GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL | Uses Blackman-Nuttall windowed sinc interpolation |
GST_AUDIO_RESAMPLER_METHOD_KAISER | Uses Kaiser windowed sinc interpolation |

Since: 1.6

### GST_AUDIO_RESAMPLER_OPT_CUBIC_B

    #define GST_AUDIO_RESAMPLER_OPT_CUBIC_B      "GstAudioResampler.cubic-b"

G_TYPE_DOUBLE, B parameter of the cubic filter. Values between 0.0 and 2.0 are accepted. 1.0 is the default.

Below are some values of popular filters: B C Hermite 0.0 0.0 Spline 1.0 0.0 Catmull-Rom 0.0 1/2

### GST_AUDIO_RESAMPLER_OPT_CUBIC_C

    #define GST_AUDIO_RESAMPLER_OPT_CUBIC_C      "GstAudioResampler.cubic-c"

G_TYPE_DOUBLE, C parameter of the cubic filter. Values between 0.0 and 2.0 are accepted. 0.0 is the default.

See GST_AUDIO_RESAMPLER_OPT_CUBIC_B for some more common values

### GST_AUDIO_RESAMPLER_OPT_CUTOFF

    #define GST_AUDIO_RESAMPLER_OPT_CUTOFF      "GstAudioResampler.cutoff"

G_TYPE_DOUBLE, Cutoff parameter for the filter. 0.940 is the default.

### GST_AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION

    #define GST_AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION "GstAudioResampler.filter-interpolation"

GST_TYPE_AUDIO_RESAMPLER_INTERPOLATION: how the filter coeficients should be interpolated. GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC is default.

### GST_AUDIO_RESAMPLER_OPT_FILTER_MODE

    #define GST_AUDIO_RESAMPLER_OPT_FILTER_MODE      "GstAudioResampler.filter-mode"

GST_TYPE_AUDIO_RESAMPLER_FILTER_MODE: how the filter tables should be constructed. GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO is the default.

### GST_AUDIO_RESAMPLER_OPT_FILTER_MODE_THRESHOLD

    #define GST_AUDIO_RESAMPLER_OPT_FILTER_MODE_THRESHOLD "GstAudioResampler.filter-mode-threshold"

G_TYPE_UINT: the amount of memory to use for full filter tables before switching to interpolated filter tables. 1048576 is the default.

### GST_AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE

    #define GST_AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE "GstAudioResampler.filter-oversample"

G_TYPE_UINT, oversampling to use when interpolating filters 8 is the default.

### GST_AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR

    #define GST_AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR "GstAudioResampler.max-phase-error"

G_TYPE_DOUBLE: The maximum allowed phase error when switching sample rates. 0.1 is the default.

### GST_AUDIO_RESAMPLER_OPT_N_TAPS

    #define GST_AUDIO_RESAMPLER_OPT_N_TAPS      "GstAudioResampler.n-taps"

G_TYPE_INT: the number of taps to use for the filter. 0 is the default and selects the taps automatically.

### GST_AUDIO_RESAMPLER_OPT_STOP_ATTENUATION

    #define GST_AUDIO_RESAMPLER_OPT_STOP_ATTENUATION "GstAudioResampler.stop-attenutation"

G_TYPE_DOUBLE, stopband attenuation in decibels. The attenuation after the stopband for the kaiser window. 85 dB is the default.

### GST_AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH

    #define GST_AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH "GstAudioResampler.transition-bandwidth"

G_TYPE_DOUBLE, transition bandwidth. The width of the transition band for the kaiser window. 0.087 is the default.

### GST_AUDIO_RESAMPLER_QUALITY_DEFAULT

    #define GST_AUDIO_RESAMPLER_QUALITY_DEFAULT 4

### GST_AUDIO_RESAMPLER_QUALITY_MAX

    #define GST_AUDIO_RESAMPLER_QUALITY_MAX 10

### GST_AUDIO_RESAMPLER_QUALITY_MIN

    #define GST_AUDIO_RESAMPLER_QUALITY_MIN 0