Function

GstAudio-1.0GstAudiobuffer_add_audio_metaSince 1.16

  • Allocates and attaches a GstAudio.AudioMeta on buffer, which must be writable for that purpose. The fields of the GstAudio.AudioMeta are directly populated from the arguments of this function.

    When info->layout is GstAudio.AudioLayout.NON_INTERLEAVED and offsets is null, the offsets are calculated with a formula that assumes the planes are tightly packed and in sequence: offsets[channel] = channel * samples * sample_stride

    It is not allowed for channels to overlap in memory, i.e. for each i in [0, channels), the range [offsets[i], offsets[i] + samples * sample_stride) must not overlap with any other such range. This function will assert if the parameters specified cause this restriction to be violated.

    It is, obviously, also not allowed to specify parameters that would cause out-of-bounds memory access on buffer. This is also checked, which means that you must add enough memory on the buffer before adding this meta.

    Parameters

    • buffer: Gst.Buffer
    • info: AudioInfo

      the audio properties of the buffer

    • samples: number

      the number of valid samples in the buffer

    • Optionaloffsets: number[]

      the offsets (in bytes) where each channel plane starts in the buffer or null to calculate it (see below); must be null also when info->layout is GstAudio.AudioLayout.INTERLEAVED

    Returns AudioMeta

    the GstAudio.AudioMeta that was attached on the buffer

    1.16