Module: GstAudio
- Defined in:
- lib/gst/audio-loader.rb
Overview
Copyright (C) 2024 Ruby-GNOME Project Team
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Defined Under Namespace
Modules: AudioBaseSinkDiscontReason, AudioBaseSinkSlaveMethod, AudioBaseSrcSlaveMethod, AudioCdSrcMode, AudioChannelMixerFlags, AudioChannelPosition, AudioConverterFlags, AudioDitherMethod, AudioFlags, AudioFormat, AudioFormatFlags, AudioLayout, AudioNoiseShapingMethod, AudioPackFlags, AudioQuantizeFlags, AudioResamplerFilterInterpolation, AudioResamplerFilterMode, AudioResamplerFlags, AudioResamplerMethod, AudioRingBufferFormatType, AudioRingBufferState, DsdFormat, StreamVolume, StreamVolumeFormat Classes: AudioAggregator, AudioAggregatorConvertPad, AudioAggregatorPad, AudioBaseSink, AudioBaseSrc, AudioCdSrc, AudioClock, AudioDecoder, AudioEncoder, AudioFilter, AudioRingBuffer, AudioSink, AudioSrc, Loader
Constant Summary collapse
- AUDIO_CHANNELS_RANGE =
Maximum range of allowed channels, for use in template caps strings.
(int) [ 1, max ]
- AUDIO_CONVERTER_OPT_DITHER_METHOD =
Gst::AudioDitherMethod, The dither method to use when changing bit depth. Default is #GST_AUDIO_DITHER_NONE.
GstAudioConverter.dither-method
- AUDIO_CONVERTER_OPT_DITHER_THRESHOLD =
Threshold for the output bit depth at/below which to apply dithering.
Default is 20 bit.
GstAudioConverter.dither-threshold
- AUDIO_CONVERTER_OPT_MIX_MATRIX =
#GST_TYPE_LIST, The channel mapping matrix.
The matrix coefficients must be between -1 and 1: the number of rows is equal to the number of output channels and the number of columns is equal to the number of input channels.
Example matrix generation code
To generate the matrix using code:
|[ GValue v = G_VALUE_INIT; GValue v2 = G_VALUE_INIT; GValue v3 = G_VALUE_INIT;
g_value_init (&v2, GST_TYPE_ARRAY); g_value_init (&v3, G_TYPE_DOUBLE); g_value_set_double (&v3, 1); gst_value_array_append_value (&v2, &v3); g_value_unset (&v3); [ Repeat for as many double as your input channels - unset and reinit v3 ] g_value_init (&v, GST_TYPE_ARRAY); gst_value_array_append_value (&v, &v2); g_value_unset (&v2); [ Repeat for as many v2's as your output channels - unset and reinit v2] g_object_set_property (G_OBJECT (audiomixmatrix), "matrix", &v); g_value_unset (&v); ]|
GstAudioConverter.mix-matrix
- AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD =
Gst::AudioNoiseShapingMethod, The noise shaping method to use to mask noise from quantization errors. Default is #GST_AUDIO_NOISE_SHAPING_NONE.
GstAudioConverter.noise-shaping-method
- AUDIO_CONVERTER_OPT_QUANTIZATION =
#G_TYPE_UINT, The quantization amount. Components will be quantized to multiples of this value. Default is 1
GstAudioConverter.quantization
- AUDIO_CONVERTER_OPT_RESAMPLER_METHOD =
Gst::AudioResamplerMethod, The resampler method to use when changing sample rates. Default is #GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL.
GstAudioConverter.resampler-method
- AUDIO_DECODER_MAX_ERRORS =
Default maximum number of errors tolerated before signaling error.
-1
- AUDIO_DECODER_SINK_NAME =
The name of the templates for the sink pad.
sink- AUDIO_DECODER_SRC_NAME =
The name of the templates for the source pad.
src- AUDIO_DEF_CHANNELS =
Standard number of channels used in consumer audio.
2- AUDIO_DEF_FORMAT =
Standard format used in consumer audio.
S16LE- AUDIO_DEF_RATE =
Standard sampling rate used in consumer audio.
44100- AUDIO_ENCODER_SINK_NAME =
the name of the templates for the sink pad
sink- AUDIO_ENCODER_SRC_NAME =
the name of the templates for the source pad
src- AUDIO_FORMATS_ALL =
List of all audio formats, for use in template caps strings.
Formats are sorted by decreasing "quality", using these criteria by priority:
- depth
- width
- Float > Signed > Unsigned
- native endianness preferred
{ F64BE, F64LE, F32BE, F32LE, S32BE, S32LE, U32BE, U32LE, S24_32BE, S24_32LE, U24_32BE, U24_32LE, S24BE, S24LE, U24BE, U24LE, S20BE, S20LE, U20BE, U20LE, S18BE, S18LE, U18BE, U18LE, S16BE, S16LE, U16BE, U16LE, S8, U8 }- AUDIO_RATE_RANGE =
Maximum range of allowed sample rates, for use in template caps strings.
(int) [ 1, max ]
- AUDIO_RESAMPLER_OPT_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
GstAudioResampler.cubic-b
- AUDIO_RESAMPLER_OPT_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
GstAudioResampler.cubic-c
- AUDIO_RESAMPLER_OPT_CUTOFF =
G_TYPE_DOUBLE, Cutoff parameter for the filter. 0.940 is the default.
GstAudioResampler.cutoff
- AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION =
GST_TYPE_AUDIO_RESAMPLER_INTERPOLATION: how the filter coefficients should be interpolated. GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC is default.
GstAudioResampler.filter-interpolation
- AUDIO_RESAMPLER_OPT_FILTER_MODE =
GST_TYPE_AUDIO_RESAMPLER_FILTER_MODE: how the filter tables should be constructed. GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO is the default.
GstAudioResampler.filter-mode
- AUDIO_RESAMPLER_OPT_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.
GstAudioResampler.filter-mode-threshold
- AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE =
G_TYPE_UINT, oversampling to use when interpolating filters 8 is the default.
GstAudioResampler.filter-oversample
- AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR =
G_TYPE_DOUBLE: The maximum allowed phase error when switching sample rates. 0.1 is the default.
GstAudioResampler.max-phase-error
- AUDIO_RESAMPLER_OPT_N_TAPS =
G_TYPE_INT: the number of taps to use for the filter. 0 is the default and selects the taps automatically.
GstAudioResampler.n-taps
- AUDIO_RESAMPLER_OPT_STOP_ATTENUATION =
G_TYPE_DOUBLE, stopband attenuation in decibels. The attenuation after the stopband for the kaiser window. 85 dB is the default.
GstAudioResampler.stop-attenutation
- AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH =
G_TYPE_DOUBLE, transition bandwidth. The width of the transition band for the kaiser window. 0.087 is the default.
GstAudioResampler.transition-bandwidth
- AUDIO_RESAMPLER_QUALITY_DEFAULT =
4- AUDIO_RESAMPLER_QUALITY_MAX =
10- AUDIO_RESAMPLER_QUALITY_MIN =
0- DSD_FORMATS_ALL =
List of all DSD formats, for use in template caps strings.
Big endian formats are preferred, since little-endian ones flip around the DSD bytes, and most DSD hardware uses big endian formats.
{ DSDU32BE, DSDU16BE, DSDU8, DSDU32LE, DSDU16LE }- DSD_MEDIA_TYPE =
The GStreamer media type for DSD.
audio/x-dsd
- DSD_SILENCE_PATTERN_BYTE =
Silence pattern for DSD data.
In DSD, a nullbyte does not correspond to silence. To fill memory regions with "DSD silence", these regions must be filled with byte 0x69 instead (this is the DSD silence pattern). This constant provides that pattern in a more readable fashion.
105- META_TAG_AUDIO_CHANNELS_STR =
This metadata stays relevant as long as channels are unchanged.
channels- META_TAG_AUDIO_RATE_STR =
This metadata stays relevant as long as sample rate is unchanged.
rate- META_TAG_AUDIO_STR =
This metadata is relevant for audio streams.
audio- META_TAG_DSD_PLANE_OFFSETS_STR =
This metadata stays relevant as long as the DSD plane offsets are unchanged.
dsdplaneoffsets
Instance Method Summary collapse
-
#audio_buffer_clip(buffer, segment, rate, bpf) ⇒ Gst::Buffer
Clip the buffer to the given %GstSegment.
-
#audio_buffer_map(buffer, info, gstbuffer, flags) ⇒ Boolean
Maps an audio gstbuffer so that it can be read or written and stores the result of the map operation in buffer.
-
#audio_buffer_reorder_channels(buffer, format, channels, from, to) ⇒ Boolean
Reorders buffer from the channel positions from to the channel positions to.
-
#audio_buffer_truncate(buffer, bpf, trim, samples) ⇒ Gst::Buffer
Truncate the buffer to finally have samples number of samples, removing the necessary amount of samples from the end and trim number of samples from the beginning.
-
#audio_channel_get_fallback_mask(channels) ⇒ Integer
Get the fallback channel-mask for the given number of channels.
-
#audio_channel_mixer_new(flags, format, in_channels, in_position, out_channels, out_position) ⇒ GstAudio::AudioChannelMixer
Create a new channel mixer object for the given parameters.
-
#audio_channel_mixer_new_with_matrix(flags, format, in_channels, out_channels, matrix) ⇒ GstAudio::AudioChannelMixer
Create a new channel mixer object for the given parameters.
-
#audio_channel_positions_from_mask(channels, channel_mask, position) ⇒ Boolean
Convert the channels present in channel_mask to a position array (which should have at least channels entries ensured by caller).
-
#audio_channel_positions_to_mask(position, channels, force_order, channel_mask) ⇒ Boolean
Convert the position array of channels channels to a bitmask.
-
#audio_channel_positions_to_string(position, channels) ⇒ String
Converts position to a human-readable string representation for debugging purposes.
-
#audio_channel_positions_to_valid_order(position, channels) ⇒ Boolean
Reorders the channel positions in position from any order to the GStreamer channel order.
-
#audio_check_valid_channel_positions(position, channels, force_order) ⇒ Boolean
Checks if position contains valid channel positions for channels channels.
- #audio_clipping_meta_api_get_type ⇒ GLib::Type
- #audio_clipping_meta_get_info ⇒ Gst::MetaInfo
- #audio_downmix_meta_api_get_type ⇒ GLib::Type
- #audio_downmix_meta_get_info ⇒ Gst::MetaInfo
-
#audio_format_build_integer(sign, endianness, width, depth) ⇒ GstAudio::AudioFormat
Construct a Gst::AudioFormat with given parameters.
-
#audio_format_fill_silence(info, dest, length) ⇒ nil
Fill length bytes in dest with silence samples for info.
-
#audio_format_from_string(format) ⇒ GstAudio::AudioFormat
Convert the format string to its Gst::AudioFormat.
-
#audio_format_get_info(format) ⇒ GstAudio::AudioFormatInfo
Get the Gst::AudioFormatInfo for format.
- #audio_format_info_get_type ⇒ GLib::Type
- #audio_format_to_string(format) ⇒ String
-
#audio_formats_raw(len) ⇒ Array<GstAudio::AudioFormat>
Return all the raw audio formats supported by GStreamer.
-
#audio_get_channel_reorder_map(channels, from, to, reorder_map) ⇒ Boolean
Returns a reorder map for from to to that can be used in custom channel reordering code, e.g.
-
#audio_iec61937_frame_size(spec) ⇒ Integer
Calculated the size of the buffer expected by gst_audio_iec61937_payload() for payloading type from spec.
-
#audio_iec61937_payload(src, src_n, dst, dst_n, spec, endianness) ⇒ Boolean
Payloads src in the form specified by IEC 61937 for the type from spec and stores the result in dst.
-
#audio_info_from_caps(info, caps) ⇒ Boolean
Parse caps and update info.
-
#audio_info_init(info) ⇒ nil
Initialize info with default values.
-
#audio_level_meta_api_get_type ⇒ GLib::Type
Return the #GType associated with Gst::AudioLevelMeta.
-
#audio_level_meta_get_info ⇒ Gst::MetaInfo
Return the Gst::MetaInfo associated with #GstAudioLevelMeta.
-
#audio_make_raw_caps(formats, len, layout) ⇒ Gst::Caps
Return a generic raw audio caps for formats defined in formats.
- #audio_meta_api_get_type ⇒ GLib::Type
- #audio_meta_get_info ⇒ Gst::MetaInfo
-
#audio_quantize_new(dither, ns, flags, format, channels, quantizer) ⇒ GstAudio::AudioQuantize
Create a new quantizer object with the given parameters.
-
#audio_reorder_channels(data, size, format, channels, from, to) ⇒ Boolean
Reorders data from the channel positions from to the channel positions to.
-
#audio_resampler_new(method, flags, format, channels, in_rate, out_rate, options) ⇒ GstAudio::AudioResampler
Make a new resampler.
-
#audio_resampler_options_set_quality(method, quality, in_rate, out_rate, options) ⇒ nil
Set the parameters for resampling from in_rate to out_rate using method for quality in options.
-
#buffer_add_audio_clipping_meta(buffer, format, start, end) ⇒ GstAudio::AudioClippingMeta
Attaches Gst::AudioClippingMeta metadata to buffer with the given parameters.
-
#buffer_add_audio_downmix_meta(buffer, from_position, from_channels, to_position, to_channels, matrix) ⇒ GstAudio::AudioDownmixMeta
Attaches Gst::AudioDownmixMeta metadata to buffer with the given parameters.
-
#buffer_add_audio_level_meta(buffer, level, voice_activity) ⇒ GstAudio::AudioLevelMeta
Attaches audio level information to buffer.
-
#buffer_add_audio_meta(buffer, info, samples, offsets) ⇒ GstAudio::AudioMeta
Allocates and attaches a Gst::AudioMeta on buffer, which must be writable for that purpose.
-
#buffer_add_dsd_plane_offset_meta(buffer, num_channels, num_bytes_per_channel, offsets) ⇒ GstAudio::DsdPlaneOffsetMeta
Allocates and attaches a Gst::DsdPlaneOffsetMeta on buffer, which must be writable for that purpose.
-
#buffer_get_audio_downmix_meta_for_channels(buffer, to_position, to_channels) ⇒ GstAudio::AudioDownmixMeta
Find the Gst::AudioDownmixMeta on buffer for the given destination channel positions.
-
#buffer_get_audio_level_meta(buffer) ⇒ GstAudio::AudioLevelMeta
Find the Gst::AudioLevelMeta on buffer.
-
#dsd_convert(input_data, output_data, input_format, output_format, input_layout, output_layout, input_plane_offsets, output_plane_offsets, num_dsd_bytes, num_channels, reverse_byte_bits) ⇒ nil
Converts DSD data from one layout and grouping format to another.
-
#dsd_format_from_string(str) ⇒ GstAudio::DsdFormat
Convert the DSD format string str to its Gst::DsdFormat.
-
#dsd_format_get_width(format) ⇒ Integer
Number of bytes in this DSD grouping format.
-
#dsd_format_to_string(format) ⇒ String
Returns a string containing a descriptive name for the Gst::DsdFormat if there is one, or NULL otherwise.
-
#dsd_info_from_caps(info, caps) ⇒ Boolean
Parse caps and update info.
-
#dsd_info_init(info) ⇒ nil
Initialize info with default values.
- #dsd_plane_offset_meta_api_get_type ⇒ GLib::Type
- #dsd_plane_offset_meta_get_info ⇒ Gst::MetaInfo
-
#stream_volume_convert_volume(from, to, val) ⇒ Float
The converted volume.
Instance Method Details
#audio_buffer_clip(buffer, segment, rate, bpf) ⇒ Gst::Buffer
Clip the buffer to the given %GstSegment.
After calling this function the caller does not own a reference to buffer anymore. number of channels. otherwise the clipped buffer is returned.
If the buffer has no timestamp, it is assumed to be inside the segment and is not clipped
#audio_buffer_map(buffer, info, gstbuffer, flags) ⇒ Boolean
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 Gst::AudioMeta in order to map each channel in a separate "plane" in Gst::AudioBuffer. If a #GstAudioMeta is not attached on the gstbuffer, then it must be in interleaved layout.
If a Gst::AudioMeta 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 Gst::AudioInfo from the meta will be used.
In non-interleaved buffers, it is possible to have each channel on a separate Gst::Memory. 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 Gst::Memory 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 Gst::Buffer is not ref'ed, but it is required to stay valid as long as it's mapped.
#audio_buffer_reorder_channels(buffer, format, channels, from, to) ⇒ Boolean
Reorders buffer from the channel positions from to the channel positions to. from and to must contain the same number of positions and the same positions, only in a different order. buffer must be writable.
#audio_buffer_truncate(buffer, bpf, trim, samples) ⇒ Gst::Buffer
Truncate the buffer to finally have samples number of samples, removing the necessary amount of samples from the end and trim number of samples from the beginning.
This function does not know the audio rate, therefore the caller is responsible for re-setting the correct timestamp and duration to the buffer. However, timestamp will be preserved if trim == 0, and duration will also be preserved if there is no trimming to be done. Offset and offset end will be preserved / updated.
After calling this function the caller does not own a reference to buffer anymore. number of channels. to use all the remaining samples if you are only removing samples from the beginning.
#audio_channel_get_fallback_mask(channels) ⇒ Integer
Get the fallback channel-mask for the given number of channels.
This function returns a reasonable fallback channel-mask and should be called as a last resort when the specific channel map is unknown. mask and mono.
#audio_channel_mixer_new(flags, format, in_channels, in_position, out_channels, out_position) ⇒ GstAudio::AudioChannelMixer
Create a new channel mixer object for the given parameters.
#audio_channel_mixer_new_with_matrix(flags, format, in_channels, out_channels, matrix) ⇒ GstAudio::AudioChannelMixer
Create a new channel mixer object for the given parameters.
#audio_channel_positions_from_mask(channels, channel_mask, position) ⇒ Boolean
Convert the channels present in channel_mask to a position array (which should have at least channels entries ensured by caller). If channel_mask is set to 0, it is considered as 'not present' for purpose of conversion. A partially valid channel_mask with less bits set than the number of channels is considered valid.
#audio_channel_positions_to_mask(position, channels, force_order, channel_mask) ⇒ Boolean
Convert the position array of channels channels to a bitmask.
If force_order is true it additionally checks if the channels are in the order required by GStreamer.
#audio_channel_positions_to_string(position, channels) ⇒ String
Converts position to a human-readable string representation for debugging purposes. position
#audio_channel_positions_to_valid_order(position, channels) ⇒ Boolean
Reorders the channel positions in position from any order to the GStreamer channel order. was successful.
#audio_check_valid_channel_positions(position, channels, force_order) ⇒ Boolean
Checks if position contains valid channel positions for channels channels. If force_order is true it additionally checks if the channels are in the order required by GStreamer.
#audio_clipping_meta_api_get_type ⇒ GLib::Type
#audio_clipping_meta_get_info ⇒ Gst::MetaInfo
#audio_downmix_meta_api_get_type ⇒ GLib::Type
#audio_downmix_meta_get_info ⇒ Gst::MetaInfo
#audio_format_build_integer(sign, endianness, width, depth) ⇒ GstAudio::AudioFormat
Construct a Gst::AudioFormat with given parameters. exists with the given parameters.
#audio_format_fill_silence(info, dest, length) ⇒ nil
Fill length bytes in dest with silence samples for info.
#audio_format_from_string(format) ⇒ GstAudio::AudioFormat
Convert the format string to its Gst::AudioFormat. string is not a known format.
#audio_format_get_info(format) ⇒ GstAudio::AudioFormatInfo
Get the Gst::AudioFormatInfo for format
#audio_format_info_get_type ⇒ GLib::Type
#audio_format_to_string(format) ⇒ String
#audio_formats_raw(len) ⇒ Array<GstAudio::AudioFormat>
Return all the raw audio formats supported by GStreamer.
#audio_get_channel_reorder_map(channels, from, to, reorder_map) ⇒ Boolean
Returns a reorder map for from to to that can be used in custom channel reordering code, e.g. to convert from or to the GStreamer channel order. from and to must contain the same number of positions and the same positions, only in a different order.
The resulting reorder_map can be used for reordering by assigning channel i of the input to channel reorder_map[i] of the output. is possible.
#audio_iec61937_frame_size(spec) ⇒ Integer
Calculated the size of the buffer expected by gst_audio_iec61937_payload() for payloading type from spec. payloaded.
#audio_iec61937_payload(src, src_n, dst, dst_n, spec, endianness) ⇒ Boolean
Payloads src in the form specified by IEC 61937 for the type from spec and stores the result in dst. src must contain exactly one frame of data and the frame is not checked for errors. otherwise.
#audio_info_from_caps(info, caps) ⇒ Boolean
Parse caps and update info.
#audio_info_init(info) ⇒ nil
Initialize info with default values.
#audio_level_meta_api_get_type ⇒ GLib::Type
Return the #GType associated with Gst::AudioLevelMeta.
#audio_level_meta_get_info ⇒ Gst::MetaInfo
Return the Gst::MetaInfo associated with #GstAudioLevelMeta.
#audio_make_raw_caps(formats, len, layout) ⇒ Gst::Caps
Return a generic raw audio caps for formats defined in formats. If formats is nil returns a caps for all the supported raw audio formats, see gst_audio_formats_raw().
#audio_meta_api_get_type ⇒ GLib::Type
#audio_meta_get_info ⇒ Gst::MetaInfo
#audio_quantize_new(dither, ns, flags, format, channels, quantizer) ⇒ GstAudio::AudioQuantize
Create a new quantizer object with the given parameters.
Output samples will be quantized to a multiple of quantizer. Better performance is achieved when quantizer is a power of 2.
Dithering and noise-shaping can be performed during quantization with the dither and ns parameters.
#audio_reorder_channels(data, size, format, channels, from, to) ⇒ Boolean
Reorders data from the channel positions from to the channel positions to. from and to must contain the same number of positions and the same positions, only in a different order.
Note: this function assumes the audio data is in interleaved layout
#audio_resampler_new(method, flags, format, channels, in_rate, out_rate, options) ⇒ GstAudio::AudioResampler
Make a new resampler.
#audio_resampler_options_set_quality(method, quality, in_rate, out_rate, options) ⇒ nil
Set the parameters for resampling from in_rate to out_rate using method for quality in options.
#buffer_add_audio_clipping_meta(buffer, format, start, end) ⇒ GstAudio::AudioClippingMeta
Attaches Gst::AudioClippingMeta metadata to buffer with the given parameters.
#buffer_add_audio_downmix_meta(buffer, from_position, from_channels, to_position, to_channels, matrix) ⇒ GstAudio::AudioDownmixMeta
Attaches Gst::AudioDownmixMeta metadata to buffer with the given parameters.
matrix is an two-dimensional array of to_channels times from_channels coefficients, i.e. the i-th output channels is constructed by multiplicating the input channels with the coefficients in matrix[i] and taking the sum of the results.
#buffer_add_audio_level_meta(buffer, level, voice_activity) ⇒ GstAudio::AudioLevelMeta
Attaches audio level information to buffer. (RFC 6464)
#buffer_add_audio_meta(buffer, info, samples, offsets) ⇒ GstAudio::AudioMeta
Allocates and attaches a Gst::AudioMeta on buffer, which must be writable for that purpose. The fields of the Gst::AudioMeta are directly populated from the arguments of this function.
When info->layout is %GST_AUDIO_LAYOUT_NON_INTERLEAVED and offsets is nil, 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.
#buffer_add_dsd_plane_offset_meta(buffer, num_channels, num_bytes_per_channel, offsets) ⇒ GstAudio::DsdPlaneOffsetMeta
Allocates and attaches a Gst::DsdPlaneOffsetMeta on buffer, which must be writable for that purpose. The fields of the Gst::DsdPlaneOffsetMeta are directly populated from the arguments of this function.
If offsets is NULL, then the meta's offsets field is left uninitialized. This is useful if for example offset values are to be calculated in the meta's offsets field in-place. Similarly, num_bytes_per_channel can be set to 0, but only if offsets is NULL. This is useful if the number of bytes per channel is known only later.
It is not allowed for channels to overlap in memory, i.e. for each i in [0, channels), the range [offsets[i], offsets[i] + num_bytes_per_channel) 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.
This meta is only needed for non-interleaved (= planar) DSD data.
#buffer_get_audio_downmix_meta_for_channels(buffer, to_position, to_channels) ⇒ GstAudio::AudioDownmixMeta
Find the Gst::AudioDownmixMeta on buffer for the given destination channel positions.
#buffer_get_audio_level_meta(buffer) ⇒ GstAudio::AudioLevelMeta
Find the Gst::AudioLevelMeta on buffer. there is no such metadata on buffer.
#dsd_convert(input_data, output_data, input_format, output_format, input_layout, output_layout, input_plane_offsets, output_plane_offsets, num_dsd_bytes, num_channels, reverse_byte_bits) ⇒ nil
Converts DSD data from one layout and grouping format to another. num_bytes must be an integer multiple of the width of both input and output format. For example, if the input format is GST_DSD_FORMAT_U32LE, and the output format is GST_DSD_FORMAT_U16BE, then num_bytes must be an integer multiple of both 4 (U32LE width) and 2 (U16BE width).
reverse_byte_bits is necessary if the bit order within the DSD bytes needs to be reversed. This is rarely necessary, and is not to be confused with the endianness of formats (which determines the ordering of bytes).
input_plane_offsets must not be NULL if input_layout is set to #GST_AUDIO_LAYOUT_NON_INTERLEAVED. The same applies to output_plane_offsets. These plane offsets define the starting offset of the planes (there is exactly one plane per channel) within input_data and output_data respectively. If GST_AUDIO_LAYOUT_INTERLEAVED is used, the plane offsets are ignored.
#dsd_format_from_string(str) ⇒ GstAudio::DsdFormat
Convert the DSD format string str to its Gst::DsdFormat. string is not a known format.
#dsd_format_get_width(format) ⇒ Integer
Returns Number of bytes in this DSD grouping format.
#dsd_format_to_string(format) ⇒ String
Returns a string containing a descriptive name for the Gst::DsdFormat if there is one, or NULL otherwise.
#dsd_info_from_caps(info, caps) ⇒ Boolean
Parse caps and update info.
#dsd_info_init(info) ⇒ nil
Initialize info with default values.
#dsd_plane_offset_meta_api_get_type ⇒ GLib::Type
#dsd_plane_offset_meta_get_info ⇒ Gst::MetaInfo
#stream_volume_convert_volume(from, to, val) ⇒ Float
Returns the converted volume.