AudioBuffer.map

Maps an audio gstbuffer so that it can be read or written and stores the result of the map operation in buffer.

This is especially useful when the gstbuffer is in non-interleaved (planar) layout, in which case this function will use the information in the gstbuffer's attached #GstAudioMeta in order to map each channel in a separate "plane" in #GstAudioBuffer. If a #GstAudioMeta is not attached on the gstbuffer, then it must be in interleaved layout.

If a #GstAudioMeta is attached, then the #GstAudioInfo on the meta is checked against info. Normally, they should be equal, but in case they are not, a g_critical will be printed and the #GstAudioInfo from the meta will be used.

In non-interleaved buffers, it is possible to have each channel on a separate #GstMemory. In this case, each memory will be mapped separately to avoid copying their contents in a larger memory area. Do note though that it is not supported to have a single channel spanning over two or more different #GstMemory objects. Although the map operation will likely succeed in this case, it will be highly sub-optimal and it is recommended to merge all the memories in the buffer before calling this function.

Note

The actual #GstBuffer is not ref'ed, but it is required to stay valid

as long as it's mapped.

Parameters

bufferpointer to a #GstAudioBuffer
infothe audio properties of the buffer
gstbufferthe #GstBuffer to be mapped
flagsthe access mode for the memory

Returns

true if the map operation succeeded or false on failure